]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/tglbtn.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / msw / tglbtn.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/tglbtn.h
3 // Purpose: Declaration of the wxToggleButton class, which implements a
4 // toggle button under wxMSW.
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_TOGGLEBUTTON_H_
13 #define _WX_TOGGLEBUTTON_H_
14
15 #include "wx/bitmap.h"
16
17 // Checkbox item (single checkbox)
18 class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase
19 {
20 public:
21 wxToggleButton() { Init(); }
22 wxToggleButton(wxWindow *parent,
23 wxWindowID id,
24 const wxString& label,
25 const wxPoint& pos = wxDefaultPosition,
26 const wxSize& size = wxDefaultSize,
27 long style = 0,
28 const wxValidator& validator = wxDefaultValidator,
29 const wxString& name = wxCheckBoxNameStr)
30 {
31 Create(parent, id, label, pos, size, style, validator, name);
32 }
33
34 bool Create(wxWindow *parent,
35 wxWindowID id,
36 const wxString& 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 virtual void SetValue(bool value);
44 virtual bool GetValue() const ;
45
46 virtual bool MSWCommand(WXUINT param, WXWORD id);
47 virtual void Command(wxCommandEvent& event);
48
49 virtual State GetNormalState() const;
50
51 // returns true if the platform should explicitly apply a theme border
52 virtual bool CanApplyThemeBorder() const { return false; }
53
54 protected:
55 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
56
57 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
58
59 void Init();
60
61 // current state of the button (when owner-drawn)
62 bool m_state;
63
64 private:
65 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton)
66 };
67
68 //-----------------------------------------------------------------------------
69 // wxBitmapToggleButton
70 //-----------------------------------------------------------------------------
71
72
73 class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton
74 {
75 public:
76 // construction/destruction
77 wxBitmapToggleButton() {}
78 wxBitmapToggleButton(wxWindow *parent,
79 wxWindowID id,
80 const wxBitmap& label,
81 const wxPoint& pos = wxDefaultPosition,
82 const wxSize& size = wxDefaultSize,
83 long style = 0,
84 const wxValidator& validator = wxDefaultValidator,
85 const wxString& name = wxCheckBoxNameStr)
86 {
87 Create(parent, id, label, pos, size, style, validator, name);
88 }
89
90 // Create the control
91 bool Create(wxWindow *parent,
92 wxWindowID id,
93 const wxBitmap& label,
94 const wxPoint& pos = wxDefaultPosition,
95 const wxSize& size = wxDefaultSize, long style = 0,
96 const wxValidator& validator = wxDefaultValidator,
97 const wxString& name = wxCheckBoxNameStr);
98
99 // deprecated synonym for SetBitmapLabel()
100 wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap),
101 SetBitmapLabel(bitmap); )
102 // prevent virtual function hiding
103 virtual void SetLabel(const wxString& label) { wxToggleButton::SetLabel(label); }
104
105 private:
106 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
107 };
108
109 #endif // _WX_TOGGLEBUTTON_H_
110