1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/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 // wxToggleBitmapButton
27 //-----------------------------------------------------------------------------
29 class WXDLLIMPEXP_CORE wxToggleBitmapButton
: public wxToggleButtonBase
32 // construction/destruction
33 wxToggleBitmapButton() {}
34 wxToggleBitmapButton(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
);
72 void DoApplyWidgetStyle(GtkRcStyle
*style
);
73 bool IsOwnGtkWindow(GdkWindow
*window
);
75 virtual void OnInternalIdle();
76 virtual wxSize
DoGetBestSize() const;
79 DECLARE_DYNAMIC_CLASS(wxToggleBitmapButton
)
82 //-----------------------------------------------------------------------------
84 //-----------------------------------------------------------------------------
86 class WXDLLIMPEXP_CORE wxToggleButton
: public wxControl
89 // construction/destruction
91 wxToggleButton(wxWindow
*parent
,
93 const wxString
& label
,
94 const wxPoint
& pos
= wxDefaultPosition
,
95 const wxSize
& size
= wxDefaultSize
,
97 const wxValidator
& validator
= wxDefaultValidator
,
98 const wxString
& name
= wxCheckBoxNameStr
)
100 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
103 // Create the control
104 bool Create(wxWindow
*parent
,
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
);
113 void SetValue(bool state
);
114 bool GetValue() const;
117 void SetLabel(const wxString
& label
);
118 bool Enable(bool enable
= TRUE
);
120 static wxVisualAttributes
121 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
126 void DoApplyWidgetStyle(GtkRcStyle
*style
);
127 bool IsOwnGtkWindow(GdkWindow
*window
);
129 virtual void OnInternalIdle();
130 virtual wxSize
DoGetBestSize() const;
133 DECLARE_DYNAMIC_CLASS(wxToggleButton
)
136 #endif // _WX_GTK_TOGGLEBUTTON_H_