MCPcopy Create free account
hub / github.com/MyGUI/mygui / notifyMouseWheel

Method notifyMouseWheel

MyGUIEngine/src/MyGUI_ScrollView.cpp:104–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102 }
103
104 void ScrollView::notifyMouseWheel(Widget* _sender, int _rel)
105 {
106 if (mVRange != 0)
107 {
108 IntPoint point = getClientWidget()->getPosition();
109 int offset = -point.top;
110 if (_rel < 0)
111 offset += SCROLL_VIEW_MOUSE_WHEEL;
112 else
113 offset -= SCROLL_VIEW_MOUSE_WHEEL;
114
115 if (offset < 0)
116 offset = 0;
117 else if (offset > (int)mVRange)
118 offset = mVRange;
119
120 if (offset != point.top)
121 {
122 point.top = -offset;
123 if (mVScroll != nullptr)
124 {
125 mVScroll->setScrollPosition(offset);
126 }
127 getClientWidget()->setPosition(point);
128 }
129 }
130 else if (mHRange != 0)
131 {
132 IntPoint point = getClientWidget()->getPosition();
133 int offset = -point.left;
134 if (_rel < 0)
135 offset += SCROLL_VIEW_MOUSE_WHEEL;
136 else
137 offset -= SCROLL_VIEW_MOUSE_WHEEL;
138
139 if (offset < 0)
140 offset = 0;
141 else if (offset > (int)mHRange)
142 offset = mHRange;
143
144 if (offset != point.left)
145 {
146 point.left = -offset;
147 if (mHScroll != nullptr)
148 {
149 mHScroll->setScrollPosition(offset);
150 }
151 getClientWidget()->setPosition(point);
152 }
153 }
154 }
155
156 IntSize ScrollView::getContentSize() const
157 {

Callers

nothing calls this directly

Calls 3

getPositionMethod · 0.45
setScrollPositionMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected