1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxCheckListBox class - a listbox with checkable items
4 // Note: this is an optional class.
5 // Author: Stefan Csomor
9 // Copyright: (c) Stefan Csomor
10 // Licence: wxWindows licence
11 ///////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_CHECKLST_H_
14 #define _WX_CHECKLST_H_
16 #if !defined(__MWERKS__) && !defined(__UNIX__)
17 typedef unsigned int size_t;
20 class WXDLLEXPORT wxCheckListBox
: public wxCheckListBoxBase
22 DECLARE_DYNAMIC_CLASS(wxCheckListBox
)
25 wxCheckListBox() { Init(); }
26 wxCheckListBox(wxWindow
*parent
,
28 const wxPoint
& pos
= wxDefaultPosition
,
29 const wxSize
& size
= wxDefaultSize
,
31 const wxString
*choices
= NULL
,
33 const wxValidator
& validator
= wxDefaultValidator
,
34 const wxString
& name
= wxListBoxNameStr
)
38 Create(parent
, id
, pos
, size
, nStrings
, choices
, style
, validator
, name
);
40 wxCheckListBox(wxWindow
*parent
,
44 const wxArrayString
& choices
,
46 const wxValidator
& validator
= wxDefaultValidator
,
47 const wxString
& name
= wxListBoxNameStr
)
51 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
54 bool Create(wxWindow
*parent
,
56 const wxPoint
& pos
= wxDefaultPosition
,
57 const wxSize
& size
= wxDefaultSize
,
59 const wxString
*choices
= NULL
,
61 const wxValidator
& validator
= wxDefaultValidator
,
62 const wxString
& name
= wxListBoxNameStr
);
63 bool Create(wxWindow
*parent
,
67 const wxArrayString
& choices
,
69 const wxValidator
& validator
= wxDefaultValidator
,
70 const wxString
& name
= wxListBoxNameStr
);
72 // items may be checked
73 bool IsChecked(size_t uiIndex
) const;
74 void Check(size_t uiIndex
, bool bCheck
= TRUE
);
75 void OnChar(wxKeyEvent
& event
) ;
76 void OnLeftClick(wxMouseEvent
& event
) ;
79 wxInt32 m_checkBoxWidth
;
80 wxInt32 m_checkBoxHeight
;
81 wxInt32 m_TextBaseLineOffset
;
83 // the array containing the checked status of the items
86 // override all methods which add/delete items to update m_checks array as
88 virtual void Delete(int n
);
90 virtual int DoAppend(const wxString
& item
);
91 virtual void DoInsertItems(const wxArrayString
& items
, int pos
);
92 virtual void DoSetItems(const wxArrayString
& items
, void **clientData
);
93 virtual void DoClear();
94 // common part of all ctors