X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/907f09f44b7b18159d71bb08e9af5fce8c814a14..616c0d1f3ac084bb92f0a75dc48812e8647f1b22:/include/wx/dataview.h diff --git a/include/wx/dataview.h b/include/wx/dataview.h index ba69d16a7d..7b86dea69f 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -19,6 +19,7 @@ #include "wx/textctrl.h" #include "wx/headercol.h" #include "wx/variant.h" +#include "wx/dnd.h" // For wxDragResult declaration only. #include "wx/dynarray.h" #include "wx/icon.h" #include "wx/itemid.h" @@ -376,12 +377,6 @@ public: virtual unsigned GetRow( const wxDataViewItem &item ) const; wxDataViewItem GetItem( unsigned int row ) const; - // compare based on index - - virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2, - unsigned int column, bool ascending ) const; - virtual bool HasDefaultCompare() const; - // implement base methods virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const; @@ -767,7 +762,9 @@ public: #if wxUSE_DRAG_AND_DROP , m_dataObject(NULL), m_dataBuffer(NULL), - m_dataSize(0) + m_dataSize(0), + m_dragFlags(0), + m_dropEffect(wxDragNone) #endif { } @@ -786,7 +783,9 @@ public: , m_dataObject(event.m_dataObject), m_dataFormat(event.m_dataFormat), m_dataBuffer(event.m_dataBuffer), - m_dataSize(event.m_dataSize) + m_dataSize(event.m_dataSize), + m_dragFlags(event.m_dragFlags), + m_dropEffect(event.m_dropEffect) #endif { } @@ -832,6 +831,10 @@ public: size_t GetDataSize() const { return m_dataSize; } void SetDataBuffer( void* buf ) { m_dataBuffer = buf;} void *GetDataBuffer() const { return m_dataBuffer; } + void SetDragFlags( int flags ) { m_dragFlags = flags; } + int GetDragFlags() const { return m_dragFlags; } + void SetDropEffect( wxDragResult effect ) { m_dropEffect = effect; } + wxDragResult GetDropEffect() const { return m_dropEffect; } #endif // wxUSE_DRAG_AND_DROP virtual wxEvent *Clone() const { return new wxDataViewEvent(*this); } @@ -853,6 +856,9 @@ protected: wxDataFormat m_dataFormat; void* m_dataBuffer; size_t m_dataSize; + + int m_dragFlags; + wxDragResult m_dropEffect; #endif // wxUSE_DRAG_AND_DROP private: @@ -933,24 +939,20 @@ typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&); class WXDLLIMPEXP_ADV wxDataViewListStoreLine { public: - wxDataViewListStoreLine( wxClientData *data = NULL ) + wxDataViewListStoreLine( wxUIntPtr data = NULL ) { m_data = data; } - virtual ~wxDataViewListStoreLine() - { - delete m_data; - } - void SetData( wxClientData *data ) - { if (m_data) delete m_data; m_data = data; } - wxClientData *GetData() const + void SetData( wxUIntPtr data ) + { m_data = data; } + wxUIntPtr GetData() const { return m_data; } wxVector m_values; private: - wxClientData *m_data; + wxUIntPtr m_data; }; @@ -964,12 +966,17 @@ public: void InsertColumn( unsigned int pos, const wxString &varianttype ); void AppendColumn( const wxString &varianttype ); - void AppendItem( const wxVector &values, wxClientData *data = NULL ); - void PrependItem( const wxVector &values, wxClientData *data = NULL ); - void InsertItem( unsigned int row, const wxVector &values, wxClientData *data = NULL ); + void AppendItem( const wxVector &values, wxUIntPtr data = NULL ); + void PrependItem( const wxVector &values, wxUIntPtr data = NULL ); + void InsertItem( unsigned int row, const wxVector &values, wxUIntPtr data = NULL ); void DeleteItem( unsigned int pos ); void DeleteAllItems(); + unsigned int GetItemCount() const; + + void SetItemData( const wxDataViewItem& item, wxUIntPtr data ); + wxUIntPtr GetItemData( const wxDataViewItem& item ) const; + // override base virtuals virtual unsigned int GetColumnCount() const; @@ -1046,11 +1053,11 @@ public: wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int width = -1, wxAlignment align = wxALIGN_LEFT, int flags = wxDATAVIEW_COL_RESIZABLE ); - void AppendItem( const wxVector &values, wxClientData *data = NULL ) + void AppendItem( const wxVector &values, wxUIntPtr data = NULL ) { GetStore()->AppendItem( values, data ); } - void PrependItem( const wxVector &values, wxClientData *data = NULL ) + void PrependItem( const wxVector &values, wxUIntPtr data = NULL ) { GetStore()->PrependItem( values, data ); } - void InsertItem( unsigned int row, const wxVector &values, wxClientData *data = NULL ) + void InsertItem( unsigned int row, const wxVector &values, wxUIntPtr data = NULL ) { GetStore()->InsertItem( row, values, data ); } void DeleteItem( unsigned row ) { GetStore()->DeleteItem( row ); } @@ -1075,6 +1082,14 @@ public: bool GetToggleValue( unsigned int row, unsigned int col ) const { wxVariant value; GetStore()->GetValueByRow( value, row, col ); return value.GetBool(); } + void SetItemData( const wxDataViewItem& item, wxUIntPtr data ) + { GetStore()->SetItemData( item, data ); } + wxUIntPtr GetItemData( const wxDataViewItem& item ) const + { return GetStore()->GetItemData( item ); } + + int GetItemCount() const + { return GetStore()->GetItemCount(); } + void OnSize( wxSizeEvent &event ); private: