]>
Commit | Line | Data |
---|---|---|
23324ae1 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80cc5fc7 | 2 | // Name: wx/listctrl.h |
e54c96f1 | 3 | // Purpose: interface of wxListCtrl |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
526954c5 | 6 | // Licence: wxWindows licence |
23324ae1 FM |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
9 | /** | |
10 | @class wxListCtrl | |
7c913512 | 11 | |
23324ae1 FM |
12 | A list control presents lists in a number of formats: list view, report view, |
13 | icon view and small icon view. In any case, elements are numbered from zero. | |
14 | For all these modes, the items are stored in the control and must be added to | |
15 | it using wxListCtrl::InsertItem method. | |
7c913512 | 16 | |
23324ae1 FM |
17 | A special case of report view quite different from the other modes of the list |
18 | control is a virtual control in which the items data (including text, images | |
19 | and attributes) is managed by the main program and is requested by the control | |
20 | itself only when needed which allows to have controls with millions of items | |
21 | without consuming much memory. To use virtual list control you must use | |
75504144 | 22 | wxListCtrl::SetItemCount first and override at least wxListCtrl::OnGetItemText |
320ab87c FM |
23 | (and optionally wxListCtrl::OnGetItemImage or wxListCtrl::OnGetItemColumnImage and |
24 | wxListCtrl::OnGetItemAttr) to return the information about the items when the | |
25 | control requests it. | |
5bcb6a69 | 26 | |
320ab87c FM |
27 | Virtual list control can be used as a normal one except that no operations |
28 | which can take time proportional to the number of items in the control happen | |
29 | -- this is required to allow having a practically infinite number of items. | |
30 | For example, in a multiple selection virtual list control, the selections won't | |
31 | be sent when many items are selected at once because this could mean iterating | |
32 | over all the items. | |
7c913512 | 33 | |
23324ae1 | 34 | Using many of wxListCtrl features is shown in the |
320ab87c | 35 | @ref page_samples_listctrl "corresponding sample". |
7c913512 | 36 | |
23324ae1 FM |
37 | To intercept events from a list control, use the event table macros described |
38 | in wxListEvent. | |
7c913512 | 39 | |
320ab87c FM |
40 | <b>wxMac Note</b>: Starting with wxWidgets 2.8, wxListCtrl uses a native |
41 | implementation for report mode, and uses a generic implementation for other | |
42 | modes. You can use the generic implementation for report mode as well by setting | |
5bcb6a69 | 43 | the @c mac.listctrl.always_use_generic system option (see wxSystemOptions) to 1. |
2e2b4d24 | 44 | |
7c913512 | 45 | |
23324ae1 | 46 | @beginStyleTable |
8c6791e4 | 47 | @style{wxLC_LIST} |
23324ae1 FM |
48 | Multicolumn list view, with optional small icons. Columns are |
49 | computed automatically, i.e. you don't set columns as in | |
5bcb6a69 | 50 | @c wxLC_REPORT. In other words, the list wraps, unlike a wxListBox. |
8c6791e4 | 51 | @style{wxLC_REPORT} |
23324ae1 | 52 | Single or multicolumn report view, with optional header. |
8c6791e4 | 53 | @style{wxLC_VIRTUAL} |
23324ae1 | 54 | The application provides items text on demand. May only be used |
5bcb6a69 | 55 | with @c wxLC_REPORT. |
8c6791e4 | 56 | @style{wxLC_ICON} |
23324ae1 | 57 | Large icon view, with optional labels. |
8c6791e4 | 58 | @style{wxLC_SMALL_ICON} |
23324ae1 | 59 | Small icon view, with optional labels. |
8c6791e4 | 60 | @style{wxLC_ALIGN_TOP} |
23324ae1 | 61 | Icons align to the top. Win32 default, Win32 only. |
8c6791e4 | 62 | @style{wxLC_ALIGN_LEFT} |
23324ae1 | 63 | Icons align to the left. |
8c6791e4 | 64 | @style{wxLC_AUTOARRANGE} |
23324ae1 | 65 | Icons arrange themselves. Win32 only. |
8c6791e4 | 66 | @style{wxLC_EDIT_LABELS} |
23324ae1 FM |
67 | Labels are editable: the application will be notified when editing |
68 | starts. | |
8c6791e4 | 69 | @style{wxLC_NO_HEADER} |
23324ae1 | 70 | No header in report mode. |
8c6791e4 | 71 | @style{wxLC_SINGLE_SEL} |
23324ae1 | 72 | Single selection (default is multiple). |
8c6791e4 | 73 | @style{wxLC_SORT_ASCENDING} |
b45506e8 VZ |
74 | Sort in ascending order. (You must still supply a comparison callback |
75 | in wxListCtrl::SortItems.) | |
8c6791e4 | 76 | @style{wxLC_SORT_DESCENDING} |
b45506e8 VZ |
77 | Sort in descending order. (You must still supply a comparison callback |
78 | in wxListCtrl::SortItems.) | |
8c6791e4 | 79 | @style{wxLC_HRULES} |
23324ae1 | 80 | Draws light horizontal rules between rows in report mode. |
8c6791e4 | 81 | @style{wxLC_VRULES} |
23324ae1 FM |
82 | Draws light vertical rules between columns in report mode. |
83 | @endStyleTable | |
7c913512 | 84 | |
2e2b4d24 | 85 | |
3051a44a | 86 | @beginEventEmissionTable{wxListEvent} |
2e2b4d24 RR |
87 | @event{EVT_LIST_BEGIN_DRAG(id, func)} |
88 | Begin dragging with the left mouse button. | |
89 | @event{EVT_LIST_BEGIN_RDRAG(id, func)} | |
90 | Begin dragging with the right mouse button.. | |
f5a64bba | 91 | @event{EVT_LIST_BEGIN_LABEL_EDIT(id, func)} |
2e2b4d24 RR |
92 | Begin editing a label. This can be prevented by calling Veto(). |
93 | @event{EVT_LIST_END_LABEL_EDIT(id, func)} | |
94 | Finish editing a label. This can be prevented by calling Veto(). | |
95 | @event{EVT_LIST_DELETE_ITEM(id, func)} | |
96 | An item was deleted. | |
97 | @event{EVT_LIST_DELETE_ALL_ITEMS(id, func)} | |
98 | All items were deleted. | |
99 | @event{EVT_LIST_ITEM_SELECTED(id, func)} | |
100 | The item has been selected. | |
101 | @event{EVT_LIST_ITEM_DESELECTED(id, func)} | |
102 | The item has been deselected. | |
103 | @event{EVT_LIST_ITEM_ACTIVATED(id, func)} | |
104 | The item has been activated (ENTER or double click). | |
105 | @event{EVT_LIST_ITEM_FOCUSED(id, func)} | |
106 | The currently focused item has changed. | |
107 | @event{EVT_LIST_ITEM_MIDDLE_CLICK(id, func)} | |
108 | The middle mouse button has been clicked on an item. | |
109 | @event{EVT_LIST_ITEM_RIGHT_CLICK(id, func)} | |
320ab87c | 110 | The right mouse button has been clicked on an item. |
2e2b4d24 RR |
111 | @event{EVT_LIST_KEY_DOWN(id, func)} |
112 | A key has been pressed. | |
113 | @event{EVT_LIST_INSERT_ITEM(id, func)} | |
114 | An item has been inserted. | |
115 | @event{EVT_LIST_COL_CLICK(id, func)} | |
116 | A column (m_col) has been left-clicked. | |
117 | @event{EVT_LIST_COL_RIGHT_CLICK(id, func)} | |
118 | A column (m_col) has been right-clicked. | |
119 | @event{EVT_LIST_COL_BEGIN_DRAG(id, func)} | |
120 | The user started resizing a column - can be vetoed. | |
121 | @event{EVT_LIST_COL_DRAGGING(id, func)} | |
122 | The divider between columns is being dragged. | |
123 | @event{EVT_LIST_COL_END_DRAG(id, func)} | |
124 | A column has been resized by the user. | |
125 | @event{EVT_LIST_CACHE_HINT(id, func)} | |
126 | Prepare cache for a virtual list control. | |
127 | @endEventTable | |
128 | ||
129 | ||
23324ae1 FM |
130 | @library{wxcore} |
131 | @category{ctrl} | |
7e59b885 | 132 | @appearance{listctrl.png} |
7c913512 | 133 | |
320ab87c FM |
134 | @see @ref overview_listctrl, wxListView, wxListBox, wxTreeCtrl, wxImageList, |
135 | wxListEvent, wxListItem, wxEditableListBox | |
23324ae1 FM |
136 | */ |
137 | class wxListCtrl : public wxControl | |
138 | { | |
139 | public: | |
b45506e8 | 140 | /** |
1d7c0c08 | 141 | Default constructor. |
b45506e8 VZ |
142 | */ |
143 | wxListCtrl(); | |
144 | ||
23324ae1 FM |
145 | /** |
146 | Constructor, creating and showing a list control. | |
3c4f71cc | 147 | |
7c913512 | 148 | @param parent |
4cc4bfaf | 149 | Parent window. Must not be @NULL. |
7c913512 | 150 | @param id |
4cc4bfaf | 151 | Window identifier. The value wxID_ANY indicates a default value. |
7c913512 | 152 | @param pos |
4cc4bfaf | 153 | Window position. |
dc1b07fd | 154 | If ::wxDefaultPosition is specified then a default position is chosen. |
7c913512 | 155 | @param size |
320ab87c | 156 | Window size. |
dc1b07fd | 157 | If ::wxDefaultSize is specified then the window is sized appropriately. |
7c913512 | 158 | @param style |
4cc4bfaf | 159 | Window style. See wxListCtrl. |
7c913512 | 160 | @param validator |
4cc4bfaf | 161 | Window validator. |
7c913512 | 162 | @param name |
4cc4bfaf | 163 | Window name. |
3c4f71cc | 164 | |
4cc4bfaf | 165 | @see Create(), wxValidator |
23324ae1 | 166 | */ |
7c913512 FM |
167 | wxListCtrl(wxWindow* parent, wxWindowID id, |
168 | const wxPoint& pos = wxDefaultPosition, | |
169 | const wxSize& size = wxDefaultSize, | |
170 | long style = wxLC_ICON, | |
171 | const wxValidator& validator = wxDefaultValidator, | |
172 | const wxString& name = wxListCtrlNameStr); | |
23324ae1 FM |
173 | |
174 | /** | |
175 | Destructor, destroying the list control. | |
176 | */ | |
adaaa686 | 177 | virtual ~wxListCtrl(); |
23324ae1 FM |
178 | |
179 | /** | |
320ab87c FM |
180 | Arranges the items in icon or small icon view. |
181 | This only has effect on Win32. @a flag is one of: | |
1d7c0c08 RR |
182 | - wxLIST_ALIGN_DEFAULT: Default alignment. |
183 | - wxLIST_ALIGN_LEFT: Align to the left side of the control. | |
184 | - wxLIST_ALIGN_TOP: Align to the top side of the control. | |
185 | - wxLIST_ALIGN_SNAP_TO_GRID: Snap to grid. | |
23324ae1 FM |
186 | */ |
187 | bool Arrange(int flag = wxLIST_ALIGN_DEFAULT); | |
188 | ||
189 | /** | |
320ab87c FM |
190 | Sets the image list associated with the control and takes ownership of it |
191 | (i.e. the control will, unlike when using SetImageList(), delete the list | |
192 | when destroyed). @a which is one of @c wxIMAGE_LIST_NORMAL, @c wxIMAGE_LIST_SMALL, | |
193 | @c wxIMAGE_LIST_STATE (the last is unimplemented). | |
3c4f71cc | 194 | |
4cc4bfaf | 195 | @see SetImageList() |
23324ae1 FM |
196 | */ |
197 | void AssignImageList(wxImageList* imageList, int which); | |
198 | ||
199 | /** | |
200 | Deletes all items and all columns. | |
201 | */ | |
202 | void ClearAll(); | |
203 | ||
204 | /** | |
205 | Creates the list control. See wxListCtrl() for further details. | |
206 | */ | |
207 | bool Create(wxWindow* parent, wxWindowID id, | |
208 | const wxPoint& pos = wxDefaultPosition, | |
209 | const wxSize& size = wxDefaultSize, | |
210 | long style = wxLC_ICON, | |
211 | const wxValidator& validator = wxDefaultValidator, | |
212 | const wxString& name = wxListCtrlNameStr); | |
213 | ||
214 | /** | |
215 | Deletes all items in the list control. | |
320ab87c | 216 | |
4b97af90 VZ |
217 | This function does @e not send the @c wxEVT_COMMAND_LIST_DELETE_ITEM |
218 | event because deleting many items from the control would be too slow | |
219 | then (unlike wxListCtrl::DeleteItem) but it does send the special @c | |
220 | wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS event if the control was not empty. | |
221 | If it was already empty, nothing is done and no event is sent. | |
222 | ||
223 | @return @true if the items were successfully deleted or if the control | |
224 | was already empty, @false if an error occurred while deleting the | |
225 | items. | |
23324ae1 FM |
226 | */ |
227 | bool DeleteAllItems(); | |
228 | ||
229 | /** | |
230 | Deletes a column. | |
231 | */ | |
232 | bool DeleteColumn(int col); | |
233 | ||
234 | /** | |
320ab87c FM |
235 | Deletes the specified item. |
236 | This function sends the @c wxEVT_COMMAND_LIST_DELETE_ITEM event for the | |
237 | item being deleted. | |
238 | ||
239 | @see DeleteAllItems() | |
23324ae1 FM |
240 | */ |
241 | bool DeleteItem(long item); | |
242 | ||
243 | /** | |
320ab87c FM |
244 | Starts editing the label of the given item. |
245 | ||
246 | This function generates a @c EVT_LIST_BEGIN_LABEL_EDIT event which can be | |
247 | vetoed so that no text control will appear for in-place editing. | |
248 | ||
23324ae1 | 249 | If the user changed the label (i.e. s/he does not press ESC or leave |
320ab87c | 250 | the text control without changes, a @c EVT_LIST_END_LABEL_EDIT event |
23324ae1 FM |
251 | will be sent which can be vetoed as well. |
252 | */ | |
5267aefd | 253 | wxTextCtrl* EditLabel(long item, |
b19b28c8 | 254 | wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); |
23324ae1 | 255 | |
747eb0f6 VZ |
256 | /** |
257 | Finish editing the label. | |
258 | ||
259 | This method allows to programmatically end editing a list control item | |
260 | in place. Usually it will only be called when editing is in progress, | |
417b8fcc VZ |
261 | i.e. if GetEditControl() returns non-NULL. In particular, do not call |
262 | it from EVT_LIST_BEGIN_LABEL_EDIT handler as the edit control is not | |
263 | yet fully created by then, just veto the event in this handler instead | |
264 | to prevent the editing from even starting. | |
265 | ||
266 | Notice that calling this method will result in EVT_LIST_END_LABEL_EDIT | |
267 | event being generated. | |
747eb0f6 VZ |
268 | |
269 | Currently only implemented in wxMSW. | |
270 | ||
271 | @param cancel If @true, discard the changes made by user, as if @c | |
272 | Escape key was pressed. Otherwise, accept the changes as if @c | |
273 | Return was pressed. | |
274 | @return @true if item editing wad finished or @false if no item as | |
275 | being edited. | |
276 | */ | |
277 | bool EndEditLabel(bool cancel); | |
278 | ||
23324ae1 FM |
279 | /** |
280 | Ensures this item is visible. | |
281 | */ | |
282 | bool EnsureVisible(long item); | |
283 | ||
23324ae1 | 284 | /** |
320ab87c FM |
285 | Find an item whose label matches this string, starting from start or the |
286 | beginning if start is @c -1. The string comparison is case insensitive. | |
287 | ||
288 | If @a partial is @true then this method will look for items which begin with @a str. | |
c2ebca9b VZ |
289 | |
290 | @return The next matching item if any or @c -1 (wxNOT_FOUND) otherwise. | |
23324ae1 FM |
291 | */ |
292 | long FindItem(long start, const wxString& str, | |
4cc4bfaf | 293 | bool partial = false); |
320ab87c | 294 | |
1d7c0c08 | 295 | /** |
320ab87c FM |
296 | Find an item whose data matches this data, starting from start or the |
297 | beginning if 'start' is @c -1. | |
1058f652 MB |
298 | |
299 | @beginWxPerlOnly | |
300 | In wxPerl this method is implemented as FindItemData(start, data). | |
301 | @endWxPerlOnly | |
c2ebca9b VZ |
302 | |
303 | @return The next matching item if any or @c -1 (wxNOT_FOUND) otherwise. | |
1d7c0c08 | 304 | */ |
0a98423e | 305 | long FindItem(long start, wxUIntPtr data); |
320ab87c | 306 | |
1d7c0c08 RR |
307 | /** |
308 | Find an item nearest this position in the specified direction, | |
309 | starting from @a start or the beginning if @a start is -1. | |
1058f652 MB |
310 | |
311 | @beginWxPerlOnly | |
312 | In wxPerl this method is implemented as FindItemAtPos(start, pt, direction). | |
313 | @endWxPerlOnly | |
c2ebca9b VZ |
314 | |
315 | @return The next matching item if any or @c -1 (wxNOT_FOUND) otherwise. | |
1d7c0c08 | 316 | */ |
7c913512 | 317 | long FindItem(long start, const wxPoint& pt, int direction); |
23324ae1 FM |
318 | |
319 | /** | |
320ab87c FM |
320 | Gets information about this column. |
321 | See SetItem() for more information. | |
1058f652 MB |
322 | |
323 | @beginWxPerlOnly | |
324 | In wxPerl this method takes only the @a col parameter and | |
325 | returns a @c Wx::ListItem (or @c undef). | |
326 | @endWxPerlOnly | |
23324ae1 | 327 | */ |
328f5751 | 328 | bool GetColumn(int col, wxListItem& item) const; |
23324ae1 FM |
329 | |
330 | /** | |
331 | Returns the number of columns. | |
332 | */ | |
328f5751 | 333 | int GetColumnCount() const; |
23324ae1 FM |
334 | |
335 | /** | |
80cc5fc7 VZ |
336 | Gets the column index from its position in visual order. |
337 | ||
338 | After calling SetColumnsOrder(), the index returned by this function | |
339 | corresponds to the value of the element number @a pos in the array | |
340 | returned by GetColumnsOrder(). | |
341 | ||
342 | Please see SetColumnsOrder() documentation for an example and | |
343 | additional remarks about the columns ordering. | |
344 | ||
345 | @see GetColumnOrder() | |
23324ae1 | 346 | */ |
80cc5fc7 | 347 | int GetColumnIndexFromOrder(int pos) const; |
23324ae1 FM |
348 | |
349 | /** | |
80cc5fc7 VZ |
350 | Gets the column visual order position. |
351 | ||
352 | This function returns the index of the column which appears at the | |
353 | given visual position, e.g. calling it with @a col equal to 0 returns | |
354 | the index of the first shown column. | |
355 | ||
356 | Please see SetColumnsOrder() documentation for an example and | |
357 | additional remarks about the columns ordering. | |
358 | ||
359 | @see GetColumnsOrder(), GetColumnIndexFromOrder() | |
23324ae1 | 360 | */ |
328f5751 | 361 | int GetColumnOrder(int col) const; |
23324ae1 FM |
362 | |
363 | /** | |
364 | Gets the column width (report view only). | |
365 | */ | |
328f5751 | 366 | int GetColumnWidth(int col) const; |
23324ae1 FM |
367 | |
368 | /** | |
320ab87c | 369 | Returns the array containing the orders of all columns. |
80cc5fc7 | 370 | |
320ab87c | 371 | On error, an empty array is returned. |
80cc5fc7 VZ |
372 | |
373 | Please see SetColumnsOrder() documentation for an example and | |
374 | additional remarks about the columns ordering. | |
375 | ||
376 | @see GetColumnOrder(), GetColumnIndexFromOrder() | |
23324ae1 | 377 | */ |
328f5751 | 378 | wxArrayInt GetColumnsOrder() const; |
23324ae1 FM |
379 | |
380 | /** | |
320ab87c FM |
381 | Gets the number of items that can fit vertically in the visible area of |
382 | the list control (list or report view) or the total number of items in | |
383 | the list control (icon or small icon view). | |
23324ae1 | 384 | */ |
328f5751 | 385 | int GetCountPerPage() const; |
23324ae1 FM |
386 | |
387 | /** | |
320ab87c FM |
388 | Returns the edit control being currently used to edit a label. |
389 | Returns @NULL if no label is being edited. | |
390 | ||
1f1d2182 | 391 | @note It is currently only implemented for wxMSW and the generic version, |
320ab87c | 392 | not for the native Mac OS X version. |
23324ae1 | 393 | */ |
328f5751 | 394 | wxTextCtrl* GetEditControl() const; |
23324ae1 FM |
395 | |
396 | /** | |
4cc4bfaf | 397 | Returns the specified image list. @a which may be one of: |
1d7c0c08 RR |
398 | - wxIMAGE_LIST_NORMAL: The normal (large icon) image list. |
399 | - wxIMAGE_LIST_SMALL: The small icon image list. | |
400 | - wxIMAGE_LIST_STATE: The user-defined state image list (unimplemented). | |
23324ae1 | 401 | */ |
328f5751 | 402 | wxImageList* GetImageList(int which) const; |
23324ae1 FM |
403 | |
404 | /** | |
320ab87c | 405 | Gets information about the item. See SetItem() for more information. |
c86b476d FM |
406 | |
407 | You must call @e info.SetId() to set the ID of item you're interested in | |
408 | before calling this method, and @e info.SetMask() with the flags indicating | |
409 | what fields you need to retrieve from @a info. | |
1058f652 MB |
410 | |
411 | @beginWxPerlOnly | |
412 | In wxPerl this method takes as parameter the ID of the item | |
413 | and (optionally) the column, and returns a Wx::ListItem object. | |
414 | @endWxPerlOnly | |
23324ae1 | 415 | */ |
328f5751 | 416 | bool GetItem(wxListItem& info) const; |
23324ae1 FM |
417 | |
418 | /** | |
320ab87c FM |
419 | Returns the colour for this item. |
420 | If the item has no specific colour, returns an invalid colour | |
421 | (and not the default background control of the control itself). | |
3c4f71cc | 422 | |
4cc4bfaf | 423 | @see GetItemTextColour() |
23324ae1 | 424 | */ |
328f5751 | 425 | wxColour GetItemBackgroundColour(long item) const; |
23324ae1 FM |
426 | |
427 | /** | |
428 | Returns the number of items in the list control. | |
429 | */ | |
328f5751 | 430 | int GetItemCount() const; |
23324ae1 FM |
431 | |
432 | /** | |
433 | Gets the application-defined data associated with this item. | |
434 | */ | |
5267aefd | 435 | wxUIntPtr GetItemData(long item) const; |
23324ae1 FM |
436 | |
437 | /** | |
438 | Returns the item's font. | |
439 | */ | |
328f5751 | 440 | wxFont GetItemFont(long item) const; |
23324ae1 FM |
441 | |
442 | /** | |
443 | Returns the position of the item, in icon or small icon view. | |
1058f652 MB |
444 | |
445 | @beginWxPerlOnly | |
446 | In wxPerl this method takes only the @a item parameter and | |
447 | returns a @c Wx::Point (or @c undef). | |
448 | @endWxPerlOnly | |
23324ae1 | 449 | */ |
328f5751 | 450 | bool GetItemPosition(long item, wxPoint& pos) const; |
23324ae1 FM |
451 | |
452 | /** | |
453 | Returns the rectangle representing the item's size and position, in physical | |
454 | coordinates. | |
320ab87c | 455 | |
4cc4bfaf | 456 | @a code is one of wxLIST_RECT_BOUNDS, wxLIST_RECT_ICON, wxLIST_RECT_LABEL. |
1058f652 MB |
457 | |
458 | @beginWxPerlOnly | |
459 | In wxPerl this method takes only the @a item and @a code parameters and | |
460 | returns a @c Wx::Rect (or @c undef). | |
461 | @endWxPerlOnly | |
23324ae1 FM |
462 | */ |
463 | bool GetItemRect(long item, wxRect& rect, | |
328f5751 | 464 | int code = wxLIST_RECT_BOUNDS) const; |
23324ae1 FM |
465 | |
466 | /** | |
320ab87c FM |
467 | Retrieves the spacing between icons in pixels: horizontal spacing is |
468 | returned as @c x component of the wxSize object and the vertical spacing | |
469 | as its @c y component. | |
23324ae1 | 470 | */ |
328f5751 | 471 | wxSize GetItemSpacing() const; |
23324ae1 FM |
472 | |
473 | /** | |
474 | Gets the item state. For a list of state flags, see SetItem(). | |
320ab87c | 475 | The @a stateMask indicates which state flags are of interest. |
23324ae1 | 476 | */ |
328f5751 | 477 | int GetItemState(long item, long stateMask) const; |
23324ae1 FM |
478 | |
479 | /** | |
480 | Gets the item text for this item. | |
b6812a6f VZ |
481 | |
482 | @param item | |
483 | Item (zero-based) index. | |
484 | @param col | |
485 | Item column (zero-based) index. Column 0 is the default. This | |
486 | parameter is new in wxWidgets 2.9.1. | |
23324ae1 | 487 | */ |
b6812a6f | 488 | wxString GetItemText(long item, int col = 0) const; |
23324ae1 FM |
489 | |
490 | /** | |
320ab87c FM |
491 | Returns the colour for this item. |
492 | ||
493 | If the item has no specific colour, returns an invalid colour (and not the | |
494 | default foreground control of the control itself as this wouldn't allow | |
495 | distinguishing between items having the same colour as the current control | |
496 | foreground and items with default colour which, hence, have always the | |
497 | same colour as the control). | |
23324ae1 | 498 | */ |
328f5751 | 499 | wxColour GetItemTextColour(long item) const; |
23324ae1 FM |
500 | |
501 | /** | |
502 | Searches for an item with the given geometry or state, starting from | |
320ab87c | 503 | @a item but excluding the @a item itself. |
3c4f71cc | 504 | |
320ab87c FM |
505 | If @a item is -1, the first item that matches the specified flags will be returned. |
506 | Returns the first item with given state following @a item or -1 if no such item found. | |
507 | This function may be used to find all selected items in the control like this: | |
3c4f71cc | 508 | |
320ab87c FM |
509 | @code |
510 | long item = -1; | |
511 | for ( ;; ) | |
512 | { | |
513 | item = listctrl->GetNextItem(item, | |
514 | wxLIST_NEXT_ALL, | |
515 | wxLIST_STATE_SELECTED); | |
516 | if ( item == -1 ) | |
517 | break; | |
518 | ||
519 | // this item is selected - do whatever is needed with it | |
520 | wxLogMessage("Item %ld is selected.", item); | |
521 | } | |
522 | @endcode | |
3c4f71cc | 523 | |
320ab87c FM |
524 | @a geometry can be one of: |
525 | - wxLIST_NEXT_ABOVE: Searches for an item above the specified item. | |
526 | - wxLIST_NEXT_ALL: Searches for subsequent item by index. | |
527 | - wxLIST_NEXT_BELOW: Searches for an item below the specified item. | |
528 | - wxLIST_NEXT_LEFT: Searches for an item to the left of the specified item. | |
529 | - wxLIST_NEXT_RIGHT: Searches for an item to the right of the specified item. | |
3c4f71cc | 530 | |
1f1d2182 | 531 | @note this parameter is only supported by wxMSW currently and ignored on |
320ab87c | 532 | other platforms. |
3c4f71cc | 533 | |
320ab87c FM |
534 | @a state can be a bitlist of the following: |
535 | - wxLIST_STATE_DONTCARE: Don't care what the state is. | |
536 | - wxLIST_STATE_DROPHILITED: The item indicates it is a drop target. | |
537 | - wxLIST_STATE_FOCUSED: The item has the focus. | |
538 | - wxLIST_STATE_SELECTED: The item is selected. | |
539 | - wxLIST_STATE_CUT: The item is selected as part of a cut and paste operation. | |
23324ae1 FM |
540 | */ |
541 | long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, | |
328f5751 | 542 | int state = wxLIST_STATE_DONTCARE) const; |
23324ae1 FM |
543 | |
544 | /** | |
545 | Returns the number of selected items in the list control. | |
546 | */ | |
328f5751 | 547 | int GetSelectedItemCount() const; |
23324ae1 FM |
548 | |
549 | /** | |
550 | Returns the rectangle representing the size and position, in physical | |
4cc4bfaf | 551 | coordinates, of the given subitem, i.e. the part of the row @a item in the |
320ab87c FM |
552 | column @a subItem. |
553 | ||
554 | This method is only meaningfull when the wxListCtrl is in the report mode. | |
555 | If @a subItem parameter is equal to the special value | |
23324ae1 FM |
556 | @c wxLIST_GETSUBITEMRECT_WHOLEITEM the return value is the same as |
557 | for GetItemRect(). | |
320ab87c FM |
558 | |
559 | @a code can be one of @c wxLIST_RECT_BOUNDS, @c wxLIST_RECT_ICON or | |
560 | @c wxLIST_RECT_LABEL. | |
3c4f71cc | 561 | |
1e24c2af | 562 | @since 2.7.0 |
23324ae1 FM |
563 | */ |
564 | bool GetSubItemRect(long item, long subItem, wxRect& rect, | |
328f5751 | 565 | int code = wxLIST_RECT_BOUNDS) const; |
23324ae1 FM |
566 | |
567 | /** | |
568 | Gets the text colour of the list control. | |
569 | */ | |
328f5751 | 570 | wxColour GetTextColour() const; |
23324ae1 FM |
571 | |
572 | /** | |
320ab87c | 573 | Gets the index of the topmost visible item when in list or report view. |
23324ae1 | 574 | */ |
328f5751 | 575 | long GetTopItem() const; |
23324ae1 FM |
576 | |
577 | /** | |
578 | Returns the rectangle taken by all items in the control. In other words, if the | |
579 | controls client size were equal to the size of this rectangle, no scrollbars | |
580 | would be needed and no free space would be left. | |
320ab87c | 581 | |
23324ae1 FM |
582 | Note that this function only works in the icon and small icon views, not in |
583 | list or report views (this is a limitation of the native Win32 control). | |
584 | */ | |
328f5751 | 585 | wxRect GetViewRect() const; |
23324ae1 FM |
586 | |
587 | /** | |
320ab87c FM |
588 | Determines which item (if any) is at the specified point, giving details |
589 | in @a flags. Returns index of the item or @c wxNOT_FOUND if no item is at | |
590 | the specified point. | |
3c4f71cc | 591 | |
320ab87c FM |
592 | @a flags will be a combination of the following flags: |
593 | - wxLIST_HITTEST_ABOVE: Above the client area. | |
594 | - wxLIST_HITTEST_BELOW: Below the client area. | |
595 | - wxLIST_HITTEST_NOWHERE: In the client area but below the last item. | |
596 | - wxLIST_HITTEST_ONITEMICON: On the bitmap associated with an item. | |
597 | - wxLIST_HITTEST_ONITEMLABEL: On the label (string) associated with an item. | |
598 | - wxLIST_HITTEST_ONITEMRIGHT: In the area to the right of an item. | |
599 | - wxLIST_HITTEST_ONITEMSTATEICON: On the state icon for a tree view item | |
600 | that is in a user-defined state. | |
601 | - wxLIST_HITTEST_TOLEFT: To the right of the client area. | |
602 | - wxLIST_HITTEST_TORIGHT: To the left of the client area. | |
603 | - wxLIST_HITTEST_ONITEM: Combination of @c wxLIST_HITTEST_ONITEMICON, | |
604 | @c wxLIST_HITTEST_ONITEMLABEL, @c wxLIST_HITTEST_ONITEMSTATEICON. | |
3c4f71cc | 605 | |
4cc4bfaf | 606 | If @a ptrSubItem is not @NULL and the wxListCtrl is in the report |
7c913512 | 607 | mode the subitem (or column) number will also be provided. |
23324ae1 FM |
608 | This feature is only available in version 2.7.0 or higher and is currently only |
609 | implemented under wxMSW and requires at least comctl32.dll of verion 4.70 on | |
320ab87c FM |
610 | the host system or the value stored in @a ptrSubItem will be always -1. |
611 | To compile this feature into wxWidgets library you need to have access to | |
23324ae1 | 612 | commctrl.h of version 4.70 that is provided by Microsoft. |
1058f652 MB |
613 | |
614 | @beginWxPerlOnly | |
615 | In wxPerl this method only takes the @a point parameter | |
616 | and returns a 2-element list (item, flags). | |
617 | @endWxPerlOnly | |
23324ae1 | 618 | */ |
5267aefd | 619 | long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const; |
23324ae1 | 620 | |
23324ae1 FM |
621 | /** |
622 | For report view mode (only), inserts a column. For more details, see SetItem(). | |
623 | */ | |
624 | long InsertColumn(long col, wxListItem& info); | |
320ab87c | 625 | |
1d7c0c08 RR |
626 | /** |
627 | For report view mode (only), inserts a column. For more details, see SetItem(). | |
628 | */ | |
7c913512 FM |
629 | long InsertColumn(long col, const wxString& heading, |
630 | int format = wxLIST_FORMAT_LEFT, | |
631 | int width = -1); | |
23324ae1 | 632 | |
23324ae1 | 633 | /** |
320ab87c FM |
634 | Inserts an item, returning the index of the new item if successful, -1 otherwise. |
635 | ||
7c913512 | 636 | @param info |
4cc4bfaf | 637 | wxListItem object |
b45506e8 VZ |
638 | */ |
639 | long InsertItem(wxListItem& info); | |
640 | ||
641 | /** | |
642 | Insert an string item. | |
320ab87c | 643 | |
7c913512 | 644 | @param index |
4cc4bfaf | 645 | Index of the new item, supplied by the application |
7c913512 | 646 | @param label |
4cc4bfaf | 647 | String label |
1058f652 MB |
648 | |
649 | @beginWxPerlOnly | |
650 | In wxPerl this method is implemented as InsertStringItem(index, label). | |
651 | @endWxPerlOnly | |
23324ae1 | 652 | */ |
7c913512 | 653 | long InsertItem(long index, const wxString& label); |
320ab87c | 654 | |
b45506e8 VZ |
655 | /** |
656 | Insert an image item. | |
320ab87c | 657 | |
b45506e8 VZ |
658 | @param index |
659 | Index of the new item, supplied by the application | |
660 | @param imageIndex | |
661 | Index into the image list associated with this control and view style | |
1058f652 MB |
662 | |
663 | @beginWxPerlOnly | |
664 | In wxPerl this method is implemented as InsertImageItem(index, imageIndex). | |
665 | @endWxPerlOnly | |
320ab87c | 666 | */ |
7c913512 | 667 | long InsertItem(long index, int imageIndex); |
320ab87c | 668 | |
b45506e8 VZ |
669 | /** |
670 | Insert an image/string item. | |
320ab87c | 671 | |
b45506e8 VZ |
672 | @param index |
673 | Index of the new item, supplied by the application | |
674 | @param label | |
675 | String label | |
676 | @param imageIndex | |
677 | Index into the image list associated with this control and view style | |
1058f652 MB |
678 | |
679 | @beginWxPerlOnly | |
680 | In wxPerl this method is implemented as InsertImageStringItem(index, label, imageIndex). | |
681 | @endWxPerlOnly | |
320ab87c | 682 | */ |
7c913512 FM |
683 | long InsertItem(long index, const wxString& label, |
684 | int imageIndex); | |
23324ae1 | 685 | |
23324ae1 | 686 | /** |
320ab87c FM |
687 | Redraws the given @e item. |
688 | ||
689 | This is only useful for the virtual list controls as without calling this | |
690 | function the displayed value of the item doesn't change even when the | |
691 | underlying data does change. | |
3c4f71cc | 692 | |
4cc4bfaf | 693 | @see RefreshItems() |
23324ae1 FM |
694 | */ |
695 | void RefreshItem(long item); | |
696 | ||
697 | /** | |
320ab87c FM |
698 | Redraws the items between @a itemFrom and @e itemTo. |
699 | The starting item must be less than or equal to the ending one. | |
700 | ||
701 | Just as RefreshItem() this is only useful for virtual list controls. | |
23324ae1 FM |
702 | */ |
703 | void RefreshItems(long itemFrom, long itemTo); | |
704 | ||
705 | /** | |
706 | Scrolls the list control. If in icon, small icon or report view mode, | |
4cc4bfaf FM |
707 | @a dx specifies the number of pixels to scroll. If in list view mode, |
708 | @a dx specifies the number of columns to scroll. @a dy always specifies | |
23324ae1 | 709 | the number of pixels to scroll vertically. |
320ab87c | 710 | |
1f1d2182 | 711 | @note This method is currently only implemented in the Windows version. |
23324ae1 FM |
712 | */ |
713 | bool ScrollList(int dx, int dy); | |
714 | ||
715 | /** | |
320ab87c FM |
716 | Sets the background colour. |
717 | ||
718 | Note that the wxWindow::GetBackgroundColour() function of wxWindow base | |
719 | class can be used to retrieve the current background colour. | |
23324ae1 | 720 | */ |
5267aefd | 721 | virtual bool SetBackgroundColour(const wxColour& col); |
23324ae1 FM |
722 | |
723 | /** | |
320ab87c FM |
724 | Sets information about this column. |
725 | See SetItem() for more information. | |
23324ae1 FM |
726 | */ |
727 | bool SetColumn(int col, wxListItem& item); | |
728 | ||
729 | /** | |
730 | Sets the column width. | |
320ab87c FM |
731 | |
732 | @a width can be a width in pixels or @c wxLIST_AUTOSIZE (-1) or | |
733 | @c wxLIST_AUTOSIZE_USEHEADER (-2). | |
734 | ||
735 | @c wxLIST_AUTOSIZE will resize the column to the length of its longest item. | |
736 | ||
737 | @c wxLIST_AUTOSIZE_USEHEADER will resize the column to the length of the | |
738 | header (Win32) or 80 pixels (other platforms). | |
739 | ||
4cc4bfaf | 740 | In small or normal icon view, @a col must be -1, and the column width is set |
23324ae1 FM |
741 | for all columns. |
742 | */ | |
743 | bool SetColumnWidth(int col, int width); | |
744 | ||
745 | /** | |
80cc5fc7 VZ |
746 | Changes the order in which the columns are shown. |
747 | ||
748 | By default, the columns of a list control appear on the screen in order | |
749 | of their indices, i.e. the column 0 appears first, the column 1 next | |
750 | and so on. However by using this function it is possible to arbitrarily | |
751 | reorder the columns visual order and the user can also rearrange the | |
752 | columns interactively by dragging them. In this case, the index of the | |
753 | column is not the same as its order and the functions GetColumnOrder() | |
754 | and GetColumnIndexFromOrder() should be used to translate between them. | |
755 | Notice that all the other functions still work with the column indices, | |
756 | i.e. the visual positioning of the columns on screen doesn't affect the | |
757 | code setting or getting their values for example. | |
320ab87c FM |
758 | |
759 | The @a orders array must have the same number elements as the number of | |
80cc5fc7 VZ |
760 | columns and contain each position exactly once. Its n-th element |
761 | contains the index of the column to be shown in n-th position, so for a | |
762 | control with three columns passing an array with elements 2, 0 and 1 | |
763 | results in the third column being displayed first, the first one next | |
764 | and the second one last. | |
765 | ||
766 | Example of using it: | |
767 | @code | |
768 | wxListCtrl *list = new wxListCtrl(...); | |
769 | for ( int i = 0; i < 3; i++ ) | |
770 | list->InsertColumn(i, wxString::Format("Column %d", i)); | |
771 | ||
772 | wxArrayInt order(3); | |
773 | order[0] = 2; | |
774 | order[1] = 0; | |
775 | order[2] = 1; | |
776 | list->SetColumnsOrder(order); | |
777 | ||
778 | // now list->GetColumnsOrder() will return order and | |
779 | // list->GetColumnIndexFromOrder(n) will return order[n] and | |
780 | // list->GetColumnOrder() will return 1, 2 and 0 for the column 0, | |
781 | // 1 and 2 respectively | |
782 | @endcode | |
783 | ||
784 | Please notice that this function makes sense for report view only and | |
785 | currently is only implemented in wxMSW port. To avoid explicit tests | |
786 | for @c __WXMSW__ in your code, please use @c wxHAS_LISTCTRL_COLUMN_ORDER | |
787 | as this will allow it to start working under the other platforms when | |
788 | support for the column reordering is added there. | |
320ab87c | 789 | |
80cc5fc7 | 790 | @see GetColumnsOrder() |
23324ae1 | 791 | */ |
80cc5fc7 | 792 | bool SetColumnsOrder(const wxArrayInt& orders) const; |
23324ae1 FM |
793 | |
794 | /** | |
320ab87c FM |
795 | Sets the image list associated with the control. |
796 | ||
797 | @a which is one of @c wxIMAGE_LIST_NORMAL, @c wxIMAGE_LIST_SMALL, | |
798 | @c wxIMAGE_LIST_STATE (the last is unimplemented). | |
799 | ||
23324ae1 FM |
800 | This method does not take ownership of the image list, you have to |
801 | delete it yourself. | |
3c4f71cc | 802 | |
4cc4bfaf | 803 | @see AssignImageList() |
23324ae1 FM |
804 | */ |
805 | void SetImageList(wxImageList* imageList, int which); | |
806 | ||
23324ae1 | 807 | /** |
1d7c0c08 | 808 | Sets the data of an item. |
320ab87c FM |
809 | |
810 | Using the wxListItem's mask and state mask, you can change only selected | |
811 | attributes of a wxListCtrl item. | |
23324ae1 FM |
812 | */ |
813 | bool SetItem(wxListItem& info); | |
320ab87c | 814 | |
1d7c0c08 | 815 | /** |
320ab87c | 816 | Sets an item string field at a particular column. |
1d7c0c08 | 817 | */ |
320ab87c | 818 | long SetItem(long index, int column, const wxString& label, int imageId = -1); |
23324ae1 FM |
819 | |
820 | /** | |
320ab87c FM |
821 | Sets the background colour for this item. |
822 | This function only works in report view mode. | |
823 | The colour can be retrieved using GetItemBackgroundColour(). | |
23324ae1 FM |
824 | */ |
825 | void SetItemBackgroundColour(long item, const wxColour& col); | |
826 | ||
827 | /** | |
320ab87c FM |
828 | Sets the image associated with the item. |
829 | In report view, you can specify the column. | |
830 | The image is an index into the image list associated with the list control. | |
23324ae1 FM |
831 | */ |
832 | bool SetItemColumnImage(long item, long column, int image); | |
833 | ||
834 | /** | |
558a6e06 VZ |
835 | This method can only be used with virtual list controls. |
836 | ||
837 | It is used to indicate to the control the number of items it contains. | |
838 | After calling it, the main program should be ready to handle calls to | |
839 | various item callbacks (such as wxListCtrl::OnGetItemText) for all | |
840 | items in the range from 0 to @a count. | |
841 | ||
842 | Notice that the control is not necessarily redrawn after this call as | |
843 | it may be undesirable if an item which is not visible on the screen | |
844 | anyhow was added to or removed from a control displaying many items, if | |
845 | you do need to refresh the display you can just call Refresh() manually. | |
23324ae1 FM |
846 | */ |
847 | void SetItemCount(long count); | |
848 | ||
849 | /** | |
320ab87c FM |
850 | Associates application-defined data with this item. |
851 | ||
852 | Notice that this function cannot be used to associate pointers with the control | |
853 | items, use SetItemPtrData() instead. | |
23324ae1 FM |
854 | */ |
855 | bool SetItemData(long item, long data); | |
856 | ||
857 | /** | |
1d7c0c08 | 858 | Sets the item's font. |
23324ae1 FM |
859 | */ |
860 | void SetItemFont(long item, const wxFont& font); | |
861 | ||
23324ae1 | 862 | /** |
320ab87c FM |
863 | Sets the unselected and selected images associated with the item. |
864 | The images are indices into the image list associated with the list control. | |
23324ae1 | 865 | */ |
5267aefd | 866 | bool SetItemImage(long item, int image, int selImage = -1); |
320ab87c | 867 | |
1d7c0c08 | 868 | /** |
320ab87c FM |
869 | Sets the unselected and selected images associated with the item. |
870 | The images are indices into the image list associated with the list control. | |
871 | ||
872 | @deprecated | |
873 | This form is deprecated: @a selImage is not used; use the other | |
874 | SetItemImage() overload. | |
1d7c0c08 | 875 | */ |
5267aefd | 876 | bool SetItemImage(long item, int image, int selImage = -1); |
23324ae1 FM |
877 | |
878 | /** | |
879 | Sets the position of the item, in icon or small icon view. Windows only. | |
880 | */ | |
881 | bool SetItemPosition(long item, const wxPoint& pos); | |
882 | ||
883 | /** | |
320ab87c FM |
884 | Associates application-defined data with this item. |
885 | ||
886 | The @a data parameter may be either an integer or a pointer cast to the | |
887 | @c wxUIntPtr type which is guaranteed to be large enough to be able to | |
888 | contain all integer types and pointers. | |
3c4f71cc | 889 | |
1e24c2af | 890 | @since 2.8.4 |
23324ae1 FM |
891 | */ |
892 | bool SetItemPtrData(long item, wxUIntPtr data); | |
893 | ||
894 | /** | |
895 | Sets the item state. For a list of state flags, see SetItem(). | |
23324ae1 FM |
896 | The @b stateMask indicates which state flags are valid. |
897 | */ | |
898 | bool SetItemState(long item, long state, long stateMask); | |
899 | ||
900 | /** | |
901 | Sets the item text for this item. | |
902 | */ | |
903 | void SetItemText(long item, const wxString& text); | |
904 | ||
905 | /** | |
320ab87c FM |
906 | Sets the colour for this item. |
907 | This function only works in report view. | |
908 | The colour can be retrieved using GetItemTextColour(). | |
23324ae1 FM |
909 | */ |
910 | void SetItemTextColour(long item, const wxColour& col); | |
911 | ||
912 | /** | |
913 | Adds or removes a single window style. | |
914 | */ | |
4cc4bfaf | 915 | void SetSingleStyle(long style, bool add = true); |
23324ae1 FM |
916 | |
917 | /** | |
918 | Sets the text colour of the list control. | |
919 | */ | |
920 | void SetTextColour(const wxColour& col); | |
921 | ||
922 | /** | |
923 | Sets the whole window style, deleting all items. | |
924 | */ | |
925 | void SetWindowStyleFlag(long style); | |
926 | ||
927 | /** | |
928 | Call this function to sort the items in the list control. Sorting is done | |
4cc4bfaf | 929 | using the specified @a fnSortCallBack function. This function must have the |
23324ae1 | 930 | following prototype: |
320ab87c | 931 | @code |
b18e2046 | 932 | int wxCALLBACK wxListCompareFunction(long item1, long item2, wxIntPtr sortData) |
320ab87c | 933 | @endcode |
3c4f71cc | 934 | |
23324ae1 FM |
935 | It is called each time when the two items must be compared and should return 0 |
936 | if the items are equal, negative value if the first item is less than the | |
937 | second one and positive value if the first one is greater than the second one | |
938 | (the same convention as used by @c qsort(3)). | |
3c4f71cc | 939 | |
320ab87c FM |
940 | The parameter @e item1 is the client data associated with the first item (NOT the index). |
941 | The parameter @e item2 is the client data associated with the second item (NOT the index). | |
942 | The parameter @e data is the value passed to SortItems() itself. | |
943 | ||
944 | Notice that the control may only be sorted on client data associated with | |
945 | the items, so you must use SetItemData if you want to be able to sort the | |
946 | items in the control. | |
947 | ||
948 | Please see the @ref page_samples_listctrl for an example of using this function. | |
1058f652 MB |
949 | |
950 | @beginWxPerlOnly | |
951 | In wxPerl the comparison function must take just two parameters; | |
952 | however, you may use a closure to achieve an effect similar to the | |
953 | SortItems third parameter. | |
954 | @endWxPerlOnly | |
23324ae1 | 955 | */ |
b18e2046 | 956 | bool SortItems(wxListCtrlCompare fnSortCallBack, wxIntPtr data); |
5e6e278d FM |
957 | |
958 | protected: | |
959 | ||
960 | /** | |
75504144 | 961 | This function may be overridden in the derived class for a control with |
5e6e278d FM |
962 | @c wxLC_VIRTUAL style. It should return the attribute for the specified |
963 | @c item or @NULL to use the default appearance parameters. | |
964 | ||
965 | wxListCtrl will not delete the pointer or keep a reference of it. | |
966 | You can return the same wxListItemAttr pointer for every OnGetItemAttr() call. | |
967 | ||
968 | The base class version always returns @NULL. | |
969 | ||
eab1336c VZ |
970 | @see OnGetItemImage(), OnGetItemColumnImage(), OnGetItemText(), |
971 | OnGetItemColumnAttr() | |
5e6e278d FM |
972 | */ |
973 | virtual wxListItemAttr* OnGetItemAttr(long item) const; | |
974 | ||
eab1336c VZ |
975 | /** |
976 | This function may be overridden in the derived class for a control with | |
977 | @c wxLC_VIRTUAL style. | |
978 | ||
979 | It should return the attribute for the for the specified @a item and @a | |
980 | column or @NULL to use the default appearance parameters. | |
981 | ||
982 | The base class version returns @c OnGetItemAttr(item). | |
983 | ||
984 | @note Currently this function is only called under wxMSW, the other | |
985 | ports only support OnGetItemAttr() | |
986 | ||
987 | @see OnGetItemAttr(), OnGetItemText(), | |
988 | OnGetItemImage(), OnGetItemColumnImage(), | |
989 | */ | |
990 | virtual wxListItemAttr* OnGetItemColumnAttr(long item, long column) const; | |
991 | ||
5e6e278d | 992 | /** |
75504144 | 993 | Override this function in the derived class for a control with |
5e6e278d FM |
994 | @c wxLC_VIRTUAL and @c wxLC_REPORT styles in order to specify the image |
995 | index for the given line and column. | |
996 | ||
997 | The base class version always calls OnGetItemImage() for the first column, else | |
998 | it returns -1. | |
999 | ||
eab1336c VZ |
1000 | @see OnGetItemText(), OnGetItemImage(), OnGetItemAttr(), |
1001 | OnGetItemColumnAttr() | |
5e6e278d FM |
1002 | */ |
1003 | virtual int OnGetItemColumnImage(long item, long column) const; | |
1004 | ||
1005 | /** | |
75504144 | 1006 | This function must be overridden in the derived class for a control with |
e2c4ccaf | 1007 | @c wxLC_VIRTUAL style having an "image list" (see SetImageList(); if the |
75504144 | 1008 | control doesn't have an image list, it is not necessary to override it). |
5e6e278d FM |
1009 | It should return the index of the items image in the controls image list |
1010 | or -1 for no image. | |
1011 | ||
1012 | In a control with @c wxLC_REPORT style, OnGetItemImage() only gets called for | |
1013 | the first column of each line. | |
1014 | ||
1015 | The base class version always returns -1. | |
1016 | ||
1017 | @see OnGetItemText(), OnGetItemColumnImage(), OnGetItemAttr() | |
1018 | */ | |
1019 | virtual int OnGetItemImage(long item) const; | |
1020 | ||
1021 | /** | |
75504144 | 1022 | This function @b must be overridden in the derived class for a control with |
5e6e278d FM |
1023 | @c wxLC_VIRTUAL style. It should return the string containing the text of |
1024 | the given @a column for the specified @c item. | |
1025 | ||
1026 | @see SetItemCount(), OnGetItemImage(), OnGetItemColumnImage(), OnGetItemAttr() | |
1027 | */ | |
1028 | virtual wxString OnGetItemText(long item, long column) const; | |
23324ae1 FM |
1029 | }; |
1030 | ||
1031 | ||
e54c96f1 | 1032 | |
23324ae1 FM |
1033 | /** |
1034 | @class wxListEvent | |
7c913512 | 1035 | |
23324ae1 | 1036 | A list event holds information about events associated with wxListCtrl objects. |
7c913512 | 1037 | |
320ab87c FM |
1038 | @beginEventTable{wxListEvent} |
1039 | @event{EVT_LIST_BEGIN_DRAG(id, func)} | |
1040 | Begin dragging with the left mouse button. | |
1041 | @event{EVT_LIST_BEGIN_RDRAG(id, func)} | |
1042 | Begin dragging with the right mouse button. | |
1043 | @event{EVT_LIST_BEGIN_LABEL_EDIT(id, func)} | |
1044 | Begin editing a label. This can be prevented by calling Veto(). | |
1045 | @event{EVT_LIST_END_LABEL_EDIT(id, func)} | |
1046 | Finish editing a label. This can be prevented by calling Veto(). | |
1047 | @event{EVT_LIST_DELETE_ITEM(id, func)} | |
1048 | Delete an item. | |
1049 | @event{EVT_LIST_DELETE_ALL_ITEMS(id, func)} | |
1050 | Delete all items. | |
1051 | @event{EVT_LIST_ITEM_SELECTED(id, func)} | |
1052 | The item has been selected. | |
1053 | @event{EVT_LIST_ITEM_DESELECTED(id, func)} | |
1054 | The item has been deselected. | |
1055 | @event{EVT_LIST_ITEM_ACTIVATED(id, func)} | |
1056 | The item has been activated (ENTER or double click). | |
1057 | @event{EVT_LIST_ITEM_FOCUSED(id, func)} | |
1058 | The currently focused item has changed. | |
1059 | @event{EVT_LIST_ITEM_MIDDLE_CLICK(id, func)} | |
1060 | The middle mouse button has been clicked on an item. | |
1061 | @event{EVT_LIST_ITEM_RIGHT_CLICK(id, func)} | |
1062 | The right mouse button has been clicked on an item. | |
1063 | @event{EVT_LIST_KEY_DOWN(id, func)} | |
1064 | A key has been pressed. | |
1065 | @event{EVT_LIST_INSERT_ITEM(id, func)} | |
1066 | An item has been inserted. | |
1067 | @event{EVT_LIST_COL_CLICK(id, func)} | |
1068 | A column (m_col) has been left-clicked. | |
1069 | @event{EVT_LIST_COL_RIGHT_CLICK(id, func)} | |
1070 | A column (m_col) (which can be -1 if the click occurred outside any column) | |
1071 | has been right-clicked. | |
1072 | @event{EVT_LIST_COL_BEGIN_DRAG(id, func)} | |
1073 | The user started resizing a column - can be vetoed. | |
1074 | @event{EVT_LIST_COL_DRAGGING(id, func)} | |
1075 | The divider between columns is being dragged. | |
1076 | @event{EVT_LIST_COL_END_DRAG(id, func)} | |
1077 | A column has been resized by the user. | |
1078 | @event{EVT_LIST_CACHE_HINT(id, func)} | |
1079 | Prepare cache for a virtual list control | |
1080 | @endEventTable | |
1081 | ||
1082 | ||
23324ae1 FM |
1083 | @library{wxbase} |
1084 | @category{events} | |
7c913512 | 1085 | |
e54c96f1 | 1086 | @see wxListCtrl |
23324ae1 FM |
1087 | */ |
1088 | class wxListEvent : public wxNotifyEvent | |
1089 | { | |
1090 | public: | |
1091 | /** | |
1092 | Constructor. | |
1093 | */ | |
0a98423e | 1094 | wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0); |
23324ae1 FM |
1095 | |
1096 | /** | |
1097 | For @c EVT_LIST_CACHE_HINT event only: return the first item which the | |
1098 | list control advises us to cache. | |
1099 | */ | |
328f5751 | 1100 | long GetCacheFrom() const; |
23324ae1 FM |
1101 | |
1102 | /** | |
1103 | For @c EVT_LIST_CACHE_HINT event only: return the last item (inclusive) | |
1104 | which the list control advises us to cache. | |
1105 | */ | |
328f5751 | 1106 | long GetCacheTo() const; |
23324ae1 FM |
1107 | |
1108 | /** | |
320ab87c FM |
1109 | The column position: it is only used with @c COL events. |
1110 | ||
1111 | For the column dragging events, it is the column to the left of the divider | |
1112 | being dragged, for the column click events it may be -1 if the user clicked | |
1113 | in the list control header outside any column. | |
23324ae1 | 1114 | */ |
328f5751 | 1115 | int GetColumn() const; |
23324ae1 FM |
1116 | |
1117 | /** | |
1118 | The data. | |
1119 | */ | |
328f5751 | 1120 | long GetData() const; |
23324ae1 FM |
1121 | |
1122 | /** | |
1123 | The image. | |
1124 | */ | |
328f5751 | 1125 | int GetImage() const; |
23324ae1 FM |
1126 | |
1127 | /** | |
1128 | The item index. | |
1129 | */ | |
328f5751 | 1130 | long GetIndex() const; |
23324ae1 FM |
1131 | |
1132 | /** | |
1133 | An item object, used by some events. See also wxListCtrl::SetItem. | |
1134 | */ | |
5267aefd | 1135 | const wxListItem& GetItem() const; |
23324ae1 FM |
1136 | |
1137 | /** | |
1138 | Key code if the event is a keypress event. | |
1139 | */ | |
328f5751 | 1140 | int GetKeyCode() const; |
23324ae1 FM |
1141 | |
1142 | /** | |
1143 | The (new) item label for @c EVT_LIST_END_LABEL_EDIT event. | |
1144 | */ | |
5267aefd | 1145 | const wxString& GetLabel() const; |
23324ae1 FM |
1146 | |
1147 | /** | |
1148 | The mask. | |
1149 | */ | |
328f5751 | 1150 | long GetMask() const; |
23324ae1 FM |
1151 | |
1152 | /** | |
1153 | The position of the mouse pointer if the event is a drag event. | |
1154 | */ | |
328f5751 | 1155 | wxPoint GetPoint() const; |
23324ae1 FM |
1156 | |
1157 | /** | |
1158 | The text. | |
1159 | */ | |
5267aefd | 1160 | const wxString& GetText() const; |
23324ae1 FM |
1161 | |
1162 | /** | |
320ab87c FM |
1163 | This method only makes sense for @c EVT_LIST_END_LABEL_EDIT message and |
1164 | returns @true if it the label editing has been cancelled by the user | |
1165 | (GetLabel() returns an empty string in this case but it doesn't allow the | |
1166 | application to distinguish between really cancelling the edit and the | |
1167 | admittedly rare case when the user wants to rename it to an empty string). | |
23324ae1 | 1168 | */ |
328f5751 | 1169 | bool IsEditCancelled() const; |
23324ae1 FM |
1170 | }; |
1171 | ||
1172 | ||
e54c96f1 | 1173 | |
23324ae1 FM |
1174 | /** |
1175 | @class wxListItemAttr | |
7c913512 | 1176 | |
320ab87c | 1177 | Represents the attributes (color, font, ...) of a wxListCtrl's wxListItem. |
7c913512 | 1178 | |
23324ae1 | 1179 | @library{wxbase} |
3c99e2fd | 1180 | @category{data} |
7c913512 | 1181 | |
320ab87c | 1182 | @see @ref overview_listctrl, wxListCtrl, wxListItem |
23324ae1 | 1183 | */ |
7c913512 | 1184 | class wxListItemAttr |
23324ae1 FM |
1185 | { |
1186 | public: | |
1d7c0c08 RR |
1187 | /** |
1188 | Default Constructor. | |
1189 | */ | |
1190 | wxListItemAttr(); | |
320ab87c | 1191 | |
23324ae1 FM |
1192 | /** |
1193 | Construct a wxListItemAttr with the specified foreground and | |
1194 | background colors and font. | |
1195 | */ | |
0a98423e FM |
1196 | wxListItemAttr(const wxColour& colText, |
1197 | const wxColour& colBack, | |
1198 | const wxFont& font); | |
23324ae1 FM |
1199 | |
1200 | /** | |
1201 | Returns the currently set background color. | |
1202 | */ | |
320ab87c | 1203 | const wxColour& GetBackgroundColour() const; |
23324ae1 FM |
1204 | |
1205 | /** | |
1206 | Returns the currently set font. | |
1207 | */ | |
320ab87c | 1208 | const wxFont& GetFont() const; |
23324ae1 FM |
1209 | |
1210 | /** | |
1211 | Returns the currently set text color. | |
1212 | */ | |
320ab87c | 1213 | const wxColour& GetTextColour() const; |
23324ae1 FM |
1214 | |
1215 | /** | |
1216 | Returns @true if the currently set background color is valid. | |
1217 | */ | |
328f5751 | 1218 | bool HasBackgroundColour() const; |
23324ae1 FM |
1219 | |
1220 | /** | |
1221 | Returns @true if the currently set font is valid. | |
1222 | */ | |
328f5751 | 1223 | bool HasFont() const; |
23324ae1 FM |
1224 | |
1225 | /** | |
1226 | Returns @true if the currently set text color is valid. | |
1227 | */ | |
328f5751 | 1228 | bool HasTextColour() const; |
23324ae1 FM |
1229 | |
1230 | /** | |
1231 | Sets a new background color. | |
1232 | */ | |
1233 | void SetBackgroundColour(const wxColour& colour); | |
1234 | ||
1235 | /** | |
1236 | Sets a new font. | |
1237 | */ | |
1238 | void SetFont(const wxFont& font); | |
1239 | ||
1240 | /** | |
1241 | Sets a new text color. | |
1242 | */ | |
1243 | void SetTextColour(const wxColour& colour); | |
1244 | }; | |
1245 | ||
1246 | ||
e54c96f1 | 1247 | |
23324ae1 FM |
1248 | /** |
1249 | @class wxListView | |
7c913512 FM |
1250 | |
1251 | This class currently simply presents a simpler to use interface for the | |
320ab87c FM |
1252 | wxListCtrl -- it can be thought of as a @e façade for that complicated class. |
1253 | ||
1254 | Using it is preferable to using wxListCtrl directly whenever possible because | |
1255 | in the future some ports might implement wxListView but not the full set of | |
1256 | wxListCtrl features. | |
7c913512 | 1257 | |
320ab87c FM |
1258 | Other than different interface, this class is identical to wxListCtrl. |
1259 | In particular, it uses the same events, same window styles and so on. | |
7c913512 | 1260 | |
23324ae1 FM |
1261 | @library{wxcore} |
1262 | @category{ctrl} | |
7e59b885 | 1263 | @appearance{listview.png} |
7c913512 | 1264 | |
e54c96f1 | 1265 | @see wxListView::SetColumnImage |
23324ae1 FM |
1266 | */ |
1267 | class wxListView : public wxListCtrl | |
1268 | { | |
1269 | public: | |
1270 | /** | |
1271 | Resets the column image -- after calling this function, no image will be shown. | |
3c4f71cc | 1272 | |
7c913512 | 1273 | @param col |
4cc4bfaf | 1274 | the column to clear image for |
3c4f71cc | 1275 | |
4cc4bfaf | 1276 | @see SetColumnImage() |
23324ae1 FM |
1277 | */ |
1278 | void ClearColumnImage(int col); | |
1279 | ||
1280 | /** | |
320ab87c | 1281 | Sets focus to the item with the given @a index. |
23324ae1 FM |
1282 | */ |
1283 | void Focus(long index); | |
1284 | ||
1285 | /** | |
1286 | Returns the first selected item in a (presumably) multiple selection control. | |
320ab87c FM |
1287 | Together with GetNextSelected() it can be used to iterate over all selected |
1288 | items in the control. | |
3c4f71cc | 1289 | |
d29a9a8a | 1290 | @return The first selected item, if any, -1 otherwise. |
23324ae1 | 1291 | */ |
328f5751 | 1292 | long GetFirstSelected() const; |
23324ae1 FM |
1293 | |
1294 | /** | |
1295 | Returns the currently focused item or -1 if none. | |
3c4f71cc | 1296 | |
4cc4bfaf | 1297 | @see IsSelected(), Focus() |
23324ae1 | 1298 | */ |
328f5751 | 1299 | long GetFocusedItem() const; |
23324ae1 FM |
1300 | |
1301 | /** | |
320ab87c FM |
1302 | Used together with GetFirstSelected() to iterate over all selected items |
1303 | in the control. | |
3c4f71cc | 1304 | |
320ab87c | 1305 | @return Returns the next selected item or -1 if there are no more of them. |
23324ae1 | 1306 | */ |
328f5751 | 1307 | long GetNextSelected(long item) const; |
23324ae1 FM |
1308 | |
1309 | /** | |
4cc4bfaf | 1310 | Returns @true if the item with the given @a index is selected, |
23324ae1 | 1311 | @false otherwise. |
3c4f71cc | 1312 | |
4cc4bfaf | 1313 | @see GetFirstSelected(), GetNextSelected() |
23324ae1 | 1314 | */ |
328f5751 | 1315 | bool IsSelected(long index) const; |
23324ae1 FM |
1316 | |
1317 | /** | |
1318 | Selects or unselects the given item. | |
3c4f71cc | 1319 | |
7c913512 | 1320 | @param n |
4cc4bfaf | 1321 | the item to select or unselect |
7c913512 | 1322 | @param on |
4cc4bfaf | 1323 | if @true (default), selects the item, otherwise unselects it |
3c4f71cc | 1324 | |
4cc4bfaf | 1325 | @see wxListCtrl::SetItemState |
23324ae1 | 1326 | */ |
792255cc | 1327 | void Select(long n, bool on = true); |
23324ae1 FM |
1328 | |
1329 | /** | |
320ab87c FM |
1330 | Sets the column image for the specified column. |
1331 | To use the column images, the control must have a valid image list with | |
1332 | at least one image. | |
3c4f71cc | 1333 | |
7c913512 | 1334 | @param col |
4cc4bfaf | 1335 | the column to set image for |
7c913512 | 1336 | @param image |
4cc4bfaf | 1337 | the index of the column image in the controls image list |
23324ae1 FM |
1338 | */ |
1339 | void SetColumnImage(int col, int image); | |
1340 | }; | |
1341 | ||
1342 | ||
320ab87c FM |
1343 | /** |
1344 | Column format (MSW only except wxLIST_FORMAT_LEFT). | |
1345 | */ | |
1346 | enum wxListColumnFormat | |
1347 | { | |
1348 | wxLIST_FORMAT_LEFT, | |
1349 | wxLIST_FORMAT_RIGHT, | |
1350 | wxLIST_FORMAT_CENTRE, | |
1351 | wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE | |
1352 | }; | |
e54c96f1 | 1353 | |
23324ae1 FM |
1354 | /** |
1355 | @class wxListItem | |
7c913512 | 1356 | |
23324ae1 | 1357 | This class stores information about a wxListCtrl item or column. |
7c913512 | 1358 | |
320ab87c FM |
1359 | wxListItem is a class which contains informations about: |
1360 | - Zero based item position; see SetId() and GetId(). | |
1361 | - Zero based column index; see SetColumn() and GetColumn(). | |
1362 | - The label (or header for columns); see SetText() and GetText(). | |
1363 | - The zero based index into an image list; see GetImage() and SetImage(). | |
1364 | - Application defined data; see SetData() and GetData(). | |
1365 | - For columns only: the width of the column; see SetWidth() and GetWidth(). | |
1366 | - For columns only: the format of the column; one of @c wxLIST_FORMAT_LEFT, | |
1367 | @c wxLIST_FORMAT_RIGHT, @c wxLIST_FORMAT_CENTRE. See SetAlign() and GetAlign(). | |
1368 | - The state of the item; see SetState() and GetState(). | |
1369 | This is a bitlist of the following flags: | |
1370 | - @c wxLIST_STATE_FOCUSED: The item has the focus. | |
1371 | - @c wxLIST_STATE_SELECTED: The item is selected. | |
1372 | - @c wxLIST_STATE_DONTCARE: Don't care what the state is. Win32 only. | |
1373 | - @c wxLIST_STATE_DROPHILITED: The item is highlighted to receive a drop event. Win32 only. | |
1374 | - @c wxLIST_STATE_CUT: The item is in the cut state. Win32 only. | |
1375 | - A mask indicating which state flags are valid; this is a bitlist of the | |
1376 | flags reported above for the item state. See SetStateMask() and GetStateMask(). | |
1377 | - A mask indicating which fields of this class are valid; see SetMask() and GetMask(). | |
1378 | This is a bitlist of the following flags: | |
1379 | - @c wxLIST_MASK_STATE: The state field is valid. | |
1380 | - @c wxLIST_MASK_TEXT: The label field is valid. | |
1381 | - @c wxLIST_MASK_IMAGE: The image field is valid. | |
1382 | - @c wxLIST_MASK_DATA: The application-defined data field is valid. | |
1383 | - @c wxLIST_MASK_WIDTH: The column width field is valid. | |
1384 | - @c wxLIST_MASK_FORMAT: The column format field is valid. | |
1385 | ||
1386 | The wxListItem object can also contain item-specific colour and font | |
1387 | information: for this you need to call one of SetTextColour(), SetBackgroundColour() | |
1388 | or SetFont() functions on it passing it the colour/font to use. | |
1389 | If the colour/font is not specified, the default list control colour/font is used. | |
1390 | ||
23324ae1 | 1391 | @library{wxbase} |
3c99e2fd | 1392 | @category{data} |
320ab87c FM |
1393 | |
1394 | @see wxListCtrl | |
23324ae1 FM |
1395 | */ |
1396 | class wxListItem : public wxObject | |
1397 | { | |
1398 | public: | |
1399 | /** | |
1400 | Constructor. | |
1401 | */ | |
1402 | wxListItem(); | |
1403 | ||
1404 | /** | |
1405 | Resets the item state to the default. | |
1406 | */ | |
1407 | void Clear(); | |
1408 | ||
1409 | /** | |
320ab87c FM |
1410 | Returns the alignment for this item. |
1411 | Can be one of @c wxLIST_FORMAT_LEFT, @c wxLIST_FORMAT_RIGHT or @c wxLIST_FORMAT_CENTRE. | |
23324ae1 | 1412 | */ |
328f5751 | 1413 | wxListColumnFormat GetAlign() const; |
23324ae1 FM |
1414 | |
1415 | /** | |
1416 | Returns the background colour for this item. | |
1417 | */ | |
328f5751 | 1418 | wxColour GetBackgroundColour() const; |
23324ae1 FM |
1419 | |
1420 | /** | |
1421 | Returns the zero-based column; meaningful only in report mode. | |
1422 | */ | |
328f5751 | 1423 | int GetColumn() const; |
23324ae1 FM |
1424 | |
1425 | /** | |
320ab87c FM |
1426 | Returns client data associated with the control. |
1427 | Please note that client data is associated with the item and not with subitems. | |
23324ae1 | 1428 | */ |
5267aefd | 1429 | wxUIntPtr GetData() const; |
23324ae1 FM |
1430 | |
1431 | /** | |
1432 | Returns the font used to display the item. | |
1433 | */ | |
328f5751 | 1434 | wxFont GetFont() const; |
23324ae1 FM |
1435 | |
1436 | /** | |
1437 | Returns the zero-based item position. | |
1438 | */ | |
328f5751 | 1439 | long GetId() const; |
23324ae1 FM |
1440 | |
1441 | /** | |
320ab87c FM |
1442 | Returns the zero-based index of the image associated with the item into |
1443 | the image list. | |
23324ae1 | 1444 | */ |
328f5751 | 1445 | int GetImage() const; |
23324ae1 FM |
1446 | |
1447 | /** | |
320ab87c | 1448 | Returns a bit mask indicating which fields of the structure are valid. |
3c4f71cc | 1449 | |
320ab87c FM |
1450 | Can be any combination of the following values: |
1451 | - wxLIST_MASK_STATE: @b GetState is valid. | |
1452 | - wxLIST_MASK_TEXT: @b GetText is valid. | |
1453 | - wxLIST_MASK_IMAGE: @b GetImage is valid. | |
1454 | - wxLIST_MASK_DATA: @b GetData is valid. | |
1455 | - wxLIST_MASK_WIDTH: @b GetWidth is valid. | |
1456 | - wxLIST_MASK_FORMAT: @b GetFormat is valid. | |
23324ae1 | 1457 | */ |
328f5751 | 1458 | long GetMask() const; |
23324ae1 FM |
1459 | |
1460 | /** | |
320ab87c | 1461 | Returns a bit field representing the state of the item. |
3c4f71cc | 1462 | |
320ab87c FM |
1463 | Can be any combination of: |
1464 | - wxLIST_STATE_DONTCARE: Don't care what the state is. Win32 only. | |
1465 | - wxLIST_STATE_DROPHILITED: The item is highlighted to receive a drop event. Win32 only. | |
1466 | - wxLIST_STATE_FOCUSED: The item has the focus. | |
1467 | - wxLIST_STATE_SELECTED: The item is selected. | |
1468 | - wxLIST_STATE_CUT: The item is in the cut state. Win32 only. | |
23324ae1 | 1469 | */ |
328f5751 | 1470 | long GetState() const; |
23324ae1 FM |
1471 | |
1472 | /** | |
1473 | Returns the label/header text. | |
1474 | */ | |
320ab87c | 1475 | const wxString& GetText() const; |
23324ae1 FM |
1476 | |
1477 | /** | |
1478 | Returns the text colour. | |
1479 | */ | |
328f5751 | 1480 | wxColour GetTextColour() const; |
23324ae1 FM |
1481 | |
1482 | /** | |
1483 | Meaningful only for column headers in report mode. Returns the column width. | |
1484 | */ | |
328f5751 | 1485 | int GetWidth() const; |
23324ae1 FM |
1486 | |
1487 | /** | |
320ab87c | 1488 | Sets the alignment for the item. See also GetAlign() |
23324ae1 FM |
1489 | */ |
1490 | void SetAlign(wxListColumnFormat align); | |
1491 | ||
1492 | /** | |
1493 | Sets the background colour for the item. | |
1494 | */ | |
1495 | void SetBackgroundColour(const wxColour& colBack); | |
1496 | ||
1497 | /** | |
1498 | Sets the zero-based column. Meaningful only in report mode. | |
1499 | */ | |
1500 | void SetColumn(int col); | |
1501 | ||
1502 | //@{ | |
1503 | /** | |
320ab87c FM |
1504 | Sets client data for the item. |
1505 | Please note that client data is associated with the item and not with subitems. | |
23324ae1 FM |
1506 | */ |
1507 | void SetData(long data); | |
7c913512 | 1508 | void SetData(void* data); |
23324ae1 FM |
1509 | //@} |
1510 | ||
1511 | /** | |
1512 | Sets the font for the item. | |
1513 | */ | |
1514 | void SetFont(const wxFont& font); | |
1515 | ||
1516 | /** | |
1517 | Sets the zero-based item position. | |
1518 | */ | |
1519 | void SetId(long id); | |
1520 | ||
1521 | /** | |
1522 | Sets the zero-based index of the image associated with the item | |
1523 | into the image list. | |
1524 | */ | |
1525 | void SetImage(int image); | |
1526 | ||
1527 | /** | |
1528 | Sets the mask of valid fields. See GetMask(). | |
1529 | */ | |
1530 | void SetMask(long mask); | |
1531 | ||
1532 | /** | |
1533 | Sets the item state flags (note that the valid state flags are influenced | |
320ab87c FM |
1534 | by the value of the state mask, see wxListItem::SetStateMask). |
1535 | ||
1536 | See GetState() for valid flag values. | |
23324ae1 FM |
1537 | */ |
1538 | void SetState(long state); | |
1539 | ||
1540 | /** | |
1541 | Sets the bitmask that is used to determine which of the state flags | |
1542 | are to be set. See also SetState(). | |
1543 | */ | |
1544 | void SetStateMask(long stateMask); | |
1545 | ||
1546 | /** | |
1547 | Sets the text label for the item. | |
1548 | */ | |
1549 | void SetText(const wxString& text); | |
1550 | ||
1551 | /** | |
1552 | Sets the text colour for the item. | |
1553 | */ | |
1554 | void SetTextColour(const wxColour& colText); | |
1555 | ||
1556 | /** | |
1557 | Meaningful only for column headers in report mode. Sets the column width. | |
1558 | */ | |
1559 | void SetWidth(int width); | |
1560 | }; | |
e54c96f1 | 1561 |