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

Method setViewOffset

MyGUIEngine/src/MyGUI_ItemBox.cpp:953–1012  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

951 }
952
953 void ItemBox::setViewOffset(const IntPoint& _value)
954 {
955 if (mAlignVert)
956 {
957 if (mContentSize.height <= 0)
958 return;
959
960 int offset = _value.top;
961
962 if (mContentSize.height <= _getClientWidget()->getHeight())
963 offset = 0;
964 else if (offset >= mContentSize.height - _getClientWidget()->getHeight())
965 offset = mContentSize.height - _getClientWidget()->getHeight();
966 else if (offset < 0)
967 offset = 0;
968
969 if (mContentPosition.top == offset)
970 return;
971
972 // сбрасываем старую подсветку
973 // так как при прокрутке, мышь может находиться над окном
974 resetCurrentActiveItem();
975
976 mContentPosition.top = offset;
977 }
978 else
979 {
980 if (mContentSize.width <= 0)
981 return;
982
983 int offset = _value.left;
984
985 if (mContentSize.width <= _getClientWidget()->getWidth())
986 offset = 0;
987 else if (offset >= mContentSize.width - _getClientWidget()->getWidth())
988 offset = mContentSize.width - _getClientWidget()->getWidth();
989 else if (offset < 0)
990 offset = 0;
991
992 if (mContentPosition.left == offset)
993 return;
994
995 // сбрасываем старую подсветку
996 // так как при прокрутке, мышь может находиться над окном
997 resetCurrentActiveItem();
998
999 mContentPosition.left = offset;
1000 }
1001
1002 setContentPosition(mContentPosition);
1003
1004 // заново ищем и подсвечиваем айтем
1005 if (!mNeedDrop)
1006 findCurrentActiveItem();
1007
1008 if (nullptr != mVScroll)
1009 mVScroll->setScrollPosition(mContentPosition.top);
1010 if (nullptr != mHScroll)

Callers 13

setFunction · 0.45
notifyMouseWheelMethod · 0.45
updateCursorPositionMethod · 0.45
setContentPositionMethod · 0.45
setVScrollPositionMethod · 0.45
setHScrollPositionMethod · 0.45
notifyMouseDragMethod · 0.45
loadMouseRelativeMethod · 0.45
notifyMouseDragMethod · 0.45

Calls 3

getHeightMethod · 0.45
getWidthMethod · 0.45
setScrollPositionMethod · 0.45

Tested by

no test coverage detected