Added demonstration of insert/delete rows/cols
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3954 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -56,6 +56,10 @@ BEGIN_EVENT_TABLE( GridFrame, wxFrame )
|
|||||||
EVT_MENU( ID_COLLABELHORIZALIGN, GridFrame::SetColLabelHorizAlignment )
|
EVT_MENU( ID_COLLABELHORIZALIGN, GridFrame::SetColLabelHorizAlignment )
|
||||||
EVT_MENU( ID_COLLABELVERTALIGN, GridFrame::SetColLabelVertAlignment )
|
EVT_MENU( ID_COLLABELVERTALIGN, GridFrame::SetColLabelVertAlignment )
|
||||||
EVT_MENU( ID_GRIDLINECOLOUR, GridFrame::SetGridLineColour )
|
EVT_MENU( ID_GRIDLINECOLOUR, GridFrame::SetGridLineColour )
|
||||||
|
EVT_MENU( ID_INSERTROW, GridFrame::InsertRow )
|
||||||
|
EVT_MENU( ID_INSERTCOL, GridFrame::InsertCol )
|
||||||
|
EVT_MENU( ID_DELETEROW, GridFrame::DeleteRow )
|
||||||
|
EVT_MENU( ID_DELETECOL, GridFrame::DeleteCol )
|
||||||
EVT_MENU( ID_CLEARGRID, GridFrame::ClearGrid )
|
EVT_MENU( ID_CLEARGRID, GridFrame::ClearGrid )
|
||||||
EVT_MENU( ID_ABOUT, GridFrame::About )
|
EVT_MENU( ID_ABOUT, GridFrame::About )
|
||||||
EVT_MENU( wxID_EXIT, GridFrame::OnQuit )
|
EVT_MENU( wxID_EXIT, GridFrame::OnQuit )
|
||||||
@@ -107,7 +111,13 @@ GridFrame::GridFrame()
|
|||||||
colLabelMenu->Append( ID_COLLABELVERTALIGN, "&Vertical" );
|
colLabelMenu->Append( ID_COLLABELVERTALIGN, "&Vertical" );
|
||||||
|
|
||||||
viewMenu->Append( ID_GRIDLINECOLOUR, "&Grid line colour" );
|
viewMenu->Append( ID_GRIDLINECOLOUR, "&Grid line colour" );
|
||||||
viewMenu->Append( ID_CLEARGRID, "Cl&ear grid cell contents" );
|
|
||||||
|
wxMenu *editMenu = new wxMenu;
|
||||||
|
editMenu->Append( ID_INSERTROW, "Insert &row" );
|
||||||
|
editMenu->Append( ID_INSERTCOL, "Insert &column" );
|
||||||
|
editMenu->Append( ID_DELETEROW, "Delete ro&w" );
|
||||||
|
editMenu->Append( ID_DELETECOL, "Delete co&l" );
|
||||||
|
editMenu->Append( ID_CLEARGRID, "Cl&ear grid cell contents" );
|
||||||
|
|
||||||
wxMenu *helpMenu = new wxMenu;
|
wxMenu *helpMenu = new wxMenu;
|
||||||
helpMenu->Append( ID_ABOUT, "&About wxGrid demo" );
|
helpMenu->Append( ID_ABOUT, "&About wxGrid demo" );
|
||||||
@@ -115,6 +125,7 @@ GridFrame::GridFrame()
|
|||||||
wxMenuBar *menuBar = new wxMenuBar;
|
wxMenuBar *menuBar = new wxMenuBar;
|
||||||
menuBar->Append( fileMenu, "&File" );
|
menuBar->Append( fileMenu, "&File" );
|
||||||
menuBar->Append( viewMenu, "&View" );
|
menuBar->Append( viewMenu, "&View" );
|
||||||
|
menuBar->Append( editMenu, "&Edit" );
|
||||||
menuBar->Append( helpMenu, "&Help" );
|
menuBar->Append( helpMenu, "&Help" );
|
||||||
|
|
||||||
SetMenuBar( menuBar );
|
SetMenuBar( menuBar );
|
||||||
@@ -362,6 +373,30 @@ void GridFrame::SetGridLineColour( wxCommandEvent& WXUNUSED(ev) )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GridFrame::InsertRow( wxCommandEvent& WXUNUSED(ev) )
|
||||||
|
{
|
||||||
|
grid->InsertRows( 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GridFrame::InsertCol( wxCommandEvent& WXUNUSED(ev) )
|
||||||
|
{
|
||||||
|
grid->InsertCols( 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GridFrame::DeleteRow( wxCommandEvent& WXUNUSED(ev) )
|
||||||
|
{
|
||||||
|
grid->DeleteRows( 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GridFrame::DeleteCol( wxCommandEvent& WXUNUSED(ev) )
|
||||||
|
{
|
||||||
|
grid->DeleteCols( 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GridFrame::ClearGrid( wxCommandEvent& WXUNUSED(ev) )
|
void GridFrame::ClearGrid( wxCommandEvent& WXUNUSED(ev) )
|
||||||
{
|
{
|
||||||
grid->ClearGrid();
|
grid->ClearGrid();
|
||||||
|
@@ -41,6 +41,11 @@ class GridFrame : public wxFrame
|
|||||||
void SetColLabelHorizAlignment( wxCommandEvent& );
|
void SetColLabelHorizAlignment( wxCommandEvent& );
|
||||||
void SetColLabelVertAlignment( wxCommandEvent& );
|
void SetColLabelVertAlignment( wxCommandEvent& );
|
||||||
void SetGridLineColour( wxCommandEvent& );
|
void SetGridLineColour( wxCommandEvent& );
|
||||||
|
|
||||||
|
void InsertRow( wxCommandEvent& );
|
||||||
|
void InsertCol( wxCommandEvent& );
|
||||||
|
void DeleteRow( wxCommandEvent& );
|
||||||
|
void DeleteCol( wxCommandEvent& );
|
||||||
void ClearGrid( wxCommandEvent& );
|
void ClearGrid( wxCommandEvent& );
|
||||||
|
|
||||||
void About( wxCommandEvent& );
|
void About( wxCommandEvent& );
|
||||||
@@ -72,6 +77,10 @@ class GridFrame : public wxFrame
|
|||||||
ID_COLLABELHORIZALIGN,
|
ID_COLLABELHORIZALIGN,
|
||||||
ID_COLLABELVERTALIGN,
|
ID_COLLABELVERTALIGN,
|
||||||
ID_GRIDLINECOLOUR,
|
ID_GRIDLINECOLOUR,
|
||||||
|
ID_INSERTROW,
|
||||||
|
ID_INSERTCOL,
|
||||||
|
ID_DELETEROW,
|
||||||
|
ID_DELETECOL,
|
||||||
ID_CLEARGRID,
|
ID_CLEARGRID,
|
||||||
ID_ABOUT,
|
ID_ABOUT,
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user