1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 #include "SUIT_Desktop.h"
21 #include "SUIT_Tools.h"
22 #include "SUIT_ViewWindow.h"
24 #include <QtxLogoMgr.h>
25 #include <QtxActionMenuMgr.h>
26 #include <QtxActionToolMgr.h>
28 /*!\class SUIT_Desktop
29 * Provide desktop management:\n
38 SUIT_Desktop::SUIT_Desktop()
41 myMenuMgr = new QtxActionMenuMgr( this );
42 myToolMgr = new QtxActionToolMgr( this );
43 myLogoMgr = new QtxLogoMgr( menuBar() );
49 SUIT_Desktop::~SUIT_Desktop()
56 bool SUIT_Desktop::event( QEvent* e )
63 case QEvent::WindowActivate:
66 case QEvent::WindowDeactivate:
71 return QMainWindow::event( e );
77 void SUIT_Desktop::closeEvent( QCloseEvent* e )
79 emit closing( this, e );
86 void SUIT_Desktop::childEvent( QChildEvent* e )
88 if ( e->type() == QEvent::ChildInserted && parentArea() &&
89 e->child()->isWidgetType() && e->child()->inherits( "SUIT_ViewWindow" ) )
91 QWidget* wid = (QWidget*)e->child();
92 bool vis = wid->isVisibleTo( wid->parentWidget() );
93 wid->reparent( parentArea(), QPoint( 0, 0 ), vis );
97 QtxMainWindow::childEvent( e );
103 QtxActionMenuMgr* SUIT_Desktop::menuMgr() const
111 QtxActionToolMgr* SUIT_Desktop::toolMgr() const
117 Returns the count of the existed logos.
119 int SUIT_Desktop::logoCount() const
124 return myLogoMgr->count();
128 Adds new logo to the menu bar area.
129 Obsolete. Not should be used.
130 Use SUIT_Desktop::logoInsert();
132 void SUIT_Desktop::addLogo( const QString& id, const QPixmap& pix )
134 logoInsert( id, pix );
139 Obsolete. Not should be used.
140 Use SUIT_Desktop::logoRemove();
142 void SUIT_Desktop::removeLogo( const QString& id )
148 Adds new logo to the menu bar area
150 void SUIT_Desktop::logoInsert( const QString& logoID, const QPixmap& logo, const int idx )
153 myLogoMgr->insert( logoID, logo, idx );
159 void SUIT_Desktop::logoRemove( const QString& logoID )
162 myLogoMgr->remove( logoID );
168 void SUIT_Desktop::logoClear()