]> git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/gizmos/ledctrl.h
XMLID->XRCID, XMLCTRL->XRCCTRL
[wxWidgets.git] / contrib / include / wx / gizmos / ledctrl.h
1 #ifndef _WX_LEDNUMBERCTRL_H_
2 #define _WX_LEDNUMBERCTRL_H_
3
4 #ifdef __GNUG__
5 #pragma interface "wxLEDNumberCtrl.h"
6 #endif
7
8 #ifdef GIZMOISDLL
9 #define GIZMODLLEXPORT WXDLLEXPORT
10 #else
11 #define GIZMODLLEXPORT
12 #endif
13
14
15 #include <wx/window.h>
16 #include <wx/control.h>
17
18 class wxEraseEvent;
19 class wxPaintEvent;
20 class wxSizeEvent;
21
22 // ----------------------------------------------------------------------------
23 // enum and styles
24 // ----------------------------------------------------------------------------
25
26 enum wxLEDValueAlign
27 {
28 wxLED_ALIGN_LEFT = 0x01,
29 wxLED_ALIGN_RIGHT = 0x02,
30 wxLED_ALIGN_CENTER = 0x04,
31
32 wxLED_ALIGN_MASK = 0x04
33 };
34
35 #define wxLED_DRAW_FADED 0x08
36
37 // ----------------------------------------------------------------------------
38 // wxLEDNumberCtrl
39 // ----------------------------------------------------------------------------
40
41 class GIZMODLLEXPORT wxLEDNumberCtrl : public wxControl
42 {
43 public:
44 // Constructors.
45 wxLEDNumberCtrl();
46 wxLEDNumberCtrl(wxWindow *parent, wxWindowID id = -1,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
49 long style = wxLED_ALIGN_LEFT | wxLED_DRAW_FADED);
50
51 // Create functions.
52 bool Create(wxWindow *parent, wxWindowID id = -1,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 long style = 0);
56
57 wxLEDValueAlign GetAlignment() const { return m_Alignment; }
58 bool GetDrawFaded() const { return m_DrawFaded; }
59 const wxString &GetValue() const { return m_Value; }
60
61 void SetAlignment(wxLEDValueAlign Alignment, bool Redraw = TRUE);
62 void SetDrawFaded(bool DrawFaded, bool Redraw = TRUE);
63 void SetValue(const wxString &Value, bool Redraw = TRUE);
64
65 private:
66 // Members.
67 wxString m_Value;
68 wxLEDValueAlign m_Alignment;
69
70 int m_LineMargin;
71 int m_DigitMargin;
72 int m_LineLength;
73 int m_LineWidth;
74 bool m_DrawFaded;
75 int m_LeftStartPos;
76
77 // Functions.
78 void DrawDigit(wxDC &Dc, int Digit, int Column);
79 void RecalcInternals(const wxSize &CurrentSize);
80
81 // Events.
82 DECLARE_EVENT_TABLE()
83
84 void OnEraseBackground(wxEraseEvent &Event);
85 void OnPaint(wxPaintEvent &Event);
86 void OnSize(wxSizeEvent &Event);
87 };
88
89 #endif