1//---------------------------------------------------------------------------
2// This file is generated by wxPython's SIP generator.  Do not edit by hand.
3//
4// Copyright: (c) 2018 by Total Control Software
5// License:   wxWindows License
6//
7// This file will be included by _dataview.sip
8//
9//---------------------------------------------------------------------------
10
11%ModuleHeaderCode
12#include <wx/dataview.h>
13%End
14
15
16//---------------------------------------------------------------------------
17
18const int wxDVC_DEFAULT_RENDERER_SIZE;
19const int wxDVC_DEFAULT_WIDTH;
20const int wxDVC_TOGGLE_DEFAULT_WIDTH;
21const int wxDVC_DEFAULT_MINWIDTH;
22const int wxDVR_DEFAULT_ALIGNMENT;
23const int wxDV_SINGLE;
24const int wxDV_MULTIPLE;
25const int wxDV_NO_HEADER;
26const int wxDV_HORIZ_RULES;
27const int wxDV_VERT_RULES;
28const int wxDV_ROW_LINES;
29const int wxDV_VARIABLE_LINE_HEIGHT;
30enum wxDataViewCellMode
31{
32    wxDATAVIEW_CELL_INERT,
33    wxDATAVIEW_CELL_ACTIVATABLE,
34    wxDATAVIEW_CELL_EDITABLE
35};
36
37enum wxDataViewCellRenderState
38{
39    wxDATAVIEW_CELL_SELECTED,
40    wxDATAVIEW_CELL_PRELIT,
41    wxDATAVIEW_CELL_INSENSITIVE,
42    wxDATAVIEW_CELL_FOCUSED
43};
44
45enum wxDataViewColumnFlags
46{
47    wxDATAVIEW_COL_RESIZABLE,
48    wxDATAVIEW_COL_SORTABLE,
49    wxDATAVIEW_COL_REORDERABLE,
50    wxDATAVIEW_COL_HIDDEN
51};
52
53wxEventType wxEVT_DATAVIEW_SELECTION_CHANGED   /PyName=wxEVT_DATAVIEW_SELECTION_CHANGED/;
54
55wxEventType wxEVT_DATAVIEW_ITEM_ACTIVATED   /PyName=wxEVT_DATAVIEW_ITEM_ACTIVATED/;
56
57wxEventType wxEVT_DATAVIEW_ITEM_COLLAPSING   /PyName=wxEVT_DATAVIEW_ITEM_COLLAPSING/;
58
59wxEventType wxEVT_DATAVIEW_ITEM_COLLAPSED   /PyName=wxEVT_DATAVIEW_ITEM_COLLAPSED/;
60
61wxEventType wxEVT_DATAVIEW_ITEM_EXPANDING   /PyName=wxEVT_DATAVIEW_ITEM_EXPANDING/;
62
63wxEventType wxEVT_DATAVIEW_ITEM_EXPANDED   /PyName=wxEVT_DATAVIEW_ITEM_EXPANDED/;
64
65wxEventType wxEVT_DATAVIEW_ITEM_START_EDITING   /PyName=wxEVT_DATAVIEW_ITEM_START_EDITING/;
66
67wxEventType wxEVT_DATAVIEW_ITEM_EDITING_STARTED   /PyName=wxEVT_DATAVIEW_ITEM_EDITING_STARTED/;
68
69wxEventType wxEVT_DATAVIEW_ITEM_EDITING_DONE   /PyName=wxEVT_DATAVIEW_ITEM_EDITING_DONE/;
70
71wxEventType wxEVT_DATAVIEW_ITEM_VALUE_CHANGED   /PyName=wxEVT_DATAVIEW_ITEM_VALUE_CHANGED/;
72
73wxEventType wxEVT_DATAVIEW_ITEM_CONTEXT_MENU   /PyName=wxEVT_DATAVIEW_ITEM_CONTEXT_MENU/;
74
75wxEventType wxEVT_DATAVIEW_COLUMN_HEADER_CLICK   /PyName=wxEVT_DATAVIEW_COLUMN_HEADER_CLICK/;
76
77wxEventType wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK   /PyName=wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK/;
78
79wxEventType wxEVT_DATAVIEW_COLUMN_SORTED   /PyName=wxEVT_DATAVIEW_COLUMN_SORTED/;
80
81wxEventType wxEVT_DATAVIEW_COLUMN_REORDERED   /PyName=wxEVT_DATAVIEW_COLUMN_REORDERED/;
82
83wxEventType wxEVT_DATAVIEW_CACHE_HINT   /PyName=wxEVT_DATAVIEW_CACHE_HINT/;
84
85wxEventType wxEVT_DATAVIEW_ITEM_BEGIN_DRAG   /PyName=wxEVT_DATAVIEW_ITEM_BEGIN_DRAG/;
86
87wxEventType wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE   /PyName=wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE/;
88
89wxEventType wxEVT_DATAVIEW_ITEM_DROP   /PyName=wxEVT_DATAVIEW_ITEM_DROP/;
90
91class wxDataViewItem
92{
93    %Docstring
94        DataViewItem()
95        DataViewItem(item)
96        DataViewItem(id)
97
98        wxDataViewItem is a small opaque class that represents an item in a
99        wxDataViewCtrl in a persistent way, i.e.
100    %End
101    %TypeHeaderCode
102        #include <wx/dataview.h>
103    %End
104
105public:
106    wxDataViewItem();
107
108    wxDataViewItem(
109        const wxDataViewItem & item
110    );
111
112    wxDataViewItem(
113        void * id
114    );
115
116    void * GetID() const;
117    %Docstring
118        GetID() -> void
119
120        Returns the ID.
121    %End
122
123    bool IsOk() const;
124    %Docstring
125        IsOk() -> bool
126
127        Returns true if the ID is not NULL.
128    %End
129
130    int __nonzero__();
131    %Docstring
132        __nonzero__() -> int
133    %End
134    %MethodCode
135        PyErr_Clear();
136        Py_BEGIN_ALLOW_THREADS
137        sipRes = _wxDataViewItem___nonzero__(sipCpp);
138        Py_END_ALLOW_THREADS
139        if (PyErr_Occurred()) sipIsErr = 1;
140    %End
141    %TypeCode
142    int _wxDataViewItem___nonzero__(wxDataViewItem* self)
143    {
144        return self->IsOk();
145    }
146    %End
147
148    int __bool__();
149    %Docstring
150        __bool__() -> int
151    %End
152    %MethodCode
153        PyErr_Clear();
154        Py_BEGIN_ALLOW_THREADS
155        sipRes = _wxDataViewItem___bool__(sipCpp);
156        Py_END_ALLOW_THREADS
157        if (PyErr_Occurred()) sipIsErr = 1;
158    %End
159    %TypeCode
160    int _wxDataViewItem___bool__(wxDataViewItem* self)
161    {
162        return self->IsOk();
163    }
164    %End
165
166    long __hash__();
167    %Docstring
168        __hash__() -> long
169    %End
170    %MethodCode
171        PyErr_Clear();
172        Py_BEGIN_ALLOW_THREADS
173        sipRes = _wxDataViewItem___hash__(sipCpp);
174        Py_END_ALLOW_THREADS
175        if (PyErr_Occurred()) sipIsErr = 1;
176    %End
177    %TypeCode
178    long _wxDataViewItem___hash__(wxDataViewItem* self)
179    {
180        return (long)self->GetID();
181    }
182    %End
183
184    bool __eq__(wxDataViewItem* other);
185    %Docstring
186        __eq__(other) -> bool
187    %End
188    %MethodCode
189        PyErr_Clear();
190        Py_BEGIN_ALLOW_THREADS
191        sipRes = _wxDataViewItem___eq__(sipCpp, other);
192        Py_END_ALLOW_THREADS
193        if (PyErr_Occurred()) sipIsErr = 1;
194    %End
195    %TypeCode
196    bool _wxDataViewItem___eq__(wxDataViewItem* self, wxDataViewItem* other)
197    {
198        return other ? (self->GetID() == other->GetID()) : false;
199    }
200    %End
201
202    bool __ne__(wxDataViewItem* other);
203    %Docstring
204        __ne__(other) -> bool
205    %End
206    %MethodCode
207        PyErr_Clear();
208        Py_BEGIN_ALLOW_THREADS
209        sipRes = _wxDataViewItem___ne__(sipCpp, other);
210        Py_END_ALLOW_THREADS
211        if (PyErr_Occurred()) sipIsErr = 1;
212    %End
213    %TypeCode
214    bool _wxDataViewItem___ne__(wxDataViewItem* self, wxDataViewItem* other)
215    {
216        return other ? (self->GetID() != other->GetID()) : true;
217    }
218    %End
219
220    public:
221
222
223    %Property(name=ID, get=GetID)
224};  // end of class wxDataViewItem
225
226
227class wxDataViewItemAttr
228{
229    %Docstring
230        DataViewItemAttr()
231
232        This class is used to indicate to a wxDataViewCtrl that a certain item
233        (see wxDataViewItem) has extra font attributes for its renderer.
234    %End
235    %TypeHeaderCode
236        #include <wx/dataview.h>
237    %End
238
239public:
240    wxDataViewItemAttr();
241
242    void SetBold(
243        bool set
244    );
245    %Docstring
246        SetBold(set)
247
248        Call this to indicate that the item shall be displayed in bold text.
249    %End
250
251    void SetColour(
252        const wxColour & colour
253    );
254    %Docstring
255        SetColour(colour)
256
257        Call this to indicate that the item shall be displayed with that
258        colour.
259    %End
260
261    void SetBackgroundColour(
262        const wxColour & colour
263    );
264    %Docstring
265        SetBackgroundColour(colour)
266
267        Call this to set the background colour to use.
268    %End
269
270    void SetItalic(
271        bool set
272    );
273    %Docstring
274        SetItalic(set)
275
276        Call this to indicate that the item shall be displayed in italic text.
277    %End
278
279    bool HasColour() const;
280    %Docstring
281        HasColour() -> bool
282
283        Returns true if the colour property has been set.
284    %End
285
286    const wxColour & GetColour() const;
287    %Docstring
288        GetColour() -> wx.Colour
289
290        Returns this attribute's colour.
291    %End
292
293    bool HasFont() const;
294    %Docstring
295        HasFont() -> bool
296
297        Returns true if any property affecting the font has been set.
298    %End
299
300    bool GetBold() const;
301    %Docstring
302        GetBold() -> bool
303
304        Returns value of the bold property.
305    %End
306
307    bool GetItalic() const;
308    %Docstring
309        GetItalic() -> bool
310
311        Returns value of the italics property.
312    %End
313
314    bool HasBackgroundColour() const;
315    %Docstring
316        HasBackgroundColour() -> bool
317
318        Returns true if the background colour property has been set.
319    %End
320
321    const wxColour & GetBackgroundColour() const;
322    %Docstring
323        GetBackgroundColour() -> wx.Colour
324
325        Returns the colour to be used for the background.
326    %End
327
328    bool IsDefault() const;
329    %Docstring
330        IsDefault() -> bool
331
332        Returns true if none of the properties have been set.
333    %End
334
335    wxFont GetEffectiveFont(
336        const wxFont & font
337    ) const;
338    %Docstring
339        GetEffectiveFont(font) -> wx.Font
340
341        Return the font based on the given one with this attribute applied to
342        it.
343    %End
344
345    public:
346
347
348    %Property(name=BackgroundColour, get=GetBackgroundColour, set=SetBackgroundColour)
349    %Property(name=Bold, get=GetBold, set=SetBold)
350    %Property(name=Colour, get=GetColour, set=SetColour)
351    %Property(name=Italic, get=GetItalic, set=SetItalic)
352};  // end of class wxDataViewItemAttr
353
354
355class wxDataViewIconText : wxObject
356{
357    %Docstring
358        DataViewIconText(text=wx.EmptyString, icon=wx.NullIcon)
359        DataViewIconText(other)
360
361        wxDataViewIconText is used by wxDataViewIconTextRenderer for data
362        transfer.
363    %End
364    %TypeHeaderCode
365        #include <wx/dataview.h>
366    %End
367
368public:
369    wxDataViewIconText(
370        const wxString & text = wxEmptyString,
371        const wxIcon & icon = wxNullIcon
372    );
373
374    wxDataViewIconText(
375        const wxDataViewIconText & other
376    );
377
378    const wxIcon & GetIcon() const;
379    %Docstring
380        GetIcon() -> wx.Icon
381
382        Gets the icon.
383    %End
384
385    wxString GetText() const;
386    %Docstring
387        GetText() -> String
388
389        Gets the text.
390    %End
391
392    void SetIcon(
393        const wxIcon & icon
394    );
395    %Docstring
396        SetIcon(icon)
397
398        Set the icon.
399    %End
400
401    void SetText(
402        const wxString & text
403    );
404    %Docstring
405        SetText(text)
406
407        Set the text.
408    %End
409
410    public:
411
412
413    %Property(name=Icon, get=GetIcon, set=SetIcon)
414    %Property(name=Text, get=GetText, set=SetText)
415};  // end of class wxDataViewIconText
416
417
418class wxDataViewModelNotifier
419{
420    %Docstring
421        DataViewModelNotifier()
422
423        A wxDataViewModelNotifier instance is owned by a wxDataViewModel and
424        mirrors its notification interface.
425    %End
426    %TypeHeaderCode
427        #include <wx/dataview.h>
428    %End
429
430public:
431    wxDataViewModelNotifier();
432
433    virtual
434    ~wxDataViewModelNotifier();
435
436    virtual
437    bool Cleared() = 0;
438    %Docstring
439        Cleared() -> bool
440
441        Called by owning model.
442    %End
443
444    wxDataViewModel * GetOwner() const;
445    %Docstring
446        GetOwner() -> DataViewModel
447
448        Get owning wxDataViewModel.
449    %End
450
451    virtual
452    bool ItemAdded(
453        const wxDataViewItem & parent,
454        const wxDataViewItem & item
455    ) = 0;
456    %Docstring
457        ItemAdded(parent, item) -> bool
458
459        Called by owning model.
460    %End
461
462    virtual
463    bool ItemChanged(
464        const wxDataViewItem & item
465    ) = 0;
466    %Docstring
467        ItemChanged(item) -> bool
468
469        Called by owning model.
470    %End
471
472    virtual
473    bool ItemDeleted(
474        const wxDataViewItem & parent,
475        const wxDataViewItem & item
476    ) = 0;
477    %Docstring
478        ItemDeleted(parent, item) -> bool
479
480        Called by owning model.
481    %End
482
483    virtual
484    bool ItemsAdded(
485        const wxDataViewItem & parent,
486        const wxDataViewItemArray & items
487    );
488    %Docstring
489        ItemsAdded(parent, items) -> bool
490
491        Called by owning model.
492    %End
493
494    virtual
495    bool ItemsChanged(
496        const wxDataViewItemArray & items
497    );
498    %Docstring
499        ItemsChanged(items) -> bool
500
501        Called by owning model.
502    %End
503
504    virtual
505    bool ItemsDeleted(
506        const wxDataViewItem & parent,
507        const wxDataViewItemArray & items
508    );
509    %Docstring
510        ItemsDeleted(parent, items) -> bool
511
512        Called by owning model.
513    %End
514
515    virtual
516    void Resort() = 0;
517    %Docstring
518        Resort()
519
520        Called by owning model.
521    %End
522
523    void SetOwner(
524        wxDataViewModel * owner
525    );
526    %Docstring
527        SetOwner(owner)
528
529        Set owner of this notifier.
530    %End
531
532    virtual
533    bool ValueChanged(
534        const wxDataViewItem & item,
535        unsigned int col
536    ) = 0;
537    %Docstring
538        ValueChanged(item, col) -> bool
539
540        Called by owning model.
541    %End
542
543    public:
544
545
546    %Property(name=Owner, get=GetOwner, set=SetOwner)
547};  // end of class wxDataViewModelNotifier
548
549
550class wxDataViewModel : wxRefCounter
551{
552    %Docstring
553        DataViewModel()
554
555        wxDataViewModel is the base class for all data model to be displayed
556        by a wxDataViewCtrl.
557    %End
558    %TypeHeaderCode
559        #include <wx/dataview.h>
560    %End
561
562public:
563    wxDataViewModel()   /Transfer/;
564
565    void AddNotifier(
566        wxDataViewModelNotifier * notifier   /Transfer/
567    );
568    %Docstring
569        AddNotifier(notifier)
570
571        Adds a wxDataViewModelNotifier to the model.
572    %End
573
574    bool ChangeValue(
575        const wxDVCVariant & variant,
576        const wxDataViewItem & item,
577        unsigned int col
578    );
579    %Docstring
580        ChangeValue(variant, item, col) -> bool
581
582        Change the value of the given item and update the control to reflect
583        it.
584    %End
585
586    bool Cleared();
587    %Docstring
588        Cleared() -> bool
589
590        Called to inform the model that all data has been cleared.
591    %End
592
593    virtual
594    int Compare(
595        const wxDataViewItem & item1,
596        const wxDataViewItem & item2,
597        unsigned int column,
598        bool ascending
599    ) const;
600    %Docstring
601        Compare(item1, item2, column, ascending) -> int
602
603        The compare function to be used by control.
604    %End
605
606    virtual
607    bool GetAttr(
608        const wxDataViewItem & item,
609        unsigned int col,
610        wxDataViewItemAttr & attr
611    ) const;
612    %Docstring
613        GetAttr(item, col, attr) -> bool
614
615        Override this to indicate that the item has special font attributes.
616    %End
617
618    virtual
619    bool IsEnabled(
620        const wxDataViewItem & item,
621        unsigned int col
622    ) const;
623    %Docstring
624        IsEnabled(item, col) -> bool
625
626        Override this to indicate that the item should be disabled.
627    %End
628
629    virtual
630    unsigned int GetChildren(
631        const wxDataViewItem & item,
632        wxDataViewItemArray & children
633    ) const = 0;
634    %Docstring
635        GetChildren(item, children) -> unsignedint
636
637        Override this so the control can query the child items of an item.
638    %End
639
640    virtual
641    unsigned int GetColumnCount() const = 0;
642    %Docstring
643        GetColumnCount() -> unsignedint
644
645        Override this to indicate the number of columns in the model.
646    %End
647
648    virtual
649    wxString GetColumnType(
650        unsigned int col
651    ) const = 0;
652    %Docstring
653        GetColumnType(col) -> String
654
655        Override this to indicate what type of data is stored in the column
656        specified by col.
657    %End
658
659    virtual
660    wxDataViewItem GetParent(
661        const wxDataViewItem & item
662    ) const = 0;
663    %Docstring
664        GetParent(item) -> DataViewItem
665
666        Override this to indicate which wxDataViewItem representing the parent
667        of item or an invalid wxDataViewItem if the root item is the parent
668        item.
669    %End
670
671    virtual
672    void GetValue(
673        wxDVCVariant & variant   /Out/,
674        const wxDataViewItem & item,
675        unsigned int col
676    ) const = 0;
677    %Docstring
678        GetValue(item, col) -> variant
679
680        Override this to indicate the value of item.
681    %End
682
683    virtual
684    bool HasContainerColumns(
685        const wxDataViewItem & item
686    ) const;
687    %Docstring
688        HasContainerColumns(item) -> bool
689
690        Override this method to indicate if a container item merely acts as a
691        headline (or for categorisation) or if it also acts a normal item with
692        entries for further columns.
693    %End
694
695    virtual
696    bool HasDefaultCompare() const;
697    %Docstring
698        HasDefaultCompare() -> bool
699
700        Override this to indicate that the model provides a default compare
701        function that the control should use if no wxDataViewColumn has been
702        chosen for sorting.
703    %End
704
705    bool HasValue(
706        const wxDataViewItem & item,
707        unsigned col
708    ) const;
709    %Docstring
710        HasValue(item, col) -> bool
711
712        Return true if there is a value in the given column of this item.
713    %End
714
715    virtual
716    bool IsContainer(
717        const wxDataViewItem & item
718    ) const = 0;
719    %Docstring
720        IsContainer(item) -> bool
721
722        Override this to indicate of item is a container, i.e. if it can have
723        child items.
724    %End
725
726    bool ItemAdded(
727        const wxDataViewItem & parent,
728        const wxDataViewItem & item
729    );
730    %Docstring
731        ItemAdded(parent, item) -> bool
732
733        Call this to inform the model that an item has been added to the data.
734    %End
735
736    bool ItemChanged(
737        const wxDataViewItem & item
738    );
739    %Docstring
740        ItemChanged(item) -> bool
741
742        Call this to inform the model that an item has changed.
743    %End
744
745    bool ItemDeleted(
746        const wxDataViewItem & parent,
747        const wxDataViewItem & item
748    );
749    %Docstring
750        ItemDeleted(parent, item) -> bool
751
752        Call this to inform the model that an item has been deleted from the
753        data.
754    %End
755
756    bool ItemsAdded(
757        const wxDataViewItem & parent,
758        const wxDataViewItemArray & items
759    );
760    %Docstring
761        ItemsAdded(parent, items) -> bool
762
763        Call this to inform the model that several items have been added to
764        the data.
765    %End
766
767    bool ItemsChanged(
768        const wxDataViewItemArray & items
769    );
770    %Docstring
771        ItemsChanged(items) -> bool
772
773        Call this to inform the model that several items have changed.
774    %End
775
776    bool ItemsDeleted(
777        const wxDataViewItem & parent,
778        const wxDataViewItemArray & items
779    );
780    %Docstring
781        ItemsDeleted(parent, items) -> bool
782
783        Call this to inform the model that several items have been deleted.
784    %End
785
786    void RemoveNotifier(
787        wxDataViewModelNotifier * notifier   /TransferBack/
788    );
789    %Docstring
790        RemoveNotifier(notifier)
791
792        Remove the notifier from the list of notifiers.
793    %End
794
795    virtual
796    void Resort();
797    %Docstring
798        Resort()
799
800        Call this to initiate a resort after the sort function has been
801        changed.
802    %End
803
804    virtual
805    bool SetValue(
806        const wxDVCVariant & variant,
807        const wxDataViewItem & item,
808        unsigned int col
809    ) = 0;
810    %Docstring
811        SetValue(variant, item, col) -> bool
812
813        This gets called in order to set a value in the data model.
814    %End
815
816    bool ValueChanged(
817        const wxDataViewItem & item,
818        unsigned int col
819    );
820    %Docstring
821        ValueChanged(item, col) -> bool
822
823        Call this to inform this model that a value in the model has been
824        changed.
825    %End
826
827    virtual
828    bool IsListModel() const;
829    %Docstring
830        IsListModel() -> bool
831    %End
832
833    virtual
834    bool IsVirtualListModel() const;
835    %Docstring
836        IsVirtualListModel() -> bool
837    %End
838
839    public:
840
841
842    %Property(name=ColumnCount, get=GetColumnCount)
843
844protected:
845    virtual
846    ~wxDataViewModel();
847
848};  // end of class wxDataViewModel
849
850
851class wxDataViewListModel : wxDataViewModel
852{
853    %Docstring
854        Base class with abstract API for wxDataViewIndexListModel and
855        wxDataViewVirtualListModel.
856    %End
857    %TypeHeaderCode
858        #include <wx/dataview.h>
859    %End
860
861public:
862    virtual
863    ~wxDataViewListModel();
864
865    virtual
866    int Compare(
867        const wxDataViewItem & item1,
868        const wxDataViewItem & item2,
869        unsigned int column,
870        bool ascending
871    ) const;
872    %Docstring
873        Compare(item1, item2, column, ascending) -> int
874
875        Compare method that sorts the items by their index.
876    %End
877
878    virtual
879    bool GetAttrByRow(
880        unsigned int row,
881        unsigned int col,
882        wxDataViewItemAttr & attr
883    ) const;
884    %Docstring
885        GetAttrByRow(row, col, attr) -> bool
886
887        Override this to indicate that the row has special font attributes.
888    %End
889
890    virtual
891    bool IsEnabledByRow(
892        unsigned int row,
893        unsigned int col
894    ) const;
895    %Docstring
896        IsEnabledByRow(row, col) -> bool
897
898        Override this if you want to disable specific items.
899    %End
900
901    virtual
902    unsigned int GetCount() const = 0;
903    %Docstring
904        GetCount() -> unsignedint
905
906        Returns the number of items (or rows) in the list.
907    %End
908
909    virtual
910    unsigned int GetRow(
911        const wxDataViewItem & item
912    ) const = 0;
913    %Docstring
914        GetRow(item) -> unsignedint
915
916        Returns the position of given item.
917    %End
918
919    virtual
920    void GetValueByRow(
921        wxDVCVariant & variant   /Out/,
922        unsigned int row,
923        unsigned int col
924    ) const = 0;
925    %Docstring
926        GetValueByRow(row, col) -> variant
927
928        Override this to allow getting values from the model.
929    %End
930
931    virtual
932    bool SetValueByRow(
933        const wxDVCVariant & variant,
934        unsigned int row,
935        unsigned int col
936    ) = 0;
937    %Docstring
938        SetValueByRow(variant, row, col) -> bool
939
940        Called in order to set a value in the model.
941    %End
942
943    public:
944
945
946    %Property(name=Count, get=GetCount)
947            virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const;
948            virtual bool IsContainer( const wxDataViewItem &item ) const;
949            virtual void GetValue( wxDVCVariant &variant /Out/, const wxDataViewItem &item, unsigned int col ) const [void ( wxDVCVariant &variant, const wxDataViewItem &item, unsigned int col )];
950            virtual bool SetValue( const wxDVCVariant &variant, const wxDataViewItem &item, unsigned int col );
951            virtual bool GetAttr(const wxDataViewItem &item, unsigned int col, wxDataViewItemAttr &attr) const;
952            virtual bool IsEnabled(const wxDataViewItem &item, unsigned int col) const;
953            virtual bool IsListModel() const;
954
955
956};  // end of class wxDataViewListModel
957
958
959class wxDataViewIndexListModel : wxDataViewListModel
960{
961    %Docstring
962        DataViewIndexListModel(initial_size=0)
963
964        wxDataViewIndexListModel is a specialized data model which lets you
965        address an item by its position (row) rather than its wxDataViewItem
966        (which you can obtain from this class).
967    %End
968    %TypeHeaderCode
969        #include <wx/dataview.h>
970    %End
971
972public:
973    wxDataViewIndexListModel(
974        unsigned int initial_size = 0
975    );
976
977    wxDataViewItem GetItem(
978        unsigned int row
979    ) const;
980    %Docstring
981        GetItem(row) -> DataViewItem
982
983        Returns the wxDataViewItem at the given row.
984    %End
985
986    void Reset(
987        unsigned int new_size
988    );
989    %Docstring
990        Reset(new_size)
991
992        Call this after if the data has to be read again from the model.
993    %End
994
995    void RowAppended();
996    %Docstring
997        RowAppended()
998
999        Call this after a row has been appended to the model.
1000    %End
1001
1002    void RowChanged(
1003        unsigned int row
1004    );
1005    %Docstring
1006        RowChanged(row)
1007
1008        Call this after a row has been changed.
1009    %End
1010
1011    void RowDeleted(
1012        unsigned int row
1013    );
1014    %Docstring
1015        RowDeleted(row)
1016
1017        Call this after a row has been deleted.
1018    %End
1019
1020    void RowInserted(
1021        unsigned int before
1022    );
1023    %Docstring
1024        RowInserted(before)
1025
1026        Call this after a row has been inserted at the given position.
1027    %End
1028
1029    void RowPrepended();
1030    %Docstring
1031        RowPrepended()
1032
1033        Call this after a row has been prepended to the model.
1034    %End
1035
1036    void RowValueChanged(
1037        unsigned int row,
1038        unsigned int col
1039    );
1040    %Docstring
1041        RowValueChanged(row, col)
1042
1043        Call this after a value has been changed.
1044    %End
1045
1046    void RowsDeleted(
1047        const wxArrayInt & rows
1048    );
1049    %Docstring
1050        RowsDeleted(rows)
1051
1052        Call this after rows have been deleted.
1053    %End
1054
1055                virtual unsigned int GetRow(const wxDataViewItem& item) const;
1056                virtual unsigned int GetCount() const;
1057                virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const;
1058
1059
1060};  // end of class wxDataViewIndexListModel
1061
1062
1063class wxDataViewVirtualListModel : wxDataViewListModel
1064{
1065    %Docstring
1066        DataViewVirtualListModel(initial_size=0)
1067
1068        wxDataViewVirtualListModel is a specialized data model which lets you
1069        address an item by its position (row) rather than its wxDataViewItem
1070        and as such offers the exact same interface as
1071        wxDataViewIndexListModel.
1072    %End
1073    %TypeHeaderCode
1074        #include <wx/dataview.h>
1075    %End
1076
1077public:
1078    wxDataViewVirtualListModel(
1079        unsigned int initial_size = 0
1080    );
1081
1082    wxDataViewItem GetItem(
1083        unsigned int row
1084    ) const;
1085    %Docstring
1086        GetItem(row) -> DataViewItem
1087
1088        Returns the wxDataViewItem at the given row.
1089    %End
1090
1091    void Reset(
1092        unsigned int new_size
1093    );
1094    %Docstring
1095        Reset(new_size)
1096
1097        Call this after if the data has to be read again from the model.
1098    %End
1099
1100    void RowAppended();
1101    %Docstring
1102        RowAppended()
1103
1104        Call this after a row has been appended to the model.
1105    %End
1106
1107    void RowChanged(
1108        unsigned int row
1109    );
1110    %Docstring
1111        RowChanged(row)
1112
1113        Call this after a row has been changed.
1114    %End
1115
1116    void RowDeleted(
1117        unsigned int row
1118    );
1119    %Docstring
1120        RowDeleted(row)
1121
1122        Call this after a row has been deleted.
1123    %End
1124
1125    void RowInserted(
1126        unsigned int before
1127    );
1128    %Docstring
1129        RowInserted(before)
1130
1131        Call this after a row has been inserted at the given position.
1132    %End
1133
1134    void RowPrepended();
1135    %Docstring
1136        RowPrepended()
1137
1138        Call this after a row has been prepended to the model.
1139    %End
1140
1141    void RowValueChanged(
1142        unsigned int row,
1143        unsigned int col
1144    );
1145    %Docstring
1146        RowValueChanged(row, col)
1147
1148        Call this after a value has been changed.
1149    %End
1150
1151    void RowsDeleted(
1152        const wxArrayInt & rows
1153    );
1154    %Docstring
1155        RowsDeleted(rows)
1156
1157        Call this after rows have been deleted.
1158    %End
1159
1160                virtual unsigned int GetRow(const wxDataViewItem& item) const;
1161                virtual unsigned int GetCount() const;
1162                virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const;
1163
1164
1165};  // end of class wxDataViewVirtualListModel
1166
1167
1168class wxDataViewRenderer : wxObject   /Abstract/
1169{
1170    %Docstring
1171        DataViewRenderer(varianttype, mode=DATAVIEW_CELL_INERT, align=DVR_DEFAULT_ALIGNMENT)
1172
1173        This class is used by wxDataViewCtrl to render the individual cells.
1174    %End
1175    %TypeHeaderCode
1176        #include <wx/dataview.h>
1177    %End
1178
1179public:
1180    wxDataViewRenderer(
1181        const wxString & varianttype,
1182        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1183        int align = wxDVR_DEFAULT_ALIGNMENT
1184    );
1185
1186    void EnableEllipsize(
1187        wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE
1188    );
1189    %Docstring
1190        EnableEllipsize(mode=wx.ELLIPSIZE_MIDDLE)
1191
1192        Enable or disable replacing parts of the item text with ellipsis to
1193        make it fit the column width.
1194    %End
1195
1196    void DisableEllipsize();
1197    %Docstring
1198        DisableEllipsize()
1199
1200        Disable replacing parts of the item text with ellipsis.
1201    %End
1202
1203    virtual
1204    int GetAlignment() const;
1205    %Docstring
1206        GetAlignment() -> int
1207
1208        Returns the alignment.
1209    %End
1210
1211    wxEllipsizeMode GetEllipsizeMode() const;
1212    %Docstring
1213        GetEllipsizeMode() -> EllipsizeMode
1214
1215        Returns the ellipsize mode used by the renderer.
1216    %End
1217
1218    virtual
1219    wxDataViewCellMode GetMode() const;
1220    %Docstring
1221        GetMode() -> DataViewCellMode
1222
1223        Returns the cell mode.
1224    %End
1225
1226    wxDataViewColumn * GetOwner() const;
1227    %Docstring
1228        GetOwner() -> DataViewColumn
1229
1230        Returns pointer to the owning wxDataViewColumn.
1231    %End
1232
1233    virtual
1234    void GetValue(
1235        wxDVCVariant& value   /Out/
1236    ) const = 0 [ bool (wxVariant& value) ];
1237    %Docstring
1238        GetValue() -> value
1239
1240        This methods retrieves the value from the renderer in order to
1241        transfer the value back to the data model.
1242    %End
1243
1244    wxString GetVariantType() const;
1245    %Docstring
1246        GetVariantType() -> String
1247
1248        Returns a string with the type of the wxVariant supported by this
1249        renderer.
1250    %End
1251
1252    virtual
1253    void SetAlignment(
1254        int align
1255    );
1256    %Docstring
1257        SetAlignment(align)
1258
1259        Sets the alignment of the renderer's content.
1260    %End
1261
1262    void SetOwner(
1263        wxDataViewColumn * owner
1264    );
1265    %Docstring
1266        SetOwner(owner)
1267
1268        Sets the owning wxDataViewColumn.
1269    %End
1270
1271    virtual
1272    bool SetValue(
1273        const wxDVCVariant& value
1274    ) = 0 [ bool (const wxVariant& value) ];
1275    %Docstring
1276        SetValue(value) -> bool
1277
1278        Set the value of the renderer (and thus its cell) to value.
1279    %End
1280
1281    virtual
1282    bool Validate(
1283        wxDVCVariant & value
1284    );
1285    %Docstring
1286        Validate(value) -> bool
1287
1288        Before data is committed to the data model, it is passed to this
1289        method where it can be checked for validity.
1290    %End
1291
1292    virtual
1293    bool HasEditorCtrl() const;
1294    %Docstring
1295        HasEditorCtrl() -> bool
1296    %End
1297
1298    virtual
1299    wxWindow * CreateEditorCtrl(
1300        wxWindow * parent,
1301        wxRect labelRect,
1302        const wxDVCVariant & value
1303    ) [ wxWindow* (wxWindow * parent, wxRect labelRect, const wxVariant& value) ];
1304    %Docstring
1305        CreateEditorCtrl(parent, labelRect, value) -> wx.Window
1306    %End
1307
1308    virtual
1309    void GetValueFromEditorCtrl(
1310        wxWindow * editor,
1311        wxDVCVariant& value   /Out/
1312    ) [ bool (wxWindow * editor, wxVariant& value) ];
1313    %Docstring
1314        GetValueFromEditorCtrl(editor) -> value
1315    %End
1316
1317    virtual
1318    bool StartEditing(
1319        const wxDataViewItem & item,
1320        wxRect labelRect
1321    );
1322    %Docstring
1323        StartEditing(item, labelRect) -> bool
1324    %End
1325
1326    virtual
1327    void CancelEditing();
1328    %Docstring
1329        CancelEditing()
1330    %End
1331
1332    virtual
1333    bool FinishEditing();
1334    %Docstring
1335        FinishEditing() -> bool
1336    %End
1337
1338    wxWindow * GetEditorCtrl();
1339    %Docstring
1340        GetEditorCtrl() -> wx.Window
1341    %End
1342
1343    private:
1344        wxDataViewRenderer(const wxDataViewRenderer&);
1345
1346
1347    public:
1348
1349
1350    %Property(name=Alignment, get=GetAlignment, set=SetAlignment)
1351    %Property(name=EditorCtrl, get=GetEditorCtrl)
1352    %Property(name=EllipsizeMode, get=GetEllipsizeMode)
1353    %Property(name=Mode, get=GetMode)
1354    %Property(name=Owner, get=GetOwner, set=SetOwner)
1355    %Property(name=VariantType, get=GetVariantType)
1356
1357protected:
1358    wxDataViewCtrl * GetView() const;
1359    %Docstring
1360        GetView() -> DataViewCtrl
1361    %End
1362
1363};  // end of class wxDataViewRenderer
1364
1365
1366class wxDataViewCustomRenderer : wxDataViewRenderer
1367{
1368    %Docstring
1369        DataViewCustomRenderer(varianttype="string", mode=DATAVIEW_CELL_INERT, align=DVR_DEFAULT_ALIGNMENT)
1370
1371        You need to derive a new class from wxDataViewCustomRenderer in order
1372        to write a new renderer.
1373    %End
1374    %TypeHeaderCode
1375        #include <wx/dataview.h>
1376    %End
1377
1378public:
1379    wxDataViewCustomRenderer(
1380        const wxString & varianttype = "string",
1381        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1382        int align = wxDVR_DEFAULT_ALIGNMENT
1383    );
1384
1385    virtual
1386    ~wxDataViewCustomRenderer();
1387
1388    virtual
1389    bool ActivateCell(
1390        const wxRect & cell,
1391        wxDataViewModel * model,
1392        const wxDataViewItem & item,
1393        unsigned int col,
1394        const wxMouseEvent * mouseEvent
1395    );
1396    %Docstring
1397        ActivateCell(cell, model, item, col, mouseEvent) -> bool
1398
1399        Override this to react to cell activation.
1400    %End
1401
1402    virtual
1403    wxWindow * CreateEditorCtrl(
1404        wxWindow * parent,
1405        wxRect labelRect,
1406        const wxDVCVariant & value
1407    ) [ wxWindow* (wxWindow * parent, wxRect labelRect, const wxVariant& value) ];
1408    %Docstring
1409        CreateEditorCtrl(parent, labelRect, value) -> wx.Window
1410
1411        Override this to create the actual editor control once editing is
1412        about to start.
1413    %End
1414
1415    const wxDataViewItemAttr & GetAttr() const;
1416    %Docstring
1417        GetAttr() -> DataViewItemAttr
1418
1419        Return the attribute to be used for rendering.
1420    %End
1421
1422    virtual
1423    wxSize GetSize() const = 0;
1424    %Docstring
1425        GetSize() -> wx.Size
1426
1427        Return size required to show content.
1428    %End
1429
1430    virtual
1431    void GetValueFromEditorCtrl(
1432        wxWindow * editor,
1433        wxDVCVariant& value   /Out/
1434    ) [ bool (wxWindow * editor, wxVariant& value) ];
1435    %Docstring
1436        GetValueFromEditorCtrl(editor) -> value
1437
1438        Override this so that the renderer can get the value from the editor
1439        control (pointed to by editor):
1440    %End
1441    %VirtualCatcherCode
1442        PyObject *sipResObj = sipCallMethod(&sipIsErr, sipMethod, "D", editor, sipType_wxWindow, NULL);
1443        if (sipResObj == NULL) {
1444            if (PyErr_Occurred())
1445                PyErr_Print();
1446            sipRes = false;
1447        }
1448        else if (sipResObj == Py_None) {
1449            sipRes = false;
1450        } else {
1451            sipRes = true;
1452            sipParseResult(&sipIsErr, sipMethod, sipResObj, "H5", sipType_wxDVCVariant, &value);
1453        }
1454    %End
1455
1456    virtual
1457    bool HasEditorCtrl() const;
1458    %Docstring
1459        HasEditorCtrl() -> bool
1460
1461        Override this and make it return true in order to indicate that this
1462        renderer supports in-place editing.
1463    %End
1464
1465    virtual
1466    bool LeftClick(
1467        wxPoint cursor,
1468        wxRect cell,
1469        wxDataViewModel * model,
1470        const wxDataViewItem & item,
1471        unsigned int col
1472    );
1473    %Docstring
1474        LeftClick(cursor, cell, model, item, col) -> bool
1475
1476        Override this to react to a left click.
1477    %End
1478
1479    virtual
1480    bool Activate(
1481        wxRect cell,
1482        wxDataViewModel * model,
1483        const wxDataViewItem & item,
1484        unsigned int col
1485    );
1486    %Docstring
1487        Activate(cell, model, item, col) -> bool
1488
1489        Override this to react to the activation of a cell.
1490    %End
1491
1492    virtual
1493    bool Render(
1494        wxRect cell,
1495        wxDC * dc,
1496        int state
1497    ) = 0;
1498    %Docstring
1499        Render(cell, dc, state) -> bool
1500
1501        Override this to render the cell.
1502    %End
1503
1504    void RenderText(
1505        const wxString & text,
1506        int xoffset,
1507        wxRect cell,
1508        wxDC * dc,
1509        int state
1510    );
1511    %Docstring
1512        RenderText(text, xoffset, cell, dc, state)
1513
1514        This method should be called from within Render() whenever you need to
1515        render simple text.
1516    %End
1517
1518    virtual
1519    bool StartDrag(
1520        const wxPoint & cursor,
1521        const wxRect & cell,
1522        wxDataViewModel * model,
1523        const wxDataViewItem & item,
1524        unsigned int col
1525    );
1526    %Docstring
1527        StartDrag(cursor, cell, model, item, col) -> bool
1528
1529        Override this to start a drag operation.
1530    %End
1531
1532    public:
1533
1534
1535    %Property(name=Attr, get=GetAttr)
1536    %Property(name=Size, get=GetSize)
1537
1538protected:
1539    wxSize GetTextExtent(
1540        const wxString & str
1541    ) const;
1542    %Docstring
1543        GetTextExtent(str) -> wx.Size
1544
1545        Helper for GetSize() implementations, respects attributes.
1546    %End
1547
1548};  // end of class wxDataViewCustomRenderer
1549
1550
1551class wxDataViewTextRenderer : wxDataViewRenderer
1552{
1553    %Docstring
1554        DataViewTextRenderer(varianttype="string", mode=DATAVIEW_CELL_INERT, align=DVR_DEFAULT_ALIGNMENT)
1555
1556        wxDataViewTextRenderer is used for rendering text.
1557    %End
1558    %TypeHeaderCode
1559        #include <wx/dataview.h>
1560    %End
1561
1562public:
1563    wxDataViewTextRenderer(
1564        const wxString & varianttype = "string",
1565        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1566        int align = wxDVR_DEFAULT_ALIGNMENT
1567    );
1568
1569                virtual bool SetValue( const wxDVCVariant &value ) [bool (const wxVariant& value)];
1570                virtual void GetValue( wxDVCVariant &value /Out/ ) const [bool (wxVariant& value)];
1571                %Property(name=Value, get=GetValue, set=SetValue)
1572
1573
1574};  // end of class wxDataViewTextRenderer
1575
1576
1577class wxDataViewIconTextRenderer : wxDataViewRenderer
1578{
1579    %Docstring
1580        DataViewIconTextRenderer(varianttype="wxDataViewIconText", mode=DATAVIEW_CELL_INERT, align=DVR_DEFAULT_ALIGNMENT)
1581
1582        The wxDataViewIconTextRenderer class is used to display text with a
1583        small icon next to it as it is typically done in a file manager.
1584    %End
1585    %TypeHeaderCode
1586        #include <wx/dataview.h>
1587    %End
1588
1589public:
1590    wxDataViewIconTextRenderer(
1591        const wxString & varianttype = "wxDataViewIconText",
1592        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1593        int align = wxDVR_DEFAULT_ALIGNMENT
1594    );
1595
1596                virtual bool SetValue( const wxDVCVariant &value ) [bool (const wxVariant& value)];
1597                virtual void GetValue( wxDVCVariant &value /Out/ ) const [bool (wxVariant& value)];
1598                %Property(name=Value, get=GetValue, set=SetValue)
1599
1600
1601};  // end of class wxDataViewIconTextRenderer
1602
1603
1604class wxDataViewProgressRenderer : wxDataViewRenderer
1605{
1606    %Docstring
1607        DataViewProgressRenderer(label=wx.EmptyString, varianttype="long", mode=DATAVIEW_CELL_INERT, align=DVR_DEFAULT_ALIGNMENT)
1608
1609        This class is used by wxDataViewCtrl to render progress bars.
1610    %End
1611    %TypeHeaderCode
1612        #include <wx/dataview.h>
1613    %End
1614
1615public:
1616    wxDataViewProgressRenderer(
1617        const wxString & label = wxEmptyString,
1618        const wxString & varianttype = "long",
1619        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1620        int align = wxDVR_DEFAULT_ALIGNMENT
1621    );
1622
1623                virtual bool SetValue( const wxDVCVariant &value ) [bool (const wxVariant& value)];
1624                virtual void GetValue( wxDVCVariant &value /Out/ ) const [bool (wxVariant& value)];
1625                %Property(name=Value, get=GetValue, set=SetValue)
1626
1627
1628};  // end of class wxDataViewProgressRenderer
1629
1630
1631class wxDataViewSpinRenderer : wxDataViewCustomRenderer
1632{
1633    %Docstring
1634        DataViewSpinRenderer(min, max, mode=DATAVIEW_CELL_EDITABLE, align=DVR_DEFAULT_ALIGNMENT)
1635
1636        This is a specialized renderer for rendering integer values.
1637    %End
1638    %TypeHeaderCode
1639        #include <wx/dataview.h>
1640    %End
1641
1642public:
1643    wxDataViewSpinRenderer(
1644        int min,
1645        int max,
1646        wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
1647        int align = wxDVR_DEFAULT_ALIGNMENT
1648    );
1649
1650                virtual bool SetValue( const wxDVCVariant &value ) [bool (const wxVariant& value)];
1651                virtual void GetValue( wxDVCVariant &value /Out/ ) const [bool (wxVariant& value)];
1652                %Property(name=Value, get=GetValue, set=SetValue)
1653
1654
1655            virtual wxSize GetSize() const;
1656            virtual bool Render(wxRect cell, wxDC* dc, int state);
1657
1658
1659};  // end of class wxDataViewSpinRenderer
1660
1661
1662class wxDataViewToggleRenderer : wxDataViewRenderer
1663{
1664    %Docstring
1665        DataViewToggleRenderer(varianttype="bool", mode=DATAVIEW_CELL_INERT, align=DVR_DEFAULT_ALIGNMENT)
1666
1667        This class is used by wxDataViewCtrl to render toggle controls.
1668    %End
1669    %TypeHeaderCode
1670        #include <wx/dataview.h>
1671    %End
1672
1673public:
1674    wxDataViewToggleRenderer(
1675        const wxString & varianttype = "bool",
1676        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1677        int align = wxDVR_DEFAULT_ALIGNMENT
1678    );
1679
1680                virtual bool SetValue( const wxDVCVariant &value ) [bool (const wxVariant& value)];
1681                virtual void GetValue( wxDVCVariant &value /Out/ ) const [bool (wxVariant& value)];
1682                %Property(name=Value, get=GetValue, set=SetValue)
1683
1684
1685};  // end of class wxDataViewToggleRenderer
1686
1687
1688class wxDataViewChoiceRenderer : wxDataViewRenderer
1689{
1690    %Docstring
1691        DataViewChoiceRenderer(choices, mode=DATAVIEW_CELL_EDITABLE, alignment=DVR_DEFAULT_ALIGNMENT)
1692
1693        A wxDataViewCtrl renderer using wxChoice control and values of strings
1694        in it.
1695    %End
1696    %TypeHeaderCode
1697        #include <wx/dataview.h>
1698    %End
1699
1700public:
1701    wxDataViewChoiceRenderer(
1702        const wxArrayString & choices,
1703        wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
1704        int alignment = wxDVR_DEFAULT_ALIGNMENT
1705    );
1706
1707    wxString GetChoice(
1708        size_t index
1709    ) const;
1710    %Docstring
1711        GetChoice(index) -> String
1712
1713        Returns the choice referred to by index.
1714    %End
1715
1716    const wxArrayString & GetChoices() const;
1717    %Docstring
1718        GetChoices() -> ArrayString
1719
1720        Returns all choices.
1721    %End
1722
1723    public:
1724
1725
1726    %Property(name=Choices, get=GetChoices)
1727                virtual bool SetValue( const wxDVCVariant &value ) [bool (const wxVariant& value)];
1728                virtual void GetValue( wxDVCVariant &value /Out/ ) const [bool (wxVariant& value)];
1729                %Property(name=Value, get=GetValue, set=SetValue)
1730
1731
1732};  // end of class wxDataViewChoiceRenderer
1733
1734
1735class wxDataViewDateRenderer : wxDataViewRenderer
1736{
1737    %Docstring
1738        DataViewDateRenderer(varianttype="datetime", mode=DATAVIEW_CELL_ACTIVATABLE, align=DVR_DEFAULT_ALIGNMENT)
1739
1740        This class is used by wxDataViewCtrl to render calendar controls.
1741    %End
1742    %TypeHeaderCode
1743        #include <wx/dataview.h>
1744    %End
1745
1746public:
1747    wxDataViewDateRenderer(
1748        const wxString & varianttype = "datetime",
1749        wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
1750        int align = wxDVR_DEFAULT_ALIGNMENT
1751    );
1752
1753                virtual bool SetValue( const wxDVCVariant &value ) [bool (const wxVariant& value)];
1754                virtual void GetValue( wxDVCVariant &value /Out/ ) const [bool (wxVariant& value)];
1755                %Property(name=Value, get=GetValue, set=SetValue)
1756
1757
1758};  // end of class wxDataViewDateRenderer
1759
1760
1761class wxDataViewBitmapRenderer : wxDataViewRenderer
1762{
1763    %Docstring
1764        DataViewBitmapRenderer(varianttype="wxBitmap", mode=DATAVIEW_CELL_INERT, align=DVR_DEFAULT_ALIGNMENT)
1765
1766        This class is used by wxDataViewCtrl to render bitmap controls.
1767    %End
1768    %TypeHeaderCode
1769        #include <wx/dataview.h>
1770    %End
1771
1772public:
1773    wxDataViewBitmapRenderer(
1774        const wxString & varianttype = "wxBitmap",
1775        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1776        int align = wxDVR_DEFAULT_ALIGNMENT
1777    );
1778
1779                virtual bool SetValue( const wxDVCVariant &value ) [bool (const wxVariant& value)];
1780                virtual void GetValue( wxDVCVariant &value /Out/ ) const [bool (wxVariant& value)];
1781                %Property(name=Value, get=GetValue, set=SetValue)
1782
1783
1784};  // end of class wxDataViewBitmapRenderer
1785
1786
1787class wxDataViewColumn : wxSettableHeaderColumn
1788{
1789    %Docstring
1790        DataViewColumn(title, renderer, model_column, width=DVC_DEFAULT_WIDTH, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE)
1791        DataViewColumn(bitmap, renderer, model_column, width=DVC_DEFAULT_WIDTH, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE)
1792
1793        This class represents a column in a wxDataViewCtrl.
1794    %End
1795    %TypeHeaderCode
1796        #include <wx/dataview.h>
1797    %End
1798
1799public:
1800    wxDataViewColumn(
1801        const wxString & title,
1802        wxDataViewRenderer * renderer   /Transfer/,
1803        unsigned int model_column,
1804        int width = wxDVC_DEFAULT_WIDTH,
1805        wxAlignment align = wxALIGN_CENTER,
1806        int flags = wxDATAVIEW_COL_RESIZABLE
1807    );
1808
1809    wxDataViewColumn(
1810        const wxBitmap & bitmap,
1811        wxDataViewRenderer * renderer   /Transfer/,
1812        unsigned int model_column,
1813        int width = wxDVC_DEFAULT_WIDTH,
1814        wxAlignment align = wxALIGN_CENTER,
1815        int flags = wxDATAVIEW_COL_RESIZABLE
1816    );
1817
1818    unsigned int GetModelColumn() const;
1819    %Docstring
1820        GetModelColumn() -> unsignedint
1821
1822        Returns the index of the column of the model, which this
1823        wxDataViewColumn is displaying.
1824    %End
1825
1826    wxDataViewCtrl * GetOwner() const;
1827    %Docstring
1828        GetOwner() -> DataViewCtrl
1829
1830        Returns the owning wxDataViewCtrl.
1831    %End
1832
1833    wxDataViewRenderer * GetRenderer() const;
1834    %Docstring
1835        GetRenderer() -> DataViewRenderer
1836
1837        Returns the renderer of this wxDataViewColumn.
1838    %End
1839
1840            virtual void SetTitle(const wxString& title);
1841            virtual wxString GetTitle() const;
1842            virtual void SetBitmap(const wxBitmap& bitmap);
1843            virtual wxBitmap GetBitmap() const;
1844            virtual void SetWidth(int width);
1845            virtual int GetWidth() const;
1846            virtual void SetMinWidth(int minWidth);
1847            virtual int GetMinWidth() const;
1848            virtual void SetAlignment(wxAlignment align);
1849            virtual wxAlignment GetAlignment() const;
1850            virtual void SetFlags(int flags);
1851            virtual int GetFlags() const;
1852            virtual bool IsSortKey() const;
1853            virtual void SetSortOrder(bool ascending);
1854            virtual bool IsSortOrderAscending() const;
1855
1856            virtual void SetResizeable(bool resizable);
1857            virtual void SetSortable(bool sortable);
1858            virtual void SetReorderable(bool reorderable);
1859            virtual void SetHidden(bool hidden);
1860
1861
1862    public:
1863
1864
1865    %Property(name=ModelColumn, get=GetModelColumn)
1866    %Property(name=Owner, get=GetOwner)
1867    %Property(name=Renderer, get=GetRenderer)
1868    %Property(name=Title, get=GetTitle, set=SetTitle)
1869    %Property(name=Bitmap, get=GetBitmap, set=SetBitmap)
1870    %Property(name=Width, get=GetWidth, set=SetWidth)
1871    %Property(name=MinWidth, get=GetMinWidth, set=SetMinWidth)
1872    %Property(name=Alignment, get=GetAlignment, set=SetAlignment)
1873    %Property(name=Flags, get=GetFlags, set=SetFlags)
1874    %Property(name=SortOrder, get=IsSortOrderAscending, set=SetSortOrder)
1875};  // end of class wxDataViewColumn
1876
1877
1878const char* wxDataViewCtrlNameStr;
1879
1880class wxDataViewCtrl : wxControl
1881{
1882    %Docstring
1883        DataViewCtrl()
1884        DataViewCtrl(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, validator=wx.DefaultValidator, name=DataViewCtrlNameStr)
1885
1886        wxDataViewCtrl is a control to display data either in a tree like
1887        fashion or in a tabular form or both.
1888    %End
1889    %TypeHeaderCode
1890        #include <wx/dataview.h>
1891    %End
1892
1893public:
1894    wxDataViewCtrl();
1895    %PreMethodCode
1896        if (!wxPyCheckForApp()) return NULL;
1897    %End
1898
1899    wxDataViewCtrl(
1900        wxWindow * parent   /TransferThis/,
1901        wxWindowID id = wxID_ANY,
1902        const wxPoint & pos = wxDefaultPosition,
1903        const wxSize & size = wxDefaultSize,
1904        long style = 0,
1905        const wxValidator & validator = wxDefaultValidator,
1906        const wxString & name = wxDataViewCtrlNameStr
1907    );
1908    %PreMethodCode
1909        if (!wxPyCheckForApp()) return NULL;
1910    %End
1911
1912    ~wxDataViewCtrl();
1913
1914    wxDataViewColumn * AppendBitmapColumn(
1915        const wxString & label,
1916        unsigned int model_column,
1917        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1918        int width = -1,
1919        wxAlignment align = wxALIGN_CENTER,
1920        int flags = wxDATAVIEW_COL_RESIZABLE
1921    );
1922    %Docstring
1923        AppendBitmapColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
1924        AppendBitmapColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
1925
1926        Appends a column for rendering a bitmap.
1927    %End
1928
1929    wxDataViewColumn * AppendBitmapColumn(
1930        const wxBitmap & label,
1931        unsigned int model_column,
1932        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1933        int width = -1,
1934        wxAlignment align = wxALIGN_CENTER,
1935        int flags = wxDATAVIEW_COL_RESIZABLE
1936    );
1937
1938    wxDataViewColumn * PrependBitmapColumn(
1939        const wxString & label,
1940        unsigned int model_column,
1941        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1942        int width = -1,
1943        wxAlignment align = wxALIGN_CENTER,
1944        int flags = wxDATAVIEW_COL_RESIZABLE
1945    );
1946    %Docstring
1947        PrependBitmapColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
1948        PrependBitmapColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
1949
1950        Prepends a column for rendering a bitmap.
1951    %End
1952
1953    wxDataViewColumn * PrependBitmapColumn(
1954        const wxBitmap & label,
1955        unsigned int model_column,
1956        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
1957        int width = -1,
1958        wxAlignment align = wxALIGN_CENTER,
1959        int flags = wxDATAVIEW_COL_RESIZABLE
1960    );
1961
1962    wxDataViewColumn * AppendDateColumn(
1963        const wxString & label,
1964        unsigned int model_column,
1965        wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
1966        int width = -1,
1967        wxAlignment align = wxALIGN_NOT,
1968        int flags = wxDATAVIEW_COL_RESIZABLE
1969    );
1970    %Docstring
1971        AppendDateColumn(label, model_column, mode=DATAVIEW_CELL_ACTIVATABLE, width=-1, align=wx.ALIGN_NOT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
1972        AppendDateColumn(label, model_column, mode=DATAVIEW_CELL_ACTIVATABLE, width=-1, align=wx.ALIGN_NOT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
1973
1974        Appends a column for rendering a date.
1975    %End
1976
1977    wxDataViewColumn * AppendDateColumn(
1978        const wxBitmap & label,
1979        unsigned int model_column,
1980        wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
1981        int width = -1,
1982        wxAlignment align = wxALIGN_NOT,
1983        int flags = wxDATAVIEW_COL_RESIZABLE
1984    );
1985
1986    wxDataViewColumn * PrependDateColumn(
1987        const wxString & label,
1988        unsigned int model_column,
1989        wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
1990        int width = -1,
1991        wxAlignment align = wxALIGN_NOT,
1992        int flags = wxDATAVIEW_COL_RESIZABLE
1993    );
1994    %Docstring
1995        PrependDateColumn(label, model_column, mode=DATAVIEW_CELL_ACTIVATABLE, width=-1, align=wx.ALIGN_NOT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
1996        PrependDateColumn(label, model_column, mode=DATAVIEW_CELL_ACTIVATABLE, width=-1, align=wx.ALIGN_NOT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
1997
1998        Prepends a column for rendering a date.
1999    %End
2000
2001    wxDataViewColumn * PrependDateColumn(
2002        const wxBitmap & label,
2003        unsigned int model_column,
2004        wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
2005        int width = -1,
2006        wxAlignment align = wxALIGN_NOT,
2007        int flags = wxDATAVIEW_COL_RESIZABLE
2008    );
2009
2010    wxDataViewColumn * AppendIconTextColumn(
2011        const wxString & label,
2012        unsigned int model_column,
2013        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2014        int width = -1,
2015        wxAlignment align = wxALIGN_NOT,
2016        int flags = wxDATAVIEW_COL_RESIZABLE
2017    );
2018    %Docstring
2019        AppendIconTextColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_NOT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2020        AppendIconTextColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_NOT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2021
2022        Appends a column for rendering text with an icon.
2023    %End
2024
2025    wxDataViewColumn * AppendIconTextColumn(
2026        const wxBitmap & label,
2027        unsigned int model_column,
2028        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2029        int width = -1,
2030        wxAlignment align = wxALIGN_NOT,
2031        int flags = wxDATAVIEW_COL_RESIZABLE
2032    );
2033
2034    wxDataViewColumn * PrependIconTextColumn(
2035        const wxString & label,
2036        unsigned int model_column,
2037        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2038        int width = -1,
2039        wxAlignment align = wxALIGN_NOT,
2040        int flags = wxDATAVIEW_COL_RESIZABLE
2041    );
2042    %Docstring
2043        PrependIconTextColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_NOT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2044        PrependIconTextColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_NOT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2045
2046        Prepends a column for rendering text with an icon.
2047    %End
2048
2049    wxDataViewColumn * PrependIconTextColumn(
2050        const wxBitmap & label,
2051        unsigned int model_column,
2052        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2053        int width = -1,
2054        wxAlignment align = wxALIGN_NOT,
2055        int flags = wxDATAVIEW_COL_RESIZABLE
2056    );
2057
2058    wxDataViewColumn * AppendProgressColumn(
2059        const wxString & label,
2060        unsigned int model_column,
2061        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2062        int width = 80,
2063        wxAlignment align = wxALIGN_CENTER,
2064        int flags = wxDATAVIEW_COL_RESIZABLE
2065    );
2066    %Docstring
2067        AppendProgressColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=80, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2068        AppendProgressColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=80, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2069
2070        Appends a column for rendering a progress indicator.
2071    %End
2072
2073    wxDataViewColumn * AppendProgressColumn(
2074        const wxBitmap & label,
2075        unsigned int model_column,
2076        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2077        int width = 80,
2078        wxAlignment align = wxALIGN_CENTER,
2079        int flags = wxDATAVIEW_COL_RESIZABLE
2080    );
2081
2082    wxDataViewColumn * PrependProgressColumn(
2083        const wxString & label,
2084        unsigned int model_column,
2085        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2086        int width = 80,
2087        wxAlignment align = wxALIGN_CENTER,
2088        int flags = wxDATAVIEW_COL_RESIZABLE
2089    );
2090    %Docstring
2091        PrependProgressColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=80, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2092        PrependProgressColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=80, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2093
2094        Prepends a column for rendering a progress indicator.
2095    %End
2096
2097    wxDataViewColumn * PrependProgressColumn(
2098        const wxBitmap & label,
2099        unsigned int model_column,
2100        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2101        int width = 80,
2102        wxAlignment align = wxALIGN_CENTER,
2103        int flags = wxDATAVIEW_COL_RESIZABLE
2104    );
2105
2106    wxDataViewColumn * AppendTextColumn(
2107        const wxString & label,
2108        unsigned int model_column,
2109        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2110        int width = -1,
2111        wxAlignment align = wxALIGN_NOT,
2112        int flags = wxDATAVIEW_COL_RESIZABLE
2113    );
2114    %Docstring
2115        AppendTextColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_NOT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2116        AppendTextColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_NOT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2117
2118        Appends a column for rendering text.
2119    %End
2120
2121    wxDataViewColumn * AppendTextColumn(
2122        const wxBitmap & label,
2123        unsigned int model_column,
2124        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2125        int width = -1,
2126        wxAlignment align = wxALIGN_NOT,
2127        int flags = wxDATAVIEW_COL_RESIZABLE
2128    );
2129
2130    wxDataViewColumn * PrependTextColumn(
2131        const wxString & label,
2132        unsigned int model_column,
2133        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2134        int width = -1,
2135        wxAlignment align = wxALIGN_NOT,
2136        int flags = wxDATAVIEW_COL_RESIZABLE
2137    );
2138    %Docstring
2139        PrependTextColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_NOT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2140        PrependTextColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_NOT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2141
2142        Prepends a column for rendering text.
2143    %End
2144
2145    wxDataViewColumn * PrependTextColumn(
2146        const wxBitmap & label,
2147        unsigned int model_column,
2148        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2149        int width = -1,
2150        wxAlignment align = wxALIGN_NOT,
2151        int flags = wxDATAVIEW_COL_RESIZABLE
2152    );
2153
2154    wxDataViewColumn * AppendToggleColumn(
2155        const wxString & label,
2156        unsigned int model_column,
2157        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2158        int width = 30,
2159        wxAlignment align = wxALIGN_CENTER,
2160        int flags = wxDATAVIEW_COL_RESIZABLE
2161    );
2162    %Docstring
2163        AppendToggleColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=30, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2164        AppendToggleColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=30, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2165
2166        Appends a column for rendering a toggle.
2167    %End
2168
2169    wxDataViewColumn * AppendToggleColumn(
2170        const wxBitmap & label,
2171        unsigned int model_column,
2172        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2173        int width = 30,
2174        wxAlignment align = wxALIGN_CENTER,
2175        int flags = wxDATAVIEW_COL_RESIZABLE
2176    );
2177
2178    wxDataViewColumn * PrependToggleColumn(
2179        const wxString & label,
2180        unsigned int model_column,
2181        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2182        int width = 30,
2183        wxAlignment align = wxALIGN_CENTER,
2184        int flags = wxDATAVIEW_COL_RESIZABLE
2185    );
2186    %Docstring
2187        PrependToggleColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=30, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2188        PrependToggleColumn(label, model_column, mode=DATAVIEW_CELL_INERT, width=30, align=wx.ALIGN_CENTER, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
2189
2190        Prepends a column for rendering a toggle.
2191    %End
2192
2193    wxDataViewColumn * PrependToggleColumn(
2194        const wxBitmap & label,
2195        unsigned int model_column,
2196        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
2197        int width = 30,
2198        wxAlignment align = wxALIGN_CENTER,
2199        int flags = wxDATAVIEW_COL_RESIZABLE
2200    );
2201
2202    bool Create(
2203        wxWindow * parent   /TransferThis/,
2204        wxWindowID id = wxID_ANY,
2205        const wxPoint & pos = wxDefaultPosition,
2206        const wxSize & size = wxDefaultSize,
2207        long style = 0,
2208        const wxValidator & validator = wxDefaultValidator,
2209        const wxString & name = wxDataViewCtrlNameStr
2210    );
2211    %Docstring
2212        Create(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, validator=wx.DefaultValidator, name=DataViewCtrlNameStr) -> bool
2213
2214        Create the control.
2215    %End
2216
2217    bool AppendColumn(
2218        wxDataViewColumn * col   /Transfer/
2219    );
2220    %Docstring
2221        AppendColumn(col) -> bool
2222
2223        Appends a wxDataViewColumn to the control.
2224    %End
2225
2226    bool PrependColumn(
2227        wxDataViewColumn * col   /Transfer/
2228    );
2229    %Docstring
2230        PrependColumn(col) -> bool
2231
2232        Prepends a wxDataViewColumn to the control.
2233    %End
2234
2235    bool InsertColumn(
2236        unsigned int pos,
2237        wxDataViewColumn * col   /Transfer/
2238    );
2239    %Docstring
2240        InsertColumn(pos, col) -> bool
2241
2242        Inserts a wxDataViewColumn to the control.
2243    %End
2244
2245    bool AssociateModel(
2246        wxDataViewModel * model   /Transfer/
2247    )   /PyName=_AssociateModel/;
2248    %Docstring
2249        _AssociateModel(model) -> bool
2250
2251        Associates a wxDataViewModel with the control.
2252    %End
2253
2254    bool ClearColumns();
2255    %Docstring
2256        ClearColumns() -> bool
2257
2258        Removes all columns.
2259    %End
2260
2261    void Collapse(
2262        const wxDataViewItem & item
2263    );
2264    %Docstring
2265        Collapse(item)
2266
2267        Collapses the item.
2268    %End
2269
2270    bool DeleteColumn(
2271        wxDataViewColumn * column
2272    );
2273    %Docstring
2274        DeleteColumn(column) -> bool
2275
2276        Deletes given column.
2277    %End
2278
2279    void EditItem(
2280        const wxDataViewItem & item,
2281        const wxDataViewColumn * column
2282    );
2283    %Docstring
2284        EditItem(item, column)
2285
2286        Programmatically starts editing given cell of item.
2287    %End
2288
2289    bool EnableDragSource(
2290        const wxDataFormat & format
2291    );
2292    %Docstring
2293        EnableDragSource(format) -> bool
2294
2295        Enable drag operations using the given format.
2296    %End
2297
2298    bool EnableDropTarget(
2299        const wxDataFormat & format
2300    );
2301    %Docstring
2302        EnableDropTarget(format) -> bool
2303
2304        Enable drop operations using the given format.
2305    %End
2306
2307    void EnsureVisible(
2308        const wxDataViewItem & item,
2309        const wxDataViewColumn * column = NULL
2310    );
2311    %Docstring
2312        EnsureVisible(item, column=None)
2313
2314        Call this to ensure that the given item is visible.
2315    %End
2316
2317    void Expand(
2318        const wxDataViewItem & item
2319    );
2320    %Docstring
2321        Expand(item)
2322
2323        Expands the item.
2324    %End
2325
2326    void ExpandAncestors(
2327        const wxDataViewItem & item
2328    );
2329    %Docstring
2330        ExpandAncestors(item)
2331
2332        Expands all ancestors of the item.
2333    %End
2334
2335    wxDataViewColumn * GetColumn(
2336        unsigned int pos
2337    ) const;
2338    %Docstring
2339        GetColumn(pos) -> DataViewColumn
2340
2341        Returns pointer to the column.
2342    %End
2343
2344    unsigned int GetColumnCount() const;
2345    %Docstring
2346        GetColumnCount() -> unsignedint
2347
2348        Returns the number of columns.
2349    %End
2350
2351    int GetColumnPosition(
2352        const wxDataViewColumn * column
2353    ) const;
2354    %Docstring
2355        GetColumnPosition(column) -> int
2356
2357        Returns the position of the column or -1 if not found in the control.
2358    %End
2359
2360    wxDataViewColumn * GetExpanderColumn() const;
2361    %Docstring
2362        GetExpanderColumn() -> DataViewColumn
2363
2364        Returns column containing the expanders.
2365    %End
2366
2367    wxDataViewItem GetCurrentItem() const;
2368    %Docstring
2369        GetCurrentItem() -> DataViewItem
2370
2371        Returns the currently focused item.
2372    %End
2373
2374    wxDataViewColumn * GetCurrentColumn() const;
2375    %Docstring
2376        GetCurrentColumn() -> DataViewColumn
2377
2378        Returns the column that currently has focus.
2379    %End
2380
2381    int GetIndent() const;
2382    %Docstring
2383        GetIndent() -> int
2384
2385        Returns indentation.
2386    %End
2387
2388    wxRect GetItemRect(
2389        const wxDataViewItem & item,
2390        const wxDataViewColumn * col = NULL
2391    ) const;
2392    %Docstring
2393        GetItemRect(item, col=None) -> wx.Rect
2394
2395        Returns item rectangle.
2396    %End
2397
2398    wxDataViewModel * GetModel();
2399    %Docstring
2400        GetModel() -> DataViewModel
2401
2402        Returns pointer to the data model associated with the control (if
2403        any).
2404    %End
2405
2406    int GetSelectedItemsCount() const;
2407    %Docstring
2408        GetSelectedItemsCount() -> int
2409
2410        Returns the number of currently selected items.
2411    %End
2412
2413    wxDataViewItem GetSelection() const;
2414    %Docstring
2415        GetSelection() -> DataViewItem
2416
2417        Returns first selected item or an invalid item if none is selected.
2418    %End
2419
2420    wxDataViewItemArray* GetSelections() const   /Factory/;
2421    %Docstring
2422        GetSelections() -> DataViewItemArray
2423
2424        Returns a list of the currently selected items.
2425    %End
2426    %MethodCode
2427        PyErr_Clear();
2428        Py_BEGIN_ALLOW_THREADS
2429        sipRes = _wxDataViewCtrl_GetSelections(sipCpp);
2430        Py_END_ALLOW_THREADS
2431        if (PyErr_Occurred()) sipIsErr = 1;
2432    %End
2433    %TypeCode
2434    wxDataViewItemArray* _wxDataViewCtrl_GetSelections(const wxDataViewCtrl* self)
2435    {
2436        wxDataViewItemArray* selections = new wxDataViewItemArray;
2437        self->GetSelections(*selections);
2438        return selections;
2439    }
2440    %End
2441
2442    wxDataViewColumn * GetSortingColumn() const;
2443    %Docstring
2444        GetSortingColumn() -> DataViewColumn
2445
2446        Returns the wxDataViewColumn currently responsible for sorting or NULL
2447        if none has been selected.
2448    %End
2449
2450    bool HasSelection() const;
2451    %Docstring
2452        HasSelection() -> bool
2453
2454        Returns true if any items are currently selected.
2455    %End
2456
2457    PyObject* HitTest(const wxPoint& point) const;
2458    %Docstring
2459        HitTest(point) -> PyObject
2460
2461        HitTest(point) -> (item, col)
2462
2463        Returns the item and column located at point, as a 2 element tuple.
2464    %End
2465    %MethodCode
2466        PyErr_Clear();
2467        Py_BEGIN_ALLOW_THREADS
2468        sipRes = _wxDataViewCtrl_HitTest(sipCpp, point);
2469        Py_END_ALLOW_THREADS
2470        if (PyErr_Occurred()) sipIsErr = 1;
2471    %End
2472    %TypeCode
2473    PyObject* _wxDataViewCtrl_HitTest(const wxDataViewCtrl* self, const wxPoint* point)
2474    {
2475        wxDataViewItem*   item = new wxDataViewItem();;
2476        wxDataViewColumn* col = NULL;
2477
2478        self->HitTest(*point, *item, col);
2479
2480        wxPyThreadBlocker blocker;
2481        PyObject* value = PyTuple_New(2);
2482        PyObject* item_obj =
2483            wxPyConstructObject((void*)item, wxT("wxDataViewItem"), 1);   // owned
2484        PyObject* col_obj;
2485        if (col) {
2486            col_obj = wxPyConstructObject((void*)col, wxT("wxDataViewColumn"), 0);  // not owned
2487        } else {
2488            col_obj = Py_None;
2489            Py_INCREF(Py_None);
2490        }
2491        PyTuple_SET_ITEM(value, 0, item_obj);
2492        PyTuple_SET_ITEM(value, 1, col_obj);
2493        // PyTuple steals a reference, so we don't need to decref the items here
2494        return value;
2495    }
2496    %End
2497
2498    bool IsExpanded(
2499        const wxDataViewItem & item
2500    ) const;
2501    %Docstring
2502        IsExpanded(item) -> bool
2503
2504        Return true if the item is expanded.
2505    %End
2506
2507    bool IsSelected(
2508        const wxDataViewItem & item
2509    ) const;
2510    %Docstring
2511        IsSelected(item) -> bool
2512
2513        Return true if the item is selected.
2514    %End
2515
2516    void Select(
2517        const wxDataViewItem & item
2518    );
2519    %Docstring
2520        Select(item)
2521
2522        Select the given item.
2523    %End
2524
2525    void SelectAll();
2526    %Docstring
2527        SelectAll()
2528
2529        Select all items.
2530    %End
2531
2532    void SetExpanderColumn(
2533        wxDataViewColumn * col
2534    );
2535    %Docstring
2536        SetExpanderColumn(col)
2537
2538        Set which column shall contain the tree-like expanders.
2539    %End
2540
2541    void SetCurrentItem(
2542        const wxDataViewItem & item
2543    );
2544    %Docstring
2545        SetCurrentItem(item)
2546
2547        Changes the currently focused item.
2548    %End
2549
2550    void SetIndent(
2551        int indent
2552    );
2553    %Docstring
2554        SetIndent(indent)
2555
2556        Sets the indentation.
2557    %End
2558
2559    void SetSelections(
2560        const wxDataViewItemArray & sel
2561    );
2562    %Docstring
2563        SetSelections(sel)
2564
2565        Sets the selection to the array of wxDataViewItems.
2566    %End
2567
2568    void Unselect(
2569        const wxDataViewItem & item
2570    );
2571    %Docstring
2572        Unselect(item)
2573
2574        Unselect the given item.
2575    %End
2576
2577    void UnselectAll();
2578    %Docstring
2579        UnselectAll()
2580
2581        Unselect all item.
2582    %End
2583
2584    bool SetRowHeight(
2585        int rowHeight
2586    );
2587    %Docstring
2588        SetRowHeight(rowHeight) -> bool
2589
2590        Sets the row height.
2591    %End
2592
2593    public:
2594    virtual wxPoint GetClientAreaOrigin() const;
2595    virtual bool Validate();
2596    virtual bool TransferDataToWindow();
2597    virtual bool TransferDataFromWindow();
2598    virtual void InitDialog();
2599    virtual bool AcceptsFocus() const;
2600    virtual bool AcceptsFocusRecursively() const;
2601    virtual bool AcceptsFocusFromKeyboard() const;
2602    virtual void AddChild( wxWindowBase *child );
2603    virtual void RemoveChild( wxWindowBase *child );
2604    virtual void InheritAttributes();
2605    virtual bool ShouldInheritColours() const;
2606    virtual void OnInternalIdle();
2607    virtual wxWindow *GetMainWindowOfCompositeControl();
2608    virtual bool InformFirstDirection(int direction, int size, int availableOtherDir);
2609    virtual void SetCanFocus(bool canFocus);
2610    virtual bool Destroy();
2611    virtual void SetValidator( const wxValidator &validator );
2612    virtual wxValidator* GetValidator();
2613
2614
2615    protected:
2616    virtual bool ProcessEvent(wxEvent & event);
2617    virtual void DoEnable(bool enable);
2618    virtual void DoGetPosition(int *x, int *y) const;
2619    virtual void DoGetSize(int *width, int *height) const;
2620    virtual void DoGetClientSize(int *width, int *height) const;
2621    virtual wxSize DoGetBestSize() const;
2622    virtual wxSize DoGetBestClientSize() const;
2623    virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
2624    virtual void DoSetClientSize(int width, int height);
2625    virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH );
2626    virtual wxSize DoGetBorderSize() const;
2627    virtual void DoMoveWindow(int x, int y, int width, int height);
2628    virtual void DoSetWindowVariant( wxWindowVariant variant);
2629    virtual wxBorder GetDefaultBorder() const;
2630    virtual wxBorder GetDefaultBorderForControl() const;
2631    virtual void DoFreeze();
2632    virtual void DoThaw();
2633    virtual bool HasTransparentBackground();
2634    virtual bool TryBefore(wxEvent& event);
2635    virtual bool TryAfter(wxEvent& event);
2636
2637
2638    public:
2639
2640
2641    static
2642    wxVisualAttributes GetClassDefaultAttributes(
2643        wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL
2644    );
2645    %Docstring
2646        GetClassDefaultAttributes(variant=wx.WINDOW_VARIANT_NORMAL) -> wx.VisualAttributes
2647    %End
2648    %PreMethodCode
2649        if (!wxPyCheckForApp()) return NULL;
2650    %End
2651
2652    public:
2653
2654
2655    %Property(name=ColumnCount, get=GetColumnCount)
2656    %Property(name=CurrentColumn, get=GetCurrentColumn)
2657    %Property(name=CurrentItem, get=GetCurrentItem, set=SetCurrentItem)
2658    %Property(name=ExpanderColumn, get=GetExpanderColumn, set=SetExpanderColumn)
2659    %Property(name=Indent, get=GetIndent, set=SetIndent)
2660    %Property(name=Model, get=GetModel)
2661    %Property(name=SelectedItemsCount, get=GetSelectedItemsCount)
2662    %Property(name=Selection, get=GetSelection)
2663    %Property(name=Selections, get=GetSelections, set=SetSelections)
2664    %Property(name=SortingColumn, get=GetSortingColumn)
2665};  // end of class wxDataViewCtrl
2666
2667
2668%Extract(id=pycode_dataview)
2669def _DataViewCtrl_AssociateModel(self, model):
2670    """
2671    Associates a :class:`DataViewModel` with the control.
2672    Ownership of the model object is passed to C++, however it
2673    is reference counted so it can be shared with other views.
2674    """
2675    import wx.siplib
2676    wasPyOwned = wx.siplib.ispyowned(model)
2677    self._AssociateModel(model)
2678    # Ownership of the python object has just been transferred to
2679    # C++, so DecRef the C++ instance associated with this python
2680    # reference.
2681    if wasPyOwned:
2682        model.DecRef()
2683DataViewCtrl.AssociateModel = _DataViewCtrl_AssociateModel
2684del _DataViewCtrl_AssociateModel
2685%End
2686
2687%Extract(id=pycode_dataview)
2688def _DataViewCtrl_GetColumns(self):
2689    """
2690    Returns a list of column objects.
2691    """
2692    return [self.GetColumn(i) for i in range(self.GetColumnCount())]
2693DataViewCtrl.GetColumns = _DataViewCtrl_GetColumns
2694del _DataViewCtrl_GetColumns
2695%End
2696
2697%Extract(id=pycode_dataview)
2698DataViewCtrl.Columns = property(DataViewCtrl.GetColumns)
2699%End
2700
2701class wxDataViewEvent : wxNotifyEvent
2702{
2703    %Docstring
2704        DataViewEvent(commandType=wx.wxEVT_NULL, winid=0)
2705
2706        This is the event class for the wxDataViewCtrl notifications.
2707    %End
2708    %TypeHeaderCode
2709        #include <wx/dataview.h>
2710    %End
2711
2712public:
2713    wxDataViewEvent(
2714        wxEventType commandType = wxEVT_NULL,
2715        int winid = 0
2716    );
2717
2718    int GetColumn() const;
2719    %Docstring
2720        GetColumn() -> int
2721
2722        Returns the position of the column in the control or -1 if no column
2723        field was set by the event emitter.
2724    %End
2725
2726    wxDataViewColumn * GetDataViewColumn() const;
2727    %Docstring
2728        GetDataViewColumn() -> DataViewColumn
2729
2730        Returns a pointer to the wxDataViewColumn from which the event was
2731        emitted or NULL.
2732    %End
2733
2734    wxDataViewModel * GetModel() const;
2735    %Docstring
2736        GetModel() -> DataViewModel
2737
2738        Returns the wxDataViewModel associated with the event.
2739    %End
2740
2741    wxPoint GetPosition() const;
2742    %Docstring
2743        GetPosition() -> wx.Point
2744
2745        Returns the position of a context menu event in screen coordinates.
2746    %End
2747
2748    const wxDVCVariant & GetValue() const;
2749    %Docstring
2750        GetValue() -> DVCVariant
2751
2752        Returns a reference to a value.
2753    %End
2754
2755    bool IsEditCancelled() const;
2756    %Docstring
2757        IsEditCancelled() -> bool
2758
2759        Can be used to determine whether the new value is going to be accepted
2760        in wxEVT_DATAVIEW_ITEM_EDITING_DONE handler.
2761    %End
2762
2763    void SetColumn(
2764        int col
2765    );
2766    %Docstring
2767        SetColumn(col)
2768
2769        Sets the column index associated with this event.
2770    %End
2771
2772    void SetDataViewColumn(
2773        wxDataViewColumn * col
2774    );
2775    %Docstring
2776        SetDataViewColumn(col)
2777
2778        For wxEVT_DATAVIEW_COLUMN_HEADER_CLICK only.
2779    %End
2780
2781    void SetModel(
2782        wxDataViewModel * model
2783    );
2784    %Docstring
2785        SetModel(model)
2786
2787        Sets the dataview model associated with this event.
2788    %End
2789
2790    void SetValue(
2791        const wxDVCVariant & value
2792    );
2793    %Docstring
2794        SetValue(value)
2795
2796        Sets the value associated with this event.
2797    %End
2798
2799    void SetDataObject(
2800        wxDataObject * obj   /Transfer/
2801    );
2802    %Docstring
2803        SetDataObject(obj)
2804
2805        Set wxDataObject for data transfer within a drag operation.
2806    %End
2807
2808    wxDataFormat GetDataFormat() const;
2809    %Docstring
2810        GetDataFormat() -> wx.DataFormat
2811
2812        Gets the wxDataFormat during a drop operation.
2813    %End
2814
2815    size_t GetDataSize() const;
2816    %Docstring
2817        GetDataSize() -> size_t
2818
2819        Gets the data size for a drop data transfer.
2820    %End
2821
2822    PyObject* GetDataBuffer() const;
2823    %Docstring
2824        GetDataBuffer() -> PyObject
2825
2826        Gets the data buffer for a drop data transfer
2827    %End
2828    %MethodCode
2829        PyErr_Clear();
2830        Py_BEGIN_ALLOW_THREADS
2831        sipRes = _wxDataViewEvent_GetDataBuffer(sipCpp);
2832        Py_END_ALLOW_THREADS
2833        if (PyErr_Occurred()) sipIsErr = 1;
2834    %End
2835    %TypeCode
2836    PyObject* _wxDataViewEvent_GetDataBuffer(const wxDataViewEvent* self)
2837    {
2838        wxPyThreadBlocker blocker;
2839        return wxPyMakeBuffer(self->GetDataBuffer(), self->GetDataSize(), true);
2840    }
2841    %End
2842
2843    void SetDragFlags(
2844        int flags
2845    );
2846    %Docstring
2847        SetDragFlags(flags)
2848
2849        Specify the kind of the drag operation to perform.
2850    %End
2851
2852    wxDragResult GetDropEffect() const;
2853    %Docstring
2854        GetDropEffect() -> DragResult
2855
2856        Returns the effect the user requested to happen to the dropped data.
2857    %End
2858
2859    int GetCacheFrom() const;
2860    %Docstring
2861        GetCacheFrom() -> int
2862
2863        Return the first row that will be displayed.
2864    %End
2865
2866    int GetCacheTo() const;
2867    %Docstring
2868        GetCacheTo() -> int
2869
2870        Return the last row that will be displayed.
2871    %End
2872
2873    wxDataViewItem GetItem() const;
2874    %Docstring
2875        GetItem() -> DataViewItem
2876    %End
2877
2878    void SetItem(
2879        const wxDataViewItem & item
2880    );
2881    %Docstring
2882        SetItem(item)
2883    %End
2884
2885    void SetEditCanceled(
2886        bool editCancelled
2887    );
2888    %Docstring
2889        SetEditCanceled(editCancelled)
2890    %End
2891
2892    void SetPosition(
2893        int x,
2894        int y
2895    );
2896    %Docstring
2897        SetPosition(x, y)
2898    %End
2899
2900    void SetCache(
2901        int from_,
2902        int to_
2903    );
2904    %Docstring
2905        SetCache(from_, to_)
2906    %End
2907
2908    wxDataObject * GetDataObject() const;
2909    %Docstring
2910        GetDataObject() -> wx.DataObject
2911    %End
2912
2913    void SetDataFormat(
2914        const wxDataFormat & format
2915    );
2916    %Docstring
2917        SetDataFormat(format)
2918    %End
2919
2920    void SetDataSize(
2921        size_t size
2922    );
2923    %Docstring
2924        SetDataSize(size)
2925    %End
2926
2927    void SetDataBuffer(
2928        void * buf
2929    );
2930    %Docstring
2931        SetDataBuffer(buf)
2932    %End
2933
2934    int GetDragFlags() const;
2935    %Docstring
2936        GetDragFlags() -> int
2937    %End
2938
2939    void SetDropEffect(
2940        wxDragResult effect
2941    );
2942    %Docstring
2943        SetDropEffect(effect)
2944    %End
2945
2946    public:
2947    virtual wxEvent* Clone() const /Factory/;
2948
2949
2950    private:
2951        wxDataViewEvent& operator=(const wxDataViewEvent&);
2952
2953
2954    %Property(name=EditCancelled, get=IsEditCancelled, set=SetEditCanceled)
2955};  // end of class wxDataViewEvent
2956
2957
2958class wxDataViewListCtrl : wxDataViewCtrl
2959{
2960    %Docstring
2961        DataViewListCtrl()
2962        DataViewListCtrl(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=DV_ROW_LINES, validator=wx.DefaultValidator)
2963
2964        This class is a wxDataViewCtrl which internally uses a
2965        wxDataViewListStore and forwards most of its API to that class.
2966    %End
2967    %TypeHeaderCode
2968        #include <wx/dataview.h>
2969    %End
2970
2971public:
2972    wxDataViewListCtrl();
2973    %PreMethodCode
2974        if (!wxPyCheckForApp()) return NULL;
2975    %End
2976
2977    wxDataViewListCtrl(
2978        wxWindow * parent   /TransferThis/,
2979        wxWindowID id = wxID_ANY,
2980        const wxPoint & pos = wxDefaultPosition,
2981        const wxSize & size = wxDefaultSize,
2982        long style = wxDV_ROW_LINES,
2983        const wxValidator & validator = wxDefaultValidator
2984    );
2985    %PreMethodCode
2986        if (!wxPyCheckForApp()) return NULL;
2987    %End
2988
2989    ~wxDataViewListCtrl();
2990
2991    wxDataViewListStore * GetStore();
2992    %Docstring
2993        GetStore() -> DataViewListStore
2994
2995        Returns the store.
2996    %End
2997
2998    int GetSelectedRow() const;
2999    %Docstring
3000        GetSelectedRow() -> int
3001
3002        Returns index of the selected row or wxNOT_FOUND.
3003    %End
3004
3005    void SelectRow(
3006        unsigned row
3007    );
3008    %Docstring
3009        SelectRow(row)
3010
3011        Selects given row.
3012    %End
3013
3014    void UnselectRow(
3015        unsigned row
3016    );
3017    %Docstring
3018        UnselectRow(row)
3019
3020        Unselects given row.
3021    %End
3022
3023    bool IsRowSelected(
3024        unsigned row
3025    ) const;
3026    %Docstring
3027        IsRowSelected(row) -> bool
3028
3029        Returns true if row is selected.
3030    %End
3031
3032    bool AppendColumn(
3033        wxDataViewColumn * column   /Transfer/
3034    );
3035    %Docstring
3036        AppendColumn(column) -> bool
3037        AppendColumn(column, varianttype)
3038
3039        Appends a column to the control and additionally appends a column to
3040        the store with the type string.
3041    %End
3042
3043    void AppendColumn(
3044        wxDataViewColumn * column   /Transfer/,
3045        const wxString & varianttype
3046    );
3047
3048    wxDataViewColumn * AppendTextColumn(
3049        const wxString & label,
3050        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
3051        int width = -1,
3052        wxAlignment align = wxALIGN_LEFT,
3053        int flags = wxDATAVIEW_COL_RESIZABLE
3054    );
3055    %Docstring
3056        AppendTextColumn(label, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_LEFT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
3057
3058        Appends a text column to the control and the store.
3059    %End
3060
3061    wxDataViewColumn * AppendToggleColumn(
3062        const wxString & label,
3063        wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
3064        int width = -1,
3065        wxAlignment align = wxALIGN_LEFT,
3066        int flags = wxDATAVIEW_COL_RESIZABLE
3067    );
3068    %Docstring
3069        AppendToggleColumn(label, mode=DATAVIEW_CELL_ACTIVATABLE, width=-1, align=wx.ALIGN_LEFT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
3070
3071        Appends a toggle column to the control and the store.
3072    %End
3073
3074    wxDataViewColumn * AppendProgressColumn(
3075        const wxString & label,
3076        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
3077        int width = -1,
3078        wxAlignment align = wxALIGN_LEFT,
3079        int flags = wxDATAVIEW_COL_RESIZABLE
3080    );
3081    %Docstring
3082        AppendProgressColumn(label, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_LEFT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
3083
3084        Appends a progress column to the control and the store.
3085    %End
3086
3087    wxDataViewColumn * AppendIconTextColumn(
3088        const wxString & label,
3089        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
3090        int width = -1,
3091        wxAlignment align = wxALIGN_LEFT,
3092        int flags = wxDATAVIEW_COL_RESIZABLE
3093    );
3094    %Docstring
3095        AppendIconTextColumn(label, mode=DATAVIEW_CELL_INERT, width=-1, align=wx.ALIGN_LEFT, flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
3096
3097        Appends an icon-and-text column to the control and the store.
3098    %End
3099
3100    bool InsertColumn(
3101        unsigned int pos,
3102        wxDataViewColumn * column   /Transfer/
3103    );
3104    %Docstring
3105        InsertColumn(pos, column) -> bool
3106        InsertColumn(pos, column, varianttype)
3107
3108        Inserts a column to the control and additionally inserts a column to
3109        the store with the type string.
3110    %End
3111
3112    void InsertColumn(
3113        unsigned int pos,
3114        wxDataViewColumn * column   /Transfer/,
3115        const wxString & varianttype
3116    );
3117
3118    bool PrependColumn(
3119        wxDataViewColumn * column   /Transfer/
3120    );
3121    %Docstring
3122        PrependColumn(column) -> bool
3123        PrependColumn(column, varianttype)
3124
3125        Prepends a column to the control and additionally prepends a column to
3126        the store with the type string.
3127    %End
3128
3129    void PrependColumn(
3130        wxDataViewColumn * column   /Transfer/,
3131        const wxString & varianttype
3132    );
3133
3134    void AppendItem(
3135        const wxVariantVector& values,
3136        wxUIntPtr data = NULL
3137    );
3138    %Docstring
3139        AppendItem(values, data=None)
3140
3141        Appends an item (=row) to the control and store.
3142    %End
3143
3144    void PrependItem(
3145        const wxVariantVector& values,
3146        wxUIntPtr data = NULL
3147    );
3148    %Docstring
3149        PrependItem(values, data=None)
3150
3151        Prepends an item (=row) to the control and store.
3152    %End
3153
3154    void InsertItem(
3155        unsigned int row,
3156        const wxVariantVector& values,
3157        wxUIntPtr data = NULL
3158    );
3159    %Docstring
3160        InsertItem(row, values, data=None)
3161
3162        Inserts an item (=row) to the control and store.
3163    %End
3164
3165    void DeleteItem(
3166        unsigned row
3167    );
3168    %Docstring
3169        DeleteItem(row)
3170
3171        Delete the row at position row.
3172    %End
3173
3174    void DeleteAllItems();
3175    %Docstring
3176        DeleteAllItems()
3177
3178        Delete all items (= all rows).
3179    %End
3180
3181    unsigned int GetItemCount() const;
3182    %Docstring
3183        GetItemCount() -> unsignedint
3184
3185        Returns the number of items (=rows) in the control.
3186    %End
3187
3188    wxUIntPtr GetItemData(
3189        const wxDataViewItem & item
3190    ) const;
3191    %Docstring
3192        GetItemData(item) -> UIntPtr
3193
3194        Returns the client data associated with the item.
3195    %End
3196
3197    void SetValue(
3198        const wxDVCVariant & value,
3199        unsigned int row,
3200        unsigned int col
3201    );
3202    %Docstring
3203        SetValue(value, row, col)
3204
3205        Sets the value in the store and update the control.
3206    %End
3207
3208    void GetValue(
3209        wxDVCVariant & value   /Out/,
3210        unsigned int row,
3211        unsigned int col
3212    );
3213    %Docstring
3214        GetValue(row, col) -> value
3215
3216        Returns the value from the store.
3217    %End
3218
3219    void SetTextValue(
3220        const wxString & value,
3221        unsigned int row,
3222        unsigned int col
3223    );
3224    %Docstring
3225        SetTextValue(value, row, col)
3226
3227        Sets the value in the store and update the control.
3228    %End
3229
3230    wxString GetTextValue(
3231        unsigned int row,
3232        unsigned int col
3233    ) const;
3234    %Docstring
3235        GetTextValue(row, col) -> String
3236
3237        Returns the value from the store.
3238    %End
3239
3240    void SetToggleValue(
3241        bool value,
3242        unsigned int row,
3243        unsigned int col
3244    );
3245    %Docstring
3246        SetToggleValue(value, row, col)
3247
3248        Sets the value in the store and update the control.
3249    %End
3250
3251    bool GetToggleValue(
3252        unsigned int row,
3253        unsigned int col
3254    ) const;
3255    %Docstring
3256        GetToggleValue(row, col) -> bool
3257
3258        Returns the value from the store.
3259    %End
3260
3261    void SetItemData(
3262        const wxDataViewItem & item,
3263        wxUIntPtr data
3264    );
3265    %Docstring
3266        SetItemData(item, data)
3267
3268        Associates a client data pointer with the given item.
3269    %End
3270
3271    bool Create(
3272        wxWindow * parent   /TransferThis/,
3273        wxWindowID id = wxID_ANY,
3274        const wxPoint & pos = wxDefaultPosition,
3275        const wxSize & size = wxDefaultSize,
3276        long style = wxDV_ROW_LINES,
3277        const wxValidator & validator = wxDefaultValidator
3278    );
3279    %Docstring
3280        Create(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=DV_ROW_LINES, validator=wx.DefaultValidator) -> bool
3281
3282        Creates the control and a wxDataViewListStore as its internal model.
3283    %End
3284
3285    int ItemToRow(
3286        const wxDataViewItem & item
3287    ) const;
3288    %Docstring
3289        ItemToRow(item) -> int
3290
3291        Returns the position of given item or wxNOT_FOUND if it's not a valid
3292        item.
3293    %End
3294
3295    wxDataViewItem RowToItem(
3296        int row
3297    ) const;
3298    %Docstring
3299        RowToItem(row) -> DataViewItem
3300
3301        Returns the wxDataViewItem at the given row.
3302    %End
3303
3304    public:
3305    virtual wxPoint GetClientAreaOrigin() const;
3306    virtual bool Validate();
3307    virtual bool TransferDataToWindow();
3308    virtual bool TransferDataFromWindow();
3309    virtual void InitDialog();
3310    virtual bool AcceptsFocus() const;
3311    virtual bool AcceptsFocusRecursively() const;
3312    virtual bool AcceptsFocusFromKeyboard() const;
3313    virtual void AddChild( wxWindowBase *child );
3314    virtual void RemoveChild( wxWindowBase *child );
3315    virtual void InheritAttributes();
3316    virtual bool ShouldInheritColours() const;
3317    virtual void OnInternalIdle();
3318    virtual wxWindow *GetMainWindowOfCompositeControl();
3319    virtual bool InformFirstDirection(int direction, int size, int availableOtherDir);
3320    virtual void SetCanFocus(bool canFocus);
3321    virtual bool Destroy();
3322    virtual void SetValidator( const wxValidator &validator );
3323    virtual wxValidator* GetValidator();
3324
3325
3326    protected:
3327    virtual bool ProcessEvent(wxEvent & event);
3328    virtual void DoEnable(bool enable);
3329    virtual void DoGetPosition(int *x, int *y) const;
3330    virtual void DoGetSize(int *width, int *height) const;
3331    virtual void DoGetClientSize(int *width, int *height) const;
3332    virtual wxSize DoGetBestSize() const;
3333    virtual wxSize DoGetBestClientSize() const;
3334    virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
3335    virtual void DoSetClientSize(int width, int height);
3336    virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH );
3337    virtual wxSize DoGetBorderSize() const;
3338    virtual void DoMoveWindow(int x, int y, int width, int height);
3339    virtual void DoSetWindowVariant( wxWindowVariant variant);
3340    virtual wxBorder GetDefaultBorder() const;
3341    virtual wxBorder GetDefaultBorderForControl() const;
3342    virtual void DoFreeze();
3343    virtual void DoThaw();
3344    virtual bool HasTransparentBackground();
3345    virtual bool TryBefore(wxEvent& event);
3346    virtual bool TryAfter(wxEvent& event);
3347
3348
3349    public:
3350
3351
3352    static
3353    wxVisualAttributes GetClassDefaultAttributes(
3354        wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL
3355    );
3356    %Docstring
3357        GetClassDefaultAttributes(variant=wx.WINDOW_VARIANT_NORMAL) -> wx.VisualAttributes
3358    %End
3359    %PreMethodCode
3360        if (!wxPyCheckForApp()) return NULL;
3361    %End
3362
3363    public:
3364
3365
3366    %Property(name=ItemCount, get=GetItemCount)
3367    %Property(name=SelectedRow, get=GetSelectedRow)
3368    %Property(name=Store, get=GetStore)
3369};  // end of class wxDataViewListCtrl
3370
3371
3372class wxDataViewListStore : wxDataViewIndexListModel
3373{
3374    %Docstring
3375        DataViewListStore()
3376
3377        wxDataViewListStore is a specialised wxDataViewModel for storing a
3378        simple table of data.
3379    %End
3380    %TypeHeaderCode
3381        #include <wx/dataview.h>
3382    %End
3383
3384public:
3385    wxDataViewListStore();
3386
3387    ~wxDataViewListStore();
3388
3389    void PrependColumn(
3390        const wxString & varianttype
3391    );
3392    %Docstring
3393        PrependColumn(varianttype)
3394
3395        Prepends a data column.
3396    %End
3397
3398    void InsertColumn(
3399        unsigned int pos,
3400        const wxString & varianttype
3401    );
3402    %Docstring
3403        InsertColumn(pos, varianttype)
3404
3405        Inserts a data column before pos.
3406    %End
3407
3408    void AppendColumn(
3409        const wxString & varianttype
3410    );
3411    %Docstring
3412        AppendColumn(varianttype)
3413
3414        Appends a data column.
3415    %End
3416
3417    void AppendItem(
3418        const wxVariantVector& values,
3419        wxUIntPtr data = NULL
3420    );
3421    %Docstring
3422        AppendItem(values, data=None)
3423
3424        Appends an item (=row) and fills it with values.
3425    %End
3426
3427    void PrependItem(
3428        const wxVariantVector& values,
3429        wxUIntPtr data = NULL
3430    );
3431    %Docstring
3432        PrependItem(values, data=None)
3433
3434        Prepends an item (=row) and fills it with values.
3435    %End
3436
3437    void InsertItem(
3438        unsigned int row,
3439        const wxVariantVector& values,
3440        wxUIntPtr data = NULL
3441    );
3442    %Docstring
3443        InsertItem(row, values, data=None)
3444
3445        Inserts an item (=row) and fills it with values.
3446    %End
3447
3448    void DeleteItem(
3449        unsigned pos
3450    );
3451    %Docstring
3452        DeleteItem(pos)
3453
3454        Delete the item (=row) at position pos.
3455    %End
3456
3457    void DeleteAllItems();
3458    %Docstring
3459        DeleteAllItems()
3460
3461        Delete all item (=all rows) in the store.
3462    %End
3463
3464    unsigned int GetItemCount() const;
3465    %Docstring
3466        GetItemCount() -> unsignedint
3467
3468        Returns the number of items (=rows) in the control.
3469    %End
3470
3471    wxUIntPtr GetItemData(
3472        const wxDataViewItem & item
3473    ) const;
3474    %Docstring
3475        GetItemData(item) -> UIntPtr
3476
3477        Returns the client data associated with the item.
3478    %End
3479
3480    virtual
3481    unsigned int GetColumnCount() const;
3482    %Docstring
3483        GetColumnCount() -> unsignedint
3484
3485        Overridden from wxDataViewModel.
3486    %End
3487
3488    virtual
3489    wxString GetColumnType(
3490        unsigned int col
3491    ) const;
3492    %Docstring
3493        GetColumnType(col) -> String
3494
3495        Overridden from wxDataViewModel.
3496    %End
3497
3498    void SetItemData(
3499        const wxDataViewItem & item,
3500        wxUIntPtr data
3501    );
3502    %Docstring
3503        SetItemData(item, data)
3504
3505        Sets the client data associated with the item.
3506    %End
3507
3508    virtual
3509    void GetValueByRow(
3510        wxDVCVariant & value   /Out/,
3511        unsigned int row,
3512        unsigned int col
3513    ) const;
3514    %Docstring
3515        GetValueByRow(row, col) -> value
3516
3517        Overridden from wxDataViewIndexListModel.
3518    %End
3519
3520    virtual
3521    bool SetValueByRow(
3522        const wxDVCVariant & value,
3523        unsigned int row,
3524        unsigned int col
3525    );
3526    %Docstring
3527        SetValueByRow(value, row, col) -> bool
3528
3529        Overridden from wxDataViewIndexListModel.
3530    %End
3531
3532    public:
3533
3534
3535    %Property(name=ColumnCount, get=GetColumnCount)
3536    %Property(name=ItemCount, get=GetItemCount)
3537};  // end of class wxDataViewListStore
3538
3539
3540class wxDataViewTreeCtrl : wxDataViewCtrl
3541{
3542    %Docstring
3543        DataViewTreeCtrl()
3544        DataViewTreeCtrl(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=DV_NO_HEADER|DV_ROW_LINES, validator=wx.DefaultValidator)
3545
3546        This class is a wxDataViewCtrl which internally uses a
3547        wxDataViewTreeStore and forwards most of its API to that class.
3548    %End
3549    %TypeHeaderCode
3550        #include <wx/dataview.h>
3551    %End
3552
3553public:
3554    wxDataViewTreeCtrl();
3555    %PreMethodCode
3556        if (!wxPyCheckForApp()) return NULL;
3557    %End
3558
3559    wxDataViewTreeCtrl(
3560        wxWindow * parent   /TransferThis/,
3561        wxWindowID id = wxID_ANY,
3562        const wxPoint & pos = wxDefaultPosition,
3563        const wxSize & size = wxDefaultSize,
3564        long style = wxDV_NO_HEADER|wxDV_ROW_LINES,
3565        const wxValidator & validator = wxDefaultValidator
3566    );
3567    %PreMethodCode
3568        if (!wxPyCheckForApp()) return NULL;
3569    %End
3570
3571    ~wxDataViewTreeCtrl();
3572
3573    wxDataViewTreeStore * GetStore();
3574    %Docstring
3575        GetStore() -> DataViewTreeStore
3576
3577        Returns the store.
3578    %End
3579
3580    wxDataViewItem AppendContainer(
3581        const wxDataViewItem & parent,
3582        const wxString & text,
3583        int icon = -1,
3584        int expanded = -1,
3585        wxClientData * data   /Transfer/ = NULL
3586    );
3587    %Docstring
3588        AppendContainer(parent, text, icon=-1, expanded=-1, data=None) -> DataViewItem
3589
3590        Appends a container to the given parent.
3591    %End
3592
3593    wxDataViewItem AppendItem(
3594        const wxDataViewItem & parent,
3595        const wxString & text,
3596        int icon = -1,
3597        wxClientData * data   /Transfer/ = NULL
3598    );
3599    %Docstring
3600        AppendItem(parent, text, icon=-1, data=None) -> DataViewItem
3601
3602        Appends an item to the given parent.
3603    %End
3604
3605    bool Create(
3606        wxWindow * parent   /TransferThis/,
3607        wxWindowID id = wxID_ANY,
3608        const wxPoint & pos = wxDefaultPosition,
3609        const wxSize & size = wxDefaultSize,
3610        long style = wxDV_NO_HEADER|wxDV_ROW_LINES,
3611        const wxValidator & validator = wxDefaultValidator
3612    );
3613    %Docstring
3614        Create(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=DV_NO_HEADER|DV_ROW_LINES, validator=wx.DefaultValidator) -> bool
3615
3616        Creates the control and a wxDataViewTreeStore as its internal model.
3617    %End
3618
3619    void DeleteAllItems();
3620    %Docstring
3621        DeleteAllItems()
3622
3623        Calls the identical method from wxDataViewTreeStore.
3624    %End
3625
3626    void DeleteChildren(
3627        const wxDataViewItem & item
3628    );
3629    %Docstring
3630        DeleteChildren(item)
3631
3632        Calls the identical method from wxDataViewTreeStore.
3633    %End
3634
3635    void DeleteItem(
3636        const wxDataViewItem & item
3637    );
3638    %Docstring
3639        DeleteItem(item)
3640
3641        Calls the identical method from wxDataViewTreeStore.
3642    %End
3643
3644    int GetChildCount(
3645        const wxDataViewItem & parent
3646    ) const;
3647    %Docstring
3648        GetChildCount(parent) -> int
3649
3650        Calls the identical method from wxDataViewTreeStore.
3651    %End
3652
3653    wxImageList * GetImageList();
3654    %Docstring
3655        GetImageList() -> wx.ImageList
3656
3657        Returns the image list.
3658    %End
3659
3660    wxClientData * GetItemData(
3661        const wxDataViewItem & item
3662    ) const;
3663    %Docstring
3664        GetItemData(item) -> ClientData
3665
3666        Calls the identical method from wxDataViewTreeStore.
3667    %End
3668
3669    const wxIcon & GetItemExpandedIcon(
3670        const wxDataViewItem & item
3671    ) const;
3672    %Docstring
3673        GetItemExpandedIcon(item) -> wx.Icon
3674
3675        Calls the identical method from wxDataViewTreeStore.
3676    %End
3677
3678    const wxIcon & GetItemIcon(
3679        const wxDataViewItem & item
3680    ) const;
3681    %Docstring
3682        GetItemIcon(item) -> wx.Icon
3683
3684        Calls the identical method from wxDataViewTreeStore.
3685    %End
3686
3687    wxString GetItemText(
3688        const wxDataViewItem & item
3689    ) const;
3690    %Docstring
3691        GetItemText(item) -> String
3692
3693        Calls the identical method from wxDataViewTreeStore.
3694    %End
3695
3696    wxDataViewItem GetNthChild(
3697        const wxDataViewItem & parent,
3698        unsigned int pos
3699    ) const;
3700    %Docstring
3701        GetNthChild(parent, pos) -> DataViewItem
3702
3703        Calls the identical method from wxDataViewTreeStore.
3704    %End
3705
3706    wxDataViewItem InsertContainer(
3707        const wxDataViewItem & parent,
3708        const wxDataViewItem & previous,
3709        const wxString & text,
3710        int icon = -1,
3711        int expanded = -1,
3712        wxClientData * data   /Transfer/ = NULL
3713    );
3714    %Docstring
3715        InsertContainer(parent, previous, text, icon=-1, expanded=-1, data=None) -> DataViewItem
3716
3717        Calls the same method from wxDataViewTreeStore but uses an index
3718        position in the image list instead of a wxIcon.
3719    %End
3720
3721    wxDataViewItem InsertItem(
3722        const wxDataViewItem & parent,
3723        const wxDataViewItem & previous,
3724        const wxString & text,
3725        int icon = -1,
3726        wxClientData * data   /Transfer/ = NULL
3727    );
3728    %Docstring
3729        InsertItem(parent, previous, text, icon=-1, data=None) -> DataViewItem
3730
3731        Calls the same method from wxDataViewTreeStore but uses an index
3732        position in the image list instead of a wxIcon.
3733    %End
3734
3735    bool IsContainer(
3736        const wxDataViewItem & item
3737    );
3738    %Docstring
3739        IsContainer(item) -> bool
3740
3741        Returns true if item is a container.
3742    %End
3743
3744    wxDataViewItem PrependContainer(
3745        const wxDataViewItem & parent,
3746        const wxString & text,
3747        int icon = -1,
3748        int expanded = -1,
3749        wxClientData * data   /Transfer/ = NULL
3750    );
3751    %Docstring
3752        PrependContainer(parent, text, icon=-1, expanded=-1, data=None) -> DataViewItem
3753
3754        Calls the same method from wxDataViewTreeStore but uses an index
3755        position in the image list instead of a wxIcon.
3756    %End
3757
3758    wxDataViewItem PrependItem(
3759        const wxDataViewItem & parent,
3760        const wxString & text,
3761        int icon = -1,
3762        wxClientData * data   /Transfer/ = NULL
3763    );
3764    %Docstring
3765        PrependItem(parent, text, icon=-1, data=None) -> DataViewItem
3766
3767        Calls the same method from wxDataViewTreeStore but uses an index
3768        position in the image list instead of a wxIcon.
3769    %End
3770
3771    void SetImageList(
3772        wxImageList * imagelist
3773    );
3774    %Docstring
3775        SetImageList(imagelist)
3776
3777        Sets the image list.
3778    %End
3779
3780    void SetItemData(
3781        const wxDataViewItem & item,
3782        wxClientData * data   /Transfer/
3783    );
3784    %Docstring
3785        SetItemData(item, data)
3786
3787        Calls the identical method from wxDataViewTreeStore.
3788    %End
3789
3790    void SetItemExpandedIcon(
3791        const wxDataViewItem & item,
3792        const wxIcon & icon
3793    );
3794    %Docstring
3795        SetItemExpandedIcon(item, icon)
3796
3797        Calls the identical method from wxDataViewTreeStore.
3798    %End
3799
3800    void SetItemIcon(
3801        const wxDataViewItem & item,
3802        const wxIcon & icon
3803    );
3804    %Docstring
3805        SetItemIcon(item, icon)
3806
3807        Calls the identical method from wxDataViewTreeStore.
3808    %End
3809
3810    void SetItemText(
3811        const wxDataViewItem & item,
3812        const wxString & text
3813    );
3814    %Docstring
3815        SetItemText(item, text)
3816
3817        Calls the identical method from wxDataViewTreeStore.
3818    %End
3819
3820    public:
3821    virtual wxPoint GetClientAreaOrigin() const;
3822    virtual bool Validate();
3823    virtual bool TransferDataToWindow();
3824    virtual bool TransferDataFromWindow();
3825    virtual void InitDialog();
3826    virtual bool AcceptsFocus() const;
3827    virtual bool AcceptsFocusRecursively() const;
3828    virtual bool AcceptsFocusFromKeyboard() const;
3829    virtual void AddChild( wxWindowBase *child );
3830    virtual void RemoveChild( wxWindowBase *child );
3831    virtual void InheritAttributes();
3832    virtual bool ShouldInheritColours() const;
3833    virtual void OnInternalIdle();
3834    virtual wxWindow *GetMainWindowOfCompositeControl();
3835    virtual bool InformFirstDirection(int direction, int size, int availableOtherDir);
3836    virtual void SetCanFocus(bool canFocus);
3837    virtual bool Destroy();
3838    virtual void SetValidator( const wxValidator &validator );
3839    virtual wxValidator* GetValidator();
3840
3841
3842    protected:
3843    virtual bool ProcessEvent(wxEvent & event);
3844    virtual void DoEnable(bool enable);
3845    virtual void DoGetPosition(int *x, int *y) const;
3846    virtual void DoGetSize(int *width, int *height) const;
3847    virtual void DoGetClientSize(int *width, int *height) const;
3848    virtual wxSize DoGetBestSize() const;
3849    virtual wxSize DoGetBestClientSize() const;
3850    virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
3851    virtual void DoSetClientSize(int width, int height);
3852    virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH );
3853    virtual wxSize DoGetBorderSize() const;
3854    virtual void DoMoveWindow(int x, int y, int width, int height);
3855    virtual void DoSetWindowVariant( wxWindowVariant variant);
3856    virtual wxBorder GetDefaultBorder() const;
3857    virtual wxBorder GetDefaultBorderForControl() const;
3858    virtual void DoFreeze();
3859    virtual void DoThaw();
3860    virtual bool HasTransparentBackground();
3861    virtual bool TryBefore(wxEvent& event);
3862    virtual bool TryAfter(wxEvent& event);
3863
3864
3865    public:
3866
3867
3868    static
3869    wxVisualAttributes GetClassDefaultAttributes(
3870        wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL
3871    );
3872    %Docstring
3873        GetClassDefaultAttributes(variant=wx.WINDOW_VARIANT_NORMAL) -> wx.VisualAttributes
3874    %End
3875    %PreMethodCode
3876        if (!wxPyCheckForApp()) return NULL;
3877    %End
3878
3879    public:
3880
3881
3882    %Property(name=ImageList, get=GetImageList, set=SetImageList)
3883    %Property(name=Store, get=GetStore)
3884};  // end of class wxDataViewTreeCtrl
3885
3886
3887class wxDataViewTreeStore : wxDataViewModel
3888{
3889    %Docstring
3890        DataViewTreeStore()
3891
3892        wxDataViewTreeStore is a specialised wxDataViewModel for storing
3893        simple trees very much like wxTreeCtrl does and it offers a similar
3894        API.
3895    %End
3896    %TypeHeaderCode
3897        #include <wx/dataview.h>
3898    %End
3899
3900public:
3901    wxDataViewTreeStore()   /Transfer/;
3902
3903    virtual
3904    ~wxDataViewTreeStore();
3905
3906    wxDataViewItem AppendContainer(
3907        const wxDataViewItem & parent,
3908        const wxString & text,
3909        const wxIcon & icon = wxNullIcon,
3910        const wxIcon & expanded = wxNullIcon,
3911        wxClientData * data   /Transfer/ = NULL
3912    );
3913    %Docstring
3914        AppendContainer(parent, text, icon=wx.NullIcon, expanded=wx.NullIcon, data=None) -> DataViewItem
3915
3916        Append a container.
3917    %End
3918
3919    wxDataViewItem AppendItem(
3920        const wxDataViewItem & parent,
3921        const wxString & text,
3922        const wxIcon & icon = wxNullIcon,
3923        wxClientData * data   /Transfer/ = NULL
3924    );
3925    %Docstring
3926        AppendItem(parent, text, icon=wx.NullIcon, data=None) -> DataViewItem
3927
3928        Append an item.
3929    %End
3930
3931    void DeleteAllItems();
3932    %Docstring
3933        DeleteAllItems()
3934
3935        Delete all item in the model.
3936    %End
3937
3938    void DeleteChildren(
3939        const wxDataViewItem & item
3940    );
3941    %Docstring
3942        DeleteChildren(item)
3943
3944        Delete all children of the item, but not the item itself.
3945    %End
3946
3947    void DeleteItem(
3948        const wxDataViewItem & item
3949    );
3950    %Docstring
3951        DeleteItem(item)
3952
3953        Delete this item.
3954    %End
3955
3956    int GetChildCount(
3957        const wxDataViewItem & parent
3958    ) const;
3959    %Docstring
3960        GetChildCount(parent) -> int
3961
3962        Return the number of children of item.
3963    %End
3964
3965    wxClientData * GetItemData(
3966        const wxDataViewItem & item
3967    ) const;
3968    %Docstring
3969        GetItemData(item) -> ClientData
3970
3971        Returns the client data associated with the item.
3972    %End
3973
3974    const wxIcon & GetItemExpandedIcon(
3975        const wxDataViewItem & item
3976    ) const;
3977    %Docstring
3978        GetItemExpandedIcon(item) -> wx.Icon
3979
3980        Returns the icon to display in expanded containers.
3981    %End
3982
3983    const wxIcon & GetItemIcon(
3984        const wxDataViewItem & item
3985    ) const;
3986    %Docstring
3987        GetItemIcon(item) -> wx.Icon
3988
3989        Returns the icon of the item.
3990    %End
3991
3992    wxString GetItemText(
3993        const wxDataViewItem & item
3994    ) const;
3995    %Docstring
3996        GetItemText(item) -> String
3997
3998        Returns the text of the item.
3999    %End
4000
4001    wxDataViewItem GetNthChild(
4002        const wxDataViewItem & parent,
4003        unsigned int pos
4004    ) const;
4005    %Docstring
4006        GetNthChild(parent, pos) -> DataViewItem
4007
4008        Returns the nth child item of item.
4009    %End
4010
4011    wxDataViewItem InsertContainer(
4012        const wxDataViewItem & parent,
4013        const wxDataViewItem & previous,
4014        const wxString & text,
4015        const wxIcon & icon = wxNullIcon,
4016        const wxIcon & expanded = wxNullIcon,
4017        wxClientData * data   /Transfer/ = NULL
4018    );
4019    %Docstring
4020        InsertContainer(parent, previous, text, icon=wx.NullIcon, expanded=wx.NullIcon, data=None) -> DataViewItem
4021
4022        Inserts a container after previous.
4023    %End
4024
4025    wxDataViewItem InsertItem(
4026        const wxDataViewItem & parent,
4027        const wxDataViewItem & previous,
4028        const wxString & text,
4029        const wxIcon & icon = wxNullIcon,
4030        wxClientData * data   /Transfer/ = NULL
4031    );
4032    %Docstring
4033        InsertItem(parent, previous, text, icon=wx.NullIcon, data=None) -> DataViewItem
4034
4035        Inserts an item after previous.
4036    %End
4037
4038    wxDataViewItem PrependContainer(
4039        const wxDataViewItem & parent,
4040        const wxString & text,
4041        const wxIcon & icon = wxNullIcon,
4042        const wxIcon & expanded = wxNullIcon,
4043        wxClientData * data   /Transfer/ = NULL
4044    );
4045    %Docstring
4046        PrependContainer(parent, text, icon=wx.NullIcon, expanded=wx.NullIcon, data=None) -> DataViewItem
4047
4048        Inserts a container before the first child item or parent.
4049    %End
4050
4051    wxDataViewItem PrependItem(
4052        const wxDataViewItem & parent,
4053        const wxString & text,
4054        const wxIcon & icon = wxNullIcon,
4055        wxClientData * data   /Transfer/ = NULL
4056    );
4057    %Docstring
4058        PrependItem(parent, text, icon=wx.NullIcon, data=None) -> DataViewItem
4059
4060        Inserts an item before the first child item or parent.
4061    %End
4062
4063    void SetItemData(
4064        const wxDataViewItem & item,
4065        wxClientData * data   /Transfer/
4066    );
4067    %Docstring
4068        SetItemData(item, data)
4069
4070        Sets the client data associated with the item.
4071    %End
4072
4073    void SetItemExpandedIcon(
4074        const wxDataViewItem & item,
4075        const wxIcon & icon
4076    );
4077    %Docstring
4078        SetItemExpandedIcon(item, icon)
4079
4080        Sets the expanded icon for the item.
4081    %End
4082
4083    void SetItemIcon(
4084        const wxDataViewItem & item,
4085        const wxIcon & icon
4086    );
4087    %Docstring
4088        SetItemIcon(item, icon)
4089
4090        Sets the icon for the item.
4091    %End
4092
4093};  // end of class wxDataViewTreeStore
4094
4095
4096class wxDataViewItemArray
4097{
4098public:
4099    SIP_SSIZE_T __len__();
4100    %MethodCode
4101        sipRes = sipCpp->GetCount();
4102    %End
4103
4104            wxDataViewItem& __getitem__(long index);
4105        %MethodCode
4106            if (0 > index)
4107                index += sipCpp->GetCount();
4108
4109            if ((index < sipCpp->GetCount()) && (0 <= index)) {
4110                sipRes = &sipCpp->Item(index);
4111            }
4112            else {
4113                wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
4114                sipError = sipErrorFail;
4115            }
4116        %End
4117
4118
4119    int __contains__(wxDataViewItem& obj);
4120    %MethodCode
4121        int idx = sipCpp->Index(*obj, false);
4122        sipRes = idx != wxNOT_FOUND;
4123    %End
4124
4125    void append(wxDataViewItem& obj);
4126    %MethodCode
4127        sipCpp->Add(*obj);
4128    %End
4129
4130    // TODO:  add support for index(value, [start, [stop]])
4131    int index(wxDataViewItem& obj);
4132    %MethodCode
4133        int idx = sipCpp->Index(*obj, false);
4134        if (idx == wxNOT_FOUND) {
4135            sipError = sipErrorFail;
4136            wxPyErr_SetString(PyExc_ValueError,
4137                              "sequence.index(x): x not in sequence");
4138            }
4139        sipRes = idx;
4140    %End
4141};
4142
4143%Extract(id=pycode_dataview)
4144def _DataViewItemArray___repr__(self):
4145    return "DataViewItemArray: " + repr(list(self))
4146DataViewItemArray.__repr__ = _DataViewItemArray___repr__
4147del _DataViewItemArray___repr__
4148%End
4149
4150
4151%Extract(id=pycode_dataview)
4152NullDataViewItem = DataViewItem()
4153
4154%End
4155
4156%Extract(id=pycode_dataview)
4157class DataViewItemObjectMapper(object):
4158    """
4159    This class provides a mechanism for mapping between Python objects and the
4160    :class:`DataViewItem` objects used by the :class:`DataViewModel` for tracking the items in
4161    the view. The ID used for the item is the id() of the Python object. Use
4162    :meth:`ObjectToItem` to create a :class:`DataViewItem` using a Python object as its ID,
4163    and use :meth:`ItemToObject` to fetch that Python object again later for a given
4164    :class:`DataViewItem`.
4165
4166    By default a regular dictionary is used to implement the ID to object
4167    mapping. Optionally a WeakValueDictionary can be useful when there will be
4168    a high turnover of objects and mantaining an extra reference to the
4169    objects would be unwise.  If weak references are used then the objects
4170    associated with data items must be weak-referenceable.  (Things like
4171    stock lists and dictionaries are not.)  See :meth:`UseWeakRefs`.
4172
4173    This class is used in :class:`PyDataViewModel` as a mixin for convenience.
4174    """
4175    def __init__(self):
4176        self.mapper = dict()
4177        self.usingWeakRefs = False
4178
4179    def ObjectToItem(self, obj):
4180        """
4181        Create a :class:`DataViewItem` for the object, and remember the ID-->obj mapping.
4182        """
4183        import sys
4184        oid = id(obj)
4185        while oid > sys.maxsize:
4186            # risk of conflict here... May need some more thought.
4187            oid -= sys.maxsize
4188        self.mapper[oid] = obj
4189        return DataViewItem(oid)
4190
4191    def ItemToObject(self, item):
4192        """
4193        Retrieve the object that was used to create an item.
4194        """
4195        oid = int(item.GetID())
4196        return self.mapper[oid]
4197
4198    def UseWeakRefs(self, flag):
4199        """
4200        Switch to or from using a weak value dictionary for keeping the ID to
4201        object map.
4202        """
4203        if flag == self.usingWeakRefs:
4204            return
4205        if flag:
4206            import weakref
4207            newmap = weakref.WeakValueDictionary()
4208        else:
4209            newmap = dict()
4210        newmap.update(self.mapper)
4211        self.mapper = newmap
4212        self.usingWeakRefs = flag
4213
4214
4215%End
4216
4217%Extract(id=pycode_dataview)
4218class PyDataViewModel(DataViewModel, DataViewItemObjectMapper):
4219    """
4220    A convenience class that is a :class:`DataViewModel` combined with an object mapper.
4221    """
4222    def __init__(self):
4223        DataViewModel.__init__(self)
4224        DataViewItemObjectMapper.__init__(self)
4225
4226
4227%End
4228
4229%Extract(id=pycode_dataview)
4230PyDataViewIndexListModel = wx.deprecated(DataViewIndexListModel)
4231PyDataViewVirtualListModel = wx.deprecated(DataViewVirtualListModel)
4232
4233%End
4234
4235%Extract(id=pycode_dataview)
4236PyDataViewCustomRenderer = wx.deprecated(DataViewCustomRenderer,
4237                                         "Use DataViewCustomRenderer instead")
4238
4239%End
4240
4241%Extract(id=pycode_dataview)
4242EVT_DATAVIEW_SELECTION_CHANGED         = wx.PyEventBinder( wxEVT_DATAVIEW_SELECTION_CHANGED, 1)
4243EVT_DATAVIEW_ITEM_ACTIVATED            = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_ACTIVATED, 1)
4244EVT_DATAVIEW_ITEM_COLLAPSED            = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_COLLAPSED, 1)
4245EVT_DATAVIEW_ITEM_EXPANDED             = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EXPANDED, 1)
4246EVT_DATAVIEW_ITEM_COLLAPSING           = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_COLLAPSING, 1)
4247EVT_DATAVIEW_ITEM_EXPANDING            = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EXPANDING, 1)
4248EVT_DATAVIEW_ITEM_START_EDITING        = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_START_EDITING, 1)
4249EVT_DATAVIEW_ITEM_EDITING_STARTED      = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EDITING_STARTED, 1)
4250EVT_DATAVIEW_ITEM_EDITING_DONE         = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_EDITING_DONE, 1)
4251EVT_DATAVIEW_ITEM_VALUE_CHANGED        = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, 1)
4252EVT_DATAVIEW_ITEM_CONTEXT_MENU         = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_CONTEXT_MENU, 1)
4253EVT_DATAVIEW_COLUMN_HEADER_CLICK       = wx.PyEventBinder( wxEVT_DATAVIEW_COLUMN_HEADER_CLICK, 1)
4254EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK = wx.PyEventBinder( wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, 1)
4255EVT_DATAVIEW_COLUMN_SORTED             = wx.PyEventBinder( wxEVT_DATAVIEW_COLUMN_SORTED, 1)
4256EVT_DATAVIEW_COLUMN_REORDERED          = wx.PyEventBinder( wxEVT_DATAVIEW_COLUMN_REORDERED, 1)
4257EVT_DATAVIEW_ITEM_BEGIN_DRAG           = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, 1)
4258EVT_DATAVIEW_ITEM_DROP_POSSIBLE        = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, 1)
4259EVT_DATAVIEW_ITEM_DROP                 = wx.PyEventBinder( wxEVT_DATAVIEW_ITEM_DROP, 1)
4260EVT_DATAVIEW_CACHE_HINT                = wx.PyEventBinder( wxEVT_DATAVIEW_CACHE_HINT, 1 )
4261
4262# deprecated wxEVT aliases
4263wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED          = wxEVT_DATAVIEW_SELECTION_CHANGED
4264wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED             = wxEVT_DATAVIEW_ITEM_ACTIVATED
4265wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED             = wxEVT_DATAVIEW_ITEM_COLLAPSED
4266wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED              = wxEVT_DATAVIEW_ITEM_EXPANDED
4267wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING            = wxEVT_DATAVIEW_ITEM_COLLAPSING
4268wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING             = wxEVT_DATAVIEW_ITEM_EXPANDING
4269wxEVT_COMMAND_DATAVIEW_ITEM_START_EDITING         = wxEVT_DATAVIEW_ITEM_START_EDITING
4270wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED       = wxEVT_DATAVIEW_ITEM_EDITING_STARTED
4271wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE          = wxEVT_DATAVIEW_ITEM_EDITING_DONE
4272wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED         = wxEVT_DATAVIEW_ITEM_VALUE_CHANGED
4273wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU          = wxEVT_DATAVIEW_ITEM_CONTEXT_MENU
4274wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK        = wxEVT_DATAVIEW_COLUMN_HEADER_CLICK
4275wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK  = wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK
4276wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED              = wxEVT_DATAVIEW_COLUMN_SORTED
4277wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED           = wxEVT_DATAVIEW_COLUMN_REORDERED
4278wxEVT_COMMAND_DATAVIEW_CACHE_HINT                 = wxEVT_DATAVIEW_CACHE_HINT
4279wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG            = wxEVT_DATAVIEW_ITEM_BEGIN_DRAG
4280wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE         = wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE
4281wxEVT_COMMAND_DATAVIEW_ITEM_DROP                  = wxEVT_DATAVIEW_ITEM_DROP
4282
4283%End
4284
4285
4286//---------------------------------------------------------------------------
4287
4288