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