]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/tglbtn.h
1. moved InheritAttributes() from wxControl to wxWindow
[wxWidgets.git] / include / wx / gtk / 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
10// License: Rocketeer license
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
69
70 // implementation
71 bool m_blockEvent;
72 wxBitmap m_bitmap;
73
74 void OnSetBitmap();
75 void ApplyWidgetStyle();
76 bool IsOwnGtkWindow(GdkWindow *window);
77
78 virtual void OnInternalIdle();
79 virtual wxSize DoGetBestSize() const;
80
81private:
82 DECLARE_DYNAMIC_CLASS(wxToggleBitmapButton)
83};
1db8dc4a
VZ
84//-----------------------------------------------------------------------------
85// wxToggleButton
86//-----------------------------------------------------------------------------
87
88class wxToggleButton: public wxControl
89{
90public:
91 // construction/destruction
92 wxToggleButton() {}
93 wxToggleButton(wxWindow *parent,
94 wxWindowID id,
95 const wxString& label,
96 const wxPoint& pos = wxDefaultPosition,
97 const wxSize& size = wxDefaultSize,
98 long style = 0,
99 const wxValidator& validator = wxDefaultValidator,
100 const wxString& name = wxCheckBoxNameStr)
101 {
102 Create(parent, id, label, pos, size, style, validator, name);
103 }
104
105 // Create the control
106 bool Create(wxWindow *parent,
107 wxWindowID id,
108 const wxString& label,
109 const wxPoint& pos = wxDefaultPosition,
110 const wxSize& size = wxDefaultSize, long style = 0,
111 const wxValidator& validator = wxDefaultValidator,
112 const wxString& name = wxCheckBoxNameStr);
113
114 // Get/set the value
115 void SetValue(bool state);
116 bool GetValue() const;
117
118 // Set the label
119 void SetLabel(const wxString& label);
120 bool Enable(bool enable = TRUE);
121
9864c56d
RR
122
123 // implementation
124 bool m_blockEvent;
1db8dc4a 125
1db8dc4a
VZ
126 void ApplyWidgetStyle();
127 bool IsOwnGtkWindow(GdkWindow *window);
128
129 virtual void OnInternalIdle();
130 virtual wxSize DoGetBestSize() const;
131
132private:
133 DECLARE_DYNAMIC_CLASS(wxToggleButton)
134};
135
136#endif // _WX_GTK_TOGGLEBUTTON_H_
137