Version: 6.3.1
Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes

SMESHGUI_Operation Class Reference

#include <SMESHGUI_Operation.h>

Inheritance diagram for SMESHGUI_Operation:
Inheritance graph
[legend]

Public Member Functions

 SMESHGUI_Operation ()
virtual ~SMESHGUI_Operation ()

Protected Slots

virtual void onOk ()
virtual bool onApply ()
virtual void onCancel ()
void onHelp ()

Protected Member Functions

virtual void initDialog ()
 sets the dialog widgets to state just after operation start
virtual void startOperation ()
virtual bool isReadyToStart () const
virtual void setIsApplyAndClose (const bool theFlag)
virtual bool isApplyAndClose () const
virtual void setDialogActive (const bool)
 Set according dialog active or inactive.
SMESHGUIgetSMESHGUI () const
bool isStudyLocked (const bool=true) const
 Verifies whether study of operation is locked.
 _PTR (Study) studyDS() const
virtual bool isValid (SUIT_Operation *) const
 Verifies whether given operator is valid for this one.

Protected Attributes

QString myHelpFileName
bool myIsApplyAndClose

Detailed Description

Definition at line 46 of file SMESHGUI_Operation.h.


Constructor & Destructor Documentation

SMESHGUI_Operation::SMESHGUI_Operation ( )

Definition at line 51 of file SMESHGUI_Operation.cxx.

References myHelpFileName.

SMESHGUI_Operation::~SMESHGUI_Operation ( ) [virtual]

Definition at line 62 of file SMESHGUI_Operation.cxx.

{
}

Member Function Documentation

SMESHGUI_Operation._PTR ( Study  ) const [protected]
SMESHGUI * SMESHGUI_Operation::getSMESHGUI ( ) const [protected]
void SMESHGUI_Operation::initDialog ( ) [protected, virtual]

sets the dialog widgets to state just after operation start

Reimplemented in SMESHGUI_PrecomputeOp, SMESHGUI_MeshOrderOp, and SMESHGUI_SelectionOp.

Definition at line 215 of file SMESHGUI_Operation.cxx.

Referenced by startOperation().

{
}
bool SMESHGUI_Operation::isApplyAndClose ( ) const [protected, virtual]
bool SMESHGUI_Operation::isReadyToStart ( ) const [protected, virtual]

Definition at line 115 of file SMESHGUI_Operation.cxx.

References getSMESHGUI(), and isStudyLocked().

{
  if ( !LightApp_Operation::isReadyToStart() )
    return false;
  else if ( getSMESHGUI() == 0 )
  {
    SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
                              tr( "NO_MODULE" ) );
    return false;
  }
  else if ( isStudyLocked() )
    return false;

  return true;
}
bool SMESHGUI_Operation::isStudyLocked ( const bool  theMess = true) const [protected]

Verifies whether study of operation is locked.

Parameters:
theMess- specifies whether message box must be shown if study is locked
Returns:
State of study.

Verifies whether study of operation is locked. If second parameter is TRUE and study is locked when corresponding message box appears

Definition at line 247 of file SMESHGUI_Operation.cxx.

References SMESHGUI.desktop().

Referenced by isReadyToStart(), SMESHGUI_MeshOp.onApply(), SMESHGUI_MakeNodeAtPointOp.onApply(), SMESHGUI_Make2DFrom3DOp.onApply(), and SMESHGUI_GroupOnShapeOp.onApply().

{
  if ( studyDS() )
  {
    if ( studyDS()->GetProperties()->IsLocked() )
    {
      if ( theMess )
        SUIT_MessageBox::warning( SMESHGUI::desktop(), tr( "WRN_WARNING" ),
                                  tr( "WRN_STUDY_LOCKED" ) );
      return true;
    }
  }

  return false;
}
bool SMESHGUI_Operation::isValid ( SUIT_Operation *  theOtherOp) const [protected, virtual]

Verifies whether given operator is valid for this one.

Parameters:
theOtherOp- other operation
Returns:
Returns TRUE if the given operator is valid for this one, FALSE otherwise

Virtual method redefined from base class verifies whether given operator is valid for this one (i.e. can be started "above" this operator). In current implementation method retuns false if theOtherOp operation is not intended for deleting objects or mesh elements.

Reimplemented in SMESHGUI_BaseComputeOp, and SMESHGUI_MeshOp.

Definition at line 273 of file SMESHGUI_Operation.cxx.

{
  static QStringList anOps;
  if ( anOps.count() == 0 )
  {
    anOps.append( "SMESHGUI_DeleteOp" );
    // to do add other operations here
  }

  return ( theOtherOp &&
         ( ( theOtherOp->inherits("SMESHGUI_Operation") && ( !anOps.contains(theOtherOp->metaObject()->className() ) || anOps.contains(metaObject()->className()) ) ) ||
           ( theOtherOp->inherits("LightApp_ShowHideOp") ) ) );

  return true;
}
bool SMESHGUI_Operation::onApply ( ) [protected, virtual, slot]
void SMESHGUI_Operation::onCancel ( ) [protected, virtual, slot]

Reimplemented in SMESHGUI_PrecomputeOp, and SMESHGUI_MeshOrderOp.

Definition at line 182 of file SMESHGUI_Operation.cxx.

Referenced by startOperation(), and SMESHGUI_BaseComputeOp.startOperation().

{
  abort();
}
void SMESHGUI_Operation::onHelp ( ) [protected, slot]

Definition at line 191 of file SMESHGUI_Operation.cxx.

References getSMESHGUI(), and myHelpFileName.

Referenced by startOperation(), and SMESHGUI_PrecomputeOp.startOperation().

{
  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
  if (app)
    app->onHelpContextModule(getSMESHGUI() ? app->moduleName(getSMESHGUI()->moduleName()) : QString(""), myHelpFileName);
  else {
    QString platform;
#ifdef WIN32
    platform = "winapplication";
#else
    platform = "application";
#endif
    SUIT_MessageBox::warning( desktop(), tr("WRN_WARNING"),
                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
                              arg(app->resourceMgr()->stringValue("ExternalBrowser",
                                                                  platform)).
                              arg(myHelpFileName) );
  }
}
void SMESHGUI_Operation::onOk ( ) [protected, virtual, slot]

Definition at line 159 of file SMESHGUI_Operation.cxx.

References onApply(), and setIsApplyAndClose().

Referenced by startOperation(), and SMESHGUI_PrecomputeOp.startOperation().

{
  setIsApplyAndClose( true );
  if( onApply() )
    commit();
  setIsApplyAndClose( false );
  //else
  //  abort();
}
void SMESHGUI_Operation::setDialogActive ( const bool  active) [protected, virtual]

Set according dialog active or inactive.

Definition at line 135 of file SMESHGUI_Operation.cxx.

References ex13_hole1partial.d, and SMESHGUI_Dialog.setContentActive().

{
  LightApp_Operation::setDialogActive( active );

  SMESHGUI_Dialog* d = dynamic_cast<SMESHGUI_Dialog*>( dlg() );
  if( d )
    d->setContentActive( active );

}
void SMESHGUI_Operation::setIsApplyAndClose ( const bool  theFlag) [protected, virtual]

Definition at line 224 of file SMESHGUI_Operation.cxx.

References myIsApplyAndClose.

Referenced by onOk().

{
  myIsApplyAndClose = theFlag;
}
void SMESHGUI_Operation::startOperation ( ) [protected, virtual]

Reimplemented in SMESHGUI_BaseComputeOp, SMESHGUI_ComputeOp, SMESHGUI_PrecomputeOp, SMESHGUI_EvaluateOp, SMESHGUI_ConvToQuadOp, SMESHGUI_FindElemByPointOp, SMESHGUI_GroupOnShapeOp, SMESHGUI_Make2DFrom3DOp, SMESHGUI_MakeNodeAtPointOp, SMESHGUI_MeshOp, SMESHGUI_MeshOrderOp, SMESHGUI_SelectionOp, and SMESHGUI_ShapeByMeshOp.

Definition at line 79 of file SMESHGUI_Operation.cxx.

References initDialog(), onApply(), onCancel(), onHelp(), and onOk().

{
  if( dlg() )
  {
    disconnect( dlg(), SIGNAL( dlgOk() ), this, SLOT( onOk() ) );
    disconnect( dlg(), SIGNAL( dlgApply() ), this, SLOT( onApply() ) );
    disconnect( dlg(), SIGNAL( dlgCancel() ), this, SLOT( onCancel() ) );
    disconnect( dlg(), SIGNAL( dlgClose() ), this, SLOT( onCancel() ) );
    disconnect( dlg(), SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );

    if( dlg()->testButtonFlags( QtxDialog::OK ) )
      connect( dlg(), SIGNAL( dlgOk() ), this, SLOT( onOk() ) );

    if( dlg()->testButtonFlags( QtxDialog::Apply ) )
      connect( dlg(), SIGNAL( dlgApply() ), this, SLOT( onApply() ) );

    if( dlg()->testButtonFlags( QtxDialog::Cancel ) )
      connect( dlg(), SIGNAL( dlgCancel() ), this, SLOT( onCancel() ) );

    if( dlg()->testButtonFlags( QtxDialog::Help ) )
      connect( dlg(), SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );

    //if( dlg()->testButtonFlags( QtxDialog::Close ) )
    //if dialog hasn't close, cancel, no and etc buttons, dlgClose will be emitted when dialog is closed not by OK
    connect( dlg(), SIGNAL( dlgClose() ), this, SLOT( onCancel() ) );

    initDialog();
  }

  LightApp_Operation::startOperation();
}

Field Documentation

QString SMESHGUI_Operation.myHelpFileName [protected]

Definition at line 75 of file SMESHGUI_Operation.h.

Referenced by isApplyAndClose(), and setIsApplyAndClose().

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS