Salome HOME
This commit was generated by cvs2git to create tag 'V1_4_0b2'.
[modules/kernel.git] / src / SALOME_PYQT / SalomePyQt.cxx
1 //  Copyright (C) 2003  CEA/DEN, EDF R&D
2 //
3 //
4 //
5 //  File   : SalomePyQt.cxx
6 //  Module : SALOME
7
8 using namespace std;
9 #include "SalomePyQt.hxx"
10
11 #include "QAD_Application.h"
12 #include "QAD_Desktop.h"
13 #include "QAD_Study.h"
14 #include "QAD_FileDlg.h"
15
16 #include "QAD_Config.h"
17 #include "QAD_Settings.h"
18
19 QWidget* SalomePyQt::getDesktop()
20 {
21   return (QWidget*)(QAD_Application::getDesktop());
22 }
23
24 QWorkspace* SalomePyQt::getMainFrame()
25 {
26   return (QWorkspace*)(QAD_Application::getDesktop()->getMainFrame());
27 }
28
29 QMenuBar* SalomePyQt::getMainMenuBar() 
30 {
31   return (QMenuBar*)(QAD_Application::getDesktop()->getMainMenuBar());
32 }
33
34 int SalomePyQt::getStudyId()
35 {
36   return QAD_Application::getDesktop()->getActiveApp()->getActiveStudy()->getStudyId();
37 }
38
39 SALOME_Selection* SalomePyQt::getSelection()
40 {
41   return SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveApp()->getActiveStudy()->getSelection());
42 }
43
44 void SalomePyQt::putInfo( const QString& msg )
45 {
46   QAD_Application::getDesktop()->putInfo(msg);
47 }
48
49 void SalomePyQt::putInfo( const QString& msg, int ms )
50 {
51   QAD_Application::getDesktop()->putInfo(msg, ms);
52 }
53
54 void SalomePyQt::updateObjBrowser( int studyId, bool updateSelection)
55 {  
56   QList<QAD_Study>& studies = QAD_Application::getDesktop()->getActiveApp()->getStudies();
57   for ( QAD_Study* study = studies.first(); study; study = studies.next() )  {
58     if ( study->getStudyId() == studyId ) {
59       study->updateObjBrowser( updateSelection );
60       break;
61     }
62   }
63 }
64
65 const QString& SalomePyQt::getActiveComponent()
66 {
67   return QAD_Application::getDesktop()->getActiveComponent();
68 }
69
70 void SalomePyQt::addStringSetting(QString _name, QString _value, bool _autoValue)
71 {
72   QAD_CONFIG->addSetting(_name, _value, _autoValue);
73 }
74
75 void SalomePyQt::addIntSetting(QString _name, int _value, bool _autoValue)
76 {
77   QAD_CONFIG->addSetting(_name, _value, _autoValue);
78 }
79
80 void SalomePyQt::addDoubleSetting(QString _name, double _value, bool _autoValue)
81 {
82   QAD_CONFIG->addSetting(_name, _value, _autoValue);
83 }
84
85 bool SalomePyQt::removeSettings(QString name)
86 {
87   return QAD_CONFIG->removeSettings( name );
88 }
89
90 QString SalomePyQt::getSetting(QString name)
91 {
92   return QAD_CONFIG->getSetting(name);
93 }
94
95 QString SalomePyQt::getFileName(QWidget*           parent, 
96                                 const QString&     initial, 
97                                 const QStringList& filters, 
98                                 const QString&     caption,
99                                 bool               open)
100 {
101   return QAD_FileDlg::getFileName(parent, initial, filters, caption, open);
102 }
103
104 QString SalomePyQt::getExistingDirectory(QWidget*       parent,
105                                          const QString& initial,
106                                          const QString& caption)
107 {
108   return QAD_FileDlg::getExistingDirectory(parent, initial, caption);
109 }
110
111 void SalomePyQt::helpContext(const QString& source, const QString& context) {
112   //QAD_Application::getDesktop()->helpContext(source, context);
113 }