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 // License: 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 //-----------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------
29 extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr
[];
31 //-----------------------------------------------------------------------------
32 // wxBitmapToggleButton
33 //-----------------------------------------------------------------------------
35 class WXDLLIMPEXP_CORE wxBitmapToggleButton
: public wxToggleButtonBase
38 // construction/destruction
39 wxBitmapToggleButton() {}
40 wxBitmapToggleButton(wxWindow
*parent
,
42 const wxBitmap
& label
,
43 const wxPoint
& pos
= wxDefaultPosition
,
44 const wxSize
& size
= wxDefaultSize
,
46 const wxValidator
& validator
= wxDefaultValidator
,
47 const wxString
& name
= wxCheckBoxNameStr
)
49 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
53 bool Create(wxWindow
*parent
,
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
);
62 void SetValue(bool state
);
63 bool GetValue() const;
66 virtual void SetLabel(const wxString
& label
) { wxControl::SetLabel(label
); }
67 virtual void SetLabel(const wxBitmap
& label
);
68 bool Enable(bool enable
= true);
70 static wxVisualAttributes
71 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
79 void GTKDisableEvents();
80 void GTKEnableEvents();
82 virtual wxSize
DoGetBestSize() const;
83 virtual void DoApplyWidgetStyle(GtkRcStyle
*style
);
84 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
87 typedef wxToggleButtonBase base_type
;
89 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton
)
92 //-----------------------------------------------------------------------------
94 //-----------------------------------------------------------------------------
96 class WXDLLIMPEXP_CORE wxToggleButton
: public wxToggleButtonBase
99 // construction/destruction
101 wxToggleButton(wxWindow
*parent
,
103 const wxString
& label
,
104 const wxPoint
& pos
= wxDefaultPosition
,
105 const wxSize
& size
= wxDefaultSize
,
107 const wxValidator
& validator
= wxDefaultValidator
,
108 const wxString
& name
= wxCheckBoxNameStr
)
110 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
113 // Create the control
114 bool Create(wxWindow
*parent
,
116 const wxString
& label
,
117 const wxPoint
& pos
= wxDefaultPosition
,
118 const wxSize
& size
= wxDefaultSize
, long style
= 0,
119 const wxValidator
& validator
= wxDefaultValidator
,
120 const wxString
& name
= wxCheckBoxNameStr
);
123 void SetValue(bool state
);
124 bool GetValue() const;
127 void SetLabel(const wxString
& label
);
128 bool Enable(bool enable
= true);
130 static wxVisualAttributes
131 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
134 void GTKDisableEvents();
135 void GTKEnableEvents();
137 virtual wxSize
DoGetBestSize() const;
138 virtual void DoApplyWidgetStyle(GtkRcStyle
*style
);
139 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
142 typedef wxToggleButtonBase base_type
;
144 DECLARE_DYNAMIC_CLASS(wxToggleButton
)
147 #endif // _WX_GTK_TOGGLEBUTTON_H_