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 // 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_CORE
const char wxCheckBoxNameStr
[];
31 //-----------------------------------------------------------------------------
32 // wxToggleBitmapButton
33 //-----------------------------------------------------------------------------
35 class WXDLLIMPEXP_CORE wxToggleBitmapButton
: public wxControl
38 // construction/destruction
39 wxToggleBitmapButton() {}
40 wxToggleBitmapButton(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
);
78 void DoApplyWidgetStyle(GtkRcStyle
*style
);
79 bool IsOwnGtkWindow(GdkWindow
*window
);
81 virtual void OnInternalIdle();
82 virtual wxSize
DoGetBestSize() const;
85 DECLARE_DYNAMIC_CLASS(wxToggleBitmapButton
)
88 //-----------------------------------------------------------------------------
90 //-----------------------------------------------------------------------------
92 class WXDLLIMPEXP_CORE wxToggleButton
: public wxControl
95 // construction/destruction
97 wxToggleButton(wxWindow
*parent
,
99 const wxString
& label
,
100 const wxPoint
& pos
= wxDefaultPosition
,
101 const wxSize
& size
= wxDefaultSize
,
103 const wxValidator
& validator
= wxDefaultValidator
,
104 const wxString
& name
= wxCheckBoxNameStr
)
106 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
109 // Create the control
110 bool Create(wxWindow
*parent
,
112 const wxString
& label
,
113 const wxPoint
& pos
= wxDefaultPosition
,
114 const wxSize
& size
= wxDefaultSize
, long style
= 0,
115 const wxValidator
& validator
= wxDefaultValidator
,
116 const wxString
& name
= wxCheckBoxNameStr
);
119 void SetValue(bool state
);
120 bool GetValue() const;
123 void SetLabel(const wxString
& label
);
124 bool Enable(bool enable
= TRUE
);
126 static wxVisualAttributes
127 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
132 void DoApplyWidgetStyle(GtkRcStyle
*style
);
133 bool IsOwnGtkWindow(GdkWindow
*window
);
135 virtual void OnInternalIdle();
136 virtual wxSize
DoGetBestSize() const;
139 DECLARE_DYNAMIC_CLASS(wxToggleButton
)
142 #endif // _WX_GTK_TOGGLEBUTTON_H_