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:
parent
f3b0f8ad21
commit
f554a14b89
@ -32,7 +32,7 @@
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataViewCtrl flags
|
||||
// wxDataViewCtrl flags
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -47,23 +47,23 @@ class WXDLLIMPEXP_CORE wxDataViewCell;
|
||||
|
||||
extern WXDLLEXPORT_DATA(const wxChar) wxDataViewCtrlNameStr[];
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewModel
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class wxDataViewModel: public wxObject
|
||||
{
|
||||
public:
|
||||
wxDataViewModel() { }
|
||||
virtual ~wxDataViewModel() { }
|
||||
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewModel)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewListModelNotifier
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
|
||||
class wxDataViewListModelNotifier: public wxObject
|
||||
@ -71,7 +71,7 @@ class wxDataViewListModelNotifier: public wxObject
|
||||
public:
|
||||
wxDataViewListModelNotifier() { }
|
||||
virtual ~wxDataViewListModelNotifier() { }
|
||||
|
||||
|
||||
virtual bool RowAppended() = 0;
|
||||
virtual bool RowPrepended() = 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 RowsReordered( size_t *new_order ) = 0;
|
||||
virtual bool Cleared() = 0;
|
||||
|
||||
|
||||
void SetOwner( wxDataViewListModel *owner ) { m_owner = owner; }
|
||||
wxDataViewListModel *GetOwner() { return m_owner; }
|
||||
|
||||
|
||||
private:
|
||||
wxDataViewListModel *m_owner;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewListModel
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class wxDataViewViewingColumn: public wxObject
|
||||
{
|
||||
@ -100,7 +100,7 @@ public:
|
||||
m_viewColumn = view_column;
|
||||
m_modelColumn = model_column;
|
||||
}
|
||||
|
||||
|
||||
wxDataViewColumn *m_viewColumn;
|
||||
size_t m_modelColumn;
|
||||
};
|
||||
@ -130,13 +130,13 @@ public:
|
||||
virtual bool RowsReordered( size_t *new_order );
|
||||
virtual bool Cleared();
|
||||
|
||||
// Used internally
|
||||
// Used internally
|
||||
virtual void AddViewingColumn( wxDataViewColumn *view_column, size_t model_column );
|
||||
virtual void RemoveViewingColumn( wxDataViewColumn *column );
|
||||
|
||||
|
||||
virtual void AddNotifier( wxDataViewListModelNotifier *notifier );
|
||||
virtual void RemoveNotifier( wxDataViewListModelNotifier *notifier );
|
||||
|
||||
|
||||
wxList m_notifiers;
|
||||
wxList m_viewingColumns;
|
||||
|
||||
@ -144,9 +144,9 @@ protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewListModel)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewSortedListModel
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
typedef int (wxCALLBACK *wxDataViewListModelCompare)
|
||||
(size_t row1, size_t row2, size_t col, wxDataViewListModel* model );
|
||||
@ -191,9 +191,9 @@ protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewSortedListModel)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewCellBase
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
enum wxDataViewCellMode
|
||||
{
|
||||
@ -215,16 +215,16 @@ class wxDataViewCellBase: public wxObject
|
||||
public:
|
||||
wxDataViewCellBase( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
||||
|
||||
virtual bool SetValue( const wxVariant &value ) { return true; }
|
||||
virtual bool GetValue( wxVariant &value ) { return true; }
|
||||
virtual bool Validate( wxVariant &value ) { return true; }
|
||||
|
||||
virtual bool SetValue( const wxVariant& WXUNUSED(value) ) { return true; }
|
||||
virtual bool GetValue( wxVariant& WXUNUSED(value) ) { return true; }
|
||||
virtual bool Validate( wxVariant& WXUNUSED(value) ) { return true; }
|
||||
|
||||
wxString GetVariantType() { return m_variantType; }
|
||||
wxDataViewCellMode GetMode() { return m_mode; }
|
||||
|
||||
|
||||
void SetOwner( wxDataViewColumn *owner ) { m_owner = owner; }
|
||||
wxDataViewColumn* GetOwner() { return m_owner; }
|
||||
|
||||
|
||||
protected:
|
||||
wxDataViewCellMode m_mode;
|
||||
wxString m_variantType;
|
||||
@ -234,9 +234,9 @@ protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCellBase)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewColumnBase
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
enum wxDataViewColumnFlags
|
||||
{
|
||||
@ -253,11 +253,11 @@ public:
|
||||
|
||||
virtual void SetTitle( const wxString &title );
|
||||
virtual wxString GetTitle();
|
||||
|
||||
|
||||
wxDataViewCell* GetCell() { return m_cell; }
|
||||
|
||||
|
||||
size_t GetModelColumn() { return m_model_column; }
|
||||
|
||||
|
||||
void SetOwner( wxDataViewCtrl *owner ) { m_owner = owner; }
|
||||
wxDataViewCtrl *GetOwner() { return m_owner; }
|
||||
|
||||
@ -273,29 +273,29 @@ protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumnBase)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewCtrlBase
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class wxDataViewCtrlBase: public wxControl
|
||||
{
|
||||
public:
|
||||
wxDataViewCtrlBase();
|
||||
~wxDataViewCtrlBase();
|
||||
|
||||
|
||||
virtual bool AssociateModel( wxDataViewListModel *model );
|
||||
wxDataViewListModel* GetModel();
|
||||
|
||||
|
||||
virtual bool AppendTextColumn( 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 AppendDateColumn( const wxString &label, size_t model_column );
|
||||
virtual bool AppendColumn( wxDataViewColumn *col );
|
||||
virtual bool AppendColumn( wxDataViewColumn *col );
|
||||
virtual size_t GetNumberOfColumns();
|
||||
virtual bool DeleteColumn( size_t pos );
|
||||
virtual bool ClearColumns();
|
||||
virtual wxDataViewColumn* GetColumn( size_t pos );
|
||||
|
||||
|
||||
private:
|
||||
wxDataViewListModel *m_model;
|
||||
wxList m_cols;
|
||||
|
@ -16,17 +16,17 @@
|
||||
#include "wx/control.h"
|
||||
#include "wx/scrolwin.h"
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// classes
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDataViewCtrl;
|
||||
class WXDLLIMPEXP_CORE wxDataViewMainWindow;
|
||||
class WXDLLIMPEXP_CORE wxDataViewHeaderWindow;
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewCell
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class wxDataViewCell: public wxDataViewCellBase
|
||||
{
|
||||
@ -36,144 +36,155 @@ public:
|
||||
|
||||
virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
|
||||
virtual wxSize GetSize() = 0;
|
||||
|
||||
virtual bool Activate( wxRect cell,
|
||||
wxDataViewListModel *model, size_t col, size_t row )
|
||||
|
||||
virtual bool Activate( wxRect WXUNUSED(cell),
|
||||
wxDataViewListModel *WXUNUSED(model),
|
||||
size_t WXUNUSED(col),
|
||||
size_t WXUNUSED(row) )
|
||||
{ return false; }
|
||||
|
||||
virtual bool LeftClick( wxPoint cursor, wxRect cell,
|
||||
wxDataViewListModel *model, size_t col, size_t row )
|
||||
{ return false; }
|
||||
virtual bool RightClick( wxPoint cursor, wxRect cell,
|
||||
wxDataViewListModel *model, size_t col, size_t row )
|
||||
{ return false; }
|
||||
virtual bool StartDrag( wxPoint cursor, wxRect cell,
|
||||
wxDataViewListModel *model, size_t col, size_t row )
|
||||
{ return false; }
|
||||
|
||||
|
||||
virtual bool LeftClick( wxPoint WXUNUSED(cursor),
|
||||
wxRect WXUNUSED(cell),
|
||||
wxDataViewListModel *WXUNUSED(model),
|
||||
size_t WXUNUSED(col),
|
||||
size_t WXUNUSED(row) )
|
||||
{ return false; }
|
||||
virtual bool RightClick( wxPoint WXUNUSED(cursor),
|
||||
wxRect WXUNUSED(cell),
|
||||
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
|
||||
virtual wxDC *GetDC();
|
||||
|
||||
|
||||
private:
|
||||
wxDC *m_dc;
|
||||
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewCustomCell
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class wxDataViewCustomCell: public wxDataViewCell
|
||||
{
|
||||
public:
|
||||
wxDataViewCustomCell( const wxString &varianttype = wxT("string"),
|
||||
wxDataViewCustomCell( const wxString &varianttype = wxT("string"),
|
||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
||||
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewTextCell
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class wxDataViewTextCell: public wxDataViewCustomCell
|
||||
{
|
||||
public:
|
||||
wxDataViewTextCell( const wxString &varianttype = wxT("string"),
|
||||
wxDataViewTextCell( const wxString &varianttype = wxT("string"),
|
||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
||||
|
||||
bool SetValue( const wxVariant &value );
|
||||
bool GetValue( wxVariant &value );
|
||||
|
||||
|
||||
bool Render( wxRect cell, wxDC *dc, int state );
|
||||
wxSize GetSize();
|
||||
|
||||
|
||||
private:
|
||||
wxString m_text;
|
||||
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewToggleCell
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class wxDataViewToggleCell: public wxDataViewCustomCell
|
||||
{
|
||||
public:
|
||||
wxDataViewToggleCell( const wxString &varianttype = wxT("bool"),
|
||||
wxDataViewToggleCell( const wxString &varianttype = wxT("bool"),
|
||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
||||
|
||||
bool SetValue( const wxVariant &value );
|
||||
bool GetValue( wxVariant &value );
|
||||
|
||||
|
||||
bool Render( wxRect cell, wxDC *dc, int state );
|
||||
bool Activate( wxRect cell, wxDataViewListModel *model, size_t col, size_t row );
|
||||
wxSize GetSize();
|
||||
|
||||
|
||||
private:
|
||||
bool m_toggle;
|
||||
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewProgressCell
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class wxDataViewProgressCell: public wxDataViewCustomCell
|
||||
{
|
||||
public:
|
||||
wxDataViewProgressCell( const wxString &label = wxEmptyString,
|
||||
const wxString &varianttype = wxT("long"),
|
||||
wxDataViewProgressCell( const wxString &label = wxEmptyString,
|
||||
const wxString &varianttype = wxT("long"),
|
||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
|
||||
~wxDataViewProgressCell();
|
||||
|
||||
|
||||
bool SetValue( const wxVariant &value );
|
||||
|
||||
|
||||
virtual bool Render( wxRect cell, wxDC *dc, int state );
|
||||
virtual wxSize GetSize();
|
||||
|
||||
|
||||
private:
|
||||
wxString m_label;
|
||||
int m_value;
|
||||
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewDateCell
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class wxDataViewDateCell: public wxDataViewCustomCell
|
||||
{
|
||||
public:
|
||||
wxDataViewDateCell( const wxString &varianttype = wxT("datetime"),
|
||||
wxDataViewDateCell( const wxString &varianttype = wxT("datetime"),
|
||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE );
|
||||
|
||||
|
||||
bool SetValue( const wxVariant &value );
|
||||
|
||||
|
||||
virtual bool Render( wxRect cell, wxDC *dc, int state );
|
||||
virtual wxSize GetSize();
|
||||
virtual bool Activate( wxRect cell,
|
||||
wxDataViewListModel *model, size_t col, size_t row );
|
||||
|
||||
|
||||
private:
|
||||
wxDateTime m_date;
|
||||
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewColumn
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDataViewColumn: public wxDataViewColumnBase
|
||||
{
|
||||
@ -182,10 +193,10 @@ public:
|
||||
virtual ~wxDataViewColumn();
|
||||
|
||||
virtual void SetTitle( const wxString &title );
|
||||
|
||||
|
||||
void SetWidth( int width ) { m_width = width; }
|
||||
int GetWidth() { return m_width; }
|
||||
|
||||
|
||||
private:
|
||||
int m_width;
|
||||
|
||||
@ -193,11 +204,11 @@ protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewCtrl
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDataViewCtrl: public wxDataViewCtrlBase,
|
||||
class WXDLLIMPEXP_CORE wxDataViewCtrl: public wxDataViewCtrlBase,
|
||||
public wxScrollHelperNative
|
||||
{
|
||||
public:
|
||||
@ -205,11 +216,11 @@ public:
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
wxDataViewCtrl( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator )
|
||||
const wxValidator& validator = wxDefaultValidator )
|
||||
: wxScrollHelperNative(this)
|
||||
{
|
||||
Create(parent, id, pos, size, style, validator );
|
||||
@ -226,17 +237,17 @@ public:
|
||||
|
||||
virtual bool AssociateModel( wxDataViewListModel *model );
|
||||
virtual bool AppendColumn( wxDataViewColumn *col );
|
||||
|
||||
|
||||
private:
|
||||
friend class wxDataViewMainWindow;
|
||||
friend class wxDataViewHeaderWindow;
|
||||
wxDataViewListModelNotifier *m_notifier;
|
||||
wxDataViewMainWindow *m_clientArea;
|
||||
wxDataViewHeaderWindow *m_headerArea;
|
||||
|
||||
|
||||
private:
|
||||
void OnSize( wxSizeEvent &event );
|
||||
|
||||
|
||||
// we need to return a special WM_GETDLGCODE value to process just the
|
||||
// arrows but let the other navigation characters through
|
||||
#ifdef __WXMSW__
|
||||
|
@ -147,7 +147,7 @@ public:
|
||||
m_colour = value.GetString();
|
||||
return true;
|
||||
}
|
||||
bool Render( wxRect rect, wxDC *dc, int state )
|
||||
bool Render( wxRect rect, wxDC *dc, int WXUNUSED(state) )
|
||||
{
|
||||
dc->SetPen( *wxBLACK_PEN );
|
||||
if (m_colour == wxT("red"))
|
||||
@ -163,8 +163,10 @@ public:
|
||||
{
|
||||
return wxSize(20,8);
|
||||
}
|
||||
bool Activate( wxRect rect,
|
||||
wxDataViewListModel *model, size_t col, size_t row )
|
||||
bool Activate( wxRect WXUNUSED(rect),
|
||||
wxDataViewListModel *WXUNUSED(model),
|
||||
size_t WXUNUSED(col),
|
||||
size_t WXUNUSED(row) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -193,7 +195,7 @@ public:
|
||||
|
||||
virtual size_t GetNumberOfRows() { return m_list.GetCount(); }
|
||||
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 )
|
||||
{
|
||||
if (col == 0)
|
||||
@ -347,7 +349,7 @@ MyFrame::MyFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h):
|
||||
|
||||
|
||||
// Left wxDataViewCtrl
|
||||
dataview_left = new wxDataViewCtrl( this, -1 );
|
||||
dataview_left = new wxDataViewCtrl( this, wxID_ANY );
|
||||
|
||||
MyTextModel *model = new MyTextModel;
|
||||
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 );
|
||||
|
||||
// Right wxDataViewCtrl using the same model
|
||||
dataview_right = new wxDataViewCtrl( this, -1 );
|
||||
dataview_right = new wxDataViewCtrl( this, wxID_ANY );
|
||||
dataview_right->AssociateModel( model );
|
||||
|
||||
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
|
||||
dataview_left = new wxDataViewCtrl( this, -1 );
|
||||
dataview_left = new wxDataViewCtrl( this, wxID_ANY );
|
||||
|
||||
MyUnsortedTextModel *model = new MyUnsortedTextModel;
|
||||
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 );
|
||||
|
||||
// Right wxDataViewCtrl using the sorting model
|
||||
dataview_right = new wxDataViewCtrl( this, -1 );
|
||||
dataview_right = new wxDataViewCtrl( this, wxID_ANY );
|
||||
wxDataViewSortedListModel *sorted_model =
|
||||
new wxDataViewSortedListModel( model );
|
||||
dataview_right->AssociateModel( sorted_model );
|
||||
@ -506,43 +508,43 @@ void MySortingFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
|
||||
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))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -15,24 +15,25 @@
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_DATAVIEWCTRL
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/dataview.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/image.h"
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/object.h"
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------
|
||||
#include "wx/image.h"
|
||||
#include "wx/dataview.h"
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewModel
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDataViewModel, wxObject)
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewListModel
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDataViewListModel, wxDataViewModel)
|
||||
|
||||
@ -58,7 +59,7 @@ bool wxDataViewListModel::RowAppended()
|
||||
ret = false;
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -74,7 +75,7 @@ bool wxDataViewListModel::RowPrepended()
|
||||
ret = false;
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -90,7 +91,7 @@ bool wxDataViewListModel::RowInserted( size_t before )
|
||||
ret = false;
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -106,7 +107,7 @@ bool wxDataViewListModel::RowDeleted( size_t row )
|
||||
ret = false;
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -122,7 +123,7 @@ bool wxDataViewListModel::RowChanged( size_t row )
|
||||
ret = false;
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -138,7 +139,7 @@ bool wxDataViewListModel::ValueChanged( size_t col, size_t row )
|
||||
ret = false;
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -154,7 +155,7 @@ bool wxDataViewListModel::RowsReordered( size_t *new_order )
|
||||
ret = false;
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -170,7 +171,7 @@ bool wxDataViewListModel::Cleared()
|
||||
ret = false;
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -185,13 +186,13 @@ void wxDataViewListModel::RemoveViewingColumn( wxDataViewColumn *column )
|
||||
while (node)
|
||||
{
|
||||
wxDataViewViewingColumn* tmp = (wxDataViewViewingColumn*) node->GetData();
|
||||
|
||||
|
||||
if (tmp->m_viewColumn == column)
|
||||
{
|
||||
m_viewingColumns.DeleteObject( tmp );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
node = node->GetNext();
|
||||
}
|
||||
}
|
||||
@ -207,32 +208,32 @@ void wxDataViewListModel::RemoveNotifier( wxDataViewListModelNotifier *notifier
|
||||
m_notifiers.DeleteObject( notifier );
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewSortedListModelNotifier
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class wxDataViewSortedListModelNotifier: public wxDataViewListModelNotifier
|
||||
{
|
||||
public:
|
||||
wxDataViewSortedListModelNotifier( wxDataViewSortedListModel *model )
|
||||
{ m_model = model; }
|
||||
|
||||
|
||||
virtual bool RowAppended() { return true; }
|
||||
virtual bool RowPrepended() { return true; }
|
||||
virtual bool RowInserted( size_t before ) { return true; }
|
||||
virtual bool RowDeleted( size_t row ) { return true; }
|
||||
virtual bool RowChanged( size_t row ) { return true; }
|
||||
virtual bool RowInserted( size_t WXUNUSED(before) ) { return true; }
|
||||
virtual bool RowDeleted( size_t WXUNUSED(row) ) { return true; }
|
||||
virtual bool RowChanged( size_t WXUNUSED(row) ) { return true; }
|
||||
virtual bool ValueChanged( size_t col, size_t 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; }
|
||||
|
||||
|
||||
wxDataViewSortedListModel *m_model;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewSortedListModel compare function
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
int wxCALLBACK wxDataViewListModelSortedDefaultCompare
|
||||
(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 );
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewSortedListModel
|
||||
// ---------------------------------------------------------
|
||||
|
||||
@ -294,11 +295,11 @@ wxDataViewSortedListModel::wxDataViewSortedListModel( wxDataViewListModel *child
|
||||
s_CmpCol = 0;
|
||||
s_CmpModel = child;
|
||||
s_CmpFunc = wxDataViewListModelSortedDefaultCompare;
|
||||
|
||||
|
||||
m_notifierOnChild = new wxDataViewSortedListModelNotifier( this );
|
||||
m_child->AddNotifier( m_notifierOnChild );
|
||||
|
||||
Resort();
|
||||
|
||||
Resort();
|
||||
}
|
||||
|
||||
wxDataViewSortedListModel::~wxDataViewSortedListModel()
|
||||
@ -335,7 +336,7 @@ bool wxDataViewSortedListModel::ChildValueChanged( size_t col, size_t row )
|
||||
{
|
||||
size_t i;
|
||||
size_t len = m_array.GetCount();
|
||||
|
||||
|
||||
// Remove and readd sorted. Find out at which
|
||||
// position it was and where it ended.
|
||||
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.Add( row );
|
||||
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
if (m_array[i] == row)
|
||||
{
|
||||
end_pos = i;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (end_pos == start_pos)
|
||||
return wxDataViewListModel::ValueChanged( col, start_pos );
|
||||
|
||||
|
||||
// Create an array where order[old] -> new_pos, so that
|
||||
// if nothing changed order[0] -> 0 etc.
|
||||
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--)
|
||||
order[i] = order[i-1];
|
||||
order[start_pos] = end_pos;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
wxDataViewListModel::RowsReordered( order );
|
||||
|
||||
|
||||
delete [] order;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -410,9 +411,9 @@ bool wxDataViewSortedListModel::SetValue( wxVariant &variant, size_t col, size_t
|
||||
{
|
||||
size_t child_row = m_array[row];
|
||||
bool ret = m_child->SetValue( variant, col, child_row );
|
||||
|
||||
|
||||
// Resort in ::ChildValueChanged() which gets reported back.
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -420,9 +421,9 @@ bool wxDataViewSortedListModel::RowAppended()
|
||||
{
|
||||
// you can only append
|
||||
bool ret = m_child->RowAppended();
|
||||
|
||||
|
||||
// report RowInsrted
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -430,31 +431,31 @@ bool wxDataViewSortedListModel::RowPrepended()
|
||||
{
|
||||
// you can only append
|
||||
bool ret = m_child->RowAppended();
|
||||
|
||||
|
||||
// report RowInsrted
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool wxDataViewSortedListModel::RowInserted( size_t before )
|
||||
bool wxDataViewSortedListModel::RowInserted( size_t WXUNUSED(before) )
|
||||
{
|
||||
// you can only append
|
||||
bool ret = m_child->RowAppended();
|
||||
|
||||
|
||||
// report different RowInsrted
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool wxDataViewSortedListModel::RowDeleted( size_t row )
|
||||
{
|
||||
size_t child_row = m_array[row];
|
||||
|
||||
|
||||
bool ret = m_child->RowDeleted( child_row );
|
||||
|
||||
|
||||
// Do nothing here as the change in the
|
||||
// child model will be reported back.
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -462,10 +463,10 @@ bool wxDataViewSortedListModel::RowChanged( size_t row )
|
||||
{
|
||||
size_t child_row = m_array[row];
|
||||
bool ret = m_child->RowChanged( child_row );
|
||||
|
||||
|
||||
// Do nothing here as the change in the
|
||||
// child model will be reported back.
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -473,14 +474,14 @@ bool wxDataViewSortedListModel::ValueChanged( size_t col, size_t row )
|
||||
{
|
||||
size_t child_row = m_array[row];
|
||||
bool ret = m_child->ValueChanged( col, child_row );
|
||||
|
||||
|
||||
// Do nothing here as the change in the
|
||||
// child model will be reported back.
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool wxDataViewSortedListModel::RowsReordered( size_t *new_order )
|
||||
bool wxDataViewSortedListModel::RowsReordered( size_t *WXUNUSED(new_order) )
|
||||
{
|
||||
// We sort them ourselves.
|
||||
|
||||
@ -490,15 +491,15 @@ bool wxDataViewSortedListModel::RowsReordered( size_t *new_order )
|
||||
bool wxDataViewSortedListModel::Cleared()
|
||||
{
|
||||
bool ret = m_child->Cleared();
|
||||
|
||||
|
||||
wxDataViewListModel::Cleared();
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewCellBase
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDataViewCellBase, wxObject)
|
||||
|
||||
@ -507,10 +508,10 @@ wxDataViewCellBase::wxDataViewCellBase( const wxString &varianttype, wxDataViewC
|
||||
m_variantType = varianttype;
|
||||
m_mode = mode;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewColumnBase
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDataViewColumnBase, wxObject)
|
||||
|
||||
@ -528,7 +529,7 @@ wxDataViewColumnBase::~wxDataViewColumnBase()
|
||||
{
|
||||
if (m_cell)
|
||||
delete m_cell;
|
||||
|
||||
|
||||
if (GetOwner())
|
||||
{
|
||||
GetOwner()->GetModel()->RemoveViewingColumn( (wxDataViewColumn*) this );
|
||||
@ -545,9 +546,9 @@ wxString wxDataViewColumnBase::GetTitle()
|
||||
return m_title;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewCtrlBase
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDataViewCtrlBase, wxControl)
|
||||
|
||||
@ -564,7 +565,7 @@ wxDataViewCtrlBase::~wxDataViewCtrlBase()
|
||||
bool wxDataViewCtrlBase::AssociateModel( wxDataViewListModel *model )
|
||||
{
|
||||
m_model = model;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -606,7 +607,7 @@ size_t wxDataViewCtrlBase::GetNumberOfColumns()
|
||||
return m_cols.GetCount();
|
||||
}
|
||||
|
||||
bool wxDataViewCtrlBase::DeleteColumn( size_t pos )
|
||||
bool wxDataViewCtrlBase::DeleteColumn( size_t WXUNUSED(pos) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: datavgen.cpp
|
||||
// Name: src/generic/datavgen.cpp
|
||||
// Purpose: wxDataViewCtrl generic implementation
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
@ -10,25 +10,25 @@
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_DATAVIEWCTRL
|
||||
|
||||
#include "wx/dataview.h"
|
||||
|
||||
#ifdef wxUSE_GENERICDATAVIEWCTRL
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
#include "wx/stockitem.h"
|
||||
#include "wx/dcclient.h"
|
||||
#include "wx/calctrl.h"
|
||||
#include "wx/popupwin.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/renderer.h"
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include <windows.h> // for DLGC_WANTARROWS
|
||||
#include "wx/msw/winundef.h"
|
||||
#include "wx/msw/wrapwin.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -57,11 +57,11 @@ public:
|
||||
void OnPaint( wxPaintEvent &event );
|
||||
void OnMouse( wxMouseEvent &event );
|
||||
void OnSetFocus( wxFocusEvent &event );
|
||||
|
||||
|
||||
private:
|
||||
wxDataViewCtrl *m_owner;
|
||||
wxCursor *m_resizeCursor;
|
||||
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxDataViewHeaderWindow)
|
||||
DECLARE_EVENT_TABLE()
|
||||
@ -97,32 +97,32 @@ public:
|
||||
void OnPaint( wxPaintEvent &event );
|
||||
void OnMouse( wxMouseEvent &event );
|
||||
void OnSetFocus( wxFocusEvent &event );
|
||||
|
||||
|
||||
void UpdateDisplay();
|
||||
void RecalculateDisplay();
|
||||
void OnInternalIdle();
|
||||
|
||||
|
||||
void ScrollWindow( int dx, int dy, const wxRect *rect );
|
||||
private:
|
||||
wxDataViewCtrl *m_owner;
|
||||
int m_lineHeight;
|
||||
bool m_dirty;
|
||||
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxDataViewMainWindow)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxGenericDataViewListModelNotifier
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class wxGenericDataViewListModelNotifier: public wxDataViewListModelNotifier
|
||||
{
|
||||
public:
|
||||
wxGenericDataViewListModelNotifier( wxDataViewMainWindow *mainWindow )
|
||||
{ m_mainWindow = mainWindow; }
|
||||
|
||||
|
||||
virtual bool RowAppended()
|
||||
{ return m_mainWindow->RowAppended(); }
|
||||
virtual bool RowPrepended()
|
||||
@ -139,13 +139,13 @@ public:
|
||||
{ return m_mainWindow->RowsReordered( new_order ); }
|
||||
virtual bool Cleared()
|
||||
{ return m_mainWindow->Cleared(); }
|
||||
|
||||
|
||||
wxDataViewMainWindow *m_mainWindow;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewCell
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDataViewCell, wxDataViewCellBase)
|
||||
|
||||
@ -171,25 +171,25 @@ wxDC *wxDataViewCell::GetDC()
|
||||
return NULL;
|
||||
m_dc = new wxClientDC( GetOwner()->GetOwner() );
|
||||
}
|
||||
|
||||
|
||||
return m_dc;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewCustomCell
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomCell, wxDataViewCell)
|
||||
|
||||
wxDataViewCustomCell::wxDataViewCustomCell( const wxString &varianttype,
|
||||
wxDataViewCustomCell::wxDataViewCustomCell( const wxString &varianttype,
|
||||
wxDataViewCellMode mode ) :
|
||||
wxDataViewCell( varianttype, mode )
|
||||
{
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewTextCell
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDataViewTextCell, wxDataViewCustomCell)
|
||||
|
||||
@ -201,16 +201,16 @@ wxDataViewTextCell::wxDataViewTextCell( const wxString &varianttype, wxDataViewC
|
||||
bool wxDataViewTextCell::SetValue( const wxVariant &value )
|
||||
{
|
||||
m_text = value.GetString();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxDataViewTextCell::GetValue( wxVariant &value )
|
||||
bool wxDataViewTextCell::GetValue( wxVariant& WXUNUSED(value) )
|
||||
{
|
||||
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 );
|
||||
|
||||
@ -222,13 +222,13 @@ wxSize wxDataViewTextCell::GetSize()
|
||||
return wxSize(80,20);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewToggleCell
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleCell, wxDataViewCustomCell)
|
||||
|
||||
wxDataViewToggleCell::wxDataViewToggleCell( const wxString &varianttype,
|
||||
wxDataViewToggleCell::wxDataViewToggleCell( const wxString &varianttype,
|
||||
wxDataViewCellMode mode ) :
|
||||
wxDataViewCustomCell( varianttype, mode )
|
||||
{
|
||||
@ -238,19 +238,19 @@ wxDataViewToggleCell::wxDataViewToggleCell( const wxString &varianttype,
|
||||
bool wxDataViewToggleCell::SetValue( const wxVariant &value )
|
||||
{
|
||||
m_toggle = value.GetBool();
|
||||
|
||||
|
||||
return true;;
|
||||
}
|
||||
|
||||
bool wxDataViewToggleCell::GetValue( wxVariant &value )
|
||||
bool wxDataViewToggleCell::GetValue( wxVariant &WXUNUSED(value) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxDataViewToggleCell::Render( wxRect cell, wxDC *dc, int state )
|
||||
|
||||
bool wxDataViewToggleCell::Render( wxRect cell, wxDC *dc, int WXUNUSED(state) )
|
||||
{
|
||||
// User wxRenderer here
|
||||
|
||||
|
||||
if (GetMode() == wxDATAVIEW_CELL_ACTIVATABLE)
|
||||
dc->SetPen( *wxBLACK_PEN );
|
||||
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.width, rect.y, rect.x, rect.y+rect.height );
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
wxVariant variant = value;
|
||||
model->SetValue( variant, col, row );
|
||||
model->ValueChanged( col, row );
|
||||
model->ValueChanged( col, row );
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -289,15 +289,15 @@ wxSize wxDataViewToggleCell::GetSize()
|
||||
return wxSize(20,20);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewProgressCell
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressCell, wxDataViewCustomCell)
|
||||
|
||||
wxDataViewProgressCell::wxDataViewProgressCell( const wxString &label,
|
||||
wxDataViewProgressCell::wxDataViewProgressCell( const wxString &label,
|
||||
const wxString &varianttype, wxDataViewCellMode mode ) :
|
||||
wxDataViewCustomCell( varianttype, mode )
|
||||
wxDataViewCustomCell( varianttype, mode )
|
||||
{
|
||||
m_label = label;
|
||||
m_value = 0;
|
||||
@ -310,14 +310,14 @@ wxDataViewProgressCell::~wxDataViewProgressCell()
|
||||
bool wxDataViewProgressCell::SetValue( const wxVariant &value )
|
||||
{
|
||||
m_value = (long) value;
|
||||
|
||||
|
||||
if (m_value < 0) m_value = 0;
|
||||
if (m_value > 100) m_value = 100;
|
||||
|
||||
|
||||
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;
|
||||
wxRect bar = cell;
|
||||
@ -329,7 +329,7 @@ bool wxDataViewProgressCell::Render( wxRect cell, wxDC *dc, int state )
|
||||
dc->SetBrush( *wxTRANSPARENT_BRUSH );
|
||||
dc->SetPen( *wxBLACK_PEN );
|
||||
dc->DrawRectangle( cell );
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -337,14 +337,14 @@ wxSize wxDataViewProgressCell::GetSize()
|
||||
{
|
||||
return wxSize(40,12);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewDateCell
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class wxDataViewDateCellPopupTransient: public wxPopupTransientWindow
|
||||
{
|
||||
public:
|
||||
public:
|
||||
wxDataViewDateCellPopupTransient( wxWindow* parent, wxDateTime *value,
|
||||
wxDataViewListModel *model, size_t col, size_t row ) :
|
||||
wxPopupTransientWindow( parent, wxBORDER_SIMPLE )
|
||||
@ -352,30 +352,30 @@ public:
|
||||
m_model = model;
|
||||
m_col = col;
|
||||
m_row = row;
|
||||
m_cal = new wxCalendarCtrl( this, -1, *value );
|
||||
m_cal = new wxCalendarCtrl( this, wxID_ANY, *value );
|
||||
wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
sizer->Add( m_cal, 1, wxGROW );
|
||||
SetSizer( sizer );
|
||||
sizer->Fit( this );
|
||||
}
|
||||
|
||||
|
||||
virtual void OnDismiss()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void OnCalendar( wxCalendarEvent &event );
|
||||
|
||||
|
||||
wxCalendarCtrl *m_cal;
|
||||
wxDataViewListModel *m_model;
|
||||
wxDataViewListModel *m_model;
|
||||
size_t m_col;
|
||||
size_t m_row;
|
||||
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(wxDataViewDateCellPopupTransient,wxPopupTransientWindow)
|
||||
EVT_CALENDAR( -1, wxDataViewDateCellPopupTransient::OnCalendar )
|
||||
EVT_CALENDAR( wxID_ANY, wxDataViewDateCellPopupTransient::OnCalendar )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
void wxDataViewDateCellPopupTransient::OnCalendar( wxCalendarEvent &event )
|
||||
@ -394,15 +394,15 @@ wxDataViewDateCell::wxDataViewDateCell( const wxString &varianttype,
|
||||
wxDataViewCustomCell( varianttype, mode )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool wxDataViewDateCell::SetValue( const wxVariant &value )
|
||||
{
|
||||
m_date = value.GetDateTime();
|
||||
|
||||
|
||||
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() );
|
||||
wxString tmp = m_date.FormatDate();
|
||||
@ -420,13 +420,13 @@ wxSize wxDataViewDateCell::GetSize()
|
||||
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;
|
||||
model->GetValue( variant, col, row );
|
||||
wxDateTime value = variant.GetDateTime();
|
||||
|
||||
wxDataViewDateCellPopupTransient *popup = new wxDataViewDateCellPopupTransient(
|
||||
wxDataViewDateCellPopupTransient *popup = new wxDataViewDateCellPopupTransient(
|
||||
GetOwner()->GetOwner()->GetParent(), &value, model, col, row );
|
||||
wxPoint pos = wxGetMousePosition();
|
||||
popup->Move( pos );
|
||||
@ -436,13 +436,13 @@ bool wxDataViewDateCell::Activate( wxRect cell, wxDataViewListModel *model, size
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewColumn
|
||||
// ---------------------------------------------------------
|
||||
// ---------------------------------------------------------
|
||||
|
||||
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 ) :
|
||||
wxDataViewColumnBase( title, cell, model_column, flags )
|
||||
{
|
||||
@ -456,7 +456,7 @@ wxDataViewColumn::~wxDataViewColumn()
|
||||
void wxDataViewColumn::SetTitle( const wxString &title )
|
||||
{
|
||||
wxDataViewColumnBase::SetTitle( title );
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -478,7 +478,7 @@ wxDataViewHeaderWindow::wxDataViewHeaderWindow( wxDataViewCtrl *parent, wxWindow
|
||||
SetOwner( parent );
|
||||
|
||||
m_resizeCursor = new wxCursor( wxCURSOR_SIZEWE );
|
||||
|
||||
|
||||
wxVisualAttributes attr = wxPanel::GetClassDefaultAttributes();
|
||||
SetOwnForegroundColour( attr.colFg );
|
||||
SetOwnBackgroundColour( attr.colBg );
|
||||
@ -491,13 +491,13 @@ wxDataViewHeaderWindow::~wxDataViewHeaderWindow()
|
||||
delete m_resizeCursor;
|
||||
}
|
||||
|
||||
void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &event )
|
||||
void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
{
|
||||
int w, h;
|
||||
GetClientSize( &w, &h );
|
||||
|
||||
wxPaintDC dc( this );
|
||||
|
||||
|
||||
int xpix;
|
||||
m_owner->GetScrollPixelsPerUnit( &xpix, NULL );
|
||||
|
||||
@ -506,9 +506,9 @@ void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &event )
|
||||
|
||||
// account for the horz scrollbar offset
|
||||
dc.SetDeviceOrigin( -x * xpix, 0 );
|
||||
|
||||
|
||||
dc.SetFont( GetFont() );
|
||||
|
||||
|
||||
size_t cols = GetOwner()->GetNumberOfColumns();
|
||||
size_t i;
|
||||
int xpos = 0;
|
||||
@ -516,7 +516,7 @@ void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &event )
|
||||
{
|
||||
wxDataViewColumn *col = GetOwner()->GetColumn( i );
|
||||
int width = col->GetWidth();
|
||||
|
||||
|
||||
// the width of the rect to draw: make it smaller to fit entirely
|
||||
// inside the column rect
|
||||
#ifdef __WXMAC__
|
||||
@ -536,13 +536,13 @@ void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &event )
|
||||
: (int)wxCONTROL_DISABLED
|
||||
);
|
||||
|
||||
dc.DrawText( col->GetTitle(), xpos+3, 3 );
|
||||
|
||||
dc.DrawText( col->GetTitle(), xpos+3, 3 );
|
||||
|
||||
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 )
|
||||
{
|
||||
SetOwner( parent );
|
||||
|
||||
|
||||
// We need to calculate this smartly..
|
||||
m_lineHeight = 20;
|
||||
|
||||
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
@ -589,22 +589,22 @@ bool wxDataViewMainWindow::RowPrepended()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxDataViewMainWindow::RowInserted( size_t before )
|
||||
bool wxDataViewMainWindow::RowInserted( size_t WXUNUSED(before) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxDataViewMainWindow::RowDeleted( size_t row )
|
||||
bool wxDataViewMainWindow::RowDeleted( size_t WXUNUSED(row) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxDataViewMainWindow::RowChanged( size_t row )
|
||||
bool wxDataViewMainWindow::RowChanged( size_t WXUNUSED(row) )
|
||||
{
|
||||
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 );
|
||||
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;
|
||||
}
|
||||
|
||||
bool wxDataViewMainWindow::RowsReordered( size_t *new_order )
|
||||
bool wxDataViewMainWindow::RowsReordered( size_t *WXUNUSED(new_order) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -631,7 +631,7 @@ void wxDataViewMainWindow::UpdateDisplay()
|
||||
void wxDataViewMainWindow::OnInternalIdle()
|
||||
{
|
||||
wxWindow::OnInternalIdle();
|
||||
|
||||
|
||||
if (m_dirty)
|
||||
{
|
||||
RecalculateDisplay();
|
||||
@ -647,7 +647,7 @@ void wxDataViewMainWindow::RecalculateDisplay()
|
||||
Refresh();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int width = 0;
|
||||
size_t cols = GetOwner()->GetNumberOfColumns();
|
||||
size_t i;
|
||||
@ -656,12 +656,12 @@ void wxDataViewMainWindow::RecalculateDisplay()
|
||||
wxDataViewColumn *col = GetOwner()->GetColumn( i );
|
||||
width += col->GetWidth();
|
||||
}
|
||||
|
||||
|
||||
int height = model->GetNumberOfRows() * m_lineHeight;
|
||||
|
||||
SetVirtualSize( width, height );
|
||||
GetOwner()->SetScrollRate( 10, m_lineHeight );
|
||||
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
@ -671,7 +671,7 @@ void wxDataViewMainWindow::ScrollWindow( int dx, int dy, const wxRect *rect )
|
||||
GetOwner()->m_headerArea->ScrollWindow( dx, 0 );
|
||||
}
|
||||
|
||||
void wxDataViewMainWindow::OnPaint( wxPaintEvent &event )
|
||||
void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
{
|
||||
wxPaintDC dc( this );
|
||||
|
||||
@ -681,9 +681,9 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &event )
|
||||
|
||||
wxRect update = GetUpdateRegion().GetBox();
|
||||
m_owner->CalcUnscrolledPosition( update.x, update.y, &update.x, &update.y );
|
||||
|
||||
|
||||
wxDataViewListModel *model = GetOwner()->GetModel();
|
||||
|
||||
|
||||
size_t item_start = update.y / m_lineHeight;
|
||||
size_t item_count = (update.height / m_lineHeight) + 1;
|
||||
|
||||
@ -697,7 +697,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &event )
|
||||
wxDataViewColumn *col = GetOwner()->GetColumn( i );
|
||||
wxDataViewCell *cell = col->GetCell();
|
||||
cell_rect.width = col->GetWidth();
|
||||
|
||||
|
||||
size_t item;
|
||||
for (item = item_start; item <= item_start+item_count; item++)
|
||||
{
|
||||
@ -714,12 +714,12 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &event )
|
||||
// for now: centre
|
||||
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.width = size.x;
|
||||
item_rect.height= size.y;
|
||||
cell->Render( item_rect, &dc, 0 );
|
||||
}
|
||||
|
||||
|
||||
cell_rect.x += cell_rect.width;
|
||||
}
|
||||
}
|
||||
@ -745,12 +745,12 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
|
||||
}
|
||||
xpos += c->GetWidth();
|
||||
}
|
||||
if (!col)
|
||||
if (!col)
|
||||
return;
|
||||
wxDataViewCell *cell = col->GetCell();
|
||||
|
||||
|
||||
size_t row = y / m_lineHeight;
|
||||
|
||||
|
||||
wxDataViewListModel *model = GetOwner()->GetModel();
|
||||
|
||||
if (event.LeftDClick())
|
||||
@ -763,7 +763,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
|
||||
wxRect cell_rect( xpos, row * m_lineHeight, col->GetWidth(), m_lineHeight );
|
||||
cell->Activate( cell_rect, model, col->GetModelColumn(), row );
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -797,23 +797,23 @@ void wxDataViewCtrl::Init()
|
||||
}
|
||||
|
||||
bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxValidator& validator )
|
||||
{
|
||||
if (!wxControl::Create( parent, id, pos, size, style | wxScrolledWindowStyle|wxSUNKEN_BORDER, validator))
|
||||
return false;
|
||||
|
||||
Init();
|
||||
|
||||
|
||||
#ifdef __WXMAC__
|
||||
MacSetClipChildren( true ) ;
|
||||
#endif
|
||||
|
||||
m_clientArea = new wxDataViewMainWindow( this, -1 );
|
||||
m_headerArea = new wxDataViewHeaderWindow( this, -1, wxDefaultPosition, wxSize(-1,25) );
|
||||
|
||||
m_clientArea = new wxDataViewMainWindow( this, wxID_ANY );
|
||||
m_headerArea = new wxDataViewHeaderWindow( this, wxID_ANY, wxDefaultPosition, wxSize(wxDefaultCoord,25) );
|
||||
|
||||
SetTargetWindow( m_clientArea );
|
||||
|
||||
|
||||
wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
|
||||
sizer->Add( m_headerArea, 0, wxGROW );
|
||||
sizer->Add( m_clientArea, 1, wxGROW );
|
||||
@ -841,7 +841,7 @@ WXLRESULT wxDataViewCtrl::MSWWindowProc(WXUINT nMsg,
|
||||
}
|
||||
#endif
|
||||
|
||||
void wxDataViewCtrl::OnSize( wxSizeEvent &event )
|
||||
void wxDataViewCtrl::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
{
|
||||
// We need to override OnSize so that our scrolled
|
||||
// window a) does call Layout() to use sizers for
|
||||
@ -862,10 +862,10 @@ bool wxDataViewCtrl::AssociateModel( wxDataViewListModel *model )
|
||||
|
||||
m_notifier = new wxGenericDataViewListModelNotifier( m_clientArea );
|
||||
|
||||
model->AddNotifier( m_notifier );
|
||||
model->AddNotifier( m_notifier );
|
||||
|
||||
m_clientArea->UpdateDisplay();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -873,15 +873,15 @@ bool wxDataViewCtrl::AppendColumn( wxDataViewColumn *col )
|
||||
{
|
||||
if (!wxDataViewCtrlBase::AppendColumn(col))
|
||||
return false;
|
||||
|
||||
|
||||
m_clientArea->UpdateDisplay();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
// !wxUSE_GENERICDATAVIEWCTRL
|
||||
|
||||
#endif
|
||||
#endif
|
||||
// wxUSE_DATAVIEWCTRL
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user