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

Method notifyMouseWheel

MyGUIEngine/src/MyGUI_EditBox.cpp:1730–1773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1728 }
1729
1730 void EditBox::notifyMouseWheel(Widget* _sender, int _rel)
1731 {
1732 if (mClientText == nullptr)
1733 return;
1734
1735 if (mVRange != 0)
1736 {
1737 IntPoint point = mClientText->getViewOffset();
1738 int offset = point.top;
1739 if (_rel < 0)
1740 offset += EDIT_MOUSE_WHEEL;
1741 else
1742 offset -= EDIT_MOUSE_WHEEL;
1743
1744 offset = std::clamp(offset, 0, int(mVRange));
1745
1746 if (offset != point.top)
1747 {
1748 point.top = offset;
1749 if (mVScroll != nullptr)
1750 mVScroll->setScrollPosition(offset);
1751 mClientText->setViewOffset(point);
1752 }
1753 }
1754 else if (mHRange != 0)
1755 {
1756 IntPoint point = mClientText->getViewOffset();
1757 int offset = point.left;
1758 if (_rel < 0)
1759 offset += EDIT_MOUSE_WHEEL;
1760 else
1761 offset -= EDIT_MOUSE_WHEEL;
1762
1763 offset = std::clamp(offset, 0, int(mHRange));
1764
1765 if (offset != point.left)
1766 {
1767 point.left = offset;
1768 if (mHScroll != nullptr)
1769 mHScroll->setScrollPosition(offset);
1770 mClientText->setViewOffset(point);
1771 }
1772 }
1773 }
1774
1775 void EditBox::setEditWordWrap(bool _value)
1776 {

Callers

nothing calls this directly

Calls 4

clampFunction · 0.85
getViewOffsetMethod · 0.45
setScrollPositionMethod · 0.45
setViewOffsetMethod · 0.45

Tested by

no test coverage detected