]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/univ/checkbox.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/checkbox.h
3 // Purpose: wxCheckBox declaration
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_UNIV_CHECKBOX_H_
13 #define _WX_UNIV_CHECKBOX_H_
15 #include "wx/button.h" // for wxStdButtonInputHandler
17 // ----------------------------------------------------------------------------
18 // the actions supported by wxCheckBox
19 // ----------------------------------------------------------------------------
21 #define wxACTION_CHECKBOX_CHECK _T("check") // SetValue(true)
22 #define wxACTION_CHECKBOX_CLEAR _T("clear") // SetValue(false)
23 #define wxACTION_CHECKBOX_TOGGLE _T("toggle") // toggle the check state
25 // additionally it accepts wxACTION_BUTTON_PRESS and RELEASE
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 class WXDLLEXPORT wxCheckBox
: public wxCheckBoxBase
53 wxCheckBox() { Init(); }
55 wxCheckBox(wxWindow
*parent
,
57 const wxString
& label
,
58 const wxPoint
& pos
= wxDefaultPosition
,
59 const wxSize
& size
= wxDefaultSize
,
61 const wxValidator
& validator
= wxDefaultValidator
,
62 const wxString
& name
= wxCheckBoxNameStr
)
66 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
69 bool Create(wxWindow
*parent
,
71 const wxString
& label
,
72 const wxPoint
& pos
= wxDefaultPosition
,
73 const wxSize
& size
= wxDefaultSize
,
75 const wxValidator
& validator
= wxDefaultValidator
,
76 const wxString
& name
= wxCheckBoxNameStr
);
78 // implement the checkbox interface
79 virtual void SetValue(bool value
);
80 virtual bool GetValue() const;
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;
89 virtual void Release();
90 virtual void ChangeValue(bool value
);
92 // overridden base class virtuals
93 virtual bool IsPressed() const { return m_isPressed
; }
95 virtual bool PerformAction(const wxControlAction
& action
,
97 const wxString
& strArg
= wxEmptyString
);
99 virtual bool CanBeHighlighted() const { return true; }
100 virtual wxInputHandler
*CreateStdInputHandler(wxInputHandler
*handlerDef
);
101 virtual wxInputHandler
*DoGetStdInputHandler(wxInputHandler
*handlerDef
)
103 return CreateStdInputHandler(handlerDef
);
107 virtual void DoSet3StateValue(wxCheckBoxState
WXUNUSED(state
));
108 virtual wxCheckBoxState
DoGet3StateValue() const;
110 virtual void DoDraw(wxControlRenderer
*renderer
);
111 virtual wxSize
DoGetBestClientSize() const;
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;
117 // common part of all ctors
120 // send command event notifying about the checkbox state change
121 virtual void SendEvent();
123 // called when the checkbox becomes checked - radio button hook
124 virtual void OnCheck();
126 // get the state corresponding to the flags (combination of wxCONTROL_XXX)
127 wxCheckBox::State
GetState(int flags
) const;
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
]; }
134 // get the current status
135 Status
GetStatus() const { return m_status
; }
138 // the current check status
141 // the bitmaps to use for the different states
142 wxBitmap m_bitmaps
[State_Max
][Status_Max
];
144 // is the checkbox currently pressed?
147 DECLARE_DYNAMIC_CLASS(wxCheckBox
)
150 #endif // _WX_UNIV_CHECKBOX_H_