Salome HOME
Popup item "Refresh"
[modules/gui.git] / src / STD / STD_SDIDesktop.cxx
1 #include "STD_SDIDesktop.h"
2
3 #include <SUIT_ViewWindow.h>
4
5 #include <qvbox.h>
6 #include <qmenubar.h>
7 #include <qobjectlist.h>
8
9 STD_SDIDesktop::STD_SDIDesktop()
10 : SUIT_Desktop()
11 {
12   myMainWidget = new QVBox( this );
13   myMainWidget->setFrameStyle( QFrame::Panel | QFrame::Sunken );
14
15   setCentralWidget( myMainWidget );
16 }
17
18 STD_SDIDesktop::~STD_SDIDesktop()
19 {
20 }
21
22 SUIT_ViewWindow* STD_SDIDesktop::activeWindow() const
23 {
24   const QObjectList* children = myMainWidget->children();
25   if ( !children )
26     return 0;
27
28   QPtrList<SUIT_ViewWindow> winList;
29   for ( QObjectListIt it( *children ); it.current(); ++it )
30   {
31     if ( it.current()->inherits( "SUIT_ViewWindow" ) )
32       winList.append( (SUIT_ViewWindow*)it.current() );
33   }
34
35   SUIT_ViewWindow* win = 0;
36   for ( QPtrListIterator<SUIT_ViewWindow> itr( winList ); itr.current() && !win; ++itr )
37   {
38     if ( itr.current()->isActiveWindow() )
39       win = itr.current();
40   }
41
42   if ( !win && !winList.isEmpty() )
43     win = winList.getFirst();
44
45   return win;
46 }
47
48 QPtrList<SUIT_ViewWindow> STD_SDIDesktop::windows() const
49 {
50   QPtrList<SUIT_ViewWindow> winList;
51       winList.append( activeWindow() );
52   return winList;
53 }
54
55 QWidget* STD_SDIDesktop::parentArea() const
56 {
57   return myMainWidget;
58 }