]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/tglbtn.h
Always provide wxMenuItem bitmap-related methods in wxMSW.
[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
8// RCS-ID: $Id$
9// Copyright: (c) 2000 Johnny C. Norris II
526954c5 10// Licence: wxWindows licence
1db8dc4a
VZ
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_TOGGLEBUTTON_H_
14#define _WX_TOGGLEBUTTON_H_
15
76c13f8f
RR
16#include "wx/bitmap.h"
17
b4354db1
VZ
18// Checkbox item (single checkbox)
19class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase
76c13f8f
RR
20{
21public:
b4354db1
VZ
22 wxToggleButton() { Init(); }
23 wxToggleButton(wxWindow *parent,
76c13f8f 24 wxWindowID id,
b4354db1 25 const wxString& label,
76c13f8f
RR
26 const wxPoint& pos = wxDefaultPosition,
27 const wxSize& size = wxDefaultSize,
28 long style = 0,
29 const wxValidator& validator = wxDefaultValidator,
30 const wxString& name = wxCheckBoxNameStr)
31 {
32 Create(parent, id, label, pos, size, style, validator, name);
33 }
34
76c13f8f
RR
35 bool Create(wxWindow *parent,
36 wxWindowID id,
b4354db1 37 const wxString& label,
76c13f8f 38 const wxPoint& pos = wxDefaultPosition,
b4354db1
VZ
39 const wxSize& size = wxDefaultSize,
40 long style = 0,
76c13f8f
RR
41 const wxValidator& validator = wxDefaultValidator,
42 const wxString& name = wxCheckBoxNameStr);
43
b4354db1
VZ
44 virtual void SetValue(bool value);
45 virtual bool GetValue() const ;
46
47 virtual bool MSWCommand(WXUINT param, WXWORD id);
48 virtual void Command(wxCommandEvent& event);
76c13f8f 49
b4354db1
VZ
50 virtual State GetNormalState() const;
51
52 // returns true if the platform should explicitly apply a theme border
53 virtual bool CanApplyThemeBorder() const { return false; }
76c13f8f
RR
54
55protected:
b4354db1 56 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
03647350 57
b4354db1 58 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
03647350 59
b4354db1 60 void Init();
76c13f8f 61
b4354db1
VZ
62 // current state of the button (when owner-drawn)
63 bool m_state;
76c13f8f
RR
64
65private:
b4354db1 66 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton)
76c13f8f
RR
67};
68
b4354db1
VZ
69//-----------------------------------------------------------------------------
70// wxBitmapToggleButton
71//-----------------------------------------------------------------------------
72
73
74class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton
1db8dc4a
VZ
75{
76public:
b4354db1
VZ
77 // construction/destruction
78 wxBitmapToggleButton() {}
79 wxBitmapToggleButton(wxWindow *parent,
1db8dc4a 80 wxWindowID id,
b4354db1 81 const wxBitmap& label,
1db8dc4a
VZ
82 const wxPoint& pos = wxDefaultPosition,
83 const wxSize& size = wxDefaultSize,
84 long style = 0,
85 const wxValidator& validator = wxDefaultValidator,
86 const wxString& name = wxCheckBoxNameStr)
87 {
88 Create(parent, id, label, pos, size, style, validator, name);
89 }
90
b4354db1 91 // Create the control
1db8dc4a
VZ
92 bool Create(wxWindow *parent,
93 wxWindowID id,
b4354db1 94 const wxBitmap& label,
1db8dc4a 95 const wxPoint& pos = wxDefaultPosition,
b4354db1 96 const wxSize& size = wxDefaultSize, long style = 0,
1db8dc4a
VZ
97 const wxValidator& validator = wxDefaultValidator,
98 const wxString& name = wxCheckBoxNameStr);
99
b4354db1
VZ
100 // deprecated synonym for SetBitmapLabel()
101 wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap),
102 SetBitmapLabel(bitmap); )
103 // prevent virtual function hiding
104 virtual void SetLabel(const wxString& label) { wxToggleButton::SetLabel(label); }
9016f3ad 105
1db8dc4a 106private:
b4354db1 107 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
1db8dc4a
VZ
108};
109
110#endif // _WX_TOGGLEBUTTON_H_
111