+ this->Connect(wxEVT_PAINT, wxPaintEventHandler(wxScrolled::OnPaint));
+
+ // by default, we're scrollable in both directions (but if one of the
+ // styles is specified explicitly, we shouldn't add the other one
+ // automatically)
+ if ( !(style & (wxHSCROLL | wxVSCROLL)) )
+ style |= wxHSCROLL | wxVSCROLL;
+
+ return T::Create(parent, winid, pos, size, style, name);
+ }
+
+ // we need to return a special WM_GETDLGCODE value to process just the
+ // arrows but let the other navigation characters through
+#ifdef __WXMSW__
+ virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+ {
+ return FilterMSWWindowProc(nMsg, T::MSWWindowProc(nMsg, wParam, lParam));
+ }
+#endif // __WXMSW__
+
+ WX_FORWARD_TO_SCROLL_HELPER()
+
+protected:
+ virtual wxSize DoGetBestSize() const
+ {
+ return FilterBestSize(this, this, T::DoGetBestSize());
+ }
+
+private:
+ // this is needed for wxEVT_PAINT processing hack described in
+ // wxScrollHelperEvtHandler::ProcessEvent()
+ void OnPaint(wxPaintEvent& event)
+ {
+ // the user code didn't really draw the window if we got here, so set
+ // this flag to try to call OnDraw() later
+ ResetDrawnFlag();
+ event.Skip();
+ }
+
+ DECLARE_NO_COPY_CLASS(wxScrolled)
+};
+
+// VC++ <= 6 requires this; it's unlikely any other specializations would
+// be needed by user code _and_ they were using VC6, so we list only wxWindow
+// (typical use) and wxPanel (wxScrolledWindow use) specializations here
+WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE( wxScrolled<wxPanel> )
+WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE( wxScrolled<wxWindow> )
+
+// for compatibility with existing code, we provide wxScrolledWindow
+// "typedef" for wxScrolled<wxPanel>. It's not a real typedef because we
+// want wxScrolledWindow to show in wxRTTI information (the class is widely
+// used and likelihood of its wxRTTI information being used too is high):
+class WXDLLIMPEXP_CORE wxScrolledWindow : public wxScrolled<wxPanel>
+{
+public:
+ wxScrolledWindow() : wxScrolled<wxPanel>() {}
+ wxScrolledWindow(wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxScrolledWindowStyle,
+ const wxString& name = wxPanelNameStr)
+ : wxScrolled<wxPanel>(parent, winid, pos, size, style, name) {}
+
+ DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow)
+};
+
+typedef wxScrolled<wxWindow> wxScrolledCanvas;
+
+#endif // _WX_SCROLWIN_H_BASE_