IMPLEMENT_APP(MyApp)
-// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit()
{
if ( !wxApp::OnInit() )
return false;
// Create the main frame window
- SetTopWindow(new MyFrame(NULL, wxT("wxWidgets OpenGL Isosurf Sample")));
+ MyFrame *frame = new MyFrame(NULL, wxT("wxWidgets OpenGL Isosurf Sample"));
return true;
}
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
END_EVENT_TABLE()
-// My frame constructor
MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
- const wxSize& size, long style)
+ const wxSize& size, long style)
: wxFrame(frame, wxID_ANY, title, pos, size, style),
m_canvas(NULL)
{
// Make a menubar
wxMenu *fileMenu = new wxMenu;
- fileMenu->Append(wxID_EXIT, _T("E&xit"));
+ fileMenu->Append(wxID_EXIT, wxT("E&xit"));
wxMenuBar *menuBar = new wxMenuBar;
- menuBar->Append(fileMenu, _T("&File"));
+ menuBar->Append(fileMenu, wxT("&File"));
SetMenuBar(menuBar);
delete stream;
- wxLogMessage(_T("Loaded %d vertices, %d triangles from '%s'"),
+ wxLogMessage(wxT("Loaded %d vertices, %d triangles from '%s'"),
m_numverts, m_numverts-2, filename.c_str());
+
+ // NOTE: for some reason under wxGTK the following is required to avoid that
+ // the surface gets rendered in a small rectangle in the top-left corner of the frame
+ PostSizeEventToParent();
}
void TestGLCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) )
// (for key events).
event.Skip();
- if(event.LeftIsDown())
+ if (event.LeftIsDown())
{
- if(!dragging)
+ if (!dragging)
{
dragging = 1;
}