headerctrl.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/headerctrl.h
  3. // Purpose: interface of wxHeaderCtrl
  4. // Author: Vadim Zeitlin
  5. // Created: 2008-12-01
  6. // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
  7. // Licence: wxWindows licence
  8. /////////////////////////////////////////////////////////////////////////////
  9. enum
  10. {
  11. // allow column drag and drop
  12. wxHD_ALLOW_REORDER = 0x0001,
  13. // allow hiding (and showing back) the columns using the menu shown by
  14. // right clicking the header
  15. wxHD_ALLOW_HIDE = 0x0002,
  16. // style used by default when creating the control
  17. wxHD_DEFAULT_STYLE = wxHD_ALLOW_REORDER
  18. };
  19. /**
  20. @class wxHeaderCtrl
  21. wxHeaderCtrl is the control containing the column headings which is usually
  22. used for display of tabular data.
  23. It is used as part of wxGrid, in generic version wxDataViewCtrl and report
  24. view of wxListCtrl but can be also used independently. In general this
  25. class is meant to be used as part of another control which already stores
  26. the column information somewhere as it can't be used directly: instead you
  27. need to inherit from it and implement the GetColumn() method to provide
  28. column information. See wxHeaderCtrlSimple for a concrete control class
  29. which can be used directly.
  30. In addition to labeling the columns, the control has the following
  31. features:
  32. - Column reordering support, either by explicitly configuring the
  33. columns order and calling SetColumnsOrder() or by dragging the
  34. columns interactively (if enabled).
  35. - Display of the icons in the header: this is often used to display a
  36. sort or reverse sort indicator when the column header is clicked.
  37. Notice that this control itself doesn't do anything other than displaying
  38. the column headers. In particular column reordering and sorting must still
  39. be supported by the associated control displaying the real data under the
  40. header. Also remember to call ScrollWindow() method of the control if the
  41. associated data display window has a horizontal scrollbar, otherwise the
  42. headers wouldn't align with the data when the window is scrolled.
  43. This control is implemented using the native header control under MSW
  44. systems and a generic implementation elsewhere.
  45. @section headerctrl_improvements Future Improvements
  46. Some features are supported by the native MSW control and so could be
  47. easily implemented in this version of wxHeaderCtrl but need to be
  48. implemented in the generic version as well to be really useful. Please let
  49. us know if you need or, better, plan to work on implementing, any of them:
  50. - Displaying bitmaps instead of or together with the text
  51. - Custom drawn headers
  52. - Filters associated with a column.
  53. @beginStyleTable
  54. @style{wxHD_ALLOW_REORDER}
  55. If this style is specified (it is by default), the user can reorder
  56. the control columns by dragging them.
  57. @style{wxHD_ALLOW_HIDE}
  58. If this style is specified, the control shows a popup menu allowing the
  59. user to change the columns visibility on right mouse click. Notice that
  60. the program can always hide or show the columns, this style only
  61. affects the users capability to do it.
  62. @style{wxHD_DEFAULT_STYLE}
  63. Symbolic name for the default control style, currently equal to
  64. @c wxHD_ALLOW_REORDER.
  65. @endStyleTable
  66. @beginEventEmissionTable{wxHeaderCtrlEvent}
  67. @event{EVT_HEADER_CLICK(id, func)}
  68. A column heading was clicked.
  69. @event{EVT_HEADER_RIGHT_CLICK(id, func)}
  70. A column heading was right clicked.
  71. @event{EVT_HEADER_MIDDLE_CLICK(id, func)}
  72. A column heading was clicked with the middle mouse button.
  73. @event{EVT_HEADER_DCLICK(id, func)}
  74. A column heading was double clicked.
  75. @event{EVT_HEADER_RIGHT_DCLICK(id, func)}
  76. A column heading was right double clicked.
  77. @event{EVT_HEADER_MIDDLE_DCLICK(id, func)}
  78. A column heading was double clicked with the middle mouse button.
  79. @event{EVT_HEADER_SEPARATOR_DCLICK(id, func)}
  80. Separator to the right of the specified column was double clicked
  81. (this action is commonly used to resize the column to fit its
  82. contents width and the control provides UpdateColumnWidthToFit() method
  83. to make implementing this easier).
  84. @event{EVT_HEADER_BEGIN_RESIZE(id, func)}
  85. The user started to drag the separator to the right of the column
  86. with the specified index (this can only happen for the columns for
  87. which wxHeaderColumn::IsResizeable() returns true). The event can
  88. be vetoed to prevent the column from being resized. If it isn't,
  89. the resizing and end resize (or dragging cancelled) events will be
  90. generated later.
  91. @event{EVT_HEADER_RESIZING(id, func)}
  92. The user is dragging the column with the specified index resizing
  93. it and its current width is wxHeaderCtrlEvent::GetWidth().
  94. The event can be vetoed to stop the dragging operation completely at
  95. any time.
  96. @event{EVT_HEADER_END_RESIZE(id, func)}
  97. The user stopped dragging the column by releasing the mouse.
  98. The column should normally be resized to the value of
  99. wxHeaderCtrlEvent::GetWidth().
  100. @event{EVT_HEADER_BEGIN_REORDER(id, func)}
  101. The user started to drag the column with the specified index (this
  102. can only happen for the controls with wxHD_ALLOW_REORDER style).
  103. This event can be vetoed to prevent the column from being reordered,
  104. otherwise the end reorder message will be generated later.
  105. @event{EVT_HEADER_END_REORDER(id, func)}
  106. The user dropped the column in its new location. The event can be
  107. vetoed to prevent the column from being placed at the new position
  108. or handled to update the display of the data in the associated
  109. control to match the new column location (available from
  110. wxHeaderCtrlEvent::GetNewOrder()).
  111. @event{EVT_HEADER_DRAGGING_CANCELLED(id, func)}
  112. The resizing or reordering operation currently in progress was
  113. cancelled. This can happen if the user pressed Esc key while
  114. dragging the mouse or the mouse capture was lost for some other
  115. reason. You only need to handle this event if your application
  116. entered into some modal mode when resizing or reordering began, in
  117. which case it should handle this event in addition to the matching
  118. end resizing or reordering ones.
  119. @endEventTable
  120. @library{wxcore}
  121. @category{ctrl}
  122. @see wxGrid, wxListCtrl, wxDataViewCtrl
  123. */
  124. class wxHeaderCtrl : public wxControl
  125. {
  126. public:
  127. /**
  128. Default constructor not creating the underlying window.
  129. You must use Create() after creating the object using this constructor.
  130. */
  131. wxHeaderCtrl();
  132. /**
  133. Constructor creating the window.
  134. Please see Create() for the parameters documentation.
  135. */
  136. wxHeaderCtrl(wxWindow *parent,
  137. wxWindowID winid = wxID_ANY,
  138. const wxPoint& pos = wxDefaultPosition,
  139. const wxSize& size = wxDefaultSize,
  140. long style = wxHD_DEFAULT_STYLE,
  141. const wxString& name = wxHeaderCtrlNameStr);
  142. /**
  143. Create the header control window.
  144. @param parent
  145. The parent window. The header control should be typically
  146. positioned along the top edge of this window.
  147. @param winid
  148. Id of the control or @c wxID_ANY if you don't care.
  149. @param pos
  150. The initial position of the control.
  151. @param size
  152. The initial size of the control (usually not very useful as this
  153. control will typically be resized to have the same width as the
  154. associated data display control).
  155. @param style
  156. The control style, @c wxHD_DEFAULT_STYLE by default. Notice that
  157. the default style allows the user to reorder the columns by
  158. dragging them and you need to explicitly turn this feature off by
  159. using @code wxHD_DEFAULT_STYLE & ~wxHD_ALLOW_REORDER @endcode if
  160. this is undesirable.
  161. @param name
  162. The name of the control.
  163. */
  164. bool Create(wxWindow *parent,
  165. wxWindowID winid = wxID_ANY,
  166. const wxPoint& pos = wxDefaultPosition,
  167. const wxSize& size = wxDefaultSize,
  168. long style = wxHD_DEFAULT_STYLE,
  169. const wxString& name = wxHeaderCtrlNameStr);
  170. /**
  171. Set the number of columns in the control.
  172. The control will use GetColumn() to get information about all the
  173. new columns and refresh itself, i.e. this method also has the same
  174. effect as calling UpdateColumn() for all columns but it should only be
  175. used if the number of columns really changed.
  176. */
  177. void SetColumnCount(unsigned int count);
  178. /**
  179. Return the number of columns in the control.
  180. @return
  181. Number of columns as previously set by SetColumnCount().
  182. @see IsEmpty()
  183. */
  184. unsigned int GetColumnCount() const;
  185. /**
  186. Return whether the control has any columns.
  187. @see GetColumnCount()
  188. */
  189. bool IsEmpty() const;
  190. /**
  191. Update the column with the given index.
  192. When the value returned by GetColumn() changes, this method must be
  193. called to notify the control about the change and update the visual
  194. display to match the new column data.
  195. @param idx
  196. The column index, must be less than GetColumnCount().
  197. */
  198. void UpdateColumn(unsigned int idx);
  199. /**
  200. Change the columns display order.
  201. The display order defines the order in which the columns appear on the
  202. screen and does @em not affect the interpretation of indices by all the
  203. other class methods.
  204. The @a order array specifies the column indices corresponding to the
  205. display positions.
  206. @param order
  207. A permutation of all column indices, i.e. an array of size
  208. GetColumnsOrder() containing all column indices exactly once. The
  209. n-th element of this array defines the index of the column shown at
  210. the n-th position from left (for the default left-to-right writing
  211. direction).
  212. @see wxListCtrl::SetColumnsOrder()
  213. */
  214. void SetColumnsOrder(const wxArrayInt& order);
  215. /**
  216. Return the array describing the columns display order.
  217. For the controls without wxHD_ALLOW_REORDER style the returned array
  218. will be the same as was passed to SetColumnsOrder() previously or
  219. define the default order (with n-th element being n) if it hadn't been
  220. called. But for the controls with wxHD_ALLOW_REORDER style, the columns
  221. can be also reordered by user.
  222. */
  223. wxArrayInt GetColumnsOrder() const;
  224. /**
  225. Return the index of the column displayed at the given position.
  226. @param pos
  227. The display position, e.g. 0 for the left-most column, 1 for the
  228. next one and so on until GetColumnCount() - 1.
  229. @see GetColumnPos()
  230. */
  231. unsigned int GetColumnAt(unsigned int pos) const;
  232. /**
  233. Get the position at which this column is currently displayed.
  234. Notice that a valid position is returned even for the hidden columns
  235. currently.
  236. @param idx
  237. The column index, must be less than GetColumnCount().
  238. @see GetColumnAt()
  239. */
  240. unsigned int GetColumnPos(unsigned int idx) const;
  241. /**
  242. Reset the columns order to the natural one.
  243. After calling this function, the column with index @c idx appears at
  244. position @c idx in the control.
  245. */
  246. void ResetColumnsOrder();
  247. /**
  248. Helper function to manipulate the array of column indices.
  249. This function reshuffles the array of column indices indexed by
  250. positions (i.e. using the same convention as for SetColumnsOrder()) so
  251. that the column with the given index is found at the specified
  252. position.
  253. @param order
  254. Array containing the indices of columns in order of their
  255. positions.
  256. @param idx
  257. The index of the column to move.
  258. @param pos
  259. The new position for the column @a idx.
  260. */
  261. static void MoveColumnInOrderArray(wxArrayInt& order,
  262. unsigned int idx,
  263. unsigned int pos);
  264. /**
  265. Show the popup menu allowing the user to show or hide the columns.
  266. This functions shows the popup menu containing all columns with check
  267. marks for the ones which are currently shown and allows the user to
  268. check or uncheck them to toggle their visibility. It is called from the
  269. default EVT_HEADER_RIGHT_CLICK handler for the controls which have
  270. wxHD_ALLOW_HIDE style. And if the column has wxHD_ALLOW_REORDER style
  271. as well, the menu also contains an item to customize the columns shown
  272. using which results in ShowCustomizeDialog() being called, please see
  273. its description for more details.
  274. If a column was toggled, UpdateColumnVisibility() virtual function is
  275. called so it must be implemented for the controls with wxHD_ALLOW_HIDE
  276. style or if you call this function explicitly.
  277. @param pt
  278. The position of the menu, in the header window coordinates.
  279. @param title
  280. The title for the menu if not empty.
  281. @return
  282. @true if a column was shown or hidden or @false if nothing was
  283. done, e.g. because the menu was cancelled.
  284. */
  285. bool ShowColumnsMenu(const wxPoint& pt, const wxString& title = wxString());
  286. /**
  287. Helper function appending the checkable items corresponding to all the
  288. columns to the given menu.
  289. This function is used by ShowColumnsMenu() but can also be used if you
  290. show your own custom columns menu and still want all the columns shown
  291. in it. It appends menu items with column labels as their text and
  292. consecutive ids starting from @a idColumnsBase to the menu and checks
  293. the items corresponding to the currently visible columns.
  294. Example of use:
  295. @code
  296. wxMenu menu;
  297. menu.Append(100, "Some custom command");
  298. menu.AppendSeparator();
  299. AddColumnsItems(menu, 200);
  300. const int rc = GetPopupMenuSelectionFromUser(menu, pt);
  301. if ( rc >= 200 )
  302. ... toggle visibility of the column rc-200 ...
  303. @endcode
  304. @param menu
  305. The menu to append the items to. It may be currently empty or not.
  306. @param idColumnsBase
  307. The id for the menu item corresponding to the first column, the
  308. other ones are consecutive starting from it. It should be positive.
  309. */
  310. void AddColumnsItems(wxMenu& menu, int idColumnsBase = 0);
  311. /**
  312. Show the column customization dialog.
  313. This function displays a modal dialog containing the list of all
  314. columns which the user can use to reorder them as well as show or hide
  315. individual columns.
  316. If the user accepts the changes done in the dialog, the virtual
  317. methods UpdateColumnVisibility() and UpdateColumnsOrder() will be
  318. called so they must be overridden in the derived class if this method
  319. is ever called. Please notice that the user will be able to invoke it
  320. interactively from the header popup menu if the control has both
  321. wxHD_ALLOW_HIDE and wxHD_ALLOW_REORDER styles.
  322. @see wxRearrangeDialog
  323. */
  324. bool ShowCustomizeDialog();
  325. /**
  326. Returns width needed for given column's title.
  327. @since 2.9.4
  328. */
  329. int GetColumnTitleWidth(const wxHeaderColumn& col);
  330. protected:
  331. /**
  332. Method to be implemented by the derived classes to return the
  333. information for the given column.
  334. @param idx
  335. The column index, between 0 and the value last passed to
  336. SetColumnCount().
  337. */
  338. virtual const wxHeaderColumn& GetColumn(unsigned int idx) const = 0;
  339. /**
  340. Method called when the column visibility is changed by the user.
  341. This method is called from ShowColumnsMenu() or ShowCustomizeDialog()
  342. when the user interactively hides or shows a column. A typical
  343. implementation will simply update the internally stored column state.
  344. Notice that there is no need to call UpdateColumn() from this method as
  345. it is already done by wxHeaderCtrl itself.
  346. The base class version doesn't do anything and must be overridden if
  347. this method is called.
  348. @param idx
  349. The index of the column whose visibility was toggled.
  350. @param show
  351. The new visibility value, @true if the column is now shown or
  352. @false if it is not hidden.
  353. */
  354. virtual void UpdateColumnVisibility(unsigned int idx, bool show);
  355. /**
  356. Method called when the columns order is changed in the customization
  357. dialog.
  358. This method is only called from ShowCustomizeDialog() when the user
  359. changes the order of columns. In particular it is @em not called if a
  360. single column changes place because the user dragged it to the new
  361. location, the EVT_HEADER_END_REORDER event handler should be used to
  362. react to this.
  363. A typical implementation in a derived class will update the display
  364. order of the columns in the associated control, if any. Notice that
  365. there is no need to call SetColumnsOrder() from it as wxHeaderCtrl does
  366. it itself.
  367. The base class version doesn't do anything and must be overridden if
  368. this method is called.
  369. @param order
  370. The new column order. This array uses the same convention as
  371. SetColumnsOrder().
  372. */
  373. virtual void UpdateColumnsOrder(const wxArrayInt& order);
  374. /**
  375. Method which may be implemented by the derived classes to allow double
  376. clicking the column separator to resize the column to fit its contents.
  377. When a separator is double clicked, the default handler of
  378. EVT_HEADER_SEPARATOR_DCLICK event calls this function and refreshes the
  379. column if it returns @true so to implement the resizing of the column
  380. to fit its width on header double click you need to implement this
  381. method using logic similar to this example:
  382. @code
  383. class MyHeaderColumn : public wxHeaderColumn
  384. {
  385. public:
  386. ...
  387. void SetWidth(int width) { m_width = width; }
  388. virtual int GetWidth() const { return m_width; }
  389. private:
  390. int m_width;
  391. };
  392. class MyHeaderCtrl : public wxHeaderCtrl
  393. {
  394. public:
  395. protected:
  396. virtual wxHeaderColumn& GetColumn(unsigned int idx) const
  397. {
  398. return m_cols[idx];
  399. }
  400. virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle)
  401. {
  402. int widthContents = ... compute minimal width for column idx ...
  403. m_cols[idx].SetWidth(wxMax(widthContents, widthTitle));
  404. return true;
  405. }
  406. wxVector<MyHeaderColumn> m_cols;
  407. };
  408. @endcode
  409. Base class version simply returns @false.
  410. @param idx
  411. The zero-based index of the column to update.
  412. @param widthTitle
  413. Contains minimal width needed to display the column header itself
  414. and will usually be used as a starting point for the fitting width
  415. calculation.
  416. @return
  417. @true to indicate that the column was resized, i.e. GetColumn() now
  418. returns the new width value, and so must be refreshed or @false
  419. meaning that the control didn't reach to the separator double click.
  420. */
  421. virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle);
  422. /**
  423. Can be overridden in the derived class to update internal data
  424. structures when the number of the columns in the control changes.
  425. This method is called by SetColumnCount() before effectively changing
  426. the number of columns.
  427. The base class version does nothing but it is good practice to still
  428. call it from the overridden version in the derived class.
  429. */
  430. virtual void OnColumnCountChanging(unsigned int count);
  431. };
  432. /**
  433. @class wxHeaderCtrlSimple
  434. wxHeaderCtrlSimple is a concrete header control which can be used directly,
  435. without inheriting from it as you need to do when using wxHeaderCtrl
  436. itself.
  437. When using it, you need to use simple AppendColumn(), InsertColumn() and
  438. DeleteColumn() methods instead of setting the number of columns with
  439. SetColumnCount() and returning the information about them from the
  440. overridden GetColumn().
  441. @library{wxcore}
  442. @category{ctrl}
  443. @see wxHeaderCtrl
  444. */
  445. class wxHeaderCtrlSimple : public wxHeaderCtrl
  446. {
  447. public:
  448. /**
  449. Default constructor not creating the underlying window.
  450. You must use Create() after creating the object using this constructor.
  451. */
  452. wxHeaderCtrlSimple();
  453. /**
  454. Constructor creating the window.
  455. Please see the base class wxHeaderCtrl::Create() method for the
  456. parameters description.
  457. */
  458. wxHeaderCtrlSimple(wxWindow *parent,
  459. wxWindowID winid = wxID_ANY,
  460. const wxPoint& pos = wxDefaultPosition,
  461. const wxSize& size = wxDefaultSize,
  462. long style = wxHD_DEFAULT_STYLE,
  463. const wxString& name = wxHeaderCtrlNameStr);
  464. /**
  465. Insert the column at the given position.
  466. @param col
  467. The column to insert. Notice that because of the existence of
  468. implicit conversion from wxString to wxHeaderColumn a string
  469. can be passed directly here.
  470. @param idx
  471. The position of the new column, from 0 to GetColumnCount(). Using
  472. GetColumnCount() means to append the column to the end.
  473. @see AppendColumn()
  474. */
  475. void InsertColumn(const wxHeaderColumnSimple& col, unsigned int idx);
  476. /**
  477. Append the column to the end of the control.
  478. @see InsertColumn()
  479. */
  480. void AppendColumn(const wxHeaderColumnSimple& col);
  481. /**
  482. Delete the column at the given position.
  483. @see InsertColumn(), AppendColumn()
  484. */
  485. void DeleteColumn(unsigned int idx);
  486. /**
  487. Show or hide the column.
  488. Initially the column is shown by default or hidden if it was added with
  489. wxCOL_HIDDEN flag set.
  490. When a column is hidden, it doesn't appear at all on the screen but its
  491. index is still taken into account when working with other columns. E.g.
  492. if there are three columns 0, 1 and 2 and the column 1 is hidden you
  493. still need to use index 2 to refer to the last visible column.
  494. @param idx
  495. The index of the column to show or hide, from 0 to GetColumnCount().
  496. @param show
  497. Indicates whether the column should be shown (default) or hidden.
  498. */
  499. void ShowColumn(unsigned int idx, bool show = true);
  500. /**
  501. Hide the column with the given index.
  502. This is the same as calling @code ShowColumn(idx, false) @endcode.
  503. @param idx
  504. The index of the column to show or hide, from 0 to GetColumnCount().
  505. */
  506. void HideColumn(unsigned int idx);
  507. /**
  508. Update the column sort indicator.
  509. The sort indicator, if shown, is typically an arrow pointing upwards or
  510. downwards depending on whether the control contents is sorted in
  511. ascending or descending order.
  512. @param idx
  513. The column to set the sort indicator for.
  514. If @c -1 is given, then the currently shown sort indicator
  515. will be removed.
  516. @param sortOrder
  517. If @true or @false show the sort indicator corresponding to
  518. ascending or descending sort order respectively.
  519. */
  520. void ShowSortIndicator(unsigned int idx, bool sortOrder = true);
  521. /**
  522. Remove the sort indicator from the column being used as sort key.
  523. @see ShowSortIndicator
  524. */
  525. void RemoveSortIndicator();
  526. protected:
  527. /**
  528. This function can be overridden in the classes deriving from this
  529. control instead of overriding UpdateColumnWidthToFit().
  530. To implement automatic column resizing to fit its contents width when
  531. the column divider is double clicked, you need to simply return the
  532. fitting width for the given column @a idx from this method, the control
  533. will automatically use the biggest value between the one returned from
  534. here and the one needed for the display of the column title itself.
  535. The base class version returns -1 indicating that this function is not
  536. implemented.
  537. */
  538. virtual int GetBestFittingWidth(unsigned int idx) const;
  539. };
  540. /**
  541. @class wxHeaderCtrlEvent
  542. Event class representing the events generated by wxHeaderCtrl.
  543. @library{wxcore}
  544. @category{events}
  545. @see wxHeaderCtrl
  546. */
  547. class wxHeaderCtrlEvent : public wxNotifyEvent
  548. {
  549. public:
  550. wxHeaderCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
  551. wxHeaderCtrlEvent(const wxHeaderCtrlEvent& event);
  552. /**
  553. Return the index of the column affected by this event.
  554. This method can be called for all header control events.
  555. */
  556. int GetColumn() const;
  557. void SetColumn(int col);
  558. /**
  559. Return the current width of the column.
  560. This method can only be called for the dragging events.
  561. */
  562. int GetWidth() const;
  563. void SetWidth(int width);
  564. /**
  565. Return the new order of the column.
  566. This method can only be called for a reorder event for which it
  567. indicates the tentative new position for the column GetColumn()
  568. selected by the user. If the event is not vetoed, this will become the
  569. new column position in wxHeaderCtrl::GetColumnsOrder().
  570. */
  571. unsigned int GetNewOrder() const;
  572. void SetNewOrder(unsigned int order);
  573. };
  574. wxEventType wxEVT_HEADER_CLICK;
  575. wxEventType wxEVT_HEADER_RIGHT_CLICK;
  576. wxEventType wxEVT_HEADER_MIDDLE_CLICK;
  577. wxEventType wxEVT_HEADER_DCLICK;
  578. wxEventType wxEVT_HEADER_RIGHT_DCLICK;
  579. wxEventType wxEVT_HEADER_MIDDLE_DCLICK;
  580. wxEventType wxEVT_HEADER_SEPARATOR_DCLICK;
  581. wxEventType wxEVT_HEADER_BEGIN_RESIZE;
  582. wxEventType wxEVT_HEADER_RESIZING;
  583. wxEventType wxEVT_HEADER_END_RESIZE;
  584. wxEventType wxEVT_HEADER_BEGIN_REORDER;
  585. wxEventType wxEVT_HEADER_END_REORDER;
  586. wxEventType wxEVT_HEADER_DRAGGING_CANCELLED;