]>
Commit | Line | Data |
---|---|---|
1db8dc4a | 1 | ///////////////////////////////////////////////////////////////////////////// |
8ef94bfc | 2 | // Name: wx/gtk1/tglbtn.h |
1db8dc4a VZ |
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 | |
526954c5 | 10 | // Licence: 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 | ||
b5dbe15d VS |
22 | class WXDLLIMPEXP_FWD_CORE wxToggleButton; |
23 | class WXDLLIMPEXP_FWD_CORE wxToggleBitmapButton; | |
1db8dc4a | 24 | |
4f856067 RR |
25 | //----------------------------------------------------------------------------- |
26 | // wxToggleBitmapButton | |
27 | //----------------------------------------------------------------------------- | |
28 | ||
803cab4d | 29 | class WXDLLIMPEXP_CORE wxToggleBitmapButton: public wxToggleButtonBase |
4f856067 RR |
30 | { |
31 | public: | |
32 | // construction/destruction | |
33 | wxToggleBitmapButton() {} | |
34 | wxToggleBitmapButton(wxWindow *parent, | |
35 | wxWindowID id, | |
36 | const wxBitmap& label, | |
37 | const wxPoint& pos = wxDefaultPosition, | |
38 | const wxSize& size = wxDefaultSize, | |
39 | long style = 0, | |
40 | const wxValidator& validator = wxDefaultValidator, | |
41 | const wxString& name = wxCheckBoxNameStr) | |
42 | { | |
43 | Create(parent, id, label, pos, size, style, validator, name); | |
44 | } | |
45 | ||
46 | // Create the control | |
47 | bool Create(wxWindow *parent, | |
48 | wxWindowID id, | |
49 | const wxBitmap& label, | |
50 | const wxPoint& pos = wxDefaultPosition, | |
51 | const wxSize& size = wxDefaultSize, long style = 0, | |
52 | const wxValidator& validator = wxDefaultValidator, | |
53 | const wxString& name = wxCheckBoxNameStr); | |
54 | ||
55 | // Get/set the value | |
56 | void SetValue(bool state); | |
57 | bool GetValue() const; | |
58 | ||
59 | // Set the label | |
17a1ebd1 VZ |
60 | virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); } |
61 | virtual void SetLabel(const wxBitmap& label); | |
4f856067 RR |
62 | bool Enable(bool enable = TRUE); |
63 | ||
9d522606 RD |
64 | static wxVisualAttributes |
65 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
66 | ||
4f856067 RR |
67 | // implementation |
68 | bool m_blockEvent; | |
69 | wxBitmap m_bitmap; | |
70 | ||
71 | void OnSetBitmap(); | |
f40fdaa3 | 72 | void DoApplyWidgetStyle(GtkRcStyle *style); |
4f856067 RR |
73 | bool IsOwnGtkWindow(GdkWindow *window); |
74 | ||
75 | virtual void OnInternalIdle(); | |
76 | virtual wxSize DoGetBestSize() const; | |
77 | ||
78 | private: | |
79 | DECLARE_DYNAMIC_CLASS(wxToggleBitmapButton) | |
80 | }; | |
9d522606 | 81 | |
1db8dc4a VZ |
82 | //----------------------------------------------------------------------------- |
83 | // wxToggleButton | |
84 | //----------------------------------------------------------------------------- | |
85 | ||
20123d49 | 86 | class WXDLLIMPEXP_CORE wxToggleButton: public wxControl |
1db8dc4a VZ |
87 | { |
88 | public: | |
89 | // construction/destruction | |
90 | wxToggleButton() {} | |
91 | wxToggleButton(wxWindow *parent, | |
92 | wxWindowID id, | |
93 | const wxString& label, | |
94 | const wxPoint& pos = wxDefaultPosition, | |
95 | const wxSize& size = wxDefaultSize, | |
96 | long style = 0, | |
97 | const wxValidator& validator = wxDefaultValidator, | |
98 | const wxString& name = wxCheckBoxNameStr) | |
99 | { | |
100 | Create(parent, id, label, pos, size, style, validator, name); | |
101 | } | |
102 | ||
103 | // Create the control | |
104 | bool Create(wxWindow *parent, | |
105 | wxWindowID id, | |
106 | const wxString& label, | |
107 | const wxPoint& pos = wxDefaultPosition, | |
108 | const wxSize& size = wxDefaultSize, long style = 0, | |
109 | const wxValidator& validator = wxDefaultValidator, | |
110 | const wxString& name = wxCheckBoxNameStr); | |
111 | ||
112 | // Get/set the value | |
113 | void SetValue(bool state); | |
114 | bool GetValue() const; | |
115 | ||
116 | // Set the label | |
117 | void SetLabel(const wxString& label); | |
118 | bool Enable(bool enable = TRUE); | |
119 | ||
9d522606 RD |
120 | static wxVisualAttributes |
121 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
8ef94bfc | 122 | |
9864c56d RR |
123 | // implementation |
124 | bool m_blockEvent; | |
1db8dc4a | 125 | |
f40fdaa3 | 126 | void DoApplyWidgetStyle(GtkRcStyle *style); |
1db8dc4a VZ |
127 | bool IsOwnGtkWindow(GdkWindow *window); |
128 | ||
129 | virtual void OnInternalIdle(); | |
130 | virtual wxSize DoGetBestSize() const; | |
131 | ||
132 | private: | |
133 | DECLARE_DYNAMIC_CLASS(wxToggleButton) | |
134 | }; | |
135 | ||
136 | #endif // _WX_GTK_TOGGLEBUTTON_H_ | |
137 |