Some basic groundwork changes

This commit is contained in:
Tim Warren 2015-03-30 16:01:24 -04:00
parent facb4f69f1
commit 7ee0143418
5 changed files with 73 additions and 13 deletions

View File

@ -20,7 +20,13 @@ bool TyroApp::OnInit()
{ {
TyroFrame* frame = new TyroFrame(0L, _("wxWidgets Application Template")); TyroFrame* frame = new TyroFrame(0L, _("wxWidgets Application Template"));
frame->Show(); frame->Show(true);
return true; return true;
} }
int TyroApp::OnExit(wxCommandEvent &WXUNUSED(event))
{
close(true);
return 1;
}

View File

@ -14,8 +14,10 @@
class TyroApp : public wxApp class TyroApp : public wxApp
{ {
friend class TyroFrame;
public: public:
virtual bool OnInit(); virtual bool OnInit();
virtual int OnExit(wxCommandEvent &WXUNUSED(event));
}; };
#endif // TYROAPP_H #endif // TYROAPP_H

52
TyroMac.cbp Normal file
View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Tyro" />
<Option pch_mode="2" />
<Option compiler="clang" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/Tyro" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-Wextra" />
<Add option="-g" />
<Add option="-mmacosx-version-min=10.5 -I/usr/local/lib/wx/include/osx_cocoa-unicode-static-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__" />
</Compiler>
<Linker>
<Add option="-L/usr/local/lib -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL /usr/local/lib/libwx_osx_cocoau_xrc-3.0.a /usr/local/lib/libwx_osx_cocoau_qa-3.0.a /usr/local/lib/libwx_baseu_net-3.0.a /usr/local/lib/libwx_osx_cocoau_html-3.0.a /usr/local/lib/libwx_osx_cocoau_adv-3.0.a /usr/local/lib/libwx_osx_cocoau_core-3.0.a /usr/local/lib/libwx_baseu_xml-3.0.a /usr/local/lib/libwx_baseu-3.0.a -lpng -ljpeg -ltiff -framework WebKit -lexpat -lwxregexu-3.0 -lz -lpthread -liconv" />
</Linker>
</Target>
<Target title="Release">
<Option output="bin/Release/Tyro" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="0" />
<Option compiler="gcc" />
<Option projectLinkerOptionsRelation="2" />
<Compiler>
<Add option="-Os" />
</Compiler>
</Target>
</Build>
<Compiler>
<Add option="`wx-config --cflags`" />
</Compiler>
<Linker>
<Add option="`wx-config --libs`" />
</Linker>
<Unit filename="TyroApp.cpp" />
<Unit filename="TyroApp.h" />
<Unit filename="TyroMain.cpp" />
<Unit filename="TyroMain.h" />
<Extensions>
<code_completion>
<search_path add="/usr/local/lib" />
</code_completion>
<debugger />
<envvars />
</Extensions>
</Project>
</CodeBlocks_project_file>

View File

@ -43,34 +43,33 @@ wxString wxbuildinfo(wxbuildinfoformat format)
BEGIN_EVENT_TABLE(TyroFrame, wxFrame) BEGIN_EVENT_TABLE(TyroFrame, wxFrame)
EVT_CLOSE(TyroFrame::OnClose) EVT_CLOSE(TyroFrame::OnClose)
EVT_MENU(idMenuQuit, TyroFrame::OnQuit) EVT_MENU(wxID_EXIT, TyroFrame::OnQuit)
EVT_MENU(idMenuAbout, TyroFrame::OnAbout) EVT_MENU(wxID_ABOUT, TyroFrame::OnAbout)
END_EVENT_TABLE() END_EVENT_TABLE()
TyroFrame::TyroFrame(wxFrame *frame, const wxString& title) TyroFrame::TyroFrame(wxFrame *frame, const wxString& title)
: wxFrame(frame, -1, title) : wxFrame(frame, -1, title)
{ {
#if wxUSE_MENUS // create a menu bar
// create a menu bar
wxMenuBar* mbar = new wxMenuBar(); wxMenuBar* mbar = new wxMenuBar();
wxMenu* fileMenu = new wxMenu(_T("")); wxMenu* fileMenu = new wxMenu(_T(""));
fileMenu->Append(idMenuQuit, _("&Quit\tAlt-F4"), _("Quit the application"));
fileMenu->Append(wxID_EXIT, _("&Quit\tAlt-F4"), _("Quit the application"));
mbar->Append(fileMenu, _("&File")); mbar->Append(fileMenu, _("&File"));
wxMenu* helpMenu = new wxMenu(_T("")); wxMenu* helpMenu = new wxMenu(_T(""));
helpMenu->Append(idMenuAbout, _("&About\tF1"), _("Show info about this application")); helpMenu->Append(wxID_ABOUT, _("&About\tF1"), _("Show info about this application"));
mbar->Append(helpMenu, _("&Help")); mbar->Append(helpMenu, _("&Help"));
SetMenuBar(mbar); #ifdef __WXMAC__
#endif // wxUSE_MENUS wxMenuBar::MacSetCommonMenuBar(mbar);
#endif // __WXMAC__
SetMenuBar(mbar);
#if wxUSE_STATUSBAR
// 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(_("Hello Code::Blocks user!"),0); SetStatusText(_(""),0);
SetStatusText(wxbuildinfo(short_f), 1); SetStatusText(wxbuildinfo(short_f), 1);
#endif // wxUSE_STATUSBAR
} }

View File

@ -14,6 +14,7 @@
#include <wx/wx.h> #include <wx/wx.h>
#endif #endif
#include <wx/string.h>
#include "TyroApp.h" #include "TyroApp.h"
class TyroFrame: public wxFrame class TyroFrame: public wxFrame