tests for the new [de]selection grid methods (patch by Roland Scholz

<scholz@pb.izm.fhg.de>)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9045 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-01-04 11:05:41 +00:00
parent db89aa764f
commit 14e5a313d1
2 changed files with 78 additions and 2 deletions

View File

@@ -97,6 +97,15 @@ BEGIN_EVENT_TABLE( GridFrame, wxFrame )
EVT_MENU( ID_VTABLE, GridFrame::OnVTable) EVT_MENU( ID_VTABLE, GridFrame::OnVTable)
EVT_MENU( ID_BUGS_TABLE, GridFrame::OnBugsTable) 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_LABEL_LEFT_CLICK( GridFrame::OnLabelLeftClick )
EVT_GRID_CELL_LEFT_CLICK( GridFrame::OnCellLeftClick ) EVT_GRID_CELL_LEFT_CLICK( GridFrame::OnCellLeftClick )
EVT_GRID_ROW_SIZE( GridFrame::OnRowSize ) EVT_GRID_ROW_SIZE( GridFrame::OnRowSize )
@@ -166,9 +175,17 @@ GridFrame::GridFrame()
editMenu->Append( ID_DELETECOL, "Delete selected co&ls" ); editMenu->Append( ID_DELETECOL, "Delete selected co&ls" );
editMenu->Append( ID_CLEARGRID, "Cl&ear grid cell contents" ); 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; wxMenu *selectionMenu = new wxMenu;
selectMenu->Append( ID_CHANGESEL, "Change &selection mode",
editMenu->Append( ID_CHANGESEL, "Change &selection mode",
selectionMenu, selectionMenu,
"Change selection mode" ); "Change selection mode" );
@@ -176,6 +193,7 @@ GridFrame::GridFrame()
selectionMenu->Append( ID_SELROWS, "Select &Rows" ); selectionMenu->Append( ID_SELROWS, "Select &Rows" );
selectionMenu->Append( ID_SELCOLS, "Select C&ols" ); selectionMenu->Append( ID_SELCOLS, "Select C&ols" );
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append( ID_ABOUT, "&About wxGrid demo" ); helpMenu->Append( ID_ABOUT, "&About wxGrid demo" );
@@ -184,6 +202,7 @@ GridFrame::GridFrame()
menuBar->Append( viewMenu, "&View" ); menuBar->Append( viewMenu, "&View" );
menuBar->Append( colMenu, "&Colours" ); menuBar->Append( colMenu, "&Colours" );
menuBar->Append( editMenu, "&Edit" ); menuBar->Append( editMenu, "&Edit" );
menuBar->Append( selectMenu, "&Select" );
menuBar->Append( helpMenu, "&Help" ); menuBar->Append( helpMenu, "&Help" );
SetMenuBar( menuBar ); 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 ) void GridFrame::OnLabelLeftClick( wxGridEvent& ev )
{ {
logBuf = ""; logBuf = "";

View File

@@ -62,6 +62,15 @@ class GridFrame : public wxFrame
void SelectRows( wxCommandEvent& ); void SelectRows( wxCommandEvent& );
void SelectCols( 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 OnLabelLeftClick( wxGridEvent& );
void OnCellLeftClick( wxGridEvent& ); void OnCellLeftClick( wxGridEvent& );
void OnRowSize( wxGridSizeEvent& ); void OnRowSize( wxGridSizeEvent& );
@@ -115,6 +124,14 @@ public:
ID_ABOUT, ID_ABOUT,
ID_VTABLE, ID_VTABLE,
ID_BUGS_TABLE, 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 ID_TESTFUNC
}; };