1 ///////////////////////////////////////////////////////////
2 // File : SierpinskyGUI.cxx
3 // Author : Vadim SANDLER (OCN)
5 // Copyright (C) 2005 Open CASCADE
6 ///////////////////////////////////////////////////////////
8 #include "SierpinskyGUI.h"
10 #include <SUIT_MessageBox.h>
11 #include <SUIT_ResourceMgr.h>
12 #include <SUIT_Desktop.h>
13 #include <SalomeApp_Application.h>
14 #include <SVTK_ViewModel.h>
15 #include <SALOME_LifeCycleCORBA.hxx>
16 #include <SierpinskyGUI_RunDlg.h>
21 SierpinskyGUI::SierpinskyGUI() :
22 SalomeApp_Module("Sierpinsky")
27 * Gets an reference to the module's engine
29 SIERPINSKY_ORB::SIERPINSKY_ptr SierpinskyGUI::InitSIERPINSKYGen( SalomeApp_Application* app )
31 SIERPINSKY_ORB::SIERPINSKY_ptr clr;
33 Engines::Component_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer","SIERPINSKY" );
34 clr = SIERPINSKY_ORB::SIERPINSKY::_narrow(comp);
36 catch (CORBA::Exception&){
37 MESSAGE("Caught CORBA::Exception.");
40 MESSAGE("Caught unknown exception.");
46 * Module's initialization
48 void SierpinskyGUI::initialize( CAM_Application* app )
50 SalomeApp_Module::initialize( app );
52 InitSIERPINSKYGen( dynamic_cast<SalomeApp_Application*>( app ) );
54 QWidget* aParent = app->desktop();
55 SUIT_ResourceMgr* aResourceMgr = app->resourceMgr();
58 QPixmap aPixmap = aResourceMgr->loadPixmap( "SIERPINSKY",tr( "ICON_RUN_DLG" ) );
59 createAction( 901, tr( "Run Dialog" ), QIcon(aPixmap), tr( "RUN" ), tr( "CAPTION" ), 0, aParent, false,
60 this, SLOT( OnRun() ) );
64 aMenuId = createMenu( tr( "MENU_Sierpinsky" ), -1, -1, 30 );
65 createMenu( 901, aMenuId, 10 );
68 int aToolId = createTool ( tr( "TOOL_Sierpinsky" ) );
69 createTool( 901, aToolId );
75 QString SierpinskyGUI::engineIOR() const
77 CORBA::String_var anIOR = getApp()->orb()->object_to_string( InitSIERPINSKYGen( getApp() ) );
78 return QString( anIOR.in() );
82 * Required dockable windows
84 void SierpinskyGUI::windows( QMap<int, int>& wmap ) const
86 wmap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
90 * Required viewers list
92 void SierpinskyGUI::viewManagers( QStringList& vmlist ) const
94 vmlist.append( SVTK_Viewer::Type() );
100 bool SierpinskyGUI::activateModule( SUIT_Study* theStudy )
102 bool bOk = SalomeApp_Module::activateModule( theStudy );
111 * Module's deactivation
113 bool SierpinskyGUI::deactivateModule( SUIT_Study* theStudy )
118 return SalomeApp_Module::deactivateModule( theStudy );
124 SierpinskyGUI::~SierpinskyGUI()
130 void SierpinskyGUI::OnRun()
132 QWidget* aParent = getApp()->desktop();
133 SierpinskyGUI_RunDlg* aDlg = new SierpinskyGUI_RunDlg( aParent, this );
138 CAM_Module* createModule()
140 return new SierpinskyGUI();