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 "STD_SDIDesktop.h"
21 #include <SUIT_ViewWindow.h>
25 #include <qobjectlist.h>
27 /*!Constructor. Create instance of QVBox*/
28 STD_SDIDesktop::STD_SDIDesktop()
31 myMainWidget = new QVBox( this );
32 myMainWidget->setFrameStyle( QFrame::Panel | QFrame::Sunken );
34 setCentralWidget( myMainWidget );
38 STD_SDIDesktop::~STD_SDIDesktop()
42 /*!\retval SUIT_ViewWindow - return const active window.*/
43 SUIT_ViewWindow* STD_SDIDesktop::activeWindow() const
45 const QObjectList* children = myMainWidget->children();
49 QPtrList<SUIT_ViewWindow> winList;
50 for ( QObjectListIt it( *children ); it.current(); ++it )
52 if ( it.current()->inherits( "SUIT_ViewWindow" ) )
53 winList.append( (SUIT_ViewWindow*)it.current() );
56 SUIT_ViewWindow* win = 0;
57 for ( QPtrListIterator<SUIT_ViewWindow> itr( winList ); itr.current() && !win; ++itr )
59 if ( itr.current()->isActiveWindow() )
63 if ( !win && !winList.isEmpty() )
64 win = winList.getFirst();
69 /*!\retval QPtrList<SUIT_ViewWindow> - return const active window list.*/
70 QPtrList<SUIT_ViewWindow> STD_SDIDesktop::windows() const
72 QPtrList<SUIT_ViewWindow> winList;
73 winList.append( activeWindow() );
77 /*!\retval QWidget - pointer to main window.*/
78 QWidget* STD_SDIDesktop::parentArea() const