1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxCheckListBox class - a listbox with checkable items
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef __CHECKLST__H_
13 #define __CHECKLST__H_
16 #pragma interface "checklst.h"
20 // typedef unsigned int size_t;
25 #if !wxUSE_OWNER_DRAWN
26 #error "wxCheckListBox class requires owner-drawn functionality."
29 class wxCheckListBoxItem
; // fwd decl, define in checklst.cpp
31 class WXDLLEXPORT wxCheckListBox
: public wxListBox
33 DECLARE_DYNAMIC_CLASS(wxCheckListBox
)
37 wxCheckListBox(wxWindow
*parent
, wxWindowID id
,
38 const wxPoint
& pos
= wxDefaultPosition
,
39 const wxSize
& size
= wxDefaultSize
,
41 const wxString choices
[] = NULL
,
43 const wxValidator
& validator
= wxDefaultValidator
,
44 const wxString
& name
= wxListBoxNameStr
);
46 // override base class virtuals
47 virtual void Delete(int n
);
48 virtual void InsertItems(int nItems
, const wxString items
[], int pos
);
50 virtual bool SetFont( const wxFont
&font
);
52 // items may be checked
53 bool IsChecked(size_t uiIndex
) const;
54 void Check(size_t uiIndex
, bool bCheck
= TRUE
);
57 size_t GetItemHeight() const { return m_nItemHeight
; }
60 // we create our items ourselves and they have non-standard size,
61 // so we need to override these functions
62 virtual wxOwnerDrawn
*CreateItem(size_t n
);
63 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT
*item
);
65 // pressing space or clicking the check box toggles the item
66 void OnChar(wxKeyEvent
& event
);
67 void OnLeftClick(wxMouseEvent
& event
);
70 size_t m_nItemHeight
; // height of checklistbox items (the same for all)