class MyScrolledWindow: public wxScrolledWindow
{
public:
- MyScrolledWindow(){};
+ MyScrolledWindow() {}
MyScrolledWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size );
- ~MyScrolledWindow(){};
+
void OnPaint( wxPaintEvent &event );
void OnSize( wxSizeEvent &event );
+
+protected:
+ virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size);
+
private:
MyCanvas *m_canvas;
mainsizer->Add( middlesizer, 1, wxEXPAND );
- SetAutoLayout( true );
SetSizer( mainsizer );
}
+wxSize MyScrolledWindow::GetSizeAvailableForScrollTarget(const wxSize& size)
+{
+ // decrease the total size by the size of the non-scrollable parts above/to
+ // the left of the canvas
+ wxSize sizeCanvas(size);
+ sizeCanvas.x -= 60;
+ sizeCanvas.y -= 25;
+ return sizeCanvas;
+}
+
void MyScrolledWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
{
// We need to override OnSize so that our scrolled
// MyFrame
-const int ID_QUIT = 108;
+const int ID_QUIT = wxID_EXIT;
const int ID_FULL = 109;
-const int ID_ABOUT = 110;
+const int ID_ABOUT = wxID_ABOUT;
IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame )
topsizer->Add( m_log, 0, wxEXPAND );
#endif // wxUSE_LOG
- SetAutoLayout( true );
SetSizer( topsizer );
}
bool MyApp::OnInit()
{
+ if ( !wxApp::OnInit() )
+ return false;
+
wxFrame *frame = new MyFrame();
frame->Show( true );