From 58d44a3bf00ef7a3ed419ec2e34792f7fbb2c59a Mon Sep 17 00:00:00 2001 From: stv Date: Fri, 11 Nov 2005 09:40:31 +0000 Subject: [PATCH] no message --- src/CAF/CAF_Application.cxx | 19 +++++++++++++------ src/CAF/CAF_Application.h | 18 ++++++++++-------- src/Qtx/QtxListAction.cxx | 8 ++++++++ src/Qtx/QtxListAction.h | 3 +++ src/SUIT/SUIT_Application.cxx | 12 ++++++++++++ src/SUIT/SUIT_Application.h | 3 +++ 6 files changed, 49 insertions(+), 14 deletions(-) diff --git a/src/CAF/CAF_Application.cxx b/src/CAF/CAF_Application.cxx index 3a069fdcb..db05644cf 100755 --- a/src/CAF/CAF_Application.cxx +++ b/src/CAF/CAF_Application.cxx @@ -160,18 +160,25 @@ void CAF_Application::updateCommandsStatus() cafStudy = (CAF_Study*)activeStudy(); QAction* undo = action( EditUndoId ); - if ( cafStudy && undo->inherits( "QtxListAction" ) ) - ((QtxListAction*)undo)->addNames( cafStudy->undoNames() ); + if ( cafStudy && undo ) + undo->setProperty( "names", cafStudy->undoNames() ); QAction* redo = action( EditRedoId ); - if ( cafStudy && redo->inherits( "QtxListAction" ) ) - ((QtxListAction*)redo)->addNames( cafStudy->redoNames() ); + if ( cafStudy && redo ) + redo->setProperty( "names", cafStudy->redoNames() ); - undo->setEnabled( cafStudy && cafStudy->canUndo() ); - redo->setEnabled( cafStudy && cafStudy->canRedo() ); + if ( undo ) + undo->setEnabled( cafStudy && cafStudy->canUndo() ); + if ( redo ) + redo->setEnabled( cafStudy && cafStudy->canRedo() ); } void CAF_Application::onHelpAbout() { SUIT_MessageBox::info1( desktop(), tr( "About" ), tr( "ABOUT_INFO" ), "&OK" ); } + +SUIT_Study* CAF_Application::createNewStudy() +{ + return new CAF_Study( this ); +} diff --git a/src/CAF/CAF_Application.h b/src/CAF/CAF_Application.h index f5610fe90..8f7300459 100755 --- a/src/CAF/CAF_Application.h +++ b/src/CAF/CAF_Application.h @@ -23,24 +23,26 @@ public: CAF_Application(); virtual ~CAF_Application(); - virtual QString applicationName() const; + virtual QString applicationName() const; public slots: - virtual void onHelpAbout(); + virtual void onHelpAbout(); protected slots: - virtual bool onUndo( int ); - virtual bool onRedo( int ); + virtual bool onUndo( int ); + virtual bool onRedo( int ); protected: enum { EditUndoId = STD_Application::UserID, EditRedoId, UserID }; protected: - virtual void createActions(); - virtual void updateCommandsStatus(); + virtual void createActions(); + virtual void updateCommandsStatus(); - bool undo( CAF_Study* doc ); - bool redo( CAF_Study* doc ); + virtual SUIT_Study* createNewStudy(); + + bool undo( CAF_Study* doc ); + bool redo( CAF_Study* doc ); }; #if defined WIN32 diff --git a/src/Qtx/QtxListAction.cxx b/src/Qtx/QtxListAction.cxx index 329c3d7a8..633fa370a 100755 --- a/src/Qtx/QtxListAction.cxx +++ b/src/Qtx/QtxListAction.cxx @@ -153,6 +153,14 @@ void QtxListAction::setPopupMode( const int mode ) myMode = mode; } +QStringList QtxListAction::names() const +{ + QStringList lst; + if ( myFrame ) + lst = myFrame->names(); + return lst; +} + /*! Name: addNames [public] Desc: Fills the list of actions. Removes the old contents from diff --git a/src/Qtx/QtxListAction.h b/src/Qtx/QtxListAction.h index 64003fe91..8f74210e1 100755 --- a/src/Qtx/QtxListAction.h +++ b/src/Qtx/QtxListAction.h @@ -26,6 +26,8 @@ class QTX_EXPORT QtxListAction : public QtxAction { Q_OBJECT + Q_PROPERTY( QStringList names READ names WRITE addNames ) + class ToolButton; public: @@ -47,6 +49,7 @@ public: int popupMode() const; void setPopupMode( const int ); + QStringList names() const; void addNames( const QStringList&, bool = true ); void setComment( const QString&, const QString& = QString::null ); diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx index 380820055..b0b1cd9d6 100755 --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -257,6 +257,18 @@ void SUIT_Application::setToolShown( const int id, const bool on ) desktop()->toolMgr()->setShown( id, on ); } +void SUIT_Application::setActionShown( QAction* a, const bool on ) +{ + setMenuShown( a, on ); + setToolShown( a, on ); +} + +void SUIT_Application::setActionShown( const int id, const bool on ) +{ + setMenuShown( id, on ); + setToolShown( id, on ); +} + QAction* SUIT_Application::action( const int id ) const { SUIT_Application* that = (SUIT_Application*)this; diff --git a/src/SUIT/SUIT_Application.h b/src/SUIT/SUIT_Application.h index 283d546de..8e5460264 100755 --- a/src/SUIT/SUIT_Application.h +++ b/src/SUIT/SUIT_Application.h @@ -120,6 +120,9 @@ protected: void setToolShown( QAction*, const bool ); void setToolShown( const int, const bool );//@} + void setActionShown( QAction*, const bool ); + void setActionShown( const int, const bool ); + static QAction* separator(); QAction* action( const int ) const; int actionId( const QAction* ) const; -- 2.39.2