// Name: wx/generic/dataview.h
// Purpose: wxDataViewCtrl generic implementation header
// Author: Robert Roebling
+// Modified By: Bo Yang
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// classes
// ---------------------------------------------------------
-class WXDLLIMPEXP_ADV wxDataViewCtrl;
-class WXDLLIMPEXP_ADV wxDataViewMainWindow;
-class WXDLLIMPEXP_ADV wxDataViewHeaderWindow;
+class WXDLLIMPEXP_FWD_ADV wxDataViewCtrl;
+class WXDLLIMPEXP_FWD_ADV wxDataViewMainWindow;
+class WXDLLIMPEXP_FWD_ADV wxDataViewHeaderWindow;
// ---------------------------------------------------------
// wxDataViewRenderer
{ return m_mode; }
virtual bool Activate( wxRect WXUNUSED(cell),
- wxDataViewListModel *WXUNUSED(model),
- unsigned int WXUNUSED(col),
- unsigned int WXUNUSED(row) )
+ wxDataViewModel *WXUNUSED(model),
+ const wxDataViewItem & WXUNUSED(item),
+ unsigned int WXUNUSED(col) )
{ return false; }
virtual bool LeftClick( wxPoint WXUNUSED(cursor),
wxRect WXUNUSED(cell),
- wxDataViewListModel *WXUNUSED(model),
- unsigned int WXUNUSED(col),
- unsigned int WXUNUSED(row) )
+ wxDataViewModel *WXUNUSED(model),
+ const wxDataViewItem & WXUNUSED(item),
+ unsigned int WXUNUSED(col) )
{ return false; }
virtual bool RightClick( wxPoint WXUNUSED(cursor),
wxRect WXUNUSED(cell),
- wxDataViewListModel *WXUNUSED(model),
- unsigned int WXUNUSED(col),
- unsigned int WXUNUSED(row) )
+ wxDataViewModel *WXUNUSED(model),
+ const wxDataViewItem & WXUNUSED(item),
+ unsigned int WXUNUSED(col) )
{ return false; }
virtual bool StartDrag( wxPoint WXUNUSED(cursor),
wxRect WXUNUSED(cell),
- wxDataViewListModel *WXUNUSED(model),
- unsigned int WXUNUSED(col),
- unsigned int WXUNUSED(row) )
+ wxDataViewModel *WXUNUSED(model),
+ const wxDataViewItem & WXUNUSED(item),
+ unsigned int WXUNUSED(col) )
{ return false; }
// Create DC on request
virtual wxDC *GetDC();
private:
- wxDC *m_dc;
- int m_align;
- wxDataViewCellMode m_mode;
+ wxDC *m_dc;
+ int m_align;
+ wxDataViewCellMode m_mode;
protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer)
};
+
// ---------------------------------------------------------
// wxDataViewTextRenderer
// ---------------------------------------------------------
bool Render( wxRect cell, wxDC *dc, int state );
wxSize GetSize() const;
+ // in-place editing
+ virtual bool HasEditorCtrl();
+ virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
+ virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
+
private:
- wxString m_text;
+ wxString m_text;
protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer)
bool GetValue( wxVariant &value ) const;
bool Render( wxRect cell, wxDC *dc, int state );
- bool Activate( wxRect cell, wxDataViewListModel *model, unsigned int col,
- unsigned int row );
+ bool Activate( wxRect cell, wxDataViewModel *model, const wxDataViewItem & item,
+ unsigned int col );
wxSize GetSize() const;
private:
virtual bool Render( wxRect cell, wxDC *dc, int state );
virtual wxSize GetSize() const;
virtual bool Activate( wxRect cell,
- wxDataViewListModel *model, unsigned int col, unsigned int row );
+ wxDataViewModel *model, const wxDataViewItem & item, unsigned int col );
private:
wxDateTime m_date;
int m_flags;
wxAlignment m_align;
wxString m_title;
+ bool m_ascending;
void Init(int width);
public:
wxDataViewCtrl() : wxScrollHelperNative(this)
{
+ m_sortingColumn = 0;
Init();
}
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator );
- virtual bool AssociateModel( wxDataViewListModel *model );
+ virtual bool AssociateModel( wxDataViewModel *model );
virtual bool AppendColumn( wxDataViewColumn *col );
- virtual void SetSelection( int row ); // -1 for unselect
- virtual void SetSelectionRange( unsigned int from, unsigned int to );
- virtual void SetSelections( const wxArrayInt& aSelections);
- virtual void Unselect( unsigned int row );
-
- virtual bool IsSelected( unsigned int row ) const;
- virtual int GetSelection() const;
- virtual int GetSelections(wxArrayInt& aSelections) const;
+ virtual void DoSetExpanderColumn();
+ virtual void DoSetIndent();
+
+ virtual wxDataViewItem GetSelection() const;
+ virtual int GetSelections( wxDataViewItemArray & sel ) const;
+ virtual void SetSelections( const wxDataViewItemArray & sel );
+ virtual void Select( const wxDataViewItem & item );
+ virtual void Unselect( const wxDataViewItem & item );
+ virtual bool IsSelected( const wxDataViewItem & item ) const;
+
+ virtual void SelectAll();
+ virtual void UnselectAll();
+
+ virtual void EnsureVisible( const wxDataViewItem & item,
+ const wxDataViewColumn *column = NULL );
+ virtual void HitTest( const wxPoint & point, wxDataViewItem & item, wxDataViewColumn* &column ) const;
+ virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const;
+
+protected:
+ virtual int GetSelections( wxArrayInt & sel ) const;
+ virtual void SetSelections( const wxArrayInt & sel );
+ virtual void Select( int row );
+ virtual void Unselect( int row );
+ virtual bool IsSelected( int row ) const;
+ virtual void SelectRange( int from, int to );
+ virtual void UnselectRange( int from, int to );
+
+ virtual void EnsureVisible( int row, int column );
+
+ virtual wxDataViewItem GetItemByRow( unsigned int row ) const;
+ virtual int GetRowByItem( const wxDataViewItem & item ) const;
+
+ unsigned int GetSortingColumn() { return m_sortingColumn; }
+ void SetSortingColumn( unsigned int column ) { m_sortingColumn = column; }
public: // utility functions not part of the API
// updates the header window after a change in a column setting
void OnColumnChange();
+ wxWindow *GetMainWindow() { return (wxWindow*) m_clientArea; }
+
private:
- wxDataViewListModelNotifier *m_notifier;
+ wxDataViewModelNotifier *m_notifier;
wxDataViewMainWindow *m_clientArea;
wxDataViewHeaderWindow *m_headerArea;
+ unsigned int m_sortingColumn;
private:
void OnSize( wxSizeEvent &event );