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
8 // Copyright: (c) 2000 Johnny C. Norris II
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GTK_TOGGLEBUTTON_H_
13 #define _WX_GTK_TOGGLEBUTTON_H_
15 #include "wx/bitmap.h"
17 //-----------------------------------------------------------------------------
19 //-----------------------------------------------------------------------------
21 class WXDLLIMPEXP_FWD_CORE wxToggleButton
;
22 class WXDLLIMPEXP_FWD_CORE wxToggleBitmapButton
;
24 //-----------------------------------------------------------------------------
25 // wxToggleBitmapButton
26 //-----------------------------------------------------------------------------
28 class WXDLLIMPEXP_CORE wxToggleBitmapButton
: public wxToggleButtonBase
31 // construction/destruction
32 wxToggleBitmapButton() {}
33 wxToggleBitmapButton(wxWindow
*parent
,
35 const wxBitmap
& label
,
36 const wxPoint
& pos
= wxDefaultPosition
,
37 const wxSize
& size
= wxDefaultSize
,
39 const wxValidator
& validator
= wxDefaultValidator
,
40 const wxString
& name
= wxCheckBoxNameStr
)
42 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
46 bool Create(wxWindow
*parent
,
48 const wxBitmap
& label
,
49 const wxPoint
& pos
= wxDefaultPosition
,
50 const wxSize
& size
= wxDefaultSize
, long style
= 0,
51 const wxValidator
& validator
= wxDefaultValidator
,
52 const wxString
& name
= wxCheckBoxNameStr
);
55 void SetValue(bool state
);
56 bool GetValue() const;
59 virtual void SetLabel(const wxString
& label
) { wxControl::SetLabel(label
); }
60 virtual void SetLabel(const wxBitmap
& label
);
61 bool Enable(bool enable
= TRUE
);
63 static wxVisualAttributes
64 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
71 void DoApplyWidgetStyle(GtkRcStyle
*style
);
72 bool IsOwnGtkWindow(GdkWindow
*window
);
74 virtual void OnInternalIdle();
75 virtual wxSize
DoGetBestSize() const;
78 DECLARE_DYNAMIC_CLASS(wxToggleBitmapButton
)
81 //-----------------------------------------------------------------------------
83 //-----------------------------------------------------------------------------
85 class WXDLLIMPEXP_CORE wxToggleButton
: public wxControl
88 // construction/destruction
90 wxToggleButton(wxWindow
*parent
,
92 const wxString
& label
,
93 const wxPoint
& pos
= wxDefaultPosition
,
94 const wxSize
& size
= wxDefaultSize
,
96 const wxValidator
& validator
= wxDefaultValidator
,
97 const wxString
& name
= wxCheckBoxNameStr
)
99 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
102 // Create the control
103 bool Create(wxWindow
*parent
,
105 const wxString
& label
,
106 const wxPoint
& pos
= wxDefaultPosition
,
107 const wxSize
& size
= wxDefaultSize
, long style
= 0,
108 const wxValidator
& validator
= wxDefaultValidator
,
109 const wxString
& name
= wxCheckBoxNameStr
);
112 void SetValue(bool state
);
113 bool GetValue() const;
116 void SetLabel(const wxString
& label
);
117 bool Enable(bool enable
= TRUE
);
119 static wxVisualAttributes
120 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
125 void DoApplyWidgetStyle(GtkRcStyle
*style
);
126 bool IsOwnGtkWindow(GdkWindow
*window
);
128 virtual void OnInternalIdle();
129 virtual wxSize
DoGetBestSize() const;
132 DECLARE_DYNAMIC_CLASS(wxToggleButton
)
135 #endif // _WX_GTK_TOGGLEBUTTON_H_