From e07d27ce7846dda8e94095aede3ea8043a53ba9b Mon Sep 17 00:00:00 2001
From: Pavel Kalugin
Date: Mon, 3 Sep 2018 18:07:56 +0300
Subject: [PATCH] Add a command to set corner label to grid sample
---
samples/grid/griddemo.cpp | 16 ++++++++++++++++
samples/grid/griddemo.h | 2 ++
2 files changed, 18 insertions(+)
diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp
index 774efad4b3..d8c775988c 100644
--- a/samples/grid/griddemo.cpp
+++ b/samples/grid/griddemo.cpp
@@ -178,6 +178,7 @@ wxBEGIN_EVENT_TABLE( GridFrame, wxFrame )
EVT_MENU( ID_DELETEROW, GridFrame::DeleteSelectedRows )
EVT_MENU( ID_DELETECOL, GridFrame::DeleteSelectedCols )
EVT_MENU( ID_CLEARGRID, GridFrame::ClearGrid )
+ EVT_MENU( ID_SETCORNERLABEL, GridFrame::SetCornerLabelValue )
EVT_MENU( ID_SHOWSEL, GridFrame::ShowSelection )
EVT_MENU( ID_SELCELLS, GridFrame::SelectCells )
EVT_MENU( ID_SELROWS, GridFrame::SelectRows )
@@ -352,6 +353,7 @@ GridFrame::GridFrame()
editMenu->Append( ID_DELETEROW, wxT("Delete selected ro&ws") );
editMenu->Append( ID_DELETECOL, wxT("Delete selected co&ls") );
editMenu->Append( ID_CLEARGRID, wxT("Cl&ear grid cell contents") );
+ editMenu->Append( ID_SETCORNERLABEL, wxT("&Set corner label...") );
wxMenu *selectMenu = new wxMenu;
selectMenu->Append( ID_SELECT_UNSELECT, wxT("Add new cells to the selection"),
@@ -1040,6 +1042,20 @@ void GridFrame::ClearGrid( wxCommandEvent& WXUNUSED(ev) )
grid->ClearGrid();
}
+void GridFrame::SetCornerLabelValue( wxCommandEvent& WXUNUSED(ev) )
+{
+ wxTextEntryDialog dialog(this,
+ "Please enter corner label:",
+ "Please enter a string",
+ grid->GetCornerLabelValue(),
+ wxOK | wxCANCEL);
+
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ grid->SetCornerLabelValue(dialog.GetValue());
+ }
+}
+
void GridFrame::ShowSelection( wxCommandEvent& WXUNUSED(ev) )
{
switch ( grid->GetSelectionMode() )
diff --git a/samples/grid/griddemo.h b/samples/grid/griddemo.h
index 30c1a85150..6d3e60667c 100644
--- a/samples/grid/griddemo.h
+++ b/samples/grid/griddemo.h
@@ -64,6 +64,7 @@ class GridFrame : public wxFrame
void DeleteSelectedRows( wxCommandEvent& );
void DeleteSelectedCols( wxCommandEvent& );
void ClearGrid( wxCommandEvent& );
+ void SetCornerLabelValue( wxCommandEvent& );
void ShowSelection( wxCommandEvent& );
void SelectCells( wxCommandEvent& );
void SelectRows( wxCommandEvent& );
@@ -165,6 +166,7 @@ public:
ID_DELETEROW,
ID_DELETECOL,
ID_CLEARGRID,
+ ID_SETCORNERLABEL,
ID_SHOWSEL,
ID_CHANGESEL,
ID_SELCELLS,