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
9 // Copyright: (c) 2000 Johnny C. Norris II
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_GTK_TOGGLEBUTTON_H_
14 #define _WX_GTK_TOGGLEBUTTON_H_
16 #include "wx/bitmap.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 class WXDLLIMPEXP_FWD_CORE wxToggleButton
;
23 class WXDLLIMPEXP_FWD_CORE wxToggleBitmapButton
;
25 //-----------------------------------------------------------------------------
26 // wxBitmapToggleButton
27 //-----------------------------------------------------------------------------
29 class WXDLLIMPEXP_CORE wxBitmapToggleButton
: public wxToggleButtonBase
32 // construction/destruction
33 wxBitmapToggleButton() {}
34 wxBitmapToggleButton(wxWindow
*parent
,
36 const wxBitmap
& label
,
37 const wxPoint
& pos
= wxDefaultPosition
,
38 const wxSize
& size
= wxDefaultSize
,
40 const wxValidator
& validator
= wxDefaultValidator
,
41 const wxString
& name
= wxCheckBoxNameStr
)
43 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
47 bool Create(wxWindow
*parent
,
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
);
56 void SetValue(bool state
);
57 bool GetValue() const;
60 virtual void SetLabel(const wxString
& label
) { wxControl::SetLabel(label
); }
61 virtual void SetLabel(const wxBitmap
& label
);
62 bool Enable(bool enable
= true);
64 static wxVisualAttributes
65 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
73 void GTKDisableEvents();
74 void GTKEnableEvents();
76 virtual wxSize
DoGetBestSize() const;
77 virtual void DoApplyWidgetStyle(GtkRcStyle
*style
);
78 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
81 typedef wxToggleButtonBase base_type
;
83 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton
)
86 //-----------------------------------------------------------------------------
88 //-----------------------------------------------------------------------------
90 class WXDLLIMPEXP_CORE wxToggleButton
: public wxToggleButtonBase
93 // construction/destruction
95 wxToggleButton(wxWindow
*parent
,
97 const wxString
& label
,
98 const wxPoint
& pos
= wxDefaultPosition
,
99 const wxSize
& size
= wxDefaultSize
,
101 const wxValidator
& validator
= wxDefaultValidator
,
102 const wxString
& name
= wxCheckBoxNameStr
)
104 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
107 // Create the control
108 bool Create(wxWindow
*parent
,
110 const wxString
& label
,
111 const wxPoint
& pos
= wxDefaultPosition
,
112 const wxSize
& size
= wxDefaultSize
, long style
= 0,
113 const wxValidator
& validator
= wxDefaultValidator
,
114 const wxString
& name
= wxCheckBoxNameStr
);
117 void SetValue(bool state
);
118 bool GetValue() const;
121 void SetLabel(const wxString
& label
);
122 bool Enable(bool enable
= true);
124 static wxVisualAttributes
125 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
128 void GTKDisableEvents();
129 void GTKEnableEvents();
131 virtual wxSize
DoGetBestSize() const;
132 virtual void DoApplyWidgetStyle(GtkRcStyle
*style
);
133 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
136 typedef wxToggleButtonBase base_type
;
138 DECLARE_DYNAMIC_CLASS(wxToggleButton
)
141 #endif // _WX_GTK_TOGGLEBUTTON_H_