+ bool m_ascending;
+ wxDataViewListModel *m_child;
+ wxDataViewSortedIndexArray m_array;
+ wxDataViewListModelNotifier *m_notifierOnChild;
+
+ void InitStatics(); // BAD
+};
+
+//-----------------------------------------------------------------------------
+// wxDataViewEditorCtrlEvtHandler
+//-----------------------------------------------------------------------------
+
+class wxDataViewEditorCtrlEvtHandler: public wxEvtHandler
+{
+public:
+ wxDataViewEditorCtrlEvtHandler( wxControl *editor, wxDataViewRenderer *owner );
+
+ void AcceptChangesAndFinish();
+ void SetFocusOnIdle( bool focus = true ) { m_focusOnIdle = focus; }
+
+protected:
+ void OnChar( wxKeyEvent &event );
+ void OnKillFocus( wxFocusEvent &event );
+ void OnIdle( wxIdleEvent &event );
+
+private:
+ wxDataViewRenderer *m_owner;
+ wxControl *m_editorCtrl;
+ bool m_finished;
+ bool m_focusOnIdle;
+
+private:
+ DECLARE_EVENT_TABLE()
+};
+
+// ---------------------------------------------------------
+// wxDataViewRendererBase
+// ---------------------------------------------------------
+
+enum wxDataViewCellMode
+{
+ wxDATAVIEW_CELL_INERT,
+ wxDATAVIEW_CELL_ACTIVATABLE,
+ wxDATAVIEW_CELL_EDITABLE
+};
+
+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( unsigned int row, wxRect labelRect );
+ virtual void CancelEditing();
+ virtual bool FinishEditing();
+
+ wxControl *GetEditorCtrl() { return m_editorCtrl; }
+
+protected:
+ wxString m_variantType;
+ wxDataViewColumn *m_owner;
+ wxControl *m_editorCtrl;
+ unsigned int m_row; // 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; }