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