]>
Commit | Line | Data |
---|---|---|
1db8dc4a VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/gtk/tglbtn.h | |
3 | // Purpose: Declaration of the wxToggleButton class, which implements a | |
4 | // toggle button under wxGTK. | |
5 | // Author: John Norris, minor changes by Axel Schlueter | |
6 | // Modified by: | |
7 | // Created: 08.02.01 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2000 Johnny C. Norris II | |
706fb893 | 10 | // License: wxWindows licence |
1db8dc4a VZ |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | ||
13 | #ifndef _WX_GTK_TOGGLEBUTTON_H_ | |
14 | #define _WX_GTK_TOGGLEBUTTON_H_ | |
15 | ||
4f856067 RR |
16 | #include "wx/bitmap.h" |
17 | ||
1db8dc4a VZ |
18 | //----------------------------------------------------------------------------- |
19 | // classes | |
20 | //----------------------------------------------------------------------------- | |
21 | ||
20123d49 MW |
22 | class WXDLLIMPEXP_CORE wxToggleButton; |
23 | class WXDLLIMPEXP_CORE wxToggleBitmapButton; | |
1db8dc4a VZ |
24 | |
25 | //----------------------------------------------------------------------------- | |
26 | // global data | |
27 | //----------------------------------------------------------------------------- | |
28 | ||
63ec432b | 29 | extern WXDLLIMPEXP_CORE const wxChar wxCheckBoxNameStr[]; |
1db8dc4a | 30 | |
4f856067 RR |
31 | //----------------------------------------------------------------------------- |
32 | // wxToggleBitmapButton | |
33 | //----------------------------------------------------------------------------- | |
34 | ||
20123d49 | 35 | class WXDLLIMPEXP_CORE wxToggleBitmapButton: public wxControl |
4f856067 RR |
36 | { |
37 | public: | |
38 | // construction/destruction | |
39 | wxToggleBitmapButton() {} | |
40 | wxToggleBitmapButton(wxWindow *parent, | |
41 | wxWindowID id, | |
42 | const wxBitmap& label, | |
43 | const wxPoint& pos = wxDefaultPosition, | |
44 | const wxSize& size = wxDefaultSize, | |
45 | long style = 0, | |
46 | const wxValidator& validator = wxDefaultValidator, | |
47 | const wxString& name = wxCheckBoxNameStr) | |
48 | { | |
49 | Create(parent, id, label, pos, size, style, validator, name); | |
50 | } | |
51 | ||
52 | // Create the control | |
53 | bool Create(wxWindow *parent, | |
54 | wxWindowID id, | |
55 | const wxBitmap& label, | |
56 | const wxPoint& pos = wxDefaultPosition, | |
57 | const wxSize& size = wxDefaultSize, long style = 0, | |
58 | const wxValidator& validator = wxDefaultValidator, | |
59 | const wxString& name = wxCheckBoxNameStr); | |
60 | ||
61 | // Get/set the value | |
62 | void SetValue(bool state); | |
63 | bool GetValue() const; | |
64 | ||
65 | // Set the label | |
17a1ebd1 VZ |
66 | virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); } |
67 | virtual void SetLabel(const wxBitmap& label); | |
4f856067 RR |
68 | bool Enable(bool enable = TRUE); |
69 | ||
9d522606 RD |
70 | static wxVisualAttributes |
71 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
72 | ||
4f856067 RR |
73 | // implementation |
74 | bool m_blockEvent; | |
75 | wxBitmap m_bitmap; | |
76 | ||
77 | void OnSetBitmap(); | |
4f856067 RR |
78 | bool IsOwnGtkWindow(GdkWindow *window); |
79 | ||
80 | virtual void OnInternalIdle(); | |
6f02a879 VZ |
81 | |
82 | protected: | |
83 | void DoApplyWidgetStyle(GtkRcStyle *style); | |
4f856067 RR |
84 | virtual wxSize DoGetBestSize() const; |
85 | ||
86 | private: | |
87 | DECLARE_DYNAMIC_CLASS(wxToggleBitmapButton) | |
88 | }; | |
9d522606 | 89 | |
1db8dc4a VZ |
90 | //----------------------------------------------------------------------------- |
91 | // wxToggleButton | |
92 | //----------------------------------------------------------------------------- | |
93 | ||
20123d49 | 94 | class WXDLLIMPEXP_CORE wxToggleButton: public wxControl |
1db8dc4a VZ |
95 | { |
96 | public: | |
97 | // construction/destruction | |
98 | wxToggleButton() {} | |
99 | wxToggleButton(wxWindow *parent, | |
100 | wxWindowID id, | |
101 | const wxString& label, | |
102 | const wxPoint& pos = wxDefaultPosition, | |
103 | const wxSize& size = wxDefaultSize, | |
104 | long style = 0, | |
105 | const wxValidator& validator = wxDefaultValidator, | |
106 | const wxString& name = wxCheckBoxNameStr) | |
107 | { | |
108 | Create(parent, id, label, pos, size, style, validator, name); | |
109 | } | |
110 | ||
111 | // Create the control | |
112 | bool Create(wxWindow *parent, | |
113 | wxWindowID id, | |
114 | const wxString& label, | |
115 | const wxPoint& pos = wxDefaultPosition, | |
116 | const wxSize& size = wxDefaultSize, long style = 0, | |
117 | const wxValidator& validator = wxDefaultValidator, | |
118 | const wxString& name = wxCheckBoxNameStr); | |
119 | ||
120 | // Get/set the value | |
121 | void SetValue(bool state); | |
122 | bool GetValue() const; | |
123 | ||
124 | // Set the label | |
125 | void SetLabel(const wxString& label); | |
126 | bool Enable(bool enable = TRUE); | |
127 | ||
9d522606 RD |
128 | static wxVisualAttributes |
129 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
9864c56d RR |
130 | |
131 | // implementation | |
132 | bool m_blockEvent; | |
1db8dc4a | 133 | |
1db8dc4a VZ |
134 | bool IsOwnGtkWindow(GdkWindow *window); |
135 | ||
136 | virtual void OnInternalIdle(); | |
6f02a879 VZ |
137 | |
138 | protected: | |
139 | void DoApplyWidgetStyle(GtkRcStyle *style); | |
1db8dc4a VZ |
140 | virtual wxSize DoGetBestSize() const; |
141 | ||
142 | private: | |
143 | DECLARE_DYNAMIC_CLASS(wxToggleButton) | |
144 | }; | |
145 | ||
146 | #endif // _WX_GTK_TOGGLEBUTTON_H_ | |
147 |