]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/tglbtn.h
Fix wxMac preprocessor check in wxWebView code.
[wxWidgets.git] / include / wx / gtk / tglbtn.h
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
6 // Modified by:
7 // Created: 08.02.01
8 // RCS-ID: $Id$
9 // Copyright: (c) 2000 Johnny C. Norris II
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _WX_GTK_TOGGLEBUTTON_H_
14 #define _WX_GTK_TOGGLEBUTTON_H_
15
16 #include "wx/bitmap.h"
17
18 //-----------------------------------------------------------------------------
19 // classes
20 //-----------------------------------------------------------------------------
21
22 class WXDLLIMPEXP_FWD_CORE wxToggleButton;
23 class WXDLLIMPEXP_FWD_CORE wxToggleBitmapButton;
24
25 //-----------------------------------------------------------------------------
26 // wxToggleButton
27 //-----------------------------------------------------------------------------
28
29 class WXDLLIMPEXP_CORE wxToggleButton: public wxToggleButtonBase
30 {
31 public:
32 // construction/destruction
33 wxToggleButton() {}
34 wxToggleButton(wxWindow *parent,
35 wxWindowID id,
36 const wxString& label,
37 const wxPoint& pos = wxDefaultPosition,
38 const wxSize& size = wxDefaultSize,
39 long style = 0,
40 const wxValidator& validator = wxDefaultValidator,
41 const wxString& name = wxCheckBoxNameStr)
42 {
43 Create(parent, id, label, pos, size, style, validator, name);
44 }
45
46 // Create the control
47 bool Create(wxWindow *parent,
48 wxWindowID id,
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);
54
55 // Get/set the value
56 void SetValue(bool state);
57 bool GetValue() const;
58
59 // Set the label
60 void SetLabel(const wxString& label);
61
62 static wxVisualAttributes
63 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
64
65 protected:
66 void GTKDisableEvents();
67 void GTKEnableEvents();
68
69 virtual wxSize DoGetBestSize() const;
70 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
71
72 #if wxUSE_MARKUP
73 virtual bool DoSetLabelMarkup(const wxString& markup);
74 #endif // wxUSE_MARKUP
75
76 private:
77 typedef wxToggleButtonBase base_type;
78
79 // Return the GtkLabel used by this toggle button.
80 GtkLabel *GTKGetLabel() const;
81
82 DECLARE_DYNAMIC_CLASS(wxToggleButton)
83 };
84
85 //-----------------------------------------------------------------------------
86 // wxBitmapToggleButton
87 //-----------------------------------------------------------------------------
88
89 class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton
90 {
91 public:
92 // construction/destruction
93 wxBitmapToggleButton() {}
94 wxBitmapToggleButton(wxWindow *parent,
95 wxWindowID id,
96 const wxBitmap& label,
97 const wxPoint& pos = wxDefaultPosition,
98 const wxSize& size = wxDefaultSize,
99 long style = 0,
100 const wxValidator& validator = wxDefaultValidator,
101 const wxString& name = wxCheckBoxNameStr)
102 {
103 Create(parent, id, label, pos, size, style, validator, name);
104 }
105
106 // Create the control
107 bool Create(wxWindow *parent,
108 wxWindowID id,
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);
114
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); }
120
121 private:
122 typedef wxToggleButtonBase base_type;
123
124 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
125 };
126
127 #endif // _WX_GTK_TOGGLEBUTTON_H_
128