]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/checkbox.h
removing outdated code
[wxWidgets.git] / include / wx / univ / checkbox.h
CommitLineData
1e6feb95
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/univ/checkbox.h
3// Purpose: wxCheckBox declaration
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 07.09.00
7// RCS-ID: $Id$
442b35b5 8// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
65571936 9// Licence: wxWindows licence
1e6feb95
VZ
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_UNIV_CHECKBOX_H_
13#define _WX_UNIV_CHECKBOX_H_
14
1e6feb95
VZ
15#include "wx/button.h" // for wxStdButtonInputHandler
16
17// ----------------------------------------------------------------------------
18// the actions supported by wxCheckBox
19// ----------------------------------------------------------------------------
20
9a83f860
VZ
21#define wxACTION_CHECKBOX_CHECK wxT("check") // SetValue(true)
22#define wxACTION_CHECKBOX_CLEAR wxT("clear") // SetValue(false)
23#define wxACTION_CHECKBOX_TOGGLE wxT("toggle") // toggle the check state
1e6feb95
VZ
24
25// additionally it accepts wxACTION_BUTTON_PRESS and RELEASE
26
27// ----------------------------------------------------------------------------
28// wxCheckBox
29// ----------------------------------------------------------------------------
30
53a2db12 31class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase
1e6feb95
VZ
32{
33public:
34 // checkbox constants
35 enum State
36 {
37 State_Normal,
38 State_Pressed,
39 State_Disabled,
40 State_Current,
41 State_Max
42 };
43
44 enum Status
45 {
46 Status_Checked,
47 Status_Unchecked,
415a0ff1 48 Status_3rdState,
1e6feb95
VZ
49 Status_Max
50 };
51
52 // constructors
6463b9f5 53 wxCheckBox() { Init(); }
1e6feb95
VZ
54
55 wxCheckBox(wxWindow *parent,
56 wxWindowID id,
57 const wxString& label,
58 const wxPoint& pos = wxDefaultPosition,
59 const wxSize& size = wxDefaultSize,
60 long style = 0,
61 const wxValidator& validator = wxDefaultValidator,
6463b9f5
JS
62 const wxString& name = wxCheckBoxNameStr)
63 {
64 Init();
65
66 Create(parent, id, label, pos, size, style, validator, name);
67 }
1e6feb95
VZ
68
69 bool Create(wxWindow *parent,
70 wxWindowID id,
71 const wxString& label,
72 const wxPoint& pos = wxDefaultPosition,
73 const wxSize& size = wxDefaultSize,
74 long style = 0,
75 const wxValidator& validator = wxDefaultValidator,
76 const wxString& name = wxCheckBoxNameStr);
77
78 // implement the checkbox interface
79 virtual void SetValue(bool value);
80 virtual bool GetValue() const;
81
82 // set/get the bitmaps to use for the checkbox indicator
83 void SetBitmap(const wxBitmap& bmp, State state, Status status);
84 virtual wxBitmap GetBitmap(State state, Status status) const;
85
86 // wxCheckBox actions
87 void Toggle();
88 virtual void Press();
89 virtual void Release();
90 virtual void ChangeValue(bool value);
91
92 // overridden base class virtuals
93 virtual bool IsPressed() const { return m_isPressed; }
94
6f02a879
VZ
95 virtual bool PerformAction(const wxControlAction& action,
96 long numArg = -1,
97 const wxString& strArg = wxEmptyString);
98
99 virtual bool CanBeHighlighted() const { return true; }
9467bdb7
VZ
100 virtual wxInputHandler *CreateStdInputHandler(wxInputHandler *handlerDef);
101 virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
102 {
103 return CreateStdInputHandler(handlerDef);
104 }
6f02a879 105
1e6feb95 106protected:
415a0ff1
WS
107 virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state));
108 virtual wxCheckBoxState DoGet3StateValue() const;
109
1e6feb95
VZ
110 virtual void DoDraw(wxControlRenderer *renderer);
111 virtual wxSize DoGetBestClientSize() const;
112
1e6feb95
VZ
113 // get the size of the bitmap using either the current one or the default
114 // one (query renderer then)
115 virtual wxSize GetBitmapSize() const;
116
117 // common part of all ctors
118 void Init();
119
120 // send command event notifying about the checkbox state change
121 virtual void SendEvent();
122
123 // called when the checkbox becomes checked - radio button hook
124 virtual void OnCheck();
125
126 // get the state corresponding to the flags (combination of wxCONTROL_XXX)
127 wxCheckBox::State GetState(int flags) const;
128
129 // directly access the bitmaps array without trying to find a valid bitmap
130 // to use as GetBitmap() does
131 wxBitmap DoGetBitmap(State state, Status status) const
132 { return m_bitmaps[state][status]; }
133
134 // get the current status
135 Status GetStatus() const { return m_status; }
136
137private:
138 // the current check status
139 Status m_status;
140
141 // the bitmaps to use for the different states
142 wxBitmap m_bitmaps[State_Max][Status_Max];
143
144 // is the checkbox currently pressed?
145 bool m_isPressed;
146
147 DECLARE_DYNAMIC_CLASS(wxCheckBox)
148};
149
1e6feb95 150#endif // _WX_UNIV_CHECKBOX_H_