ScrollTo(topLineNew);
}
-
-void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown) {
+void ScintillaWX::DoMouseWheel(int rotation, int delta,
+ int linesPerAction, int ctrlDown,
+ bool isPageScroll ) {
int topLineNew = topLine;
int lines;
lines = wheelRotation / delta;
wheelRotation -= lines * delta;
if (lines != 0) {
- lines *= linesPerAction;
+ if (isPageScroll)
+ lines = lines * LinesOnScreen(); // lines is either +1 or -1
+ else
+ lines *= linesPerAction;
topLineNew -= lines;
ScrollTo(topLineNew);
}
void DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
void DoButtonUp(Point pt, unsigned int curTime, bool ctrl);
void DoButtonMove(Point pt);
- void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown);
+ void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown, bool isPageScroll);
void DoAddChar(int key);
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);
void DoTick() { Tick(); }
m_swx->DoMouseWheel(evt.GetWheelRotation(),
evt.GetWheelDelta(),
evt.GetLinesPerAction(),
- evt.ControlDown());
+ evt.ControlDown(),
+ evt.IsPageScroll());
}
m_swx->DoMouseWheel(evt.GetWheelRotation(),
evt.GetWheelDelta(),
evt.GetLinesPerAction(),
- evt.ControlDown());
+ evt.ControlDown(),
+ evt.IsPageScroll());
}
left the window and the state variables for it may have changed during this
time.
-{\bf NB:} Note the difference between methods like
-\helpref{LeftDown}{wxmouseeventleftdown} and
-\helpref{LeftIsDown}{wxmouseeventleftisdown}: the format returns {\tt TRUE}
+{\bf NB:} Note the difference between methods like
+\helpref{LeftDown}{wxmouseeventleftdown} and
+\helpref{LeftIsDown}{wxmouseeventleftisdown}: the format returns {\tt TRUE}
when the event corresponds to the left mouse button click while the latter
returns {\tt TRUE} if the left mouse button is currently being pressed. For
-example, when the user is dragging the mouse you can use
+example, when the user is dragging the mouse you can use
\helpref{LeftIsDown}{wxmouseeventleftisdown} to test
whether the left mouse button is (still) depressed. Also, by convention, if
-\helpref{LeftDown}{wxmouseeventleftdown} returns {\tt TRUE},
+\helpref{LeftDown}{wxmouseeventleftdown} returns {\tt TRUE},
\helpref{LeftIsDown}{wxmouseeventleftisdown} will also return {\tt TRUE} in
wxWindows whatever the underlying GUI behaviour is (which is
platform-dependent). The same applies, of course, to other mouse buttons as
Returns TRUE if the event was a mouse button event (not necessarily a button down event -
that may be tested using {\it ButtonDown}).
+\membersection{wxMouseEvent::IsPageScroll}
+
+\constfunc{bool}{IsPageScroll}{\void}
+
+Returns TRUE if the system has been setup to do page scrolling with
+the mouse wheel instead of line scrolling.
+
\membersection{wxMouseEvent::Leaving}\label{wxmouseeventleaving}
\constfunc{bool}{Leaving}{\void}
// wheel action. Defaults to one.
int GetLinesPerAction() const { return m_linesPerAction; }
+ // Is the system set to do page scrolling?
+ bool IsPageScroll() const { return m_linesPerAction == UINT_MAX; }
+
virtual wxEvent *Clone() const { return new wxMouseEvent(*this); }
public:
m_checked =
m_enabled =
m_setEnabled =
- m_setText =
+ m_setText =
m_setChecked = FALSE;
}
wxUpdateUIEvent(const wxUpdateUIEvent & event)
#if wxUSE_MOUSEWHEEL
-#ifndef WHEEL_PAGESCROLL
-#define WHEEL_PAGESCROLL (UINT_MAX) // signifies to scroll a page
-#endif
-
void wxScrollHelper::HandleOnMouseWheel(wxMouseEvent& event)
{
m_wheelRotation += event.GetWheelRotation();
newEvent.SetOrientation(wxVERTICAL);
newEvent.m_eventObject = m_win;
- if (event.GetLinesPerAction() == WHEEL_PAGESCROLL)
+ if (event.IsPageScroll())
{
if (lines > 0)
newEvent.m_eventType = wxEVT_SCROLLWIN_PAGEUP;
ScrollTo(topLineNew);
}
-
-void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown) {
+void ScintillaWX::DoMouseWheel(int rotation, int delta,
+ int linesPerAction, int ctrlDown,
+ bool isPageScroll ) {
int topLineNew = topLine;
int lines;
lines = wheelRotation / delta;
wheelRotation -= lines * delta;
if (lines != 0) {
- lines *= linesPerAction;
+ if (isPageScroll)
+ lines = lines * LinesOnScreen(); // lines is either +1 or -1
+ else
+ lines *= linesPerAction;
topLineNew -= lines;
ScrollTo(topLineNew);
}
void DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
void DoButtonUp(Point pt, unsigned int curTime, bool ctrl);
void DoButtonMove(Point pt);
- void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown);
+ void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown, bool isPageScroll);
void DoAddChar(int key);
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);
void DoTick() { Tick(); }
m_swx->DoMouseWheel(evt.GetWheelRotation(),
evt.GetWheelDelta(),
evt.GetLinesPerAction(),
- evt.ControlDown());
+ evt.ControlDown(),
+ evt.IsPageScroll());
}
m_swx->DoMouseWheel(evt.GetWheelRotation(),
evt.GetWheelDelta(),
evt.GetLinesPerAction(),
- evt.ControlDown());
+ evt.ControlDown(),
+ evt.IsPageScroll());
}