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_RightFrame.h"
36 #include "QAD_LeftFrame.h"
37 #include "QAD_Splitter.h"
38 #include "QAD_Application.h"
39 #include "QAD_Desktop.h"
40 #include "QAD_Study.h"
41 #include "QAD_ObjectBrowser.h"
42 #include "QAD_PyInterp.h"
44 #include <qvaluelist.h>
51 QAD_StudyFrame::QAD_StudyFrame(QAD_Study* theStudy, QWidget* theParent,
52 const QString& theTitle, ViewType theTypeView,
53 QAD_PyInterp*& theInterp, QMutex* theMutex):
54 QMainWindow( theParent , theTitle, WStyle_NormalBorder |
55 WStyle_MinMax | WStyle_SysMenu | WDestructiveClose),
58 myTypeView(theTypeView),
62 setCaption( myTitle );
63 setPalette(QAD_Application::getPalette());
65 mySplitter = new QAD_Splitter( Qt::Horizontal, this);
66 mySplitter->setCompressEnabled( true );
68 setCentralWidget(mySplitter);
69 myLeftFrm = new QAD_LeftFrame(myStudy->getStudyDocument(), mySplitter, theTitle );
70 myRightFrm = new QAD_RightFrame( mySplitter, theTitle, myTypeView, myInterp, theMutex);
72 QValueList<int> sizes;
73 sizes.append( (int)(0.30*QAD_Application::getDesktop()->getMainFrame()->width()) );
74 sizes.append( (int)(0.50*QAD_Application::getDesktop()->getMainFrame()->width()) );
75 mySplitter->setSizes( sizes );
77 QAD_ASSERT_DEBUG_ONLY ( theParent->inherits("QWorkspaceP") );
78 QAD_ASSERT ( QObject::connect( (QWorkspaceP*)theParent, SIGNAL(windowActivated(QWidget*)),
79 this, SLOT(onStudyFrameActivated(QWidget*))) );
86 QAD_StudyFrame::~QAD_StudyFrame()
91 Returns the rightframe of this frame
93 QAD_RightFrame* QAD_StudyFrame::getRightFrame() const
99 Returns the leftframe of this frame
101 QAD_LeftFrame* QAD_StudyFrame::getLeftFrame() const
107 Returns 'true' if studyframe is visible
109 void QAD_StudyFrame::setVisible( bool visible )
111 if ( visible == isVisible() )
114 if ( visible ) show();
119 Called when StudyFrame is about to close
121 void QAD_StudyFrame::closeEvent(QCloseEvent* e)
123 if ( IsPyLocked() ) {
128 emit sfStudyFrameClosing(this);
134 void QAD_StudyFrame::compressLeft()
136 mySplitter->compress(myLeftFrm);
139 void QAD_StudyFrame::compressRight()
141 mySplitter->compress(myRightFrm);
144 void QAD_StudyFrame::unCompressLeft()
146 mySplitter->unCompress(myLeftFrm);
149 void QAD_StudyFrame::unCompressRight()
151 mySplitter->unCompress(myRightFrm);
155 Returns the title of studyframe
157 const QString& QAD_StudyFrame::title() const
163 Sets the new title of studyframe
165 void QAD_StudyFrame::setTitle( const QString& title )
168 setCaption( myTitle );
172 Returns the entry of studyframe
174 const QString& QAD_StudyFrame::entry() const
180 Sets the new entru of studyframe
182 void QAD_StudyFrame::setEntry( const QString& entry )
187 ViewType QAD_StudyFrame::getTypeView() const
193 The slot is called when a studyframe is activated
195 void QAD_StudyFrame::onStudyFrameActivated ( QWidget* activeWindow )
197 emit sfStudyFrameActivated( (QAD_StudyFrame*) activeWindow );
201 Returns the Python interpreter that belongs to this study
203 QAD_PyInterp* QAD_StudyFrame::get_PyInterp(void)