in-place editing code from Michael Bedward integrated (with my docs)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2874 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-06-23 11:26:19 +00:00
parent da175b2ce4
commit c0b042fce9
4 changed files with 480 additions and 302 deletions

View File

@@ -34,6 +34,7 @@ class MyApp: public wxApp
bool OnInit(void);
};
// Define a new frame type
class MyFrame: public wxFrame
{ public:
@@ -41,6 +42,7 @@ class MyFrame: public wxFrame
MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
void ToggleEditable(wxCommandEvent& event);
void ToggleEditInPlace(wxCommandEvent& event);
void ToggleRowLabel(wxCommandEvent& event);
void ToggleColLabel(wxCommandEvent& event);
void ToggleDividers(wxCommandEvent& event);
@@ -66,6 +68,7 @@ wxBitmap *cellBitmap2 = (wxBitmap *) NULL;
// ID for the menu quit command
#define GRID_QUIT 1
#define GRID_TOGGLE_EDITABLE 2
#define GRID_TOGGLE_EDITINPLACE 22
#define GRID_LEFT_CELL 3
#define GRID_CENTRE_CELL 4
#define GRID_RIGHT_CELL 5
@@ -105,6 +108,7 @@ bool MyApp::OnInit(void)
wxMenu *settings_menu = new wxMenu;
settings_menu->Append(GRID_TOGGLE_EDITABLE, "&Toggle editable");
settings_menu->Append(GRID_TOGGLE_EDITINPLACE, "&Toggle edit in place");
settings_menu->Append(GRID_TOGGLE_ROW_LABEL, "Toggle ro&w label");
settings_menu->Append(GRID_TOGGLE_COL_LABEL, "Toggle co&l label");
settings_menu->Append(GRID_TOGGLE_DIVIDERS, "Toggle &dividers");
@@ -164,6 +168,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, cons
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(GRID_TOGGLE_EDITABLE, MyFrame::ToggleEditable)
EVT_MENU(GRID_TOGGLE_EDITINPLACE, MyFrame::ToggleEditInPlace)
EVT_MENU(GRID_TOGGLE_ROW_LABEL, MyFrame::ToggleRowLabel)
EVT_MENU(GRID_TOGGLE_COL_LABEL, MyFrame::ToggleColLabel)
EVT_MENU(GRID_TOGGLE_DIVIDERS, MyFrame::ToggleDividers)
@@ -185,6 +190,12 @@ void MyFrame::ToggleEditable(wxCommandEvent& WXUNUSED(event))
grid->Refresh();
}
void MyFrame::ToggleEditInPlace(wxCommandEvent& WXUNUSED(event))
{
grid->SetEditInPlace(!grid->GetEditInPlace());
grid->Refresh();
}
void MyFrame::ToggleRowLabel(wxCommandEvent& WXUNUSED(event))
{
if (grid->GetLabelSize(wxVERTICAL) > 0)