2015-04-23 16:40:59 -04:00
|
|
|
/**
|
|
|
|
* Main application file
|
|
|
|
*/
|
2015-03-30 14:50:10 -04:00
|
|
|
|
2015-04-22 10:09:43 -04:00
|
|
|
#include "wx_common.h"
|
2015-05-08 16:01:36 -04:00
|
|
|
#include "widgets/widget.h"
|
2015-04-22 10:09:43 -04:00
|
|
|
|
|
|
|
#include <wx/app.h>
|
|
|
|
#include <wx/debug.h>
|
|
|
|
|
|
|
|
class TyroApp : public wxApp
|
|
|
|
{
|
|
|
|
friend class MainFrame;
|
|
|
|
public:
|
|
|
|
virtual bool OnInit();
|
|
|
|
virtual int OnExit();
|
|
|
|
private:
|
|
|
|
};
|
|
|
|
|
|
|
|
//**************************************************************
|
2015-03-30 14:50:10 -04:00
|
|
|
|
|
|
|
IMPLEMENT_APP(TyroApp);
|
|
|
|
|
2015-05-07 17:05:27 -04:00
|
|
|
// Some global stuff
|
2015-05-08 16:01:36 -04:00
|
|
|
wxConfigBase *Config;
|
2015-05-07 17:05:27 -04:00
|
|
|
TyroMenu *mbar;
|
|
|
|
MainFrame *main_frame;
|
|
|
|
|
2015-04-23 16:40:59 -04:00
|
|
|
/**
|
|
|
|
* Start the event loop and create the main window
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
2015-03-30 14:50:10 -04:00
|
|
|
bool TyroApp::OnInit()
|
|
|
|
{
|
2015-04-16 17:03:27 -04:00
|
|
|
this->SetAppName(APP_NAME);
|
|
|
|
this->SetVendorName(APP_VENDOR);
|
|
|
|
|
2015-04-28 16:14:04 -04:00
|
|
|
Config = wxConfigBase::Get();
|
2015-05-07 17:05:27 -04:00
|
|
|
mbar = new TyroMenu();
|
|
|
|
main_frame = new MainFrame(0L, APP_NAME);
|
2015-03-30 14:50:10 -04:00
|
|
|
|
2015-05-07 17:05:27 -04:00
|
|
|
SetTopWindow(main_frame);
|
2015-04-16 17:03:27 -04:00
|
|
|
|
2015-05-07 17:05:27 -04:00
|
|
|
main_frame->Layout();
|
|
|
|
main_frame->CenterOnScreen();
|
|
|
|
main_frame->Show(true);
|
2015-03-30 14:50:10 -04:00
|
|
|
|
2015-03-31 22:52:12 -04:00
|
|
|
return true;
|
2015-03-30 14:50:10 -04:00
|
|
|
}
|
2015-03-30 16:01:24 -04:00
|
|
|
|
2015-04-23 16:40:59 -04:00
|
|
|
/**
|
|
|
|
* Exit handler
|
|
|
|
*
|
|
|
|
* @return int
|
|
|
|
*/
|
2015-04-02 18:00:50 -04:00
|
|
|
int TyroApp::OnExit()
|
2015-03-30 16:01:24 -04:00
|
|
|
{
|
2015-04-28 16:14:04 -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
|
|
|
}
|