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