//
#include "SUIT_Desktop.h"
-#include "SUIT_Tools.h"
#include "SUIT_ViewWindow.h"
-#include <QtxLogoMgr.h>
+//#include <QtxLogoMgr.h>
#include <QtxActionMenuMgr.h>
#include <QtxActionToolMgr.h>
+#include <QApplication>
+#include <QCloseEvent>
+
/*!\class SUIT_Desktop
* Provide desktop management:\n
* \li menu manager
* \li windows
*/
+class SUIT_Desktop::ReparentEvent : public QEvent
+{
+public:
+ ReparentEvent( Type t, QObject* obj ) : QEvent( t ), myObj( obj ) {};
+
+ QObject* object() const { return myObj; }
+
+private:
+ QObject* myObj;
+};
+
/*!
Constructor.
*/
{
myMenuMgr = new QtxActionMenuMgr( this );
myToolMgr = new QtxActionToolMgr( this );
- myLogoMgr = new QtxLogoMgr( menuBar() );
+ myLogoMgr = 0;//new QtxLogoMgr( menuBar() );
}
/*!
case QEvent::WindowDeactivate:
emit deactivated();
break;
+ default:
+ break;
}
return QMainWindow::event( e );
*/
void SUIT_Desktop::childEvent( QChildEvent* e )
{
- if ( e->type() == QEvent::ChildInserted && parentArea() &&
- e->child()->isWidgetType() && e->child()->inherits( "SUIT_ViewWindow" ) )
- {
- QWidget* wid = (QWidget*)e->child();
- bool vis = wid->isVisibleTo( wid->parentWidget() );
- wid->reparent( parentArea(), QPoint( 0, 0 ), vis );
- wid->setShown( vis );
- }
+ if ( e->type() == QEvent::ChildAdded && e->child()->isWidgetType() )
+ QApplication::postEvent( this, new QChildEvent( QEvent::Type( Reparent ), e->child() ) );
else
QtxMainWindow::childEvent( e );
}
+void SUIT_Desktop::customEvent( QEvent* e )
+{
+ if ( (int)e->type() != Reparent )
+ return;
+
+ QChildEvent* re = (QChildEvent*)e;
+ if ( re->child()->inherits( "SUIT_ViewWindow" ) )
+ {
+ QWidget* wid = (QWidget*)re->child();
+ bool invis = wid->testAttribute( Qt::WA_WState_ExplicitShowHide ) &&
+ wid->testAttribute( Qt::WA_WState_Hidden );
+
+ addWindow( wid );
+ wid->setShown( !invis );
+ }
+}
+
/*!
Gets menu manager.
*/
*/
int SUIT_Desktop::logoCount() const
{
+ return 0;
+/*
if ( !myLogoMgr )
return 0;
else
return myLogoMgr->count();
-}
-
-/*!
- Adds new logo to the menu bar area.
- Obsolete. Not should be used.
- Use SUIT_Desktop::logoInsert();
*/
-void SUIT_Desktop::addLogo( const QString& id, const QPixmap& pix )
-{
- logoInsert( id, pix );
-}
-
-/*!
- Removes a logo.
- Obsolete. Not should be used.
- Use SUIT_Desktop::logoRemove();
-*/
-void SUIT_Desktop::removeLogo( const QString& id )
-{
- logoRemove( id );
}
/*!
Adds new logo to the menu bar area
*/
-void SUIT_Desktop::logoInsert( const QString& logoID, const QPixmap& logo, const int idx )
+void SUIT_Desktop::logoInsert( const QString& /*logoID*/, const QPixmap& /*logo*/, const int /*idx*/ )
{
+/*
if ( myLogoMgr )
myLogoMgr->insert( logoID, logo, idx );
+*/
}
/*!
Removes a logo
*/
-void SUIT_Desktop::logoRemove( const QString& logoID )
+void SUIT_Desktop::logoRemove( const QString& /*logoID*/ )
{
+/*
if ( myLogoMgr )
myLogoMgr->remove( logoID );
+*/
}
/*!
*/
void SUIT_Desktop::logoClear()
{
+/*
if ( myLogoMgr )
myLogoMgr->clear();
+*/
}
/*!
#include "SUIT.h"
-#include <qmap.h>
-#include <qpixmap.h>
+#include <QList>
+#include <QEvent>
+
#include <QtxMainWindow.h>
-class QPopupMenu;
class QtxLogoMgr;
class SUIT_ViewWindow;
class QtxActionMenuMgr;
{
Q_OBJECT
+ class ReparentEvent;
+
+ enum { Reparent = QEvent::User };
+
public:
SUIT_Desktop();
virtual ~SUIT_Desktop();
QtxActionToolMgr* toolMgr() const;
virtual SUIT_ViewWindow* activeWindow() const = 0;
- virtual QPtrList<SUIT_ViewWindow> windows() const = 0;
-
- void addLogo( const QString&, const QPixmap& ); // Not should be used. Will be removed.
- void removeLogo( const QString& ); // Not should be used. Will be removed.
+ virtual QList<SUIT_ViewWindow*> windows() const = 0;
int logoCount() const;
protected:
virtual bool event( QEvent* );
+ virtual void customEvent( QEvent* );
virtual void closeEvent( QCloseEvent* );
virtual void childEvent( QChildEvent* );
- virtual QWidget* parentArea() const = 0;
+ virtual void addWindow( QWidget* ) = 0;
private:
QtxActionMenuMgr* myMenuMgr;