More menus, about dialog, and tabs replace spaces

This commit is contained in:
Timothy Warren 2015-03-31 22:52:12 -04:00
parent 794e660b03
commit d8b673934b
4 changed files with 96 additions and 103 deletions

View File

@ -20,6 +20,7 @@ bool TyroApp::OnInit()
{ {
TyroFrame* frame = new TyroFrame(0L, _("Tyro")); TyroFrame* frame = new TyroFrame(0L, _("Tyro"));
frame->CenterOnScreen();
frame->Show(true); frame->Show(true);
SetTopWindow(frame); SetTopWindow(frame);

View File

@ -13,33 +13,6 @@
#include "TyroMain.h" #include "TyroMain.h"
//helper functions
enum wxbuildinfoformat {
short_f, long_f };
wxString wxbuildinfo(wxbuildinfoformat format)
{
wxString wxbuild(wxVERSION_STRING);
if (format == long_f )
{
#if defined(__WXMSW__)
wxbuild << _T("-Windows");
#elif defined(__WXMAC__)
wxbuild << _T("-Mac");
#elif defined(__UNIX__)
wxbuild << _T("-Linux");
#endif
#if wxUSE_UNICODE
wxbuild << _T("-Unicode build");
#else
wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
}
return wxbuild;
}
BEGIN_EVENT_TABLE(TyroFrame, wxFrame) BEGIN_EVENT_TABLE(TyroFrame, wxFrame)
EVT_CLOSE(TyroFrame::OnClose) EVT_CLOSE(TyroFrame::OnClose)
@ -59,12 +32,22 @@ TyroFrame::TyroFrame(wxFrame *frame, const wxString& title)
wxMenu* helpMenu = new wxMenu(_T("")); wxMenu* helpMenu = new wxMenu(_T(""));
// Add items to top-level menus // Add items to top-level menus
fileMenu->Append(wxID_OPEN, _T("&Open"), _T("Opens an existing file")); fileMenu->Append(wxID_NEW, _T("&New\tCtrl+N"), _T("Create a new file"));
fileMenu->Append(wxID_SAVE, _T("&Save"), _T("Save the content"));
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append(wxID_EXIT, _("&Quit"), _("Quit the application")); fileMenu->Append(wxID_OPEN, _T("&Open\tCtrl+0"), _T("Opens an existing file"));
fileMenu->Append(wxID_CLOSE, _T("&Close\tCtrl+W"), _T("Close the current document"));
fileMenu->Append(wxID_SAVE, _T("&Save\tCtrl+S"), _T("Save the content"));
fileMenu->AppendSeparator();
fileMenu->Append(wxID_EXIT, _T("&Quit\tCtrl+Q"), _T("Quit the application"));
helpMenu->Append(wxID_ABOUT, _("&About"), _("Show info about this application")); editMenu->Append(wxID_UNDO, _T("&Undo\tCtrl+Z"), _T("Undo last action"));
editMenu->Append(wxID_REDO, _T("&Redo\tCtrl+Y"), _T("Redo last action"));
editMenu->AppendSeparator();
editMenu->Append(wxID_CUT, _T("Cu&t\tCtrl+X"), _T("Cut selected text"));
editMenu->Append(wxID_COPY, _T("&Copy\tCtrl+C"), _T("Copy selected text"));
editMenu->Append(wxID_PASTE, _T("&Paste\tCtrl+V"), _T("Paste contents of clipboard"));
helpMenu->Append(wxID_ABOUT, _T("&About...\tF1"), _T("Show info about this application"));
// Add the menus to the menubar // Add the menus to the menubar
mbar->Append(fileMenu, _("&File")); mbar->Append(fileMenu, _("&File"));
@ -79,7 +62,7 @@ SetMenuBar(mbar);
// create a status bar with some information about the used wxWidgets version // create a status bar with some information about the used wxWidgets version
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(_(""), 0); SetStatusText(_(""), 0);
SetStatusText(wxbuildinfo(short_f), 1); SetStatusText(_(""), 1);
// Set up control layout // Set up control layout
wxBoxSizer *base_sizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *base_sizer = new wxBoxSizer(wxVERTICAL);
@ -114,6 +97,15 @@ void TyroFrame::OnClose(wxCloseEvent &event)
Destroy(); Destroy();
} }
void TyroFrame::OnMenuFileOpen(wxCommandEvent &event)
{
}
void TyroFrame::OnMenuFileSave(wxCommandEvent &event)
{
}
void TyroFrame::OnQuit(wxCommandEvent &event) void TyroFrame::OnQuit(wxCommandEvent &event)
{ {
Destroy(); Destroy();
@ -121,6 +113,5 @@ void TyroFrame::OnQuit(wxCommandEvent &event)
void TyroFrame::OnAbout(wxCommandEvent &event) void TyroFrame::OnAbout(wxCommandEvent &event)
{ {
wxString msg = wxbuildinfo(long_f); wxMessageBox(_T("Tyro, a text editor for all development\n Copyright 2015, Timothy J. Warren"), wxT("About Tyro"), wxOK| wxICON_INFORMATION, this);
wxMessageBox(msg, _("Welcome to..."));
} }

View File

@ -27,7 +27,8 @@ class TyroFrame: public wxFrame
idMenuQuit = 1000, idMenuQuit = 1000,
idMenuAbout idMenuAbout
}; };
wxAuiManager m_mgr; void OnMenuFileOpen(wxCommandEvent &event);
void OnMenuFileSave(wxCommandEvent &event);
void OnClose(wxCloseEvent &event); void OnClose(wxCloseEvent &event);
void OnQuit(wxCommandEvent &event); void OnQuit(wxCommandEvent &event);
void OnAbout(wxCommandEvent &event); void OnAbout(wxCommandEvent &event);