]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/tglbtn.h
Add wxUSE_ARTPROVIDER_STD build option.
[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 // global data
27 //-----------------------------------------------------------------------------
28
29 extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[];
30
31 //-----------------------------------------------------------------------------
32 // wxBitmapToggleButton
33 //-----------------------------------------------------------------------------
34
35 class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButtonBase
36 {
37 public:
38 // construction/destruction
39 wxBitmapToggleButton() {}
40 wxBitmapToggleButton(wxWindow *parent,
41 wxWindowID id,
42 const wxBitmap& label,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize,
45 long style = 0,
46 const wxValidator& validator = wxDefaultValidator,
47 const wxString& name = wxCheckBoxNameStr)
48 {
49 Create(parent, id, label, pos, size, style, validator, name);
50 }
51
52 // Create the control
53 bool Create(wxWindow *parent,
54 wxWindowID id,
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);
60
61 // Get/set the value
62 void SetValue(bool state);
63 bool GetValue() const;
64
65 // Set the label
66 virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
67 virtual void SetLabel(const wxBitmap& label);
68 bool Enable(bool enable = true);
69
70 static wxVisualAttributes
71 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
72
73 // implementation
74 wxBitmap m_bitmap;
75
76 void OnSetBitmap();
77
78 protected:
79 void GTKDisableEvents();
80 void GTKEnableEvents();
81
82 virtual wxSize DoGetBestSize() const;
83 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
84 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
85
86 private:
87 typedef wxToggleButtonBase base_type;
88
89 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
90 };
91
92 //-----------------------------------------------------------------------------
93 // wxToggleButton
94 //-----------------------------------------------------------------------------
95
96 class WXDLLIMPEXP_CORE wxToggleButton: public wxToggleButtonBase
97 {
98 public:
99 // construction/destruction
100 wxToggleButton() {}
101 wxToggleButton(wxWindow *parent,
102 wxWindowID id,
103 const wxString& label,
104 const wxPoint& pos = wxDefaultPosition,
105 const wxSize& size = wxDefaultSize,
106 long style = 0,
107 const wxValidator& validator = wxDefaultValidator,
108 const wxString& name = wxCheckBoxNameStr)
109 {
110 Create(parent, id, label, pos, size, style, validator, name);
111 }
112
113 // Create the control
114 bool Create(wxWindow *parent,
115 wxWindowID id,
116 const wxString& label,
117 const wxPoint& pos = wxDefaultPosition,
118 const wxSize& size = wxDefaultSize, long style = 0,
119 const wxValidator& validator = wxDefaultValidator,
120 const wxString& name = wxCheckBoxNameStr);
121
122 // Get/set the value
123 void SetValue(bool state);
124 bool GetValue() const;
125
126 // Set the label
127 void SetLabel(const wxString& label);
128 bool Enable(bool enable = true);
129
130 static wxVisualAttributes
131 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
132
133 protected:
134 void GTKDisableEvents();
135 void GTKEnableEvents();
136
137 virtual wxSize DoGetBestSize() const;
138 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
139 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
140
141 private:
142 typedef wxToggleButtonBase base_type;
143
144 DECLARE_DYNAMIC_CLASS(wxToggleButton)
145 };
146
147 #endif // _WX_GTK_TOGGLEBUTTON_H_
148