]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/tglbtn.h
Wrappers for *ToText
[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 // License: Rocketeer license
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 wxToggleButton;
23 class wxToggleBitmapButton;
24
25 //-----------------------------------------------------------------------------
26 // global data
27 //-----------------------------------------------------------------------------
28
29 extern const wxChar *wxCheckBoxNameStr;
30
31 //-----------------------------------------------------------------------------
32 // wxToggleBitmapButton
33 //-----------------------------------------------------------------------------
34
35 class wxToggleBitmapButton: public wxControl
36 {
37 public:
38 // construction/destruction
39 wxToggleBitmapButton() {}
40 wxToggleBitmapButton(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 void SetLabel(const wxBitmap& label);
67 bool Enable(bool enable = TRUE);
68
69 static wxVisualAttributes
70 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
71
72 // implementation
73 bool m_blockEvent;
74 wxBitmap m_bitmap;
75
76 void OnSetBitmap();
77 void DoApplyWidgetStyle(GtkRcStyle *style);
78 bool IsOwnGtkWindow(GdkWindow *window);
79
80 virtual void OnInternalIdle();
81 virtual wxSize DoGetBestSize() const;
82
83 private:
84 DECLARE_DYNAMIC_CLASS(wxToggleBitmapButton)
85 };
86
87 //-----------------------------------------------------------------------------
88 // wxToggleButton
89 //-----------------------------------------------------------------------------
90
91 class wxToggleButton: public wxControl
92 {
93 public:
94 // construction/destruction
95 wxToggleButton() {}
96 wxToggleButton(wxWindow *parent,
97 wxWindowID id,
98 const wxString& label,
99 const wxPoint& pos = wxDefaultPosition,
100 const wxSize& size = wxDefaultSize,
101 long style = 0,
102 const wxValidator& validator = wxDefaultValidator,
103 const wxString& name = wxCheckBoxNameStr)
104 {
105 Create(parent, id, label, pos, size, style, validator, name);
106 }
107
108 // Create the control
109 bool Create(wxWindow *parent,
110 wxWindowID id,
111 const wxString& label,
112 const wxPoint& pos = wxDefaultPosition,
113 const wxSize& size = wxDefaultSize, long style = 0,
114 const wxValidator& validator = wxDefaultValidator,
115 const wxString& name = wxCheckBoxNameStr);
116
117 // Get/set the value
118 void SetValue(bool state);
119 bool GetValue() const;
120
121 // Set the label
122 void SetLabel(const wxString& label);
123 bool Enable(bool enable = TRUE);
124
125 static wxVisualAttributes
126 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
127
128 // implementation
129 bool m_blockEvent;
130
131 void DoApplyWidgetStyle(GtkRcStyle *style);
132 bool IsOwnGtkWindow(GdkWindow *window);
133
134 virtual void OnInternalIdle();
135 virtual wxSize DoGetBestSize() const;
136
137 private:
138 DECLARE_DYNAMIC_CLASS(wxToggleButton)
139 };
140
141 #endif // _WX_GTK_TOGGLEBUTTON_H_
142