X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5d9e16056107bfbcbcc3e601f473e766f03c8dd7..fd5907ffd9b0785bb6eb6f2546101623b23827c5:/include/wx/generic/dataview.h?ds=inline diff --git a/include/wx/generic/dataview.h b/include/wx/generic/dataview.h index a2d944ab93..d47b028b04 100644 --- a/include/wx/generic/dataview.h +++ b/include/wx/generic/dataview.h @@ -17,6 +17,7 @@ #include "wx/control.h" #include "wx/scrolwin.h" #include "wx/icon.h" +#include "wx/vector.h" class WXDLLIMPEXP_FWD_ADV wxDataViewMainWindow; class WXDLLIMPEXP_FWD_ADV wxDataViewHeaderWindow; @@ -56,7 +57,7 @@ public: virtual wxString GetTitle() const { return m_title; } virtual void SetWidth(int width) { m_width = width; UpdateDisplay(); } - virtual int GetWidth() const { return m_width; } + virtual int GetWidth() const; virtual void SetMinWidth(int minWidth) { m_minWidth = minWidth; UpdateDisplay(); } virtual int GetMinWidth() const { return m_minWidth; } @@ -79,7 +80,7 @@ public: private: // common part of all ctors void Init(int width, wxAlignment align, int flags); - + void UpdateDisplay(); wxString m_title; @@ -120,10 +121,11 @@ public: wxDataViewCtrl( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator ) + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDataViewCtrlNameStr ) : wxScrollHelper(this) { - Create(parent, id, pos, size, style, validator ); + Create(parent, id, pos, size, style, validator, name); } virtual ~wxDataViewCtrl(); @@ -133,7 +135,8 @@ public: bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator ); + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxDataViewCtrlNameStr); virtual bool AssociateModel( wxDataViewModel *model ); @@ -204,10 +207,7 @@ protected: public: // utility functions not part of the API // returns the "best" width for the idx-th column - unsigned int GetBestColumnWidth(int WXUNUSED(idx)) const - { - return GetClientSize().GetWidth() / GetColumnCount(); - } + unsigned int GetBestColumnWidth(int idx) const; // called by header window after reorder void ColumnMoved( wxDataViewColumn* col, unsigned int new_pos ); @@ -227,7 +227,16 @@ public: // utility functions not part of the API wxDataViewColumn *GetColumnAt(unsigned int pos) const; private: + virtual wxDataViewItem DoGetCurrentItem() const; + virtual void DoSetCurrentItem(const wxDataViewItem& item); + + void InvalidateColBestWidths(); + void InvalidateColBestWidth(int idx); + wxDataViewColumnList m_cols; + // cached column best widths or 0 if not computed, values are for + // respective columns from m_cols and the arrays have same size + wxVector m_colsBestWidths; wxDataViewModelNotifier *m_notifier; wxDataViewMainWindow *m_clientArea; wxDataViewHeaderWindow *m_headerArea;