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