]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/gtk1/tglbtn.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / gtk1 / tglbtn.h
... / ...
CommitLineData
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// Copyright: (c) 2000 Johnny C. Norris II
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GTK_TOGGLEBUTTON_H_
13#define _WX_GTK_TOGGLEBUTTON_H_
14
15#include "wx/bitmap.h"
16
17//-----------------------------------------------------------------------------
18// classes
19//-----------------------------------------------------------------------------
20
21class WXDLLIMPEXP_FWD_CORE wxToggleButton;
22class WXDLLIMPEXP_FWD_CORE wxToggleBitmapButton;
23
24//-----------------------------------------------------------------------------
25// wxToggleBitmapButton
26//-----------------------------------------------------------------------------
27
28class WXDLLIMPEXP_CORE wxToggleBitmapButton: public wxToggleButtonBase
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
59 virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
60 virtual void SetLabel(const wxBitmap& label);
61 bool Enable(bool enable = TRUE);
62
63 static wxVisualAttributes
64 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
65
66 // implementation
67 bool m_blockEvent;
68 wxBitmap m_bitmap;
69
70 void OnSetBitmap();
71 void DoApplyWidgetStyle(GtkRcStyle *style);
72 bool IsOwnGtkWindow(GdkWindow *window);
73
74 virtual void OnInternalIdle();
75 virtual wxSize DoGetBestSize() const;
76
77private:
78 DECLARE_DYNAMIC_CLASS(wxToggleBitmapButton)
79};
80
81//-----------------------------------------------------------------------------
82// wxToggleButton
83//-----------------------------------------------------------------------------
84
85class WXDLLIMPEXP_CORE wxToggleButton: public wxControl
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
119 static wxVisualAttributes
120 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
121
122 // implementation
123 bool m_blockEvent;
124
125 void DoApplyWidgetStyle(GtkRcStyle *style);
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