Edit menu wired up

This commit is contained in:
Tim Warren 2015-04-09 13:27:30 -04:00
parent dee08adda4
commit 57fb790397
4 changed files with 32 additions and 7 deletions

View File

@ -25,7 +25,7 @@ MainFrame::MainFrame(wxFrame *frame, const wxString& title)
base_sizer->Add(notebook, 1, wxEXPAND | wxALL, 5);
base_sizer->SetContainingWindow(this);
base_sizer->SetMinSize(800,600);
base_sizer->SetMinSize(600,400);
SetSizerAndFit(base_sizer);
@ -128,7 +128,10 @@ void MainFrame::BindEvents()
Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnNew, this, wxID_NEW);
Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnAbout, this, wxID_ABOUT);
Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnQuit, this, wxID_EXIT);
Bind(wxEVT_COMMAND_MENU_SELECTED, &TabContainer::OnEditSelectAll, notebook, wxID_SELECTALL);
Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnEditCut, this, wxID_CUT);
Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnEditCopy, this, wxID_COPY);
Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnEditPaste, this, wxID_PASTE);
Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnEditSelectAll, this, wxID_SELECTALL);
}
void MainFrame::OnClose(wxCloseEvent &WXUNUSED(event))
@ -146,6 +149,26 @@ void MainFrame::OnQuit(wxCommandEvent &WXUNUSED(event))
Destroy();
}
void MainFrame::OnEditCut(wxCommandEvent &WXUNUSED(event))
{
notebook->GetCurrentEditor()->Cut();
}
void MainFrame::OnEditCopy(wxCommandEvent &WXUNUSED(event))
{
notebook->GetCurrentEditor()->Copy();
}
void MainFrame::OnEditPaste(wxCommandEvent &WXUNUSED(event))
{
notebook->GetCurrentEditor()->Paste();
}
void MainFrame::OnEditSelectAll(wxCommandEvent &WXUNUSED(event))
{
notebook->GetCurrentEditor()->SelectAll();
}
void MainFrame::OnAbout(wxCommandEvent &WXUNUSED(event))
{
wxMessageBox(_T("Tyro, a text editor for all development\n Copyright 2015, Timothy J. Warren"), wxT("About Tyro"), wxOK| wxICON_INFORMATION, this);

View File

@ -27,6 +27,10 @@ class MainFrame: public wxFrame
void SetupStatusBar();
void BindEvents();
void OnNew(wxCommandEvent &event);
void OnEditCut(wxCommandEvent &event);
void OnEditCopy(wxCommandEvent &event);
void OnEditPaste(wxCommandEvent &event);
void OnEditSelectAll(wxCommandEvent &event);
void OnClose(wxCloseEvent &event);
void OnQuit(wxCommandEvent &event);
void OnAbout(wxCommandEvent &event);

View File

@ -39,9 +39,7 @@ void TabContainer::AddTab(wxString filePath)
this->AddPage(editor, caption);
}
void TabContainer::OnEditSelectAll(wxCommandEvent &WXUNUSED(event))
EditPane *TabContainer::GetCurrentEditor()
{
cout << "Edit select all event called.";
//EditPane *editor = (EditPane *) this->GetCurrentPage();
//editor->SelectAll();
return (EditPane *) this->GetCurrentPage();
}

View File

@ -28,7 +28,7 @@ public:
void AddTab();
void AddTab(wxString filePath);
void OnEditSelectAll(wxCommandEvent &event);
EditPane *GetCurrentEditor();
private:
};