]> git.saurik.com Git - wxWidgets.git/commitdiff
Added view menu items to toggle row and col drag-resizing.
authorMichael Bedward <mbedward@ozemail.com.au>
Tue, 22 Feb 2000 04:06:58 +0000 (04:06 +0000)
committerMichael Bedward <mbedward@ozemail.com.au>
Tue, 22 Feb 2000 04:06:58 +0000 (04:06 +0000)
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
samples/newgrid/griddemo.h

index 492043c751ca1f0421208c5ab7589b255a52ff5f..3a7f00e66c2627ab2efe3baf65bca1336f8f2e70 100644 (file)
@@ -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 );
index e54c469f75fe6eeebff29eed0ce1ee0931e6658f..4af53be9602bd232ca96499e9d44f93f6bfda2bb 100644 (file)
@@ -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,