- Rewrite wxHeaderCtrl to be virtual-like: even if we don't need an infinite

number of columns in it, it turns out that getting column information from
  the associated control is much easier than copying it into the control.
- Provide wxHeaderCtrlSimple derived class which can be used easily if
  callback approach of wxHeaderCtrl is not needed.
- Because of wxHeaderCtrl virtualization, port-specific implementations of
  wxHeaderColumn are not needed any more and were removed.
- Use wxHeaderCtrl in the generic wxDataViewCtrl: this means that column
  events are broken right now in it as they haven't been implemented by
  wxHeaderCtrl yet, this will be fixed a.s.a.p.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57161 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-12-07 14:47:55 +00:00
parent bc0289bf5e
commit e2bfe6731e
30 changed files with 725 additions and 2034 deletions

View File

@@ -508,26 +508,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 wxHeaderColumnBase
{
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 +538,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);
};
// ---------------------------------------------------------