#include <QFrame>
#include <QVBoxLayout>
+#include <QStatusBar>
#include <stdarg.h>
*/
void STD_MDIDesktop::addWindow( QWidget* w )
{
- if ( !w || !workspace() )
+ if ( !w || !myWorkspace )
return;
- workspace()->addWindow( w );
+ QWidget* aWnd = myWorkspace->addWindow( w );
+ //aWnd->setAutoFillBackground(false);
+ //setBackgroundRole(QPalette::NoRole);
+ QSize aSize = myWorkspace->size();
+
+ QWidget* aCurrWnd = myWorkspace->activeWindow();
+ int xPos = 0, yPos = 0;
+ if (aCurrWnd) {
+ const QRect& aCurrGeom = aCurrWnd->geometry();
+ int aShift = 20;
+ if (statusBar())
+ aShift = statusBar()->geometry().height();
+ int aXLow = aSize.width() * 1./3.;
+ int aYLow = aSize.height() * 1./3.;
+ xPos = (aCurrGeom.x() > aXLow)? 0 : aCurrGeom.x() + aShift;
+ yPos = (aCurrGeom.y() > aYLow)? 0 : aCurrGeom.y() + aShift;
+ }
+ aWnd->setGeometry(xPos, yPos, aSize.width() * 2./3., aSize.height() * 2./3.);
}
/*!Call method perform for operation \a type.*/
/*!
Child event.
*/
-void SUIT_Desktop::childEvent( QChildEvent* e )
+/*void SUIT_Desktop::childEvent( QChildEvent* e )
{
if ( e->type() == QEvent::ChildAdded && e->child()->isWidgetType() )
QApplication::postEvent( this, new ReparentEvent( QEvent::Type( Reparent ), e->child() ) );
else
QtxMainWindow::childEvent( e );
-}
+}*/
-void SUIT_Desktop::customEvent( QEvent* e )
+/*void SUIT_Desktop::customEvent( QEvent* e )
{
if ( (int)e->type() != Reparent )
return;
addWindow( wid );
wid->setShown( !invis );
}
-}
+}*/
/*!
Gets menu manager.
void emitActivated();
void emitMessage( const QString& );
+ virtual void addWindow( QWidget* ) = 0;
+
signals:
void activated();
void deactivated();
protected:
virtual bool event( QEvent* );
- virtual void customEvent( QEvent* );
+ //virtual void customEvent( QEvent* );
virtual void closeEvent( QCloseEvent* );
- virtual void childEvent( QChildEvent* );
+ //virtual void childEvent( QChildEvent* );
- virtual void addWindow( QWidget* ) = 0;
private:
QtxActionMenuMgr* myMenuMgr;
setViewName( aView );
aView->setWindowIcon( QIcon( myIcon ) );
- //myDesktop->addViewWindow( aView );
+ myDesktop->addWindow( aView );
//it is done automatically during creation of view
aView->setViewManager( this );
// Special treatment for the case when <aView> is the first one in this view manager
// -> call onWindowActivated() directly, because somebody may always want
// to use getActiveView()
+ aView->show();
if ( !myActiveView )
onWindowActivated( aView );
SUIT_MessageBox::critical( this, tr( "ERROR" ), tr( "ERR_CANT_DUMP_VIEW" ) );
return true;
- }
+ }
return QMainWindow::event( e );
}