]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dataview.h | |
80932a3e | 3 | // Purpose: interface of wxDataView* classes |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
526954c5 | 6 | // Licence: wxWindows licence |
23324ae1 FM |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
b321b61c | 9 | |
23324ae1 FM |
10 | /** |
11 | @class wxDataViewModel | |
7c913512 | 12 | |
c4e57202 FM |
13 | wxDataViewModel is the base class for all data model to be displayed by a |
14 | wxDataViewCtrl. | |
15 | ||
16 | All other models derive from it and must implement its pure virtual functions | |
17 | in order to define a complete data model. In detail, you need to override | |
18 | wxDataViewModel::IsContainer, wxDataViewModel::GetParent, wxDataViewModel::GetChildren, | |
19 | wxDataViewModel::GetColumnCount, wxDataViewModel::GetColumnType and | |
20 | wxDataViewModel::GetValue in order to define the data model which acts as an | |
21 | interface between your actual data and the wxDataViewCtrl. | |
22 | ||
a36bceb6 RR |
23 | Note that wxDataViewModel does not define the position or index of any item |
24 | in the control because different controls might display the same data differently. | |
25 | wxDataViewModel does provide a wxDataViewModel::Compare method which the | |
26 | wxDataViewCtrl may use to sort the data either in conjunction with a column | |
27 | header or without (see wxDataViewModel::HasDefaultCompare). | |
7c913512 | 28 | |
c4e57202 FM |
29 | wxDataViewModel (as indeed the entire wxDataViewCtrl code) is using wxVariant |
30 | to store data and its type in a generic way. wxVariant can be extended to contain | |
a36bceb6 RR |
31 | almost any data without changes to the original class. To a certain extent, |
32 | you can use (the somewhat more elegant) wxAny instead of wxVariant as there | |
33 | is code to convert between the two, but it is unclear what impact this will | |
34 | have on performance. | |
35 | ||
36 | Since you will usually allow the wxDataViewCtrl to change your data | |
37 | through its graphical interface, you will also have to override | |
38 | wxDataViewModel::SetValue which the wxDataViewCtrl will call when a change | |
39 | to some data has been committed. | |
7c913512 | 40 | |
a36bceb6 RR |
41 | If the data represented by the model is changed by something else than its |
42 | associated wxDataViewCtrl, the control has to be notified about the change. | |
c4e57202 FM |
43 | Depending on what happened you need to call one of the following methods: |
44 | - wxDataViewModel::ValueChanged, | |
45 | - wxDataViewModel::ItemAdded, | |
46 | - wxDataViewModel::ItemDeleted, | |
47 | - wxDataViewModel::ItemChanged, | |
48 | - wxDataViewModel::Cleared. | |
49 | ||
50 | There are plural forms for notification of addition, change or removal of | |
51 | several item at once. See: | |
52 | - wxDataViewModel::ItemsAdded, | |
53 | - wxDataViewModel::ItemsDeleted, | |
54 | - wxDataViewModel::ItemsChanged. | |
55 | ||
c4e57202 FM |
56 | This class maintains a list of wxDataViewModelNotifier which link this class |
57 | to the specific implementations on the supported platforms so that e.g. calling | |
58 | wxDataViewModel::ValueChanged on this model will just call | |
59 | wxDataViewModelNotifier::ValueChanged for each notifier that has been added. | |
60 | You can also add your own notifier in order to get informed about any changes | |
23324ae1 | 61 | to the data in the list model. |
7c913512 | 62 | |
c4e57202 | 63 | Currently wxWidgets provides the following models apart from the base model: |
bda698ed RR |
64 | wxDataViewIndexListModel, wxDataViewVirtualListModel, wxDataViewTreeStore, |
65 | wxDataViewListStore. | |
7c913512 | 66 | |
e4e83d3a | 67 | Note that wxDataViewModel is reference counted, derives from wxRefCounter |
c4e57202 FM |
68 | and cannot be deleted directly as it can be shared by several wxDataViewCtrls. |
69 | This implies that you need to decrease the reference count after | |
23324ae1 | 70 | associating the model with a control like this: |
7c913512 | 71 | |
23324ae1 | 72 | @code |
14f73cf1 | 73 | wxDataViewCtrl *musicCtrl = new wxDataViewCtrl( this, wxID_ANY ); |
23324ae1 | 74 | wxDataViewModel *musicModel = new MyMusicModel; |
14f73cf1 FM |
75 | m_musicCtrl->AssociateModel( musicModel ); |
76 | musicModel->DecRef(); // avoid memory leak !! | |
43c64cc6 | 77 | |
23324ae1 FM |
78 | // add columns now |
79 | @endcode | |
7c913512 | 80 | |
a36bceb6 RR |
81 | A potentially better way to avoid memory leaks is to use wxObjectDataPtr |
82 | ||
83 | @code | |
84 | wxObjectDataPtr<MyMusicModel> musicModel; | |
85 | ||
86 | wxDataViewCtrl *musicCtrl = new wxDataViewCtrl( this, wxID_ANY ); | |
87 | musicModel = new MyMusicModel; | |
88 | m_musicCtrl->AssociateModel( musicModel.get() ); | |
89 | ||
90 | // add columns now | |
91 | @endcode | |
92 | ||
93 | ||
23324ae1 | 94 | @library{wxadv} |
b321b61c | 95 | @category{dvc} |
23324ae1 | 96 | */ |
e4e83d3a | 97 | class wxDataViewModel : public wxRefCounter |
23324ae1 FM |
98 | { |
99 | public: | |
100 | /** | |
101 | Constructor. | |
102 | */ | |
103 | wxDataViewModel(); | |
104 | ||
23324ae1 | 105 | /** |
c4e57202 | 106 | Adds a wxDataViewModelNotifier to the model. |
23324ae1 FM |
107 | */ |
108 | void AddNotifier(wxDataViewModelNotifier* notifier); | |
109 | ||
795dac4c VZ |
110 | /** |
111 | Change the value of the given item and update the control to reflect | |
112 | it. | |
113 | ||
114 | This function simply calls SetValue() and, if it succeeded, | |
115 | ValueChanged(). | |
116 | ||
117 | @since 2.9.1 | |
118 | ||
d86f721a | 119 | @param variant |
795dac4c VZ |
120 | The new value. |
121 | @param item | |
122 | The item (row) to update. | |
123 | @param col | |
124 | The column to update. | |
125 | @return | |
126 | @true if both SetValue() and ValueChanged() returned @true. | |
127 | */ | |
128 | bool ChangeValue(const wxVariant& variant, | |
129 | const wxDataViewItem& item, | |
130 | unsigned int col); | |
131 | ||
23324ae1 | 132 | /** |
c4e57202 FM |
133 | Called to inform the model that all data has been cleared. |
134 | The control will reread the data from the model again. | |
23324ae1 FM |
135 | */ |
136 | virtual bool Cleared(); | |
137 | ||
138 | /** | |
139 | The compare function to be used by control. The default compare function | |
140 | sorts by container and other items separately and in ascending order. | |
141 | Override this for a different sorting behaviour. | |
c4e57202 FM |
142 | |
143 | @see HasDefaultCompare(). | |
23324ae1 FM |
144 | */ |
145 | virtual int Compare(const wxDataViewItem& item1, | |
146 | const wxDataViewItem& item2, | |
147 | unsigned int column, | |
862de7b3 | 148 | bool ascending) const; |
23324ae1 FM |
149 | |
150 | /** | |
13f184c0 | 151 | Override this to indicate that the item has special font attributes. |
c4e57202 FM |
152 | This only affects the wxDataViewTextRendererText renderer. |
153 | ||
7fadac88 VZ |
154 | The base class version always simply returns @false. |
155 | ||
c4e57202 | 156 | @see wxDataViewItemAttr. |
7fadac88 VZ |
157 | |
158 | @param item | |
159 | The item for which the attribute is requested. | |
160 | @param col | |
161 | The column of the item for which the attribute is requested. | |
162 | @param attr | |
163 | The attribute to be filled in if the function returns @true. | |
164 | @return | |
165 | @true if this item has an attribute or @false otherwise. | |
23324ae1 | 166 | */ |
fadc2df6 | 167 | virtual bool GetAttr(const wxDataViewItem& item, unsigned int col, |
7fadac88 | 168 | wxDataViewItemAttr& attr) const; |
23324ae1 | 169 | |
98f8e666 VZ |
170 | /** |
171 | Override this to indicate that the item should be disabled. | |
172 | ||
173 | Disabled items are displayed differently (e.g. grayed out) and cannot | |
174 | be interacted with. | |
175 | ||
176 | The base class version always returns @true, thus making all items | |
177 | enabled by default. | |
178 | ||
179 | @param item | |
180 | The item whose enabled status is requested. | |
181 | @param col | |
182 | The column of the item whose enabled status is requested. | |
183 | @return | |
184 | @true if this item should be enabled, @false otherwise. | |
185 | ||
cf5d4c76 | 186 | @note Currently disabling items is not supported by the wxOSX/Carbon |
e97f9fbd | 187 | implementation. |
98f8e666 VZ |
188 | |
189 | @since 2.9.2 | |
190 | */ | |
191 | virtual bool IsEnabled(const wxDataViewItem &item, | |
192 | unsigned int col) const; | |
193 | ||
23324ae1 | 194 | /** |
c4e57202 FM |
195 | Override this so the control can query the child items of an item. |
196 | Returns the number of items. | |
23324ae1 FM |
197 | */ |
198 | virtual unsigned int GetChildren(const wxDataViewItem& item, | |
fadc2df6 | 199 | wxDataViewItemArray& children) const = 0; |
23324ae1 FM |
200 | |
201 | /** | |
202 | Override this to indicate the number of columns in the model. | |
203 | */ | |
b91c4601 | 204 | virtual unsigned int GetColumnCount() const = 0; |
23324ae1 FM |
205 | |
206 | /** | |
207 | Override this to indicate what type of data is stored in the | |
c4e57202 FM |
208 | column specified by @a col. |
209 | ||
210 | This should return a string indicating the type of data as reported by wxVariant. | |
23324ae1 | 211 | */ |
b91c4601 | 212 | virtual wxString GetColumnType(unsigned int col) const = 0; |
23324ae1 FM |
213 | |
214 | /** | |
215 | Override this to indicate which wxDataViewItem representing the parent | |
57ab6f23 | 216 | of @a item or an invalid wxDataViewItem if the root item is |
23324ae1 FM |
217 | the parent item. |
218 | */ | |
b91c4601 | 219 | virtual wxDataViewItem GetParent(const wxDataViewItem& item) const = 0; |
23324ae1 FM |
220 | |
221 | /** | |
c4e57202 | 222 | Override this to indicate the value of @a item. |
23324ae1 FM |
223 | A wxVariant is used to store the data. |
224 | */ | |
b91c4601 FM |
225 | virtual void GetValue(wxVariant& variant, const wxDataViewItem& item, |
226 | unsigned int col) const = 0; | |
23324ae1 FM |
227 | |
228 | /** | |
c4e57202 FM |
229 | Override this method to indicate if a container item merely acts as a |
230 | headline (or for categorisation) or if it also acts a normal item with | |
57ab6f23 | 231 | entries for further columns. By default returns @false. |
23324ae1 | 232 | */ |
328f5751 | 233 | virtual bool HasContainerColumns(const wxDataViewItem& item) const; |
23324ae1 FM |
234 | |
235 | /** | |
236 | Override this to indicate that the model provides a default compare | |
237 | function that the control should use if no wxDataViewColumn has been | |
238 | chosen for sorting. Usually, the user clicks on a column header for | |
c4e57202 FM |
239 | sorting, the data will be sorted alphanumerically. |
240 | ||
241 | If any other order (e.g. by index or order of appearance) is required, | |
242 | then this should be used. | |
243 | See wxDataViewIndexListModel for a model which makes use of this. | |
23324ae1 | 244 | */ |
328f5751 | 245 | virtual bool HasDefaultCompare() const; |
23324ae1 | 246 | |
b372f20e VZ |
247 | /** |
248 | Return true if there is a value in the given column of this item. | |
249 | ||
250 | All normal items have values in all columns but the container items | |
251 | only show their label in the first column (@a col == 0) by default (but | |
252 | see HasContainerColumns()). So this function always returns true for | |
253 | the first column while for the other ones it returns true only if the | |
254 | item is not a container or HasContainerColumns() was overridden to | |
255 | return true for it. | |
256 | ||
257 | @since 2.9.1 | |
258 | */ | |
259 | bool HasValue(const wxDataViewItem& item, unsigned col) const; | |
260 | ||
23324ae1 | 261 | /** |
4cc4bfaf | 262 | Override this to indicate of @a item is a container, i.e. if |
23324ae1 FM |
263 | it can have child items. |
264 | */ | |
b91c4601 | 265 | virtual bool IsContainer(const wxDataViewItem& item) const = 0; |
23324ae1 FM |
266 | |
267 | /** | |
c4e57202 | 268 | Call this to inform the model that an item has been added to the data. |
23324ae1 | 269 | */ |
9ca2afd1 | 270 | bool ItemAdded(const wxDataViewItem& parent, |
23324ae1 FM |
271 | const wxDataViewItem& item); |
272 | ||
273 | /** | |
274 | Call this to inform the model that an item has changed. | |
c4e57202 | 275 | |
3a194bda | 276 | This will eventually emit a @c wxEVT_DATAVIEW_ITEM_VALUE_CHANGED |
23324ae1 FM |
277 | event (in which the column fields will not be set) to the user. |
278 | */ | |
9ca2afd1 | 279 | bool ItemChanged(const wxDataViewItem& item); |
23324ae1 FM |
280 | |
281 | /** | |
282 | Call this to inform the model that an item has been deleted from the data. | |
283 | */ | |
9ca2afd1 | 284 | bool ItemDeleted(const wxDataViewItem& parent, |
23324ae1 FM |
285 | const wxDataViewItem& item); |
286 | ||
287 | /** | |
c4e57202 | 288 | Call this to inform the model that several items have been added to the data. |
23324ae1 | 289 | */ |
9ca2afd1 | 290 | bool ItemsAdded(const wxDataViewItem& parent, |
23324ae1 FM |
291 | const wxDataViewItemArray& items); |
292 | ||
293 | /** | |
294 | Call this to inform the model that several items have changed. | |
c4e57202 | 295 | |
3a194bda | 296 | This will eventually emit @c wxEVT_DATAVIEW_ITEM_VALUE_CHANGED |
23324ae1 FM |
297 | events (in which the column fields will not be set) to the user. |
298 | */ | |
9ca2afd1 | 299 | bool ItemsChanged(const wxDataViewItemArray& items); |
23324ae1 FM |
300 | |
301 | /** | |
302 | Call this to inform the model that several items have been deleted. | |
303 | */ | |
9ca2afd1 | 304 | bool ItemsDeleted(const wxDataViewItem& parent, |
23324ae1 FM |
305 | const wxDataViewItemArray& items); |
306 | ||
307 | /** | |
4cc4bfaf | 308 | Remove the @a notifier from the list of notifiers. |
23324ae1 FM |
309 | */ |
310 | void RemoveNotifier(wxDataViewModelNotifier* notifier); | |
311 | ||
312 | /** | |
c4e57202 | 313 | Call this to initiate a resort after the sort function has been changed. |
23324ae1 FM |
314 | */ |
315 | virtual void Resort(); | |
316 | ||
317 | /** | |
318 | This gets called in order to set a value in the data model. | |
795dac4c | 319 | |
c4e57202 FM |
320 | The most common scenario is that the wxDataViewCtrl calls this method |
321 | after the user changed some data in the view. | |
322 | ||
795dac4c VZ |
323 | This is the function you need to override in your derived class but if |
324 | you want to call it, ChangeValue() is usually more convenient as | |
325 | otherwise you need to manually call ValueChanged() to update the | |
326 | control itself. | |
23324ae1 | 327 | */ |
795dac4c VZ |
328 | virtual bool SetValue(const wxVariant& variant, |
329 | const wxDataViewItem& item, | |
b91c4601 | 330 | unsigned int col) = 0; |
23324ae1 FM |
331 | |
332 | /** | |
c4e57202 FM |
333 | Call this to inform this model that a value in the model has been changed. |
334 | This is also called from wxDataViewCtrl's internal editing code, e.g. when | |
335 | editing a text field in the control. | |
336 | ||
3a194bda | 337 | This will eventually emit a @c wxEVT_DATAVIEW_ITEM_VALUE_CHANGED |
23324ae1 FM |
338 | event to the user. |
339 | */ | |
340 | virtual bool ValueChanged(const wxDataViewItem& item, | |
341 | unsigned int col); | |
5e6e278d FM |
342 | |
343 | protected: | |
344 | ||
345 | /** | |
346 | Destructor. This should not be called directly. Use DecRef() instead. | |
347 | */ | |
348 | virtual ~wxDataViewModel(); | |
23324ae1 FM |
349 | }; |
350 | ||
351 | ||
e54c96f1 | 352 | |
e39de702 | 353 | /** |
b955766e | 354 | @class wxDataViewListModel |
e39de702 | 355 | |
b955766e RR |
356 | Base class with abstract API for wxDataViewIndexListModel and |
357 | wxDataViewVirtualListModel. | |
e39de702 | 358 | |
8ed522d9 | 359 | @library{wxadv} |
b321b61c | 360 | @category{dvc} |
e39de702 | 361 | */ |
b955766e | 362 | class wxDataViewListModel : public wxDataViewModel |
e39de702 RR |
363 | { |
364 | public: | |
e39de702 RR |
365 | |
366 | /** | |
367 | Destructor. | |
368 | */ | |
adaaa686 | 369 | virtual ~wxDataViewIndexListModel(); |
e39de702 RR |
370 | |
371 | /** | |
372 | Compare method that sorts the items by their index. | |
373 | */ | |
374 | int Compare(const wxDataViewItem& item1, | |
375 | const wxDataViewItem& item2, | |
376 | unsigned int column, bool ascending); | |
377 | ||
378 | /** | |
13f184c0 | 379 | Override this to indicate that the row has special font attributes. |
c4e57202 FM |
380 | This only affects the wxDataViewTextRendererText() renderer. |
381 | ||
7fadac88 VZ |
382 | The base class version always simply returns @false. |
383 | ||
c4e57202 | 384 | @see wxDataViewItemAttr. |
7fadac88 VZ |
385 | |
386 | @param row | |
387 | The row for which the attribute is requested. | |
388 | @param col | |
389 | The column for which the attribute is requested. | |
390 | @param attr | |
391 | The attribute to be filled in if the function returns @true. | |
392 | @return | |
393 | @true if this item has an attribute or @false otherwise. | |
e39de702 | 394 | */ |
8eff6c56 | 395 | virtual bool GetAttrByRow(unsigned int row, unsigned int col, |
7fadac88 | 396 | wxDataViewItemAttr& attr) const; |
e39de702 | 397 | |
98f8e666 VZ |
398 | /** |
399 | Override this if you want to disable specific items. | |
400 | ||
401 | The base class version always returns @true, thus making all items | |
402 | enabled by default. | |
403 | ||
404 | @param row | |
405 | The row of the item whose enabled status is requested. | |
406 | @param col | |
407 | The column of the item whose enabled status is requested. | |
408 | @return | |
409 | @true if the item at this row and column should be enabled, | |
410 | @false otherwise. | |
411 | ||
412 | @note See wxDataViewModel::IsEnabled() for the current status of | |
413 | support for disabling the items under different platforms. | |
414 | ||
415 | @since 2.9.2 | |
416 | */ | |
417 | virtual bool IsEnabledByRow(unsigned int row, | |
418 | unsigned int col) const; | |
419 | ||
74d9b8fb | 420 | /** |
47e2f881 | 421 | Returns the number of items (or rows) in the list. |
74d9b8fb VZ |
422 | */ |
423 | unsigned int GetCount() const; | |
424 | ||
e39de702 RR |
425 | /** |
426 | Returns the wxDataViewItem at the given @e row. | |
427 | */ | |
428 | wxDataViewItem GetItem(unsigned int row) const; | |
429 | ||
430 | /** | |
431 | Returns the position of given @e item. | |
432 | */ | |
433 | unsigned int GetRow(const wxDataViewItem& item) const; | |
434 | ||
435 | /** | |
436 | Override this to allow getting values from the model. | |
437 | */ | |
8eff6c56 | 438 | virtual void GetValueByRow(wxVariant& variant, unsigned int row, |
fadc2df6 | 439 | unsigned int col) const = 0; |
e39de702 RR |
440 | |
441 | /** | |
c4e57202 FM |
442 | Call this after if the data has to be read again from the model. |
443 | This is useful after major changes when calling the methods below | |
444 | (possibly thousands of times) doesn't make sense. | |
e39de702 RR |
445 | */ |
446 | void Reset(unsigned int new_size); | |
447 | ||
448 | /** | |
449 | Call this after a row has been appended to the model. | |
450 | */ | |
451 | void RowAppended(); | |
452 | ||
453 | /** | |
454 | Call this after a row has been changed. | |
455 | */ | |
456 | void RowChanged(unsigned int row); | |
457 | ||
458 | /** | |
459 | Call this after a row has been deleted. | |
460 | */ | |
461 | void RowDeleted(unsigned int row); | |
462 | ||
463 | /** | |
464 | Call this after a row has been inserted at the given position. | |
465 | */ | |
466 | void RowInserted(unsigned int before); | |
467 | ||
468 | /** | |
469 | Call this after a row has been prepended to the model. | |
470 | */ | |
471 | void RowPrepended(); | |
472 | ||
473 | /** | |
474 | Call this after a value has been changed. | |
475 | */ | |
476 | void RowValueChanged(unsigned int row, unsigned int col); | |
477 | ||
478 | /** | |
c4e57202 FM |
479 | Call this after rows have been deleted. |
480 | The array will internally get copied and sorted in descending order so | |
481 | that the rows with the highest position will be deleted first. | |
e39de702 RR |
482 | */ |
483 | void RowsDeleted(const wxArrayInt& rows); | |
484 | ||
485 | /** | |
486 | Called in order to set a value in the model. | |
487 | */ | |
8eff6c56 | 488 | virtual bool SetValueByRow(const wxVariant& variant, unsigned int row, |
fadc2df6 | 489 | unsigned int col) = 0; |
e39de702 RR |
490 | }; |
491 | ||
492 | ||
b955766e RR |
493 | /** |
494 | @class wxDataViewIndexListModel | |
495 | ||
496 | wxDataViewIndexListModel is a specialized data model which lets you address | |
497 | an item by its position (row) rather than its wxDataViewItem (which you can | |
498 | obtain from this class). | |
499 | This model also provides its own wxDataViewIndexListModel::Compare | |
500 | method which sorts the model's data by the index. | |
501 | ||
502 | This model is not a virtual model since the control stores each wxDataViewItem. | |
503 | Use wxDataViewVirtualListModel if you need to display millions of items or | |
504 | have other reason to use a virtual control. | |
505 | ||
506 | @see wxDataViewListModel for the API. | |
507 | ||
508 | @library{wxadv} | |
509 | @category{dvc} | |
510 | */ | |
511 | ||
512 | class wxDataViewIndexListModel : public wxDataViewListModel | |
513 | { | |
514 | public: | |
515 | /** | |
516 | Constructor. | |
517 | */ | |
518 | wxDataViewIndexListModel(unsigned int initial_size = 0); | |
519 | ||
520 | }; | |
e39de702 RR |
521 | |
522 | /** | |
523 | @class wxDataViewVirtualListModel | |
e39de702 | 524 | |
c4e57202 FM |
525 | wxDataViewVirtualListModel is a specialized data model which lets you address |
526 | an item by its position (row) rather than its wxDataViewItem and as such offers | |
527 | the exact same interface as wxDataViewIndexListModel. | |
528 | The important difference is that under platforms other than OS X, using this | |
529 | model will result in a truly virtual control able to handle millions of items | |
b955766e | 530 | as the control doesn't store any item (a feature not supported by OS X). |
e39de702 | 531 | |
b955766e | 532 | @see wxDataViewListModel for the API. |
e39de702 | 533 | |
8ed522d9 | 534 | @library{wxadv} |
b321b61c | 535 | @category{dvc} |
e39de702 | 536 | */ |
b955766e RR |
537 | |
538 | class wxDataViewVirtualListModel : public wxDataViewListModel | |
e39de702 RR |
539 | { |
540 | public: | |
541 | /** | |
542 | Constructor. | |
543 | */ | |
544 | wxDataViewVirtualListModel(unsigned int initial_size = 0); | |
74d9b8fb | 545 | |
6da3d196 | 546 | }; |
e39de702 RR |
547 | |
548 | ||
549 | ||
23324ae1 FM |
550 | /** |
551 | @class wxDataViewItemAttr | |
7c913512 | 552 | |
c4e57202 FM |
553 | This class is used to indicate to a wxDataViewCtrl that a certain item |
554 | (see wxDataViewItem) has extra font attributes for its renderer. | |
555 | For this, it is required to override wxDataViewModel::GetAttr. | |
7c913512 | 556 | |
c4e57202 | 557 | Attributes are currently only supported by wxDataViewTextRendererText. |
7c913512 | 558 | |
23324ae1 | 559 | @library{wxadv} |
b321b61c | 560 | @category{dvc} |
23324ae1 | 561 | */ |
7c913512 | 562 | class wxDataViewItemAttr |
23324ae1 FM |
563 | { |
564 | public: | |
565 | /** | |
566 | Constructor. | |
567 | */ | |
568 | wxDataViewItemAttr(); | |
569 | ||
570 | /** | |
571 | Call this to indicate that the item shall be displayed in bold text. | |
572 | */ | |
573 | void SetBold(bool set); | |
574 | ||
575 | /** | |
c4e57202 | 576 | Call this to indicate that the item shall be displayed with that colour. |
23324ae1 FM |
577 | */ |
578 | void SetColour(const wxColour& colour); | |
579 | ||
1c959a62 VZ |
580 | /** |
581 | Call this to set the background colour to use. | |
582 | ||
583 | Currently this attribute is only supported in the generic version of | |
584 | wxDataViewCtrl and ignored by the native GTK+ and OS X implementations. | |
585 | ||
586 | @since 2.9.4 | |
587 | */ | |
588 | void SetBackgroundColour(const wxColour& colour); | |
589 | ||
23324ae1 FM |
590 | /** |
591 | Call this to indicate that the item shall be displayed in italic text. | |
592 | */ | |
593 | void SetItalic(bool set); | |
594 | }; | |
595 | ||
596 | ||
e54c96f1 | 597 | |
23324ae1 FM |
598 | /** |
599 | @class wxDataViewItem | |
7c913512 | 600 | |
c4e57202 | 601 | wxDataViewItem is a small opaque class that represents an item in a wxDataViewCtrl |
fe45d6ff | 602 | in a persistent way, i.e. independent of the position of the item in the control |
c4e57202 FM |
603 | or changes to its contents. |
604 | ||
605 | It must hold a unique ID of type @e void* in its only field and can be converted | |
606 | to and from it. | |
607 | ||
608 | If the ID is @NULL the wxDataViewItem is invalid and wxDataViewItem::IsOk will | |
609 | return @false which used in many places in the API of wxDataViewCtrl to | |
610 | indicate that e.g. no item was found. An ID of @NULL is also used to indicate | |
611 | the invisible root. Examples for this are wxDataViewModel::GetParent and | |
23324ae1 | 612 | wxDataViewModel::GetChildren. |
7c913512 | 613 | |
23324ae1 | 614 | @library{wxadv} |
b321b61c | 615 | @category{dvc} |
23324ae1 | 616 | */ |
7c913512 | 617 | class wxDataViewItem |
23324ae1 FM |
618 | { |
619 | public: | |
620 | //@{ | |
621 | /** | |
c4e57202 | 622 | Constructor. |
23324ae1 | 623 | */ |
d5c4a81f | 624 | wxDataViewItem(); |
7c913512 | 625 | wxDataViewItem(const wxDataViewItem& item); |
d5c4a81f | 626 | explicit wxDataViewItem(void* id); |
23324ae1 FM |
627 | //@} |
628 | ||
629 | /** | |
630 | Returns the ID. | |
631 | */ | |
328f5751 | 632 | void* GetID() const; |
23324ae1 FM |
633 | |
634 | /** | |
c4e57202 | 635 | Returns @true if the ID is not @NULL. |
23324ae1 | 636 | */ |
328f5751 | 637 | bool IsOk() const; |
23324ae1 FM |
638 | }; |
639 | ||
640 | ||
e9321277 RD |
641 | // ---------------------------------------------------------------------------- |
642 | // wxDataViewCtrl flags | |
643 | // ---------------------------------------------------------------------------- | |
644 | ||
645 | // size of a wxDataViewRenderer without contents: | |
646 | #define wxDVC_DEFAULT_RENDERER_SIZE 20 | |
647 | ||
648 | // the default width of new (text) columns: | |
649 | #define wxDVC_DEFAULT_WIDTH 80 | |
650 | ||
651 | // the default width of new toggle columns: | |
652 | #define wxDVC_TOGGLE_DEFAULT_WIDTH 30 | |
653 | ||
654 | // the default minimal width of the columns: | |
655 | #define wxDVC_DEFAULT_MINWIDTH 30 | |
656 | ||
657 | // The default alignment of wxDataViewRenderers is to take | |
658 | // the alignment from the column it owns. | |
659 | #define wxDVR_DEFAULT_ALIGNMENT -1 | |
660 | ||
661 | #define wxDV_SINGLE 0x0000 // for convenience | |
662 | #define wxDV_MULTIPLE 0x0001 // can select multiple items | |
663 | ||
664 | #define wxDV_NO_HEADER 0x0002 // column titles not visible | |
665 | #define wxDV_HORIZ_RULES 0x0004 // light horizontal rules between rows | |
666 | #define wxDV_VERT_RULES 0x0008 // light vertical rules between columns | |
667 | ||
668 | #define wxDV_ROW_LINES 0x0010 // alternating colour in rows | |
669 | #define wxDV_VARIABLE_LINE_HEIGHT 0x0020 // variable line height | |
670 | ||
ea8fa3c4 RD |
671 | // events |
672 | ||
673 | wxEventType wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED; | |
674 | ||
675 | wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED; | |
676 | wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING; | |
677 | wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED; | |
678 | wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING; | |
679 | wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED; | |
680 | wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_START_EDITING; | |
681 | wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED; | |
682 | wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE; | |
683 | wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED; | |
684 | ||
685 | wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU; | |
686 | ||
687 | wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK; | |
688 | wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK; | |
689 | wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED; | |
690 | wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED; | |
691 | wxEventType wxEVT_COMMAND_DATAVIEW_CACHE_HINT; | |
692 | ||
693 | wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG; | |
694 | wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE; | |
695 | wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_DROP; | |
e54c96f1 | 696 | |
23324ae1 FM |
697 | /** |
698 | @class wxDataViewCtrl | |
7c913512 | 699 | |
c4e57202 FM |
700 | wxDataViewCtrl is a control to display data either in a tree like fashion or |
701 | in a tabular form or both. | |
02b51ae5 | 702 | |
c4e57202 FM |
703 | If you only need to display a simple tree structure with an API more like the |
704 | older wxTreeCtrl class, then the specialized wxDataViewTreeCtrl can be used. | |
02b51ae5 | 705 | Likewise, if you only want to display simple table structure you can use |
832df171 RR |
706 | the specialized wxDataViewListCtrl class. Both wxDataViewTreeCtrl and |
707 | wxDataViewListCtrl can be used without defining your own wxDataViewModel. | |
c4e57202 FM |
708 | |
709 | A wxDataViewItem is used to represent a (visible) item in the control. | |
710 | ||
80932a3e | 711 | Unlike wxListCtrl, wxDataViewCtrl doesn't get its data from the user through |
c4e57202 FM |
712 | virtual functions or by setting it directly. Instead you need to write your own |
713 | wxDataViewModel and associate it with this control. | |
714 | Then you need to add a number of wxDataViewColumn to this control to define | |
715 | what each column shall display. Each wxDataViewColumn in turn owns 1 instance | |
716 | of a wxDataViewRenderer to render its cells. | |
717 | ||
718 | A number of standard renderers for rendering text, dates, images, toggle, | |
719 | a progress bar etc. are provided. Additionally, the user can write custom | |
80932a3e | 720 | renderers deriving from wxDataViewCustomRenderer for displaying anything. |
c4e57202 FM |
721 | |
722 | All data transfer from the control to the model and the user code is done | |
723 | through wxVariant which can be extended to support more data formats as necessary. | |
724 | Accordingly, all type information uses the strings returned from wxVariant::GetType. | |
7c913512 | 725 | |
23324ae1 | 726 | @beginStyleTable |
8c6791e4 | 727 | @style{wxDV_SINGLE} |
23324ae1 | 728 | Single selection mode. This is the default. |
8c6791e4 | 729 | @style{wxDV_MULTIPLE} |
23324ae1 | 730 | Multiple selection mode. |
8c6791e4 | 731 | @style{wxDV_ROW_LINES} |
23324ae1 | 732 | Use alternating colours for rows if supported by platform and theme. |
cc72cde0 VZ |
733 | Currently only supported by the native GTK and OS X implementations |
734 | but not by the generic one. | |
8c6791e4 | 735 | @style{wxDV_HORIZ_RULES} |
23324ae1 | 736 | Display fine rules between row if supported. |
8c6791e4 | 737 | @style{wxDV_VERT_RULES} |
23324ae1 | 738 | Display fine rules between columns is supported. |
d7c6d397 | 739 | @style{wxDV_VARIABLE_LINE_HEIGHT} |
c4e57202 | 740 | Allow variable line heights. |
14f73cf1 | 741 | This can be inefficient when displaying large number of items. |
b5123fb6 VZ |
742 | @style{wxDV_NO_HEADER} |
743 | Do not show column headers (which are shown by default). | |
23324ae1 | 744 | @endStyleTable |
7c913512 | 745 | |
3051a44a | 746 | @beginEventEmissionTable{wxDataViewEvent} |
7d01d660 | 747 | @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)} |
14f73cf1 | 748 | Process a @c wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event. |
7d01d660 | 749 | @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)} |
14f73cf1 | 750 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event. |
3e978cf7 | 751 | @event{EVT_DATAVIEW_ITEM_START_EDITING(id, func)} |
b0c7cd8e | 752 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_START_EDITING event. This |
3e978cf7 | 753 | event can be vetoed in order to prevent editing on an item by item |
b0c7cd8e | 754 | basis. |
7d01d660 | 755 | @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)} |
14f73cf1 | 756 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event. |
7d01d660 | 757 | @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)} |
14f73cf1 | 758 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event. |
7d01d660 | 759 | @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)} |
14f73cf1 | 760 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event. |
7d01d660 | 761 | @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)} |
14f73cf1 | 762 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event. |
7d01d660 | 763 | @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)} |
14f73cf1 | 764 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event. |
7d01d660 | 765 | @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)} |
14f73cf1 | 766 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event. |
7d01d660 | 767 | @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)} |
14f73cf1 | 768 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event. |
7d01d660 | 769 | @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)} |
7ed24cb6 VZ |
770 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event |
771 | generated when the user right clicks inside the control. Notice that | |
772 | this menu is generated even if the click didn't occur on any valid | |
773 | item, in this case wxDataViewEvent::GetItem() simply returns an | |
774 | invalid item. | |
7d01d660 | 775 | @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)} |
14f73cf1 | 776 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event. |
7d01d660 | 777 | @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)} |
14f73cf1 | 778 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event. |
7d01d660 | 779 | @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)} |
14f73cf1 | 780 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event. |
7d01d660 | 781 | @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)} |
14f73cf1 | 782 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event. |
591cc82d | 783 | @event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)} |
14f73cf1 | 784 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG event. |
e4de825e | 785 | @event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)} |
14f73cf1 | 786 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event. |
e4de825e | 787 | @event{EVT_DATAVIEW_ITEM_DROP(id, func)} |
14f73cf1 | 788 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP event. |
7d01d660 | 789 | @endEventTable |
b91c4601 | 790 | |
23324ae1 | 791 | @library{wxadv} |
b321b61c | 792 | @category{ctrl,dvc} |
7e59b885 | 793 | @appearance{dataviewctrl.png} |
23324ae1 FM |
794 | */ |
795 | class wxDataViewCtrl : public wxControl | |
796 | { | |
797 | public: | |
23324ae1 | 798 | /** |
19723525 | 799 | Default Constructor. |
23324ae1 FM |
800 | */ |
801 | wxDataViewCtrl(); | |
b91c4601 | 802 | |
19723525 RR |
803 | /** |
804 | Constructor. Calls Create(). | |
805 | */ | |
7c913512 FM |
806 | wxDataViewCtrl(wxWindow* parent, wxWindowID id, |
807 | const wxPoint& pos = wxDefaultPosition, | |
808 | const wxSize& size = wxDefaultSize, | |
809 | long style = 0, | |
8eb99915 RR |
810 | const wxValidator& validator = wxDefaultValidator, |
811 | const wxString& name = wxDataViewCtrlNameStr); | |
23324ae1 FM |
812 | |
813 | /** | |
814 | Destructor. | |
815 | */ | |
adaaa686 | 816 | virtual ~wxDataViewCtrl(); |
23324ae1 | 817 | |
e39de702 | 818 | /** |
19723525 | 819 | Appends a wxDataViewColumn to the control. Returns @true on success. |
c4e57202 | 820 | |
e39de702 RR |
821 | Note that there is a number of short cut methods which implicitly create |
822 | a wxDataViewColumn and a wxDataViewRenderer for it (see below). | |
823 | */ | |
824 | virtual bool AppendColumn(wxDataViewColumn* col); | |
825 | ||
19723525 RR |
826 | /** |
827 | Prepends a wxDataViewColumn to the control. Returns @true on success. | |
c4e57202 | 828 | |
19723525 RR |
829 | Note that there is a number of short cut methods which implicitly create |
830 | a wxDataViewColumn and a wxDataViewRenderer for it. | |
831 | */ | |
832 | virtual bool PrependColumn(wxDataViewColumn* col); | |
833 | ||
834 | /** | |
835 | Inserts a wxDataViewColumn to the control. Returns @true on success. | |
836 | */ | |
837 | virtual bool InsertColumn(unsigned int pos, wxDataViewColumn* col); | |
b91c4601 | 838 | |
23324ae1 FM |
839 | //@{ |
840 | /** | |
841 | Appends a column for rendering a bitmap. Returns the wxDataViewColumn | |
842 | created in the function or @NULL on failure. | |
843 | */ | |
844 | wxDataViewColumn* AppendBitmapColumn(const wxString& label, | |
845 | unsigned int model_column, | |
846 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
847 | int width = -1, | |
848 | wxAlignment align = wxALIGN_CENTER, | |
849 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
7c913512 FM |
850 | wxDataViewColumn* AppendBitmapColumn(const wxBitmap& label, |
851 | unsigned int model_column, | |
852 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
853 | int width = -1, | |
854 | wxAlignment align = wxALIGN_CENTER, | |
855 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
23324ae1 FM |
856 | //@} |
857 | ||
23324ae1 FM |
858 | //@{ |
859 | /** | |
860 | Appends a column for rendering a date. Returns the wxDataViewColumn | |
861 | created in the function or @NULL on failure. | |
b91c4601 | 862 | |
c4e57202 FM |
863 | @note The @a align parameter is applied to both the column header and |
864 | the column renderer. | |
23324ae1 FM |
865 | */ |
866 | wxDataViewColumn* AppendDateColumn(const wxString& label, | |
867 | unsigned int model_column, | |
868 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, | |
869 | int width = -1, | |
882678eb | 870 | wxAlignment align = wxALIGN_NOT, |
23324ae1 | 871 | int flags = wxDATAVIEW_COL_RESIZABLE); |
7c913512 FM |
872 | wxDataViewColumn* AppendDateColumn(const wxBitmap& label, |
873 | unsigned int model_column, | |
874 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, | |
875 | int width = -1, | |
882678eb | 876 | wxAlignment align = wxALIGN_NOT, |
7c913512 | 877 | int flags = wxDATAVIEW_COL_RESIZABLE); |
23324ae1 FM |
878 | //@} |
879 | ||
880 | //@{ | |
881 | /** | |
882 | Appends a column for rendering text with an icon. Returns the wxDataViewColumn | |
c4e57202 FM |
883 | created in the function or @NULL on failure. |
884 | This method uses the wxDataViewIconTextRenderer class. | |
b91c4601 | 885 | |
c4e57202 FM |
886 | @note The @a align parameter is applied to both the column header and |
887 | the column renderer. | |
23324ae1 FM |
888 | */ |
889 | wxDataViewColumn* AppendIconTextColumn(const wxString& label, | |
890 | unsigned int model_column, | |
891 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
892 | int width = -1, | |
882678eb | 893 | wxAlignment align = wxALIGN_NOT, |
23324ae1 | 894 | int flags = wxDATAVIEW_COL_RESIZABLE); |
7c913512 FM |
895 | wxDataViewColumn* AppendIconTextColumn(const wxBitmap& label, |
896 | unsigned int model_column, | |
897 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
898 | int width = -1, | |
882678eb | 899 | wxAlignment align = wxALIGN_NOT, |
7c913512 | 900 | int flags = wxDATAVIEW_COL_RESIZABLE); |
23324ae1 FM |
901 | //@} |
902 | ||
903 | //@{ | |
904 | /** | |
905 | Appends a column for rendering a progress indicator. Returns the | |
e39de702 | 906 | wxDataViewColumn created in the function or @NULL on failure. |
b91c4601 | 907 | |
c4e57202 FM |
908 | @note The @a align parameter is applied to both the column header and |
909 | the column renderer. | |
23324ae1 FM |
910 | */ |
911 | wxDataViewColumn* AppendProgressColumn(const wxString& label, | |
912 | unsigned int model_column, | |
913 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
914 | int width = 80, | |
915 | wxAlignment align = wxALIGN_CENTER, | |
916 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
7c913512 FM |
917 | wxDataViewColumn* AppendProgressColumn(const wxBitmap& label, |
918 | unsigned int model_column, | |
919 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
920 | int width = 80, | |
921 | wxAlignment align = wxALIGN_CENTER, | |
922 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
23324ae1 FM |
923 | //@} |
924 | ||
925 | //@{ | |
926 | /** | |
927 | Appends a column for rendering text. Returns the wxDataViewColumn | |
928 | created in the function or @NULL on failure. | |
b91c4601 | 929 | |
c4e57202 FM |
930 | @note The @a align parameter is applied to both the column header and |
931 | the column renderer. | |
23324ae1 FM |
932 | */ |
933 | wxDataViewColumn* AppendTextColumn(const wxString& label, | |
934 | unsigned int model_column, | |
935 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
936 | int width = -1, | |
882678eb | 937 | wxAlignment align = wxALIGN_NOT, |
23324ae1 | 938 | int flags = wxDATAVIEW_COL_RESIZABLE); |
7c913512 FM |
939 | wxDataViewColumn* AppendTextColumn(const wxBitmap& label, |
940 | unsigned int model_column, | |
941 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
942 | int width = -1, | |
882678eb | 943 | wxAlignment align = wxALIGN_NOT, |
7c913512 | 944 | int flags = wxDATAVIEW_COL_RESIZABLE); |
23324ae1 FM |
945 | //@} |
946 | ||
947 | //@{ | |
948 | /** | |
949 | Appends a column for rendering a toggle. Returns the wxDataViewColumn | |
950 | created in the function or @NULL on failure. | |
b91c4601 | 951 | |
c4e57202 FM |
952 | @note The @a align parameter is applied to both the column header and |
953 | the column renderer. | |
23324ae1 FM |
954 | */ |
955 | wxDataViewColumn* AppendToggleColumn(const wxString& label, | |
956 | unsigned int model_column, | |
957 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
958 | int width = 30, | |
959 | wxAlignment align = wxALIGN_CENTER, | |
960 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
7c913512 FM |
961 | wxDataViewColumn* AppendToggleColumn(const wxBitmap& label, |
962 | unsigned int model_column, | |
963 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
964 | int width = 30, | |
965 | wxAlignment align = wxALIGN_CENTER, | |
966 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
23324ae1 FM |
967 | //@} |
968 | ||
969 | /** | |
c4e57202 FM |
970 | Associates a wxDataViewModel with the control. |
971 | This increases the reference count of the model by 1. | |
23324ae1 FM |
972 | */ |
973 | virtual bool AssociateModel(wxDataViewModel* model); | |
974 | ||
975 | /** | |
976 | Removes all columns. | |
977 | */ | |
978 | virtual bool ClearColumns(); | |
979 | ||
23324ae1 FM |
980 | /** |
981 | Collapses the item. | |
982 | */ | |
adaaa686 | 983 | virtual void Collapse(const wxDataViewItem& item); |
23324ae1 FM |
984 | |
985 | /** | |
986 | Create the control. Useful for two step creation. | |
987 | */ | |
988 | bool Create(wxWindow* parent, wxWindowID id, | |
989 | const wxPoint& pos = wxDefaultPosition, | |
990 | const wxSize& size = wxDefaultSize, | |
991 | long style = 0, | |
8eb99915 RR |
992 | const wxValidator& validator = wxDefaultValidator, |
993 | const wxString& name = wxDataViewCtrlNameStr); | |
23324ae1 FM |
994 | |
995 | /** | |
996 | Deletes given column. | |
997 | */ | |
50ec54b6 | 998 | virtual bool DeleteColumn(wxDataViewColumn* column); |
23324ae1 | 999 | |
907f09f4 VS |
1000 | /** |
1001 | Programmatically starts editing given cell of @a item. | |
1002 | ||
1003 | Doesn't do anything if the item or this column is not editable. | |
1004 | ||
1005 | @note Currently not implemented in wxOSX/Carbon. | |
1006 | ||
1007 | @since 2.9.4 | |
1008 | */ | |
1009 | virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column); | |
1010 | ||
e4de825e RR |
1011 | /** |
1012 | Enable drag operations using the given @a format. | |
1013 | */ | |
1014 | virtual bool EnableDragSource( const wxDataFormat &format ); | |
02b51ae5 | 1015 | |
e4de825e RR |
1016 | /** |
1017 | Enable drop operations using the given @a format. | |
1018 | */ | |
1019 | virtual bool EnableDropTarget( const wxDataFormat &format ); | |
02b51ae5 | 1020 | |
23324ae1 FM |
1021 | /** |
1022 | Call this to ensure that the given item is visible. | |
1023 | */ | |
fadc2df6 FM |
1024 | virtual void EnsureVisible(const wxDataViewItem& item, |
1025 | const wxDataViewColumn* column = NULL); | |
23324ae1 FM |
1026 | |
1027 | /** | |
1028 | Expands the item. | |
1029 | */ | |
adaaa686 | 1030 | virtual void Expand(const wxDataViewItem& item); |
23324ae1 | 1031 | |
4219d8b0 RR |
1032 | /** |
1033 | Expands all ancestors of the @a item. This method also | |
1034 | ensures that the item itself as well as all ancestor | |
1035 | items have been read from the model by the control. | |
1036 | */ | |
1037 | virtual void ExpandAncestors( const wxDataViewItem & item ); | |
798c0d87 | 1038 | |
23324ae1 | 1039 | /** |
c4e57202 FM |
1040 | Returns pointer to the column. @a pos refers to the position in the |
1041 | control which may change after reordering columns by the user. | |
23324ae1 | 1042 | */ |
328f5751 | 1043 | virtual wxDataViewColumn* GetColumn(unsigned int pos) const; |
23324ae1 FM |
1044 | |
1045 | /** | |
1046 | Returns the number of columns. | |
1047 | */ | |
328f5751 | 1048 | virtual unsigned int GetColumnCount() const; |
23324ae1 FM |
1049 | |
1050 | /** | |
1051 | Returns the position of the column or -1 if not found in the control. | |
1052 | */ | |
328f5751 | 1053 | virtual int GetColumnPosition(const wxDataViewColumn* column) const; |
23324ae1 FM |
1054 | |
1055 | /** | |
1056 | Returns column containing the expanders. | |
1057 | */ | |
328f5751 | 1058 | wxDataViewColumn* GetExpanderColumn() const; |
23324ae1 | 1059 | |
80ce465c VZ |
1060 | /** |
1061 | Returns the currently focused item. | |
1062 | ||
1063 | This is the item that the keyboard commands apply to. It may be invalid | |
1064 | if there is no focus currently. | |
1065 | ||
1066 | This method is mostly useful for the controls with @c wxDV_MULTIPLE | |
1067 | style as in the case of single selection it returns the same thing as | |
1068 | GetSelection(). | |
1069 | ||
1070 | Notice that under all platforms except Mac OS X the currently focused | |
1071 | item may be selected or not but under OS X the current item is always | |
1072 | selected. | |
1073 | ||
ee1377e1 | 1074 | @see SetCurrentItem(), GetCurrentColumn() |
80ce465c VZ |
1075 | |
1076 | @since 2.9.2 | |
1077 | */ | |
1078 | wxDataViewItem GetCurrentItem() const; | |
1079 | ||
ee1377e1 VS |
1080 | /** |
1081 | Returns the column that currently has focus. | |
1082 | ||
1083 | If the focus is set to individual cell within the currently focused | |
1084 | item (as opposed to being on the item as a whole), then this is the | |
1085 | column that the focus is on. | |
1086 | ||
1087 | Returns NULL if no column currently has focus. | |
1088 | ||
1089 | @see GetCurrentItem() | |
1090 | ||
1091 | @since 2.9.4 | |
1092 | */ | |
1093 | wxDataViewColumn *GetCurrentColumn() const; | |
1094 | ||
23324ae1 FM |
1095 | /** |
1096 | Returns indentation. | |
1097 | */ | |
328f5751 | 1098 | int GetIndent() const; |
23324ae1 FM |
1099 | |
1100 | /** | |
1101 | Returns item rect. | |
1102 | */ | |
fadc2df6 FM |
1103 | virtual wxRect GetItemRect(const wxDataViewItem& item, |
1104 | const wxDataViewColumn* col = NULL) const; | |
23324ae1 FM |
1105 | |
1106 | /** | |
c4e57202 | 1107 | Returns pointer to the data model associated with the control (if any). |
23324ae1 | 1108 | */ |
adaaa686 | 1109 | wxDataViewModel* GetModel(); |
23324ae1 | 1110 | |
fa93d732 VZ |
1111 | /** |
1112 | Returns the number of currently selected items. | |
1113 | ||
1114 | This method may be called for both the controls with single and | |
1115 | multiple selections and returns the number of selected item, possibly | |
1116 | 0, in any case. | |
1117 | ||
1118 | @since 2.9.3 | |
1119 | */ | |
1120 | virtual int GetSelectedItemsCount() const; | |
1121 | ||
23324ae1 FM |
1122 | /** |
1123 | Returns first selected item or an invalid item if none is selected. | |
fa93d732 VZ |
1124 | |
1125 | This method may be called for both the controls with single and | |
1126 | multiple selections but returns an invalid item if more than one item | |
1127 | is selected in the latter case, use HasSelection() to determine if | |
1128 | there are any selected items when using multiple selection. | |
23324ae1 | 1129 | */ |
adaaa686 | 1130 | virtual wxDataViewItem GetSelection() const; |
23324ae1 FM |
1131 | |
1132 | /** | |
c4e57202 | 1133 | Fills @a sel with currently selected items and returns their number. |
fa93d732 VZ |
1134 | |
1135 | This method may be called for both the controls with single and | |
1136 | multiple selections. In the single selection case it returns the array | |
1137 | with at most one element in it. | |
1138 | ||
1139 | @see GetSelectedItemsCount() | |
23324ae1 | 1140 | */ |
adaaa686 | 1141 | virtual int GetSelections(wxDataViewItemArray& sel) const; |
23324ae1 FM |
1142 | |
1143 | /** | |
1144 | Returns the wxDataViewColumn currently responsible for sorting | |
1145 | or @NULL if none has been selected. | |
1146 | */ | |
328f5751 | 1147 | virtual wxDataViewColumn* GetSortingColumn() const; |
23324ae1 | 1148 | |
fa93d732 VZ |
1149 | /** |
1150 | Returns true if any items are currently selected. | |
1151 | ||
1152 | This method may be called for both the controls with single and | |
1153 | multiple selections. | |
1154 | ||
1155 | Calling this method is equivalent to calling GetSelectedItemsCount() | |
1156 | and comparing its result with 0 but is more clear and might also be | |
1157 | implemented more efficiently in the future. | |
1158 | ||
1159 | @since 2.9.3 | |
1160 | */ | |
1161 | bool HasSelection() const; | |
1162 | ||
23324ae1 FM |
1163 | /** |
1164 | Hittest. | |
1165 | */ | |
fadc2df6 FM |
1166 | virtual void HitTest(const wxPoint& point, wxDataViewItem& item, |
1167 | wxDataViewColumn*& col) const; | |
23324ae1 | 1168 | |
739a8399 RR |
1169 | /** |
1170 | Return @true if the item is expanded. | |
739a8399 RR |
1171 | */ |
1172 | virtual bool IsExpanded(const wxDataViewItem& item) const; | |
1173 | ||
23324ae1 FM |
1174 | /** |
1175 | Return @true if the item is selected. | |
1176 | */ | |
adaaa686 | 1177 | virtual bool IsSelected(const wxDataViewItem& item) const; |
23324ae1 FM |
1178 | |
1179 | /** | |
1180 | Select the given item. | |
1e184300 VZ |
1181 | |
1182 | In single selection mode this changes the (unique) currently selected | |
1183 | item. In multi selection mode, the @a item is selected and the | |
1184 | previously selected items remain selected. | |
23324ae1 | 1185 | */ |
adaaa686 | 1186 | virtual void Select(const wxDataViewItem& item); |
23324ae1 FM |
1187 | |
1188 | /** | |
1189 | Select all items. | |
1190 | */ | |
adaaa686 | 1191 | virtual void SelectAll(); |
23324ae1 FM |
1192 | |
1193 | /** | |
1194 | Set which column shall contain the tree-like expanders. | |
1195 | */ | |
4cc4bfaf | 1196 | void SetExpanderColumn(wxDataViewColumn* col); |
23324ae1 | 1197 | |
80ce465c VZ |
1198 | /** |
1199 | Changes the currently focused item. | |
1200 | ||
1201 | The @a item parameter must be valid, there is no way to remove the | |
1202 | current item from the control. | |
1203 | ||
1204 | In single selection mode, calling this method is the same as calling | |
1205 | Select() and is thus not very useful. In multiple selection mode this | |
1206 | method only moves the current item however without changing the | |
1207 | selection except under OS X where the current item is always selected, | |
1208 | so calling SetCurrentItem() selects @a item if it hadn't been selected | |
1209 | before. | |
1210 | ||
1211 | @see GetCurrentItem() | |
1212 | ||
1213 | @since 2.9.2 | |
1214 | */ | |
1215 | void SetCurrentItem(const wxDataViewItem& item); | |
1216 | ||
23324ae1 | 1217 | /** |
57ab6f23 | 1218 | Sets the indentation. |
23324ae1 FM |
1219 | */ |
1220 | void SetIndent(int indent); | |
1221 | ||
1222 | /** | |
1223 | Sets the selection to the array of wxDataViewItems. | |
1224 | */ | |
adaaa686 | 1225 | virtual void SetSelections(const wxDataViewItemArray& sel); |
23324ae1 FM |
1226 | |
1227 | /** | |
1228 | Unselect the given item. | |
1229 | */ | |
adaaa686 | 1230 | virtual void Unselect(const wxDataViewItem& item); |
23324ae1 FM |
1231 | |
1232 | /** | |
c4e57202 FM |
1233 | Unselect all item. |
1234 | This method only has effect if multiple selections are allowed. | |
23324ae1 | 1235 | */ |
adaaa686 | 1236 | virtual void UnselectAll(); |
bbfd4548 VZ |
1237 | |
1238 | /** | |
1239 | Sets the row height. | |
1240 | ||
1241 | This function can only be used when all rows have the same height, i.e. | |
1242 | when wxDV_VARIABLE_LINE_HEIGHT flag is not used. | |
1243 | ||
0f4a54a6 VZ |
1244 | Currently this is implemented in the generic and native GTK versions |
1245 | only and nothing is done (and @false returned) when using OS X port. | |
1246 | ||
1247 | Also notice that this method can only be used to increase the row | |
1248 | height compared with the default one (as determined by the return value | |
1249 | of wxDataViewRenderer::GetSize()), if it is set to a too small value | |
1250 | then the minimum required by the renderers will be used. | |
bbfd4548 VZ |
1251 | |
1252 | @return @true if the line height was changed or @false otherwise. | |
1253 | ||
1254 | @since 2.9.2 | |
1255 | */ | |
1256 | virtual bool SetRowHeight(int rowHeight); | |
23324ae1 FM |
1257 | }; |
1258 | ||
1259 | ||
e54c96f1 | 1260 | |
23324ae1 FM |
1261 | /** |
1262 | @class wxDataViewModelNotifier | |
7c913512 | 1263 | |
c4e57202 FM |
1264 | A wxDataViewModelNotifier instance is owned by a wxDataViewModel and mirrors |
1265 | its notification interface. | |
1266 | See the documentation of that class for further information. | |
7c913512 | 1267 | |
8ed522d9 | 1268 | @library{wxadv} |
b321b61c | 1269 | @category{dvc} |
23324ae1 | 1270 | */ |
7c913512 | 1271 | class wxDataViewModelNotifier |
23324ae1 FM |
1272 | { |
1273 | public: | |
1274 | /** | |
1275 | Constructor. | |
1276 | */ | |
1277 | wxDataViewModelNotifier(); | |
1278 | ||
1279 | /** | |
1280 | Destructor. | |
1281 | */ | |
adaaa686 | 1282 | virtual ~wxDataViewModelNotifier(); |
23324ae1 FM |
1283 | |
1284 | /** | |
1285 | Called by owning model. | |
1286 | */ | |
b91c4601 | 1287 | virtual bool Cleared() = 0; |
23324ae1 FM |
1288 | |
1289 | /** | |
1290 | Get owning wxDataViewModel. | |
1291 | */ | |
e51bf699 | 1292 | wxDataViewModel* GetOwner() const; |
23324ae1 FM |
1293 | |
1294 | /** | |
1295 | Called by owning model. | |
63e55c0a VS |
1296 | |
1297 | @return Always return @true from this function in derived classes. | |
23324ae1 | 1298 | */ |
fadc2df6 FM |
1299 | virtual bool ItemAdded(const wxDataViewItem& parent, |
1300 | const wxDataViewItem& item) = 0; | |
23324ae1 FM |
1301 | |
1302 | /** | |
1303 | Called by owning model. | |
63e55c0a VS |
1304 | |
1305 | @return Always return @true from this function in derived classes. | |
23324ae1 | 1306 | */ |
b91c4601 | 1307 | virtual bool ItemChanged(const wxDataViewItem& item) = 0; |
23324ae1 FM |
1308 | |
1309 | /** | |
1310 | Called by owning model. | |
63e55c0a VS |
1311 | |
1312 | @return Always return @true from this function in derived classes. | |
23324ae1 | 1313 | */ |
fadc2df6 FM |
1314 | virtual bool ItemDeleted(const wxDataViewItem& parent, |
1315 | const wxDataViewItem& item) = 0; | |
23324ae1 FM |
1316 | |
1317 | /** | |
1318 | Called by owning model. | |
63e55c0a VS |
1319 | |
1320 | @return Always return @true from this function in derived classes. | |
23324ae1 | 1321 | */ |
fadc2df6 FM |
1322 | virtual bool ItemsAdded(const wxDataViewItem& parent, |
1323 | const wxDataViewItemArray& items); | |
23324ae1 FM |
1324 | |
1325 | /** | |
1326 | Called by owning model. | |
63e55c0a VS |
1327 | |
1328 | @return Always return @true from this function in derived classes. | |
23324ae1 | 1329 | */ |
adaaa686 | 1330 | virtual bool ItemsChanged(const wxDataViewItemArray& items); |
23324ae1 FM |
1331 | |
1332 | /** | |
1333 | Called by owning model. | |
63e55c0a VS |
1334 | |
1335 | @return Always return @true from this function in derived classes. | |
23324ae1 | 1336 | */ |
fadc2df6 FM |
1337 | virtual bool ItemsDeleted(const wxDataViewItem& parent, |
1338 | const wxDataViewItemArray& items); | |
23324ae1 FM |
1339 | |
1340 | /** | |
1341 | Called by owning model. | |
1342 | */ | |
b91c4601 | 1343 | virtual void Resort() = 0; |
23324ae1 FM |
1344 | |
1345 | /** | |
1346 | Set owner of this notifier. Used internally. | |
1347 | */ | |
1348 | void SetOwner(wxDataViewModel* owner); | |
1349 | ||
1350 | /** | |
1351 | Called by owning model. | |
63e55c0a VS |
1352 | |
1353 | @return Always return @true from this function in derived classes. | |
23324ae1 | 1354 | */ |
b91c4601 | 1355 | virtual bool ValueChanged(const wxDataViewItem& item, unsigned int col) = 0; |
23324ae1 FM |
1356 | }; |
1357 | ||
1358 | ||
c4e57202 FM |
1359 | /** |
1360 | The mode of a data-view cell; see wxDataViewRenderer for more info. | |
1361 | */ | |
1362 | enum wxDataViewCellMode | |
1363 | { | |
dc73d7f5 VS |
1364 | /** |
1365 | The cell only displays information and cannot be manipulated or | |
1366 | otherwise interacted with in any way. | |
1367 | ||
1368 | Note that this doesn't mean that the row being drawn can't be selected, | |
1369 | just that a particular element of it cannot be individually modified. | |
1370 | */ | |
c4e57202 FM |
1371 | wxDATAVIEW_CELL_INERT, |
1372 | ||
1373 | /** | |
dc73d7f5 VS |
1374 | Indicates that the cell can be @em activated by clicking it or using |
1375 | keyboard. | |
1376 | ||
1377 | Activating a cell is an alternative to showing inline editor when the | |
1378 | value can be edited in a simple way that doesn't warrant full editor | |
1379 | control. The most typical use of cell activation is toggling the | |
1380 | checkbox in wxDataViewToggleRenderer; others would be e.g. an embedded | |
1381 | volume slider or a five-star rating column. | |
1382 | ||
1383 | The exact means of activating a cell are platform-dependent, but they | |
1384 | are usually similar to those used for inline editing of values. | |
1385 | Typically, a cell would be activated by Space or Enter keys or by left | |
1386 | mouse click. | |
1387 | ||
1388 | @note Do not confuse this with item activation in wxDataViewCtrl | |
1389 | and the wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event. That one is | |
1390 | used for activating the item (or, to put it differently, the | |
1391 | entire row) similarly to analogous messages in wxTreeCtrl and | |
1392 | wxListCtrl, and the effect differs (play a song, open a file | |
1393 | etc.). Cell activation, on the other hand, is all about | |
1394 | interacting with the individual cell. | |
1395 | ||
1396 | @see wxDataViewCustomRenderer::ActivateCell() | |
c4e57202 FM |
1397 | */ |
1398 | wxDATAVIEW_CELL_ACTIVATABLE, | |
1399 | ||
1400 | /** | |
dc73d7f5 VS |
1401 | Indicates that the user can edit the data in-place in an inline editor |
1402 | control that will show up when the user wants to edit the cell. | |
1403 | ||
1404 | A typical example of this behaviour is changing the filename in a file | |
1405 | managers. | |
1406 | ||
1407 | Editing is typically triggered by slowly double-clicking the cell or by | |
1408 | a platform-dependent keyboard shortcut (F2 is typical on Windows, Space | |
1409 | and/or Enter is common elsewhere and supported on Windows too). | |
1410 | ||
1411 | @see wxDataViewCustomRenderer::CreateEditorCtrl() | |
c4e57202 FM |
1412 | */ |
1413 | wxDATAVIEW_CELL_EDITABLE | |
1414 | }; | |
1415 | ||
1416 | /** | |
1417 | The values of this enum controls how a wxDataViewRenderer should display | |
1418 | its contents in a cell. | |
1419 | */ | |
1420 | enum wxDataViewCellRenderState | |
1421 | { | |
1422 | wxDATAVIEW_CELL_SELECTED = 1, | |
1423 | wxDATAVIEW_CELL_PRELIT = 2, | |
1424 | wxDATAVIEW_CELL_INSENSITIVE = 4, | |
1425 | wxDATAVIEW_CELL_FOCUSED = 8 | |
1426 | }; | |
e54c96f1 | 1427 | |
23324ae1 FM |
1428 | /** |
1429 | @class wxDataViewRenderer | |
7c913512 | 1430 | |
5b99d5d8 | 1431 | This class is used by wxDataViewCtrl to render the individual cells. |
c4e57202 FM |
1432 | One instance of a renderer class is owned by a wxDataViewColumn. |
1433 | There is a number of ready-to-use renderers provided: | |
1434 | - wxDataViewTextRenderer, | |
c4e57202 FM |
1435 | - wxDataViewIconTextRenderer, |
1436 | - wxDataViewToggleRenderer, | |
1437 | - wxDataViewProgressRenderer, | |
1438 | - wxDataViewBitmapRenderer, | |
1439 | - wxDataViewDateRenderer, | |
1440 | - wxDataViewSpinRenderer. | |
f4fcd648 | 1441 | - wxDataViewChoiceRenderer. |
7c913512 | 1442 | |
23324ae1 FM |
1443 | Additionally, the user can write own renderers by deriving from |
1444 | wxDataViewCustomRenderer. | |
7c913512 | 1445 | |
c4e57202 FM |
1446 | The ::wxDataViewCellMode and ::wxDataViewCellRenderState flags accepted |
1447 | by the constructors respectively controls what actions the cell data allows | |
1448 | and how the renderer should display its contents in a cell. | |
7c913512 | 1449 | |
23324ae1 | 1450 | @library{wxadv} |
b321b61c | 1451 | @category{dvc} |
23324ae1 FM |
1452 | */ |
1453 | class wxDataViewRenderer : public wxObject | |
1454 | { | |
1455 | public: | |
1456 | /** | |
b91c4601 | 1457 | Constructor. |
23324ae1 FM |
1458 | */ |
1459 | wxDataViewRenderer(const wxString& varianttype, | |
1460 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
f2b7492a | 1461 | int align = wxDVR_DEFAULT_ALIGNMENT ); |
23324ae1 | 1462 | |
c937bcac VZ |
1463 | /** |
1464 | Enable or disable replacing parts of the item text with ellipsis to | |
1465 | make it fit the column width. | |
1466 | ||
1467 | This method only makes sense for the renderers working with text, such | |
1468 | as wxDataViewTextRenderer or wxDataViewIconTextRenderer. | |
1469 | ||
1470 | By default wxELLIPSIZE_MIDDLE is used. | |
1471 | ||
1472 | @param mode | |
1473 | Ellipsization mode, use wxELLIPSIZE_NONE to disable. | |
1474 | ||
1475 | @since 2.9.1 | |
1476 | */ | |
1477 | void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE); | |
1478 | ||
1479 | /** | |
1480 | Disable replacing parts of the item text with ellipsis. | |
1481 | ||
1482 | If ellipsizing is disabled, the string will be truncated if it doesn't | |
1483 | fit. | |
1484 | ||
1485 | This is the same as @code EnableEllipsize(wxELLIPSIZE_NONE) @endcode. | |
1486 | ||
1487 | @since 2.9.1 | |
1488 | */ | |
1489 | void DisableEllipsize(); | |
1490 | ||
20c36737 | 1491 | /** |
f2b7492a | 1492 | Returns the alignment. See SetAlignment() |
20c36737 RR |
1493 | */ |
1494 | virtual int GetAlignment() const; | |
1495 | ||
c937bcac VZ |
1496 | /** |
1497 | Returns the ellipsize mode used by the renderer. | |
1498 | ||
1499 | If the return value is wxELLIPSIZE_NONE, the text is simply truncated | |
1500 | if it doesn't fit. | |
1501 | ||
1502 | @see EnableEllipsize() | |
1503 | */ | |
1504 | wxEllipsizeMode GetEllipsizeMode() const; | |
1505 | ||
23324ae1 FM |
1506 | /** |
1507 | Returns the cell mode. | |
1508 | */ | |
adaaa686 | 1509 | virtual wxDataViewCellMode GetMode() const; |
23324ae1 FM |
1510 | |
1511 | /** | |
1512 | Returns pointer to the owning wxDataViewColumn. | |
1513 | */ | |
adaaa686 | 1514 | wxDataViewColumn* GetOwner() const; |
23324ae1 FM |
1515 | |
1516 | /** | |
1517 | This methods retrieves the value from the renderer in order to | |
c4e57202 FM |
1518 | transfer the value back to the data model. |
1519 | ||
1520 | Returns @false on failure. | |
23324ae1 | 1521 | */ |
b91c4601 | 1522 | virtual bool GetValue(wxVariant& value) const = 0; |
23324ae1 FM |
1523 | |
1524 | /** | |
c4e57202 | 1525 | Returns a string with the type of the wxVariant supported by this renderer. |
23324ae1 | 1526 | */ |
adaaa686 | 1527 | wxString GetVariantType() const; |
23324ae1 | 1528 | |
20c36737 | 1529 | /** |
c4e57202 FM |
1530 | Sets the alignment of the renderer's content. |
1531 | The default value of @c wxDVR_DEFAULT_ALIGMENT indicates that the content | |
1532 | should have the same alignment as the column header. | |
1533 | ||
1534 | The method is not implemented under OS X and the renderer always aligns | |
1535 | its contents as the column header on that platform. The other platforms | |
f2b7492a | 1536 | support both vertical and horizontal alignment. |
20c36737 RR |
1537 | */ |
1538 | virtual void SetAlignment( int align ); | |
23324ae1 | 1539 | /** |
c4e57202 FM |
1540 | Sets the owning wxDataViewColumn. |
1541 | This is usually called from within wxDataViewColumn. | |
23324ae1 | 1542 | */ |
adaaa686 | 1543 | void SetOwner(wxDataViewColumn* owner); |
23324ae1 FM |
1544 | |
1545 | /** | |
c4e57202 | 1546 | Set the value of the renderer (and thus its cell) to @a value. |
23324ae1 FM |
1547 | The internal code will then render this cell with this data. |
1548 | */ | |
b91c4601 | 1549 | virtual bool SetValue(const wxVariant& value) = 0; |
23324ae1 FM |
1550 | |
1551 | /** | |
1552 | Before data is committed to the data model, it is passed to this | |
1553 | method where it can be checked for validity. This can also be | |
1554 | used for checking a valid range or limiting the user input in | |
1555 | a certain aspect (e.g. max number of characters or only alphanumeric | |
c4e57202 FM |
1556 | input, ASCII only etc.). Return @false if the value is not valid. |
1557 | ||
23324ae1 FM |
1558 | Please note that due to implementation limitations, this validation |
1559 | is done after the editing control already is destroyed and the | |
1560 | editing process finished. | |
1561 | */ | |
1562 | virtual bool Validate(wxVariant& value); | |
1563 | }; | |
1564 | ||
1565 | ||
e54c96f1 | 1566 | |
23324ae1 FM |
1567 | /** |
1568 | @class wxDataViewTextRenderer | |
7c913512 | 1569 | |
c4e57202 FM |
1570 | wxDataViewTextRenderer is used for rendering text. |
1571 | It supports in-place editing if desired. | |
7c913512 | 1572 | |
23324ae1 | 1573 | @library{wxadv} |
b321b61c | 1574 | @category{dvc} |
23324ae1 FM |
1575 | */ |
1576 | class wxDataViewTextRenderer : public wxDataViewRenderer | |
1577 | { | |
1578 | public: | |
1579 | /** | |
c4e57202 | 1580 | The ctor. |
23324ae1 FM |
1581 | */ |
1582 | wxDataViewTextRenderer(const wxString& varianttype = "string", | |
05303ccd RR |
1583 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, |
1584 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
23324ae1 FM |
1585 | }; |
1586 | ||
1587 | ||
e54c96f1 | 1588 | |
f2b7492a RR |
1589 | /** |
1590 | @class wxDataViewIconTextRenderer | |
f2b7492a RR |
1591 | |
1592 | The wxDataViewIconTextRenderer class is used to display text with | |
1593 | a small icon next to it as it is typically done in a file manager. | |
c4e57202 FM |
1594 | |
1595 | This classes uses the wxDataViewIconText helper class to store its data. | |
4d68a949 BP |
1596 | wxDataViewIconText can be converted to and from a wxVariant using the left |
1597 | shift operator. | |
f2b7492a RR |
1598 | |
1599 | @library{wxadv} | |
b321b61c | 1600 | @category{dvc} |
f2b7492a RR |
1601 | */ |
1602 | class wxDataViewIconTextRenderer : public wxDataViewRenderer | |
1603 | { | |
1604 | public: | |
1605 | /** | |
c4e57202 | 1606 | The ctor. |
f2b7492a RR |
1607 | */ |
1608 | wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText", | |
1609 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
1610 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
1611 | }; | |
1612 | ||
1613 | ||
1614 | ||
23324ae1 FM |
1615 | /** |
1616 | @class wxDataViewProgressRenderer | |
7c913512 | 1617 | |
c4e57202 | 1618 | This class is used by wxDataViewCtrl to render progress bars. |
7c913512 | 1619 | |
23324ae1 | 1620 | @library{wxadv} |
b321b61c | 1621 | @category{dvc} |
23324ae1 FM |
1622 | */ |
1623 | class wxDataViewProgressRenderer : public wxDataViewRenderer | |
1624 | { | |
1625 | public: | |
1626 | /** | |
c4e57202 | 1627 | The ctor. |
23324ae1 FM |
1628 | */ |
1629 | wxDataViewProgressRenderer(const wxString& label = wxEmptyString, | |
1630 | const wxString& varianttype = "long", | |
05303ccd RR |
1631 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, |
1632 | int align = wxDVR_DEFAULT_ALIGNMENT ); | |
23324ae1 FM |
1633 | }; |
1634 | ||
1635 | ||
e54c96f1 | 1636 | |
23324ae1 FM |
1637 | /** |
1638 | @class wxDataViewSpinRenderer | |
7c913512 | 1639 | |
c4e57202 FM |
1640 | This is a specialized renderer for rendering integer values. |
1641 | It supports modifying the values in-place by using a wxSpinCtrl. | |
23324ae1 | 1642 | The renderer only support variants of type @e long. |
7c913512 | 1643 | |
8ed522d9 | 1644 | @library{wxadv} |
b321b61c | 1645 | @category{dvc} |
23324ae1 FM |
1646 | */ |
1647 | class wxDataViewSpinRenderer : public wxDataViewCustomRenderer | |
1648 | { | |
1649 | public: | |
1650 | /** | |
c4e57202 FM |
1651 | Constructor. |
1652 | @a min and @a max indicate the minimum and maximum values for the wxSpinCtrl. | |
23324ae1 FM |
1653 | */ |
1654 | wxDataViewSpinRenderer(int min, int max, | |
1655 | wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, | |
05303ccd | 1656 | int align = wxDVR_DEFAULT_ALIGNMENT); |
23324ae1 FM |
1657 | }; |
1658 | ||
1659 | ||
e54c96f1 | 1660 | |
23324ae1 FM |
1661 | /** |
1662 | @class wxDataViewToggleRenderer | |
7c913512 | 1663 | |
c4e57202 | 1664 | This class is used by wxDataViewCtrl to render toggle controls. |
7c913512 | 1665 | |
23324ae1 | 1666 | @library{wxadv} |
b321b61c | 1667 | @category{dvc} |
23324ae1 FM |
1668 | */ |
1669 | class wxDataViewToggleRenderer : public wxDataViewRenderer | |
1670 | { | |
1671 | public: | |
1672 | /** | |
c4e57202 | 1673 | The ctor. |
23324ae1 FM |
1674 | */ |
1675 | wxDataViewToggleRenderer(const wxString& varianttype = "bool", | |
50ec54b6 FM |
1676 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, |
1677 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
23324ae1 FM |
1678 | }; |
1679 | ||
1680 | ||
f4fcd648 RR |
1681 | /** |
1682 | @class wxDataViewChoiceRenderer | |
1683 | ||
1684 | This class is used by wxDataViewCtrl to render choice controls. | |
1685 | It stores a string so that SetValue() and GetValue() operate | |
1686 | on a variant holding a string. | |
1687 | ||
1688 | @library{wxadv} | |
1689 | @category{dvc} | |
1690 | */ | |
1691 | ||
1692 | class wxDataViewChoiceRenderer: public wxDataViewRenderer | |
1693 | { | |
1694 | public: | |
1695 | /** | |
1696 | The ctor. | |
1697 | */ | |
1698 | wxDataViewChoiceRenderer( const wxArrayString &choices, | |
1699 | wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, | |
1700 | int alignment = wxDVR_DEFAULT_ALIGNMENT ); | |
1701 | ||
1702 | /** | |
1703 | Returns the choice referred to by index. | |
1704 | */ | |
1705 | wxString GetChoice(size_t index) const; | |
1706 | ||
1707 | /** | |
1708 | Returns all choices. | |
1709 | */ | |
1710 | const wxArrayString& GetChoices() const; | |
1711 | }; | |
1712 | ||
e54c96f1 | 1713 | |
23324ae1 | 1714 | /** |
5b99d5d8 | 1715 | @class wxDataViewDateRenderer |
7c913512 | 1716 | |
c4e57202 | 1717 | This class is used by wxDataViewCtrl to render calendar controls. |
7c913512 | 1718 | |
5b99d5d8 | 1719 | @library{wxadv} |
b321b61c | 1720 | @category{dvc} |
23324ae1 | 1721 | */ |
5b99d5d8 | 1722 | class wxDataViewDateRenderer : public wxDataViewRenderer |
23324ae1 FM |
1723 | { |
1724 | public: | |
23324ae1 | 1725 | /** |
c4e57202 | 1726 | The ctor. |
23324ae1 | 1727 | */ |
5b99d5d8 | 1728 | wxDataViewDateRenderer(const wxString& varianttype = "datetime", |
50ec54b6 FM |
1729 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, |
1730 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
5b99d5d8 | 1731 | }; |
23324ae1 | 1732 | |
3c4f71cc | 1733 | |
23324ae1 | 1734 | |
5b99d5d8 RR |
1735 | /** |
1736 | @class wxDataViewCustomRenderer | |
23324ae1 | 1737 | |
5b99d5d8 | 1738 | You need to derive a new class from wxDataViewCustomRenderer in |
c4e57202 FM |
1739 | order to write a new renderer. |
1740 | ||
1741 | You need to override at least wxDataViewRenderer::SetValue, wxDataViewRenderer::GetValue, | |
1742 | wxDataViewCustomRenderer::GetSize and wxDataViewCustomRenderer::Render. | |
1743 | ||
1744 | If you want your renderer to support in-place editing then you also need to override | |
1745 | wxDataViewCustomRenderer::HasEditorCtrl, wxDataViewCustomRenderer::CreateEditorCtrl | |
5b99d5d8 | 1746 | and wxDataViewCustomRenderer::GetValueFromEditorCtrl. |
c4e57202 FM |
1747 | |
1748 | Note that a special event handler will be pushed onto that editor control | |
1749 | which handles @e \<ENTER\> and focus out events in order to end the editing. | |
23324ae1 | 1750 | |
5b99d5d8 | 1751 | @library{wxadv} |
b321b61c | 1752 | @category{dvc} |
5b99d5d8 RR |
1753 | */ |
1754 | class wxDataViewCustomRenderer : public wxDataViewRenderer | |
1755 | { | |
1756 | public: | |
23324ae1 | 1757 | /** |
5b99d5d8 | 1758 | Constructor. |
23324ae1 | 1759 | */ |
5b99d5d8 RR |
1760 | wxDataViewCustomRenderer(const wxString& varianttype = "string", |
1761 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
b91c4601 | 1762 | int align = -1, bool no_init = false); |
23324ae1 FM |
1763 | |
1764 | /** | |
5b99d5d8 | 1765 | Destructor. |
23324ae1 | 1766 | */ |
adaaa686 | 1767 | virtual ~wxDataViewCustomRenderer(); |
23324ae1 | 1768 | |
23324ae1 | 1769 | /** |
dc73d7f5 VS |
1770 | Override this to react to cell @em activation. Activating a cell is an |
1771 | alternative to showing inline editor when the value can be edited in a | |
1772 | simple way that doesn't warrant full editor control. The most typical | |
1773 | use of cell activation is toggling the checkbox in | |
1774 | wxDataViewToggleRenderer; others would be e.g. an embedded volume | |
1775 | slider or a five-star rating column. | |
1776 | ||
1777 | The exact means of activating a cell are platform-dependent, but they | |
1778 | are usually similar to those used for inline editing of values. | |
1779 | Typically, a cell would be activated by Space or Enter keys or by left | |
1780 | mouse click. | |
1781 | ||
1782 | This method will only be called if the cell has the | |
1783 | wxDATAVIEW_CELL_ACTIVATABLE mode. | |
1784 | ||
1785 | @param cell | |
1786 | Coordinates of the activated cell's area. | |
1787 | @param model | |
1788 | The model to manipulate in response. | |
1789 | @param item | |
1790 | Activated item. | |
1791 | @param col | |
1792 | Activated column of @a item. | |
1793 | @param mouseEvent | |
1794 | If the activation was triggered by mouse click, contains the | |
1795 | corresponding event. Is @NULL otherwise (for keyboard activation). | |
1796 | Mouse coordinates are adjusted to be relative to the cell. | |
1797 | ||
1798 | @since 2.9.3 | |
1799 | ||
1800 | @note Do not confuse this method with item activation in wxDataViewCtrl | |
1801 | and the wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event. That one is | |
1802 | used for activating the item (or, to put it differently, the | |
1803 | entire row) similarly to analogous messages in wxTreeCtrl and | |
1804 | wxListCtrl, and the effect differs (play a song, open a file | |
1805 | etc.). Cell activation, on the other hand, is all about | |
1806 | interacting with the individual cell. | |
1807 | ||
1808 | @see CreateEditorCtrl() | |
23324ae1 | 1809 | */ |
dc73d7f5 VS |
1810 | virtual bool ActivateCell(const wxRect& cell, |
1811 | wxDataViewModel* model, | |
1812 | const wxDataViewItem & item, | |
1813 | unsigned int col, | |
1814 | const wxMouseEvent *mouseEvent); | |
23324ae1 FM |
1815 | |
1816 | /** | |
5b99d5d8 | 1817 | Override this to create the actual editor control once editing |
c4e57202 FM |
1818 | is about to start. |
1819 | ||
dc73d7f5 VS |
1820 | This method will only be called if the cell has the |
1821 | wxDATAVIEW_CELL_EDITABLE mode. Editing is typically triggered by slowly | |
1822 | double-clicking the cell or by a platform-dependent keyboard shortcut | |
1823 | (F2 is typical on Windows, Space and/or Enter is common elsewhere and | |
1824 | supported on Windows too). | |
1825 | ||
1826 | @param parent | |
1827 | The parent of the editor control. | |
1828 | @param labelRect | |
1829 | Indicates the position and size of the editor control. The control | |
1830 | should be created in place of the cell and @a labelRect should be | |
1831 | respected as much as possible. | |
1832 | @param value | |
1833 | Initial value of the editor. | |
1834 | ||
1835 | An example: | |
c4e57202 FM |
1836 | @code |
1837 | { | |
1838 | long l = value; | |
1839 | return new wxSpinCtrl( parent, wxID_ANY, wxEmptyString, | |
1840 | labelRect.GetTopLeft(), labelRect.GetSize(), 0, 0, 100, l ); | |
1841 | } | |
1842 | @endcode | |
dc73d7f5 VS |
1843 | |
1844 | @see ActivateCell() | |
23324ae1 | 1845 | */ |
64c70359 VS |
1846 | virtual wxWindow* CreateEditorCtrl(wxWindow* parent, |
1847 | wxRect labelRect, | |
1848 | const wxVariant& value); | |
23324ae1 FM |
1849 | |
1850 | /** | |
62265c2c VZ |
1851 | Return the attribute to be used for rendering. |
1852 | ||
1853 | This function may be called from Render() implementation to use the | |
1854 | attributes defined for the item if the renderer supports them. | |
1855 | ||
1856 | Notice that when Render() is called, the wxDC object passed to it is | |
1857 | already set up to use the correct attributes (e.g. its font is set to | |
1858 | bold or italic version if wxDataViewItemAttr::GetBold() or GetItalic() | |
1859 | returns true) so it may not be necessary to call it explicitly if you | |
1860 | only want to render text using the items attributes. | |
1861 | ||
1862 | @since 2.9.1 | |
1863 | */ | |
1864 | const wxDataViewItemAttr& GetAttr() const; | |
23324ae1 FM |
1865 | |
1866 | /** | |
5b99d5d8 | 1867 | Return size required to show content. |
23324ae1 | 1868 | */ |
b91c4601 | 1869 | virtual wxSize GetSize() const = 0; |
23324ae1 FM |
1870 | |
1871 | /** | |
80093617 | 1872 | Override this so that the renderer can get the value from the editor |
c4e57202 FM |
1873 | control (pointed to by @a editor): |
1874 | @code | |
1875 | { | |
1876 | wxSpinCtrl *sc = (wxSpinCtrl*) editor; | |
1877 | long l = sc->GetValue(); | |
1878 | value = l; | |
1879 | return true; | |
1880 | } | |
1881 | @endcode | |
23324ae1 | 1882 | */ |
64c70359 | 1883 | virtual bool GetValueFromEditorCtrl(wxWindow* editor, |
5b99d5d8 | 1884 | wxVariant& value); |
23324ae1 FM |
1885 | |
1886 | /** | |
c4e57202 | 1887 | Override this and make it return @true in order to |
5b99d5d8 | 1888 | indicate that this renderer supports in-place editing. |
23324ae1 | 1889 | */ |
220bfe15 | 1890 | virtual bool HasEditorCtrl() const; |
23324ae1 FM |
1891 | |
1892 | /** | |
80093617 | 1893 | Override this to react to a left click. |
c4e57202 | 1894 | This method will only be called in @c wxDATAVIEW_CELL_ACTIVATABLE mode. |
23324ae1 | 1895 | */ |
548fa9c1 VS |
1896 | virtual bool LeftClick( const wxPoint& cursor, |
1897 | const wxRect& cell, | |
5b99d5d8 RR |
1898 | wxDataViewModel * model, |
1899 | const wxDataViewItem & item, | |
1900 | unsigned int col ); | |
23324ae1 FM |
1901 | |
1902 | /** | |
c4e57202 FM |
1903 | Override this to render the cell. |
1904 | Before this is called, wxDataViewRenderer::SetValue was called | |
5b99d5d8 | 1905 | so that this instance knows what to render. |
23324ae1 | 1906 | */ |
b91c4601 | 1907 | virtual bool Render(wxRect cell, wxDC* dc, int state) = 0; |
23324ae1 FM |
1908 | |
1909 | /** | |
c4e57202 FM |
1910 | This method should be called from within Render() whenever you need to |
1911 | render simple text. | |
1912 | This will ensure that the correct colour, font and vertical alignment will | |
1913 | be chosen so the text will look the same as text drawn by native renderers. | |
23324ae1 | 1914 | */ |
50ec54b6 | 1915 | void RenderText(const wxString& text, int xoffset, wxRect cell, |
5b99d5d8 | 1916 | wxDC* dc, int state); |
23324ae1 FM |
1917 | |
1918 | /** | |
80093617 | 1919 | Override this to start a drag operation. Not yet supported. |
23324ae1 | 1920 | */ |
548fa9c1 VS |
1921 | virtual bool StartDrag(const wxPoint& cursor, |
1922 | const wxRect& cell, | |
5b99d5d8 RR |
1923 | wxDataViewModel* model, |
1924 | const wxDataViewItem & item, | |
1925 | unsigned int col); | |
23324ae1 FM |
1926 | }; |
1927 | ||
1928 | ||
e54c96f1 | 1929 | |
23324ae1 | 1930 | /** |
5b99d5d8 | 1931 | @class wxDataViewBitmapRenderer |
7c913512 | 1932 | |
c4e57202 | 1933 | This class is used by wxDataViewCtrl to render bitmap controls. |
7c913512 | 1934 | |
23324ae1 | 1935 | @library{wxadv} |
b321b61c | 1936 | @category{dvc} |
23324ae1 | 1937 | */ |
5b99d5d8 | 1938 | class wxDataViewBitmapRenderer : public wxDataViewRenderer |
23324ae1 FM |
1939 | { |
1940 | public: | |
1941 | /** | |
c4e57202 | 1942 | The ctor. |
23324ae1 | 1943 | */ |
5b99d5d8 RR |
1944 | wxDataViewBitmapRenderer(const wxString& varianttype = "wxBitmap", |
1945 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
14d922d1 | 1946 | int align = wxDVR_DEFAULT_ALIGNMENT); |
5b99d5d8 RR |
1947 | }; |
1948 | ||
23324ae1 | 1949 | |
c4e57202 FM |
1950 | /** |
1951 | The flags used by wxDataViewColumn. | |
02b51ae5 | 1952 | Can be combined together. |
c4e57202 FM |
1953 | */ |
1954 | enum wxDataViewColumnFlags | |
1955 | { | |
1956 | wxDATAVIEW_COL_RESIZABLE = 1, | |
1957 | wxDATAVIEW_COL_SORTABLE = 2, | |
1958 | wxDATAVIEW_COL_REORDERABLE = 4, | |
1959 | wxDATAVIEW_COL_HIDDEN = 8 | |
1960 | }; | |
23324ae1 | 1961 | |
5b99d5d8 RR |
1962 | /** |
1963 | @class wxDataViewColumn | |
5b99d5d8 RR |
1964 | |
1965 | This class represents a column in a wxDataViewCtrl. | |
739a8399 | 1966 | One wxDataViewColumn is bound to one column in the data model to which the |
c4e57202 | 1967 | wxDataViewCtrl has been associated. |
5b99d5d8 | 1968 | |
c4e57202 | 1969 | An instance of wxDataViewRenderer is used by this class to render its data. |
5b99d5d8 RR |
1970 | |
1971 | @library{wxadv} | |
b321b61c | 1972 | @category{dvc} |
5b99d5d8 | 1973 | */ |
c9c59db7 | 1974 | class wxDataViewColumn : public wxSettableHeaderColumn |
5b99d5d8 RR |
1975 | { |
1976 | public: | |
23324ae1 | 1977 | /** |
02b51ae5 FM |
1978 | Constructs a text column. |
1979 | ||
1980 | @param title | |
1981 | The title of the column. | |
1982 | @param renderer | |
1983 | The class which will render the contents of this column. | |
1984 | @param model_column | |
1985 | The index of the model's column which is associated with this object. | |
1986 | @param width | |
1987 | The width of the column. | |
1988 | The @c wxDVC_DEFAULT_WIDTH value is the fixed default value. | |
1989 | @param align | |
1990 | The alignment of the column title. | |
1991 | @param flags | |
1992 | One or more flags of the ::wxDataViewColumnFlags enumeration. | |
23324ae1 | 1993 | */ |
5b99d5d8 RR |
1994 | wxDataViewColumn(const wxString& title, |
1995 | wxDataViewRenderer* renderer, | |
1996 | unsigned int model_column, | |
1997 | int width = wxDVC_DEFAULT_WIDTH, | |
882678eb | 1998 | wxAlignment align = wxALIGN_CENTER, |
5b99d5d8 | 1999 | int flags = wxDATAVIEW_COL_RESIZABLE); |
02b51ae5 FM |
2000 | |
2001 | /** | |
2002 | Constructs a bitmap column. | |
2003 | ||
2004 | @param bitmap | |
2005 | The bitmap of the column. | |
2006 | @param renderer | |
2007 | The class which will render the contents of this column. | |
2008 | @param model_column | |
2009 | The index of the model's column which is associated with this object. | |
2010 | @param width | |
2011 | The width of the column. | |
2012 | The @c wxDVC_DEFAULT_WIDTH value is the fixed default value. | |
2013 | @param align | |
2014 | The alignment of the column title. | |
2015 | @param flags | |
2016 | One or more flags of the ::wxDataViewColumnFlags enumeration. | |
2017 | */ | |
5b99d5d8 RR |
2018 | wxDataViewColumn(const wxBitmap& bitmap, |
2019 | wxDataViewRenderer* renderer, | |
2020 | unsigned int model_column, | |
2021 | int width = wxDVC_DEFAULT_WIDTH, | |
882678eb | 2022 | wxAlignment align = wxALIGN_CENTER, |
5b99d5d8 | 2023 | int flags = wxDATAVIEW_COL_RESIZABLE); |
23324ae1 | 2024 | |
23324ae1 | 2025 | /** |
5b99d5d8 RR |
2026 | Returns the index of the column of the model, which this |
2027 | wxDataViewColumn is displaying. | |
23324ae1 | 2028 | */ |
adaaa686 | 2029 | unsigned int GetModelColumn() const; |
23324ae1 FM |
2030 | |
2031 | /** | |
5b99d5d8 | 2032 | Returns the owning wxDataViewCtrl. |
23324ae1 | 2033 | */ |
e51bf699 | 2034 | wxDataViewCtrl* GetOwner() const; |
23324ae1 FM |
2035 | |
2036 | /** | |
5b99d5d8 | 2037 | Returns the renderer of this wxDataViewColumn. |
c4e57202 FM |
2038 | |
2039 | @see wxDataViewRenderer. | |
23324ae1 | 2040 | */ |
adaaa686 | 2041 | wxDataViewRenderer* GetRenderer() const; |
23324ae1 FM |
2042 | }; |
2043 | ||
2044 | ||
e54c96f1 | 2045 | |
832df171 RR |
2046 | /** |
2047 | @class wxDataViewListCtrl | |
2048 | ||
2049 | This class is a wxDataViewCtrl which internally uses a wxDataViewListStore | |
2050 | and forwards most of its API to that class. | |
2051 | ||
2052 | The purpose of this class is to offer a simple way to display and | |
2053 | edit a small table of data without having to write your own wxDataViewModel. | |
2054 | ||
23efa4bf | 2055 | @code |
14f73cf1 | 2056 | wxDataViewListCtrl *listctrl = new wxDataViewListCtrl( parent, wxID_ANY ); |
02b51ae5 | 2057 | |
95b20f41 RR |
2058 | listctrl->AppendToggleColumn( "Toggle" ); |
2059 | listctrl->AppendTextColumn( "Text" ); | |
02b51ae5 | 2060 | |
23efa4bf | 2061 | wxVector<wxVariant> data; |
14f73cf1 FM |
2062 | data.push_back( wxVariant(true) ); |
2063 | data.push_back( wxVariant("row 1") ); | |
23efa4bf | 2064 | listctrl->AppendItem( data ); |
02b51ae5 | 2065 | |
23efa4bf | 2066 | data.clear(); |
14f73cf1 FM |
2067 | data.push_back( wxVariant(false) ); |
2068 | data.push_back( wxVariant("row 3") ); | |
23efa4bf RR |
2069 | listctrl->AppendItem( data ); |
2070 | @endcode | |
43c64cc6 | 2071 | |
14f73cf1 FM |
2072 | @beginStyleTable |
2073 | See wxDataViewCtrl for the list of supported styles. | |
2074 | @endStyleTable | |
43c64cc6 | 2075 | |
14f73cf1 FM |
2076 | @beginEventEmissionTable |
2077 | See wxDataViewCtrl for the list of events emitted by this class. | |
2078 | @endEventTable | |
23efa4bf | 2079 | |
832df171 RR |
2080 | @library{wxadv} |
2081 | @category{ctrl,dvc} | |
2082 | */ | |
832df171 RR |
2083 | class wxDataViewListCtrl: public wxDataViewCtrl |
2084 | { | |
b75b04d4 | 2085 | public: |
832df171 RR |
2086 | /** |
2087 | Default ctor. | |
2088 | */ | |
2089 | wxDataViewListCtrl(); | |
02b51ae5 | 2090 | |
832df171 RR |
2091 | /** |
2092 | Constructor. Calls Create(). | |
2093 | */ | |
2094 | wxDataViewListCtrl( wxWindow *parent, wxWindowID id, | |
2095 | const wxPoint& pos = wxDefaultPosition, | |
2096 | const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES, | |
2097 | const wxValidator& validator = wxDefaultValidator ); | |
02b51ae5 | 2098 | |
832df171 RR |
2099 | /** |
2100 | Destructor. Deletes the image list if any. | |
2101 | */ | |
2102 | ~wxDataViewListCtrl(); | |
2103 | ||
2104 | /** | |
2105 | Creates the control and a wxDataViewListStore as its internal model. | |
2106 | */ | |
2107 | bool Create( wxWindow *parent, wxWindowID id, | |
2108 | const wxPoint& pos = wxDefaultPosition, | |
2109 | const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES, | |
2110 | const wxValidator& validator = wxDefaultValidator ); | |
2111 | ||
2112 | //@{ | |
2113 | /** | |
2114 | Returns the store. | |
2115 | */ | |
2116 | wxDataViewListStore *GetStore(); | |
2117 | const wxDataViewListStore *GetStore() const; | |
2118 | //@} | |
2119 | ||
17de95e4 VS |
2120 | /** |
2121 | Returns the position of given @e item or wxNOT_FOUND if it's | |
2122 | not a valid item. | |
2123 | ||
2124 | @since 2.9.2 | |
2125 | */ | |
2126 | int ItemToRow(const wxDataViewItem &item) const; | |
2127 | ||
2128 | /** | |
2129 | Returns the wxDataViewItem at the given @e row. | |
2130 | ||
2131 | @since 2.9.2 | |
2132 | */ | |
2133 | wxDataViewItem RowToItem(int row) const; | |
2134 | ||
fa629ada VS |
2135 | //@{ |
2136 | /** | |
2137 | @name Selection handling functions | |
2138 | */ | |
2139 | ||
2140 | /** | |
2141 | Returns index of the selected row or wxNOT_FOUND. | |
2142 | ||
2143 | @see wxDataViewCtrl::GetSelection() | |
2144 | ||
2145 | @since 2.9.2 | |
2146 | */ | |
2147 | int GetSelectedRow() const; | |
2148 | ||
2149 | /** | |
2150 | Selects given row. | |
2151 | ||
2152 | @see wxDataViewCtrl::Select() | |
2153 | ||
2154 | @since 2.9.2 | |
2155 | */ | |
2156 | void SelectRow(unsigned row); | |
2157 | ||
2158 | /** | |
2159 | Unselects given row. | |
2160 | ||
2161 | @see wxDataViewCtrl::Unselect() | |
2162 | ||
2163 | @since 2.9.2 | |
2164 | */ | |
2165 | void UnselectRow(unsigned row); | |
2166 | ||
2167 | /** | |
2168 | Returns true if @a row is selected. | |
2169 | ||
2170 | @see wxDataViewCtrl::IsSelected() | |
2171 | ||
2172 | @since 2.9.2 | |
2173 | */ | |
2174 | bool IsRowSelected(unsigned row) const; | |
2175 | ||
2176 | //@} | |
2177 | ||
832df171 | 2178 | /** |
14f73cf1 FM |
2179 | @name Column management functions |
2180 | */ | |
2181 | //@{ | |
43c64cc6 | 2182 | |
14f73cf1 FM |
2183 | /** |
2184 | Appends a column to the control and additionally appends a | |
2185 | column to the store with the type string. | |
2186 | */ | |
2187 | virtual void AppendColumn( wxDataViewColumn *column ); | |
2188 | ||
2189 | /** | |
2190 | Appends a column to the control and additionally appends a | |
2191 | column to the list store with the type @a varianttype. | |
832df171 | 2192 | */ |
95b20f41 | 2193 | void AppendColumn( wxDataViewColumn *column, const wxString &varianttype ); |
02b51ae5 | 2194 | |
832df171 | 2195 | /** |
14f73cf1 | 2196 | Appends a text column to the control and the store. |
43c64cc6 | 2197 | |
14f73cf1 FM |
2198 | See wxDataViewColumn::wxDataViewColumn for more info about |
2199 | the parameters. | |
832df171 | 2200 | */ |
14f73cf1 FM |
2201 | wxDataViewColumn *AppendTextColumn( const wxString &label, |
2202 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
43c64cc6 | 2203 | int width = -1, wxAlignment align = wxALIGN_LEFT, |
14f73cf1 | 2204 | int flags = wxDATAVIEW_COL_RESIZABLE ); |
02b51ae5 | 2205 | |
832df171 | 2206 | /** |
14f73cf1 | 2207 | Appends a toggle column to the control and the store. |
43c64cc6 | 2208 | |
14f73cf1 FM |
2209 | See wxDataViewColumn::wxDataViewColumn for more info about |
2210 | the parameters. | |
832df171 | 2211 | */ |
14f73cf1 FM |
2212 | wxDataViewColumn *AppendToggleColumn( const wxString &label, |
2213 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, | |
43c64cc6 | 2214 | int width = -1, wxAlignment align = wxALIGN_LEFT, |
14f73cf1 | 2215 | int flags = wxDATAVIEW_COL_RESIZABLE ); |
02b51ae5 | 2216 | |
95b20f41 | 2217 | /** |
14f73cf1 | 2218 | Appends a progress column to the control and the store. |
02b51ae5 | 2219 | |
14f73cf1 FM |
2220 | See wxDataViewColumn::wxDataViewColumn for more info about |
2221 | the parameters. | |
95b20f41 | 2222 | */ |
14f73cf1 FM |
2223 | wxDataViewColumn *AppendProgressColumn( const wxString &label, |
2224 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
43c64cc6 | 2225 | int width = -1, wxAlignment align = wxALIGN_LEFT, |
14f73cf1 | 2226 | int flags = wxDATAVIEW_COL_RESIZABLE ); |
02b51ae5 | 2227 | |
95b20f41 | 2228 | /** |
14f73cf1 | 2229 | Appends an icon-and-text column to the control and the store. |
02b51ae5 | 2230 | |
14f73cf1 FM |
2231 | See wxDataViewColumn::wxDataViewColumn for more info about |
2232 | the parameters. | |
95b20f41 | 2233 | */ |
14f73cf1 FM |
2234 | wxDataViewColumn *AppendIconTextColumn( const wxString &label, |
2235 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
43c64cc6 | 2236 | int width = -1, wxAlignment align = wxALIGN_LEFT, |
14f73cf1 | 2237 | int flags = wxDATAVIEW_COL_RESIZABLE ); |
02b51ae5 | 2238 | |
95b20f41 | 2239 | /** |
14f73cf1 | 2240 | Inserts a column to the control and additionally inserts a |
95b20f41 RR |
2241 | column to the store with the type string. |
2242 | */ | |
2243 | virtual void InsertColumn( unsigned int pos, wxDataViewColumn *column ); | |
02b51ae5 | 2244 | |
832df171 | 2245 | /** |
14f73cf1 FM |
2246 | Inserts a column to the control and additionally inserts a |
2247 | column to the list store with the type @a varianttype. | |
832df171 | 2248 | */ |
43c64cc6 | 2249 | void InsertColumn( unsigned int pos, wxDataViewColumn *column, |
14f73cf1 | 2250 | const wxString &varianttype ); |
02b51ae5 | 2251 | |
832df171 | 2252 | /** |
14f73cf1 FM |
2253 | Prepends a column to the control and additionally prepends a |
2254 | column to the store with the type string. | |
832df171 | 2255 | */ |
14f73cf1 | 2256 | virtual void PrependColumn( wxDataViewColumn *column ); |
02b51ae5 | 2257 | |
832df171 | 2258 | /** |
14f73cf1 FM |
2259 | Prepends a column to the control and additionally prepends a |
2260 | column to the list store with the type @a varianttype. | |
832df171 | 2261 | */ |
14f73cf1 | 2262 | void PrependColumn( wxDataViewColumn *column, const wxString &varianttype ); |
02b51ae5 | 2263 | |
14f73cf1 | 2264 | //@} |
43c64cc6 VZ |
2265 | |
2266 | ||
832df171 | 2267 | /** |
14f73cf1 | 2268 | @name Item management functions |
832df171 | 2269 | */ |
14f73cf1 | 2270 | //@{ |
43c64cc6 | 2271 | |
832df171 RR |
2272 | /** |
2273 | Appends an item (=row) to the control and store. | |
2274 | */ | |
2275 | void AppendItem( const wxVector<wxVariant> &values, wxClientData *data = NULL ); | |
2276 | ||
2277 | /** | |
2278 | Prepends an item (=row) to the control and store. | |
2279 | */ | |
2280 | void PrependItem( const wxVector<wxVariant> &values, wxClientData *data = NULL ); | |
2281 | ||
2282 | /** | |
2283 | Inserts an item (=row) to the control and store. | |
2284 | */ | |
14f73cf1 | 2285 | void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxClientData *data = NULL ); |
02b51ae5 | 2286 | |
832df171 RR |
2287 | /** |
2288 | Delete the row at position @a row. | |
2289 | */ | |
2290 | void DeleteItem( unsigned row ); | |
02b51ae5 | 2291 | |
832df171 RR |
2292 | /** |
2293 | Delete all items (= all rows). | |
2294 | */ | |
2295 | void DeleteAllItems(); | |
02b51ae5 | 2296 | |
832df171 RR |
2297 | /** |
2298 | Sets the value in the store and update the control. | |
2299 | */ | |
2300 | void SetValue( const wxVariant &value, unsigned int row, unsigned int col ); | |
02b51ae5 | 2301 | |
832df171 RR |
2302 | /** |
2303 | Returns the value from the store. | |
2304 | */ | |
2305 | void GetValue( wxVariant &value, unsigned int row, unsigned int col ); | |
02b51ae5 | 2306 | |
832df171 | 2307 | /** |
02b51ae5 FM |
2308 | Sets the value in the store and update the control. |
2309 | ||
57ab6f23 | 2310 | This method assumes that the string is stored in respective |
832df171 RR |
2311 | column. |
2312 | */ | |
2313 | void SetTextValue( const wxString &value, unsigned int row, unsigned int col ); | |
02b51ae5 | 2314 | |
832df171 RR |
2315 | /** |
2316 | Returns the value from the store. | |
02b51ae5 | 2317 | |
57ab6f23 | 2318 | This method assumes that the string is stored in respective |
832df171 RR |
2319 | column. |
2320 | */ | |
2321 | wxString GetTextValue( unsigned int row, unsigned int col ) const; | |
02b51ae5 | 2322 | |
832df171 | 2323 | /** |
02b51ae5 FM |
2324 | Sets the value in the store and update the control. |
2325 | ||
57ab6f23 | 2326 | This method assumes that the boolean value is stored in |
832df171 RR |
2327 | respective column. |
2328 | */ | |
2329 | void SetToggleValue( bool value, unsigned int row, unsigned int col ); | |
02b51ae5 | 2330 | |
832df171 RR |
2331 | /** |
2332 | Returns the value from the store. | |
02b51ae5 | 2333 | |
57ab6f23 | 2334 | This method assumes that the boolean value is stored in |
832df171 RR |
2335 | respective column. |
2336 | */ | |
2337 | bool GetToggleValue( unsigned int row, unsigned int col ) const; | |
43c64cc6 | 2338 | |
14f73cf1 | 2339 | //@} |
832df171 RR |
2340 | }; |
2341 | ||
2342 | ||
23324ae1 | 2343 | /** |
5b99d5d8 | 2344 | @class wxDataViewTreeCtrl |
7c913512 | 2345 | |
c4e57202 FM |
2346 | This class is a wxDataViewCtrl which internally uses a wxDataViewTreeStore |
2347 | and forwards most of its API to that class. | |
2348 | Additionally, it uses a wxImageList to store a list of icons. | |
2349 | ||
43c64cc6 VZ |
2350 | The main purpose of this class is to provide a simple upgrade path for code |
2351 | using wxTreeCtrl. | |
14f73cf1 FM |
2352 | |
2353 | @beginStyleTable | |
2354 | See wxDataViewCtrl for the list of supported styles. | |
2355 | @endStyleTable | |
43c64cc6 | 2356 | |
14f73cf1 FM |
2357 | @beginEventEmissionTable |
2358 | See wxDataViewCtrl for the list of events emitted by this class. | |
2359 | @endEventTable | |
7c913512 | 2360 | |
8ed522d9 | 2361 | @library{wxadv} |
b321b61c | 2362 | @category{ctrl,dvc} |
7e59b885 | 2363 | @appearance{dataviewtreectrl.png} |
23324ae1 | 2364 | */ |
5b99d5d8 | 2365 | class wxDataViewTreeCtrl : public wxDataViewCtrl |
23324ae1 FM |
2366 | { |
2367 | public: | |
2368 | /** | |
c4e57202 | 2369 | Default ctor. |
5b99d5d8 RR |
2370 | */ |
2371 | wxDataViewTreeCtrl(); | |
c4e57202 FM |
2372 | |
2373 | /** | |
43c64cc6 VZ |
2374 | Constructor. |
2375 | ||
2376 | Calls Create(). | |
c4e57202 | 2377 | */ |
5b99d5d8 RR |
2378 | wxDataViewTreeCtrl(wxWindow* parent, wxWindowID id, |
2379 | const wxPoint& pos = wxDefaultPosition, | |
2380 | const wxSize& size = wxDefaultSize, | |
43c64cc6 | 2381 | long style = wxDV_NO_HEADER | wxDV_ROW_LINES, |
5b99d5d8 | 2382 | const wxValidator& validator = wxDefaultValidator); |
3c4f71cc | 2383 | |
5b99d5d8 RR |
2384 | /** |
2385 | Destructor. Deletes the image list if any. | |
23324ae1 | 2386 | */ |
adaaa686 | 2387 | virtual ~wxDataViewTreeCtrl(); |
23324ae1 | 2388 | |
5b99d5d8 | 2389 | /** |
b75b04d4 | 2390 | Appends a container to the given @a parent. |
5b99d5d8 RR |
2391 | */ |
2392 | wxDataViewItem AppendContainer(const wxDataViewItem& parent, | |
2393 | const wxString& text, | |
2394 | int icon = -1, | |
2395 | int expanded = -1, | |
2396 | wxClientData* data = NULL); | |
e54c96f1 | 2397 | |
5b99d5d8 | 2398 | /** |
b75b04d4 | 2399 | Appends an item to the given @a parent. |
5b99d5d8 RR |
2400 | */ |
2401 | wxDataViewItem AppendItem(const wxDataViewItem& parent, | |
2402 | const wxString& text, | |
2403 | int icon = -1, | |
2404 | wxClientData* data = NULL); | |
7c913512 | 2405 | |
5b99d5d8 | 2406 | /** |
c4e57202 | 2407 | Creates the control and a wxDataViewTreeStore as its internal model. |
43c64cc6 VZ |
2408 | |
2409 | The default tree column created by this method is an editable column | |
2410 | using wxDataViewIconTextRenderer as its renderer. | |
5b99d5d8 RR |
2411 | */ |
2412 | bool Create(wxWindow* parent, wxWindowID id, | |
2413 | const wxPoint& pos = wxDefaultPosition, | |
2414 | const wxSize& size = wxDefaultSize, | |
43c64cc6 | 2415 | long style = wxDV_NO_HEADER | wxDV_ROW_LINES, |
5b99d5d8 RR |
2416 | const wxValidator& validator = wxDefaultValidator); |
2417 | ||
2418 | /** | |
2419 | Calls the identical method from wxDataViewTreeStore. | |
2420 | */ | |
2421 | void DeleteAllItems(); | |
7c913512 | 2422 | |
23324ae1 | 2423 | /** |
5b99d5d8 RR |
2424 | Calls the identical method from wxDataViewTreeStore. |
2425 | */ | |
2426 | void DeleteChildren(const wxDataViewItem& item); | |
3c4f71cc | 2427 | |
5b99d5d8 RR |
2428 | /** |
2429 | Calls the identical method from wxDataViewTreeStore. | |
23324ae1 | 2430 | */ |
5b99d5d8 | 2431 | void DeleteItem(const wxDataViewItem& item); |
23324ae1 | 2432 | |
5b99d5d8 RR |
2433 | /** |
2434 | Calls the identical method from wxDataViewTreeStore. | |
2435 | */ | |
2436 | int GetChildCount(const wxDataViewItem& parent) const; | |
23324ae1 | 2437 | |
5b99d5d8 RR |
2438 | /** |
2439 | Returns the image list. | |
2440 | */ | |
2441 | wxImageList* GetImageList(); | |
05303ccd | 2442 | |
5b99d5d8 RR |
2443 | /** |
2444 | Calls the identical method from wxDataViewTreeStore. | |
2445 | */ | |
2446 | wxClientData* GetItemData(const wxDataViewItem& item) const; | |
05303ccd | 2447 | |
5b99d5d8 RR |
2448 | /** |
2449 | Calls the identical method from wxDataViewTreeStore. | |
2450 | */ | |
b91c4601 | 2451 | const wxIcon& GetItemExpandedIcon(const wxDataViewItem& item) const; |
05303ccd | 2452 | |
05303ccd | 2453 | /** |
5b99d5d8 | 2454 | Calls the identical method from wxDataViewTreeStore. |
05303ccd | 2455 | */ |
b91c4601 | 2456 | const wxIcon& GetItemIcon(const wxDataViewItem& item) const; |
05303ccd RR |
2457 | |
2458 | /** | |
5b99d5d8 | 2459 | Calls the identical method from wxDataViewTreeStore. |
05303ccd | 2460 | */ |
5b99d5d8 RR |
2461 | wxString GetItemText(const wxDataViewItem& item) const; |
2462 | ||
2463 | /** | |
2464 | Calls the identical method from wxDataViewTreeStore. | |
2465 | */ | |
2466 | wxDataViewItem GetNthChild(const wxDataViewItem& parent, | |
2467 | unsigned int pos) const; | |
05303ccd | 2468 | |
5b99d5d8 | 2469 | //@{ |
05303ccd | 2470 | /** |
5b99d5d8 | 2471 | Returns the store. |
05303ccd | 2472 | */ |
882678eb | 2473 | wxDataViewTreeStore* GetStore(); |
5b99d5d8 RR |
2474 | const wxDataViewTreeStore* GetStore() const; |
2475 | //@} | |
05303ccd RR |
2476 | |
2477 | /** | |
c4e57202 FM |
2478 | Calls the same method from wxDataViewTreeStore but uses |
2479 | an index position in the image list instead of a wxIcon. | |
05303ccd | 2480 | */ |
5b99d5d8 RR |
2481 | wxDataViewItem InsertContainer(const wxDataViewItem& parent, |
2482 | const wxDataViewItem& previous, | |
2483 | const wxString& text, | |
2484 | int icon = -1, | |
2485 | int expanded = -1, | |
2486 | wxClientData* data = NULL); | |
05303ccd RR |
2487 | |
2488 | /** | |
c4e57202 FM |
2489 | Calls the same method from wxDataViewTreeStore but uses |
2490 | an index position in the image list instead of a wxIcon. | |
05303ccd | 2491 | */ |
5b99d5d8 RR |
2492 | wxDataViewItem InsertItem(const wxDataViewItem& parent, |
2493 | const wxDataViewItem& previous, | |
2494 | const wxString& text, | |
2495 | int icon = -1, | |
2496 | wxClientData* data = NULL); | |
05303ccd | 2497 | |
8ddda15b RR |
2498 | /** |
2499 | Returns true if item is a container. | |
2500 | */ | |
2501 | bool IsContainer( const wxDataViewItem& item ); | |
2502 | ||
05303ccd | 2503 | /** |
c4e57202 FM |
2504 | Calls the same method from wxDataViewTreeStore but uses |
2505 | an index position in the image list instead of a wxIcon. | |
05303ccd | 2506 | */ |
5b99d5d8 RR |
2507 | wxDataViewItem PrependContainer(const wxDataViewItem& parent, |
2508 | const wxString& text, | |
2509 | int icon = -1, | |
2510 | int expanded = -1, | |
2511 | wxClientData* data = NULL); | |
05303ccd RR |
2512 | |
2513 | /** | |
c4e57202 FM |
2514 | Calls the same method from wxDataViewTreeStore but uses |
2515 | an index position in the image list instead of a wxIcon. | |
05303ccd | 2516 | */ |
5b99d5d8 RR |
2517 | wxDataViewItem PrependItem(const wxDataViewItem& parent, |
2518 | const wxString& text, | |
2519 | int icon = -1, | |
2520 | wxClientData* data = NULL); | |
05303ccd RR |
2521 | |
2522 | /** | |
5b99d5d8 | 2523 | Sets the image list. |
05303ccd | 2524 | */ |
5b99d5d8 | 2525 | void SetImageList(wxImageList* imagelist); |
05303ccd RR |
2526 | |
2527 | /** | |
5b99d5d8 | 2528 | Calls the identical method from wxDataViewTreeStore. |
05303ccd | 2529 | */ |
5b99d5d8 | 2530 | void SetItemData(const wxDataViewItem& item, wxClientData* data); |
05303ccd RR |
2531 | |
2532 | /** | |
5b99d5d8 | 2533 | Calls the identical method from wxDataViewTreeStore. |
05303ccd | 2534 | */ |
5b99d5d8 RR |
2535 | void SetItemExpandedIcon(const wxDataViewItem& item, |
2536 | const wxIcon& icon); | |
05303ccd RR |
2537 | |
2538 | /** | |
5b99d5d8 | 2539 | Calls the identical method from wxDataViewTreeStore. |
05303ccd | 2540 | */ |
5b99d5d8 | 2541 | void SetItemIcon(const wxDataViewItem& item, const wxIcon& icon); |
05303ccd RR |
2542 | |
2543 | /** | |
5b99d5d8 | 2544 | Calls the identical method from wxDataViewTreeStore. |
05303ccd | 2545 | */ |
5b99d5d8 RR |
2546 | void SetItemText(const wxDataViewItem& item, |
2547 | const wxString& text); | |
05303ccd RR |
2548 | }; |
2549 | ||
2550 | ||
bda698ed RR |
2551 | /** |
2552 | @class wxDataViewListStore | |
2553 | ||
2554 | wxDataViewListStore is a specialised wxDataViewModel for storing | |
2555 | a simple table of data. Since it derives from wxDataViewIndexListModel | |
2556 | its data is be accessed by row (i.e. by index) instead of only | |
2557 | by wxDataViewItem. | |
2558 | ||
02b51ae5 | 2559 | This class actually stores the values (therefore its name) |
bda698ed | 2560 | and implements all virtual methods from the base classes so it can be |
02b51ae5 | 2561 | used directly without having to derive any class from it, but it is |
bda698ed RR |
2562 | mostly used from within wxDataViewListCtrl. |
2563 | ||
2564 | @library{wxadv} | |
2565 | @category{dvc} | |
2566 | */ | |
2567 | ||
2568 | class wxDataViewListStore: public wxDataViewIndexListModel | |
2569 | { | |
2570 | public: | |
2571 | /** | |
02b51ae5 | 2572 | Constructor |
bda698ed RR |
2573 | */ |
2574 | wxDataViewListStore(); | |
02b51ae5 | 2575 | |
bda698ed | 2576 | /** |
02b51ae5 | 2577 | Destructor |
bda698ed RR |
2578 | */ |
2579 | ~wxDataViewListStore(); | |
2580 | ||
2581 | /** | |
02b51ae5 FM |
2582 | Prepends a data column. |
2583 | ||
2584 | @a variantype indicates the type of values store in the column. | |
2585 | ||
2586 | This does not automatically fill in any (default) values in | |
2587 | rows which exist in the store already. | |
bda698ed RR |
2588 | */ |
2589 | void PrependColumn( const wxString &varianttype ); | |
2590 | ||
2591 | /** | |
02b51ae5 FM |
2592 | Inserts a data column before @a pos. |
2593 | ||
2594 | @a variantype indicates the type of values store in the column. | |
2595 | ||
2596 | This does not automatically fill in any (default) values in | |
2597 | rows which exist in the store already. | |
bda698ed RR |
2598 | */ |
2599 | void InsertColumn( unsigned int pos, const wxString &varianttype ); | |
2600 | ||
2601 | /** | |
02b51ae5 FM |
2602 | Appends a data column. |
2603 | ||
2604 | @a variantype indicates the type of values store in the column. | |
2605 | ||
2606 | This does not automatically fill in any (default) values in | |
2607 | rows which exist in the store already. | |
bda698ed RR |
2608 | */ |
2609 | void AppendColumn( const wxString &varianttype ); | |
02b51ae5 | 2610 | |
bda698ed RR |
2611 | /** |
2612 | Appends an item (=row) and fills it with @a values. | |
02b51ae5 | 2613 | |
bda698ed RR |
2614 | The values must match the values specifies in the column |
2615 | in number and type. No (default) values are filled in | |
2616 | automatically. | |
2617 | */ | |
2618 | void AppendItem( const wxVector<wxVariant> &values, wxClientData *data = NULL ); | |
02b51ae5 | 2619 | |
bda698ed RR |
2620 | /** |
2621 | Prepends an item (=row) and fills it with @a values. | |
02b51ae5 | 2622 | |
bda698ed RR |
2623 | The values must match the values specifies in the column |
2624 | in number and type. No (default) values are filled in | |
2625 | automatically. | |
2626 | */ | |
2627 | void PrependItem( const wxVector<wxVariant> &values, wxClientData *data = NULL ); | |
02b51ae5 | 2628 | |
bda698ed RR |
2629 | /** |
2630 | Inserts an item (=row) and fills it with @a values. | |
02b51ae5 | 2631 | |
bda698ed RR |
2632 | The values must match the values specifies in the column |
2633 | in number and type. No (default) values are filled in | |
2634 | automatically. | |
2635 | */ | |
2636 | void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxClientData *data = NULL ); | |
02b51ae5 | 2637 | |
bda698ed RR |
2638 | /** |
2639 | Delete the item (=row) at position @a pos. | |
2640 | */ | |
2641 | void DeleteItem( unsigned pos ); | |
02b51ae5 | 2642 | |
bda698ed RR |
2643 | /** |
2644 | Delete all item (=all rows) in the store. | |
2645 | */ | |
2646 | void DeleteAllItems(); | |
2647 | ||
2648 | /** | |
57ab6f23 | 2649 | Overridden from wxDataViewModel |
bda698ed RR |
2650 | */ |
2651 | virtual unsigned int GetColumnCount() const; | |
2652 | ||
2653 | /** | |
57ab6f23 | 2654 | Overridden from wxDataViewModel |
bda698ed RR |
2655 | */ |
2656 | virtual wxString GetColumnType( unsigned int col ) const; | |
2657 | ||
2658 | /** | |
57ab6f23 | 2659 | Overridden from wxDataViewIndexListModel |
bda698ed RR |
2660 | */ |
2661 | virtual void GetValueByRow( wxVariant &value, | |
2662 | unsigned int row, unsigned int col ) const; | |
2663 | ||
2664 | /** | |
57ab6f23 | 2665 | Overridden from wxDataViewIndexListModel |
bda698ed RR |
2666 | */ |
2667 | virtual bool SetValueByRow( const wxVariant &value, | |
2668 | unsigned int row, unsigned int col ); | |
2669 | }; | |
2670 | ||
05303ccd RR |
2671 | |
2672 | /** | |
5b99d5d8 | 2673 | @class wxDataViewTreeStore |
05303ccd | 2674 | |
57ab6f23 | 2675 | wxDataViewTreeStore is a specialised wxDataViewModel for storing simple |
c4e57202 FM |
2676 | trees very much like wxTreeCtrl does and it offers a similar API. |
2677 | ||
02b51ae5 | 2678 | This class actually stores the entire tree and the values (therefore its name) |
8eff6c56 | 2679 | and implements all virtual methods from the base class so it can be used directly |
bda698ed RR |
2680 | without having to derive any class from it, but it is mostly used from within |
2681 | wxDataViewTreeCtrl. | |
05303ccd RR |
2682 | |
2683 | @library{wxadv} | |
b321b61c | 2684 | @category{dvc} |
05303ccd | 2685 | */ |
5b99d5d8 | 2686 | class wxDataViewTreeStore : public wxDataViewModel |
05303ccd RR |
2687 | { |
2688 | public: | |
2689 | /** | |
5b99d5d8 | 2690 | Constructor. Creates the invisible root node internally. |
05303ccd | 2691 | */ |
5b99d5d8 | 2692 | wxDataViewTreeStore(); |
e54c96f1 | 2693 | |
5b99d5d8 RR |
2694 | /** |
2695 | Destructor. | |
2696 | */ | |
adaaa686 | 2697 | virtual ~wxDataViewTreeStore(); |
7c913512 | 2698 | |
5b99d5d8 RR |
2699 | /** |
2700 | Append a container. | |
2701 | */ | |
2702 | wxDataViewItem AppendContainer(const wxDataViewItem& parent, | |
2703 | const wxString& text, | |
2704 | const wxIcon& icon = wxNullIcon, | |
2705 | const wxIcon& expanded = wxNullIcon, | |
2706 | wxClientData* data = NULL); | |
7c913512 | 2707 | |
5b99d5d8 RR |
2708 | /** |
2709 | Append an item. | |
2710 | */ | |
2711 | wxDataViewItem AppendItem(const wxDataViewItem& parent, | |
2712 | const wxString& text, | |
2713 | const wxIcon& icon = wxNullIcon, | |
2714 | wxClientData* data = NULL); | |
7c913512 | 2715 | |
23324ae1 | 2716 | /** |
5b99d5d8 | 2717 | Delete all item in the model. |
23324ae1 | 2718 | */ |
5b99d5d8 | 2719 | void DeleteAllItems(); |
23324ae1 FM |
2720 | |
2721 | /** | |
5b99d5d8 | 2722 | Delete all children of the item, but not the item itself. |
23324ae1 | 2723 | */ |
5b99d5d8 | 2724 | void DeleteChildren(const wxDataViewItem& item); |
23324ae1 FM |
2725 | |
2726 | /** | |
5b99d5d8 | 2727 | Delete this item. |
23324ae1 | 2728 | */ |
5b99d5d8 | 2729 | void DeleteItem(const wxDataViewItem& item); |
23324ae1 FM |
2730 | |
2731 | /** | |
5b99d5d8 | 2732 | Return the number of children of item. |
23324ae1 | 2733 | */ |
5b99d5d8 | 2734 | int GetChildCount(const wxDataViewItem& parent) const; |
23324ae1 FM |
2735 | |
2736 | /** | |
57ab6f23 | 2737 | Returns the client data associated with the item. |
23324ae1 | 2738 | */ |
5b99d5d8 | 2739 | wxClientData* GetItemData(const wxDataViewItem& item) const; |
23324ae1 FM |
2740 | |
2741 | /** | |
5b99d5d8 | 2742 | Returns the icon to display in expanded containers. |
23324ae1 | 2743 | */ |
b91c4601 | 2744 | const wxIcon& GetItemExpandedIcon(const wxDataViewItem& item) const; |
23324ae1 FM |
2745 | |
2746 | /** | |
5b99d5d8 | 2747 | Returns the icon of the item. |
23324ae1 | 2748 | */ |
b91c4601 | 2749 | const wxIcon& GetItemIcon(const wxDataViewItem& item) const; |
23324ae1 FM |
2750 | |
2751 | /** | |
5b99d5d8 | 2752 | Returns the text of the item. |
23324ae1 | 2753 | */ |
5b99d5d8 | 2754 | wxString GetItemText(const wxDataViewItem& item) const; |
23324ae1 FM |
2755 | |
2756 | /** | |
5b99d5d8 | 2757 | Returns the nth child item of item. |
23324ae1 | 2758 | */ |
5b99d5d8 RR |
2759 | wxDataViewItem GetNthChild(const wxDataViewItem& parent, |
2760 | unsigned int pos) const; | |
23324ae1 FM |
2761 | |
2762 | /** | |
c4e57202 | 2763 | Inserts a container after @a previous. |
23324ae1 | 2764 | */ |
5b99d5d8 RR |
2765 | wxDataViewItem InsertContainer(const wxDataViewItem& parent, |
2766 | const wxDataViewItem& previous, | |
2767 | const wxString& text, | |
2768 | const wxIcon& icon = wxNullIcon, | |
2769 | const wxIcon& expanded = wxNullIcon, | |
2770 | wxClientData* data = NULL); | |
23324ae1 FM |
2771 | |
2772 | /** | |
c4e57202 | 2773 | Inserts an item after @a previous. |
23324ae1 | 2774 | */ |
5b99d5d8 RR |
2775 | wxDataViewItem InsertItem(const wxDataViewItem& parent, |
2776 | const wxDataViewItem& previous, | |
2777 | const wxString& text, | |
2778 | const wxIcon& icon = wxNullIcon, | |
2779 | wxClientData* data = NULL); | |
23324ae1 FM |
2780 | |
2781 | /** | |
c4e57202 | 2782 | Inserts a container before the first child item or @a parent. |
23324ae1 | 2783 | */ |
5b99d5d8 RR |
2784 | wxDataViewItem PrependContainer(const wxDataViewItem& parent, |
2785 | const wxString& text, | |
2786 | const wxIcon& icon = wxNullIcon, | |
2787 | const wxIcon& expanded = wxNullIcon, | |
2788 | wxClientData* data = NULL); | |
23324ae1 FM |
2789 | |
2790 | /** | |
c4e57202 | 2791 | Inserts an item before the first child item or @a parent. |
23324ae1 | 2792 | */ |
5b99d5d8 RR |
2793 | wxDataViewItem PrependItem(const wxDataViewItem& parent, |
2794 | const wxString& text, | |
2795 | const wxIcon& icon = wxNullIcon, | |
2796 | wxClientData* data = NULL); | |
23324ae1 FM |
2797 | |
2798 | /** | |
5b99d5d8 | 2799 | Sets the client data associated with the item. |
23324ae1 | 2800 | */ |
5b99d5d8 | 2801 | void SetItemData(const wxDataViewItem& item, wxClientData* data); |
23324ae1 FM |
2802 | |
2803 | /** | |
5b99d5d8 | 2804 | Sets the expanded icon for the item. |
23324ae1 | 2805 | */ |
5b99d5d8 RR |
2806 | void SetItemExpandedIcon(const wxDataViewItem& item, |
2807 | const wxIcon& icon); | |
23324ae1 FM |
2808 | |
2809 | /** | |
5b99d5d8 | 2810 | Sets the icon for the item. |
23324ae1 | 2811 | */ |
5b99d5d8 | 2812 | void SetItemIcon(const wxDataViewItem& item, const wxIcon& icon); |
23324ae1 | 2813 | }; |
e54c96f1 | 2814 | |
80932a3e FM |
2815 | |
2816 | /** | |
2817 | @class wxDataViewIconText | |
2818 | ||
2819 | wxDataViewIconText is used by wxDataViewIconTextRenderer for data transfer. | |
2820 | This class can be converted to and from a wxVariant. | |
2821 | ||
2822 | @library{wxadv} | |
2823 | @category{dvc} | |
2824 | */ | |
2825 | class wxDataViewIconText : public wxObject | |
2826 | { | |
2827 | public: | |
2828 | //@{ | |
2829 | /** | |
2830 | Constructor. | |
2831 | */ | |
2832 | wxDataViewIconText(const wxString& text = wxEmptyString, | |
2833 | const wxIcon& icon = wxNullIcon); | |
2834 | wxDataViewIconText(const wxDataViewIconText& other); | |
2835 | //@} | |
2836 | ||
2837 | /** | |
2838 | Gets the icon. | |
2839 | */ | |
2840 | const wxIcon& GetIcon() const; | |
2841 | ||
2842 | /** | |
2843 | Gets the text. | |
2844 | */ | |
2845 | wxString GetText() const; | |
2846 | ||
2847 | /** | |
2848 | Set the icon. | |
2849 | */ | |
2850 | void SetIcon(const wxIcon& icon); | |
2851 | ||
2852 | /** | |
2853 | Set the text. | |
2854 | */ | |
2855 | void SetText(const wxString& text); | |
2856 | }; | |
2857 | ||
2858 | ||
2859 | ||
2860 | /** | |
2861 | @class wxDataViewEvent | |
2862 | ||
2863 | This is the event class for the wxDataViewCtrl notifications. | |
2864 | ||
14f73cf1 FM |
2865 | @beginEventTable{wxDataViewEvent} |
2866 | @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)} | |
2867 | Process a @c wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event. | |
2868 | @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)} | |
2869 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event. | |
2870 | @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)} | |
2871 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event. | |
2872 | @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)} | |
2873 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event. | |
2874 | @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)} | |
2875 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event. | |
2876 | @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)} | |
2877 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event. | |
2878 | @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)} | |
2879 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event. | |
2880 | @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)} | |
2881 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event. | |
2882 | @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)} | |
2883 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event. | |
2884 | @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)} | |
2885 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event. | |
2886 | @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)} | |
2887 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event. | |
2888 | @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)} | |
2889 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event. | |
2890 | @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)} | |
2891 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event. | |
2892 | @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)} | |
2893 | Process a @c wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event. | |
2894 | @event{EVT_DATAVIEW_ITEM_BEGIN_DRAG(id, func)} | |
2895 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG event. | |
2896 | @event{EVT_DATAVIEW_ITEM_DROP_POSSIBLE(id, func)} | |
2897 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE event. | |
2898 | @event{EVT_DATAVIEW_ITEM_DROP(id, func)} | |
2899 | Process a @c wxEVT_COMMAND_DATAVIEW_ITEM_DROP event. | |
47a8b1e1 VZ |
2900 | @event{EVT_DATAVIEW_CACHE_HINT(id, func)} |
2901 | Process a @c wxEVT_COMMAND_DATAVIEW_CACHE_HINT event. | |
14f73cf1 | 2902 | @endEventTable |
43c64cc6 | 2903 | |
80932a3e FM |
2904 | @library{wxadv} |
2905 | @category{events,dvc} | |
2906 | */ | |
2907 | class wxDataViewEvent : public wxNotifyEvent | |
2908 | { | |
2909 | public: | |
80932a3e FM |
2910 | /** |
2911 | Constructor. Typically used by wxWidgets internals only. | |
2912 | */ | |
2913 | wxDataViewEvent(wxEventType commandType = wxEVT_NULL, | |
2914 | int winid = 0); | |
80932a3e FM |
2915 | |
2916 | /** | |
2917 | Returns the position of the column in the control or -1 | |
2918 | if no column field was set by the event emitter. | |
2919 | */ | |
2920 | int GetColumn() const; | |
2921 | ||
2922 | /** | |
2923 | Returns a pointer to the wxDataViewColumn from which | |
2924 | the event was emitted or @NULL. | |
2925 | */ | |
2926 | wxDataViewColumn* GetDataViewColumn() const; | |
2927 | ||
2928 | /** | |
2929 | Returns the wxDataViewModel associated with the event. | |
2930 | */ | |
2931 | wxDataViewModel* GetModel() const; | |
2932 | ||
2933 | /** | |
57ab6f23 | 2934 | Returns the position of a context menu event in screen coordinates. |
80932a3e FM |
2935 | */ |
2936 | wxPoint GetPosition() const; | |
2937 | ||
2938 | /** | |
2939 | Returns a reference to a value. | |
2940 | */ | |
2941 | const wxVariant& GetValue() const; | |
2942 | ||
2a648479 VZ |
2943 | /** |
2944 | Can be used to determine whether the new value is going to be accepted | |
2945 | in wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE handler. | |
2946 | ||
2947 | Returns @true if editing the item was cancelled or if the user tried to | |
2948 | enter an invalid value (refused by wxDataViewRenderer::Validate()). If | |
2949 | this method returns @false, it means that the value in the model is | |
2950 | about to be changed to the new one. | |
2951 | ||
2952 | Notice that wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event handler can | |
2953 | call wxNotifyEvent::Veto() to prevent this from happening. | |
2954 | ||
2955 | Currently support for setting this field and for vetoing the change is | |
2956 | only available in the generic version of wxDataViewCtrl, i.e. under MSW | |
2957 | but not GTK nor OS X. | |
2958 | ||
2959 | @since 2.9.3 | |
2960 | */ | |
2961 | bool IsEditCancelled() const; | |
2962 | ||
80932a3e FM |
2963 | /** |
2964 | Sets the column index associated with this event. | |
2965 | */ | |
2966 | void SetColumn(int col); | |
2967 | ||
2968 | /** | |
3a194bda | 2969 | For @c wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only. |
80932a3e FM |
2970 | */ |
2971 | void SetDataViewColumn(wxDataViewColumn* col); | |
2972 | ||
2973 | /** | |
2974 | Sets the dataview model associated with this event. | |
2975 | */ | |
2976 | void SetModel(wxDataViewModel* model); | |
2977 | ||
2978 | /** | |
2979 | Sets the value associated with this event. | |
2980 | */ | |
2981 | void SetValue(const wxVariant& value); | |
02b51ae5 | 2982 | |
591cc82d | 2983 | /** |
e4de825e | 2984 | Set wxDataObject for data transfer within a drag operation. |
591cc82d RR |
2985 | */ |
2986 | void SetDataObject( wxDataObject *obj ); | |
02b51ae5 | 2987 | |
591cc82d | 2988 | /** |
e4de825e RR |
2989 | Used internally. Gets associated wxDataObject for data transfer |
2990 | within a drag operation. | |
2991 | */ | |
2992 | wxDataObject *GetDataObject() const; | |
02b51ae5 | 2993 | |
e4de825e RR |
2994 | /** |
2995 | Used internally. Sets the wxDataFormat during a drop operation. | |
2996 | */ | |
2997 | void SetDataFormat( const wxDataFormat &format ); | |
02b51ae5 | 2998 | |
e4de825e RR |
2999 | /** |
3000 | Gets the wxDataFormat during a drop operation. | |
3001 | */ | |
3002 | wxDataFormat GetDataFormat() const; | |
02b51ae5 | 3003 | |
e4de825e RR |
3004 | /** |
3005 | Used internally. Sets the data size for a drop data transfer. | |
3006 | */ | |
3007 | void SetDataSize( size_t size ); | |
02b51ae5 | 3008 | |
e4de825e RR |
3009 | /** |
3010 | Gets the data size for a drop data transfer. | |
3011 | */ | |
3012 | size_t GetDataSize() const; | |
02b51ae5 | 3013 | |
e4de825e RR |
3014 | /** |
3015 | Used internally. Sets the data buffer for a drop data transfer. | |
3016 | */ | |
3017 | void SetDataBuffer( void* buf ); | |
02b51ae5 | 3018 | |
e4de825e RR |
3019 | /** |
3020 | Gets the data buffer for a drop data transfer. | |
591cc82d | 3021 | */ |
e4de825e | 3022 | void *GetDataBuffer() const; |
47a8b1e1 VZ |
3023 | |
3024 | /** | |
3025 | Return the first row that will be displayed. | |
3026 | */ | |
3027 | int GetCacheFrom() const; | |
3028 | ||
3029 | /** | |
3030 | Return the last row that will be displayed. | |
3031 | */ | |
3032 | int GetCacheTo() const; | |
80932a3e FM |
3033 | }; |
3034 |