1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxCheckListBox class - a listbox with checkable items
4 // Note: this is an optional class.
5 // Author: David Webster
9 // Copyright: (c) David Webster
10 // Licence: wxWindows licence
11 ///////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_CHECKLST_H_
14 #define _WX_CHECKLST_H_
20 class wxOwnerDrawn
; // so the compiler knows, it is a class.
22 class wxCheckListBoxItem
; // fwd decl, define in checklst.cpp
24 class WXDLLEXPORT wxCheckListBox
: public wxListBox
31 wxCheckListBox( wxWindow
* pParent
33 ,const wxPoint
& rPos
= wxDefaultPosition
34 ,const wxSize
& vSize
= wxDefaultSize
36 ,const wxString asChoices
[] = NULL
39 ,const wxValidator
& rValidator
= wxDefaultValidator
41 ,const wxString
& rsName
= wxListBoxNameStr
45 // Override base class virtuals
47 virtual void Delete(int n
);
48 virtual void InsertItems( int nItems
49 ,const wxString asItems
[]
53 virtual bool SetFont(const wxFont
&rFont
);
56 // Items may be checked
58 bool IsChecked(size_t uiIndex
) const;
59 void Check( size_t uiIndex
66 size_t GetItemHeight(void) const { return m_nItemHeight
; }
70 // We create our items ourselves and they have non-standard size,
71 // so we need to override these functions
73 virtual wxOwnerDrawn
* CreateItem(size_t n
);
74 virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT
* pItem
);
77 // Pressing space or clicking the check box toggles the item
79 void OnChar(wxKeyEvent
& rEvent
);
80 void OnLeftClick(wxMouseEvent
& rEvent
);
83 size_t m_nItemHeight
; // height of checklistbox items (the same for all)
86 // Virtual function hiding suppression, do not use
88 virtual wxControl
* CreateItem( const wxItemResource
* pChildResource
89 ,const wxItemResource
* pParentResource
90 ,const wxResourceTable
* pTable
= (const wxResourceTable
*) NULL
93 return(wxWindowBase::CreateItem( pChildResource
98 DECLARE_DYNAMIC_CLASS(wxCheckListBox
)
100 }; // end of CLASS wxCheckListBoxItem