]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dataview.h | |
3 | // Purpose: documentation for wxDataViewIconText class | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxDataViewIconText | |
11 | @wxheader{dataview.h} | |
7c913512 FM |
12 | |
13 | wxDataViewIconText is used by | |
23324ae1 FM |
14 | wxDataViewIconTextRenderer |
15 | for data transfer. This class can be converted to a from | |
16 | a wxVariant. | |
7c913512 | 17 | |
23324ae1 FM |
18 | @library{wxbase} |
19 | @category{FIXME} | |
20 | */ | |
21 | class wxDataViewIconText : public wxObject | |
22 | { | |
23 | public: | |
24 | //@{ | |
25 | /** | |
26 | Constructor. | |
27 | */ | |
28 | wxDataViewIconText(const wxString& text = wxEmptyString, | |
29 | const wxIcon& icon = wxNullIcon); | |
7c913512 | 30 | wxDataViewIconText(const wxDataViewIconText& other); |
23324ae1 FM |
31 | //@} |
32 | ||
33 | /** | |
34 | Gets the icon. | |
35 | */ | |
36 | const wxIcon GetIcon(); | |
37 | ||
38 | /** | |
39 | Gets the text. | |
40 | */ | |
41 | wxString GetText(); | |
42 | ||
43 | /** | |
44 | Set the icon. | |
45 | */ | |
46 | void SetIcon(const wxIcon& icon); | |
47 | ||
48 | /** | |
49 | Set the text. | |
50 | */ | |
51 | void SetText(const wxString& text); | |
52 | }; | |
53 | ||
54 | ||
55 | /** | |
56 | @class wxDataViewEvent | |
57 | @wxheader{dataview.h} | |
7c913512 | 58 | |
23324ae1 | 59 | wxDataViewEvent - the event class for the wxDataViewCtrl notifications |
7c913512 | 60 | |
23324ae1 FM |
61 | @library{wxadv} |
62 | @category{FIXME} | |
63 | */ | |
64 | class wxDataViewEvent : public wxNotifyEvent | |
65 | { | |
66 | public: | |
67 | //@{ | |
68 | /** | |
69 | ||
70 | */ | |
71 | wxDataViewEvent(wxEventType commandType = wxEVT_@NULL, | |
72 | int winid = 0); | |
7c913512 | 73 | wxDataViewEvent(const wxDataViewEvent& event); |
23324ae1 FM |
74 | //@} |
75 | ||
76 | /** | |
77 | Used to clone the event. | |
78 | */ | |
79 | wxEvent* Clone(); | |
80 | ||
81 | /** | |
82 | Returns the position of the column in the control or -1 | |
83 | if no column field was set by the event emitter. | |
84 | */ | |
85 | int GetColumn(); | |
86 | ||
87 | /** | |
88 | Returns a pointer to the wxDataViewColumn from which | |
89 | the event was emitted or @NULL. | |
90 | */ | |
91 | wxDataViewColumn* GetDataViewColumn(); | |
92 | ||
93 | /** | |
94 | Returns the wxDataViewModel associated with the event. | |
95 | */ | |
96 | wxDataViewModel* GetModel(); | |
97 | ||
98 | /** | |
99 | Returns a the position of a context menu event in screen coordinates. | |
100 | */ | |
101 | wxPoint GetPosition(); | |
102 | ||
103 | /** | |
104 | Returns a reference to a value. | |
105 | */ | |
106 | const wxVariant GetValue(); | |
107 | ||
108 | /** | |
109 | ||
110 | */ | |
111 | void SetColumn(int col); | |
112 | ||
113 | /** | |
114 | For wxEVT_DATAVIEW_COLUMN_HEADER_CLICKED only. | |
115 | */ | |
116 | void SetDataViewColumn(wxDataViewColumn* col); | |
117 | ||
118 | /** | |
119 | ||
120 | */ | |
121 | void SetModel(wxDataViewModel* model); | |
122 | ||
123 | /** | |
124 | ||
125 | */ | |
126 | void SetValue(const wxVariant& value); | |
127 | }; | |
128 | ||
129 | ||
130 | /** | |
131 | @class wxDataViewIconTextRenderer | |
132 | @wxheader{dataview.h} | |
7c913512 | 133 | |
23324ae1 FM |
134 | The wxDataViewIconTextRenderer class is used to display text with |
135 | a small icon next to it as it is typically done in a file manager. | |
136 | This classes uses the wxDataViewIconText | |
137 | helper class to store its data. wxDataViewIonText can be converted | |
138 | to a from a wxVariant using the left shift | |
139 | operator. | |
7c913512 | 140 | |
23324ae1 FM |
141 | @library{wxadv} |
142 | @category{FIXME} | |
143 | */ | |
144 | class wxDataViewIconTextRenderer : public wxDataViewRenderer | |
145 | { | |
146 | public: | |
147 | /** | |
148 | ||
149 | */ | |
150 | wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText", | |
151 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT); | |
152 | }; | |
153 | ||
154 | ||
155 | /** | |
156 | @class wxDataViewIndexListModel | |
157 | @wxheader{dataview.h} | |
7c913512 | 158 | |
23324ae1 | 159 | wxDataViewIndexListModel is a specialized data model which lets |
7c913512 FM |
160 | you address an item by its position (row) rather than its |
161 | wxDataViewItem (which you can obtain from this class). | |
162 | This model also provides its own | |
23324ae1 FM |
163 | wxDataViewIndexListModel::Compare method |
164 | which sorts the model's data by the index. | |
7c913512 | 165 | |
23324ae1 FM |
166 | This model is special in the it is implemented differently under OS X |
167 | and other platforms. Under OS X a wxDataViewItem is always persistent | |
168 | and this is also the case for this class. Under other platforms, the | |
169 | meaning of a wxDataViewItem is changed to reflect a row number for | |
7c913512 | 170 | wxDataViewIndexListModel. The consequence of this is that |
23324ae1 FM |
171 | wxDataViewIndexListModel can be used as a virtual model with an |
172 | almost infinate number of items on platforms other than OS X. | |
7c913512 | 173 | |
23324ae1 FM |
174 | @library{wxbase} |
175 | @category{FIXME} | |
176 | */ | |
177 | class wxDataViewIndexListModel : public wxDataViewModel | |
178 | { | |
179 | public: | |
180 | /** | |
181 | Constructor. | |
182 | */ | |
183 | wxDataViewIndexListModel(unsigned int initial_size = 0); | |
184 | ||
185 | /** | |
186 | Destructor. | |
187 | */ | |
188 | ~wxDataViewIndexListModel(); | |
189 | ||
190 | /** | |
191 | Compare method that sorts the items by their index. | |
192 | */ | |
193 | int Compare(const wxDataViewItem& item1, | |
194 | const wxDataViewItem& item2, | |
195 | unsigned int column, bool ascending); | |
196 | ||
197 | /** | |
198 | Oberride this to indicate that the row has special font attributes. | |
7c913512 | 199 | This only affects the |
23324ae1 FM |
200 | wxDataViewTextRendererText renderer. |
201 | ||
202 | See also wxDataViewItemAttr. | |
203 | */ | |
204 | bool GetAttr(unsigned int row, unsigned int col, | |
205 | wxDataViewItemAttr& attr); | |
206 | ||
207 | /** | |
208 | Returns the wxDataViewItem at the given @e row. | |
209 | */ | |
210 | wxDataViewItem GetItem(unsigned int row); | |
211 | ||
212 | /** | |
213 | Returns the position of given @e item. | |
214 | */ | |
215 | unsigned int GetRow(const wxDataViewItem& item); | |
216 | ||
217 | /** | |
218 | Override this to allow getting values from the model. | |
219 | */ | |
220 | void GetValue(wxVariant& variant, unsigned int row, | |
221 | unsigned int col); | |
222 | ||
223 | /** | |
224 | Call this after if the data has to be read again from | |
225 | the model. This is useful after major changes when | |
226 | calling the methods below (possibly thousands of times) | |
227 | doesn't make sense. | |
228 | */ | |
229 | void Reset(unsigned int new_size); | |
230 | ||
231 | /** | |
232 | Call this after a row has been appended to the model. | |
233 | */ | |
234 | void RowAppended(); | |
235 | ||
236 | /** | |
237 | Call this after a row has been changed. | |
238 | */ | |
239 | void RowChanged(unsigned int row); | |
240 | ||
241 | /** | |
242 | Call this after a row has been deleted. | |
243 | */ | |
244 | void RowDeleted(unsigned int row); | |
245 | ||
246 | /** | |
247 | Call this after a row has been inserted at the given position. | |
248 | */ | |
249 | void RowInserted(unsigned int before); | |
250 | ||
251 | /** | |
252 | Call this after a row has been prepended to the model. | |
253 | */ | |
254 | void RowPrepended(); | |
255 | ||
256 | /** | |
257 | Call this after a value has been changed. | |
258 | */ | |
259 | void RowValueChanged(unsigned int row, unsigned int col); | |
260 | ||
261 | /** | |
262 | Call this after rows have been deleted. The array will internally | |
263 | get copied and sorted in descending order so that the rows with | |
264 | the highest position will be deleted first. | |
265 | */ | |
266 | void RowsDeleted(const wxArrayInt& rows); | |
267 | ||
268 | /** | |
269 | Called in order to set a value in the model. | |
270 | */ | |
271 | bool SetValue(const wxVariant& variant, unsigned int row, | |
272 | unsigned int col); | |
273 | }; | |
274 | ||
275 | ||
276 | /** | |
277 | @class wxDataViewModel | |
278 | @wxheader{dataview.h} | |
7c913512 | 279 | |
23324ae1 | 280 | wxDataViewModel is the base class for all data model to be |
7c913512 | 281 | displayed by a wxDataViewCtrl. |
23324ae1 FM |
282 | All other models derive from it and must implement its |
283 | pure virtual functions in order to define a complete | |
7c913512 | 284 | data model. In detail, you need to override |
23324ae1 FM |
285 | wxDataViewModel::IsContainer, |
286 | wxDataViewModel::GetParent, | |
287 | wxDataViewModel::GetChildren, | |
288 | wxDataViewModel::GetColumnCount, | |
289 | wxDataViewModel::GetColumnType and | |
290 | wxDataViewModel::GetValue in order to | |
7c913512 | 291 | define the data model which acts as an interface between |
23324ae1 FM |
292 | your actual data and the wxDataViewCtrl. Since you will |
293 | usually also allow the wxDataViewCtrl to change your data | |
294 | through its graphical interface, you will also have to override | |
295 | wxDataViewModel::SetValue which the | |
296 | wxDataViewCtrl will call when a change to some data has been | |
297 | commited. | |
7c913512 | 298 | |
23324ae1 FM |
299 | wxDataViewModel (as indeed the entire wxDataViewCtrl |
300 | code) is using wxVariant to store data and | |
301 | its type in a generic way. wxVariant can be extended to contain | |
302 | almost any data without changes to the original class. | |
7c913512 | 303 | |
23324ae1 FM |
304 | The data that is presented through this data model is expected |
305 | to change at run-time. You need to inform the data model when | |
306 | a change happened. Depending on what happened you need to call | |
7c913512 | 307 | one of the following methods: |
23324ae1 FM |
308 | wxDataViewModel::ValueChanged, |
309 | wxDataViewModel::ItemAdded, | |
310 | wxDataViewModel::ItemDeleted, | |
311 | wxDataViewModel::ItemChanged, | |
312 | wxDataViewModel::Cleared. There are | |
313 | plural forms for notification of addition, change | |
7c913512 | 314 | or removal of several item at once. See |
23324ae1 FM |
315 | wxDataViewModel::ItemsAdded, |
316 | wxDataViewModel::ItemsDeleted, | |
317 | wxDataViewModel::ItemsChanged. | |
7c913512 | 318 | |
23324ae1 FM |
319 | Note that wxDataViewModel does not define the position or |
320 | index of any item in the control because different controls | |
321 | might display the same data differently. wxDataViewModel does | |
322 | provide a wxDataViewModel::Compare method | |
323 | which the wxDataViewCtrl may use to sort the data either | |
324 | in conjunction with a column header or without (see | |
325 | wxDataViewModel::HasDefaultCompare). | |
7c913512 FM |
326 | |
327 | This class maintains a list of | |
23324ae1 FM |
328 | wxDataViewModelNotifier |
329 | which link this class to the specific implementations on the | |
7c913512 | 330 | supported platforms so that e.g. calling |
23324ae1 | 331 | wxDataViewModel::ValueChanged |
7c913512 | 332 | on this model will just call |
23324ae1 | 333 | wxDataViewModelNotifier::ValueChanged |
7c913512 FM |
334 | for each notifier that has been added. You can also add |
335 | your own notifier in order to get informed about any changes | |
23324ae1 | 336 | to the data in the list model. |
7c913512 | 337 | |
23324ae1 | 338 | Currently wxWidgets provides the following models apart |
7c913512 | 339 | from the base model: |
23324ae1 FM |
340 | wxDataViewIndexListModel, |
341 | wxDataViewTreeStore. | |
7c913512 FM |
342 | |
343 | Note that wxDataViewModel is reference counted, derives from | |
23324ae1 FM |
344 | wxObjectRefData and cannot be deleted |
345 | directly as it can be shared by several wxDataViewCtrls. This | |
346 | implies that you need to decrease the reference count after | |
347 | associating the model with a control like this: | |
7c913512 | 348 | |
23324ae1 FM |
349 | @code |
350 | wxDataViewCtrl *musicCtrl = new wxDataViewCtrl( this, ID_MUSIC_CTRL ); | |
351 | wxDataViewModel *musicModel = new MyMusicModel; | |
352 | m_musicCtrl-AssociateModel( musicModel ); | |
353 | musicModel-DecRef(); // avoid memory leak !! | |
354 | // add columns now | |
355 | @endcode | |
7c913512 FM |
356 | |
357 | ||
23324ae1 FM |
358 | @library{wxadv} |
359 | @category{FIXME} | |
360 | */ | |
361 | class wxDataViewModel : public wxObjectRefData | |
362 | { | |
363 | public: | |
364 | /** | |
365 | Constructor. | |
366 | */ | |
367 | wxDataViewModel(); | |
368 | ||
369 | /** | |
370 | Destructor. This should not be called directly. Use DecRef() instead. | |
371 | */ | |
372 | ~wxDataViewModel(); | |
373 | ||
374 | /** | |
375 | Adds a wxDataViewModelNotifier | |
376 | to the model. | |
377 | */ | |
378 | void AddNotifier(wxDataViewModelNotifier* notifier); | |
379 | ||
380 | /** | |
381 | Called to inform the model that all data has been cleared. The | |
382 | control will reread the data from the model again. | |
383 | */ | |
384 | virtual bool Cleared(); | |
385 | ||
386 | /** | |
387 | The compare function to be used by control. The default compare function | |
388 | sorts by container and other items separately and in ascending order. | |
389 | Override this for a different sorting behaviour. | |
390 | ||
391 | See also HasDefaultCompare(). | |
392 | */ | |
393 | virtual int Compare(const wxDataViewItem& item1, | |
394 | const wxDataViewItem& item2, | |
395 | unsigned int column, | |
396 | bool ascending); | |
397 | ||
398 | /** | |
399 | Oberride this to indicate that the item has special font attributes. | |
7c913512 | 400 | This only affects the |
23324ae1 FM |
401 | wxDataViewTextRendererText renderer. |
402 | ||
403 | See also wxDataViewItemAttr. | |
404 | */ | |
405 | bool GetAttr(const wxDataViewItem& item, unsigned int col, | |
406 | wxDataViewItemAttr& attr); | |
407 | ||
408 | /** | |
409 | Override this so the control can query the child items of | |
410 | an item. Returns the number of items. | |
411 | */ | |
412 | virtual unsigned int GetChildren(const wxDataViewItem& item, | |
413 | wxDataViewItemArray& children); | |
414 | ||
415 | /** | |
416 | Override this to indicate the number of columns in the model. | |
417 | */ | |
418 | virtual unsigned int GetColumnCount(); | |
419 | ||
420 | /** | |
421 | Override this to indicate what type of data is stored in the | |
422 | column specified by @e col. This should return a string | |
423 | indicating the type of data as reported by wxVariant. | |
424 | */ | |
425 | virtual wxString GetColumnType(unsigned int col); | |
426 | ||
427 | /** | |
428 | Override this to indicate which wxDataViewItem representing the parent | |
429 | of @e item or an invalid wxDataViewItem if the the root item is | |
430 | the parent item. | |
431 | */ | |
432 | virtual wxDataViewItem GetParent(const wxDataViewItem& item); | |
433 | ||
434 | /** | |
435 | Override this to indicate the value of @e item | |
436 | A wxVariant is used to store the data. | |
437 | */ | |
438 | virtual void GetValue(wxVariant& variant, | |
439 | const wxDataViewItem& item, | |
440 | unsigned int col); | |
441 | ||
442 | /** | |
443 | Override this method to indicate if a container item merely | |
444 | acts as a headline (or for categorisation) or if it also | |
7c913512 | 445 | acts a normal item with entries for futher columns. By |
23324ae1 FM |
446 | default returns @e @false. |
447 | */ | |
448 | virtual bool HasContainerColumns(const wxDataViewItem& item); | |
449 | ||
450 | /** | |
451 | Override this to indicate that the model provides a default compare | |
452 | function that the control should use if no wxDataViewColumn has been | |
453 | chosen for sorting. Usually, the user clicks on a column header for | |
454 | sorting, the data will be sorted alphanumerically. If any other | |
455 | order (e.g. by index or order of appearance) is required, then this | |
456 | should be used. See also wxDataViewIndexListModel | |
457 | for a model which makes use of this. | |
458 | */ | |
459 | virtual bool HasDefaultCompare(); | |
460 | ||
461 | /** | |
462 | Override this to indicate of @e item is a container, i.e. if | |
463 | it can have child items. | |
464 | */ | |
465 | virtual bool IsContainer(const wxDataViewItem& item); | |
466 | ||
467 | /** | |
468 | Call this to inform the model that an item has been added | |
469 | to the data. | |
470 | */ | |
471 | virtual bool ItemAdded(const wxDataViewItem& parent, | |
472 | const wxDataViewItem& item); | |
473 | ||
474 | /** | |
475 | Call this to inform the model that an item has changed. | |
476 | ||
477 | This will eventually emit a wxEVT_DATAVIEW_ITEM_VALUE_CHANGED | |
478 | event (in which the column fields will not be set) to the user. | |
479 | */ | |
480 | virtual bool ItemChanged(const wxDataViewItem& item); | |
481 | ||
482 | /** | |
483 | Call this to inform the model that an item has been deleted from the data. | |
484 | */ | |
485 | virtual bool ItemDeleted(const wxDataViewItem& parent, | |
486 | const wxDataViewItem& item); | |
487 | ||
488 | /** | |
489 | Call this to inform the model that several items have been added | |
490 | to the data. | |
491 | */ | |
492 | virtual bool ItemsAdded(const wxDataViewItem& parent, | |
493 | const wxDataViewItemArray& items); | |
494 | ||
495 | /** | |
496 | Call this to inform the model that several items have changed. | |
497 | ||
498 | This will eventually emit wxEVT_DATAVIEW_ITEM_VALUE_CHANGED | |
499 | events (in which the column fields will not be set) to the user. | |
500 | */ | |
501 | virtual bool ItemsChanged(const wxDataViewItemArray& items); | |
502 | ||
503 | /** | |
504 | Call this to inform the model that several items have been deleted. | |
505 | */ | |
506 | virtual bool ItemsDeleted(const wxDataViewItem& parent, | |
507 | const wxDataViewItemArray& items); | |
508 | ||
509 | /** | |
510 | Remove the @e notifier from the list of notifiers. | |
511 | */ | |
512 | void RemoveNotifier(wxDataViewModelNotifier* notifier); | |
513 | ||
514 | /** | |
515 | Call this to initiate a resort after the sort function has | |
516 | been changed. | |
517 | */ | |
518 | virtual void Resort(); | |
519 | ||
520 | /** | |
521 | This gets called in order to set a value in the data model. | |
522 | The most common scenario is that the wxDataViewCtrl calls | |
523 | this method after the user changed some data in the view. | |
524 | Afterwards ValueChanged() | |
525 | has to be called! | |
526 | */ | |
527 | virtual bool SetValue(const wxVariant& variant, | |
528 | const wxDataViewItem& item, | |
529 | unsigned int col); | |
530 | ||
531 | /** | |
532 | Call this to inform this model that a value in the model has | |
533 | been changed. This is also called from wxDataViewCtrl's | |
7c913512 | 534 | internal editing code, e.g. when editing a text field |
23324ae1 FM |
535 | in the control. |
536 | ||
537 | This will eventually emit a wxEVT_DATAVIEW_ITEM_VALUE_CHANGED | |
538 | event to the user. | |
539 | */ | |
540 | virtual bool ValueChanged(const wxDataViewItem& item, | |
541 | unsigned int col); | |
542 | }; | |
543 | ||
544 | ||
545 | /** | |
546 | @class wxDataViewCustomRenderer | |
547 | @wxheader{dataview.h} | |
7c913512 | 548 | |
23324ae1 | 549 | You need to derive a new class from wxDataViewCustomRenderer in |
7c913512 | 550 | order to write a new renderer. You need to override at least |
23324ae1 | 551 | wxDataViewRenderer::SetValue, |
7c913512 | 552 | wxDataViewRenderer::GetValue, |
23324ae1 FM |
553 | wxDataViewCustomRenderer::GetSize |
554 | and wxDataViewCustomRenderer::Render. | |
7c913512 | 555 | |
23324ae1 | 556 | If you want your renderer to support in-place editing then you |
7c913512 | 557 | also need to override |
23324ae1 FM |
558 | wxDataViewCustomRenderer::HasEditorCtrl, |
559 | wxDataViewCustomRenderer::CreateEditorCtrl | |
560 | and wxDataViewCustomRenderer::GetValueFromEditorCtrl. | |
561 | Note that a special event handler will be pushed onto that | |
562 | editor control which handles ENTER and focus out events | |
563 | in order to end the editing. | |
7c913512 | 564 | |
23324ae1 FM |
565 | @library{wxadv} |
566 | @category{FIXME} | |
567 | */ | |
568 | class wxDataViewCustomRenderer : public wxDataViewRenderer | |
569 | { | |
570 | public: | |
571 | /** | |
572 | Constructor. | |
573 | */ | |
574 | wxDataViewCustomRenderer(const wxString& varianttype = "string", | |
575 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
576 | bool no_init = @false); | |
577 | ||
578 | /** | |
579 | Destructor. | |
580 | */ | |
581 | ~wxDataViewCustomRenderer(); | |
582 | ||
583 | /** | |
584 | Override this to react to double clicks or ENTER. | |
585 | */ | |
586 | virtual bool Activate(wxRect cell, wxDataViewModel* model, | |
587 | unsigned int col, | |
588 | unsigned int row); | |
589 | ||
590 | /** | |
591 | Override this to create the actual editor control once editing | |
592 | is about to start. @e parent is the parent of the editor | |
593 | control, @e labelRect indicates the position and | |
594 | size of the editor control and @e value is its initial value: | |
595 | */ | |
596 | virtual wxControl* CreateEditorCtrl(wxWindow * parent, | |
597 | wxRect labelRect, | |
598 | const wxVariant & value); | |
599 | ||
600 | /** | |
601 | Create DC on request. Internal. | |
602 | */ | |
603 | #define virtual wxDC* GetDC() /* implementation is private */ | |
604 | ||
605 | /** | |
606 | Return size required to show content. | |
607 | */ | |
608 | virtual wxSize GetSize(); | |
609 | ||
610 | /** | |
7c913512 | 611 | Overrride this so that the renderer can get the value |
23324ae1 FM |
612 | from the editor control (pointed to by @e editor): |
613 | */ | |
614 | virtual bool GetValueFromEditorCtrl(wxControl* editor, | |
615 | wxVariant & value); | |
616 | ||
617 | /** | |
618 | Override this and make it return @e @true in order to | |
619 | indicate that this renderer supports in-place editing. | |
620 | */ | |
621 | virtual bool HasEditorCtrl(); | |
622 | ||
623 | /** | |
624 | Overrride this to react to a left click. | |
625 | */ | |
626 | virtual bool LeftClick(wxPoint cursor, wxRect cell, | |
627 | wxDataViewModel* model, | |
628 | unsigned int col, | |
629 | unsigned int row); | |
630 | ||
631 | /** | |
632 | Override this to render the cell. Before this is called, | |
633 | wxDataViewRenderer::SetValue was called | |
634 | so that this instance knows what to render. | |
635 | */ | |
636 | virtual bool Render(wxRect cell, wxDC* dc, int state); | |
637 | ||
638 | /** | |
639 | This method should be called from within Render() | |
640 | whenever you need to render simple text. This will ensure that the | |
641 | correct colour, font and vertical alignment will be chosen so the | |
642 | text will look the same as text drawn by native renderers. | |
643 | */ | |
644 | bool RenderText(const wxString& text, int xoffset, wxRect cell, | |
645 | wxDC* dc, int state); | |
646 | ||
647 | /** | |
648 | Overrride this to react to a right click. | |
649 | */ | |
650 | virtual bool RightClick(wxPoint cursor, wxRect cell, | |
651 | wxDataViewModel* model, | |
652 | unsigned int col, | |
653 | unsigned int row); | |
654 | ||
655 | /** | |
656 | Overrride this to start a drag operation. | |
657 | */ | |
658 | virtual bool StartDrag(wxPoint cursor, wxRect cell, | |
659 | wxDataViewModel* model, | |
660 | unsigned int col, | |
661 | unsigned int row); | |
662 | }; | |
663 | ||
664 | ||
665 | /** | |
666 | @class wxDataViewBitmapRenderer | |
667 | @wxheader{dataview.h} | |
7c913512 | 668 | |
23324ae1 | 669 | wxDataViewBitmapRenderer |
7c913512 | 670 | |
23324ae1 FM |
671 | @library{wxadv} |
672 | @category{FIXME} | |
673 | */ | |
674 | class wxDataViewBitmapRenderer : public wxDataViewRenderer | |
675 | { | |
676 | public: | |
677 | /** | |
678 | ||
679 | */ | |
680 | wxDataViewBitmapRenderer(const wxString& varianttype = "wxBitmap", | |
681 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT); | |
682 | }; | |
683 | ||
684 | ||
685 | /** | |
686 | @class wxDataViewItemAttr | |
687 | @wxheader{dataview.h} | |
7c913512 | 688 | |
23324ae1 FM |
689 | This class is used to indicate to a wxDataViewCtrl |
690 | that a certain Item has extra font attributes | |
7c913512 | 691 | for its renderer. For this, it is required to override |
23324ae1 | 692 | wxDataViewModel::GetAttr. |
7c913512 FM |
693 | |
694 | Attributes are currently only supported by | |
23324ae1 | 695 | wxDataViewTextRendererText. |
7c913512 | 696 | |
23324ae1 FM |
697 | @library{wxadv} |
698 | @category{FIXME} | |
699 | */ | |
7c913512 | 700 | class wxDataViewItemAttr |
23324ae1 FM |
701 | { |
702 | public: | |
703 | /** | |
704 | Constructor. | |
705 | */ | |
706 | wxDataViewItemAttr(); | |
707 | ||
708 | /** | |
709 | Call this to indicate that the item shall be displayed in bold text. | |
710 | */ | |
711 | void SetBold(bool set); | |
712 | ||
713 | /** | |
714 | Call this to indicate that the item shall be displayed with | |
715 | that colour. | |
716 | */ | |
717 | void SetColour(const wxColour& colour); | |
718 | ||
719 | /** | |
720 | Call this to indicate that the item shall be displayed in italic text. | |
721 | */ | |
722 | void SetItalic(bool set); | |
723 | }; | |
724 | ||
725 | ||
726 | /** | |
727 | @class wxDataViewItem | |
728 | @wxheader{dataview.h} | |
7c913512 | 729 | |
23324ae1 FM |
730 | wxDataViewItem is a small opaque class that represents an |
731 | item in a wxDataViewCtrl in a | |
732 | persistent way, i.e. indepent of the position of the | |
733 | item in the control or changes to its contents. It must | |
734 | hold a unique ID of type @e void* in its only field | |
7c913512 FM |
735 | and can be converted to a from it. |
736 | ||
737 | If the ID is @e @NULL the wxDataViewItem is invalid and | |
23324ae1 FM |
738 | wxDataViewItem::IsOk will return @e @false |
739 | which used in many places in the API of wxDataViewCtrl | |
740 | to indicate that e.g. no item was found. An ID of @NULL | |
741 | is also used to indicate the invisible root. Examples | |
742 | for this are | |
743 | wxDataViewModel::GetParent and | |
744 | wxDataViewModel::GetChildren. | |
7c913512 | 745 | |
23324ae1 FM |
746 | @library{wxadv} |
747 | @category{FIXME} | |
748 | */ | |
7c913512 | 749 | class wxDataViewItem |
23324ae1 FM |
750 | { |
751 | public: | |
752 | //@{ | |
753 | /** | |
754 | ||
755 | */ | |
756 | wxDataViewItem(void* id = @NULL); | |
7c913512 | 757 | wxDataViewItem(const wxDataViewItem& item); |
23324ae1 FM |
758 | //@} |
759 | ||
760 | /** | |
761 | Returns the ID. | |
762 | */ | |
763 | #define void* GetID() /* implementation is private */ | |
764 | ||
765 | /** | |
766 | Returns @true if the ID is not @e @NULL. | |
767 | */ | |
768 | #define bool IsOk() /* implementation is private */ | |
769 | }; | |
770 | ||
771 | ||
772 | /** | |
773 | @class wxDataViewCtrl | |
774 | @wxheader{dataview.h} | |
7c913512 | 775 | |
23324ae1 FM |
776 | wxDataViewCtrl is a control to display data either |
777 | in a tree like fashion or in a tabular form or both. | |
778 | If you only need to display a simple tree structure | |
779 | with an API more like the older wxTreeCtrl class, | |
780 | then the specialized wxDataViewTreeCtrl | |
781 | can be used. | |
7c913512 | 782 | |
23324ae1 FM |
783 | A wxDataViewItem is used |
784 | to represent a (visible) item in the control. | |
7c913512 FM |
785 | |
786 | Unlike wxListCtrl wxDataViewCtrl doesn't | |
23324ae1 | 787 | get its data from the user through virtual functions or by |
7c913512 | 788 | setting it directly. Instead you need to write your own |
23324ae1 FM |
789 | wxDataViewModel and associate |
790 | it with this control. Then you need to add a number of | |
791 | wxDataViewColumn to this control to | |
792 | define what each column shall display. Each wxDataViewColumn | |
7c913512 | 793 | in turn owns 1 instance of a |
23324ae1 FM |
794 | wxDataViewRenderer to render its |
795 | cells. A number of standard renderers for rendering text, dates, | |
796 | images, toggle, a progress bar etc. are provided. Additionally, | |
7c913512 | 797 | the user can write custom renderes deriving from |
23324ae1 FM |
798 | wxDataViewCustomRenderer |
799 | for displaying anything. | |
7c913512 | 800 | |
23324ae1 FM |
801 | All data transfer from the control to the model and the user |
802 | code is done through wxVariant which can | |
7c913512 | 803 | be extended to support more data formats as necessary. |
23324ae1 FM |
804 | Accordingly, all type information uses the strings returned |
805 | from wxVariant::GetType. | |
7c913512 | 806 | |
23324ae1 FM |
807 | @beginStyleTable |
808 | @style{wxDV_SINGLE}: | |
809 | Single selection mode. This is the default. | |
810 | @style{wxDV_MULTIPLE}: | |
811 | Multiple selection mode. | |
812 | @style{wxDV_ROW_LINES}: | |
813 | Use alternating colours for rows if supported by platform and theme. | |
814 | @style{wxDV_HORIZ_RULES}: | |
815 | Display fine rules between row if supported. | |
816 | @style{wxDV_VERT_RULES}: | |
817 | Display fine rules between columns is supported. | |
818 | @endStyleTable | |
7c913512 | 819 | |
23324ae1 FM |
820 | @library{wxadv} |
821 | @category{ctrl} | |
822 | @appearance{dataviewctrl.png} | |
823 | */ | |
824 | class wxDataViewCtrl : public wxControl | |
825 | { | |
826 | public: | |
827 | //@{ | |
828 | /** | |
829 | Constructor. Calls Create(). | |
830 | */ | |
831 | wxDataViewCtrl(); | |
7c913512 FM |
832 | wxDataViewCtrl(wxWindow* parent, wxWindowID id, |
833 | const wxPoint& pos = wxDefaultPosition, | |
834 | const wxSize& size = wxDefaultSize, | |
835 | long style = 0, | |
836 | const wxValidator& validator = wxDefaultValidator); | |
23324ae1 FM |
837 | //@} |
838 | ||
839 | /** | |
840 | Destructor. | |
841 | */ | |
842 | ~wxDataViewCtrl(); | |
843 | ||
844 | //@{ | |
845 | /** | |
846 | Appends a column for rendering a bitmap. Returns the wxDataViewColumn | |
847 | created in the function or @NULL on failure. | |
848 | */ | |
849 | wxDataViewColumn* AppendBitmapColumn(const wxString& label, | |
850 | unsigned int model_column, | |
851 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
852 | int width = -1, | |
853 | wxAlignment align = wxALIGN_CENTER, | |
854 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
7c913512 FM |
855 | wxDataViewColumn* AppendBitmapColumn(const wxBitmap& label, |
856 | unsigned int model_column, | |
857 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
858 | int width = -1, | |
859 | wxAlignment align = wxALIGN_CENTER, | |
860 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
23324ae1 FM |
861 | //@} |
862 | ||
863 | /** | |
864 | Add a wxDataViewColumn to the control. Returns | |
865 | @e @true on success. | |
866 | ||
867 | Note that there is a number of short cut methods which implicitly create | |
7c913512 | 868 | a wxDataViewColumn and a |
23324ae1 FM |
869 | wxDataViewRenderer for it (see below). |
870 | */ | |
871 | virtual bool AppendColumn(wxDataViewColumn* col); | |
872 | ||
873 | //@{ | |
874 | /** | |
875 | Appends a column for rendering a date. Returns the wxDataViewColumn | |
876 | created in the function or @NULL on failure. | |
877 | */ | |
878 | wxDataViewColumn* AppendDateColumn(const wxString& label, | |
879 | unsigned int model_column, | |
880 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, | |
881 | int width = -1, | |
882 | wxAlignment align = wxALIGN_CENTER, | |
883 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
7c913512 FM |
884 | wxDataViewColumn* AppendDateColumn(const wxBitmap& label, |
885 | unsigned int model_column, | |
886 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, | |
887 | int width = -1, | |
888 | wxAlignment align = wxALIGN_CENTER, | |
889 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
23324ae1 FM |
890 | //@} |
891 | ||
892 | //@{ | |
893 | /** | |
894 | Appends a column for rendering text with an icon. Returns the wxDataViewColumn | |
7c913512 | 895 | created in the function or @NULL on failure. This uses the |
23324ae1 FM |
896 | wxDataViewIconTextRenderer. |
897 | */ | |
898 | wxDataViewColumn* AppendIconTextColumn(const wxString& label, | |
899 | unsigned int model_column, | |
900 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
901 | int width = -1, | |
902 | wxAlignment align = wxALIGN_LEFT, | |
903 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
7c913512 FM |
904 | wxDataViewColumn* AppendIconTextColumn(const wxBitmap& label, |
905 | unsigned int model_column, | |
906 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
907 | int width = -1, | |
908 | wxAlignment align = wxALIGN_LEFT, | |
909 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
23324ae1 FM |
910 | //@} |
911 | ||
912 | //@{ | |
913 | /** | |
914 | Appends a column for rendering a progress indicator. Returns the | |
915 | wxDataViewColumn | |
916 | created in the function or @NULL on failure. | |
917 | */ | |
918 | wxDataViewColumn* AppendProgressColumn(const wxString& label, | |
919 | unsigned int model_column, | |
920 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
921 | int width = 80, | |
922 | wxAlignment align = wxALIGN_CENTER, | |
923 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
7c913512 FM |
924 | wxDataViewColumn* AppendProgressColumn(const wxBitmap& label, |
925 | unsigned int model_column, | |
926 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
927 | int width = 80, | |
928 | wxAlignment align = wxALIGN_CENTER, | |
929 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
23324ae1 FM |
930 | //@} |
931 | ||
932 | //@{ | |
933 | /** | |
934 | Appends a column for rendering text. Returns the wxDataViewColumn | |
935 | created in the function or @NULL on failure. | |
936 | */ | |
937 | wxDataViewColumn* AppendTextColumn(const wxString& label, | |
938 | unsigned int model_column, | |
939 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
940 | int width = -1, | |
941 | wxAlignment align = wxALIGN_LEFT, | |
942 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
7c913512 FM |
943 | wxDataViewColumn* AppendTextColumn(const wxBitmap& label, |
944 | unsigned int model_column, | |
945 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
946 | int width = -1, | |
947 | wxAlignment align = wxALIGN_LEFT, | |
948 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
23324ae1 FM |
949 | //@} |
950 | ||
951 | //@{ | |
952 | /** | |
953 | Appends a column for rendering a toggle. Returns the wxDataViewColumn | |
954 | created in the function or @NULL on failure. | |
955 | */ | |
956 | wxDataViewColumn* AppendToggleColumn(const wxString& label, | |
957 | unsigned int model_column, | |
958 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
959 | int width = 30, | |
960 | wxAlignment align = wxALIGN_CENTER, | |
961 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
7c913512 FM |
962 | wxDataViewColumn* AppendToggleColumn(const wxBitmap& label, |
963 | unsigned int model_column, | |
964 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
965 | int width = 30, | |
966 | wxAlignment align = wxALIGN_CENTER, | |
967 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
23324ae1 FM |
968 | //@} |
969 | ||
970 | /** | |
971 | Associates a wxDataViewModel with the | |
972 | control. This increases the reference count of the model by 1. | |
973 | */ | |
974 | virtual bool AssociateModel(wxDataViewModel* model); | |
975 | ||
976 | /** | |
977 | Removes all columns. | |
978 | */ | |
979 | virtual bool ClearColumns(); | |
980 | ||
981 | /** | |
982 | Unselects all rows. | |
983 | */ | |
984 | void ClearSelection(); | |
985 | ||
986 | /** | |
987 | Collapses the item. | |
988 | */ | |
989 | void Collapse(const wxDataViewItem & item); | |
990 | ||
991 | /** | |
992 | Create the control. Useful for two step creation. | |
993 | */ | |
994 | bool Create(wxWindow* parent, wxWindowID id, | |
995 | const wxPoint& pos = wxDefaultPosition, | |
996 | const wxSize& size = wxDefaultSize, | |
997 | long style = 0, | |
998 | const wxValidator& validator = wxDefaultValidator); | |
999 | ||
1000 | /** | |
1001 | Deletes given column. | |
1002 | */ | |
1003 | virtual bool DeleteColumn(const wxDataViewColumn* column); | |
1004 | ||
1005 | /** | |
1006 | Call this to ensure that the given item is visible. | |
1007 | */ | |
1008 | void EnsureVisible(const wxDataViewItem & item, | |
1009 | const wxDataViewColumn* column = @NULL); | |
1010 | ||
1011 | /** | |
1012 | Expands the item. | |
1013 | */ | |
1014 | void Expand(const wxDataViewItem & item); | |
1015 | ||
1016 | /** | |
7c913512 | 1017 | Returns pointer to the column. @e pos refers to the |
23324ae1 FM |
1018 | position in the control which may change after reordering |
1019 | columns by the user. | |
1020 | */ | |
1021 | virtual wxDataViewColumn* GetColumn(unsigned int pos); | |
1022 | ||
1023 | /** | |
1024 | Returns the number of columns. | |
1025 | */ | |
1026 | virtual unsigned int GetColumnCount(); | |
1027 | ||
1028 | /** | |
1029 | Returns the position of the column or -1 if not found in the control. | |
1030 | */ | |
1031 | virtual int GetColumnPosition(const wxDataViewColumn* column); | |
1032 | ||
1033 | /** | |
1034 | Returns column containing the expanders. | |
1035 | */ | |
1036 | wxDataViewColumn * GetExpanderColumn(); | |
1037 | ||
1038 | /** | |
1039 | Returns indentation. | |
1040 | */ | |
1041 | int GetIndent(); | |
1042 | ||
1043 | /** | |
1044 | Returns item rect. | |
1045 | */ | |
1046 | wxRect GetItemRect(const wxDataViewItem& item, | |
1047 | const wxDataViewColumn * col = @NULL); | |
1048 | ||
1049 | /** | |
1050 | Returns pointer to the data model associated with the | |
1051 | control (if any). | |
1052 | */ | |
1053 | virtual wxDataViewModel* GetModel(); | |
1054 | ||
1055 | /** | |
1056 | Returns first selected item or an invalid item if none is selected. | |
1057 | */ | |
1058 | wxDataViewItem GetSelection(); | |
1059 | ||
1060 | /** | |
1061 | Fills @e sel with currently selected items and returns | |
1062 | their number. | |
1063 | */ | |
1064 | int GetSelections(wxDataViewItemArray & sel); | |
1065 | ||
1066 | /** | |
1067 | Returns the wxDataViewColumn currently responsible for sorting | |
1068 | or @NULL if none has been selected. | |
1069 | */ | |
1070 | virtual wxDataViewColumn* GetSortingColumn(); | |
1071 | ||
1072 | /** | |
1073 | Hittest. | |
1074 | */ | |
1075 | void HitTest(const wxPoint& point, wxDataViewItem& item, | |
1076 | wxDataViewColumn *& col); | |
1077 | ||
1078 | /** | |
1079 | Return @true if the item is selected. | |
1080 | */ | |
1081 | bool IsSelected(const wxDataViewItem & item); | |
1082 | ||
1083 | /** | |
1084 | Select the given item. | |
1085 | */ | |
1086 | void Select(const wxDataViewItem & item); | |
1087 | ||
1088 | /** | |
1089 | Select all items. | |
1090 | */ | |
1091 | void SelectAll(); | |
1092 | ||
1093 | /** | |
1094 | Set which column shall contain the tree-like expanders. | |
1095 | */ | |
1096 | void SetExpanderColumn(wxDataViewColumn * col); | |
1097 | ||
1098 | /** | |
1099 | Sets the indendation. | |
1100 | */ | |
1101 | void SetIndent(int indent); | |
1102 | ||
1103 | /** | |
1104 | Sets the selection to the array of wxDataViewItems. | |
1105 | */ | |
1106 | void SetSelections(const wxDataViewItemArray & sel); | |
1107 | ||
1108 | /** | |
1109 | Unselect the given item. | |
1110 | */ | |
1111 | void Unselect(const wxDataViewItem & item); | |
1112 | ||
1113 | /** | |
1114 | Unselect all item. This method only has effect if multiple | |
1115 | selections are allowed. | |
1116 | */ | |
1117 | void UnselectAll(); | |
1118 | }; | |
1119 | ||
1120 | ||
1121 | /** | |
1122 | @class wxDataViewModelNotifier | |
1123 | @wxheader{dataview.h} | |
7c913512 | 1124 | |
23324ae1 FM |
1125 | A wxDataViewModelNotifier instance is owned by a |
1126 | wxDataViewModel | |
7c913512 | 1127 | and mirrors its notification interface. See |
23324ae1 FM |
1128 | the documentation of that class for further |
1129 | information. | |
7c913512 | 1130 | |
23324ae1 FM |
1131 | @library{wxbase} |
1132 | @category{FIXME} | |
1133 | */ | |
7c913512 | 1134 | class wxDataViewModelNotifier |
23324ae1 FM |
1135 | { |
1136 | public: | |
1137 | /** | |
1138 | Constructor. | |
1139 | */ | |
1140 | wxDataViewModelNotifier(); | |
1141 | ||
1142 | /** | |
1143 | Destructor. | |
1144 | */ | |
1145 | ~wxDataViewModelNotifier(); | |
1146 | ||
1147 | /** | |
1148 | Called by owning model. | |
1149 | */ | |
1150 | bool Cleared(); | |
1151 | ||
1152 | /** | |
1153 | Get owning wxDataViewModel. | |
1154 | */ | |
1155 | wxDataViewModel* GetOwner(); | |
1156 | ||
1157 | /** | |
1158 | Called by owning model. | |
1159 | */ | |
1160 | bool ItemAdded(const wxDataViewItem& parent, | |
1161 | const wxDataViewItem& item); | |
1162 | ||
1163 | /** | |
1164 | Called by owning model. | |
1165 | */ | |
1166 | bool ItemChanged(const wxDataViewItem& item); | |
1167 | ||
1168 | /** | |
1169 | Called by owning model. | |
1170 | */ | |
1171 | bool ItemDeleted(const wxDataViewItem& parent, | |
1172 | const wxDataViewItem& item); | |
1173 | ||
1174 | /** | |
1175 | Called by owning model. | |
1176 | */ | |
1177 | bool ItemsAdded(const wxDataViewItem& parent, | |
1178 | const wxDataViewItemArray& items); | |
1179 | ||
1180 | /** | |
1181 | Called by owning model. | |
1182 | */ | |
1183 | bool ItemsChanged(const wxDataViewItemArray& items); | |
1184 | ||
1185 | /** | |
1186 | Called by owning model. | |
1187 | */ | |
1188 | bool ItemsDeleted(const wxDataViewItem& parent, | |
1189 | const wxDataViewItemArray& items); | |
1190 | ||
1191 | /** | |
1192 | Called by owning model. | |
1193 | */ | |
1194 | void Resort(); | |
1195 | ||
1196 | /** | |
1197 | Set owner of this notifier. Used internally. | |
1198 | */ | |
1199 | void SetOwner(wxDataViewModel* owner); | |
1200 | ||
1201 | /** | |
1202 | Called by owning model. | |
1203 | */ | |
1204 | bool ValueChanged(const wxDataViewItem& item, unsigned int col); | |
1205 | }; | |
1206 | ||
1207 | ||
1208 | /** | |
1209 | @class wxDataViewRenderer | |
1210 | @wxheader{dataview.h} | |
7c913512 | 1211 | |
23324ae1 FM |
1212 | This class is used by wxDataViewCtrl to |
1213 | render the individual cells. One instance of a renderer class is | |
1214 | owned by wxDataViewColumn. There is | |
1215 | a number of ready-to-use renderers provided: | |
1216 | wxDataViewTextRenderer, | |
1217 | wxDataViewTextRendererAttr, | |
1218 | wxDataViewIconTextRenderer, | |
1219 | wxDataViewToggleRenderer, | |
1220 | wxDataViewProgressRenderer, | |
1221 | wxDataViewBitmapRenderer, | |
1222 | wxDataViewDateRenderer. | |
1223 | wxDataViewSpinRenderer. | |
7c913512 | 1224 | |
23324ae1 FM |
1225 | Additionally, the user can write own renderers by deriving from |
1226 | wxDataViewCustomRenderer. | |
7c913512 | 1227 | |
23324ae1 FM |
1228 | The @e wxDataViewCellMode flag controls, what actions |
1229 | the cell data allows. @e wxDATAVIEW_CELL_ACTIVATABLE | |
1230 | indicates that the user can double click the cell and | |
1231 | something will happen (e.g. a window for editing a date | |
1232 | will pop up). @e wxDATAVIEW_CELL_EDITABLE indicates | |
1233 | that the user can edit the data in-place, i.e. an control | |
1234 | will show up after a slow click on the cell. This behaviour | |
7c913512 | 1235 | is best known from changing the filename in most file |
23324ae1 | 1236 | managers etc. |
7c913512 FM |
1237 | |
1238 | ||
23324ae1 FM |
1239 | @code |
1240 | enum wxDataViewCellMode | |
1241 | { | |
1242 | wxDATAVIEW_CELL_INERT, | |
1243 | wxDATAVIEW_CELL_ACTIVATABLE, | |
1244 | wxDATAVIEW_CELL_EDITABLE | |
1245 | }; | |
1246 | @endcode | |
7c913512 | 1247 | |
23324ae1 FM |
1248 | The @e wxDataViewCellRenderState flag controls how the |
1249 | the renderer should display its contents in a cell: | |
7c913512 | 1250 | |
23324ae1 FM |
1251 | @code |
1252 | enum wxDataViewCellRenderState | |
1253 | { | |
1254 | wxDATAVIEW_CELL_SELECTED = 1, | |
1255 | wxDATAVIEW_CELL_PRELIT = 2, | |
1256 | wxDATAVIEW_CELL_INSENSITIVE = 4, | |
1257 | wxDATAVIEW_CELL_FOCUSED = 8 | |
1258 | }; | |
1259 | @endcode | |
7c913512 FM |
1260 | |
1261 | ||
23324ae1 FM |
1262 | @library{wxadv} |
1263 | @category{FIXME} | |
1264 | */ | |
1265 | class wxDataViewRenderer : public wxObject | |
1266 | { | |
1267 | public: | |
1268 | /** | |
1269 | Constructor. | |
1270 | */ | |
1271 | wxDataViewRenderer(const wxString& varianttype, | |
1272 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
1273 | int alignment = wxALIGN_LEFT|wxALIGN_CENTRE_VERTICAL); | |
1274 | ||
1275 | /** | |
1276 | Returns the cell mode. | |
1277 | */ | |
1278 | virtual wxDataViewCellMode GetMode(); | |
1279 | ||
1280 | /** | |
1281 | Returns pointer to the owning wxDataViewColumn. | |
1282 | */ | |
1283 | virtual wxDataViewColumn* GetOwner(); | |
1284 | ||
1285 | /** | |
1286 | This methods retrieves the value from the renderer in order to | |
1287 | transfer the value back to the data model. Returns @e @false | |
1288 | on failure. | |
1289 | */ | |
1290 | virtual bool GetValue(wxVariant& value); | |
1291 | ||
1292 | /** | |
1293 | Returns a string with the type of the wxVariant | |
1294 | supported by this renderer. | |
1295 | */ | |
1296 | virtual wxString GetVariantType(); | |
1297 | ||
1298 | /** | |
1299 | Sets the owning wxDataViewColumn. This | |
1300 | is usually called from within wxDataViewColumn. | |
1301 | */ | |
1302 | virtual void SetOwner(wxDataViewColumn* owner); | |
1303 | ||
1304 | /** | |
1305 | Set the value of the renderer (and thus its cell) to @e value. | |
1306 | The internal code will then render this cell with this data. | |
1307 | */ | |
1308 | virtual bool SetValue(const wxVariant& value); | |
1309 | ||
1310 | /** | |
1311 | Before data is committed to the data model, it is passed to this | |
1312 | method where it can be checked for validity. This can also be | |
1313 | used for checking a valid range or limiting the user input in | |
1314 | a certain aspect (e.g. max number of characters or only alphanumeric | |
1315 | input, ASCII only etc.). Return @e @false if the value is | |
1316 | not valid. | |
1317 | ||
1318 | Please note that due to implementation limitations, this validation | |
1319 | is done after the editing control already is destroyed and the | |
1320 | editing process finished. | |
1321 | */ | |
1322 | virtual bool Validate(wxVariant& value); | |
1323 | }; | |
1324 | ||
1325 | ||
1326 | /** | |
1327 | @class wxDataViewTextRenderer | |
1328 | @wxheader{dataview.h} | |
7c913512 | 1329 | |
23324ae1 FM |
1330 | wxDataViewTextRenderer is used for rendering text. It supports |
1331 | in-place editing if desired. | |
7c913512 | 1332 | |
23324ae1 FM |
1333 | @library{wxadv} |
1334 | @category{FIXME} | |
1335 | */ | |
1336 | class wxDataViewTextRenderer : public wxDataViewRenderer | |
1337 | { | |
1338 | public: | |
1339 | /** | |
1340 | ||
1341 | */ | |
1342 | wxDataViewTextRenderer(const wxString& varianttype = "string", | |
1343 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT); | |
1344 | }; | |
1345 | ||
1346 | ||
1347 | /** | |
1348 | @class wxDataViewProgressRenderer | |
1349 | @wxheader{dataview.h} | |
7c913512 | 1350 | |
23324ae1 | 1351 | wxDataViewProgressRenderer |
7c913512 | 1352 | |
23324ae1 FM |
1353 | @library{wxadv} |
1354 | @category{FIXME} | |
1355 | */ | |
1356 | class wxDataViewProgressRenderer : public wxDataViewRenderer | |
1357 | { | |
1358 | public: | |
1359 | /** | |
1360 | ||
1361 | */ | |
1362 | wxDataViewProgressRenderer(const wxString& label = wxEmptyString, | |
1363 | const wxString& varianttype = "long", | |
1364 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT); | |
1365 | }; | |
1366 | ||
1367 | ||
1368 | /** | |
1369 | @class wxDataViewSpinRenderer | |
1370 | @wxheader{dataview.h} | |
7c913512 | 1371 | |
23324ae1 FM |
1372 | This is a specialized renderer for rendering integer values. It |
1373 | supports modifying the values in-place by using a wxSpinCtrl. | |
1374 | The renderer only support variants of type @e long. | |
7c913512 | 1375 | |
23324ae1 FM |
1376 | @library{wxbase} |
1377 | @category{FIXME} | |
1378 | */ | |
1379 | class wxDataViewSpinRenderer : public wxDataViewCustomRenderer | |
1380 | { | |
1381 | public: | |
1382 | /** | |
1383 | Constructor. @e min and @e max indicate the minimum und | |
1384 | maximum values of for the wxSpinCtrl. | |
1385 | */ | |
1386 | wxDataViewSpinRenderer(int min, int max, | |
1387 | wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, | |
1388 | int alignment = wxDVR_DEFAULT_ALIGNMENT); | |
1389 | }; | |
1390 | ||
1391 | ||
1392 | /** | |
1393 | @class wxDataViewToggleRenderer | |
1394 | @wxheader{dataview.h} | |
7c913512 | 1395 | |
23324ae1 | 1396 | wxDataViewToggleRenderer |
7c913512 | 1397 | |
23324ae1 FM |
1398 | @library{wxadv} |
1399 | @category{FIXME} | |
1400 | */ | |
1401 | class wxDataViewToggleRenderer : public wxDataViewRenderer | |
1402 | { | |
1403 | public: | |
1404 | /** | |
1405 | ||
1406 | */ | |
1407 | wxDataViewToggleRenderer(const wxString& varianttype = "bool", | |
1408 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT); | |
1409 | }; | |
1410 | ||
1411 | ||
1412 | /** | |
1413 | @class wxDataViewTreeCtrl | |
1414 | @wxheader{dataview.h} | |
7c913512 | 1415 | |
23324ae1 FM |
1416 | This class is a wxDataViewCtrl which internally |
1417 | uses a wxDataViewTreeStore and forwards | |
1418 | most of its API to that class. Additionally, it uses a wxImageList | |
7c913512 | 1419 | to store a list of icons. The main purpose of this class is to look |
23324ae1 FM |
1420 | like a wxTreeCtrl to make a transition from it |
1421 | to the wxDataViewCtrl class simpler. | |
7c913512 | 1422 | |
23324ae1 FM |
1423 | @library{wxbase} |
1424 | @category{ctrl} | |
1425 | @appearance{dataviewtreectrl.png} | |
1426 | */ | |
1427 | class wxDataViewTreeCtrl : public wxDataViewCtrl | |
1428 | { | |
1429 | public: | |
1430 | //@{ | |
1431 | /** | |
1432 | Constructor. Calls Create(). | |
1433 | */ | |
1434 | wxDataViewTreeCtrl(); | |
7c913512 FM |
1435 | wxDataViewTreeCtrl(wxWindow* parent, wxWindowID id, |
1436 | const wxPoint& pos = wxDefaultPosition, | |
1437 | const wxSize& size = wxDefaultSize, | |
1438 | long style = wxDV_NO_HEADER, | |
1439 | const wxValidator& validator = wxDefaultValidator); | |
23324ae1 FM |
1440 | //@} |
1441 | ||
1442 | /** | |
1443 | Destructor. Deletes the image list if any. | |
1444 | */ | |
1445 | ~wxDataViewTreeCtrl(); | |
1446 | ||
1447 | /** | |
1448 | ||
1449 | */ | |
1450 | wxDataViewItem AppendContainer(const wxDataViewItem& parent, | |
1451 | const wxString& text, | |
1452 | int icon = -1, | |
1453 | int expanded = -1, | |
1454 | wxClientData* data = @NULL); | |
1455 | ||
1456 | /** | |
1457 | ||
1458 | */ | |
1459 | wxDataViewItem AppendItem(const wxDataViewItem& parent, | |
1460 | const wxString& text, | |
1461 | int icon = -1, | |
1462 | wxClientData* data = @NULL); | |
1463 | ||
1464 | /** | |
1465 | Creates the control and a wxDataViewTreeStore as | |
1466 | its internal model. | |
1467 | */ | |
1468 | bool Create(wxWindow* parent, wxWindowID id, | |
1469 | const wxPoint& pos = wxDefaultPosition, | |
1470 | const wxSize& size = wxDefaultSize, | |
1471 | long style = wxDV_NO_HEADER, | |
1472 | const wxValidator& validator = wxDefaultValidator); | |
1473 | ||
1474 | /** | |
1475 | Calls the identical method from wxDataViewTreeStore. | |
1476 | */ | |
1477 | void DeleteAllItems(); | |
1478 | ||
1479 | /** | |
1480 | Calls the identical method from wxDataViewTreeStore. | |
1481 | */ | |
1482 | void DeleteChildren(const wxDataViewItem& item); | |
1483 | ||
1484 | /** | |
1485 | Calls the identical method from wxDataViewTreeStore. | |
1486 | */ | |
1487 | void DeleteItem(const wxDataViewItem& item); | |
1488 | ||
1489 | /** | |
1490 | Calls the identical method from wxDataViewTreeStore. | |
1491 | */ | |
1492 | int GetChildCount(const wxDataViewItem& parent); | |
1493 | ||
1494 | /** | |
1495 | Returns the image list. | |
1496 | */ | |
1497 | wxImageList* GetImageList(); | |
1498 | ||
1499 | /** | |
1500 | Calls the identical method from wxDataViewTreeStore. | |
1501 | */ | |
1502 | wxClientData* GetItemData(const wxDataViewItem& item); | |
1503 | ||
1504 | /** | |
1505 | Calls the identical method from wxDataViewTreeStore. | |
1506 | */ | |
1507 | const wxIcon GetItemExpandedIcon(const wxDataViewItem& item); | |
1508 | ||
1509 | /** | |
1510 | Calls the identical method from wxDataViewTreeStore. | |
1511 | */ | |
1512 | const wxIcon GetItemIcon(const wxDataViewItem& item); | |
1513 | ||
1514 | /** | |
1515 | Calls the identical method from wxDataViewTreeStore. | |
1516 | */ | |
1517 | wxString GetItemText(const wxDataViewItem& item); | |
1518 | ||
1519 | /** | |
1520 | Calls the identical method from wxDataViewTreeStore. | |
1521 | */ | |
1522 | wxDataViewItem GetNthChild(const wxDataViewItem& parent, | |
1523 | unsigned int pos); | |
1524 | ||
1525 | //@{ | |
1526 | /** | |
1527 | Returns the store. | |
1528 | */ | |
1529 | wxDataViewTreeStore* GetStore(); | |
7c913512 | 1530 | const wxDataViewTreeStore* GetStore(); |
23324ae1 FM |
1531 | //@} |
1532 | ||
1533 | /** | |
1534 | Calls the same method from wxDataViewTreeStore but uess | |
1535 | and index position in the image list instead of a wxIcon. | |
1536 | */ | |
1537 | wxDataViewItem InsertContainer(const wxDataViewItem& parent, | |
1538 | const wxDataViewItem& previous, | |
1539 | const wxString& text, | |
1540 | int icon = -1, | |
1541 | int expanded = -1, | |
1542 | wxClientData* data = @NULL); | |
1543 | ||
1544 | /** | |
1545 | Calls the same method from wxDataViewTreeStore but uess | |
1546 | and index position in the image list instead of a wxIcon. | |
1547 | */ | |
1548 | wxDataViewItem InsertItem(const wxDataViewItem& parent, | |
1549 | const wxDataViewItem& previous, | |
1550 | const wxString& text, | |
1551 | int icon = -1, | |
1552 | wxClientData* data = @NULL); | |
1553 | ||
1554 | /** | |
1555 | Calls the same method from wxDataViewTreeStore but uess | |
1556 | and index position in the image list instead of a wxIcon. | |
1557 | */ | |
1558 | wxDataViewItem PrependContainer(const wxDataViewItem& parent, | |
1559 | const wxString& text, | |
1560 | int icon = -1, | |
1561 | int expanded = -1, | |
1562 | wxClientData* data = @NULL); | |
1563 | ||
1564 | /** | |
1565 | Calls the same method from wxDataViewTreeStore but uess | |
1566 | and index position in the image list instead of a wxIcon. | |
1567 | */ | |
1568 | wxDataViewItem PrependItem(const wxDataViewItem& parent, | |
1569 | const wxString& text, | |
1570 | int icon = -1, | |
1571 | wxClientData* data = @NULL); | |
1572 | ||
1573 | /** | |
1574 | Sets the image list. | |
1575 | */ | |
1576 | void SetImageList(wxImageList* imagelist); | |
1577 | ||
1578 | /** | |
1579 | Calls the identical method from wxDataViewTreeStore. | |
1580 | */ | |
1581 | void SetItemData(const wxDataViewItem& item, wxClientData* data); | |
1582 | ||
1583 | /** | |
1584 | Calls the identical method from wxDataViewTreeStore. | |
1585 | */ | |
1586 | void SetItemExpandedIcon(const wxDataViewItem& item, | |
1587 | const wxIcon& icon); | |
1588 | ||
1589 | /** | |
1590 | Calls the identical method from wxDataViewTreeStore. | |
1591 | */ | |
1592 | void SetItemIcon(const wxDataViewItem& item, const wxIcon& icon); | |
1593 | ||
1594 | /** | |
1595 | Calls the identical method from wxDataViewTreeStore. | |
1596 | */ | |
1597 | void SetItemText(const wxDataViewItem& item, | |
1598 | const wxString& text); | |
1599 | }; | |
1600 | ||
1601 | ||
1602 | /** | |
1603 | @class wxDataViewTreeStore | |
1604 | @wxheader{dataview.h} | |
7c913512 | 1605 | |
23324ae1 FM |
1606 | wxDataViewTreeStore is a specialised wxDataViewModel |
1607 | for displaying simple trees very much like wxTreeCtrl | |
1608 | does and it offers a similar API. This class actually stores the entire | |
1609 | tree (therefore its name) and implements all virtual methods from the base | |
1610 | class so it can be used directly without having to derive any class from it. | |
1611 | This comes at the price of much reduced flexibility. | |
7c913512 | 1612 | |
23324ae1 FM |
1613 | @library{wxadv} |
1614 | @category{FIXME} | |
1615 | */ | |
1616 | class wxDataViewTreeStore : public wxDataViewModel | |
1617 | { | |
1618 | public: | |
1619 | /** | |
1620 | Constructor. Creates the invisible root node internally. | |
1621 | */ | |
1622 | wxDataViewTreeStore(); | |
1623 | ||
1624 | /** | |
1625 | Destructor. | |
1626 | */ | |
1627 | ~wxDataViewTreeStore(); | |
1628 | ||
1629 | /** | |
1630 | Append a container. | |
1631 | */ | |
1632 | wxDataViewItem AppendContainer(const wxDataViewItem& parent, | |
1633 | const wxString& text, | |
1634 | const wxIcon& icon = wxNullIcon, | |
1635 | const wxIcon& expanded = wxNullIcon, | |
1636 | wxClientData* data = @NULL); | |
1637 | ||
1638 | /** | |
1639 | Append an item. | |
1640 | */ | |
1641 | wxDataViewItem AppendItem(const wxDataViewItem& parent, | |
1642 | const wxString& text, | |
1643 | const wxIcon& icon = wxNullIcon, | |
1644 | wxClientData* data = @NULL); | |
1645 | ||
1646 | /** | |
1647 | Delete all item in the model. | |
1648 | */ | |
1649 | void DeleteAllItems(); | |
1650 | ||
1651 | /** | |
1652 | Delete all children of the item, but not the item itself. | |
1653 | */ | |
1654 | void DeleteChildren(const wxDataViewItem& item); | |
1655 | ||
1656 | /** | |
1657 | Delete this item. | |
1658 | */ | |
1659 | void DeleteItem(const wxDataViewItem& item); | |
1660 | ||
1661 | /** | |
1662 | Return the number of children of item. | |
1663 | */ | |
1664 | int GetChildCount(const wxDataViewItem& parent); | |
1665 | ||
1666 | /** | |
1667 | Returns the client data asoociated with the item. | |
1668 | */ | |
1669 | wxClientData* GetItemData(const wxDataViewItem& item); | |
1670 | ||
1671 | /** | |
1672 | Returns the icon to display in expanded containers. | |
1673 | */ | |
1674 | const wxIcon GetItemExpandedIcon(const wxDataViewItem& item); | |
1675 | ||
1676 | /** | |
1677 | Returns the icon of the item. | |
1678 | */ | |
1679 | const wxIcon GetItemIcon(const wxDataViewItem& item); | |
1680 | ||
1681 | /** | |
1682 | Returns the text of the item. | |
1683 | */ | |
1684 | wxString GetItemText(const wxDataViewItem& item); | |
1685 | ||
1686 | /** | |
1687 | Returns the nth child item of item. | |
1688 | */ | |
1689 | wxDataViewItem GetNthChild(const wxDataViewItem& parent, | |
1690 | unsigned int pos); | |
1691 | ||
1692 | /** | |
1693 | Inserts a container after @e previous. | |
1694 | */ | |
1695 | wxDataViewItem InsertContainer(const wxDataViewItem& parent, | |
1696 | const wxDataViewItem& previous, | |
1697 | const wxString& text, | |
1698 | const wxIcon& icon = wxNullIcon, | |
1699 | const wxIcon& expanded = wxNullIcon, | |
1700 | wxClientData* data = @NULL); | |
1701 | ||
1702 | /** | |
1703 | Inserts an item after @e previous. | |
1704 | */ | |
1705 | wxDataViewItem InsertItem(const wxDataViewItem& parent, | |
1706 | const wxDataViewItem& previous, | |
1707 | const wxString& text, | |
1708 | const wxIcon& icon = wxNullIcon, | |
1709 | wxClientData* data = @NULL); | |
1710 | ||
1711 | /** | |
1712 | Inserts a container before the first child item or @e parent. | |
1713 | */ | |
1714 | wxDataViewItem PrependContainer(const wxDataViewItem& parent, | |
1715 | const wxString& text, | |
1716 | const wxIcon& icon = wxNullIcon, | |
1717 | const wxIcon& expanded = wxNullIcon, | |
1718 | wxClientData* data = @NULL); | |
1719 | ||
1720 | /** | |
1721 | Inserts an item before the first child item or @e parent. | |
1722 | */ | |
1723 | wxDataViewItem PrependItem(const wxDataViewItem& parent, | |
1724 | const wxString& text, | |
1725 | const wxIcon& icon = wxNullIcon, | |
1726 | wxClientData* data = @NULL); | |
1727 | ||
1728 | /** | |
1729 | Sets the client data associated with the item. | |
1730 | */ | |
1731 | void SetItemData(const wxDataViewItem& item, wxClientData* data); | |
1732 | ||
1733 | /** | |
1734 | Sets the expanded icon for the item. | |
1735 | */ | |
1736 | void SetItemExpandedIcon(const wxDataViewItem& item, | |
1737 | const wxIcon& icon); | |
1738 | ||
1739 | /** | |
1740 | Sets the icon for the item. | |
1741 | */ | |
1742 | void SetItemIcon(const wxDataViewItem& item, const wxIcon& icon); | |
1743 | }; | |
1744 | ||
1745 | ||
1746 | /** | |
1747 | @class wxDataViewDateRenderer | |
1748 | @wxheader{dataview.h} | |
7c913512 | 1749 | |
23324ae1 | 1750 | wxDataViewDateRenderer |
7c913512 | 1751 | |
23324ae1 FM |
1752 | @library{wxadv} |
1753 | @category{FIXME} | |
1754 | */ | |
1755 | class wxDataViewDateRenderer : public wxDataViewRenderer | |
1756 | { | |
1757 | public: | |
1758 | /** | |
1759 | ||
1760 | */ | |
1761 | wxDataViewDateRenderer(const wxString& varianttype = "datetime", | |
1762 | wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE); | |
1763 | }; | |
1764 | ||
1765 | ||
1766 | /** | |
1767 | @class wxDataViewTextRendererAttr | |
1768 | @wxheader{dataview.h} | |
7c913512 | 1769 | |
23324ae1 FM |
1770 | The same as wxDataViewTextRenderer but with |
1771 | support for font attributes. Font attributes are currently only supported | |
1772 | under GTK+ and MSW. | |
7c913512 | 1773 | |
23324ae1 FM |
1774 | See also wxDataViewModel::GetAttr and |
1775 | wxDataViewItemAttr. | |
7c913512 | 1776 | |
23324ae1 FM |
1777 | @library{wxadv} |
1778 | @category{FIXME} | |
1779 | */ | |
1780 | class wxDataViewTextRendererAttr : public wxDataViewTextRenderer | |
1781 | { | |
1782 | public: | |
1783 | /** | |
1784 | ||
1785 | */ | |
1786 | wxDataViewTextRendererAttr(const wxString& varianttype = "string", | |
1787 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, | |
1788 | int align = wxDVR_DEFAULT_ALIGNMENT); | |
1789 | }; | |
1790 | ||
1791 | ||
1792 | /** | |
1793 | @class wxDataViewColumn | |
1794 | @wxheader{dataview.h} | |
7c913512 | 1795 | |
23324ae1 FM |
1796 | This class represents a column in a wxDataViewCtrl. |
1797 | One wxDataViewColumn is bound to one column in the data model, | |
7c913512 FM |
1798 | to which the wxDataViewCtrl has been associated. |
1799 | ||
23324ae1 FM |
1800 | An instance of wxDataViewRenderer is used by |
1801 | this class to render its data. | |
7c913512 | 1802 | |
23324ae1 FM |
1803 | @library{wxadv} |
1804 | @category{FIXME} | |
1805 | */ | |
1806 | class wxDataViewColumn : public wxObject | |
1807 | { | |
1808 | public: | |
1809 | //@{ | |
1810 | /** | |
1811 | Constructors. | |
1812 | */ | |
1813 | wxDataViewColumn(const wxString& title, | |
1814 | wxDataViewRenderer* renderer, | |
1815 | unsigned int model_column, | |
1816 | int width = wxDVC_DEFAULT_WIDTH, | |
1817 | wxAlignment align = wxALIGN_CENTRE, | |
1818 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
7c913512 FM |
1819 | wxDataViewColumn(const wxBitmap& bitmap, |
1820 | wxDataViewRenderer* renderer, | |
1821 | unsigned int model_column, | |
1822 | int width = wxDVC_DEFAULT_WIDTH, | |
1823 | wxAlignment align = wxALIGN_CENTRE, | |
1824 | int flags = wxDATAVIEW_COL_RESIZABLE); | |
23324ae1 FM |
1825 | //@} |
1826 | ||
1827 | /** | |
1828 | Destructor. | |
1829 | */ | |
1830 | ~wxDataViewColumn(); | |
1831 | ||
1832 | /** | |
1833 | Returns the bitmap in the header of the column, if any. | |
1834 | */ | |
1835 | const wxBitmap GetBitmap(); | |
1836 | ||
1837 | /** | |
1838 | Returns the index of the column of the model, which this | |
1839 | wxDataViewColumn is displaying. | |
1840 | */ | |
1841 | unsigned int GetModelColumn(); | |
1842 | ||
1843 | /** | |
1844 | Returns the owning wxDataViewCtrl. | |
1845 | */ | |
1846 | wxDataViewCtrl* GetOwner(); | |
1847 | ||
1848 | /** | |
1849 | Returns the renderer of this wxDataViewColumn. | |
1850 | ||
1851 | See also wxDataViewRenderer. | |
1852 | */ | |
1853 | wxDataViewRenderer* GetRenderer(); | |
1854 | ||
1855 | /** | |
1856 | Returns @true if the column is reorderable. | |
1857 | */ | |
1858 | bool GetReorderable(); | |
1859 | ||
1860 | /** | |
1861 | Returns @true if the column is sortable. | |
1862 | ||
1863 | See SetSortable() | |
1864 | */ | |
1865 | bool GetSortable(); | |
1866 | ||
1867 | /** | |
1868 | Returns the width of the column. | |
1869 | */ | |
1870 | int GetWidth(); | |
1871 | ||
1872 | /** | |
1873 | Returns @true, if the sort order is ascending. | |
1874 | ||
1875 | See also SetSortOrder() | |
1876 | */ | |
1877 | bool IsSortOrderAscending(); | |
1878 | ||
1879 | /** | |
1880 | Set the alignment of the column header. | |
1881 | */ | |
1882 | void SetAlignment(wxAlignment align); | |
1883 | ||
1884 | /** | |
1885 | Set the bitmap of the column header. | |
1886 | */ | |
1887 | void SetBitmap(const wxBitmap& bitmap); | |
1888 | ||
1889 | /** | |
1890 | Indicate wether the column can be reordered by the | |
7c913512 | 1891 | user using the mouse. This is typically implemented |
23324ae1 FM |
1892 | visually by dragging the header button around. |
1893 | */ | |
1894 | void SetReorderable(bool reorderable); | |
1895 | ||
1896 | /** | |
1897 | Indicate the sort order if the implementation of the | |
1898 | wxDataViewCtrl supports it, most commonly by showing | |
1899 | a little arrow. | |
1900 | */ | |
1901 | void SetSortOrder(bool ascending); | |
1902 | ||
1903 | /** | |
1904 | Indicate that the column is sortable. This does | |
1905 | not show any sorting indicate yet, but it does | |
7c913512 | 1906 | make the column header clickable. Call |
23324ae1 FM |
1907 | SetSortOrder() |
1908 | afterwards to actually make the sort indicator appear. | |
1909 | If @e sortable is @false, the column header is | |
1910 | no longer clickable and the sort indicator (little | |
1911 | arrow) will disappear. | |
1912 | */ | |
1913 | void SetSortable(bool sortable); | |
1914 | ||
1915 | /** | |
1916 | Set the title of the column header to @e title. | |
1917 | */ | |
1918 | void SetTitle(const wxString& title); | |
1919 | }; |