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

@ -215,9 +215,9 @@ 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; }

View File

@ -37,18 +37,29 @@ 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),
wxDataViewListModel *WXUNUSED(model),
size_t WXUNUSED(col),
size_t WXUNUSED(row) )
{ return false; } { return false; }
virtual bool RightClick( wxPoint cursor, wxRect cell, virtual bool RightClick( wxPoint WXUNUSED(cursor),
wxDataViewListModel *model, size_t col, size_t row ) wxRect WXUNUSED(cell),
wxDataViewListModel *WXUNUSED(model),
size_t WXUNUSED(col),
size_t WXUNUSED(row) )
{ return false; } { return false; }
virtual bool StartDrag( wxPoint cursor, wxRect cell, virtual bool StartDrag( wxPoint WXUNUSED(cursor),
wxDataViewListModel *model, size_t col, size_t row ) wxRect WXUNUSED(cell),
wxDataViewListModel *WXUNUSED(model),
size_t WXUNUSED(col),
size_t WXUNUSED(row) )
{ return false; } { return false; }
// Create DC on request // Create DC on request

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,14 +15,15 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#include "wx/defs.h"
#if wxUSE_DATAVIEWCTRL #if wxUSE_DATAVIEWCTRL
#ifndef WX_PRECOMP
#include "wx/object.h" #include "wx/object.h"
#include "wx/dataview.h"
#include "wx/log.h" #include "wx/log.h"
#endif
#include "wx/image.h" #include "wx/image.h"
#include "wx/dataview.h"
// --------------------------------------------------------- // ---------------------------------------------------------
// wxDataViewModel // wxDataViewModel
@ -219,12 +220,12 @@ public:
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;
@ -436,7 +437,7 @@ bool wxDataViewSortedListModel::RowPrepended()
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();
@ -480,7 +481,7 @@ bool wxDataViewSortedListModel::ValueChanged( size_t col, size_t row )
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.
@ -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
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -205,12 +205,12 @@ bool wxDataViewTextCell::SetValue( const wxVariant &value )
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 );
@ -242,12 +242,12 @@ bool wxDataViewToggleCell::SetValue( const wxVariant &value )
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
@ -275,7 +275,7 @@ bool wxDataViewToggleCell::Render( wxRect cell, wxDC *dc, int state )
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;
@ -317,7 +317,7 @@ bool wxDataViewProgressCell::SetValue( const wxVariant &value )
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;
@ -352,7 +352,7 @@ 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 );
@ -375,7 +375,7 @@ private:
}; };
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 )
@ -402,7 +402,7 @@ bool wxDataViewDateCell::SetValue( const wxVariant &value )
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,7 +420,7 @@ 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 );
@ -491,7 +491,7 @@ 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 );
@ -542,7 +542,7 @@ void wxDataViewHeaderWindow::OnPaint( wxPaintEvent &event )
} }
} }
void wxDataViewHeaderWindow::OnMouse( wxMouseEvent &event ) void wxDataViewHeaderWindow::OnMouse( wxMouseEvent &WXUNUSED(event) )
{ {
} }
@ -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;
} }
@ -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 );
@ -809,8 +809,8 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id,
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 );
@ -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