]>
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 | |
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 | ||
4f856067 | 18 | //----------------------------------------------------------------------------- |
b4354db1 | 19 | // wxToggleButton |
4f856067 RR |
20 | //----------------------------------------------------------------------------- |
21 | ||
b4354db1 | 22 | class WXDLLIMPEXP_CORE wxToggleButton: public wxToggleButtonBase |
4f856067 RR |
23 | { |
24 | public: | |
25 | // construction/destruction | |
b4354db1 VZ |
26 | wxToggleButton() {} |
27 | wxToggleButton(wxWindow *parent, | |
4f856067 | 28 | wxWindowID id, |
b4354db1 | 29 | const wxString& label, |
4f856067 RR |
30 | const wxPoint& pos = wxDefaultPosition, |
31 | const wxSize& size = wxDefaultSize, | |
32 | long style = 0, | |
33 | const wxValidator& validator = wxDefaultValidator, | |
34 | const wxString& name = wxCheckBoxNameStr) | |
35 | { | |
36 | Create(parent, id, label, pos, size, style, validator, name); | |
37 | } | |
38 | ||
39 | // Create the control | |
40 | bool Create(wxWindow *parent, | |
41 | wxWindowID id, | |
b4354db1 | 42 | const wxString& label, |
4f856067 RR |
43 | const wxPoint& pos = wxDefaultPosition, |
44 | const wxSize& size = wxDefaultSize, long style = 0, | |
45 | const wxValidator& validator = wxDefaultValidator, | |
46 | const wxString& name = wxCheckBoxNameStr); | |
47 | ||
48 | // Get/set the value | |
49 | void SetValue(bool state); | |
50 | bool GetValue() const; | |
51 | ||
52 | // Set the label | |
b4354db1 | 53 | void SetLabel(const wxString& label); |
4f856067 | 54 | |
9d522606 RD |
55 | static wxVisualAttributes |
56 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
57 | ||
6f02a879 | 58 | protected: |
c71ab7c1 RR |
59 | void GTKDisableEvents(); |
60 | void GTKEnableEvents(); | |
23318a53 | 61 | |
4f856067 | 62 | virtual wxSize DoGetBestSize() const; |
ef5c70f9 | 63 | virtual void DoApplyWidgetStyle(GtkRcStyle *style); |
b4354db1 VZ |
64 | |
65 | #if wxUSE_MARKUP | |
66 | virtual bool DoSetLabelMarkup(const wxString& markup); | |
67 | #endif // wxUSE_MARKUP | |
4f856067 RR |
68 | |
69 | private: | |
b545684e PC |
70 | typedef wxToggleButtonBase base_type; |
71 | ||
b4354db1 VZ |
72 | // Return the GtkLabel used by this toggle button. |
73 | GtkLabel *GTKGetLabel() const; | |
74 | ||
75 | DECLARE_DYNAMIC_CLASS(wxToggleButton) | |
4f856067 | 76 | }; |
9d522606 | 77 | |
1db8dc4a | 78 | //----------------------------------------------------------------------------- |
b4354db1 | 79 | // wxBitmapToggleButton |
1db8dc4a VZ |
80 | //----------------------------------------------------------------------------- |
81 | ||
b4354db1 | 82 | class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton |
1db8dc4a VZ |
83 | { |
84 | public: | |
85 | // construction/destruction | |
b4354db1 VZ |
86 | wxBitmapToggleButton() {} |
87 | wxBitmapToggleButton(wxWindow *parent, | |
1db8dc4a | 88 | wxWindowID id, |
b4354db1 | 89 | const wxBitmap& label, |
1db8dc4a VZ |
90 | const wxPoint& pos = wxDefaultPosition, |
91 | const wxSize& size = wxDefaultSize, | |
92 | long style = 0, | |
93 | const wxValidator& validator = wxDefaultValidator, | |
94 | const wxString& name = wxCheckBoxNameStr) | |
95 | { | |
96 | Create(parent, id, label, pos, size, style, validator, name); | |
97 | } | |
98 | ||
99 | // Create the control | |
100 | bool Create(wxWindow *parent, | |
101 | wxWindowID id, | |
b4354db1 | 102 | const wxBitmap& label, |
1db8dc4a VZ |
103 | const wxPoint& pos = wxDefaultPosition, |
104 | const wxSize& size = wxDefaultSize, long style = 0, | |
105 | const wxValidator& validator = wxDefaultValidator, | |
106 | const wxString& name = wxCheckBoxNameStr); | |
107 | ||
b4354db1 VZ |
108 | // deprecated synonym for SetBitmapLabel() |
109 | wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap), | |
110 | SetBitmapLabel(bitmap); ) | |
111 | // prevent virtual function hiding | |
112 | virtual void SetLabel(const wxString& label) { wxToggleButton::SetLabel(label); } | |
1db8dc4a VZ |
113 | |
114 | private: | |
b545684e PC |
115 | typedef wxToggleButtonBase base_type; |
116 | ||
b4354db1 | 117 | DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton) |
1db8dc4a VZ |
118 | }; |
119 | ||
120 | #endif // _WX_GTK_TOGGLEBUTTON_H_ | |
121 |