/
GHanLabel.h
87 lines (67 loc) · 2.29 KB
/
GHanLabel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//// GHanLabel.h /////////////////////////////////////////////////////////////////////////////
//
// Korea Johab Hangul Label Class
// This class will allow you to use images files as buttons in wxWidgets.
// It supports the basic button image, mouse over image, and click image.
////////////////////////////////////////////////////////////////////////////////////////////
#ifndef GHANLABEL_H
#define GHANLABEL_H
#include <wx/panel.h>
#include <wx/dcbuffer.h>
#include <wx/msgdlg.h>
#include <wx/image.h>
/////////////////////////////////////////
class GHanLabelEvent: public wxCommandEvent
{
public:
GHanLabelEvent(wxEventType commandType = wxEVT_NULL, int id = 0 );
virtual wxEvent *Clone() const { return new GHanLabelEvent(*this); }
private:
DECLARE_DYNAMIC_CLASS(GHanLabelEvent)
};
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EVENT_TYPE(wxEVT_COMMAND_GHANLABEL, -1)
END_DECLARE_EVENT_TYPES()
typedef void (wxEvtHandler::*wxGHanLabelEventFunction)(GHanLabelEvent&);
#define EVT_GHANLABEL(id, fn) \
DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_GHANLABEL, id, -1, \
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) \
wxStaticCastEvent(wxGHanLabelEventFunction, & fn), (wxObject *) NULL ),
/////////////////////////////
class GHanLabel: public wxPanel
{
public:
GHanLabel(wxWindow* parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, char *text,
const wxColour &fg, const wxColour &bg);
// Destructor
virtual ~GHanLabel();
void InitHangul();
// Creators
bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size);
void SetLabel(char *text);
void SetRangeColour(int from, int to, wxColour fg, wxColour bg);
bool focused;
private:
void DrawHangul(wxDC &dc);
void OnEraseBackground(wxEraseEvent& event);
void OnPaint(wxPaintEvent &event);
void OnMouse(wxMouseEvent &event);
bool allowHover;
bool allowClick;
bool allowFocused;
wxBitmap c_button;
wxBitmap c_hover;
wxBitmap c_click;
wxBitmap c_focusedButton;
wxBitmap c_focusedHover;
wxBitmap c_focusedClick;
bool hover;
bool click;
Hangul *m_han;
char *m_text;
wxColour m_bg;
wxColour m_fg;
DECLARE_EVENT_TABLE()
};
#endif //GHANLABEL_H