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

Method frameEntered

MyGUIEngine/src/MyGUI_EditBox.cpp:796–905  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

794 }
795
796 void EditBox::frameEntered(float _frame)
797 {
798 if (mClientText == nullptr)
799 return;
800
801 // в статике все недоступно
802 if (mModeStatic)
803 return;
804
805 if (mCursorActive)
806 {
807 mCursorTimer += _frame;
808
809 if (mCursorTimer > EDIT_CURSOR_TIMER)
810 {
811 mClientText->setVisibleCursor(!mClientText->isVisibleCursor());
812 while (mCursorTimer > EDIT_CURSOR_TIMER)
813 mCursorTimer -= EDIT_CURSOR_TIMER;
814 }
815 }
816
817 // сдвигаем курсор по положению мыши
818 if (mMouseLeftPressed)
819 {
820 mActionMouseTimer += _frame;
821
822 if (mActionMouseTimer > EDIT_ACTION_MOUSE_TIMER)
823 {
824 IntPoint mouse = InputManager::getInstance().getMousePositionByLayer();
825 const IntRect& view = getClientWidget()->getAbsoluteRect();
826 mouse.left -= view.left;
827 mouse.top -= view.top;
828 IntPoint point;
829
830 bool action = false;
831
832 // вверх на одну строчку
833 if ((mouse.top < 0) && (mouse.top > -EDIT_ACTION_MOUSE_ZONE))
834 {
835 if ((mouse.left > 0) && (mouse.left <= getClientWidget()->getWidth()))
836 {
837 point = mClientText->getCursorPoint(mCursorPosition);
838 point.top -= mClientText->getFontHeight();
839 action = true;
840 }
841 }
842 // вниз на одну строчку
843 else if (
844 (mouse.top > getClientWidget()->getHeight()) &&
845 (mouse.top < (getClientWidget()->getHeight() + EDIT_ACTION_MOUSE_ZONE)))
846 {
847 if ((mouse.left > 0) && (mouse.left <= getClientWidget()->getWidth()))
848 {
849 point = mClientText->getCursorPoint(mCursorPosition);
850 point.top += mClientText->getFontHeight();
851 action = true;
852 }
853 }

Callers

nothing calls this directly

Calls 10

setVisibleCursorMethod · 0.80
isVisibleCursorMethod · 0.80
getCursorPointMethod · 0.80
setCursorPositionMethod · 0.80
getWidthMethod · 0.45
getFontHeightMethod · 0.45
getHeightMethod · 0.45
getCursorPositionMethod · 0.45
setTextSelectionMethod · 0.45

Tested by

no test coverage detected