+enum wxDataViewCellRenderState
+{
+ wxDATAVIEW_CELL_SELECTED = 1,
+ wxDATAVIEW_CELL_PRELIT = 2,
+ wxDATAVIEW_CELL_INSENSITIVE = 4,
+ wxDATAVIEW_CELL_FOCUSED = 8
+};
+
+class WXDLLIMPEXP_ADV wxDataViewRendererBase: public wxObject
+{
+public:
+ wxDataViewRendererBase( const wxString &varianttype,
+ wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
+ int alignment = wxDVR_DEFAULT_ALIGNMENT );
+
+ virtual bool Validate( wxVariant& WXUNUSED(value) )
+ { return true; }
+
+ void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; }
+ wxDataViewColumn* GetOwner() { return m_owner; }
+
+ // renderer properties:
+
+ virtual bool SetValue( const wxVariant& WXUNUSED(value) ) = 0;
+ virtual bool GetValue( wxVariant& WXUNUSED(value) ) const = 0;
+
+ wxString GetVariantType() const { return m_variantType; }
+
+ virtual void SetMode( wxDataViewCellMode mode ) = 0;
+ virtual wxDataViewCellMode GetMode() const = 0;
+
+ // NOTE: Set/GetAlignment do not take/return a wxAlignment enum but
+ // rather an "int"; that's because for rendering cells it's allowed
+ // to combine alignment flags (e.g. wxALIGN_LEFT|wxALIGN_BOTTOM)
+ virtual void SetAlignment( int align ) = 0;
+ virtual int GetAlignment() const = 0;
+
+ // in-place editing
+ virtual bool HasEditorCtrl()
+ { return false; }
+ virtual wxControl* CreateEditorCtrl(wxWindow * WXUNUSED(parent),
+ wxRect WXUNUSED(labelRect),
+ const wxVariant& WXUNUSED(value))
+ { return NULL; }
+ virtual bool GetValueFromEditorCtrl(wxControl * WXUNUSED(editor),
+ wxVariant& WXUNUSED(value))
+ { return false; }
+
+ virtual bool StartEditing( const wxDataViewItem &item, wxRect labelRect );
+ virtual void CancelEditing();
+ virtual bool FinishEditing();
+
+ wxControl *GetEditorCtrl() { return m_editorCtrl; }
+
+protected:
+ wxString m_variantType;
+ wxDataViewColumn *m_owner;
+ wxControl *m_editorCtrl;
+ wxDataViewItem m_item; // for m_editorCtrl
+
+ // internal utility:
+ const wxDataViewCtrl* GetView() const;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase)
+};
+
+// ---------------------------------------------------------
+// wxDataViewColumnBase
+// ---------------------------------------------------------
+
+enum wxDataViewColumnFlags
+{
+ wxDATAVIEW_COL_RESIZABLE = 1,
+ wxDATAVIEW_COL_SORTABLE = 2,
+ wxDATAVIEW_COL_HIDDEN = 4
+};
+
+class WXDLLIMPEXP_ADV wxDataViewColumnBase: public wxObject
+{
+public:
+ wxDataViewColumnBase( const wxString &title, wxDataViewRenderer *renderer,
+ unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ wxDataViewColumnBase( const wxBitmap &bitmap, wxDataViewRenderer *renderer,
+ unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
+ wxAlignment align = wxALIGN_CENTER,
+ int flags = wxDATAVIEW_COL_RESIZABLE );
+ virtual ~wxDataViewColumnBase();
+
+ // setters:
+
+ virtual void SetTitle( const wxString &title ) = 0;
+ virtual void SetAlignment( wxAlignment align ) = 0;
+ virtual void SetSortable( bool sortable ) = 0;
+ virtual void SetResizeable( bool resizeable ) = 0;
+ virtual void SetHidden( bool hidden ) = 0;
+ virtual void SetSortOrder( bool ascending ) = 0;
+ virtual void SetFlags( int flags );
+ virtual void SetOwner( wxDataViewCtrl *owner )
+ { m_owner = owner; }
+ virtual void SetBitmap( const wxBitmap &bitmap )
+ { m_bitmap=bitmap; }
+
+ virtual void SetMinWidth( int minWidth ) = 0;
+ virtual void SetWidth( int width ) = 0;
+
+
+ // getters:
+
+ virtual wxString GetTitle() const = 0;
+ virtual wxAlignment GetAlignment() const = 0;
+ virtual int GetWidth() const = 0;
+ virtual int GetMinWidth() const = 0;
+
+ virtual int GetFlags() const;
+
+ virtual bool IsSortable() const = 0;
+ virtual bool IsResizeable() const = 0;
+ virtual bool IsHidden() const = 0;
+ virtual bool IsSortOrderAscending() const = 0;
+
+ const wxBitmap &GetBitmap() const { return m_bitmap; }
+ unsigned int GetModelColumn() const { return m_model_column; }
+
+ wxDataViewCtrl *GetOwner() { return m_owner; }
+ wxDataViewRenderer* GetRenderer() { return m_renderer; }
+
+protected:
+ wxDataViewRenderer *m_renderer;
+ int m_model_column;
+ wxBitmap m_bitmap;
+ wxDataViewCtrl *m_owner;
+
+protected:
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase)
+};
+
+// ---------------------------------------------------------