Source and warning cleaning after enabling wxUSE_DATAVIEWCTRL in wxMSW builds.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38384 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2006-03-27 14:01:33 +00:00
parent f3b0f8ad21
commit f554a14b89
5 changed files with 318 additions and 304 deletions

View File

@@ -32,7 +32,7 @@
#endif #endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxDataViewCtrl flags // wxDataViewCtrl flags
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -47,23 +47,23 @@ class WXDLLIMPEXP_CORE wxDataViewCell;
extern WXDLLEXPORT_DATA(const wxChar) wxDataViewCtrlNameStr[]; extern WXDLLEXPORT_DATA(const wxChar) wxDataViewCtrlNameStr[];
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewModel // wxDataViewModel
// --------------------------------------------------------- // ---------------------------------------------------------
class wxDataViewModel: public wxObject class wxDataViewModel: public wxObject
{ {
public: public:
wxDataViewModel() { } wxDataViewModel() { }
virtual ~wxDataViewModel() { } virtual ~wxDataViewModel() { }
protected: protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewModel) DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewModel)
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewListModelNotifier // wxDataViewListModelNotifier
// --------------------------------------------------------- // ---------------------------------------------------------
class wxDataViewListModelNotifier: public wxObject class wxDataViewListModelNotifier: public wxObject
@@ -71,7 +71,7 @@ class wxDataViewListModelNotifier: public wxObject
public: public:
wxDataViewListModelNotifier() { } wxDataViewListModelNotifier() { }
virtual ~wxDataViewListModelNotifier() { } virtual ~wxDataViewListModelNotifier() { }
virtual bool RowAppended() = 0; virtual bool RowAppended() = 0;
virtual bool RowPrepended() = 0; virtual bool RowPrepended() = 0;
virtual bool RowInserted( size_t before ) = 0; virtual bool RowInserted( size_t before ) = 0;
@@ -80,17 +80,17 @@ public:
virtual bool ValueChanged( size_t col, size_t row ) = 0; virtual bool ValueChanged( size_t col, size_t row ) = 0;
virtual bool RowsReordered( size_t *new_order ) = 0; virtual bool RowsReordered( size_t *new_order ) = 0;
virtual bool Cleared() = 0; virtual bool Cleared() = 0;
void SetOwner( wxDataViewListModel *owner ) { m_owner = owner; } void SetOwner( wxDataViewListModel *owner ) { m_owner = owner; }
wxDataViewListModel *GetOwner() { return m_owner; } wxDataViewListModel *GetOwner() { return m_owner; }
private: private:
wxDataViewListModel *m_owner; wxDataViewListModel *m_owner;
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewListModel // wxDataViewListModel
// --------------------------------------------------------- // ---------------------------------------------------------
class wxDataViewViewingColumn: public wxObject class wxDataViewViewingColumn: public wxObject
{ {
@@ -100,7 +100,7 @@ public:
m_viewColumn = view_column; m_viewColumn = view_column;
m_modelColumn = model_column; m_modelColumn = model_column;
} }
wxDataViewColumn *m_viewColumn; wxDataViewColumn *m_viewColumn;
size_t m_modelColumn; size_t m_modelColumn;
}; };
@@ -130,13 +130,13 @@ public:
virtual bool RowsReordered( size_t *new_order ); virtual bool RowsReordered( size_t *new_order );
virtual bool Cleared(); virtual bool Cleared();
// Used internally // Used internally
virtual void AddViewingColumn( wxDataViewColumn *view_column, size_t model_column ); virtual void AddViewingColumn( wxDataViewColumn *view_column, size_t model_column );
virtual void RemoveViewingColumn( wxDataViewColumn *column ); virtual void RemoveViewingColumn( wxDataViewColumn *column );
virtual void AddNotifier( wxDataViewListModelNotifier *notifier ); virtual void AddNotifier( wxDataViewListModelNotifier *notifier );
virtual void RemoveNotifier( wxDataViewListModelNotifier *notifier ); virtual void RemoveNotifier( wxDataViewListModelNotifier *notifier );
wxList m_notifiers; wxList m_notifiers;
wxList m_viewingColumns; wxList m_viewingColumns;
@@ -144,9 +144,9 @@ protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewListModel) DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewListModel)
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewSortedListModel // wxDataViewSortedListModel
// --------------------------------------------------------- // ---------------------------------------------------------
typedef int (wxCALLBACK *wxDataViewListModelCompare) typedef int (wxCALLBACK *wxDataViewListModelCompare)
(size_t row1, size_t row2, size_t col, wxDataViewListModel* model ); (size_t row1, size_t row2, size_t col, wxDataViewListModel* model );
@@ -191,9 +191,9 @@ protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewSortedListModel) DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewSortedListModel)
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewCellBase // wxDataViewCellBase
// --------------------------------------------------------- // ---------------------------------------------------------
enum wxDataViewCellMode enum wxDataViewCellMode
{ {
@@ -215,16 +215,16 @@ class wxDataViewCellBase: public wxObject
public: public:
wxDataViewCellBase( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); wxDataViewCellBase( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
virtual bool SetValue( const wxVariant &value ) { return true; } virtual bool SetValue( const wxVariant& WXUNUSED(value) ) { return true; }
virtual bool GetValue( wxVariant &value ) { return true; } virtual bool GetValue( wxVariant& WXUNUSED(value) ) { return true; }
virtual bool Validate( wxVariant &value ) { return true; } virtual bool Validate( wxVariant& WXUNUSED(value) ) { return true; }
wxString GetVariantType() { return m_variantType; } wxString GetVariantType() { return m_variantType; }
wxDataViewCellMode GetMode() { return m_mode; } wxDataViewCellMode GetMode() { return m_mode; }
void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; } void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; }
wxDataViewColumn* GetOwner() { return m_owner; } wxDataViewColumn* GetOwner() { return m_owner; }
protected: protected:
wxDataViewCellMode m_mode; wxDataViewCellMode m_mode;
wxString m_variantType; wxString m_variantType;
@@ -234,9 +234,9 @@ protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCellBase) DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCellBase)
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewColumnBase // wxDataViewColumnBase
// --------------------------------------------------------- // ---------------------------------------------------------
enum wxDataViewColumnFlags enum wxDataViewColumnFlags
{ {
@@ -253,11 +253,11 @@ public:
virtual void SetTitle( const wxString &title ); virtual void SetTitle( const wxString &title );
virtual wxString GetTitle(); virtual wxString GetTitle();
wxDataViewCell* GetCell() { return m_cell; } wxDataViewCell* GetCell() { return m_cell; }
size_t GetModelColumn() { return m_model_column; } size_t GetModelColumn() { return m_model_column; }
void SetOwner( wxDataViewCtrl *owner ) { m_owner = owner; } void SetOwner( wxDataViewCtrl *owner ) { m_owner = owner; }
wxDataViewCtrl *GetOwner() { return m_owner; } wxDataViewCtrl *GetOwner() { return m_owner; }
@@ -273,29 +273,29 @@ protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase) DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase)
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewCtrlBase // wxDataViewCtrlBase
// --------------------------------------------------------- // ---------------------------------------------------------
class wxDataViewCtrlBase: public wxControl class wxDataViewCtrlBase: public wxControl
{ {
public: public:
wxDataViewCtrlBase(); wxDataViewCtrlBase();
~wxDataViewCtrlBase(); ~wxDataViewCtrlBase();
virtual bool AssociateModel( wxDataViewListModel *model ); virtual bool AssociateModel( wxDataViewListModel *model );
wxDataViewListModel* GetModel(); wxDataViewListModel* GetModel();
virtual bool AppendTextColumn( const wxString &label, size_t model_column ); virtual bool AppendTextColumn( const wxString &label, size_t model_column );
virtual bool AppendToggleColumn( const wxString &label, size_t model_column ); virtual bool AppendToggleColumn( const wxString &label, size_t model_column );
virtual bool AppendProgressColumn( const wxString &label, size_t model_column ); virtual bool AppendProgressColumn( const wxString &label, size_t model_column );
virtual bool AppendDateColumn( const wxString &label, size_t model_column ); virtual bool AppendDateColumn( const wxString &label, size_t model_column );
virtual bool AppendColumn( wxDataViewColumn *col ); virtual bool AppendColumn( wxDataViewColumn *col );
virtual size_t GetNumberOfColumns(); virtual size_t GetNumberOfColumns();
virtual bool DeleteColumn( size_t pos ); virtual bool DeleteColumn( size_t pos );
virtual bool ClearColumns(); virtual bool ClearColumns();
virtual wxDataViewColumn* GetColumn( size_t pos ); virtual wxDataViewColumn* GetColumn( size_t pos );
private: private:
wxDataViewListModel *m_model; wxDataViewListModel *m_model;
wxList m_cols; wxList m_cols;

View File

@@ -16,17 +16,17 @@
#include "wx/control.h" #include "wx/control.h"
#include "wx/scrolwin.h" #include "wx/scrolwin.h"
// --------------------------------------------------------- // ---------------------------------------------------------
// classes // classes
// --------------------------------------------------------- // ---------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataViewCtrl; class WXDLLIMPEXP_CORE wxDataViewCtrl;
class WXDLLIMPEXP_CORE wxDataViewMainWindow; class WXDLLIMPEXP_CORE wxDataViewMainWindow;
class WXDLLIMPEXP_CORE wxDataViewHeaderWindow; class WXDLLIMPEXP_CORE wxDataViewHeaderWindow;
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewCell // wxDataViewCell
// --------------------------------------------------------- // ---------------------------------------------------------
class wxDataViewCell: public wxDataViewCellBase class wxDataViewCell: public wxDataViewCellBase
{ {
@@ -36,144 +36,155 @@ public:
virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0; virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
virtual wxSize GetSize() = 0; virtual wxSize GetSize() = 0;
virtual bool Activate( wxRect cell, virtual bool Activate( wxRect WXUNUSED(cell),
wxDataViewListModel *model, size_t col, size_t row ) wxDataViewListModel *WXUNUSED(model),
size_t WXUNUSED(col),
size_t WXUNUSED(row) )
{ return false; } { return false; }
virtual bool LeftClick( wxPoint cursor, wxRect cell, virtual bool LeftClick( wxPoint WXUNUSED(cursor),
wxDataViewListModel *model, size_t col, size_t row ) wxRect WXUNUSED(cell),
{ return false; } wxDataViewListModel *WXUNUSED(model),
virtual bool RightClick( wxPoint cursor, wxRect cell, size_t WXUNUSED(col),
wxDataViewListModel *model, size_t col, size_t row ) size_t WXUNUSED(row) )
{ return false; } { return false; }
virtual bool StartDrag( wxPoint cursor, wxRect cell, virtual bool RightClick( wxPoint WXUNUSED(cursor),
wxDataViewListModel *model, size_t col, size_t row ) wxRect WXUNUSED(cell),
{ return false; } wxDataViewListModel *WXUNUSED(model),
size_t WXUNUSED(col),
size_t WXUNUSED(row) )
{ return false; }
virtual bool StartDrag( wxPoint WXUNUSED(cursor),
wxRect WXUNUSED(cell),
wxDataViewListModel *WXUNUSED(model),
size_t WXUNUSED(col),
size_t WXUNUSED(row) )
{ return false; }
// Create DC on request // Create DC on request
virtual wxDC *GetDC(); virtual wxDC *GetDC();
private: private:
wxDC *m_dc; wxDC *m_dc;
protected: protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell) DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell)
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewCustomCell // wxDataViewCustomCell
// --------------------------------------------------------- // ---------------------------------------------------------
class wxDataViewCustomCell: public wxDataViewCell class wxDataViewCustomCell: public wxDataViewCell
{ {
public: public:
wxDataViewCustomCell( const wxString &varianttype = wxT("string"), wxDataViewCustomCell( const wxString &varianttype = wxT("string"),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
protected: protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell) DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell)
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewTextCell // wxDataViewTextCell
// --------------------------------------------------------- // ---------------------------------------------------------
class wxDataViewTextCell: public wxDataViewCustomCell class wxDataViewTextCell: public wxDataViewCustomCell
{ {
public: public:
wxDataViewTextCell( const wxString &varianttype = wxT("string"), wxDataViewTextCell( const wxString &varianttype = wxT("string"),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
bool SetValue( const wxVariant &value ); bool SetValue( const wxVariant &value );
bool GetValue( wxVariant &value ); bool GetValue( wxVariant &value );
bool Render( wxRect cell, wxDC *dc, int state ); bool Render( wxRect cell, wxDC *dc, int state );
wxSize GetSize(); wxSize GetSize();
private: private:
wxString m_text; wxString m_text;
protected: protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell) DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell)
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewToggleCell // wxDataViewToggleCell
// --------------------------------------------------------- // ---------------------------------------------------------
class wxDataViewToggleCell: public wxDataViewCustomCell class wxDataViewToggleCell: public wxDataViewCustomCell
{ {
public: public:
wxDataViewToggleCell( const wxString &varianttype = wxT("bool"), wxDataViewToggleCell( const wxString &varianttype = wxT("bool"),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
bool SetValue( const wxVariant &value ); bool SetValue( const wxVariant &value );
bool GetValue( wxVariant &value ); bool GetValue( wxVariant &value );
bool Render( wxRect cell, wxDC *dc, int state ); bool Render( wxRect cell, wxDC *dc, int state );
bool Activate( wxRect cell, wxDataViewListModel *model, size_t col, size_t row ); bool Activate( wxRect cell, wxDataViewListModel *model, size_t col, size_t row );
wxSize GetSize(); wxSize GetSize();
private: private:
bool m_toggle; bool m_toggle;
protected: protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell) DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell)
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewProgressCell // wxDataViewProgressCell
// --------------------------------------------------------- // ---------------------------------------------------------
class wxDataViewProgressCell: public wxDataViewCustomCell class wxDataViewProgressCell: public wxDataViewCustomCell
{ {
public: public:
wxDataViewProgressCell( const wxString &label = wxEmptyString, wxDataViewProgressCell( const wxString &label = wxEmptyString,
const wxString &varianttype = wxT("long"), const wxString &varianttype = wxT("long"),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
~wxDataViewProgressCell(); ~wxDataViewProgressCell();
bool SetValue( const wxVariant &value ); bool SetValue( const wxVariant &value );
virtual bool Render( wxRect cell, wxDC *dc, int state ); virtual bool Render( wxRect cell, wxDC *dc, int state );
virtual wxSize GetSize(); virtual wxSize GetSize();
private: private:
wxString m_label; wxString m_label;
int m_value; int m_value;
protected: protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell) DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell)
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewDateCell // wxDataViewDateCell
// --------------------------------------------------------- // ---------------------------------------------------------
class wxDataViewDateCell: public wxDataViewCustomCell class wxDataViewDateCell: public wxDataViewCustomCell
{ {
public: public:
wxDataViewDateCell( const wxString &varianttype = wxT("datetime"), wxDataViewDateCell( const wxString &varianttype = wxT("datetime"),
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE ); wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE );
bool SetValue( const wxVariant &value ); bool SetValue( const wxVariant &value );
virtual bool Render( wxRect cell, wxDC *dc, int state ); virtual bool Render( wxRect cell, wxDC *dc, int state );
virtual wxSize GetSize(); virtual wxSize GetSize();
virtual bool Activate( wxRect cell, virtual bool Activate( wxRect cell,
wxDataViewListModel *model, size_t col, size_t row ); wxDataViewListModel *model, size_t col, size_t row );
private: private:
wxDateTime m_date; wxDateTime m_date;
protected: protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell) DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell)
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewColumn // wxDataViewColumn
// --------------------------------------------------------- // ---------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataViewColumn: public wxDataViewColumnBase class WXDLLIMPEXP_CORE wxDataViewColumn: public wxDataViewColumnBase
{ {
@@ -182,10 +193,10 @@ public:
virtual ~wxDataViewColumn(); virtual ~wxDataViewColumn();
virtual void SetTitle( const wxString &title ); virtual void SetTitle( const wxString &title );
void SetWidth( int width ) { m_width = width; } void SetWidth( int width ) { m_width = width; }
int GetWidth() { return m_width; } int GetWidth() { return m_width; }
private: private:
int m_width; int m_width;
@@ -193,11 +204,11 @@ protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn) DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn)
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewCtrl // wxDataViewCtrl
// --------------------------------------------------------- // ---------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataViewCtrl: public wxDataViewCtrlBase, class WXDLLIMPEXP_CORE wxDataViewCtrl: public wxDataViewCtrlBase,
public wxScrollHelperNative public wxScrollHelperNative
{ {
public: public:
@@ -205,11 +216,11 @@ public:
{ {
Init(); Init();
} }
wxDataViewCtrl( wxWindow *parent, wxWindowID id, wxDataViewCtrl( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator ) const wxValidator& validator = wxDefaultValidator )
: wxScrollHelperNative(this) : wxScrollHelperNative(this)
{ {
Create(parent, id, pos, size, style, validator ); Create(parent, id, pos, size, style, validator );
@@ -226,17 +237,17 @@ public:
virtual bool AssociateModel( wxDataViewListModel *model ); virtual bool AssociateModel( wxDataViewListModel *model );
virtual bool AppendColumn( wxDataViewColumn *col ); virtual bool AppendColumn( wxDataViewColumn *col );
private: private:
friend class wxDataViewMainWindow; friend class wxDataViewMainWindow;
friend class wxDataViewHeaderWindow; friend class wxDataViewHeaderWindow;
wxDataViewListModelNotifier *m_notifier; wxDataViewListModelNotifier *m_notifier;
wxDataViewMainWindow *m_clientArea; wxDataViewMainWindow *m_clientArea;
wxDataViewHeaderWindow *m_headerArea; wxDataViewHeaderWindow *m_headerArea;
private: private:
void OnSize( wxSizeEvent &event ); void OnSize( wxSizeEvent &event );
// we need to return a special WM_GETDLGCODE value to process just the // we need to return a special WM_GETDLGCODE value to process just the
// arrows but let the other navigation characters through // arrows but let the other navigation characters through
#ifdef __WXMSW__ #ifdef __WXMSW__

View File

@@ -147,7 +147,7 @@ public:
m_colour = value.GetString(); m_colour = value.GetString();
return true; return true;
} }
bool Render( wxRect rect, wxDC *dc, int state ) bool Render( wxRect rect, wxDC *dc, int WXUNUSED(state) )
{ {
dc->SetPen( *wxBLACK_PEN ); dc->SetPen( *wxBLACK_PEN );
if (m_colour == wxT("red")) if (m_colour == wxT("red"))
@@ -163,8 +163,10 @@ public:
{ {
return wxSize(20,8); return wxSize(20,8);
} }
bool Activate( wxRect rect, bool Activate( wxRect WXUNUSED(rect),
wxDataViewListModel *model, size_t col, size_t row ) wxDataViewListModel *WXUNUSED(model),
size_t WXUNUSED(col),
size_t WXUNUSED(row) )
{ {
return false; return false;
} }
@@ -193,7 +195,7 @@ public:
virtual size_t GetNumberOfRows() { return m_list.GetCount(); } virtual size_t GetNumberOfRows() { return m_list.GetCount(); }
virtual size_t GetNumberOfCols() { return 2; } virtual size_t GetNumberOfCols() { return 2; }
virtual wxString GetColType( size_t col ) { return wxT("string"); } virtual wxString GetColType( size_t WXUNUSED(col) ) { return wxT("string"); }
virtual void GetValue( wxVariant &variant, size_t col, size_t row ) virtual void GetValue( wxVariant &variant, size_t col, size_t row )
{ {
if (col == 0) if (col == 0)
@@ -347,7 +349,7 @@ MyFrame::MyFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h):
// Left wxDataViewCtrl // Left wxDataViewCtrl
dataview_left = new wxDataViewCtrl( this, -1 ); dataview_left = new wxDataViewCtrl( this, wxID_ANY );
MyTextModel *model = new MyTextModel; MyTextModel *model = new MyTextModel;
dataview_left->AssociateModel( model ); dataview_left->AssociateModel( model );
@@ -370,7 +372,7 @@ MyFrame::MyFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h):
dataview_left->AppendDateColumn( wxT("date"), 6 ); dataview_left->AppendDateColumn( wxT("date"), 6 );
// Right wxDataViewCtrl using the same model // Right wxDataViewCtrl using the same model
dataview_right = new wxDataViewCtrl( this, -1 ); dataview_right = new wxDataViewCtrl( this, wxID_ANY );
dataview_right->AssociateModel( model ); dataview_right->AssociateModel( model );
text_cell = new wxDataViewTextCell( wxT("string"), wxDATAVIEW_CELL_EDITABLE ); text_cell = new wxDataViewTextCell( wxT("string"), wxDATAVIEW_CELL_EDITABLE );
@@ -441,7 +443,7 @@ MySortingFrame::MySortingFrame(wxFrame *frame, wxChar *title, int x, int y, int
// Left wxDataViewCtrl // Left wxDataViewCtrl
dataview_left = new wxDataViewCtrl( this, -1 ); dataview_left = new wxDataViewCtrl( this, wxID_ANY );
MyUnsortedTextModel *model = new MyUnsortedTextModel; MyUnsortedTextModel *model = new MyUnsortedTextModel;
dataview_left->AssociateModel( model ); dataview_left->AssociateModel( model );
@@ -451,7 +453,7 @@ MySortingFrame::MySortingFrame(wxFrame *frame, wxChar *title, int x, int y, int
dataview_left->AppendTextColumn( wxT("second"), 1 ); dataview_left->AppendTextColumn( wxT("second"), 1 );
// Right wxDataViewCtrl using the sorting model // Right wxDataViewCtrl using the sorting model
dataview_right = new wxDataViewCtrl( this, -1 ); dataview_right = new wxDataViewCtrl( this, wxID_ANY );
wxDataViewSortedListModel *sorted_model = wxDataViewSortedListModel *sorted_model =
new wxDataViewSortedListModel( model ); new wxDataViewSortedListModel( model );
dataview_right->AssociateModel( sorted_model ); dataview_right->AssociateModel( sorted_model );
@@ -506,43 +508,43 @@ void MySortingFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
dialog.ShowModal(); dialog.ShowModal();
} }
void MySortingFrame::OnAppendRowLeft(wxCommandEvent& event) void MySortingFrame::OnAppendRowLeft(wxCommandEvent& WXUNUSED(event))
{ {
} }
void MySortingFrame::OnPrependRowLeft(wxCommandEvent& event) void MySortingFrame::OnPrependRowLeft(wxCommandEvent& WXUNUSED(event))
{ {
} }
void MySortingFrame::OnInsertRowLeft(wxCommandEvent& event) void MySortingFrame::OnInsertRowLeft(wxCommandEvent& WXUNUSED(event))
{ {
} }
void MySortingFrame::OnDeleteRowLeft(wxCommandEvent& event) void MySortingFrame::OnDeleteRowLeft(wxCommandEvent& WXUNUSED(event))
{ {
} }
void MySortingFrame::OnEditRowLeft(wxCommandEvent& event) void MySortingFrame::OnEditRowLeft(wxCommandEvent& WXUNUSED(event))
{ {
} }
void MySortingFrame::OnAppendRowRight(wxCommandEvent& event) void MySortingFrame::OnAppendRowRight(wxCommandEvent& WXUNUSED(event))
{ {
} }
void MySortingFrame::OnPrependRowRight(wxCommandEvent& event) void MySortingFrame::OnPrependRowRight(wxCommandEvent& WXUNUSED(event))
{ {
} }
void MySortingFrame::OnInsertRowRight(wxCommandEvent& event) void MySortingFrame::OnInsertRowRight(wxCommandEvent& WXUNUSED(event))
{ {
} }
void MySortingFrame::OnDeleteRowRight(wxCommandEvent& event) void MySortingFrame::OnDeleteRowRight(wxCommandEvent& WXUNUSED(event))
{ {
} }
void MySortingFrame::OnEditRowRight(wxCommandEvent& event) void MySortingFrame::OnEditRowRight(wxCommandEvent& WXUNUSED(event))
{ {
} }

View File

@@ -15,24 +15,25 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#include "wx/defs.h"
#if wxUSE_DATAVIEWCTRL #if wxUSE_DATAVIEWCTRL
#include "wx/object.h" #ifndef WX_PRECOMP
#include "wx/dataview.h" #include "wx/object.h"
#include "wx/log.h" #include "wx/log.h"
#include "wx/image.h" #endif
// --------------------------------------------------------- #include "wx/image.h"
#include "wx/dataview.h"
// ---------------------------------------------------------
// wxDataViewModel // wxDataViewModel
// --------------------------------------------------------- // ---------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDataViewModel, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxDataViewModel, wxObject)
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewListModel // wxDataViewListModel
// --------------------------------------------------------- // ---------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDataViewListModel, wxDataViewModel) IMPLEMENT_ABSTRACT_CLASS(wxDataViewListModel, wxDataViewModel)
@@ -58,7 +59,7 @@ bool wxDataViewListModel::RowAppended()
ret = false; ret = false;
node = node->GetNext(); node = node->GetNext();
} }
return ret; return ret;
} }
@@ -74,7 +75,7 @@ bool wxDataViewListModel::RowPrepended()
ret = false; ret = false;
node = node->GetNext(); node = node->GetNext();
} }
return ret; return ret;
} }
@@ -90,7 +91,7 @@ bool wxDataViewListModel::RowInserted( size_t before )
ret = false; ret = false;
node = node->GetNext(); node = node->GetNext();
} }
return ret; return ret;
} }
@@ -106,7 +107,7 @@ bool wxDataViewListModel::RowDeleted( size_t row )
ret = false; ret = false;
node = node->GetNext(); node = node->GetNext();
} }
return ret; return ret;
} }
@@ -122,7 +123,7 @@ bool wxDataViewListModel::RowChanged( size_t row )
ret = false; ret = false;
node = node->GetNext(); node = node->GetNext();
} }
return ret; return ret;
} }
@@ -138,7 +139,7 @@ bool wxDataViewListModel::ValueChanged( size_t col, size_t row )
ret = false; ret = false;
node = node->GetNext(); node = node->GetNext();
} }
return ret; return ret;
} }
@@ -154,7 +155,7 @@ bool wxDataViewListModel::RowsReordered( size_t *new_order )
ret = false; ret = false;
node = node->GetNext(); node = node->GetNext();
} }
return ret; return ret;
} }
@@ -170,7 +171,7 @@ bool wxDataViewListModel::Cleared()
ret = false; ret = false;
node = node->GetNext(); node = node->GetNext();
} }
return ret; return ret;
} }
@@ -185,13 +186,13 @@ void wxDataViewListModel::RemoveViewingColumn( wxDataViewColumn *column )
while (node) while (node)
{ {
wxDataViewViewingColumn* tmp = (wxDataViewViewingColumn*) node->GetData(); wxDataViewViewingColumn* tmp = (wxDataViewViewingColumn*) node->GetData();
if (tmp->m_viewColumn == column) if (tmp->m_viewColumn == column)
{ {
m_viewingColumns.DeleteObject( tmp ); m_viewingColumns.DeleteObject( tmp );
return; return;
} }
node = node->GetNext(); node = node->GetNext();
} }
} }
@@ -207,32 +208,32 @@ void wxDataViewListModel::RemoveNotifier( wxDataViewListModelNotifier *notifier
m_notifiers.DeleteObject( notifier ); m_notifiers.DeleteObject( notifier );
} }
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewSortedListModelNotifier // wxDataViewSortedListModelNotifier
// --------------------------------------------------------- // ---------------------------------------------------------
class wxDataViewSortedListModelNotifier: public wxDataViewListModelNotifier class wxDataViewSortedListModelNotifier: public wxDataViewListModelNotifier
{ {
public: public:
wxDataViewSortedListModelNotifier( wxDataViewSortedListModel *model ) wxDataViewSortedListModelNotifier( wxDataViewSortedListModel *model )
{ m_model = model; } { m_model = model; }
virtual bool RowAppended() { return true; } virtual bool RowAppended() { return true; }
virtual bool RowPrepended() { return true; } virtual bool RowPrepended() { return true; }
virtual bool RowInserted( size_t before ) { return true; } virtual bool RowInserted( size_t WXUNUSED(before) ) { return true; }
virtual bool RowDeleted( size_t row ) { return true; } virtual bool RowDeleted( size_t WXUNUSED(row) ) { return true; }
virtual bool RowChanged( size_t row ) { return true; } virtual bool RowChanged( size_t WXUNUSED(row) ) { return true; }
virtual bool ValueChanged( size_t col, size_t row ) virtual bool ValueChanged( size_t col, size_t row )
{ return m_model->ChildValueChanged( col, row); } { return m_model->ChildValueChanged( col, row); }
virtual bool RowsReordered( size_t *new_order ) { return true; } virtual bool RowsReordered( size_t *WXUNUSED(new_order) ) { return true; }
virtual bool Cleared() { return true; } virtual bool Cleared() { return true; }
wxDataViewSortedListModel *m_model; wxDataViewSortedListModel *m_model;
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewSortedListModel compare function // wxDataViewSortedListModel compare function
// --------------------------------------------------------- // ---------------------------------------------------------
int wxCALLBACK wxDataViewListModelSortedDefaultCompare int wxCALLBACK wxDataViewListModelSortedDefaultCompare
(size_t row1, size_t row2, size_t col, wxDataViewListModel* model ) (size_t row1, size_t row2, size_t col, wxDataViewListModel* model )
@@ -281,7 +282,7 @@ int LINKAGEMODE wxDataViewIntermediateCmp( size_t row1, size_t row2 )
return s_CmpFunc( row1, row2, s_CmpCol, s_CmpModel ); return s_CmpFunc( row1, row2, s_CmpCol, s_CmpModel );
} }
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewSortedListModel // wxDataViewSortedListModel
// --------------------------------------------------------- // ---------------------------------------------------------
@@ -294,11 +295,11 @@ wxDataViewSortedListModel::wxDataViewSortedListModel( wxDataViewListModel *child
s_CmpCol = 0; s_CmpCol = 0;
s_CmpModel = child; s_CmpModel = child;
s_CmpFunc = wxDataViewListModelSortedDefaultCompare; s_CmpFunc = wxDataViewListModelSortedDefaultCompare;
m_notifierOnChild = new wxDataViewSortedListModelNotifier( this ); m_notifierOnChild = new wxDataViewSortedListModelNotifier( this );
m_child->AddNotifier( m_notifierOnChild ); m_child->AddNotifier( m_notifierOnChild );
Resort(); Resort();
} }
wxDataViewSortedListModel::~wxDataViewSortedListModel() wxDataViewSortedListModel::~wxDataViewSortedListModel()
@@ -335,7 +336,7 @@ bool wxDataViewSortedListModel::ChildValueChanged( size_t col, size_t row )
{ {
size_t i; size_t i;
size_t len = m_array.GetCount(); size_t len = m_array.GetCount();
// Remove and readd sorted. Find out at which // Remove and readd sorted. Find out at which
// position it was and where it ended. // position it was and where it ended.
size_t start_pos = 0,end_pos = 0; size_t start_pos = 0,end_pos = 0;
@@ -347,17 +348,17 @@ bool wxDataViewSortedListModel::ChildValueChanged( size_t col, size_t row )
} }
m_array.RemoveAt( start_pos ); m_array.RemoveAt( start_pos );
m_array.Add( row ); m_array.Add( row );
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
if (m_array[i] == row) if (m_array[i] == row)
{ {
end_pos = i; end_pos = i;
break; break;
} }
if (end_pos == start_pos) if (end_pos == start_pos)
return wxDataViewListModel::ValueChanged( col, start_pos ); return wxDataViewListModel::ValueChanged( col, start_pos );
// Create an array where order[old] -> new_pos, so that // Create an array where order[old] -> new_pos, so that
// if nothing changed order[0] -> 0 etc. // if nothing changed order[0] -> 0 etc.
size_t *order = new size_t[ len ]; size_t *order = new size_t[ len ];
@@ -376,12 +377,12 @@ bool wxDataViewSortedListModel::ChildValueChanged( size_t col, size_t row )
for (i = end_pos; i > start_pos; i--) for (i = end_pos; i > start_pos; i--)
order[i] = order[i-1]; order[i] = order[i-1];
order[start_pos] = end_pos; order[start_pos] = end_pos;
} }
wxDataViewListModel::RowsReordered( order ); wxDataViewListModel::RowsReordered( order );
delete [] order; delete [] order;
return true; return true;
} }
@@ -410,9 +411,9 @@ bool wxDataViewSortedListModel::SetValue( wxVariant &variant, size_t col, size_t
{ {
size_t child_row = m_array[row]; size_t child_row = m_array[row];
bool ret = m_child->SetValue( variant, col, child_row ); bool ret = m_child->SetValue( variant, col, child_row );
// Resort in ::ChildValueChanged() which gets reported back. // Resort in ::ChildValueChanged() which gets reported back.
return ret; return ret;
} }
@@ -420,9 +421,9 @@ bool wxDataViewSortedListModel::RowAppended()
{ {
// you can only append // you can only append
bool ret = m_child->RowAppended(); bool ret = m_child->RowAppended();
// report RowInsrted // report RowInsrted
return ret; return ret;
} }
@@ -430,31 +431,31 @@ bool wxDataViewSortedListModel::RowPrepended()
{ {
// you can only append // you can only append
bool ret = m_child->RowAppended(); bool ret = m_child->RowAppended();
// report RowInsrted // report RowInsrted
return ret; return ret;
} }
bool wxDataViewSortedListModel::RowInserted( size_t before ) bool wxDataViewSortedListModel::RowInserted( size_t WXUNUSED(before) )
{ {
// you can only append // you can only append
bool ret = m_child->RowAppended(); bool ret = m_child->RowAppended();
// report different RowInsrted // report different RowInsrted
return ret; return ret;
} }
bool wxDataViewSortedListModel::RowDeleted( size_t row ) bool wxDataViewSortedListModel::RowDeleted( size_t row )
{ {
size_t child_row = m_array[row]; size_t child_row = m_array[row];
bool ret = m_child->RowDeleted( child_row ); bool ret = m_child->RowDeleted( child_row );
// Do nothing here as the change in the // Do nothing here as the change in the
// child model will be reported back. // child model will be reported back.
return ret; return ret;
} }
@@ -462,10 +463,10 @@ bool wxDataViewSortedListModel::RowChanged( size_t row )
{ {
size_t child_row = m_array[row]; size_t child_row = m_array[row];
bool ret = m_child->RowChanged( child_row ); bool ret = m_child->RowChanged( child_row );
// Do nothing here as the change in the // Do nothing here as the change in the
// child model will be reported back. // child model will be reported back.
return ret; return ret;
} }
@@ -473,14 +474,14 @@ bool wxDataViewSortedListModel::ValueChanged( size_t col, size_t row )
{ {
size_t child_row = m_array[row]; size_t child_row = m_array[row];
bool ret = m_child->ValueChanged( col, child_row ); bool ret = m_child->ValueChanged( col, child_row );
// Do nothing here as the change in the // Do nothing here as the change in the
// child model will be reported back. // child model will be reported back.
return ret; return ret;
} }
bool wxDataViewSortedListModel::RowsReordered( size_t *new_order ) bool wxDataViewSortedListModel::RowsReordered( size_t *WXUNUSED(new_order) )
{ {
// We sort them ourselves. // We sort them ourselves.
@@ -490,15 +491,15 @@ bool wxDataViewSortedListModel::RowsReordered( size_t *new_order )
bool wxDataViewSortedListModel::Cleared() bool wxDataViewSortedListModel::Cleared()
{ {
bool ret = m_child->Cleared(); bool ret = m_child->Cleared();
wxDataViewListModel::Cleared(); wxDataViewListModel::Cleared();
return ret; return ret;
} }
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewCellBase // wxDataViewCellBase
// --------------------------------------------------------- // ---------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDataViewCellBase, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxDataViewCellBase, wxObject)
@@ -507,10 +508,10 @@ wxDataViewCellBase::wxDataViewCellBase( const wxString &varianttype, wxDataViewC
m_variantType = varianttype; m_variantType = varianttype;
m_mode = mode; m_mode = mode;
} }
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewColumnBase // wxDataViewColumnBase
// --------------------------------------------------------- // ---------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumnBase, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumnBase, wxObject)
@@ -528,7 +529,7 @@ wxDataViewColumnBase::~wxDataViewColumnBase()
{ {
if (m_cell) if (m_cell)
delete m_cell; delete m_cell;
if (GetOwner()) if (GetOwner())
{ {
GetOwner()->GetModel()->RemoveViewingColumn( (wxDataViewColumn*) this ); GetOwner()->GetModel()->RemoveViewingColumn( (wxDataViewColumn*) this );
@@ -545,9 +546,9 @@ wxString wxDataViewColumnBase::GetTitle()
return m_title; return m_title;
} }
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewCtrlBase // wxDataViewCtrlBase
// --------------------------------------------------------- // ---------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDataViewCtrlBase, wxControl) IMPLEMENT_ABSTRACT_CLASS(wxDataViewCtrlBase, wxControl)
@@ -564,7 +565,7 @@ wxDataViewCtrlBase::~wxDataViewCtrlBase()
bool wxDataViewCtrlBase::AssociateModel( wxDataViewListModel *model ) bool wxDataViewCtrlBase::AssociateModel( wxDataViewListModel *model )
{ {
m_model = model; m_model = model;
return true; return true;
} }
@@ -606,7 +607,7 @@ size_t wxDataViewCtrlBase::GetNumberOfColumns()
return m_cols.GetCount(); return m_cols.GetCount();
} }
bool wxDataViewCtrlBase::DeleteColumn( size_t pos ) bool wxDataViewCtrlBase::DeleteColumn( size_t WXUNUSED(pos) )
{ {
return false; return false;
} }

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: datavgen.cpp // Name: src/generic/datavgen.cpp
// Purpose: wxDataViewCtrl generic implementation // Purpose: wxDataViewCtrl generic implementation
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
@@ -10,25 +10,25 @@
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
#include "wx/defs.h"
#if wxUSE_DATAVIEWCTRL #if wxUSE_DATAVIEWCTRL
#include "wx/dataview.h" #include "wx/dataview.h"
#ifdef wxUSE_GENERICDATAVIEWCTRL #ifdef wxUSE_GENERICDATAVIEWCTRL
#ifndef WX_PRECOMP
#include "wx/sizer.h"
#include "wx/log.h"
#endif
#include "wx/stockitem.h" #include "wx/stockitem.h"
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/calctrl.h" #include "wx/calctrl.h"
#include "wx/popupwin.h" #include "wx/popupwin.h"
#include "wx/sizer.h"
#include "wx/log.h"
#include "wx/renderer.h" #include "wx/renderer.h"
#ifdef __WXMSW__ #ifdef __WXMSW__
#include <windows.h> // for DLGC_WANTARROWS #include "wx/msw/wrapwin.h"
#include "wx/msw/winundef.h"
#endif #endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -57,11 +57,11 @@ public:
void OnPaint( wxPaintEvent &event ); void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event ); void OnMouse( wxMouseEvent &event );
void OnSetFocus( wxFocusEvent &event ); void OnSetFocus( wxFocusEvent &event );
private: private:
wxDataViewCtrl *m_owner; wxDataViewCtrl *m_owner;
wxCursor *m_resizeCursor; wxCursor *m_resizeCursor;
private: private:
DECLARE_DYNAMIC_CLASS(wxDataViewHeaderWindow) DECLARE_DYNAMIC_CLASS(wxDataViewHeaderWindow)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
@@ -97,32 +97,32 @@ public:
void OnPaint( wxPaintEvent &event ); void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event ); void OnMouse( wxMouseEvent &event );
void OnSetFocus( wxFocusEvent &event ); void OnSetFocus( wxFocusEvent &event );
void UpdateDisplay(); void UpdateDisplay();
void RecalculateDisplay(); void RecalculateDisplay();
void OnInternalIdle(); void OnInternalIdle();
void ScrollWindow( int dx, int dy, const wxRect *rect ); void ScrollWindow( int dx, int dy, const wxRect *rect );
private: private:
wxDataViewCtrl *m_owner; wxDataViewCtrl *m_owner;
int m_lineHeight; int m_lineHeight;
bool m_dirty; bool m_dirty;
private: private:
DECLARE_DYNAMIC_CLASS(wxDataViewMainWindow) DECLARE_DYNAMIC_CLASS(wxDataViewMainWindow)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxGenericDataViewListModelNotifier // wxGenericDataViewListModelNotifier
// --------------------------------------------------------- // ---------------------------------------------------------
class wxGenericDataViewListModelNotifier: public wxDataViewListModelNotifier class wxGenericDataViewListModelNotifier: public wxDataViewListModelNotifier
{ {
public: public:
wxGenericDataViewListModelNotifier( wxDataViewMainWindow *mainWindow ) wxGenericDataViewListModelNotifier( wxDataViewMainWindow *mainWindow )
{ m_mainWindow = mainWindow; } { m_mainWindow = mainWindow; }
virtual bool RowAppended() virtual bool RowAppended()
{ return m_mainWindow->RowAppended(); } { return m_mainWindow->RowAppended(); }
virtual bool RowPrepended() virtual bool RowPrepended()
@@ -139,13 +139,13 @@ public:
{ return m_mainWindow->RowsReordered( new_order ); } { return m_mainWindow->RowsReordered( new_order ); }
virtual bool Cleared() virtual bool Cleared()
{ return m_mainWindow->Cleared(); } { return m_mainWindow->Cleared(); }
wxDataViewMainWindow *m_mainWindow; wxDataViewMainWindow *m_mainWindow;
}; };
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewCell // wxDataViewCell
// --------------------------------------------------------- // ---------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDataViewCell, wxDataViewCellBase) IMPLEMENT_ABSTRACT_CLASS(wxDataViewCell, wxDataViewCellBase)
@@ -171,25 +171,25 @@ wxDC *wxDataViewCell::GetDC()
return NULL; return NULL;
m_dc = new wxClientDC( GetOwner()->GetOwner() ); m_dc = new wxClientDC( GetOwner()->GetOwner() );
} }
return m_dc; return m_dc;
} }
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewCustomCell // wxDataViewCustomCell
// --------------------------------------------------------- // ---------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomCell, wxDataViewCell) IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomCell, wxDataViewCell)
wxDataViewCustomCell::wxDataViewCustomCell( const wxString &varianttype, wxDataViewCustomCell::wxDataViewCustomCell( const wxString &varianttype,
wxDataViewCellMode mode ) : wxDataViewCellMode mode ) :
wxDataViewCell( varianttype, mode ) wxDataViewCell( varianttype, mode )
{ {
} }
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewTextCell // wxDataViewTextCell
// --------------------------------------------------------- // ---------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDataViewTextCell, wxDataViewCustomCell) IMPLEMENT_ABSTRACT_CLASS(wxDataViewTextCell, wxDataViewCustomCell)
@@ -201,16 +201,16 @@ wxDataViewTextCell::wxDataViewTextCell( const wxString &varianttype, wxDataViewC
bool wxDataViewTextCell::SetValue( const wxVariant &value ) bool wxDataViewTextCell::SetValue( const wxVariant &value )
{ {
m_text = value.GetString(); m_text = value.GetString();
return true; return true;
} }
bool wxDataViewTextCell::GetValue( wxVariant &value ) bool wxDataViewTextCell::GetValue( wxVariant& WXUNUSED(value) )
{ {
return false; return false;
} }
bool wxDataViewTextCell::Render( wxRect cell, wxDC *dc, int state ) bool wxDataViewTextCell::Render( wxRect cell, wxDC *dc, int WXUNUSED(state) )
{ {
dc->DrawText( m_text, cell.x, cell.y ); dc->DrawText( m_text, cell.x, cell.y );
@@ -222,13 +222,13 @@ wxSize wxDataViewTextCell::GetSize()
return wxSize(80,20); return wxSize(80,20);
} }
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewToggleCell // wxDataViewToggleCell
// --------------------------------------------------------- // ---------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleCell, wxDataViewCustomCell) IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleCell, wxDataViewCustomCell)
wxDataViewToggleCell::wxDataViewToggleCell( const wxString &varianttype, wxDataViewToggleCell::wxDataViewToggleCell( const wxString &varianttype,
wxDataViewCellMode mode ) : wxDataViewCellMode mode ) :
wxDataViewCustomCell( varianttype, mode ) wxDataViewCustomCell( varianttype, mode )
{ {
@@ -238,19 +238,19 @@ wxDataViewToggleCell::wxDataViewToggleCell( const wxString &varianttype,
bool wxDataViewToggleCell::SetValue( const wxVariant &value ) bool wxDataViewToggleCell::SetValue( const wxVariant &value )
{ {
m_toggle = value.GetBool(); m_toggle = value.GetBool();
return true;; return true;;
} }
bool wxDataViewToggleCell::GetValue( wxVariant &value ) bool wxDataViewToggleCell::GetValue( wxVariant &WXUNUSED(value) )
{ {
return false; return false;
} }
bool wxDataViewToggleCell::Render( wxRect cell, wxDC *dc, int state ) bool wxDataViewToggleCell::Render( wxRect cell, wxDC *dc, int WXUNUSED(state) )
{ {
// User wxRenderer here // User wxRenderer here
if (GetMode() == wxDATAVIEW_CELL_ACTIVATABLE) if (GetMode() == wxDATAVIEW_CELL_ACTIVATABLE)
dc->SetPen( *wxBLACK_PEN ); dc->SetPen( *wxBLACK_PEN );
else else
@@ -271,16 +271,16 @@ bool wxDataViewToggleCell::Render( wxRect cell, wxDC *dc, int state )
dc->DrawLine( rect.x, rect.y, rect.x+rect.width, rect.y+rect.height ); dc->DrawLine( rect.x, rect.y, rect.x+rect.width, rect.y+rect.height );
dc->DrawLine( rect.x+rect.width, rect.y, rect.x, rect.y+rect.height ); dc->DrawLine( rect.x+rect.width, rect.y, rect.x, rect.y+rect.height );
} }
return true; return true;
} }
bool wxDataViewToggleCell::Activate( wxRect cell, wxDataViewListModel *model, size_t col, size_t row ) bool wxDataViewToggleCell::Activate( wxRect WXUNUSED(cell), wxDataViewListModel *model, size_t col, size_t row )
{ {
bool value = !m_toggle; bool value = !m_toggle;
wxVariant variant = value; wxVariant variant = value;
model->SetValue( variant, col, row ); model->SetValue( variant, col, row );
model->ValueChanged( col, row ); model->ValueChanged( col, row );
return true; return true;
} }
@@ -289,15 +289,15 @@ wxSize wxDataViewToggleCell::GetSize()
return wxSize(20,20); return wxSize(20,20);
} }
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewProgressCell // wxDataViewProgressCell
// --------------------------------------------------------- // ---------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressCell, wxDataViewCustomCell) IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressCell, wxDataViewCustomCell)
wxDataViewProgressCell::wxDataViewProgressCell( const wxString &label, wxDataViewProgressCell::wxDataViewProgressCell( const wxString &label,
const wxString &varianttype, wxDataViewCellMode mode ) : const wxString &varianttype, wxDataViewCellMode mode ) :
wxDataViewCustomCell( varianttype, mode ) wxDataViewCustomCell( varianttype, mode )
{ {
m_label = label; m_label = label;
m_value = 0; m_value = 0;
@@ -310,14 +310,14 @@ wxDataViewProgressCell::~wxDataViewProgressCell()
bool wxDataViewProgressCell::SetValue( const wxVariant &value ) bool wxDataViewProgressCell::SetValue( const wxVariant &value )
{ {
m_value = (long) value; m_value = (long) value;
if (m_value < 0) m_value = 0; if (m_value < 0) m_value = 0;
if (m_value > 100) m_value = 100; if (m_value > 100) m_value = 100;
return true; return true;
} }
bool wxDataViewProgressCell::Render( wxRect cell, wxDC *dc, int state ) bool wxDataViewProgressCell::Render( wxRect cell, wxDC *dc, int WXUNUSED(state) )
{ {
double pct = (double)m_value / 100.0; double pct = (double)m_value / 100.0;
wxRect bar = cell; wxRect bar = cell;
@@ -329,7 +329,7 @@ bool wxDataViewProgressCell::Render( wxRect cell, wxDC *dc, int state )
dc->SetBrush( *wxTRANSPARENT_BRUSH ); dc->SetBrush( *wxTRANSPARENT_BRUSH );
dc->SetPen( *wxBLACK_PEN ); dc->SetPen( *wxBLACK_PEN );
dc->DrawRectangle( cell ); dc->DrawRectangle( cell );
return true; return true;
} }
@@ -337,14 +337,14 @@ wxSize wxDataViewProgressCell::GetSize()
{ {
return wxSize(40,12); return wxSize(40,12);
} }
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewDateCell // wxDataViewDateCell
// --------------------------------------------------------- // ---------------------------------------------------------
class wxDataViewDateCellPopupTransient: public wxPopupTransientWindow class wxDataViewDateCellPopupTransient: public wxPopupTransientWindow
{ {
public: public:
wxDataViewDateCellPopupTransient( wxWindow* parent, wxDateTime *value, wxDataViewDateCellPopupTransient( wxWindow* parent, wxDateTime *value,
wxDataViewListModel *model, size_t col, size_t row ) : wxDataViewListModel *model, size_t col, size_t row ) :
wxPopupTransientWindow( parent, wxBORDER_SIMPLE ) wxPopupTransientWindow( parent, wxBORDER_SIMPLE )
@@ -352,30 +352,30 @@ public:
m_model = model; m_model = model;
m_col = col; m_col = col;
m_row = row; m_row = row;
m_cal = new wxCalendarCtrl( this, -1, *value ); m_cal = new wxCalendarCtrl( this, wxID_ANY, *value );
wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
sizer->Add( m_cal, 1, wxGROW ); sizer->Add( m_cal, 1, wxGROW );
SetSizer( sizer ); SetSizer( sizer );
sizer->Fit( this ); sizer->Fit( this );
} }
virtual void OnDismiss() virtual void OnDismiss()
{ {
} }
void OnCalendar( wxCalendarEvent &event ); void OnCalendar( wxCalendarEvent &event );
wxCalendarCtrl *m_cal; wxCalendarCtrl *m_cal;
wxDataViewListModel *m_model; wxDataViewListModel *m_model;
size_t m_col; size_t m_col;
size_t m_row; size_t m_row;
private: private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
BEGIN_EVENT_TABLE(wxDataViewDateCellPopupTransient,wxPopupTransientWindow) BEGIN_EVENT_TABLE(wxDataViewDateCellPopupTransient,wxPopupTransientWindow)
EVT_CALENDAR( -1, wxDataViewDateCellPopupTransient::OnCalendar ) EVT_CALENDAR( wxID_ANY, wxDataViewDateCellPopupTransient::OnCalendar )
END_EVENT_TABLE() END_EVENT_TABLE()
void wxDataViewDateCellPopupTransient::OnCalendar( wxCalendarEvent &event ) void wxDataViewDateCellPopupTransient::OnCalendar( wxCalendarEvent &event )
@@ -394,15 +394,15 @@ wxDataViewDateCell::wxDataViewDateCell( const wxString &varianttype,
wxDataViewCustomCell( varianttype, mode ) wxDataViewCustomCell( varianttype, mode )
{ {
} }
bool wxDataViewDateCell::SetValue( const wxVariant &value ) bool wxDataViewDateCell::SetValue( const wxVariant &value )
{ {
m_date = value.GetDateTime(); m_date = value.GetDateTime();
return true; return true;
} }
bool wxDataViewDateCell::Render( wxRect cell, wxDC *dc, int state ) bool wxDataViewDateCell::Render( wxRect cell, wxDC *dc, int WXUNUSED(state) )
{ {
dc->SetFont( GetOwner()->GetOwner()->GetFont() ); dc->SetFont( GetOwner()->GetOwner()->GetFont() );
wxString tmp = m_date.FormatDate(); wxString tmp = m_date.FormatDate();
@@ -420,13 +420,13 @@ wxSize wxDataViewDateCell::GetSize()
return wxSize(x,y+d); return wxSize(x,y+d);
} }
bool wxDataViewDateCell::Activate( wxRect cell, wxDataViewListModel *model, size_t col, size_t row ) bool wxDataViewDateCell::Activate( wxRect WXUNUSED(cell), wxDataViewListModel *model, size_t col, size_t row )
{ {
wxVariant variant; wxVariant variant;
model->GetValue( variant, col, row ); model->GetValue( variant, col, row );
wxDateTime value = variant.GetDateTime(); wxDateTime value = variant.GetDateTime();
wxDataViewDateCellPopupTransient *popup = new wxDataViewDateCellPopupTransient( wxDataViewDateCellPopupTransient *popup = new wxDataViewDateCellPopupTransient(
GetOwner()->GetOwner()->GetParent(), &value, model, col, row ); GetOwner()->GetOwner()->GetParent(), &value, model, col, row );
wxPoint pos = wxGetMousePosition(); wxPoint pos = wxGetMousePosition();
popup->Move( pos ); popup->Move( pos );
@@ -436,13 +436,13 @@ bool wxDataViewDateCell::Activate( wxRect cell, wxDataViewListModel *model, size
return true; return true;
} }
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewColumn // wxDataViewColumn
// --------------------------------------------------------- // ---------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumn, wxDataViewColumnBase) IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumn, wxDataViewColumnBase)
wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewCell *cell, wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewCell *cell,
size_t model_column, int flags ) : size_t model_column, int flags ) :
wxDataViewColumnBase( title, cell, model_column, flags ) wxDataViewColumnBase( title, cell, model_column, flags )
{ {
@@ -456,7 +456,7 @@ wxDataViewColumn::~wxDataViewColumn()
void wxDataViewColumn::SetTitle( const wxString &title ) void wxDataViewColumn::SetTitle( const wxString &title )
{ {
wxDataViewColumnBase::SetTitle( title ); wxDataViewColumnBase::SetTitle( title );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -478,7 +478,7 @@ wxDataViewHeaderWindow::wxDataViewHeaderWindow( wxDataViewCtrl *parent, wxWindow
SetOwner( parent ); SetOwner( parent );
m_resizeCursor = new wxCursor( wxCURSOR_SIZEWE ); m_resizeCursor = new wxCursor( wxCURSOR_SIZEWE );
wxVisualAttributes attr = wxPanel::GetClassDefaultAttributes(); wxVisualAttributes attr = wxPanel::GetClassDefaultAttributes();
SetOwnForegroundColour( attr.colFg ); SetOwnForegroundColour( attr.colFg );
SetOwnBackgroundColour( attr.colBg ); SetOwnBackgroundColour( attr.colBg );
@@ -491,13 +491,13 @@ wxDataViewHeaderWindow::~wxDataViewHeaderWindow()
delete m_resizeCursor; delete m_resizeCursor;
} }
void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &event ) void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{ {
int w, h; int w, h;
GetClientSize( &w, &h ); GetClientSize( &w, &h );
wxPaintDC dc( this ); wxPaintDC dc( this );
int xpix; int xpix;
m_owner->GetScrollPixelsPerUnit( &xpix, NULL ); m_owner->GetScrollPixelsPerUnit( &xpix, NULL );
@@ -506,9 +506,9 @@ void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &event )
// account for the horz scrollbar offset // account for the horz scrollbar offset
dc.SetDeviceOrigin( -x * xpix, 0 ); dc.SetDeviceOrigin( -x * xpix, 0 );
dc.SetFont( GetFont() ); dc.SetFont( GetFont() );
size_t cols = GetOwner()->GetNumberOfColumns(); size_t cols = GetOwner()->GetNumberOfColumns();
size_t i; size_t i;
int xpos = 0; int xpos = 0;
@@ -516,7 +516,7 @@ void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &event )
{ {
wxDataViewColumn *col = GetOwner()->GetColumn( i ); wxDataViewColumn *col = GetOwner()->GetColumn( i );
int width = col->GetWidth(); int width = col->GetWidth();
// the width of the rect to draw: make it smaller to fit entirely // the width of the rect to draw: make it smaller to fit entirely
// inside the column rect // inside the column rect
#ifdef __WXMAC__ #ifdef __WXMAC__
@@ -536,13 +536,13 @@ void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &event )
: (int)wxCONTROL_DISABLED : (int)wxCONTROL_DISABLED
); );
dc.DrawText( col->GetTitle(), xpos+3, 3 ); dc.DrawText( col->GetTitle(), xpos+3, 3 );
xpos += width; xpos += width;
} }
} }
void wxDataViewHeaderWindow::OnMouse( wxMouseEvent &event ) void wxDataViewHeaderWindow::OnMouse( wxMouseEvent &WXUNUSED(event) )
{ {
} }
@@ -568,10 +568,10 @@ wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID i
wxWindow( parent, id, pos, size, 0, name ) wxWindow( parent, id, pos, size, 0, name )
{ {
SetOwner( parent ); SetOwner( parent );
// We need to calculate this smartly.. // We need to calculate this smartly..
m_lineHeight = 20; m_lineHeight = 20;
UpdateDisplay(); UpdateDisplay();
} }
@@ -589,22 +589,22 @@ bool wxDataViewMainWindow::RowPrepended()
return false; return false;
} }
bool wxDataViewMainWindow::RowInserted( size_t before ) bool wxDataViewMainWindow::RowInserted( size_t WXUNUSED(before) )
{ {
return false; return false;
} }
bool wxDataViewMainWindow::RowDeleted( size_t row ) bool wxDataViewMainWindow::RowDeleted( size_t WXUNUSED(row) )
{ {
return false; return false;
} }
bool wxDataViewMainWindow::RowChanged( size_t row ) bool wxDataViewMainWindow::RowChanged( size_t WXUNUSED(row) )
{ {
return false; return false;
} }
bool wxDataViewMainWindow::ValueChanged( size_t col, size_t row ) bool wxDataViewMainWindow::ValueChanged( size_t WXUNUSED(col), size_t row )
{ {
wxRect rect( 0, row*m_lineHeight, 10000, m_lineHeight ); wxRect rect( 0, row*m_lineHeight, 10000, m_lineHeight );
m_owner->CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); m_owner->CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y );
@@ -613,7 +613,7 @@ bool wxDataViewMainWindow::ValueChanged( size_t col, size_t row )
return true; return true;
} }
bool wxDataViewMainWindow::RowsReordered( size_t *new_order ) bool wxDataViewMainWindow::RowsReordered( size_t *WXUNUSED(new_order) )
{ {
return false; return false;
} }
@@ -631,7 +631,7 @@ void wxDataViewMainWindow::UpdateDisplay()
void wxDataViewMainWindow::OnInternalIdle() void wxDataViewMainWindow::OnInternalIdle()
{ {
wxWindow::OnInternalIdle(); wxWindow::OnInternalIdle();
if (m_dirty) if (m_dirty)
{ {
RecalculateDisplay(); RecalculateDisplay();
@@ -647,7 +647,7 @@ void wxDataViewMainWindow::RecalculateDisplay()
Refresh(); Refresh();
return; return;
} }
int width = 0; int width = 0;
size_t cols = GetOwner()->GetNumberOfColumns(); size_t cols = GetOwner()->GetNumberOfColumns();
size_t i; size_t i;
@@ -656,12 +656,12 @@ void wxDataViewMainWindow::RecalculateDisplay()
wxDataViewColumn *col = GetOwner()->GetColumn( i ); wxDataViewColumn *col = GetOwner()->GetColumn( i );
width += col->GetWidth(); width += col->GetWidth();
} }
int height = model->GetNumberOfRows() * m_lineHeight; int height = model->GetNumberOfRows() * m_lineHeight;
SetVirtualSize( width, height ); SetVirtualSize( width, height );
GetOwner()->SetScrollRate( 10, m_lineHeight ); GetOwner()->SetScrollRate( 10, m_lineHeight );
Refresh(); Refresh();
} }
@@ -671,7 +671,7 @@ void wxDataViewMainWindow::ScrollWindow( int dx, int dy, const wxRect *rect )
GetOwner()->m_headerArea->ScrollWindow( dx, 0 ); GetOwner()->m_headerArea->ScrollWindow( dx, 0 );
} }
void wxDataViewMainWindow::OnPaint( wxPaintEvent &event ) void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{ {
wxPaintDC dc( this ); wxPaintDC dc( this );
@@ -681,9 +681,9 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &event )
wxRect update = GetUpdateRegion().GetBox(); wxRect update = GetUpdateRegion().GetBox();
m_owner->CalcUnscrolledPosition( update.x, update.y, &update.x, &update.y ); m_owner->CalcUnscrolledPosition( update.x, update.y, &update.x, &update.y );
wxDataViewListModel *model = GetOwner()->GetModel(); wxDataViewListModel *model = GetOwner()->GetModel();
size_t item_start = update.y / m_lineHeight; size_t item_start = update.y / m_lineHeight;
size_t item_count = (update.height / m_lineHeight) + 1; size_t item_count = (update.height / m_lineHeight) + 1;
@@ -697,7 +697,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &event )
wxDataViewColumn *col = GetOwner()->GetColumn( i ); wxDataViewColumn *col = GetOwner()->GetColumn( i );
wxDataViewCell *cell = col->GetCell(); wxDataViewCell *cell = col->GetCell();
cell_rect.width = col->GetWidth(); cell_rect.width = col->GetWidth();
size_t item; size_t item;
for (item = item_start; item <= item_start+item_count; item++) for (item = item_start; item <= item_start+item_count; item++)
{ {
@@ -714,12 +714,12 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &event )
// for now: centre // for now: centre
item_rect.x = cell_rect.x + (cell_rect.width / 2) - (size.x / 2); item_rect.x = cell_rect.x + (cell_rect.width / 2) - (size.x / 2);
item_rect.y = cell_rect.y + (cell_rect.height / 2) - (size.y / 2); item_rect.y = cell_rect.y + (cell_rect.height / 2) - (size.y / 2);
item_rect.width = size.x; item_rect.width = size.x;
item_rect.height= size.y; item_rect.height= size.y;
cell->Render( item_rect, &dc, 0 ); cell->Render( item_rect, &dc, 0 );
} }
cell_rect.x += cell_rect.width; cell_rect.x += cell_rect.width;
} }
} }
@@ -745,12 +745,12 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
} }
xpos += c->GetWidth(); xpos += c->GetWidth();
} }
if (!col) if (!col)
return; return;
wxDataViewCell *cell = col->GetCell(); wxDataViewCell *cell = col->GetCell();
size_t row = y / m_lineHeight; size_t row = y / m_lineHeight;
wxDataViewListModel *model = GetOwner()->GetModel(); wxDataViewListModel *model = GetOwner()->GetModel();
if (event.LeftDClick()) if (event.LeftDClick())
@@ -763,7 +763,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
wxRect cell_rect( xpos, row * m_lineHeight, col->GetWidth(), m_lineHeight ); wxRect cell_rect( xpos, row * m_lineHeight, col->GetWidth(), m_lineHeight );
cell->Activate( cell_rect, model, col->GetModelColumn(), row ); cell->Activate( cell_rect, model, col->GetModelColumn(), row );
} }
return; return;
} }
@@ -797,23 +797,23 @@ void wxDataViewCtrl::Init()
} }
bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style, const wxValidator& validator ) long style, const wxValidator& validator )
{ {
if (!wxControl::Create( parent, id, pos, size, style | wxScrolledWindowStyle|wxSUNKEN_BORDER, validator)) if (!wxControl::Create( parent, id, pos, size, style | wxScrolledWindowStyle|wxSUNKEN_BORDER, validator))
return false; return false;
Init(); Init();
#ifdef __WXMAC__ #ifdef __WXMAC__
MacSetClipChildren( true ) ; MacSetClipChildren( true ) ;
#endif #endif
m_clientArea = new wxDataViewMainWindow( this, -1 ); m_clientArea = new wxDataViewMainWindow( this, wxID_ANY );
m_headerArea = new wxDataViewHeaderWindow( this, -1, wxDefaultPosition, wxSize(-1,25) ); m_headerArea = new wxDataViewHeaderWindow( this, wxID_ANY, wxDefaultPosition, wxSize(wxDefaultCoord,25) );
SetTargetWindow( m_clientArea ); SetTargetWindow( m_clientArea );
wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
sizer->Add( m_headerArea, 0, wxGROW ); sizer->Add( m_headerArea, 0, wxGROW );
sizer->Add( m_clientArea, 1, wxGROW ); sizer->Add( m_clientArea, 1, wxGROW );
@@ -841,7 +841,7 @@ WXLRESULT wxDataViewCtrl::MSWWindowProc(WXUINT nMsg,
} }
#endif #endif
void wxDataViewCtrl::OnSize( wxSizeEvent &event ) void wxDataViewCtrl::OnSize( wxSizeEvent &WXUNUSED(event) )
{ {
// We need to override OnSize so that our scrolled // We need to override OnSize so that our scrolled
// window a) does call Layout() to use sizers for // window a) does call Layout() to use sizers for
@@ -862,10 +862,10 @@ bool wxDataViewCtrl::AssociateModel( wxDataViewListModel *model )
m_notifier = new wxGenericDataViewListModelNotifier( m_clientArea ); m_notifier = new wxGenericDataViewListModelNotifier( m_clientArea );
model->AddNotifier( m_notifier ); model->AddNotifier( m_notifier );
m_clientArea->UpdateDisplay(); m_clientArea->UpdateDisplay();
return true; return true;
} }
@@ -873,15 +873,15 @@ bool wxDataViewCtrl::AppendColumn( wxDataViewColumn *col )
{ {
if (!wxDataViewCtrlBase::AppendColumn(col)) if (!wxDataViewCtrlBase::AppendColumn(col))
return false; return false;
m_clientArea->UpdateDisplay(); m_clientArea->UpdateDisplay();
return true; return true;
} }
#endif #endif
// !wxUSE_GENERICDATAVIEWCTRL // !wxUSE_GENERICDATAVIEWCTRL
#endif #endif
// wxUSE_DATAVIEWCTRL // wxUSE_DATAVIEWCTRL