bool ScriptEditorWindow::internal_isPointerHovering(ScriptEditorWindow* thisPtr) { if (!thisPtr->isDestroyed()) { EditorWidgetBase* widget = thisPtr->getEditorWidget(); EditorWindowBase* window = widget->getParentWindow(); if (window == nullptr) return false; SPtr<RenderWindow> renderWindow = window->getRenderWindow(); Vector2I pointerPos = gInput().getPointerPosition(); if(Platform::isPointOverWindow(*renderWindow, pointerPos)) { Rect2I bounds = thisPtr->getEditorWidget()->getBounds(); Vector2I widgetPos(bounds.x, bounds.y); Vector2I screenPos = widget->widgetToScreenPos(widgetPos); bounds.x = screenPos.x; bounds.y = screenPos.y; return bounds.contains(pointerPos); } } return false; }
ScriptOSDropTarget::ScriptOSDropTarget(MonoObject* instance, ScriptEditorWindow* parent) :ScriptObject(instance), mParent(parent), mDropTarget(nullptr), mIsDestroyed(false) { EditorWidgetBase* parentWidget = getParentWidget(); if (parentWidget != nullptr) { mWidgetParentChangedConn = parentWidget->onParentChanged.connect(std::bind(&ScriptOSDropTarget::widgetParentChanged, this, _1)); mWidgetResizedConn = parentWidget->onResized.connect(std::bind(&ScriptOSDropTarget::widgetResized, this, _1, _2)); mWidgetMovedConn = parentWidget->onMoved.connect(std::bind(&ScriptOSDropTarget::widgetMoved, this, _1, _2)); EditorWindowBase* parentWindow = parentWidget->getParentWindow(); if (parentWindow != nullptr) setDropTarget(parentWindow->getRenderWindow(), 0, 0, 0, 0); mParentArea = parentWidget->getBounds(); } }