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
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_CORE wxToggleButton
: public wxToggleButtonBase
24 // construction/destruction
26 wxToggleButton(wxWindow
*parent
,
28 const wxString
& label
,
29 const wxPoint
& pos
= wxDefaultPosition
,
30 const wxSize
& size
= wxDefaultSize
,
32 const wxValidator
& validator
= wxDefaultValidator
,
33 const wxString
& name
= wxCheckBoxNameStr
)
35 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
39 bool Create(wxWindow
*parent
,
41 const wxString
& label
,
42 const wxPoint
& pos
= wxDefaultPosition
,
43 const wxSize
& size
= wxDefaultSize
, long style
= 0,
44 const wxValidator
& validator
= wxDefaultValidator
,
45 const wxString
& name
= wxCheckBoxNameStr
);
48 void SetValue(bool state
);
49 bool GetValue() const;
52 void SetLabel(const wxString
& label
);
54 static wxVisualAttributes
55 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
58 void GTKDisableEvents();
59 void GTKEnableEvents();
61 virtual wxSize
DoGetBestSize() const;
62 virtual void DoApplyWidgetStyle(GtkRcStyle
*style
);
65 virtual bool DoSetLabelMarkup(const wxString
& markup
);
66 #endif // wxUSE_MARKUP
69 typedef wxToggleButtonBase base_type
;
71 // Return the GtkLabel used by this toggle button.
72 GtkLabel
*GTKGetLabel() const;
74 DECLARE_DYNAMIC_CLASS(wxToggleButton
)
77 //-----------------------------------------------------------------------------
78 // wxBitmapToggleButton
79 //-----------------------------------------------------------------------------
81 class WXDLLIMPEXP_CORE wxBitmapToggleButton
: public wxToggleButton
84 // construction/destruction
85 wxBitmapToggleButton() {}
86 wxBitmapToggleButton(wxWindow
*parent
,
88 const wxBitmap
& label
,
89 const wxPoint
& pos
= wxDefaultPosition
,
90 const wxSize
& size
= wxDefaultSize
,
92 const wxValidator
& validator
= wxDefaultValidator
,
93 const wxString
& name
= wxCheckBoxNameStr
)
95 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
99 bool Create(wxWindow
*parent
,
101 const wxBitmap
& label
,
102 const wxPoint
& pos
= wxDefaultPosition
,
103 const wxSize
& size
= wxDefaultSize
, long style
= 0,
104 const wxValidator
& validator
= wxDefaultValidator
,
105 const wxString
& name
= wxCheckBoxNameStr
);
107 // deprecated synonym for SetBitmapLabel()
108 wxDEPRECATED_INLINE( void SetLabel(const wxBitmap
& bitmap
),
109 SetBitmapLabel(bitmap
); )
110 // prevent virtual function hiding
111 virtual void SetLabel(const wxString
& label
) { wxToggleButton::SetLabel(label
); }
114 typedef wxToggleButtonBase base_type
;
116 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton
)
119 #endif // _WX_GTK_TOGGLEBUTTON_H_