1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : QAD_StudyFrame.cxx
25 // Author : Nicolas REJNERI
30 \class QAD_StudyFrame QAD_StudyFrame.h
31 \brief Frame window which contains QAD_LeftFrame and QAD_RightFrame.
34 #include "QAD_StudyFrame.h"
35 #include "QAD_StudyFrame.h"
36 #include "QAD_RightFrame.h"
37 #include "QAD_LeftFrame.h"
38 #include "QAD_Splitter.h"
39 #include "QAD_Application.h"
40 #include "QAD_Desktop.h"
41 #include "QAD_Study.h"
42 #include "QAD_ObjectBrowser.h"
43 #include "QAD_PyInterp.h"
45 #include <qvaluelist.h>
52 QAD_StudyFrame::QAD_StudyFrame(QAD_Study* theStudy, QWidget* theParent,
53 const QString& theTitle, ViewType theTypeView,
54 QAD_PyInterp*& theInterp, QMutex* theMutex):
55 QMainWindow( theParent , theTitle, WStyle_NormalBorder |
56 WStyle_MinMax | WStyle_SysMenu | WDestructiveClose),
59 myTypeView(theTypeView),
63 setCaption( myTitle );
64 setPalette(QAD_Application::getPalette());
66 mySplitter = new QAD_Splitter( Qt::Horizontal, this);
67 mySplitter->setCompressEnabled( true );
69 setCentralWidget(mySplitter);
70 myLeftFrm = new QAD_LeftFrame(myStudy->getStudyDocument(), mySplitter, theTitle );
71 myRightFrm = new QAD_RightFrame( mySplitter, theTitle, myTypeView, myInterp, theMutex);
73 QValueList<int> sizes;
74 sizes.append( (int)(0.30*QAD_Application::getDesktop()->getMainFrame()->width()) );
75 sizes.append( (int)(0.50*QAD_Application::getDesktop()->getMainFrame()->width()) );
76 mySplitter->setSizes( sizes );
78 QAD_ASSERT_DEBUG_ONLY ( theParent->inherits("QWorkspaceP") );
79 QAD_ASSERT ( QObject::connect( (QWorkspaceP*)theParent, SIGNAL(windowActivated(QWidget*)),
80 this, SLOT(onStudyFrameActivated(QWidget*))) );
87 QAD_StudyFrame::~QAD_StudyFrame()
92 Returns the rightframe of this frame
94 QAD_RightFrame* QAD_StudyFrame::getRightFrame() const
100 Returns the leftframe of this frame
102 QAD_LeftFrame* QAD_StudyFrame::getLeftFrame() const
108 Returns 'true' if studyframe is visible
110 void QAD_StudyFrame::setVisible( bool visible )
112 if ( visible == isVisible() )
115 if ( visible ) show();
120 Called when StudyFrame is about to close
122 void QAD_StudyFrame::closeEvent(QCloseEvent* e)
124 if ( IsPyLocked() ) {
129 emit sfStudyFrameClosing(this);
135 void QAD_StudyFrame::compressLeft()
137 QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
142 void QAD_StudyFrame::compressRight()
144 QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
149 void QAD_StudyFrame::unCompressLeft()
151 QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
153 h->unCompressBefore();
156 void QAD_StudyFrame::unCompressRight()
158 QSplitterPHandle* h = mySplitter->getHandleAfter(myLeftFrm);
160 h->unCompressAfter();
163 bool QAD_StudyFrame::isCompressedLeft() const
165 return mySplitter->isCompressed(myLeftFrm);
168 bool QAD_StudyFrame::isCompressedRight() const
170 return mySplitter->isCompressed(myRightFrm);
174 Returns the title of studyframe
176 const QString& QAD_StudyFrame::title() const
182 Sets the new title of studyframe
184 void QAD_StudyFrame::setTitle( const QString& title )
187 setCaption( myTitle );
191 Returns the entry of studyframe
193 const QString& QAD_StudyFrame::entry() const
199 Sets the new entru of studyframe
201 void QAD_StudyFrame::setEntry( const QString& entry )
206 ViewType QAD_StudyFrame::getTypeView() const
212 The slot is called when a studyframe is activated
214 void QAD_StudyFrame::onStudyFrameActivated ( QWidget* activeWindow )
216 emit sfStudyFrameActivated( (QAD_StudyFrame*) activeWindow );
217 getRightFrame()->getViewFrame()->Activate( getStudy() );
221 Returns the Python interpreter that belongs to this study
223 QAD_PyInterp* QAD_StudyFrame::get_PyInterp(void)