1 /////////////////////////////////////////////////////////////////////////////// 2 // Name: wx/os2/checklst.h 3 // Purpose: wxCheckListBox class - a listbox with checkable items 4 // Note: this is an optional class. 5 // Author: David Webster 6 // Modified by: 7 // Created: 10/13/99 8 // Copyright: (c) David Webster 9 // Licence: wxWindows licence 10 /////////////////////////////////////////////////////////////////////////////// 11 12 #ifndef _WX_CHECKLST_H_ 13 #define _WX_CHECKLST_H_ 14 15 #include <stddef.h> 16 17 #include "wx/defs.h" 18 19 class wxOwnerDrawn; // so the compiler knows, it is a class. 20 21 class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase 22 { 23 public: 24 // 25 // Ctors 26 // 27 wxCheckListBox(); 28 wxCheckListBox( wxWindow* pParent 29 ,wxWindowID vId 30 ,const wxPoint& rPos = wxDefaultPosition 31 ,const wxSize& vSize = wxDefaultSize 32 ,int nStrings = 0 33 ,const wxString asChoices[] = NULL 34 ,long lStyle = 0 35 ,const wxValidator& rValidator = wxDefaultValidator 36 ,const wxString& rsName = wxListBoxNameStr 37 ); 38 wxCheckListBox( wxWindow* pParent 39 ,wxWindowID vId 40 ,const wxPoint& rPos 41 ,const wxSize& vSize 42 ,const wxArrayString& asChoices 43 ,long lStyle = 0 44 ,const wxValidator& rValidator = wxDefaultValidator 45 ,const wxString& rsName = wxListBoxNameStr 46 ); 47 48 // 49 // Override base class virtuals 50 // 51 virtual void Delete(unsigned int n); 52 53 virtual bool SetFont(const wxFont &rFont); 54 55 // 56 // Items may be checked 57 // 58 bool IsChecked(unsigned int uiIndex) const; 59 void Check(unsigned int uiIndex, bool bCheck = true); 60 61 // 62 // Accessors 63 // GetItemHeight(void)64 size_t GetItemHeight(void) const { return m_nItemHeight; } 65 66 protected: 67 // 68 // We create our items ourselves and they have non-standard size, 69 // so we need to override these functions 70 // 71 virtual wxOwnerDrawn* CreateItem(size_t n); 72 virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem); 73 74 // 75 // Pressing space or clicking the check box toggles the item 76 // 77 void OnChar(wxKeyEvent& rEvent); 78 void OnLeftClick(wxMouseEvent& rEvent); 79 80 private: 81 size_t m_nItemHeight; // height of checklistbox items (the same for all) 82 83 DECLARE_DYNAMIC_CLASS(wxCheckListBox) 84 DECLARE_EVENT_TABLE() 85 }; // end of CLASS wxCheckListBox 86 87 #endif 88 // _WX_CHECKLST_H_ 89