Restructure for GUI using wxWidgets
This commit is contained in:
parent
d6767c8a8f
commit
85ea90d028
6 changed files with 248 additions and 126 deletions
59
gui.cpp
Normal file
59
gui.cpp
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#include "gui.h"
|
||||
#include "imuread.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
|
||||
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
||||
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
MyFrame::MyFrame(wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
const wxPoint &position, const wxSize& size, long style) :
|
||||
wxFrame( parent, id, title, position, size, style )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent &event)
|
||||
{
|
||||
wxMessageDialog dialog(this,
|
||||
"IMU Read\n\n\nCopyright 2016, PJRC.COM, LLC.",
|
||||
"About IMUREAD", wxOK|wxICON_INFORMATION);
|
||||
dialog.ShowModal();
|
||||
}
|
||||
|
||||
void MyFrame::OnQuit( wxCommandEvent &event )
|
||||
{
|
||||
Close(true);
|
||||
}
|
||||
|
||||
MyFrame::~MyFrame(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
MyApp::MyApp()
|
||||
{
|
||||
}
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
// make sure we exit properly on macosx
|
||||
SetExitOnFrameDelete(true);
|
||||
|
||||
wxPoint pos(100, 100);
|
||||
|
||||
MyFrame *frame = new MyFrame(NULL, -1, wxT("Teensy"), pos, wxDefaultSize,
|
||||
wxDEFAULT_FRAME_STYLE & ~(wxMAXIMIZE_BOX | wxRESIZE_BORDER));
|
||||
frame->Show( true );
|
||||
return true;
|
||||
}
|
||||
|
||||
int MyApp::OnExit()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue