From dd16fdaeaaa5882bdf1ee7af8b2a64821c0680af Mon Sep 17 00:00:00 2001 From: Michael Bedward Date: Tue, 22 Feb 2000 04:06:58 +0000 Subject: [PATCH 1/1] Added view menu items to toggle row and col drag-resizing. Removed setting of cell background colour for the moment. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6199 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/newgrid/griddemo.cpp | 23 ++++++++++++++++++++--- samples/newgrid/griddemo.h | 4 ++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/samples/newgrid/griddemo.cpp b/samples/newgrid/griddemo.cpp index 492043c751..3a7f00e66c 100644 --- a/samples/newgrid/griddemo.cpp +++ b/samples/newgrid/griddemo.cpp @@ -68,6 +68,8 @@ BEGIN_EVENT_TABLE( GridFrame, wxFrame ) EVT_MENU( ID_TOGGLEROWLABELS, GridFrame::ToggleRowLabels ) EVT_MENU( ID_TOGGLECOLLABELS, GridFrame::ToggleColLabels ) EVT_MENU( ID_TOGGLEEDIT, GridFrame::ToggleEditing ) + EVT_MENU( ID_TOGGLEROWSIZING, GridFrame::ToggleRowSizing ) + EVT_MENU( ID_TOGGLECOLSIZING, GridFrame::ToggleColSizing ) EVT_MENU( ID_SETLABELCOLOUR, GridFrame::SetLabelColour ) EVT_MENU( ID_SETLABELTEXTCOLOUR, GridFrame::SetLabelTextColour ) EVT_MENU( ID_ROWLABELHORIZALIGN, GridFrame::SetRowLabelHorizAlignment ) @@ -120,6 +122,8 @@ GridFrame::GridFrame() viewMenu->Append( ID_TOGGLEROWLABELS, "&Row labels", "", TRUE ); viewMenu->Append( ID_TOGGLECOLLABELS, "&Col labels", "", TRUE ); viewMenu->Append( ID_TOGGLEEDIT, "&Editable", "", TRUE ); + viewMenu->Append( ID_TOGGLEROWSIZING, "Ro&w drag-resize", "", TRUE ); + viewMenu->Append( ID_TOGGLECOLSIZING, "C&ol drag-resize", "", TRUE ); wxMenu *rowLabelMenu = new wxMenu; @@ -187,9 +191,6 @@ GridFrame::GridFrame() //grid->CreateGrid( 100, 100 ); grid->SetTable(new SimpleTable(100, 100), TRUE); - // VZ: cell borders don't look nice otherwise :-) (for now...) - grid->SetDefaultCellBackgroundColour(wxColour(200, 200, 180)); - grid->SetRowSize( 0, 60 ); grid->SetCellValue( 0, 0, "Ctrl+Home\nwill go to\nthis cell" ); @@ -260,6 +261,8 @@ void GridFrame::SetDefaults() GetMenuBar()->Check( ID_TOGGLEROWLABELS, TRUE ); GetMenuBar()->Check( ID_TOGGLECOLLABELS, TRUE ); GetMenuBar()->Check( ID_TOGGLEEDIT, TRUE ); + GetMenuBar()->Check( ID_TOGGLEROWSIZING, TRUE ); + GetMenuBar()->Check( ID_TOGGLECOLSIZING, TRUE ); } @@ -296,6 +299,20 @@ void GridFrame::ToggleEditing( wxCommandEvent& WXUNUSED(ev) ) } +void GridFrame::ToggleRowSizing( wxCommandEvent& WXUNUSED(ev) ) +{ + grid->EnableDragRowSize( + GetMenuBar()->IsChecked( ID_TOGGLEROWSIZING ) ); +} + + +void GridFrame::ToggleColSizing( wxCommandEvent& WXUNUSED(ev) ) +{ + grid->EnableDragColSize( + GetMenuBar()->IsChecked( ID_TOGGLECOLSIZING ) ); +} + + void GridFrame::SetLabelColour( wxCommandEvent& WXUNUSED(ev) ) { wxColourDialog dlg( NULL ); diff --git a/samples/newgrid/griddemo.h b/samples/newgrid/griddemo.h index e54c469f75..4af53be960 100644 --- a/samples/newgrid/griddemo.h +++ b/samples/newgrid/griddemo.h @@ -37,6 +37,8 @@ class GridFrame : public wxFrame void ToggleRowLabels( wxCommandEvent& ); void ToggleColLabels( wxCommandEvent& ); void ToggleEditing( wxCommandEvent& ); + void ToggleRowSizing( wxCommandEvent& ); + void ToggleColSizing( wxCommandEvent& ); void SetLabelColour( wxCommandEvent& ); void SetLabelTextColour( wxCommandEvent& ); void SetRowLabelHorizAlignment( wxCommandEvent& ); @@ -79,6 +81,8 @@ public: ID_TOGGLEROWLABELS = 100, ID_TOGGLECOLLABELS, ID_TOGGLEEDIT, + ID_TOGGLEROWSIZING, + ID_TOGGLECOLSIZING, ID_SETLABELCOLOUR, ID_SETLABELTEXTCOLOUR, ID_ROWLABELALIGN, -- 2.45.2