X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/56873923f39af96aac6bfc5776d2637b8c4623ca..d8359d3ca077993d3ef61d6c09000ce7beeb577b:/include/wx/dataview.h diff --git a/include/wx/dataview.h b/include/wx/dataview.h index b98220ac3e..fee4defdf7 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -26,6 +26,7 @@ #include "wx/weakref.h" #if !(defined(__WXGTK20__) || defined(__WXMAC__)) || defined(__WXUNIVERSAL__) +// #if !(defined(__WXMAC__)) || defined(__WXUNIVERSAL__) #define wxHAS_GENERIC_DATAVIEWCTRL #endif @@ -508,26 +509,25 @@ enum wxDataViewColumnFlags wxDATAVIEW_COL_HIDDEN = wxCOL_HIDDEN }; -class WXDLLIMPEXP_ADV wxDataViewColumnBase : public -// native implementations of wxDataViewCtrl have their own implementations of -// wxDataViewColumnBase and so they need to only inherit from -// wxHeaderColumnBase to provide the same interface as the generic port which -// uses the platform native (if any) wxHeaderColumn -#ifdef wxHAS_GENERIC_DATAVIEWCTRL - wxHeaderColumn -#else - wxHeaderColumnBase -#endif +class WXDLLIMPEXP_ADV wxDataViewColumnBase : public wxSettableHeaderColumn { 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 ); + // ctor for the text columns: takes ownership of renderer + wxDataViewColumnBase(wxDataViewRenderer *renderer, + unsigned int model_column) + { + Init(renderer, model_column); + } + + // ctor for the bitmap columns + wxDataViewColumnBase(const wxBitmap& bitmap, + wxDataViewRenderer *renderer, + unsigned int model_column) + : m_bitmap(bitmap) + { + Init(renderer, model_column); + } + virtual ~wxDataViewColumnBase(); // setters: @@ -539,23 +539,20 @@ public: wxDataViewCtrl *GetOwner() const { return m_owner; } wxDataViewRenderer* GetRenderer() const { return m_renderer; } -#ifndef wxHAS_GENERIC_DATAVIEWCTRL // implement some of base class pure virtuals (the rest is port-dependent // and done differently in generic and native versions) virtual void SetBitmap( const wxBitmap& bitmap ) { m_bitmap = bitmap; } virtual wxBitmap GetBitmap() const { return m_bitmap; } -#endif // !wxHAS_GENERIC_DATAVIEWCTRL protected: wxDataViewRenderer *m_renderer; int m_model_column; -#ifndef wxHAS_GENERIC_DATAVIEWCTRL wxBitmap m_bitmap; -#endif // !wxHAS_GENERIC_DATAVIEWCTRL wxDataViewCtrl *m_owner; -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase) +private: + // common part of all ctors + void Init(wxDataViewRenderer *renderer, unsigned int model_column); }; // --------------------------------------------------------- @@ -716,7 +713,9 @@ public: virtual void UnselectAll() = 0; virtual void Expand( const wxDataViewItem & item ) = 0; + virtual void ExpandAncestors( const wxDataViewItem & item ); virtual void Collapse( const wxDataViewItem & item ) = 0; + virtual bool IsExpanded( const wxDataViewItem & item ) const = 0; virtual void EnsureVisible( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) = 0; @@ -797,28 +796,28 @@ private: DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent) }; -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED; +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEvent ) -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED; -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED; -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED; -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING; -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING; -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED; -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE; -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED; +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEvent ) +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED, wxDataViewEvent ) +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED, wxDataViewEvent ) +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING, wxDataViewEvent ) +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING, wxDataViewEvent ) +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED, wxDataViewEvent ) +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE, wxDataViewEvent ) +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEvent ) -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU; +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, wxDataViewEvent ) -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK; -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK; -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED; -extern WXDLLIMPEXP_ADV const wxEventType wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED; +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK, wxDataViewEvent ) +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, wxDataViewEvent ) +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED, wxDataViewEvent ) +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_COMMAND_DATAVIEW_COLUMN_REORDERED, wxDataViewEvent ) typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&); #define wxDataViewEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDataViewEventFunction, &func) + wxEVENT_HANDLER_CAST(wxDataViewEventFunction, func) #define wx__DECLARE_DATAVIEWEVT(evt, id, fn) \ wx__DECLARE_EVT1(wxEVT_COMMAND_DATAVIEW_ ## evt, id, wxDataViewEventHandler(fn)) @@ -881,7 +880,7 @@ private: long m_min,m_max; }; -#ifndef __WXGTK20__ +#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXMAC__) // ------------------------------------- // wxDataViewChoiceRenderer