--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File: QtxActionSet.cxx
+// Author: Sergey TELKOV
+
+#include "QtxActionSet.h"
+
+#include <QMenu>
+#include <QActionGroup>
+
+/*!
+ Constructor
+*/
+QtxActionSet::QtxActionSet( QObject* parent )
+: QtxAction( parent )
+{
+ connect( this, SIGNAL( changed() ), this, SLOT( onChanged() ) );
+
+ setVisible( false );
+
+ update();
+}
+
+/*!
+ Destructor
+*/
+QtxActionSet::~QtxActionSet()
+{
+}
+
+QList<QAction*> QtxActionSet::actions() const
+{
+ return mySet;
+}
+
+void QtxActionSet::setActions( const QList<QAction*>& lst )
+{
+ for ( ActionList::iterator it = mySet.begin(); it != mySet.end(); ++it )
+ {
+ if ( !lst.contains( *it ) )
+ delete *it;
+ }
+
+ mySet.clear();
+
+ insertActions( lst );
+}
+
+void QtxActionSet::insertActions( const QList<QAction*>& lst, const int index )
+{
+ int idx = qMin( index < 0 ? mySet.count() : index, mySet.count() );
+
+ for ( QList<QAction*>::const_iterator it = lst.begin(); it != lst.end(); ++it )
+ {
+ QAction* a = *it;
+ int ident = generateId();
+
+ a->setParent( this );
+ mySet.insert( idx++, a );
+ a->setData( ident );
+
+ connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onActionTriggered( bool ) ) );
+ }
+
+ update();
+}
+
+int QtxActionSet::insertAction( QAction* a, const int id, const int index )
+{
+ if ( !a )
+ return -1;
+
+ int ident = id < 0 ? generateId() : id;
+ int idx = qMin( index < 0 ? mySet.count() : index, mySet.count() );
+
+ a->setParent( this );
+ mySet.insert( idx, a );
+ a->setData( ident );
+
+ connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onActionTriggered( bool ) ) );
+
+ update();
+
+ return ident;
+}
+
+int QtxActionSet::insertAction( const QString& txt, const int id, const int index )
+{
+ return insertAction( new QtxAction( txt, txt, 0, this ), id, index );
+}
+
+int QtxActionSet::insertAction( const QString& txt, const QIcon& ico, const int id, const int index )
+{
+ return insertAction( new QtxAction( txt, ico, txt, 0, this ), id, index );
+}
+
+void QtxActionSet::removeAction( QAction* a )
+{
+ if ( !mySet.contains( a ) )
+ return;
+
+ mySet.removeAll( a );
+ delete a;
+}
+
+void QtxActionSet::removeAction( const int id )
+{
+ removeAction( action( id ) );
+}
+
+void QtxActionSet::clear()
+{
+ qDeleteAll( mySet );
+ mySet.clear();
+
+ update();
+}
+
+void QtxActionSet::onChanged()
+{
+ if ( !isVisible() )
+ return;
+
+ bool block = signalsBlocked();
+ blockSignals( true );
+ setVisible( false );
+ blockSignals( block );
+}
+
+void QtxActionSet::onActionTriggered( bool )
+{
+ QAction* a = ::qobject_cast<QAction*>( sender() );
+ if ( !a )
+ return;
+
+ int id = actionId( a );
+ if ( id != -1 )
+ emit triggered( id );
+ emit triggered( a );
+}
+
+void QtxActionSet::addedTo( QWidget* w )
+{
+ QtxAction::addedTo( w );
+
+ update( w );
+}
+
+void QtxActionSet::removedFrom( QWidget* w )
+{
+ QtxAction::removedFrom( w );
+
+ update( w );
+}
+
+QAction* QtxActionSet::action( int id ) const
+{
+ QAction* a = 0;
+ for ( ActionList::const_iterator it = mySet.begin(); it != mySet.end() && !a; ++it )
+ {
+ if ( actionId( *it ) == id )
+ a = *it;
+ }
+ return a;
+}
+
+int QtxActionSet::actionId( QAction* a ) const
+{
+ int id = -1;
+ if ( a && a->data().canConvert( QVariant::Int ) )
+ id = a->data().toInt();
+ return id;
+}
+
+void QtxActionSet::setActionId( QAction* a, const int id )
+{
+ if ( !a || id == -1 )
+ return;
+
+ a->setData( id );
+}
+
+int QtxActionSet::generateId() const
+{
+ QMap<int, int> map;
+ for ( ActionList::const_iterator it = mySet.begin(); it != mySet.end(); ++it )
+ map.insert( (*it)->data().toInt(), 0 );
+
+ int id = -2;
+ while ( map.contains( id ) )
+ id--;
+
+ return id;
+}
+
+void QtxActionSet::update()
+{
+ QList<QWidget*> lst = associatedWidgets();
+ for ( QList<QWidget*>::iterator it = lst.begin(); it != lst.end(); ++it )
+ update( *it );
+}
+
+void QtxActionSet::update( QWidget* w )
+{
+ if ( !w )
+ return;
+
+ for ( ActionList::iterator it = mySet.begin(); it != mySet.end(); ++it )
+ w->removeAction( *it );
+
+ if ( !associatedWidgets().contains( w ) )
+ return;
+
+ for ( int i = 0; i < mySet.count(); i++ )
+ {
+ QAction* a = mySet.at( i );
+ w->insertAction( this, a );
+ }
+}
#include "QtxWorkspaceAction.h"
-#include <qpopupmenu.h>
-#include <qworkspace.h>
-#include <qwidgetlist.h>
+#include "QtxWorkspace.h"
+
+#include <QMenu.h>
+#include <QWidgetList>
+#include <QApplication>
/*!
Constructor
*/
-QtxWorkspaceAction::QtxWorkspaceAction( QWorkspace* ws, QObject* parent, const char* name )
-: QtxAction( tr( "Controls windows into workspace" ), tr( "Workspace management" ), 0, parent, name ),
-myFlags( Standard ),
+QtxWorkspaceAction::QtxWorkspaceAction( QtxWorkspace* ws, QObject* parent )
+: QtxActionSet( parent ),
+myFlags( 0 ),
myWorkspace( ws )
{
- myItem.insert( Cascade, new QtxAction( tr( "Arranges the windows as overlapping tiles" ),
- tr( "Cascade" ), 0, this, 0, false ) );
- myItem.insert( Tile, new QtxAction( tr( "Arranges the windows as nonoverlapping tiles" ),
- tr( "Tile" ), 0, this, 0, false ) );
- myItem.insert( HTile, new QtxAction( tr( "Arranges the windows as nonoverlapping horizontal tiles" ),
- tr( "Tile horizontally" ), 0, this, 0, false ) );
- myItem.insert( VTile, new QtxAction( tr( "Arranges the windows as nonoverlapping vertical tiles" ),
- tr( "Tile vertically" ), 0, this, 0, false ) );
-
- connect( myItem[Tile], SIGNAL( activated() ), this, SLOT( tile() ) );
- connect( myItem[Cascade], SIGNAL( activated() ), this, SLOT( cascade() ) );
- connect( myItem[HTile], SIGNAL( activated() ), this, SLOT( tileVertical() ) );
- connect( myItem[VTile], SIGNAL( activated() ), this, SLOT( tileHorizontal() ) );
+ insertAction( new QtxAction( tr( "Arranges the windows as overlapping tiles" ),
+ tr( "Cascade" ), 0, this ), Cascade );
+ insertAction( new QtxAction( tr( "Arranges the windows as nonoverlapping tiles" ),
+ tr( "Tile" ), 0, this ), Tile );
+ insertAction( new QtxAction( tr( "Arranges the windows as nonoverlapping horizontal tiles" ),
+ tr( "Tile horizontally" ), 0, this ), HTile );
+ insertAction( new QtxAction( tr( "Arranges the windows as nonoverlapping vertical tiles" ),
+ tr( "Tile vertically" ), 0, this ), VTile );
+
+ connect( this, SIGNAL( triggered( int ) ), this, SLOT( onTriggered( int ) ) );
+
+ setItems( Standard );
}
/*!
/*!
\return corresponding workspace
*/
-QWorkspace* QtxWorkspaceAction::workspace() const
+QtxWorkspace* QtxWorkspaceAction::workspace() const
{
return myWorkspace;
}
*/
void QtxWorkspaceAction::setItems( const int flags )
{
- if ( !flags || flags == myFlags || !( flags & Operations ) )
+ if ( flags == myFlags )
return;
myFlags = flags;
+
+ uint f = Windows;
+ while ( f )
+ {
+ if ( action( f ) )
+ action( f )->setVisible( myFlags & f );
+ f = f >> 1;
+ }
}
/*!
int QtxWorkspaceAction::accel( const int id ) const
{
int a = 0;
- if ( myItem.contains( id ) )
- a = myItem[id]->accel();
+ if ( action( id ) )
+ a = action( id )->shortcut();
return a;
}
\return icons of item
\param id - item id
*/
-QIconSet QtxWorkspaceAction::iconSet( const int id ) const
+QIcon QtxWorkspaceAction::icon( const int id ) const
{
- QIconSet ico;
- if ( myItem.contains( id ) )
- ico = myItem[id]->iconSet();
+ QIcon ico;
+ if ( action( id ) )
+ ico = action( id )->icon();
return ico;
}
\return menu text of item
\param id - item id
*/
-QString QtxWorkspaceAction::menuText( const int id ) const
+QString QtxWorkspaceAction::text( const int id ) const
{
QString txt;
- if ( myItem.contains( id ) )
- txt = myItem[id]->menuText();
+ if ( action( id ) )
+ txt = action( id )->text();
return txt;
}
QString QtxWorkspaceAction::statusTip( const int id ) const
{
QString txt;
- if ( myItem.contains( id ) )
- txt = myItem[id]->statusTip();
+ if ( action( id ) )
+ txt = action( id )->statusTip();
return txt;
}
*/
void QtxWorkspaceAction::setAccel( const int id, const int a )
{
- if ( myItem.contains( id ) )
- myItem[id]->setAccel( a );
+ if ( action( id ) )
+ action( id )->setShortcut( a );
}
/*!
\param id - item id
\param ico - new icons
*/
-void QtxWorkspaceAction::setIconSet( const int id, const QIconSet& ico )
+void QtxWorkspaceAction::setIcon( const int id, const QIcon& ico )
{
- if ( myItem.contains( id ) )
- myItem[id]->setIconSet( ico );
+ if ( action( id ) )
+ action( id )->setIcon( ico );
}
/*!
\param id - item id
\param txt - new menu text
*/
-void QtxWorkspaceAction::setMenuText( const int id, const QString& txt )
+void QtxWorkspaceAction::setText( const int id, const QString& txt )
{
- if ( myItem.contains( id ) )
- myItem[id]->setMenuText( txt );
+ if ( action( id ) )
+ action( id )->setText( txt );
}
/*!
*/
void QtxWorkspaceAction::setStatusTip( const int id, const QString& txt )
{
- if ( myItem.contains( id ) )
- myItem[id]->setStatusTip( txt );
-}
-
-/*!
- Adds action to widget
- \param wid - widget
-*/
-bool QtxWorkspaceAction::addTo( QWidget* wid )
-{
- return addTo( wid, -1 );
-}
-
-/*!
- Adds action to widget
- \param wid - widget
- \param idx - position
-*/
-bool QtxWorkspaceAction::addTo( QWidget* wid, const int idx )
-{
- if ( !wid || !wid->inherits( "QPopupMenu" ) )
- return false;
-
- QPopupMenu* pm = (QPopupMenu*)wid;
- checkPopup( pm );
-
- if ( myMenu.contains( pm ) )
- return false;
-
- myMenu.insert( pm, QIntList() );
- fillPopup( pm, idx );
-
- connect( pm, SIGNAL( aboutToShow() ), this, SLOT( onAboutToShow() ) );
- connect( pm, SIGNAL( destroyed( QObject* ) ), this, SLOT( onPopupDestroyed( QObject* ) ) );
-
- return true;
-}
-
-/*!
- Removes action from widget
- \param wid - widget
-*/
-bool QtxWorkspaceAction::removeFrom( QWidget* wid )
-{
- if ( !wid || !wid->inherits( "QPopupMenu" ) )
- return false;
-
- QPopupMenu* pm = (QPopupMenu*)wid;
- if ( !myMenu.contains( pm ) )
- return false;
-
- clearPopup( pm );
-
- disconnect( pm, SIGNAL( aboutToShow() ), this, SLOT( onAboutToShow() ) );
- disconnect( pm, SIGNAL( destroyed( QObject* ) ), this, SLOT( onPopupDestroyed( QObject* ) ) );
-
- myMenu.remove( pm );
-
- return true;
+ if ( action( id ) )
+ action( id )->setStatusTip( txt );
}
/*!
*/
void QtxWorkspaceAction::tile()
{
- QWorkspace* ws = workspace();
- if ( !ws )
- return;
-
- ws->tile();
+ QtxWorkspace* ws = workspace();
+ if ( ws )
+ ws->tile();
}
/*!
*/
void QtxWorkspaceAction::cascade()
{
- QWorkspace* ws = workspace();
+ QtxWorkspace* ws = workspace();
if ( !ws )
return;
int h = ws->height();
QWidgetList winList = ws->windowList();
- for ( QWidgetListIt it( winList ); it.current(); ++it )
- it.current()->resize( int( w * 0.8 ), int( h * 0.8 ) );
+ for ( QWidgetList::iterator it = winList.begin(); it != winList.end(); ++it )
+ (*it)->resize( int( w * 0.8 ), int( h * 0.8 ) );
}
/*!
*/
void QtxWorkspaceAction::tileVertical()
{
- QWorkspace* wrkSpace = workspace();
- if ( !wrkSpace )
- return;
-
- QWidgetList winList = wrkSpace->windowList();
- if ( winList.isEmpty() )
- return;
-
- int count = 0;
- for ( QWidgetListIt itr( winList ); itr.current(); ++itr )
- if ( !itr.current()->testWState( WState_Minimized ) )
- count++;
-
- if ( !count )
- return;
-
- int y = 0;
-
- int heightForEach = wrkSpace->height() / count;
- for ( QWidgetListIt it( winList ); it.current(); ++it )
- {
- QWidget* win = it.current();
- if ( win->testWState( WState_Minimized ) )
- continue;
-
- if ( win->testWState( WState_Maximized ) )
- {
- win->hide();
- win->showNormal();
- }
- int prefH = win->minimumHeight() + win->parentWidget()->baseSize().height();
- int actualH = QMAX( heightForEach, prefH );
-
- win->parentWidget()->setGeometry( 0, y, wrkSpace->width(), actualH );
- y += actualH;
- }
+ QtxWorkspace* ws = workspace();
+ if ( ws )
+ ws->tileVertical();
}
/*!
*/
void QtxWorkspaceAction::tileHorizontal()
{
- QWorkspace* wrkSpace = workspace();
- if ( !wrkSpace )
- return;
-
- QWidgetList winList = wrkSpace->windowList();
- if ( winList.isEmpty() )
- return;
-
- int count = 0;
- for ( QWidgetListIt itr( winList ); itr.current(); ++itr )
- if ( !itr.current()->testWState( WState_Minimized ) )
- count++;
-
- if ( !count )
- return;
-
- int x = 0;
- int widthForEach = wrkSpace->width() / count;
- for ( QWidgetListIt it( winList ); it.current(); ++it )
- {
- QWidget* win = it.current();
- if ( win->testWState( WState_Minimized ) )
- continue;
-
- if ( win->testWState( WState_Maximized ) )
- {
- win->hide();
- win->showNormal();
- }
- int prefW = win->minimumWidth();
- int actualW = QMAX( widthForEach, prefW );
-
- win->parentWidget()->setGeometry( x, 0, actualW, wrkSpace->height() );
- x += actualW;
- }
+ QtxWorkspace* ws = workspace();
+ if ( ws )
+ ws->tileHorizontal();
}
-/*!
- SLOT: called just before the popup menu is displayed, updates popup
-*/
-void QtxWorkspaceAction::onAboutToShow()
+void QtxWorkspaceAction::addedTo( QWidget* w )
{
- const QObject* obj = sender();
- if ( !obj || !obj->inherits( "QPopupMenu" ) )
- return;
+ QtxActionSet::addedTo( w );
- updatePopup( (QPopupMenu*)obj );
+ QMenu* pm = ::qobject_cast<QMenu*>( w );
+ if ( pm )
+ connect( pm, SIGNAL( aboutToShow() ), this, SLOT( onAboutToShow() ) );
}
-/*!
- SLOT: called when popup menu is destroyed, removes it from menu
-*/
-void QtxWorkspaceAction::onPopupDestroyed( QObject* obj )
+void QtxWorkspaceAction::removedFrom( QWidget* w )
{
- myMenu.remove( (QPopupMenu*)obj );
-}
-
-/*!
- Updates popup
- \param pm - popup menu
-*/
-void QtxWorkspaceAction::checkPopup( QPopupMenu* pm )
-{
- if ( !myMenu.contains( pm ) )
- return;
-
- QIntList updList;
- for ( QIntList::const_iterator it = myMenu[pm].begin(); it != myMenu[pm].end(); ++it )
- {
- if ( pm->indexOf( *it ) != -1 )
- updList.append( *it );
- }
-
- myMenu.remove( pm );
+ QtxActionSet::removedFrom( w );
- if ( !updList.isEmpty() )
- myMenu.insert( pm, updList );
- else
- {
+ QMenu* pm = ::qobject_cast<QMenu*>( w );
+ if ( pm )
disconnect( pm, SIGNAL( aboutToShow() ), this, SLOT( onAboutToShow() ) );
- disconnect( pm, SIGNAL( destroyed( QObject* ) ), this, SLOT( onPopupDestroyed( QObject* ) ) );
- }
}
/*!
- Clears and refills popup and updates state of actions
- \param pm - popup menu
+ Refills actions and updates thier state.
*/
-void QtxWorkspaceAction::updatePopup( QPopupMenu* pm )
+void QtxWorkspaceAction::updateContent()
{
- if ( !myMenu.contains( pm ) )
- return;
-
- fillPopup( pm, clearPopup( pm ) );
-
bool count = workspace() ? workspace()->windowList().count() : 0;
- myItem[Cascade]->setEnabled( count );
- myItem[Tile]->setEnabled( count );
- myItem[HTile]->setEnabled( count );
- myItem[VTile]->setEnabled( count );
-}
-
-/*!
- Clears popup
- \param pm - popup menu
-*/
-int QtxWorkspaceAction::clearPopup( QPopupMenu* pm )
-{
- if ( !myMenu.contains( pm ) )
- return -1;
-
- int idx = -1;
- const QIntList& lst = myMenu[pm];
- for ( QIntList::const_iterator it = lst.begin(); it != lst.end() && idx == -1; ++it )
- idx = pm->indexOf( *it );
+ action( Cascade )->setEnabled( count );
+ action( Tile )->setEnabled( count );
+ action( HTile )->setEnabled( count );
+ action( VTile )->setEnabled( count );
- for ( ItemMap::ConstIterator mit = myItem.begin(); mit != myItem.end(); ++mit )
- mit.data()->removeFrom( pm );
-
- for ( QIntList::const_iterator itr = lst.begin(); itr != lst.end(); ++itr )
- pm->removeItem( *itr );
-
- return idx;
+ updateWindows();
}
-/*!
- Fills popup with items
- \param pm - popup menu
- \param idx - position
-*/
-void QtxWorkspaceAction::fillPopup( QPopupMenu* pm, const int idx )
+void QtxWorkspaceAction::updateWindows()
{
- if ( !pm )
+ QtxWorkspace* ws = workspace();
+ if ( !ws )
return;
- int index = idx < 0 ? pm->count() : QMIN( (int)pm->count(), idx );
+ QList<QAction*> lst = actions();
+ for ( QList<QAction*>::iterator it = lst.begin(); it != lst.end(); ++it )
+ {
+ int id = actionId( *it );
+ if ( id >= Windows )
+ removeAction( *it );
+ }
- myMenu.insert( pm, QIntList() );
- QIntList& lst = myMenu[pm];
+ bool base = action( Cascade )->isVisible() || action( Tile )->isVisible() ||
+ action( HTile )->isVisible() || action( VTile )->isVisible();
- for ( ItemMap::ConstIterator mit = myItem.begin(); mit != myItem.end(); ++mit )
+ QList<QAction*> items;
+ QMap<QAction*, int> map;
+ if ( hasItems( Windows ) )
{
- if ( !hasItems( mit.key() ) )
- continue;
+ int index = 1;
+ QWidgetList wList = ws->windowList();
+ for ( QWidgetList::iterator it = wList.begin(); it != wList.end(); ++it, index++ )
+ {
+ QWidget* wid = *it;
+ QAction* a = new QtxAction( wid->windowTitle(), wid->windowTitle(), 0, this, true );
+ a->setChecked( wid == ws->activeWindow() );
+ items.append( a );
+ map.insert( a, Windows + index );
+ }
- mit.data()->addTo( pm, index );
- lst.append( pm->idAt( index++ ) );
+ if ( base && !items.isEmpty() )
+ {
+ QAction* sep = new QtxAction( this );
+ sep->setSeparator( true );
+ items.prepend( sep );
+ map.insert( sep, Windows );
+ }
}
- QWorkspace* ws = workspace();
- if ( !ws || !hasItems( Windows ) )
- return;
-
- QWidgetList wList = ws->windowList();
- if ( wList.isEmpty() )
- return;
+ if ( !items.isEmpty() )
+ insertActions( items );
- lst.append( pm->insertSeparator( index++ ) );
+ for ( QMap<QAction*, int>::const_iterator itr = map.begin(); itr != map.end(); ++itr )
+ setActionId( itr.key(), itr.value() );
+}
- int param = 0;
- pm->setCheckable( true );
- for ( QWidgetListIt it( wList ); it.current(); ++it )
- {
- int id = pm->insertItem( it.current()->caption(), this, SLOT( onItemActivated( int ) ), 0, -1, index++ );
- pm->setItemParameter( id, param++ );
- pm->setItemChecked( id, it.current() == ws->activeWindow() );
- lst.append( id );
- }
+void QtxWorkspaceAction::onAboutToShow()
+{
+ QMenu* pm = ::qobject_cast<QMenu*>( sender() );
+ if ( pm )
+ updateContent();
}
/*!
*/
void QtxWorkspaceAction::onItemActivated( int idx )
{
- QWorkspace* ws = workspace();
+ QtxWorkspace* ws = workspace();
if ( !ws )
return;
wList.at( idx )->setFocus();
}
+
+void QtxWorkspaceAction::onTriggered( int id )
+{
+ if ( id < Windows )
+ perform( id );
+ else
+ {
+ int idx = id - Windows - 1;
+
+ QtxWorkspace* ws = workspace();
+ if ( ws )
+ {
+ QWidgetList wList = ws->windowList();
+ if ( idx >= 0 && idx < (int)wList.count() )
+ wList.at( idx )->setFocus();
+ }
+ }
+}
#include <SUIT_ResourceMgr.h>
#include <QtxWorkspace.h>
-//#include <QtxActionMenuMgr.h>
-//#include <QtxWorkspaceAction.h>
+#include <QtxActionMenuMgr.h>
+#include <QtxWorkspaceAction.h>
#include <QFrame>
#include <QVBoxLayout>
*/
STD_MDIDesktop::STD_MDIDesktop()
: SUIT_Desktop(),
-myWorkspace( 0 )//,
-//myWorkspaceAction( 0 )
+myWorkspace( 0 ),
+myWorkspaceAction( 0 )
{
QFrame* base = new QFrame( this );
QVBoxLayout* main = new QVBoxLayout( base );
}
/*!Call method perform for operation \a type.*/
-void STD_MDIDesktop::windowOperation( const int /*type*/ )
+void STD_MDIDesktop::windowOperation( const int type )
{
- //myWorkspaceAction->perform( operationFlag( type ) );
+ myWorkspaceAction->perform( operationFlag( type ) );
}
/*!Sets window operations by \a first ... parameters.*/
for ( QList<int>::const_iterator it = opList.begin(); it != opList.end(); ++it )
flags = flags | operationFlag( *it );
-// myWorkspaceAction->setItems( flags );
+ myWorkspaceAction->setItems( flags );
}
/*!
*/
void STD_MDIDesktop::createActions()
{
-/*
if ( myWorkspaceAction )
return;
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->setIcon( QtxWorkspaceAction::Cascade,
+ resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_CASCADE" ) ) );
+ myWorkspaceAction->setText( 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->setIcon( QtxWorkspaceAction::Tile,
+ resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_TILE" ) ) );
+ myWorkspaceAction->setText( 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->setIcon( QtxWorkspaceAction::HTile,
+ resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_HTILE" ) ) );
+ myWorkspaceAction->setText( 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->setIcon( QtxWorkspaceAction::VTile,
+ resMgr->loadPixmap( "STD", tr( "ICON_DESK_WINDOW_VTILE" ) ) );
+ myWorkspaceAction->setText( 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, MenuWindowId );
+ int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100 );
mMgr->insert( myWorkspaceAction, winMenuId, -1 );
mMgr->insert( QtxActionMenuMgr::separator(), winMenuId, -1 );
-*/
}
/*!Convert STD_MDIDesktop enumerations to QtxWorkspaceAction.*/
-int STD_MDIDesktop::operationFlag( const int /*type*/ ) const
+int STD_MDIDesktop::operationFlag( const int type ) const
{
int res = 0;
-/*
switch ( type )
{
case Cascade:
res = QtxWorkspaceAction::VTile;
break;
}
-*/
return res;
}