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"));
frame->CenterOnScreen();
frame->Show(true);
SetTopWindow(frame);

View File

@ -13,33 +13,6 @@
#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)
EVT_CLOSE(TyroFrame::OnClose)
@ -59,12 +32,22 @@ TyroFrame::TyroFrame(wxFrame *frame, const wxString& title)
wxMenu* helpMenu = new wxMenu(_T(""));
// Add items to top-level menus
fileMenu->Append(wxID_OPEN, _T("&Open"), _T("Opens an existing file"));
fileMenu->Append(wxID_SAVE, _T("&Save"), _T("Save the content"));
fileMenu->Append(wxID_NEW, _T("&New\tCtrl+N"), _T("Create a new file"));
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
mbar->Append(fileMenu, _("&File"));
@ -78,8 +61,8 @@ SetMenuBar(mbar);
// create a status bar with some information about the used wxWidgets version
CreateStatusBar(2);
SetStatusText(_(""),0);
SetStatusText(wxbuildinfo(short_f), 1);
SetStatusText(_(""), 0);
SetStatusText(_(""), 1);
// Set up control layout
wxBoxSizer *base_sizer = new wxBoxSizer(wxVERTICAL);
@ -114,6 +97,15 @@ void TyroFrame::OnClose(wxCloseEvent &event)
Destroy();
}
void TyroFrame::OnMenuFileOpen(wxCommandEvent &event)
{
}
void TyroFrame::OnMenuFileSave(wxCommandEvent &event)
{
}
void TyroFrame::OnQuit(wxCommandEvent &event)
{
Destroy();
@ -121,6 +113,5 @@ void TyroFrame::OnQuit(wxCommandEvent &event)
void TyroFrame::OnAbout(wxCommandEvent &event)
{
wxString msg = wxbuildinfo(long_f);
wxMessageBox(msg, _("Welcome to..."));
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,10 +27,11 @@ class TyroFrame: public wxFrame
idMenuQuit = 1000,
idMenuAbout
};
wxAuiManager m_mgr;
void OnClose(wxCloseEvent& event);
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnMenuFileOpen(wxCommandEvent &event);
void OnMenuFileSave(wxCommandEvent &event);
void OnClose(wxCloseEvent &event);
void OnQuit(wxCommandEvent &event);
void OnAbout(wxCommandEvent &event);
wxAuiNotebook* CreateNotebook();
DECLARE_EVENT_TABLE()
};