-#include "STD_MDIDesktop.h"\r
-\r
-#include <SUIT_Session.h>\r
-#include <SUIT_ViewWindow.h>\r
-#include <SUIT_ResourceMgr.h>\r
-\r
-#include <QtxAction.h>\r
-#include <QtxWorkstack.h>\r
-#include <QtxActionMenuMgr.h>\r
-#include <QtxWorkspaceAction.h>\r
-\r
-#include <qvbox.h>\r
-#include <qmenubar.h>\r
-#include <qworkspace.h>\r
-#include <qobjectlist.h>\r
-\r
-#include <stdarg.h>\r
-\r
-STD_MDIDesktop::STD_MDIDesktop()\r
-: SUIT_Desktop(),\r
-myWorkstack( 0 )\r
-//myWorkspaceAction( 0 )\r
-{\r
- QVBox* base = new QVBox( this );\r
- base->setFrameStyle( QFrame::Panel | QFrame::Sunken );\r
-\r
- setCentralWidget( base );\r
-\r
- myWorkstack = new QtxWorkstack( base );\r
-\r
- connect( myWorkstack, SIGNAL( windowActivated( QWidget* ) ),\r
- this, SLOT( onWindowActivated( QWidget* ) ) );\r
-\r
- createActions();\r
-}\r
-\r
-STD_MDIDesktop::~STD_MDIDesktop()\r
-{\r
-}\r
-\r
-SUIT_ViewWindow* STD_MDIDesktop::activeWindow() const\r
-{\r
- SUIT_ViewWindow* wnd = 0;\r
-\r
- QWidget* wid = myWorkstack->activeWindow();\r
- if ( wid && wid->inherits( "SUIT_ViewWindow" ) )\r
- wnd = (SUIT_ViewWindow*)wid;\r
-\r
- return wnd;\r
-}\r
-\r
-QPtrList<SUIT_ViewWindow> STD_MDIDesktop::windows() const\r
-{\r
- QPtrList<SUIT_ViewWindow> winList;\r
-\r
- QWidgetList children = myWorkstack->windowList();\r
- for ( QWidgetListIt it( children ); it.current(); ++it )\r
- {\r
- if ( it.current()->inherits( "SUIT_ViewWindow" ) )\r
- winList.append( (SUIT_ViewWindow*)it.current() );\r
- }\r
-\r
- return winList;\r
-}\r
-\r
-QWidget* STD_MDIDesktop::parentArea() const\r
-{\r
- return myWorkstack;\r
-}\r
-\r
-void STD_MDIDesktop::windowOperation( const int type )\r
-{\r
-// myWorkspaceAction->perform( operationFlag( type ) );\r
-}\r
-\r
-void STD_MDIDesktop::setWindowOperations( const int first, ... )\r
-{\r
- va_list ints;\r
- va_start( ints, first );\r
-\r
- QValueList<int> typeList;\r
-\r
- int cur = first;\r
- while ( cur )\r
- {\r
- typeList.append( cur );\r
- cur = va_arg( ints, int );\r
- }\r
-\r
- setWindowOperations( typeList );\r
-}\r
-\r
-void STD_MDIDesktop::setWindowOperations( const QValueList<int>& opList )\r
-{\r
- int flags = 0;\r
-\r
- for ( QValueList<int>::const_iterator it = opList.begin(); it != opList.end(); ++it )\r
- flags = flags | operationFlag( *it );\r
-\r
-// myWorkspaceAction->setItems( flags );\r
-}\r
-\r
-QWorkspace* STD_MDIDesktop::workspace() const\r
-{\r
- return 0;//myWorkspace;\r
-}\r
-\r
-void STD_MDIDesktop::onWindowActivated( QWidget* w )\r
-{\r
- if ( w && w->inherits( "SUIT_ViewWindow" ) )\r
- emit windowActivated( (SUIT_ViewWindow*)w );\r
-}\r
-\r
-void STD_MDIDesktop::createActions()\r
-{\r
-/*\r
- if ( myWorkspaceAction )\r
- return;\r
-\r
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();\r
- if ( !resMgr )\r
- return;\r
-\r
- myWorkspaceAction = new QtxWorkspaceAction( workspace(), this );\r
-\r
- myWorkspaceAction->setItems( QtxWorkspaceAction::Cascade | QtxWorkspaceAction::Tile |\r
- QtxWorkspaceAction::HTile | QtxWorkspaceAction::VTile |\r
- QtxWorkspaceAction::Windows );\r
-\r
- // Cascade\r
- myWorkspaceAction->setIconSet( QtxWorkspaceAction::Cascade,\r
- resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_CASCADE" ) ) );\r
- myWorkspaceAction->setMenuText( QtxWorkspaceAction::Cascade, tr( "MEN_DESK_WINDOW_CASCADE" ) );\r
- myWorkspaceAction->setStatusTip( QtxWorkspaceAction::Cascade, tr( "PRP_DESK_WINDOW_CASCADE" ) );\r
-\r
- // Tile\r
- myWorkspaceAction->setIconSet( QtxWorkspaceAction::Tile,\r
- resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_TILE" ) ) );\r
- myWorkspaceAction->setMenuText( QtxWorkspaceAction::Tile, tr( "MEN_DESK_WINDOW_TILE" ) );\r
- myWorkspaceAction->setStatusTip( QtxWorkspaceAction::Tile, tr( "PRP_DESK_WINDOW_TILE" ) );\r
-\r
- // Tile Horizontal\r
- myWorkspaceAction->setIconSet( QtxWorkspaceAction::HTile,\r
- resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_HTILE" ) ) );\r
- myWorkspaceAction->setMenuText( QtxWorkspaceAction::HTile, tr( "MEN_DESK_WINDOW_HTILE" ) );\r
- myWorkspaceAction->setStatusTip( QtxWorkspaceAction::HTile, tr( "PRP_DESK_WINDOW_HTILE" ) );\r
-\r
- // Tile Vertical\r
- myWorkspaceAction->setIconSet( QtxWorkspaceAction::VTile,\r
- resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_VTILE" ) ) );\r
- myWorkspaceAction->setMenuText( QtxWorkspaceAction::VTile, tr( "MEN_DESK_WINDOW_VTILE" ) );\r
- myWorkspaceAction->setStatusTip( QtxWorkspaceAction::VTile, tr( "PRP_DESK_WINDOW_VTILE" ) );\r
-\r
-\r
- QtxActionMenuMgr* mMgr = menuMgr();\r
- if ( !mMgr )\r
- return;\r
-\r
- int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100 );\r
- mMgr->insert( myWorkspaceAction, winMenuId, -1 );\r
- mMgr->insert( QtxActionMenuMgr::separator(), winMenuId, -1 );\r
-*/\r
-}\r
-\r
-int STD_MDIDesktop::operationFlag( const int type ) const\r
-{\r
- int res = 0;\r
- switch ( type )\r
- {\r
- case Cascade:\r
- res = QtxWorkspaceAction::Cascade;\r
- break;\r
- case Tile:\r
- res = QtxWorkspaceAction::Tile;\r
- break;\r
- case HTile:\r
- res = QtxWorkspaceAction::HTile;\r
- break;\r
- case VTile:\r
- res = QtxWorkspaceAction::VTile;\r
- break;\r
- }\r
- return res;\r
-}\r
+#include "STD_MDIDesktop.h"
+
+#include <SUIT_Session.h>
+#include <SUIT_ViewWindow.h>
+#include <SUIT_ResourceMgr.h>
+
+#include <QtxAction.h>
+#include <QtxActionMenuMgr.h>
+#include <QtxWorkspaceAction.h>
+
+#include <qvbox.h>
+#include <qmenubar.h>
+#include <qworkspace.h>
+#include <qobjectlist.h>
+
+#include <stdarg.h>
+
+STD_MDIDesktop::STD_MDIDesktop()
+: SUIT_Desktop(),
+myWorkspace( 0 ),
+myWorkspaceAction( 0 )
+{
+ QVBox* base = new QVBox( this );
+ base->setFrameStyle( QFrame::Panel | QFrame::Sunken );
+
+ setCentralWidget( base );
+
+ myWorkspace = new QWorkspace( base );
+
+ connect( myWorkspace, SIGNAL( windowActivated( QWidget* ) ),
+ this, SLOT( onWindowActivated( QWidget* ) ) );
+
+ createActions();
+}
+
+STD_MDIDesktop::~STD_MDIDesktop()
+{
+}
+
+SUIT_ViewWindow* STD_MDIDesktop::activeWindow() const
+{
+ SUIT_ViewWindow* wnd = 0;
+
+ QWidget* wid = myWorkspace->activeWindow();
+ if ( wid && wid->inherits( "SUIT_ViewWindow" ) )
+ wnd = (SUIT_ViewWindow*)wid;
+
+ return wnd;
+}
+
+QPtrList<SUIT_ViewWindow> STD_MDIDesktop::windows() const
+{
+ QPtrList<SUIT_ViewWindow> winList;
+
+ QWidgetList children = myWorkspace->windowList();
+ for ( QWidgetListIt it( children ); it.current(); ++it )
+ {
+ if ( it.current()->inherits( "SUIT_ViewWindow" ) )
+ winList.append( (SUIT_ViewWindow*)it.current() );
+ }
+
+ return winList;
+}
+
+QWidget* STD_MDIDesktop::parentArea() const
+{
+ return workspace();
+}
+
+void STD_MDIDesktop::windowOperation( const int type )
+{
+ myWorkspaceAction->perform( operationFlag( type ) );
+}
+
+void STD_MDIDesktop::setWindowOperations( const int first, ... )
+{
+ va_list ints;
+ va_start( ints, first );
+
+ QValueList<int> typeList;
+
+ int cur = first;
+ while ( cur )
+ {
+ typeList.append( cur );
+ cur = va_arg( ints, int );
+ }
+
+ setWindowOperations( typeList );
+}
+
+void STD_MDIDesktop::setWindowOperations( const QValueList<int>& opList )
+{
+ int flags = 0;
+
+ for ( QValueList<int>::const_iterator it = opList.begin(); it != opList.end(); ++it )
+ flags = flags | operationFlag( *it );
+
+ myWorkspaceAction->setItems( flags );
+}
+
+QWorkspace* STD_MDIDesktop::workspace() const
+{
+ return myWorkspace;
+}
+
+void STD_MDIDesktop::onWindowActivated( QWidget* w )
+{
+ if ( w && w->inherits( "SUIT_ViewWindow" ) )
+ emit windowActivated( (SUIT_ViewWindow*)w );
+}
+
+void STD_MDIDesktop::createActions()
+{
+ if ( myWorkspaceAction )
+ return;
+
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ if ( !resMgr )
+ return;
+
+ myWorkspaceAction = new QtxWorkspaceAction( workspace(), this );
+
+ myWorkspaceAction->setItems( QtxWorkspaceAction::Cascade | QtxWorkspaceAction::Tile |
+ QtxWorkspaceAction::HTile | QtxWorkspaceAction::VTile |
+ QtxWorkspaceAction::Windows );
+
+ // Cascade
+ myWorkspaceAction->setIconSet( QtxWorkspaceAction::Cascade,
+ resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_CASCADE" ) ) );
+ myWorkspaceAction->setMenuText( QtxWorkspaceAction::Cascade, tr( "MEN_DESK_WINDOW_CASCADE" ) );
+ myWorkspaceAction->setStatusTip( QtxWorkspaceAction::Cascade, tr( "PRP_DESK_WINDOW_CASCADE" ) );
+
+ // Tile
+ myWorkspaceAction->setIconSet( QtxWorkspaceAction::Tile,
+ resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_TILE" ) ) );
+ myWorkspaceAction->setMenuText( QtxWorkspaceAction::Tile, tr( "MEN_DESK_WINDOW_TILE" ) );
+ myWorkspaceAction->setStatusTip( QtxWorkspaceAction::Tile, tr( "PRP_DESK_WINDOW_TILE" ) );
+
+ // Tile Horizontal
+ myWorkspaceAction->setIconSet( QtxWorkspaceAction::HTile,
+ resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_HTILE" ) ) );
+ myWorkspaceAction->setMenuText( QtxWorkspaceAction::HTile, tr( "MEN_DESK_WINDOW_HTILE" ) );
+ myWorkspaceAction->setStatusTip( QtxWorkspaceAction::HTile, tr( "PRP_DESK_WINDOW_HTILE" ) );
+
+ // Tile Vertical
+ myWorkspaceAction->setIconSet( QtxWorkspaceAction::VTile,
+ resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_VTILE" ) ) );
+ myWorkspaceAction->setMenuText( QtxWorkspaceAction::VTile, tr( "MEN_DESK_WINDOW_VTILE" ) );
+ myWorkspaceAction->setStatusTip( QtxWorkspaceAction::VTile, tr( "PRP_DESK_WINDOW_VTILE" ) );
+
+
+ QtxActionMenuMgr* mMgr = menuMgr();
+ if ( !mMgr )
+ return;
+
+ int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100 );
+ mMgr->insert( myWorkspaceAction, winMenuId, -1 );
+ mMgr->insert( QtxActionMenuMgr::separator(), winMenuId, -1 );
+}
+
+int STD_MDIDesktop::operationFlag( const int type ) const
+{
+ int res = 0;
+ switch ( type )
+ {
+ case Cascade:
+ res = QtxWorkspaceAction::Cascade;
+ break;
+ case Tile:
+ res = QtxWorkspaceAction::Tile;
+ break;
+ case HTile:
+ res = QtxWorkspaceAction::HTile;
+ break;
+ case VTile:
+ res = QtxWorkspaceAction::VTile;
+ break;
+ }
+ return res;
+}
-#ifndef STD_MDIDESKTOP_H\r
-#define STD_MDIDESKTOP_H\r
-\r
-#include "STD.h"\r
-\r
-#include <SUIT_Desktop.h>\r
-\r
-class QtxAction;\r
-class QPopupMenu;\r
-class QWorkspace;\r
-class QtxWorkstack;\r
-//class QtxWorkspaceAction;\r
-\r
-#if defined WNT\r
-#pragma warning( disable: 4251 )\r
-#endif\r
-\r
-class STD_EXPORT STD_MDIDesktop: public SUIT_Desktop \r
-{\r
- Q_OBJECT\r
-\r
-public:\r
- enum { Cascade, Tile, HTile, VTile };\r
-\r
-public:\r
- STD_MDIDesktop();\r
- virtual ~STD_MDIDesktop();\r
-\r
- virtual SUIT_ViewWindow* activeWindow() const;\r
- virtual QPtrList<SUIT_ViewWindow> windows() const;\r
-\r
- void windowOperation( const int );\r
-\r
- void setWindowOperations( const int, ... );\r
- void setWindowOperations( const QValueList<int>& );\r
-\r
- QWorkspace* workspace() const;\r
-\r
-private slots:\r
- void onWindowActivated( QWidget* );\r
-\r
-protected:\r
- void createActions();\r
- virtual QWidget* parentArea() const;\r
-\r
-private:\r
- int operationFlag( const int ) const;\r
-\r
-private:\r
- QtxWorkstack* myWorkstack;\r
-// QtxWorkspaceAction* myWorkspaceAction;\r
-};\r
-\r
-#if defined WNT\r
-#pragma warning( default: 4251 )\r
-#endif\r
-\r
-#endif\r
+#ifndef STD_MDIDESKTOP_H
+#define STD_MDIDESKTOP_H
+
+#include "STD.h"
+
+#include <SUIT_Desktop.h>
+
+class QtxAction;
+class QPopupMenu;
+class QWorkspace;
+class QtxWorkspaceAction;
+
+#if defined WNT
+#pragma warning( disable: 4251 )
+#endif
+
+class STD_EXPORT STD_MDIDesktop: public SUIT_Desktop
+{
+ Q_OBJECT
+
+public:
+ enum { Cascade, Tile, HTile, VTile };
+
+public:
+ STD_MDIDesktop();
+ virtual ~STD_MDIDesktop();
+
+ virtual SUIT_ViewWindow* activeWindow() const;
+ virtual QPtrList<SUIT_ViewWindow> windows() const;
+
+ void windowOperation( const int );
+
+ void setWindowOperations( const int, ... );
+ void setWindowOperations( const QValueList<int>& );
+
+ QWorkspace* workspace() const;
+
+private slots:
+ void onWindowActivated( QWidget* );
+
+protected:
+ void createActions();
+ virtual QWidget* parentArea() const;
+
+private:
+ int operationFlag( const int ) const;
+
+private:
+ QWorkspace* myWorkspace;
+ QtxWorkspaceAction* myWorkspaceAction;
+};
+
+#if defined WNT
+#pragma warning( default: 4251 )
+#endif
+
+#endif