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