3 #include "NewGeom_Module.h"
4 #include "NewGeom_DataModel.h"
6 #include <XGUI_Workshop.h>
8 #include <LightApp_Application.h>
9 #include <OCCViewer_ViewModel.h>
10 #include <SUIT_Desktop.h>
11 #include <QtxActionMenuMgr.h>
15 NewGeom_EXPORT CAM_Module* createModule() {
16 return new NewGeom_Module();
19 NewGeom_EXPORT char* getModuleVersion() {
25 //******************************************************
26 NewGeom_Module::NewGeom_Module()
27 : LightApp_Module( "NewGeom" )
29 myWorkshop = new XGUI_Workshop(this);
32 //******************************************************
33 NewGeom_Module::~NewGeom_Module()
37 //******************************************************
38 void NewGeom_Module::initialize(CAM_Application* theApp)
40 LightApp_Module::initialize(theApp);
42 myWorkshop->startApplication();
45 //******************************************************
46 void NewGeom_Module::windows(QMap<int, int>& theWndMap) const
48 theWndMap.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
51 //******************************************************
52 void NewGeom_Module::viewManagers(QStringList& theList) const
54 theList.append( OCCViewer_Viewer::Type() );
57 //******************************************************
58 bool NewGeom_Module::activateModule(SUIT_Study* theStudy)
60 bool isDone = LightApp_Module::activateModule(theStudy);
68 //******************************************************
69 bool NewGeom_Module::deactivateModule(SUIT_Study* theStudy)
71 setMenuShown( false );
72 setToolShown( false );
73 return LightApp_Module::deactivateModule(theStudy);
76 //******************************************************
77 CAM_DataModel* NewGeom_Module::createDataModel()
79 return new NewGeom_DataModel( this );
82 //******************************************************
83 void NewGeom_Module::addFeature(const QString& theWBName,
85 const QString& theTitle,
86 const QString& theTip,
90 const char* theMember,
91 const QKeySequence& theKeys)
93 int aMenu = createMenu(theWBName, -1, -1, 50);
94 int aTool = createTool(theWBName);
96 int aId = myActionsList.size();
97 myActionsList.append(theId);
98 SUIT_Desktop* aDesk = application()->desktop();
100 for (int i = 0; i < theKeys.count(); i++)
102 createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
103 isCheckable, theReciever, theMember);
104 int aItemId = createMenu( aId, aMenu, -1, 10 );
105 int aToolId = createTool( aId, aTool );
108 //******************************************************
109 void NewGeom_Module::addEditCommand(const QString& theId,
110 const QString& theTitle,
111 const QString& theTip,
112 const QIcon& theIcon,
114 QObject* theReciever,
115 const char* theMember,
116 const QKeySequence& theKeys)
118 int aMenu = createMenu(tr( "MEN_DESK_EDIT" ), -1, -1);
120 int aId = myActionsList.size();
121 myActionsList.append(theId);
122 SUIT_Desktop* aDesk = application()->desktop();
124 for (int i = 0; i < theKeys.count(); i++)
126 createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
127 isCheckable, theReciever, theMember);
128 createMenu( aId, aMenu, 10 );
131 //******************************************************
132 void NewGeom_Module::addEditMenuSeparator()
134 int aMenu = createMenu(tr( "MEN_DESK_EDIT" ), -1, -1);
135 createMenu( separator(), aMenu, -1, 10 );
138 //******************************************************
139 QMainWindow* NewGeom_Module::desktop() const
141 return application()->desktop();
144 //******************************************************
145 QString NewGeom_Module::commandId(const QAction* theCmd) const
147 int aId = actionId(theCmd);
148 if (aId < myActionsList.size())
149 return myActionsList[aId];
153 //******************************************************
154 QAction* NewGeom_Module::command(const QString& theId) const
156 int aId = myActionsList.indexOf(theId);
157 if ((aId != -1) && (aId < myActionsList.size())) {