]> git.saurik.com Git - wxWidgets.git/commitdiff
tests for the new [de]selection grid methods (patch by Roland Scholz
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 4 Jan 2001 11:05:41 +0000 (11:05 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 4 Jan 2001 11:05:41 +0000 (11:05 +0000)
<scholz@pb.izm.fhg.de>)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9045 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/newgrid/griddemo.cpp
samples/newgrid/griddemo.h

index 81882094529abb70d9d0a4b8529afd3b8e4c5316..1c4e4a2841baa84a822974342aed51a3c5568696 100644 (file)
@@ -97,6 +97,15 @@ BEGIN_EVENT_TABLE( GridFrame, wxFrame )
     EVT_MENU( ID_VTABLE, GridFrame::OnVTable)
     EVT_MENU( ID_BUGS_TABLE, GridFrame::OnBugsTable)
 
+    EVT_MENU( ID_DESELECT_CELL, GridFrame::DeselectCell)
+    EVT_MENU( ID_DESELECT_COL, GridFrame::DeselectCol)
+    EVT_MENU( ID_DESELECT_ROW, GridFrame::DeselectRow)
+    EVT_MENU( ID_DESELECT_ALL, GridFrame::DeselectAll)
+    EVT_MENU( ID_SELECT_CELL, GridFrame::SelectCell)
+    EVT_MENU( ID_SELECT_COL, GridFrame::SelectCol)
+    EVT_MENU( ID_SELECT_ROW, GridFrame::SelectRow)
+    EVT_MENU( ID_SELECT_ALL, GridFrame::SelectAll)
+
     EVT_GRID_LABEL_LEFT_CLICK( GridFrame::OnLabelLeftClick )
     EVT_GRID_CELL_LEFT_CLICK( GridFrame::OnCellLeftClick )
     EVT_GRID_ROW_SIZE( GridFrame::OnRowSize )
@@ -166,9 +175,17 @@ GridFrame::GridFrame()
     editMenu->Append( ID_DELETECOL, "Delete selected co&ls" );
     editMenu->Append( ID_CLEARGRID, "Cl&ear grid cell contents" );
 
+    wxMenu *selectMenu = new wxMenu;
+    selectMenu->Append( ID_SELECT_ALL, "Select all");
+    selectMenu->Append( ID_SELECT_ROW, "Select row 2");
+    selectMenu->Append( ID_SELECT_COL, "Select col 2");
+    selectMenu->Append( ID_SELECT_CELL, "Select cell (3, 1)");
+    selectMenu->Append( ID_DESELECT_ALL, "Deselect all");
+    selectMenu->Append( ID_DESELECT_ROW, "Deselect row 2");
+    selectMenu->Append( ID_DESELECT_COL, "Deselect col 2");
+    selectMenu->Append( ID_DESELECT_CELL, "Deselect cell (3, 1)");
     wxMenu *selectionMenu = new wxMenu;
-
-    editMenu->Append( ID_CHANGESEL, "Change &selection mode",
+    selectMenu->Append( ID_CHANGESEL, "Change &selection mode",
                       selectionMenu,
                       "Change selection mode" );
 
@@ -176,6 +193,7 @@ GridFrame::GridFrame()
     selectionMenu->Append( ID_SELROWS, "Select &Rows" );
     selectionMenu->Append( ID_SELCOLS, "Select C&ols" );
 
+
     wxMenu *helpMenu = new wxMenu;
     helpMenu->Append( ID_ABOUT, "&About wxGrid demo" );
 
@@ -184,6 +202,7 @@ GridFrame::GridFrame()
     menuBar->Append( viewMenu, "&View" );
     menuBar->Append( colMenu,  "&Colours" );
     menuBar->Append( editMenu, "&Edit" );
+    menuBar->Append( selectMenu, "&Select" );
     menuBar->Append( helpMenu, "&Help" );
 
     SetMenuBar( menuBar );
@@ -582,6 +601,46 @@ void GridFrame::SetCellBgColour( wxCommandEvent& WXUNUSED(ev) )
     }
 }
 
+void GridFrame::DeselectCell(wxCommandEvent& WXUNUSED(event))
+{
+      grid->DeselectCell(3, 1);
+}
+
+void GridFrame::DeselectCol(wxCommandEvent& WXUNUSED(event))
+{
+      grid->DeselectCol(2);
+}
+
+void GridFrame::DeselectRow(wxCommandEvent& WXUNUSED(event))
+{
+      grid->DeselectRow(2);
+}
+
+void GridFrame::DeselectAll(wxCommandEvent& WXUNUSED(event))
+{
+      grid->ClearSelection();
+}
+
+void GridFrame::SelectCell(wxCommandEvent& WXUNUSED(event))
+{
+      grid->SelectBlock(3, 1, 3, 1);
+}
+
+void GridFrame::SelectCol(wxCommandEvent& WXUNUSED(event))
+{
+      grid->SelectCol(2, TRUE);
+}
+
+void GridFrame::SelectRow(wxCommandEvent& WXUNUSED(event))
+{
+      grid->SelectRow(2, TRUE);
+}
+
+void GridFrame::SelectAll(wxCommandEvent& WXUNUSED(event))
+{
+      grid->SelectAll();
+}
+
 void GridFrame::OnLabelLeftClick( wxGridEvent& ev )
 {
     logBuf = "";
index 29f1bca2df550985ea6f7f300e2cd5c6526e7336..b450ef6e00d8e445cab60d5e7f15fc952ac5071c 100644 (file)
@@ -62,6 +62,15 @@ class GridFrame : public wxFrame
     void SelectRows( wxCommandEvent& );
     void SelectCols( wxCommandEvent& );
 
+    void DeselectCell(wxCommandEvent& event);
+    void DeselectCol(wxCommandEvent& event);
+    void DeselectRow(wxCommandEvent& event);
+    void DeselectAll(wxCommandEvent& event);
+    void SelectCell(wxCommandEvent& event);
+    void SelectCol(wxCommandEvent& event);
+    void SelectRow(wxCommandEvent& event);
+    void SelectAll(wxCommandEvent& event);
+
     void OnLabelLeftClick( wxGridEvent& );
     void OnCellLeftClick( wxGridEvent& );
     void OnRowSize( wxGridSizeEvent& );
@@ -115,6 +124,14 @@ public:
         ID_ABOUT,
         ID_VTABLE,
         ID_BUGS_TABLE,
+        ID_SELECT_ALL,
+        ID_SELECT_ROW,
+        ID_SELECT_COL,
+        ID_SELECT_CELL,
+        ID_DESELECT_ALL,
+        ID_DESELECT_ROW,
+        ID_DESELECT_COL,
+        ID_DESELECT_CELL,
 
         ID_TESTFUNC
     };