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

Method notifyMouseWheel

MyGUIEngine/src/MyGUI_ComboBox.cpp:184–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182 }
183
184 void ComboBox::notifyMouseWheel(Widget* _sender, int _rel)
185 {
186 if (mList->getItemCount() == 0)
187 return;
188 if (InputManager::getInstance().getKeyFocusWidget() != this)
189 return;
190 if (InputManager::getInstance().isCaptureMouse())
191 return;
192
193 if (_rel > 0)
194 {
195 if (mItemIndex != 0)
196 {
197 if (mItemIndex == ITEM_NONE)
198 mItemIndex = 0;
199 else
200 mItemIndex--;
201 Base::setCaption(mList->getItemNameAt(mItemIndex));
202 mList->setIndexSelected(mItemIndex);
203 mList->beginToItemAt(mItemIndex);
204
205 _resetContainer(false);
206
207 eventComboChangePosition(this, mItemIndex);
208 }
209 }
210 else if (_rel < 0)
211 {
212 if ((mItemIndex + 1) < mList->getItemCount())
213 {
214 if (mItemIndex == ITEM_NONE)
215 mItemIndex = 0;
216 else
217 mItemIndex++;
218 Base::setCaption(mList->getItemNameAt(mItemIndex));
219 mList->setIndexSelected(mItemIndex);
220 mList->beginToItemAt(mItemIndex);
221
222 _resetContainer(false);
223
224 eventComboChangePosition(this, mItemIndex);
225 }
226 }
227 }
228
229 void ComboBox::notifyMousePressed(Widget* _sender, int _left, int _top, MouseButton _id)
230 {

Callers

nothing calls this directly

Calls 6

setCaptionFunction · 0.85
getKeyFocusWidgetMethod · 0.80
isCaptureMouseMethod · 0.80
getItemCountMethod · 0.45
setIndexSelectedMethod · 0.45
beginToItemAtMethod · 0.45

Tested by

no test coverage detected