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"
21 #if !wxUSE_OWNER_DRAWN
22 #error "wxCheckListBox class requires owner-drawn functionality."
25 #include "wx/listbox.h"
27 class wxCheckListBoxItem
; // fwd decl, defined in checklst.cpp
29 class WXDLLEXPORT wxCheckListBox
: public wxListBox
31 DECLARE_DYNAMIC_CLASS(wxCheckListBox
)
35 wxCheckListBox(wxWindow
*parent
, wxWindowID id
,
36 const wxPoint
& pos
= wxDefaultPosition
,
37 const wxSize
& size
= wxDefaultSize
,
39 const wxString choices
[] = NULL
,
41 const wxValidator
& validator
= wxDefaultValidator
,
42 const wxString
& name
= wxListBoxNameStr
);
44 // override base class virtuals
45 virtual void Delete(int n
);
46 virtual void InsertItems(int nItems
, const wxString items
[], int pos
);
48 virtual bool SetFont( const wxFont
&font
);
50 // items may be checked
51 bool IsChecked(size_t uiIndex
) const;
52 void Check(size_t uiIndex
, bool bCheck
= TRUE
);
55 size_t GetItemHeight() const { return m_nItemHeight
; }
58 // we create our items ourselves and they have non-standard size,
59 // so we need to override these functions
60 virtual wxOwnerDrawn
*CreateItem(size_t n
);
61 virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT
*item
);
63 // pressing space or clicking the check box toggles the item
64 void OnChar(wxKeyEvent
& event
);
65 void OnLeftClick(wxMouseEvent
& event
);
68 size_t m_nItemHeight
; // height of checklistbox items (the same for all)