X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce38e440a6790c5e77306b0bb880cf7288f6bb6a..ca77701441e39245dcbfce903049e76f166979e5:/include/wx/scrolwin.h diff --git a/include/wx/scrolwin.h b/include/wx/scrolwin.h index 1b41c43d9b..89f0953362 100644 --- a/include/wx/scrolwin.h +++ b/include/wx/scrolwin.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/scrolwin.h +// Name: wx/scrolwin.h // Purpose: wxScrolledWindow, wxScrolledControl and wxScrollHelper // Author: Vadim Zeitlin // Modified by: @@ -108,6 +108,17 @@ public: // actually scroll a non-constant distance virtual void EnableScrolling(bool x_scrolling, bool y_scrolling); + // Disable use of keyboard keys for scrolling. By default cursor movement + // keys (including Home, End, Page Up and Down) are used to scroll the + // window appropriately. If the derived class uses these keys for something + // else, e.g. changing the currently selected item, this function can be + // used to disable this behaviour as it's not only not necessary then but + // can actually be actively harmful if another object forwards a keyboard + // event corresponding to one of the above keys to us using + // ProcessWindowEvent() because the event will always be processed which + // can be undesirable. + void DisableKeyboardScrolling() { m_kbdScrollingEnabled = false; } + // Get the view start void GetViewStart(int *x, int *y) const { DoGetViewStart(x, y); } @@ -241,10 +252,6 @@ protected: // delete the event handler we installed void DeleteEvtHandler(); - // calls wxScrollHelperEvtHandler::ResetDrawnFlag(), see explanation - // in wxScrollHelperEvtHandler::ProcessEvent() - void ResetDrawnFlag(); - // this function should be overridden to return the size available for // m_targetWindow inside m_win of the given size // @@ -284,6 +291,8 @@ protected: bool m_xScrollingEnabled; bool m_yScrollingEnabled; + bool m_kbdScrollingEnabled; + #if wxUSE_MOUSEWHEEL int m_wheelRotation; #endif // wxUSE_MOUSEWHEEL @@ -363,15 +372,23 @@ public: this->MacSetClipChildren(true); #endif - 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; +#ifdef __WXOSX__ + bool retval = T::Create(parent, winid, pos, size, style, name); + if ( retval && (style & wxALWAYS_SHOW_SB) ) + ShowScrollbars(wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS); + return retval; +#else + if ( style & wxALWAYS_SHOW_SB ) + ShowScrollbars(wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS); + return T::Create(parent, winid, pos, size, style, name); +#endif } // we need to return a special WM_GETDLGCODE value to process just the @@ -392,16 +409,6 @@ protected: } 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(); - } - // VC++ 6 gives warning for the declaration of template member function // without definition #ifndef __VISUALC6__