From fa05a943e99b4a788ea7ae994e8dc055806a0a91 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 15 Oct 2008 19:39:27 +0000 Subject: [PATCH] implement GetSizeAvailableForScrollTarget() in MyScrolledWindow git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56347 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/scrollsub/scrollsub.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/samples/scrollsub/scrollsub.cpp b/samples/scrollsub/scrollsub.cpp index 0799ec5aa6..d1f400d426 100644 --- a/samples/scrollsub/scrollsub.cpp +++ b/samples/scrollsub/scrollsub.cpp @@ -36,11 +36,15 @@ class MyApp; 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; @@ -177,6 +181,16 @@ MyScrolledWindow::MyScrolledWindow( wxWindow *parent, wxWindowID id, 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 -- 2.45.2