From ead62d73ff5a862b5ef4746bc602d254a9ca8e28 Mon Sep 17 00:00:00 2001 From: stv Date: Fri, 3 Jun 2005 04:54:25 +0000 Subject: [PATCH] no message --- src/STD/STD_MDIDesktop.cxx | 365 ++++++++++++++++++------------------- src/STD/STD_MDIDesktop.h | 115 ++++++------ 2 files changed, 238 insertions(+), 242 deletions(-) diff --git a/src/STD/STD_MDIDesktop.cxx b/src/STD/STD_MDIDesktop.cxx index d05643ab9..7a9aca2eb 100755 --- a/src/STD/STD_MDIDesktop.cxx +++ b/src/STD/STD_MDIDesktop.cxx @@ -1,184 +1,181 @@ -#include "STD_MDIDesktop.h" - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -STD_MDIDesktop::STD_MDIDesktop() -: SUIT_Desktop(), -myWorkstack( 0 ) -//myWorkspaceAction( 0 ) -{ - QVBox* base = new QVBox( this ); - base->setFrameStyle( QFrame::Panel | QFrame::Sunken ); - - setCentralWidget( base ); - - myWorkstack = new QtxWorkstack( base ); - - connect( myWorkstack, SIGNAL( windowActivated( QWidget* ) ), - this, SLOT( onWindowActivated( QWidget* ) ) ); - - createActions(); -} - -STD_MDIDesktop::~STD_MDIDesktop() -{ -} - -SUIT_ViewWindow* STD_MDIDesktop::activeWindow() const -{ - SUIT_ViewWindow* wnd = 0; - - QWidget* wid = myWorkstack->activeWindow(); - if ( wid && wid->inherits( "SUIT_ViewWindow" ) ) - wnd = (SUIT_ViewWindow*)wid; - - return wnd; -} - -QPtrList STD_MDIDesktop::windows() const -{ - QPtrList winList; - - QWidgetList children = myWorkstack->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 myWorkstack; -} - -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 typeList; - - int cur = first; - while ( cur ) - { - typeList.append( cur ); - cur = va_arg( ints, int ); - } - - setWindowOperations( typeList ); -} - -void STD_MDIDesktop::setWindowOperations( const QValueList& opList ) -{ - int flags = 0; - - for ( QValueList::const_iterator it = opList.begin(); it != opList.end(); ++it ) - flags = flags | operationFlag( *it ); - -// myWorkspaceAction->setItems( flags ); -} - -QWorkspace* STD_MDIDesktop::workspace() const -{ - return 0;//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; -} +#include "STD_MDIDesktop.h" + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +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 STD_MDIDesktop::windows() const +{ + QPtrList 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 typeList; + + int cur = first; + while ( cur ) + { + typeList.append( cur ); + cur = va_arg( ints, int ); + } + + setWindowOperations( typeList ); +} + +void STD_MDIDesktop::setWindowOperations( const QValueList& opList ) +{ + int flags = 0; + + for ( QValueList::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; +} diff --git a/src/STD/STD_MDIDesktop.h b/src/STD/STD_MDIDesktop.h index b8e6e5e8a..e4746b1b9 100755 --- a/src/STD/STD_MDIDesktop.h +++ b/src/STD/STD_MDIDesktop.h @@ -1,58 +1,57 @@ -#ifndef STD_MDIDESKTOP_H -#define STD_MDIDESKTOP_H - -#include "STD.h" - -#include - -class QtxAction; -class QPopupMenu; -class QWorkspace; -class QtxWorkstack; -//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 windows() const; - - void windowOperation( const int ); - - void setWindowOperations( const int, ... ); - void setWindowOperations( const QValueList& ); - - QWorkspace* workspace() const; - -private slots: - void onWindowActivated( QWidget* ); - -protected: - void createActions(); - virtual QWidget* parentArea() const; - -private: - int operationFlag( const int ) const; - -private: - QtxWorkstack* myWorkstack; -// QtxWorkspaceAction* myWorkspaceAction; -}; - -#if defined WNT -#pragma warning( default: 4251 ) -#endif - -#endif +#ifndef STD_MDIDESKTOP_H +#define STD_MDIDESKTOP_H + +#include "STD.h" + +#include + +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 windows() const; + + void windowOperation( const int ); + + void setWindowOperations( const int, ... ); + void setWindowOperations( const QValueList& ); + + 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 -- 2.39.2