editlbox.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: editlbox.h
  3. // Purpose: interface of wxEditableListBox
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. #define wxEL_ALLOW_NEW 0x0100
  8. #define wxEL_ALLOW_EDIT 0x0200
  9. #define wxEL_ALLOW_DELETE 0x0400
  10. #define wxEL_NO_REORDER 0x0800
  11. #define wxEL_DEFAULT_STYLE (wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE)
  12. /**
  13. @class wxEditableListBox
  14. An editable listbox is composite control that lets the user easily enter,
  15. delete and reorder a list of strings.
  16. @beginStyleTable
  17. @style{wxEL_ALLOW_NEW}
  18. Allows the user to enter new strings.
  19. @style{wxEL_ALLOW_EDIT}
  20. Allows the user to edit existing strings.
  21. @style{wxEL_ALLOW_DELETE}
  22. Allows the user to delete existing strings.
  23. @style{wxEL_NO_REORDER}
  24. Does not allow the user to reorder the strings.
  25. @style{wxEL_DEFAULT_STYLE}
  26. Default style: wxEL_ALLOW_NEW|wxEL_ALLOW_EDIT|wxEL_ALLOW_DELETE.
  27. @endStyleTable
  28. The control uses a wxListCtrl internally and emit its events.
  29. @library{wxadv}
  30. @category{ctrl}
  31. @see wxListBox, wxListCtrl
  32. */
  33. class wxEditableListBox : public wxPanel
  34. {
  35. public:
  36. /**
  37. Default ctor.
  38. */
  39. wxEditableListBox();
  40. /**
  41. Constructor, creating and showing a list box.
  42. @param parent
  43. Parent window. Must not be @NULL.
  44. @param id
  45. Window identifier. The value wxID_ANY indicates a default value.
  46. @param label
  47. The text shown just before the list control.
  48. @param pos
  49. Window position.
  50. If ::wxDefaultPosition is specified then a default position is chosen.
  51. @param size
  52. Window size.
  53. If ::wxDefaultSize is specified then the window is sized appropriately.
  54. @param style
  55. Window style. See wxEditableListBox.
  56. @param name
  57. Window name.
  58. @see Create()
  59. */
  60. wxEditableListBox(wxWindow* parent, wxWindowID id,
  61. const wxString& label,
  62. const wxPoint& pos = wxDefaultPosition,
  63. const wxSize& size = wxDefaultSize,
  64. long style = wxEL_DEFAULT_STYLE,
  65. const wxString& name = wxEditableListBoxNameStr);
  66. /**
  67. Destructor, destroying the list box.
  68. */
  69. virtual ~wxEditableListBox();
  70. /**
  71. Creates the editable listbox for two-step construction.
  72. See wxEditableListBox() for further details.
  73. */
  74. bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
  75. const wxPoint& pos = wxDefaultPosition,
  76. const wxSize& size = wxDefaultSize,
  77. long style = wxEL_DEFAULT_STYLE,
  78. const wxString& name = wxEditableListBoxNameStr);
  79. /**
  80. Replaces current contents with given strings.
  81. */
  82. void SetStrings(const wxArrayString& strings);
  83. /**
  84. Returns in the given array the current contents of the control
  85. (the array will be erased before control's contents are appended).
  86. */
  87. void GetStrings(wxArrayString& strings) const;
  88. };