+}*/
+
+
+void XGUI_Viewer::addView(QMdiSubWindow* theView)
+{
+ XGUI_ViewWindow* aWindow = dynamic_cast<XGUI_ViewWindow*>(theView->widget());
+
+ connect(aWindow, SIGNAL(closed(QMdiSubWindow*)),
+ this, SLOT(onViewClosed(QMdiSubWindow*)));
+
+ connect(aWindow, SIGNAL(tryClosing(XGUI_ViewWindow*)),
+ this, SIGNAL(tryCloseView(XGUI_ViewWindow*)));
+
+ connect(aWindow, SIGNAL(mousePressed(XGUI_ViewWindow*, QMouseEvent*)),
+ this, SLOT(onMousePressed(XGUI_ViewWindow*, QMouseEvent*)));
+
+ connect(aWindow, SIGNAL(mouseReleased(XGUI_ViewWindow*, QMouseEvent*)),
+ this, SIGNAL(mouseRelease(XGUI_ViewWindow*, QMouseEvent*)));
+
+ connect(aWindow, SIGNAL(mouseDoubleClicked(XGUI_ViewWindow*, QMouseEvent*)),
+ this, SIGNAL(mouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*)));
+
+ connect(aWindow, SIGNAL(mouseMoving(XGUI_ViewWindow*, QMouseEvent*)),
+ this, SIGNAL(mouseMove(XGUI_ViewWindow*, QMouseEvent*)));
+
+ connect(aWindow, SIGNAL(keyPressed(XGUI_ViewWindow*, QKeyEvent*)),
+ this, SIGNAL(keyPress(XGUI_ViewWindow*, QKeyEvent*)));
+
+ connect(aWindow, SIGNAL(keyReleased(XGUI_ViewWindow*, QKeyEvent*)),
+ this, SIGNAL(keyRelease(XGUI_ViewWindow*, QKeyEvent*)));
+
+// connect(aWindow, SIGNAL(contextMenuRequested( QContextMenuEvent* )),
+// this, SLOT (onContextMenuRequested( QContextMenuEvent* )));
+
+ connect(aWindow, SIGNAL(mouseMoving(XGUI_ViewWindow*, QMouseEvent*)),
+ this, SLOT(onMouseMove(XGUI_ViewWindow*, QMouseEvent*)));
+
+ connect(aWindow, SIGNAL(mouseReleased(XGUI_ViewWindow*, QMouseEvent*)),
+ this, SLOT(onMouseReleased(XGUI_ViewWindow*, QMouseEvent*)));
+
+ myViews.append(theView);
+}
+
+/*!
+ Emit activated for view \a view.
+*/
+void XGUI_Viewer::onWindowActivated(QMdiSubWindow* view)
+{
+ if (view && (view != myActiveView) && (!view->isMinimized())) {
+ myActiveView = view;
+ ((XGUI_ViewWindow*)myActiveView->widget())->windowActivated();
+ QList<QMdiSubWindow*>::iterator aIt;
+ for (aIt = myViews.begin(); aIt != myViews.end(); ++aIt) {
+ if ((*aIt) != myActiveView) {
+ ((XGUI_ViewWindow*)(*aIt)->widget())->windowDeactivated();
+ }
+ }
+ }