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