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 //-----------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------
29 class WXDLLIMPEXP_CORE wxToggleButton
: public wxToggleButtonBase
32 // construction/destruction
34 wxToggleButton(wxWindow
*parent
,
36 const wxString
& 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 wxString
& 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 void SetLabel(const wxString
& label
);
62 static wxVisualAttributes
63 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
66 void GTKDisableEvents();
67 void GTKEnableEvents();
69 virtual wxSize
DoGetBestSize() const;
70 virtual void DoApplyWidgetStyle(GtkRcStyle
*style
);
73 virtual bool DoSetLabelMarkup(const wxString
& markup
);
74 #endif // wxUSE_MARKUP
77 typedef wxToggleButtonBase base_type
;
79 // Return the GtkLabel used by this toggle button.
80 GtkLabel
*GTKGetLabel() const;
82 DECLARE_DYNAMIC_CLASS(wxToggleButton
)
85 //-----------------------------------------------------------------------------
86 // wxBitmapToggleButton
87 //-----------------------------------------------------------------------------
89 class WXDLLIMPEXP_CORE wxBitmapToggleButton
: public wxToggleButton
92 // construction/destruction
93 wxBitmapToggleButton() {}
94 wxBitmapToggleButton(wxWindow
*parent
,
96 const wxBitmap
& label
,
97 const wxPoint
& pos
= wxDefaultPosition
,
98 const wxSize
& size
= wxDefaultSize
,
100 const wxValidator
& validator
= wxDefaultValidator
,
101 const wxString
& name
= wxCheckBoxNameStr
)
103 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
106 // Create the control
107 bool Create(wxWindow
*parent
,
109 const wxBitmap
& label
,
110 const wxPoint
& pos
= wxDefaultPosition
,
111 const wxSize
& size
= wxDefaultSize
, long style
= 0,
112 const wxValidator
& validator
= wxDefaultValidator
,
113 const wxString
& name
= wxCheckBoxNameStr
);
115 // deprecated synonym for SetBitmapLabel()
116 wxDEPRECATED_INLINE( void SetLabel(const wxBitmap
& bitmap
),
117 SetBitmapLabel(bitmap
); )
118 // prevent virtual function hiding
119 virtual void SetLabel(const wxString
& label
) { wxToggleButton::SetLabel(label
); }
122 typedef wxToggleButtonBase base_type
;
124 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton
)
127 #endif // _WX_GTK_TOGGLEBUTTON_H_