diff --git a/Tyro.cbp b/Tyro.cbp
index f3c709e..aa8cd91 100644
--- a/Tyro.cbp
+++ b/Tyro.cbp
@@ -35,8 +35,8 @@
-
-
+
+
diff --git a/src/DocFrame.cpp b/src/DocFrame.cpp
new file mode 100644
index 0000000..891320c
--- /dev/null
+++ b/src/DocFrame.cpp
@@ -0,0 +1,5 @@
+#include "DocFrame.h"
+
+void DocFrame::OnFileChanged(wxStyledTextEvent &event)
+{
+}
\ No newline at end of file
diff --git a/src/DocFrame.h b/src/DocFrame.h
new file mode 100644
index 0000000..a89c74c
--- /dev/null
+++ b/src/DocFrame.h
@@ -0,0 +1,18 @@
+#ifndef TYRODOC_FRAME_H
+#define TYRODOC_FRAME_H
+
+#ifndef WX_PRECOMP
+ #include
+#endif
+
+#include
+
+class DocFrame: public wxFrame
+{
+public:
+private:
+ void OnFileChanged(wxStyledTextEvent &event);
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // TYRODOC_FRAM_H
\ No newline at end of file
diff --git a/src/TyroMain.cpp b/src/Main.cpp
similarity index 85%
rename from src/TyroMain.cpp
rename to src/Main.cpp
index 711604f..00093f4 100644
--- a/src/TyroMain.cpp
+++ b/src/Main.cpp
@@ -1,5 +1,5 @@
/***************************************************************
- * Name: TyroMain.cpp
+ * Name: Main.cpp
* Purpose: Code for Application Frame
* Author: Timothy J Warren (tim@timshomepage.net)
* Created: 2015-03-30
@@ -11,11 +11,13 @@
#include "wx_pch.h"
#endif
-#include "TyroMain.h"
+#include "Main.h"
BEGIN_EVENT_TABLE(TyroFrame, wxFrame)
EVT_CLOSE(TyroFrame::OnClose)
+ EVT_MENU(wxID_OPEN, TyroFrame::OnMenuFileOpen)
+ EVT_MENU(wxID_SAVE, TyroFrame::OnMenuFileSave)
EVT_MENU(wxID_EXIT, TyroFrame::OnQuit)
EVT_MENU(wxID_ABOUT, TyroFrame::OnAbout)
END_EVENT_TABLE()
@@ -23,41 +25,7 @@ END_EVENT_TABLE()
TyroFrame::TyroFrame(wxFrame *frame, const wxString& title)
: wxFrame(frame, -1, title)
{
- // create a menu bar
- wxMenuBar* mbar = new wxMenuBar();
-
- // Create Base menus
- wxMenu* fileMenu = new wxMenu(_T(""));
- wxMenu* editMenu = new wxMenu(_T(""));
- wxMenu* helpMenu = new wxMenu(_T(""));
-
- // Add items to top-level menus
- fileMenu->Append(wxID_NEW, _T("&New\tCtrl+N"), _T("Create a new file"));
- fileMenu->AppendSeparator();
- 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"));
-
- 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"));
- mbar->Append(editMenu, _("&Edit"));
- mbar->Append(helpMenu, _("&Help"));
-
-#ifdef __WXMAC__
- wxMenuBar::MacSetCommonMenuBar(mbar);
-#endif // __WXMAC__
-SetMenuBar(mbar);
+ this->SetupMenu();
// create a status bar with some information about the used wxWidgets version
CreateStatusBar(2);
@@ -83,6 +51,45 @@ SetMenuBar(mbar);
TyroFrame::~TyroFrame() {}
+void TyroFrame::SetupMenu()
+{
+ // create a menu bar
+ wxMenuBar* mbar = new wxMenuBar();
+
+ // Create Base menus
+ wxMenu* fileMenu = new wxMenu(_T(""));
+ wxMenu* editMenu = new wxMenu(_T(""));
+ wxMenu* helpMenu = new wxMenu(_T(""));
+
+ // Add items to top-level menus
+ fileMenu->Append(wxID_NEW, _T("&New\tCtrl+N"), _T("Create a new file"));
+ fileMenu->AppendSeparator();
+ fileMenu->Append(wxID_OPEN, _T("&Open\tCtrl+O"), _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"));
+
+ 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"));
+ mbar->Append(editMenu, _("&Edit"));
+ mbar->Append(helpMenu, _("&Help"));
+
+#ifdef __WXMAC__
+ wxMenuBar::MacSetCommonMenuBar(mbar);
+#endif // __WXMAC__
+ SetMenuBar(mbar);
+}
+
wxAuiNotebook *TyroFrame::CreateNotebook()
{
wxAuiNotebook *ctrl = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_DEFAULT_STYLE);
@@ -99,7 +106,13 @@ void TyroFrame::OnClose(wxCloseEvent &event)
void TyroFrame::OnMenuFileOpen(wxCommandEvent &event)
{
-
+ wxFileDialog *OpenDialog = new wxFileDialog(this, _T("Choose a file"), _(""), _(""), _("*.*"), wxFD_OPEN);
+
+ if (OpenDialog->ShowModal() == wxID_OK)
+ {
+ // Load the file into a new notebook tab and styled text control
+ }
+ OpenDialog->Close();
}
void TyroFrame::OnMenuFileSave(wxCommandEvent &event)
diff --git a/src/TyroMain.h b/src/Main.h
similarity index 84%
rename from src/TyroMain.h
rename to src/Main.h
index 5af386e..39c5c24 100644
--- a/src/TyroMain.h
+++ b/src/Main.h
@@ -1,5 +1,5 @@
/***************************************************************
- * Name: TyroMain.h
+ * Name: Main.h
* Purpose: Defines Application Frame
* Author: Timothy J Warren (tim@timshomepage.net)
* Created: 2015-03-30
@@ -15,6 +15,7 @@
#endif
#include "TyroApp.h"
+#include "DocFrame.h"
class TyroFrame: public wxFrame
{
@@ -27,8 +28,9 @@ class TyroFrame: public wxFrame
idMenuQuit = 1000,
idMenuAbout
};
-void OnMenuFileOpen(wxCommandEvent &event);
-void OnMenuFileSave(wxCommandEvent &event);
+ void SetupMenu();
+ void OnMenuFileOpen(wxCommandEvent &event);
+ void OnMenuFileSave(wxCommandEvent &event);
void OnClose(wxCloseEvent &event);
void OnQuit(wxCommandEvent &event);
void OnAbout(wxCommandEvent &event);
diff --git a/src/TyroApp.cpp b/src/TyroApp.cpp
index 34cb025..2c6d82f 100644
--- a/src/TyroApp.cpp
+++ b/src/TyroApp.cpp
@@ -12,7 +12,7 @@
#endif
#include "TyroApp.h"
-#include "TyroMain.h"
+#include "Main.h"
IMPLEMENT_APP(TyroApp);