Moved the check for page scrolling with the wheel into wxMouseEvent so
it wouldn't have to be duplicated everywhere. Also fixed wxSTC so it can handle wheel page scrolling too. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -467,8 +467,9 @@ void ScintillaWX::DoVScroll(int type, int pos) {
|
|||||||
ScrollTo(topLineNew);
|
ScrollTo(topLineNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScintillaWX::DoMouseWheel(int rotation, int delta,
|
||||||
void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown) {
|
int linesPerAction, int ctrlDown,
|
||||||
|
bool isPageScroll ) {
|
||||||
int topLineNew = topLine;
|
int topLineNew = topLine;
|
||||||
int lines;
|
int lines;
|
||||||
|
|
||||||
@@ -485,7 +486,10 @@ void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction, int
|
|||||||
lines = wheelRotation / delta;
|
lines = wheelRotation / delta;
|
||||||
wheelRotation -= lines * delta;
|
wheelRotation -= lines * delta;
|
||||||
if (lines != 0) {
|
if (lines != 0) {
|
||||||
lines *= linesPerAction;
|
if (isPageScroll)
|
||||||
|
lines = lines * LinesOnScreen(); // lines is either +1 or -1
|
||||||
|
else
|
||||||
|
lines *= linesPerAction;
|
||||||
topLineNew -= lines;
|
topLineNew -= lines;
|
||||||
ScrollTo(topLineNew);
|
ScrollTo(topLineNew);
|
||||||
}
|
}
|
||||||
|
@@ -125,7 +125,7 @@ public:
|
|||||||
void DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
|
void DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
|
||||||
void DoButtonUp(Point pt, unsigned int curTime, bool ctrl);
|
void DoButtonUp(Point pt, unsigned int curTime, bool ctrl);
|
||||||
void DoButtonMove(Point pt);
|
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);
|
void DoAddChar(int key);
|
||||||
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);
|
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);
|
||||||
void DoTick() { Tick(); }
|
void DoTick() { Tick(); }
|
||||||
|
@@ -1912,7 +1912,8 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
|
|||||||
m_swx->DoMouseWheel(evt.GetWheelRotation(),
|
m_swx->DoMouseWheel(evt.GetWheelRotation(),
|
||||||
evt.GetWheelDelta(),
|
evt.GetWheelDelta(),
|
||||||
evt.GetLinesPerAction(),
|
evt.GetLinesPerAction(),
|
||||||
evt.ControlDown());
|
evt.ControlDown(),
|
||||||
|
evt.IsPageScroll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -365,7 +365,8 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
|
|||||||
m_swx->DoMouseWheel(evt.GetWheelRotation(),
|
m_swx->DoMouseWheel(evt.GetWheelRotation(),
|
||||||
evt.GetWheelDelta(),
|
evt.GetWheelDelta(),
|
||||||
evt.GetLinesPerAction(),
|
evt.GetLinesPerAction(),
|
||||||
evt.ControlDown());
|
evt.ControlDown(),
|
||||||
|
evt.IsPageScroll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -291,6 +291,13 @@ Returns Y coordinate of the physical mouse event position.
|
|||||||
Returns TRUE if the event was a mouse button event (not necessarily a button down event -
|
Returns TRUE if the event was a mouse button event (not necessarily a button down event -
|
||||||
that may be tested using {\it ButtonDown}).
|
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}
|
\membersection{wxMouseEvent::Leaving}\label{wxmouseeventleaving}
|
||||||
|
|
||||||
\constfunc{bool}{Leaving}{\void}
|
\constfunc{bool}{Leaving}{\void}
|
||||||
|
@@ -741,6 +741,9 @@ public:
|
|||||||
// wheel action. Defaults to one.
|
// wheel action. Defaults to one.
|
||||||
int GetLinesPerAction() const { return m_linesPerAction; }
|
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); }
|
virtual wxEvent *Clone() const { return new wxMouseEvent(*this); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@@ -1084,10 +1084,6 @@ void wxScrollHelper::HandleOnMouseLeave(wxMouseEvent& event)
|
|||||||
|
|
||||||
#if wxUSE_MOUSEWHEEL
|
#if wxUSE_MOUSEWHEEL
|
||||||
|
|
||||||
#ifndef WHEEL_PAGESCROLL
|
|
||||||
#define WHEEL_PAGESCROLL (UINT_MAX) // signifies to scroll a page
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void wxScrollHelper::HandleOnMouseWheel(wxMouseEvent& event)
|
void wxScrollHelper::HandleOnMouseWheel(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
m_wheelRotation += event.GetWheelRotation();
|
m_wheelRotation += event.GetWheelRotation();
|
||||||
@@ -1103,7 +1099,7 @@ void wxScrollHelper::HandleOnMouseWheel(wxMouseEvent& event)
|
|||||||
newEvent.SetOrientation(wxVERTICAL);
|
newEvent.SetOrientation(wxVERTICAL);
|
||||||
newEvent.m_eventObject = m_win;
|
newEvent.m_eventObject = m_win;
|
||||||
|
|
||||||
if (event.GetLinesPerAction() == WHEEL_PAGESCROLL)
|
if (event.IsPageScroll())
|
||||||
{
|
{
|
||||||
if (lines > 0)
|
if (lines > 0)
|
||||||
newEvent.m_eventType = wxEVT_SCROLLWIN_PAGEUP;
|
newEvent.m_eventType = wxEVT_SCROLLWIN_PAGEUP;
|
||||||
|
@@ -467,8 +467,9 @@ void ScintillaWX::DoVScroll(int type, int pos) {
|
|||||||
ScrollTo(topLineNew);
|
ScrollTo(topLineNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScintillaWX::DoMouseWheel(int rotation, int delta,
|
||||||
void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown) {
|
int linesPerAction, int ctrlDown,
|
||||||
|
bool isPageScroll ) {
|
||||||
int topLineNew = topLine;
|
int topLineNew = topLine;
|
||||||
int lines;
|
int lines;
|
||||||
|
|
||||||
@@ -485,7 +486,10 @@ void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction, int
|
|||||||
lines = wheelRotation / delta;
|
lines = wheelRotation / delta;
|
||||||
wheelRotation -= lines * delta;
|
wheelRotation -= lines * delta;
|
||||||
if (lines != 0) {
|
if (lines != 0) {
|
||||||
lines *= linesPerAction;
|
if (isPageScroll)
|
||||||
|
lines = lines * LinesOnScreen(); // lines is either +1 or -1
|
||||||
|
else
|
||||||
|
lines *= linesPerAction;
|
||||||
topLineNew -= lines;
|
topLineNew -= lines;
|
||||||
ScrollTo(topLineNew);
|
ScrollTo(topLineNew);
|
||||||
}
|
}
|
||||||
|
@@ -125,7 +125,7 @@ public:
|
|||||||
void DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
|
void DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
|
||||||
void DoButtonUp(Point pt, unsigned int curTime, bool ctrl);
|
void DoButtonUp(Point pt, unsigned int curTime, bool ctrl);
|
||||||
void DoButtonMove(Point pt);
|
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);
|
void DoAddChar(int key);
|
||||||
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);
|
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);
|
||||||
void DoTick() { Tick(); }
|
void DoTick() { Tick(); }
|
||||||
|
@@ -1912,7 +1912,8 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
|
|||||||
m_swx->DoMouseWheel(evt.GetWheelRotation(),
|
m_swx->DoMouseWheel(evt.GetWheelRotation(),
|
||||||
evt.GetWheelDelta(),
|
evt.GetWheelDelta(),
|
||||||
evt.GetLinesPerAction(),
|
evt.GetLinesPerAction(),
|
||||||
evt.ControlDown());
|
evt.ControlDown(),
|
||||||
|
evt.IsPageScroll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -365,7 +365,8 @@ void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
|
|||||||
m_swx->DoMouseWheel(evt.GetWheelRotation(),
|
m_swx->DoMouseWheel(evt.GetWheelRotation(),
|
||||||
evt.GetWheelDelta(),
|
evt.GetWheelDelta(),
|
||||||
evt.GetLinesPerAction(),
|
evt.GetLinesPerAction(),
|
||||||
evt.ControlDown());
|
evt.ControlDown(),
|
||||||
|
evt.IsPageScroll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user