checklst.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. #ifndef _WX_CHECKLST_H_
  12. #define _WX_CHECKLST_H_
  13. #include <stddef.h>
  14. #include "wx/defs.h"
  15. class wxOwnerDrawn; // so the compiler knows, it is a class.
  16. class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase
  17. {
  18. public:
  19. //
  20. // Ctors
  21. //
  22. wxCheckListBox();
  23. wxCheckListBox( wxWindow* pParent
  24. ,wxWindowID vId
  25. ,const wxPoint& rPos = wxDefaultPosition
  26. ,const wxSize& vSize = wxDefaultSize
  27. ,int nStrings = 0
  28. ,const wxString asChoices[] = NULL
  29. ,long lStyle = 0
  30. ,const wxValidator& rValidator = wxDefaultValidator
  31. ,const wxString& rsName = wxListBoxNameStr
  32. );
  33. wxCheckListBox( wxWindow* pParent
  34. ,wxWindowID vId
  35. ,const wxPoint& rPos
  36. ,const wxSize& vSize
  37. ,const wxArrayString& asChoices
  38. ,long lStyle = 0
  39. ,const wxValidator& rValidator = wxDefaultValidator
  40. ,const wxString& rsName = wxListBoxNameStr
  41. );
  42. //
  43. // Override base class virtuals
  44. //
  45. virtual void Delete(unsigned int n);
  46. virtual bool SetFont(const wxFont &rFont);
  47. //
  48. // Items may be checked
  49. //
  50. bool IsChecked(unsigned int uiIndex) const;
  51. void Check(unsigned int uiIndex, bool bCheck = true);
  52. //
  53. // Accessors
  54. //
  55. size_t GetItemHeight(void) const { return m_nItemHeight; }
  56. protected:
  57. //
  58. // We create our items ourselves and they have non-standard size,
  59. // so we need to override these functions
  60. //
  61. virtual wxOwnerDrawn* CreateItem(size_t n);
  62. virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* pItem);
  63. //
  64. // Pressing space or clicking the check box toggles the item
  65. //
  66. void OnChar(wxKeyEvent& rEvent);
  67. void OnLeftClick(wxMouseEvent& rEvent);
  68. private:
  69. size_t m_nItemHeight; // height of checklistbox items (the same for all)
  70. DECLARE_DYNAMIC_CLASS(wxCheckListBox)
  71. DECLARE_EVENT_TABLE()
  72. }; // end of CLASS wxCheckListBox
  73. #endif
  74. // _WX_CHECKLST_H_