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>
|
2015-05-12 16:30:22 -04:00
|
|
|
|
2015-04-22 10:09:43 -04:00
|
|
|
|
2015-05-07 17:05:27 -04:00
|
|
|
// Some global stuff
|
2015-05-12 16:30:22 -04:00
|
|
|
wxConfigBase *Glob_config;
|
|
|
|
TyroMenu *Glob_menu_bar;
|
|
|
|
MainFrame *Glob_main_frame;
|
2015-05-07 17:05:27 -04:00
|
|
|
|
2015-04-23 16:40:59 -04:00
|
|
|
/**
|
2015-05-12 14:09:40 -04:00
|
|
|
* Class with main method
|
2015-04-23 16:40:59 -04:00
|
|
|
*/
|
2015-05-12 14:09:40 -04:00
|
|
|
class TyroApp : public wxApp
|
2015-03-30 14:50:10 -04:00
|
|
|
{
|
2015-05-12 14:09:40 -04:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Start the event loop and create the main window
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
bool OnInit()
|
|
|
|
{
|
|
|
|
this->SetAppName(APP_NAME);
|
|
|
|
this->SetVendorName(APP_VENDOR);
|
|
|
|
|
2015-05-12 16:30:22 -04:00
|
|
|
// Initialize globals
|
|
|
|
Glob_config = wxConfigBase::Get();
|
|
|
|
Glob_menu_bar = new TyroMenu();
|
|
|
|
Glob_main_frame = new MainFrame(0L, APP_NAME);
|
2015-05-12 14:09:40 -04:00
|
|
|
|
2015-05-12 16:30:22 -04:00
|
|
|
SetTopWindow(Glob_main_frame);
|
2015-05-12 14:09:40 -04:00
|
|
|
|
2015-05-12 16:30:22 -04:00
|
|
|
// Setup Main Window
|
|
|
|
Glob_main_frame->Layout();
|
|
|
|
Glob_main_frame->CenterOnScreen();
|
|
|
|
Glob_main_frame->Show(true);
|
2015-05-12 14:09:40 -04:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-04-16 17:03:27 -04:00
|
|
|
|
2015-05-12 14:09:40 -04:00
|
|
|
/**
|
|
|
|
* Exit handler
|
|
|
|
*
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
int OnExit()
|
|
|
|
{
|
|
|
|
// Deallocate config object
|
|
|
|
delete wxConfigBase::Set((wxConfigBase *) NULL);
|
|
|
|
|
|
|
|
return close(true);
|
|
|
|
}
|
|
|
|
};
|
2015-03-30 16:01:24 -04:00
|
|
|
|
2015-05-12 14:09:40 -04:00
|
|
|
IMPLEMENT_APP(TyroApp);
|