]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/tglbtn.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / msw / tglbtn.h
CommitLineData
1db8dc4a
VZ
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
1db8dc4a 8// Copyright: (c) 2000 Johnny C. Norris II
526954c5 9// Licence: wxWindows licence
1db8dc4a
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_TOGGLEBUTTON_H_
13#define _WX_TOGGLEBUTTON_H_
14
76c13f8f
RR
15#include "wx/bitmap.h"
16
b4354db1
VZ
17// Checkbox item (single checkbox)
18class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase
76c13f8f
RR
19{
20public:
b4354db1
VZ
21 wxToggleButton() { Init(); }
22 wxToggleButton(wxWindow *parent,
76c13f8f 23 wxWindowID id,
b4354db1 24 const wxString& label,
76c13f8f
RR
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
76c13f8f
RR
34 bool Create(wxWindow *parent,
35 wxWindowID id,
b4354db1 36 const wxString& label,
76c13f8f 37 const wxPoint& pos = wxDefaultPosition,
b4354db1
VZ
38 const wxSize& size = wxDefaultSize,
39 long style = 0,
76c13f8f
RR
40 const wxValidator& validator = wxDefaultValidator,
41 const wxString& name = wxCheckBoxNameStr);
42
b4354db1
VZ
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);
76c13f8f 48
b4354db1
VZ
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; }
76c13f8f
RR
53
54protected:
b4354db1 55 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
03647350 56
b4354db1 57 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
03647350 58
b4354db1 59 void Init();
76c13f8f 60
b4354db1
VZ
61 // current state of the button (when owner-drawn)
62 bool m_state;
76c13f8f
RR
63
64private:
b4354db1 65 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton)
76c13f8f
RR
66};
67
b4354db1
VZ
68//-----------------------------------------------------------------------------
69// wxBitmapToggleButton
70//-----------------------------------------------------------------------------
71
72
73class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton
1db8dc4a
VZ
74{
75public:
b4354db1
VZ
76 // construction/destruction
77 wxBitmapToggleButton() {}
78 wxBitmapToggleButton(wxWindow *parent,
1db8dc4a 79 wxWindowID id,
b4354db1 80 const wxBitmap& label,
1db8dc4a
VZ
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
b4354db1 90 // Create the control
1db8dc4a
VZ
91 bool Create(wxWindow *parent,
92 wxWindowID id,
b4354db1 93 const wxBitmap& label,
1db8dc4a 94 const wxPoint& pos = wxDefaultPosition,
b4354db1 95 const wxSize& size = wxDefaultSize, long style = 0,
1db8dc4a
VZ
96 const wxValidator& validator = wxDefaultValidator,
97 const wxString& name = wxCheckBoxNameStr);
98
b4354db1
VZ
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); }
9016f3ad 104
1db8dc4a 105private:
b4354db1 106 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
1db8dc4a
VZ
107};
108
109#endif // _WX_TOGGLEBUTTON_H_
110