]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/tglbtn.h
Common code for the same handling of wxSL_INVERSE.
[wxWidgets.git] / include / wx / gtk1 / tglbtn.h
CommitLineData
1db8dc4a
VZ
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
706fb893 10// License: wxWindows licence
1db8dc4a
VZ
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_GTK_TOGGLEBUTTON_H_
14#define _WX_GTK_TOGGLEBUTTON_H_
15
4f856067
RR
16#include "wx/bitmap.h"
17
1db8dc4a
VZ
18//-----------------------------------------------------------------------------
19// classes
20//-----------------------------------------------------------------------------
21
22class wxToggleButton;
4f856067 23class wxToggleBitmapButton;
1db8dc4a
VZ
24
25//-----------------------------------------------------------------------------
26// global data
27//-----------------------------------------------------------------------------
28
acbeb7b3 29extern const wxChar *wxCheckBoxNameStr;
1db8dc4a 30
4f856067
RR
31//-----------------------------------------------------------------------------
32// wxToggleBitmapButton
33//-----------------------------------------------------------------------------
34
35class wxToggleBitmapButton: public wxControl
36{
37public:
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
9d522606
RD
69 static wxVisualAttributes
70 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
71
4f856067
RR
72 // implementation
73 bool m_blockEvent;
74 wxBitmap m_bitmap;
75
76 void OnSetBitmap();
f40fdaa3 77 void DoApplyWidgetStyle(GtkRcStyle *style);
4f856067
RR
78 bool IsOwnGtkWindow(GdkWindow *window);
79
80 virtual void OnInternalIdle();
81 virtual wxSize DoGetBestSize() const;
82
83private:
84 DECLARE_DYNAMIC_CLASS(wxToggleBitmapButton)
85};
9d522606 86
1db8dc4a
VZ
87//-----------------------------------------------------------------------------
88// wxToggleButton
89//-----------------------------------------------------------------------------
90
91class wxToggleButton: public wxControl
92{
93public:
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
9d522606
RD
125 static wxVisualAttributes
126 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
9864c56d
RR
127
128 // implementation
129 bool m_blockEvent;
1db8dc4a 130
f40fdaa3 131 void DoApplyWidgetStyle(GtkRcStyle *style);
1db8dc4a
VZ
132 bool IsOwnGtkWindow(GdkWindow *window);
133
134 virtual void OnInternalIdle();
135 virtual wxSize DoGetBestSize() const;
136
137private:
138 DECLARE_DYNAMIC_CLASS(wxToggleButton)
139};
140
141#endif // _WX_GTK_TOGGLEBUTTON_H_
142