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
31 \class QAD_StudyFrame QAD_StudyFrame.h
32 \brief Frame window which contains QAD_LeftFrame and QAD_RightFrame.
35 #include "QAD_StudyFrame.h"
36 #include "QAD_RightFrame.h"
37 #include "QAD_LeftFrame.h"
38 #include "QAD_Application.h"
39 #include "QAD_Desktop.h"
40 #include "QAD_Study.h"
41 #include "QAD_ObjectBrowser.h"
42 #include <qvaluelist.h>
47 QAD_StudyFrame::QAD_StudyFrame(QAD_Study* study, QWidget* parent, const QString& title,
48 QAD_PyInterp* interp, ViewType typeView) :
49 QMainWindow( parent , title, WStyle_NormalBorder |
50 WStyle_MinMax | WStyle_SysMenu | WDestructiveClose),
53 myTypeView = typeView;
55 setCaption( myTitle );
56 setPalette(QAD_Application::getPalette());
61 s1 = new QAD_Splitter( Qt::Horizontal, this);
62 s1->setCompressEnabled( true );
64 setCentralWidget( s1 );
65 myLeftFrm = new QAD_LeftFrame(study->getStudyDocument(), s1 , title );
66 myRightFrm = new QAD_RightFrame( s1, title, _interp, myTypeView);
68 QValueList<int> sizes;
69 sizes.append( (int)(0.30*QAD_Application::getDesktop()->getMainFrame()->width()) );
70 sizes.append( (int)(0.50*QAD_Application::getDesktop()->getMainFrame()->width()) );
71 s1->setSizes( sizes );
73 QAD_ASSERT_DEBUG_ONLY ( parent->inherits("QWorkspaceP") );
74 QAD_ASSERT ( QObject::connect( (QWorkspaceP*)parent, SIGNAL(windowActivated(QWidget*)),
75 this, SLOT(onStudyFrameActivated(QWidget*))) );
81 QAD_StudyFrame::QAD_StudyFrame(QAD_Study* study, QWidget* parent ) :
82 QMainWindow ( parent ),
90 QAD_StudyFrame::~QAD_StudyFrame()
95 Returns the rightframe of this frame
97 QAD_RightFrame* QAD_StudyFrame::getRightFrame() const
103 Returns the leftframe of this frame
105 QAD_LeftFrame* QAD_StudyFrame::getLeftFrame() const
111 Returns 'true' if studyframe is visible
113 void QAD_StudyFrame::setVisible( bool visible )
115 if ( visible == isVisible() )
118 if ( visible ) show();
123 Called when StudyFrame is about to close
125 void QAD_StudyFrame::closeEvent(QCloseEvent* e)
127 emit sfBeforeStudyFrameClosing(this);
128 emit sfStudyFrameClosing(this);
134 void QAD_StudyFrame::compressLeft()
136 s1->compress(myLeftFrm);
139 void QAD_StudyFrame::compressRight()
141 s1->compress(myRightFrm);
144 void QAD_StudyFrame::unCompressLeft()
146 s1->unCompress(myLeftFrm);
149 void QAD_StudyFrame::unCompressRight()
151 s1->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)