]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/tglbtn.h
Really fix the problem with caret in wxGrid text editor under MSW.
[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 // wxToggleButton
20 //-----------------------------------------------------------------------------
21
22 class WXDLLIMPEXP_CORE wxToggleButton: public wxToggleButtonBase
23 {
24 public:
25 // construction/destruction
26 wxToggleButton() {}
27 wxToggleButton(wxWindow *parent,
28 wxWindowID id,
29 const wxString& label,
30 const wxPoint& pos = wxDefaultPosition,
31 const wxSize& size = wxDefaultSize,
32 long style = 0,
33 const wxValidator& validator = wxDefaultValidator,
34 const wxString& name = wxCheckBoxNameStr)
35 {
36 Create(parent, id, label, pos, size, style, validator, name);
37 }
38
39 // Create the control
40 bool Create(wxWindow *parent,
41 wxWindowID id,
42 const wxString& label,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize, long style = 0,
45 const wxValidator& validator = wxDefaultValidator,
46 const wxString& name = wxCheckBoxNameStr);
47
48 // Get/set the value
49 void SetValue(bool state);
50 bool GetValue() const;
51
52 // Set the label
53 void SetLabel(const wxString& label);
54
55 static wxVisualAttributes
56 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
57
58 protected:
59 void GTKDisableEvents();
60 void GTKEnableEvents();
61
62 virtual wxSize DoGetBestSize() const;
63 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
64
65 #if wxUSE_MARKUP
66 virtual bool DoSetLabelMarkup(const wxString& markup);
67 #endif // wxUSE_MARKUP
68
69 private:
70 typedef wxToggleButtonBase base_type;
71
72 // Return the GtkLabel used by this toggle button.
73 GtkLabel *GTKGetLabel() const;
74
75 DECLARE_DYNAMIC_CLASS(wxToggleButton)
76 };
77
78 //-----------------------------------------------------------------------------
79 // wxBitmapToggleButton
80 //-----------------------------------------------------------------------------
81
82 class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton
83 {
84 public:
85 // construction/destruction
86 wxBitmapToggleButton() {}
87 wxBitmapToggleButton(wxWindow *parent,
88 wxWindowID id,
89 const wxBitmap& label,
90 const wxPoint& pos = wxDefaultPosition,
91 const wxSize& size = wxDefaultSize,
92 long style = 0,
93 const wxValidator& validator = wxDefaultValidator,
94 const wxString& name = wxCheckBoxNameStr)
95 {
96 Create(parent, id, label, pos, size, style, validator, name);
97 }
98
99 // Create the control
100 bool Create(wxWindow *parent,
101 wxWindowID id,
102 const wxBitmap& label,
103 const wxPoint& pos = wxDefaultPosition,
104 const wxSize& size = wxDefaultSize, long style = 0,
105 const wxValidator& validator = wxDefaultValidator,
106 const wxString& name = wxCheckBoxNameStr);
107
108 // deprecated synonym for SetBitmapLabel()
109 wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap),
110 SetBitmapLabel(bitmap); )
111 // prevent virtual function hiding
112 virtual void SetLabel(const wxString& label) { wxToggleButton::SetLabel(label); }
113
114 private:
115 typedef wxToggleButtonBase base_type;
116
117 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
118 };
119
120 #endif // _WX_GTK_TOGGLEBUTTON_H_
121