checklst.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/osx/checklst.h
  3. // Purpose: wxCheckListBox class - a listbox with checkable items
  4. // Note: this is an optional class.
  5. // Author: Stefan Csomor
  6. // Modified by:
  7. // Created: 1998-01-01
  8. // Copyright: (c) Stefan Csomor
  9. // Licence: wxWindows licence
  10. ///////////////////////////////////////////////////////////////////////////////
  11. #ifndef _WX_MAC_CHECKLST_H_
  12. #define _WX_MAC_CHECKLST_H_
  13. class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase
  14. {
  15. public:
  16. // ctors
  17. wxCheckListBox() { Init(); }
  18. wxCheckListBox(wxWindow *parent,
  19. wxWindowID id,
  20. const wxPoint& pos = wxDefaultPosition,
  21. const wxSize& size = wxDefaultSize,
  22. int nStrings = 0,
  23. const wxString *choices = NULL,
  24. long style = 0,
  25. const wxValidator& validator = wxDefaultValidator,
  26. const wxString& name = wxListBoxNameStr)
  27. {
  28. Init();
  29. Create(parent, id, pos, size, nStrings, choices, style, validator, name);
  30. }
  31. wxCheckListBox(wxWindow *parent,
  32. wxWindowID id,
  33. const wxPoint& pos,
  34. const wxSize& size,
  35. const wxArrayString& choices,
  36. long style = 0,
  37. const wxValidator& validator = wxDefaultValidator,
  38. const wxString& name = wxListBoxNameStr)
  39. {
  40. Init();
  41. Create(parent, id, pos, size, choices, style, validator, name);
  42. }
  43. bool Create(wxWindow *parent,
  44. wxWindowID id,
  45. const wxPoint& pos = wxDefaultPosition,
  46. const wxSize& size = wxDefaultSize,
  47. int nStrings = 0,
  48. const wxString *choices = NULL,
  49. long style = 0,
  50. const wxValidator& validator = wxDefaultValidator,
  51. const wxString& name = wxListBoxNameStr);
  52. bool Create(wxWindow *parent,
  53. wxWindowID id,
  54. const wxPoint& pos,
  55. const wxSize& size,
  56. const wxArrayString& choices,
  57. long style = 0,
  58. const wxValidator& validator = wxDefaultValidator,
  59. const wxString& name = wxListBoxNameStr);
  60. // items may be checked
  61. bool IsChecked(unsigned int uiIndex) const;
  62. void Check(unsigned int uiIndex, bool bCheck = true);
  63. // data callbacks
  64. virtual void GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value );
  65. virtual void SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value );
  66. protected:
  67. // override all methods which add/delete items to update m_checks array as
  68. // well
  69. virtual void OnItemInserted(unsigned int pos);
  70. virtual void DoDeleteOneItem(unsigned int n);
  71. virtual void DoClear();
  72. // the array containing the checked status of the items
  73. wxArrayInt m_checks;
  74. wxListWidgetColumn* m_checkColumn ;
  75. void Init();
  76. private:
  77. DECLARE_EVENT_TABLE()
  78. DECLARE_DYNAMIC_CLASS(wxCheckListBox)
  79. };
  80. #endif // _WX_MAC_CHECKLST_H_