]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/tglbtn.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / gtk1 / tglbtn.h
CommitLineData
1db8dc4a 1/////////////////////////////////////////////////////////////////////////////
8ef94bfc 2// Name: wx/gtk1/tglbtn.h
1db8dc4a
VZ
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
1db8dc4a 8// Copyright: (c) 2000 Johnny C. Norris II
526954c5 9// Licence: wxWindows licence
1db8dc4a
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GTK_TOGGLEBUTTON_H_
13#define _WX_GTK_TOGGLEBUTTON_H_
14
4f856067
RR
15#include "wx/bitmap.h"
16
1db8dc4a
VZ
17//-----------------------------------------------------------------------------
18// classes
19//-----------------------------------------------------------------------------
20
b5dbe15d
VS
21class WXDLLIMPEXP_FWD_CORE wxToggleButton;
22class WXDLLIMPEXP_FWD_CORE wxToggleBitmapButton;
1db8dc4a 23
4f856067
RR
24//-----------------------------------------------------------------------------
25// wxToggleBitmapButton
26//-----------------------------------------------------------------------------
27
803cab4d 28class WXDLLIMPEXP_CORE wxToggleBitmapButton: public wxToggleButtonBase
4f856067
RR
29{
30public:
31 // construction/destruction
32 wxToggleBitmapButton() {}
33 wxToggleBitmapButton(wxWindow *parent,
34 wxWindowID id,
35 const wxBitmap& label,
36 const wxPoint& pos = wxDefaultPosition,
37 const wxSize& size = wxDefaultSize,
38 long style = 0,
39 const wxValidator& validator = wxDefaultValidator,
40 const wxString& name = wxCheckBoxNameStr)
41 {
42 Create(parent, id, label, pos, size, style, validator, name);
43 }
44
45 // Create the control
46 bool Create(wxWindow *parent,
47 wxWindowID id,
48 const wxBitmap& label,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize, long style = 0,
51 const wxValidator& validator = wxDefaultValidator,
52 const wxString& name = wxCheckBoxNameStr);
53
54 // Get/set the value
55 void SetValue(bool state);
56 bool GetValue() const;
57
58 // Set the label
17a1ebd1
VZ
59 virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
60 virtual void SetLabel(const wxBitmap& label);
4f856067
RR
61 bool Enable(bool enable = TRUE);
62
9d522606
RD
63 static wxVisualAttributes
64 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
65
4f856067
RR
66 // implementation
67 bool m_blockEvent;
68 wxBitmap m_bitmap;
69
70 void OnSetBitmap();
f40fdaa3 71 void DoApplyWidgetStyle(GtkRcStyle *style);
4f856067
RR
72 bool IsOwnGtkWindow(GdkWindow *window);
73
74 virtual void OnInternalIdle();
75 virtual wxSize DoGetBestSize() const;
76
77private:
78 DECLARE_DYNAMIC_CLASS(wxToggleBitmapButton)
79};
9d522606 80
1db8dc4a
VZ
81//-----------------------------------------------------------------------------
82// wxToggleButton
83//-----------------------------------------------------------------------------
84
20123d49 85class WXDLLIMPEXP_CORE wxToggleButton: public wxControl
1db8dc4a
VZ
86{
87public:
88 // construction/destruction
89 wxToggleButton() {}
90 wxToggleButton(wxWindow *parent,
91 wxWindowID id,
92 const wxString& label,
93 const wxPoint& pos = wxDefaultPosition,
94 const wxSize& size = wxDefaultSize,
95 long style = 0,
96 const wxValidator& validator = wxDefaultValidator,
97 const wxString& name = wxCheckBoxNameStr)
98 {
99 Create(parent, id, label, pos, size, style, validator, name);
100 }
101
102 // Create the control
103 bool Create(wxWindow *parent,
104 wxWindowID id,
105 const wxString& label,
106 const wxPoint& pos = wxDefaultPosition,
107 const wxSize& size = wxDefaultSize, long style = 0,
108 const wxValidator& validator = wxDefaultValidator,
109 const wxString& name = wxCheckBoxNameStr);
110
111 // Get/set the value
112 void SetValue(bool state);
113 bool GetValue() const;
114
115 // Set the label
116 void SetLabel(const wxString& label);
117 bool Enable(bool enable = TRUE);
118
9d522606
RD
119 static wxVisualAttributes
120 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
8ef94bfc 121
9864c56d
RR
122 // implementation
123 bool m_blockEvent;
1db8dc4a 124
f40fdaa3 125 void DoApplyWidgetStyle(GtkRcStyle *style);
1db8dc4a
VZ
126 bool IsOwnGtkWindow(GdkWindow *window);
127
128 virtual void OnInternalIdle();
129 virtual wxSize DoGetBestSize() const;
130
131private:
132 DECLARE_DYNAMIC_CLASS(wxToggleButton)
133};
134
135#endif // _WX_GTK_TOGGLEBUTTON_H_
136