2 // File : QAD_StudyFrame.cxx
3 // Created : Sun Jul 22 15:31:59 2001
4 // Author : Nicolas REJNERI
7 // Copyright : Open CASCADE
11 \class QAD_StudyFrame QAD_StudyFrame.h
12 \brief Frame window which contains QAD_LeftFrame and QAD_RightFrame.
15 #include "QAD_StudyFrame.h"
16 #include "QAD_RightFrame.h"
17 #include "QAD_LeftFrame.h"
18 #include "QAD_Application.h"
19 #include "QAD_Desktop.h"
20 #include "QAD_Study.h"
21 #include "QAD_ObjectBrowser.h"
22 #include <qvaluelist.h>
27 QAD_StudyFrame::QAD_StudyFrame(QAD_Study* study, QWidget* parent, const QString& title,
28 QAD_PyInterp* interp, ViewType typeView) :
29 QMainWindow( parent , title, WStyle_NormalBorder |
30 WStyle_MinMax | WStyle_SysMenu | WDestructiveClose),
33 myTypeView = typeView;
35 setCaption( myTitle );
36 setPalette(QAD_Application::getPalette());
41 s1 = new QAD_Splitter( Qt::Horizontal, this);
42 s1->setCompressEnabled( true );
44 setCentralWidget( s1 );
45 myLeftFrm = new QAD_LeftFrame(study->getStudyDocument(), s1 , title );
46 myRightFrm = new QAD_RightFrame( s1, title, _interp, myTypeView);
48 QValueList<int> sizes;
49 sizes.append( 0.30*QAD_Application::getDesktop()->getMainFrame()->width() );
50 sizes.append( 0.50*QAD_Application::getDesktop()->getMainFrame()->width() );
51 s1->setSizes( sizes );
53 QAD_ASSERT_DEBUG_ONLY ( parent->inherits("QWorkspaceP") );
54 QAD_ASSERT ( QObject::connect( (QWorkspaceP*)parent, SIGNAL(windowActivated(QWidget*)),
55 this, SLOT(onStudyFrameActivated(QWidget*))) );
61 QAD_StudyFrame::QAD_StudyFrame(QAD_Study* study, QWidget* parent ) :
62 QMainWindow ( parent ),
70 QAD_StudyFrame::~QAD_StudyFrame()
75 Returns the rightframe of this frame
77 QAD_RightFrame* QAD_StudyFrame::getRightFrame() const
83 Returns the leftframe of this frame
85 QAD_LeftFrame* QAD_StudyFrame::getLeftFrame() const
91 Returns 'true' if studyframe is visible
93 void QAD_StudyFrame::setVisible( bool visible )
95 if ( visible == isVisible() )
98 if ( visible ) show();
103 Called when StudyFrame is about to close
105 void QAD_StudyFrame::closeEvent(QCloseEvent* e)
107 emit sfBeforeStudyFrameClosing(this);
108 emit sfStudyFrameClosing(this);
114 void QAD_StudyFrame::compressLeft()
116 s1->compress(myLeftFrm);
119 void QAD_StudyFrame::compressRight()
121 s1->compress(myRightFrm);
124 void QAD_StudyFrame::unCompressLeft()
126 s1->unCompress(myLeftFrm);
129 void QAD_StudyFrame::unCompressRight()
131 s1->unCompress(myRightFrm);
135 Returns the title of studyframe
137 const QString& QAD_StudyFrame::title() const
143 Sets the new title of studyframe
145 void QAD_StudyFrame::setTitle( const QString& title )
148 setCaption( myTitle );
152 Returns the entry of studyframe
154 const QString& QAD_StudyFrame::entry() const
160 Sets the new entru of studyframe
162 void QAD_StudyFrame::setEntry( const QString& entry )
167 ViewType QAD_StudyFrame::getTypeView() const
173 The slot is called when a studyframe is activated
175 void QAD_StudyFrame::onStudyFrameActivated ( QWidget* activeWindow )
177 emit sfStudyFrameActivated( (QAD_StudyFrame*) activeWindow );
181 Returns the Python interpreter that belongs to this study
183 QAD_PyInterp* QAD_StudyFrame::get_PyInterp(void)