1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/checkbox.h
3 // Purpose: wxCheckBox class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CHECKBOX_H_
13 #define _WX_CHECKBOX_H_
15 // Checkbox item (single checkbox)
16 class WXDLLIMPEXP_CORE wxCheckBox
: public wxCheckBoxBase
20 wxCheckBox(wxWindow
*parent
,
22 const wxString
& label
,
23 const wxPoint
& pos
= wxDefaultPosition
,
24 const wxSize
& size
= wxDefaultSize
,
26 const wxValidator
& validator
= wxDefaultValidator
,
27 const wxString
& name
= wxCheckBoxNameStr
)
29 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
32 bool Create(wxWindow
*parent
,
34 const wxString
& label
,
35 const wxPoint
& pos
= wxDefaultPosition
,
36 const wxSize
& size
= wxDefaultSize
,
38 const wxValidator
& validator
= wxDefaultValidator
,
39 const wxString
& name
= wxCheckBoxNameStr
);
41 virtual void SetValue(bool value
);
42 virtual bool GetValue() const;
44 // override some base class virtuals
45 virtual void SetLabel(const wxString
& label
);
47 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
48 virtual void Command(wxCommandEvent
& event
);
49 virtual bool SetForegroundColour(const wxColour
& colour
);
50 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT
*item
);
52 // returns true if the platform should explicitly apply a theme border
53 virtual bool CanApplyThemeBorder() const { return false; }
55 // make the checkbox owner drawn or reset it to normal style
56 void MSWMakeOwnerDrawn(bool ownerDrawn
);
58 // implementation only from now on
59 virtual WXDWORD
MSWGetStyle(long flags
, WXDWORD
*exstyle
= NULL
) const;
62 virtual wxSize
DoGetBestClientSize() const;
64 virtual void DoSet3StateValue(wxCheckBoxState value
);
65 virtual wxCheckBoxState
DoGet3StateValue() const;
67 // return true if this checkbox is owner drawn
68 bool IsOwnerDrawn() const;
71 // common part of all ctors
74 // event handlers used by owner-drawn checkbox
75 void OnMouseEnterOrLeave(wxMouseEvent
& event
);
76 void OnMouseLeft(wxMouseEvent
& event
);
77 void OnFocus(wxFocusEvent
& event
);
80 // current state of the checkbox
81 wxCheckBoxState m_state
;
83 // true if the checkbox is currently pressed
86 // true if mouse is currently over the control
90 DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox
)