Tyro/src/TyroApp.cpp

62 lines
923 B
C++
Raw Normal View History

/**
* Main application file
*/
2015-03-30 14:50:10 -04:00
2015-04-22 10:09:43 -04:00
#include "wx_common.h"
#include <wx/app.h>
#include <wx/config.h>
2015-04-22 10:09:43 -04:00
#include <wx/debug.h>
class TyroApp : public wxApp
{
friend class MainFrame;
public:
virtual bool OnInit();
virtual int OnExit();
private:
};
wxConfigBase *Config;
2015-04-22 10:09:43 -04:00
//**************************************************************
#include "widgets/MainFrame.h"
2015-03-30 14:50:10 -04:00
IMPLEMENT_APP(TyroApp);
/**
* Start the event loop and create the main window
*
* @return bool
*/
2015-03-30 14:50:10 -04:00
bool TyroApp::OnInit()
{
this->SetAppName(APP_NAME);
this->SetVendorName(APP_VENDOR);
Config = wxConfigBase::Get();
2015-04-22 10:09:43 -04:00
MainFrame* frame = new MainFrame(0L, APP_NAME);
2015-03-30 14:50:10 -04:00
SetTopWindow(frame);
2015-04-09 11:45:19 -04:00
frame->Layout();
frame->CenterOnScreen();
frame->Show(true);
2015-03-30 14:50:10 -04:00
return true;
2015-03-30 14:50:10 -04:00
}
2015-03-30 16:01:24 -04:00
/**
* Exit handler
*
* @return int
*/
int TyroApp::OnExit()
2015-03-30 16:01:24 -04:00
{
// Deallocate config object
delete wxConfigBase::Set((wxConfigBase *) NULL);
2015-04-20 16:35:51 -04:00
return close(true);
2015-03-30 16:01:24 -04:00
}