void ezQtEngineViewWidget::wheelEvent(QWheelEvent* e) { // if a context is active, it gets exclusive access to the input data if (ezEditorInputContext::IsAnyInputContextActive()) { if (ezEditorInputContext::GetActiveInputContext()->WheelEvent(e) == ezEditorInput::WasExclusivelyHandled) return; } if (ezEditorInputContext::IsAnyInputContextActive()) return; // Override context { ezEditorInputContext* pOverride = GetDocumentWindow()->GetDocument()->GetEditorInputContextOverride(); if (pOverride != nullptr) { if (pOverride->WheelEvent(e) == ezEditorInput::WasExclusivelyHandled || ezEditorInputContext::IsAnyInputContextActive()) return; } } // if no context is active, pass the input through in a certain order, until someone handles it for (auto pContext : m_InputContexts) { if (pContext->WheelEvent(e) == ezEditorInput::WasExclusivelyHandled || ezEditorInputContext::IsAnyInputContextActive()) return; } QWidget::wheelEvent(e); }
void ezQtEngineViewWidget::mouseMoveEvent(QMouseEvent* e) { s_InteractionContext.m_pLastHoveredViewWidget = this; s_InteractionContext.m_pLastPickingResult = &m_LastPickingResult; // kick off the picking PickObject(e->pos().x(), e->pos().y()); // if a context is active, it gets exclusive access to the input data if (ezEditorInputContext::IsAnyInputContextActive()) { if (ezEditorInputContext::GetActiveInputContext()->MouseMoveEvent(e) == ezEditorInput::WasExclusivelyHandled) { e->accept(); return; } } if (ezEditorInputContext::IsAnyInputContextActive()) { e->accept(); return; } // Override context { ezEditorInputContext* pOverride = GetDocumentWindow()->GetDocument()->GetEditorInputContextOverride(); if (pOverride != nullptr) { if (pOverride->MouseMoveEvent(e) == ezEditorInput::WasExclusivelyHandled || ezEditorInputContext::IsAnyInputContextActive()) return; } } // if no context is active, pass the input through in a certain order, until someone handles it for (auto pContext : m_InputContexts) { if (pContext->MouseMoveEvent(e) == ezEditorInput::WasExclusivelyHandled || ezEditorInputContext::IsAnyInputContextActive()) { e->accept(); return; } } QWidget::mouseMoveEvent(e); }
const ezObjectPickingResult& ezQtEngineViewWidget::PickObject(ezUInt16 uiScreenPosX, ezUInt16 uiScreenPosY) const { if (!ezEditorEngineProcessConnection::GetSingleton()->IsEngineSetup()) { m_LastPickingResult.Reset(); } else { ezViewPickingMsgToEngine msg; msg.m_uiViewID = GetViewID(); msg.m_uiPickPosX = uiScreenPosX * devicePixelRatio(); msg.m_uiPickPosY = uiScreenPosY * devicePixelRatio(); GetDocumentWindow()->GetDocument()->SendMessageToEngine(&msg); } return m_LastPickingResult; }
bool csDiagramDocument::OnSaveDocument(const wxString& file) { if (file == wxEmptyString) return false; if (!m_diagram.SaveFile(file)) { wxString msgTitle; if (wxTheApp->GetAppName() != wxEmptyString) msgTitle = wxTheApp->GetAppName(); else msgTitle = wxString(_T("File error")); (void)wxMessageBox(_T("Sorry, could not open this file for saving."), msgTitle, wxOK | wxICON_EXCLAMATION, GetDocumentWindow()); return false; } Modify(false); SetFilename(file); return true; }
bool csDiagramDocument::OnOpenDocument(const wxString& file) { if (!OnSaveModified()) return false; wxString msgTitle; if (wxTheApp->GetAppName() != wxEmptyString) msgTitle = wxTheApp->GetAppName(); else msgTitle = wxString(_T("File error")); m_diagram.DeleteAllShapes(); if (!m_diagram.LoadFile(file)) { (void)wxMessageBox(_T("Sorry, could not open this file."), msgTitle, wxOK|wxICON_EXCLAMATION, GetDocumentWindow()); return false; } SetFilename(file, true); Modify(false); UpdateAllViews(); return true; }