]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/dataview.h
interface revisions
[wxWidgets.git] / interface / wx / dataview.h
index bf3eac6decbbc8316328530500dd02c8fd7131dc..f214740d715ceac522034637ba8daa94b8827e3f 100644 (file)
@@ -14,7 +14,7 @@
     for data transfer. This class can be converted to a from
     a wxVariant.
 
-    @library{wxbase}
+    @library{wxadv}
     @category{dvc}
 */
 class wxDataViewIconText : public wxObject
@@ -32,7 +32,7 @@ public:
     /**
         Gets the icon.
     */
-    const wxIcon GetIcon() const;
+    const wxIcon& GetIcon() const;
 
     /**
         Gets the text.
@@ -87,7 +87,7 @@ public:
         Returns a pointer to the wxDataViewColumn from which
         the event was emitted or @NULL.
     */
-    wxDataViewColumn* GetDataViewColumn();
+    wxDataViewColumn* GetDataViewColumn() const;
 
     /**
         Returns the wxDataViewModel associated with the event.
@@ -102,7 +102,7 @@ public:
     /**
         Returns a reference to a value.
     */
-    const wxVariant GetValue() const;
+    const wxVariant& GetValue() const;
 
     /**
 
@@ -223,7 +223,7 @@ public:
     /**
         Destructor. This should not be called directly. Use DecRef() instead.
     */
-    ~wxDataViewModel();
+    virtual ~wxDataViewModel();
 
     /**
         Adds a wxDataViewModelNotifier
@@ -267,29 +267,28 @@ public:
     /**
         Override this to indicate the number of columns in the model.
     */
-    virtual unsigned int GetColumnCount() const;
+    virtual unsigned int GetColumnCount() const = 0;
 
     /**
         Override this to indicate what type of data is stored in the
         column specified by @e col. This should return a string
         indicating the type of data as reported by wxVariant.
     */
-    virtual wxString GetColumnType(unsigned int col) const;
+    virtual wxString GetColumnType(unsigned int col) const = 0;
 
     /**
         Override this to indicate which wxDataViewItem representing the parent
         of @a item or an invalid wxDataViewItem if the the root item is
         the parent item.
     */
-    virtual wxDataViewItem GetParent(const wxDataViewItem& item) const;
+    virtual wxDataViewItem GetParent(const wxDataViewItem& item) const = 0;
 
     /**
         Override this to indicate the value of @e item
         A wxVariant is used to store the data.
     */
-    virtual void GetValue(wxVariant& variant,
-                          const wxDataViewItem& item,
-                          unsigned int col) const;
+    virtual void GetValue(wxVariant& variant, const wxDataViewItem& item,
+                          unsigned int col) const = 0;
 
     /**
         Override this method to indicate if a container item merely
@@ -314,7 +313,7 @@ public:
         Override this to indicate of @a item is a container, i.e. if
         it can have child items.
     */
-    virtual bool IsContainer(const wxDataViewItem& item) const;
+    virtual bool IsContainer(const wxDataViewItem& item) const = 0;
 
     /**
         Call this to inform the model that an item has been added
@@ -374,9 +373,8 @@ public:
         Afterwards ValueChanged()
         has to be called!
     */
-    virtual bool SetValue(const wxVariant& variant,
-                          const wxDataViewItem& item,
-                          unsigned int col);
+    virtual bool SetValue(const wxVariant& variant, const wxDataViewItem& item,
+                          unsigned int col) = 0;
 
     /**
         Call this to inform this model that a value in the model has
@@ -400,13 +398,13 @@ public:
     wxDataViewItem (which you can obtain from this class).
     This model also provides its own wxDataViewIndexListModel::Compare
     method which sorts the model's data by the index.
-    
-    This model is not a virtual model since the control stores 
+
+    This model is not a virtual model since the control stores
     each wxDataViewItem. Use wxDataViewVirtualListModel if you
     need to display millions of items or have other reason to
     use a virtual control.
 
-    @library{wxbase}
+    @library{wxadv}
     @category{dvc}
 */
 class wxDataViewIndexListModel : public wxDataViewModel
@@ -420,7 +418,7 @@ public:
     /**
         Destructor.
     */
-    ~wxDataViewIndexListModel();
+    virtual ~wxDataViewIndexListModel();
 
     /**
         Compare method that sorts the items by their index.
@@ -522,7 +520,7 @@ public:
 
     @see wxDataViewIndexListModel for the API.
 
-    @library{wxbase}
+    @library{wxadv}
     @category{dvc}
 */
 class wxDataViewVirtualListModel : public wxDataViewModel
@@ -672,9 +670,40 @@ public:
            Allow variable line heights. This can be inefficient when displaying large number of items.
     @endStyleTable
 
+    @beginEventTable{wxDataViewEvent}
+    @event{EVT_DATAVIEW_SELECTION_CHANGED(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED event.
+    @event{EVT_DATAVIEW_ITEM_ACTIVATED(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED event.
+    @event{EVT_DATAVIEW_ITEM_EDITING_STARTED(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED event.
+    @event{EVT_DATAVIEW_ITEM_EDITING_DONE(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE event.
+    @event{EVT_DATAVIEW_ITEM_COLLAPSING(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING event.
+    @event{EVT_DATAVIEW_ITEM_COLLAPSED(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED event.
+    @event{EVT_DATAVIEW_ITEM_EXPANDING(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING event.
+    @event{EVT_DATAVIEW_ITEM_EXPANDED(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED event.
+    @event{EVT_DATAVIEW_ITEM_VALUE_CHANGED(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED event.
+    @event{EVT_DATAVIEW_ITEM_CONTEXT_MENU(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU event.
+    @event{EVT_DATAVIEW_COLUMN_HEADER_CLICK(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICKED event.
+    @event{EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED event.
+    @event{EVT_DATAVIEW_COLUMN_SORTED(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED event.
+    @event{EVT_DATAVIEW_COLUMN_REORDERED(id, func)}
+           Process a wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED event.
+    @endEventTable
+
     @library{wxadv}
     @category{ctrl,dvc}
-    <!-- @appearance{dataviewctrl.png} -->
+    @appearance{dataviewctrl.png}
 */
 class wxDataViewCtrl : public wxControl
 {
@@ -683,7 +712,7 @@ public:
         Default Constructor.
     */
     wxDataViewCtrl();
-    
+
     /**
         Constructor. Calls Create().
     */
@@ -696,7 +725,7 @@ public:
     /**
         Destructor.
     */
-    ~wxDataViewCtrl();
+    virtual ~wxDataViewCtrl();
 
     /**
         Appends a wxDataViewColumn to the control. Returns @true on success.
@@ -716,7 +745,7 @@ public:
         Inserts a wxDataViewColumn to the control. Returns @true on success.
     */
     virtual bool InsertColumn(unsigned int pos, wxDataViewColumn* col);
-    
+
     //@{
     /**
         Appends a column for rendering a bitmap. Returns the wxDataViewColumn
@@ -740,7 +769,7 @@ public:
     /**
         Appends a column for rendering a date. Returns the wxDataViewColumn
         created in the function or @NULL on failure.
-        
+
         NB: The @e align parameter is applied to both the column header and
         the column renderer.
     */
@@ -763,7 +792,7 @@ public:
         Appends a column for rendering text with an icon. Returns the wxDataViewColumn
         created in the function or @NULL on failure. This method uses the
         wxDataViewIconTextRenderer class.
-        
+
         NB: The @e align parameter is applied to both the column header and
         the column renderer.
     */
@@ -785,7 +814,7 @@ public:
     /**
         Appends a column for rendering a progress indicator. Returns the
         wxDataViewColumn created in the function or @NULL on failure.
-        
+
         NB: The @e align parameter is applied to both the column header and
         the column renderer.
     */
@@ -807,7 +836,7 @@ public:
     /**
         Appends a column for rendering text. Returns the wxDataViewColumn
         created in the function or @NULL on failure.
-        
+
         NB: The @e align parameter is applied to both the column header and
         the column renderer.
     */
@@ -829,7 +858,7 @@ public:
     /**
         Appends a column for rendering a toggle. Returns the wxDataViewColumn
         created in the function or @NULL on failure.
-        
+
         NB: The @e align parameter is applied to both the column header and
         the column renderer.
     */
@@ -866,7 +895,7 @@ public:
     /**
         Collapses the item.
     */
-    void Collapse(const wxDataViewItem& item);
+    virtual void Collapse(const wxDataViewItem& item);
 
     /**
         Create the control. Useful for two step creation.
@@ -891,7 +920,7 @@ public:
     /**
         Expands the item.
     */
-    void Expand(const wxDataViewItem& item);
+    virtual void Expand(const wxDataViewItem& item);
 
     /**
         Returns pointer to the column. @a pos refers to the
@@ -930,18 +959,18 @@ public:
         Returns pointer to the data model associated with the
         control (if any).
     */
-    virtual wxDataViewModel* GetModel() const;
+    wxDataViewModel* GetModel();
 
     /**
         Returns first selected item or an invalid item if none is selected.
     */
-    wxDataViewItem GetSelection() const;
+    virtual wxDataViewItem GetSelection() const;
 
     /**
         Fills @a sel with currently selected items and returns
         their number.
     */
-    int GetSelections(wxDataViewItemArray& sel) const;
+    virtual int GetSelections(wxDataViewItemArray& sel) const;
 
     /**
         Returns the wxDataViewColumn currently responsible for sorting
@@ -958,17 +987,17 @@ public:
     /**
         Return @true if the item is selected.
     */
-    bool IsSelected(const wxDataViewItem& item) const;
+    virtual bool IsSelected(const wxDataViewItem& item) const;
 
     /**
         Select the given item.
     */
-    void Select(const wxDataViewItem& item);
+    virtual void Select(const wxDataViewItem& item);
 
     /**
         Select all items.
     */
-    void SelectAll();
+    virtual void SelectAll();
 
     /**
         Set which column shall contain the tree-like expanders.
@@ -983,18 +1012,18 @@ public:
     /**
         Sets the selection to the array of wxDataViewItems.
     */
-    void SetSelections(const wxDataViewItemArray& sel);
+    virtual void SetSelections(const wxDataViewItemArray& sel);
 
     /**
         Unselect the given item.
     */
-    void Unselect(const wxDataViewItem& item);
+    virtual void Unselect(const wxDataViewItem& item);
 
     /**
         Unselect all item. This method only has effect if multiple
         selections are allowed.
     */
-    void UnselectAll();
+    virtual void UnselectAll();
 };
 
 
@@ -1008,7 +1037,7 @@ public:
     the documentation of that class for further
     information.
 
-    @library{wxbase}
+    @library{wxadv}
     @category{dvc}
 */
 class wxDataViewModelNotifier
@@ -1022,12 +1051,12 @@ public:
     /**
         Destructor.
     */
-    ~wxDataViewModelNotifier();
+    virtual ~wxDataViewModelNotifier();
 
     /**
         Called by owning model.
     */
-    bool Cleared();
+    virtual bool Cleared() = 0;
 
     /**
         Get owning wxDataViewModel.
@@ -1043,7 +1072,7 @@ public:
     /**
         Called by owning model.
     */
-    bool ItemChanged(const wxDataViewItem& item);
+    virtual bool ItemChanged(const wxDataViewItem& item) = 0;
 
     /**
         Called by owning model.
@@ -1060,7 +1089,7 @@ public:
     /**
         Called by owning model.
     */
-    bool ItemsChanged(const wxDataViewItemArray& items);
+    virtual bool ItemsChanged(const wxDataViewItemArray& items);
 
     /**
         Called by owning model.
@@ -1071,7 +1100,7 @@ public:
     /**
         Called by owning model.
     */
-    void Resort();
+    virtual void Resort() = 0;
 
     /**
         Set owner of this notifier. Used internally.
@@ -1081,7 +1110,7 @@ public:
     /**
         Called by owning model.
     */
-    bool ValueChanged(const wxDataViewItem& item, unsigned int col);
+    virtual bool ValueChanged(const wxDataViewItem& item, unsigned int col) = 0;
 };
 
 
@@ -1145,7 +1174,7 @@ class wxDataViewRenderer : public wxObject
 {
 public:
     /**
-        Constructor. 
+        Constructor.
     */
     wxDataViewRenderer(const wxString& varianttype,
                        wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
@@ -1159,29 +1188,29 @@ public:
     /**
         Returns the cell mode.
     */
-    virtual wxDataViewCellMode GetMode();
+    virtual wxDataViewCellMode GetMode() const;
 
     /**
         Returns pointer to the owning wxDataViewColumn.
     */
-    virtual wxDataViewColumn* GetOwner() const;
+    wxDataViewColumn* GetOwner() const;
 
     /**
         This methods retrieves the value from the renderer in order to
         transfer the value back to the data model. Returns @e @false
         on failure.
     */
-    virtual bool GetValue(wxVariant& value);
+    virtual bool GetValue(wxVariant& value) const = 0;
 
     /**
         Returns a string with the type of the wxVariant
         supported by this renderer.
     */
-    virtual wxString GetVariantType();
+    wxString GetVariantType() const;
 
     /**
         Sets the alignment of the renderer's content. The default value
-        of wxDVR_DEFAULT_ALIGMENT indicates that the content should 
+        of wxDVR_DEFAULT_ALIGMENT indicates that the content should
         have the same alignment as the column header. The method is
         not implemented under OS X and the renderer always aligns its
         contents as the column header on that platform. The other platforms
@@ -1192,13 +1221,13 @@ public:
         Sets the owning wxDataViewColumn. This
         is usually called from within wxDataViewColumn.
     */
-    virtual void SetOwner(wxDataViewColumn* owner);
+    void SetOwner(wxDataViewColumn* owner);
 
     /**
         Set the value of the renderer (and thus its cell) to @e value.
         The internal code will then render this cell with this data.
     */
-    virtual bool SetValue(const wxVariant& value);
+    virtual bool SetValue(const wxVariant& value) = 0;
 
     /**
         Before data is committed to the data model, it is passed to this
@@ -1293,7 +1322,7 @@ public:
     supports modifying the values in-place by using a wxSpinCtrl.
     The renderer only support variants of type @e long.
 
-    @library{wxbase}
+    @library{wxadv}
     @category{dvc}
 */
 class wxDataViewSpinRenderer : public wxDataViewCustomRenderer
@@ -1406,12 +1435,12 @@ public:
     */
     wxDataViewCustomRenderer(const wxString& varianttype = "string",
                              wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
-                             int align = wxDVR_DEFAULT_ALIGNMENT );
+                             int align = -1, bool no_init = false);
 
     /**
         Destructor.
     */
-    ~wxDataViewCustomRenderer();
+    virtual ~wxDataViewCustomRenderer();
 
     /**
         Override this to react to double clicks or ENTER. This method will
@@ -1440,7 +1469,7 @@ public:
     /**
         Return size required to show content.
     */
-    virtual wxSize GetSize();
+    virtual wxSize GetSize() const = 0;
 
     /**
         Overrride this so that the renderer can get the value
@@ -1470,7 +1499,7 @@ public:
         wxDataViewRenderer::SetValue was called
         so that this instance knows what to render.
     */
-    virtual bool Render(wxRect cell, wxDC* dc, int state);
+    virtual bool Render(wxRect cell, wxDC* dc, int state) = 0;
 
     /**
         This method should be called from within Render()
@@ -1551,18 +1580,18 @@ public:
     /**
         Destructor.
     */
-    ~wxDataViewColumn();
+    virtual ~wxDataViewColumn();
 
     /**
         Returns the bitmap in the header of the column, if any.
     */
-    const wxBitmap GetBitmap();
+    const wxBitmap& GetBitmap() const;
 
     /**
         Returns the index of the column of the model, which this
         wxDataViewColumn is displaying.
     */
-    unsigned int GetModelColumn();
+    unsigned int GetModelColumn() const;
 
     /**
         Returns the owning wxDataViewCtrl.
@@ -1573,7 +1602,7 @@ public:
         Returns the renderer of this wxDataViewColumn.
         See also wxDataViewRenderer.
     */
-    wxDataViewRenderer* GetRenderer();
+    wxDataViewRenderer* GetRenderer() const;
 
     /**
         Returns @true if the column is reorderable.
@@ -1589,37 +1618,37 @@ public:
     /**
         Returns the width of the column.
     */
-    int GetWidth();
+    virtual int GetWidth() const;
 
     /**
         Returns @true, if the sort order is ascending.
         See also SetSortOrder()
     */
-    bool IsSortOrderAscending();
+    virtual bool IsSortOrderAscending() const;
 
     /**
         Set the alignment of the column header.
     */
-    void SetAlignment(wxAlignment align);
+    virtual void SetAlignment(wxAlignment align);
 
     /**
         Set the bitmap of the column header.
     */
-    void SetBitmap(const wxBitmap& bitmap);
+    virtual void SetBitmap(const wxBitmap& bitmap);
 
     /**
         Indicate wether the column can be reordered by the
         user using the mouse. This is typically implemented
         visually by dragging the header button around.
     */
-    void SetReorderable(bool reorderable);
+    virtual void SetReorderable(bool reorderable);
 
     /**
         Indicate the sort order if the implementation of the
         wxDataViewCtrl supports it, most commonly by showing
         a little arrow.
     */
-    void SetSortOrder(bool ascending);
+    virtual void SetSortOrder(bool ascending);
 
     /**
         Indicate that the column is sortable. This does
@@ -1631,12 +1660,12 @@ public:
         no longer clickable and the sort indicator (little
         arrow) will disappear.
     */
-    void SetSortable(bool sortable);
+    virtual void SetSortable(bool sortable);
 
     /**
         Set the title of the column header to @e title.
     */
-    void SetTitle(const wxString& title);
+    virtual void SetTitle(const wxString& title);
 };
 
 
@@ -1651,9 +1680,9 @@ public:
     like a wxTreeCtrl to make a transition from it
     to the wxDataViewCtrl class simpler.
 
-    @library{wxbase}
+    @library{wxadv}
     @category{ctrl,dvc}
-    <!-- @appearance{dataviewtreectrl.png} -->
+    @appearance{dataviewtreectrl.png}
 */
 class wxDataViewTreeCtrl : public wxDataViewCtrl
 {
@@ -1673,7 +1702,7 @@ public:
     /**
         Destructor. Deletes the image list if any.
     */
-    ~wxDataViewTreeCtrl();
+    virtual ~wxDataViewTreeCtrl();
 
     /**
 
@@ -1735,12 +1764,12 @@ public:
     /**
         Calls the identical method from wxDataViewTreeStore.
     */
-    const wxIcon GetItemExpandedIcon(const wxDataViewItem& item) const;
+    const wxIcon& GetItemExpandedIcon(const wxDataViewItem& item) const;
 
     /**
         Calls the identical method from wxDataViewTreeStore.
     */
-    const wxIcon GetItemIcon(const wxDataViewItem& item) const;
+    const wxIcon& GetItemIcon(const wxDataViewItem& item) const;
 
     /**
         Calls the identical method from wxDataViewTreeStore.
@@ -1855,7 +1884,7 @@ public:
     /**
         Destructor.
     */
-    ~wxDataViewTreeStore();
+    virtual ~wxDataViewTreeStore();
 
     /**
         Append a container.
@@ -1902,12 +1931,12 @@ public:
     /**
         Returns the icon to display in expanded containers.
     */
-    const wxIcon GetItemExpandedIcon(const wxDataViewItem& item) const;
+    const wxIcon& GetItemExpandedIcon(const wxDataViewItem& item) const;
 
     /**
         Returns the icon of the item.
     */
-    const wxIcon GetItemIcon(const wxDataViewItem& item) const;
+    const wxIcon& GetItemIcon(const wxDataViewItem& item) const;
 
     /**
         Returns the text of the item.