--- /dev/null
+/*!
+
+\page plot2d_viewer_page Plot 2D viewer
+
+\n <b>Plot 2d viewer</b> is destined to the representation of 2d
+plots and graphs in Post-Pro module.
+\n Its viewer toolbar gives you fast access to the following
+operations:
+
+\image html image77.gif
+<center><b>Dump View</b> - exports an object from the viewer in bmp,
+png, jpg or jpeg image format.</center>
+
+\image html image96.gif
+<center><b>Fit all</b> - scales the display to show the entire
+scene. Use this to resize the scene so that it could fit within the
+Viewer boundary.</center>
+
+\image html image97.gif
+<center><b>Fit area</b> - resizes the view to place in the visible
+area only the contents of a frame drawn with pressed left mouse
+button.</center>
+
+\image html image98.gif
+<center><b>Zoom</b> - allows to zoom in and out.</center>
+
+\image html image99.gif
+<center>\b Panning - if the represented objects are greater that the
+visible area and you don't wish to use Fit all functionality, click on
+this button and you'll be able to drag the scene to see its remote
+parts.</center>
+
+\image html image100.gif
+<center><b>Global panning</b> - allows to define the center of the
+scene presenting all displayed objects in the visible area.</center>
+
+\image html plot2d_points.gif
+<center><b>Draw Points</b> - represents points on the graph.</center>
+
+\image html plot2d_lines.gif
+<center><b>Draw Lines</b> - represents lines on the graph.</center>
+
+\image html plot2d_splines.gif
+<center><b>Draw Splines</b> - represents splines on the graph.</center>
+
+\image html plot2d_logarithmic_horizontal.gif
+<center><b>Horizontal axis logarithmic</b> - changes the scaling on
+horizontal axis to logarithmic.</center>
+
+\image html plot2d_logarithmic_vertical.gif
+<center><b>Vertical axis logarithmic</b> - changes the scaling on vertical
+axis to logarithmic.</center>
+
+\image html plot2d_legend.gif
+<center><b>Show Legend</b> - reveals all verbal and numerical
+information on the graphs.</center>
+
+\image html plot2d_settings.gif
+<center>\b Settings - calls a menu, in which you can specify advanced
+settings for your Plot 2d Viewer.</center>
+
+\image html plot2d_clone.gif
+<center><b>Clone view</b> - opens a new duplicate scene.</center>
+
+\anchor settings
+\n \image html plot2d_view_settings.png
+
+The options are as follows:
+<ul>
+<li><b>Main title:</b> the title of the XY plot. By default, it will
+consist of the names of the tables, on the basis of which the curve
+lines have been constructed.</li>
+<li><b>Curve type:</b> you can select from \b Points, \b Lines and \b Spline.</li>
+<li><b>Show legend:</b> here you can define the position of the
+description table on the XY plot (to the \b Left, to the \b Right, on
+\b Top or on \b Bottom).</li>
+<li><b>Marker size</b> - size of the points (markers) forming curve lines.</li>
+<li><b>Background color</b> of the XY plot.</li>
+<li><b>Scale mode:</b> here you can select the type of scaling (\b
+Linear or \b Logarithmic) along <b>X (Horizontal)</b> or <b>Y (Vertical)</b> axes.</li>
+</ul>
+
+You can define settings for each axis separately:
+<ul>
+<li>\b Horizontal or \b Vertical axis title.</li>
+<li><b>Grid/Axes marks:</b> here you can define the maximum number of major
+and minor scale divisions for a specified axis. The real number of
+intervals fits to {1,2,5}*10^N, where N is a natural number, and
+doesn't exceed the maximum.</li>
+<li><b>Save settings as default:</b> If this check box is marked, all
+XY plots will be displayed with these defined properties.</li>
+</ul>
+
+*/
--- /dev/null
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "OCCViewer_AxialScaleDlg.h"
+#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewPort3d.h"
+
+#include <Standard_Real.hxx>
+
+#include "QtxDblSpinBox.h"
+
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+
+/*!
+ Constructor
+ \param view - view window
+ \param parent - parent widget
+ \param name - dialog name
+ \param modal - is this dialog modal
+ \param fl - flags
+*/
+OCCViewer_AxialScaleDlg::OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow* view, QWidget* parent, const char* name, bool modal, WFlags fl )
+: QDialog( parent, "OCCViewer_AxialScaleDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+ myView( view )
+{
+ setCaption( tr( "DLG_SCALING" ) );
+
+ setSizeGripEnabled(TRUE);
+
+ // Create layout for this dialog
+ QGridLayout* layoutDlg = new QGridLayout (this);
+ layoutDlg->setSpacing(6);
+ layoutDlg->setMargin(11);
+
+ // Create croup box with grid layout
+ QGroupBox* aGroupBox = new QGroupBox(this, "GroupBox");
+ QHBoxLayout* aHBoxLayout = new QHBoxLayout(aGroupBox);
+ aHBoxLayout->setMargin(11);
+ aHBoxLayout->setSpacing(6);
+
+ // "X" scaling
+ QLabel* TextLabelX = new QLabel (tr("LBL_X"), aGroupBox, "TextLabelX");
+ TextLabelX->setFixedWidth(15);
+ m_sbXcoeff = new QtxDblSpinBox(1e-7, RealLast(), 0.1, aGroupBox);
+ m_sbXcoeff->setMinimumWidth(80);
+ m_sbXcoeff->setValue(1.0);
+
+ // "Y" scaling
+ QLabel* TextLabelY = new QLabel (tr("LBL_Y"), aGroupBox, "TextLabelY");
+ TextLabelY->setFixedWidth(15);
+ m_sbYcoeff = new QtxDblSpinBox(1e-7, RealLast(), 0.1, aGroupBox);
+ m_sbYcoeff->setMinimumWidth(80);
+ m_sbYcoeff->setValue(1.0);
+
+ // "Z" scaling
+ QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), aGroupBox, "TextLabelZ");
+ TextLabelZ->setFixedWidth(15);
+ m_sbZcoeff = new QtxDblSpinBox(1e-7, RealLast(), 0.1, aGroupBox);
+ m_sbZcoeff->setMinimumWidth(80);
+ m_sbZcoeff->setValue(1.0);
+
+ // Create <Reset> button
+ m_bReset = new QPushButton(tr("&Reset"), aGroupBox, "m_bReset");
+
+ // Layout widgets in the group box
+ aHBoxLayout->addWidget(TextLabelX);
+ aHBoxLayout->addWidget(m_sbXcoeff);
+ aHBoxLayout->addWidget(TextLabelY);
+ aHBoxLayout->addWidget(m_sbYcoeff);
+ aHBoxLayout->addWidget(TextLabelZ);
+ aHBoxLayout->addWidget(m_sbZcoeff);
+ //aHBoxLayout->addStretch();
+ aHBoxLayout->addWidget(m_bReset);
+
+ // OK, CANCEL, Apply button
+ QGroupBox* aGroupBox2 = new QGroupBox(this);
+ QHBoxLayout* aHBoxLayout2 = new QHBoxLayout(aGroupBox2);
+ aHBoxLayout2->setMargin(11);
+ aHBoxLayout2->setSpacing(6);
+ // Create <OK> button
+ QPushButton* m_bOk = new QPushButton(tr("O&K"), aGroupBox2, "m_bOk");
+ m_bOk->setDefault(TRUE);
+ m_bOk->setAutoDefault(TRUE);
+ // Create <Apply> button
+ QPushButton* m_bApply = new QPushButton(tr("&Apply"), aGroupBox2, "m_bApply");
+ m_bApply->setAutoDefault(TRUE);
+ // Create <Cancel> button
+ QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aGroupBox2, "m_bCancel");
+ m_bCancel->setAutoDefault(TRUE);
+
+ // Layout buttons
+ aHBoxLayout2->addWidget(m_bOk);
+ aHBoxLayout2->addWidget(m_bApply);
+ aHBoxLayout2->addStretch();
+ aHBoxLayout2->addWidget(m_bCancel);
+
+ // Layout top level widgets
+ layoutDlg->addWidget(aGroupBox,0,0);
+ layoutDlg->addWidget(aGroupBox2,1,0);
+
+ // signals and slots connections
+ connect(m_bCancel, SIGNAL(clicked()), this, SLOT(onClickClose()));
+ connect(m_bOk, SIGNAL(clicked()), this, SLOT(onClickOk()));
+ connect(m_bApply, SIGNAL(clicked()), this, SLOT(onClickApply()));
+ connect(m_bReset, SIGNAL(clicked()), this, SLOT(onClickReset()));
+
+ connect(view, SIGNAL(Hide( QHideEvent * )), this, SLOT(onViewHide()));
+
+ this->resize(100, this->sizeHint().height());
+}
+
+/*!
+ Destructor
+ Destroys the object and frees any allocated resources
+*/
+OCCViewer_AxialScaleDlg::~OCCViewer_AxialScaleDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+void
+OCCViewer_AxialScaleDlg
+::Update()
+{
+ // Get values from the OCC view
+ Standard_Real aScaleFactor[3];
+ myView->getViewPort()->getView()->AxialScale(aScaleFactor[0],aScaleFactor[1],aScaleFactor[2]);
+ m_sbXcoeff->setValue(aScaleFactor[0]);
+ m_sbYcoeff->setValue(aScaleFactor[1]);
+ m_sbZcoeff->setValue(aScaleFactor[2]);
+}
+
+void
+OCCViewer_AxialScaleDlg
+::onClickOk()
+{
+ //apply changes
+ onClickApply();
+ //Close dialog
+ accept();
+}
+
+void
+OCCViewer_AxialScaleDlg
+::onClickApply()
+{
+ double aScaleFactor[3] = {m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value()};
+ myView->getViewPort()->getView()->SetAxialScale(aScaleFactor[0],aScaleFactor[1],aScaleFactor[2]);
+}
+
+void
+OCCViewer_AxialScaleDlg
+::onClickReset()
+{
+ m_bReset->setFocus();
+ m_sbXcoeff->setValue(1.0);
+ m_sbYcoeff->setValue(1.0);
+ m_sbZcoeff->setValue(1.0);
+}
+
+void
+OCCViewer_AxialScaleDlg
+::onClickClose()
+{
+ reject();
+}
+
+void OCCViewer_AxialScaleDlg::onViewHide()
+{
+ hide();
+}
+
--- /dev/null
+// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef OCCVIEWER_AXIALSCALEDLG_H
+#define OCCVIEWER_AXIALSCALEDLG_H
+
+#include "OCCViewer.h"
+
+#include <qdialog.h>
+
+class OCCViewer_ViewWindow;
+
+class QtxDblSpinBox;
+class QPushButton;
+
+/*!
+ \class OCCViewer_AxialScaleDlg
+ \brief Dialog allowing to assign parameters of axes scaling
+*/
+class OCCViewer_AxialScaleDlg : public QDialog
+{
+ Q_OBJECT
+
+ public:
+ OCCViewer_AxialScaleDlg(OCCViewer_ViewWindow* , QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
+ ~OCCViewer_AxialScaleDlg();
+
+ void Update();
+
+protected:
+ OCCViewer_ViewWindow *myView;
+
+ QtxDblSpinBox* m_sbXcoeff;
+ QtxDblSpinBox* m_sbYcoeff;
+ QtxDblSpinBox* m_sbZcoeff;
+ QPushButton* m_bReset;
+
+protected slots:
+ void onClickApply();
+ void onClickReset();
+ void onClickOk();
+ void onClickClose();
+
+ void onViewHide();
+};
+
+#endif // OCCVIEWER_AXIALSCALEDLG_H
--- /dev/null
+
+#include <OB_FindDlg.h>
+#include <OB_ObjSearch.h>
+#include <OB_Browser.h>
+#include <OB_ListItem.h>
+
+#include <SUIT_DataObject.h>
+#include <SUIT_MessageBox.h>
+
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+
+OB_FindDlg::OB_FindDlg( QWidget* parent )
+: QGroupBox( 1, Qt::Horizontal, tr( "FIND" ), parent ),
+ mySearch( 0 )
+{
+ QFrame *btns = new QFrame( this ), *checks = new QFrame( this );
+
+ myData = new QLineEdit( btns );
+ myToFirst = new QPushButton( "|<<", btns );
+ myToLast = new QPushButton( ">>|", btns );
+ myNext = new QPushButton( ">>", btns );
+ myPrev = new QPushButton( "<<", btns );
+ myClose = new QPushButton( tr( "CLOSE" ), checks );
+ myIsCaseSens = new QCheckBox( tr( "CASE_SENSITIVE" ), checks );
+ myIsRegExp = new QCheckBox( tr( "IS_REG_EXP" ), checks );
+ int w = 30, h = myToFirst->height();
+ myToFirst->setMaximumSize( w, h );
+ myToLast->setMaximumSize( w, h );
+ myNext->setMaximumSize( w, h );
+ myPrev->setMaximumSize( w, h );
+
+ QHBoxLayout* l = new QHBoxLayout( btns, 5, 5 );
+ l->addWidget( myToFirst, 0 );
+ l->addWidget( myPrev, 0 );
+ l->addWidget( myData, 1 );
+ l->addWidget( myNext, 0 );
+ l->addWidget( myToLast, 0 );
+
+ QHBoxLayout* c = new QHBoxLayout( checks, 5, 5 );
+ c->addWidget( myIsCaseSens, 0 );
+ c->addWidget( myIsRegExp, 0 );
+ c->addWidget( myClose, 0 );
+
+ connect( myToFirst, SIGNAL( clicked() ), this, SLOT( onFind() ) );
+ connect( myToLast, SIGNAL( clicked() ), this, SLOT( onFind() ) );
+ connect( myNext, SIGNAL( clicked() ), this, SLOT( onFind() ) );
+ connect( myPrev, SIGNAL( clicked() ), this, SLOT( onFind() ) );
+ connect( myClose, SIGNAL( clicked() ), this, SLOT( onClose() ) );
+}
+
+OB_FindDlg::~OB_FindDlg()
+{
+}
+
+void OB_FindDlg::onClose()
+{
+ hide();
+}
+
+void OB_FindDlg::onFind()
+{
+ OB_ListItem* it = 0;
+ mySearch->setPattern( myData->text(), myIsRegExp->isChecked(), myIsCaseSens->isChecked() );
+ if( sender()==myToFirst )
+ it = mySearch->findFirst();
+ else if( sender()==myNext )
+ it = mySearch->findNext();
+ else if( sender()==myPrev )
+ it = mySearch->findPrev();
+ else if( sender()==myToLast )
+ it = mySearch->findLast();
+ if( it )
+ {
+ mySearch->browser()->setSelected( it->dataObject(), false );
+ mySearch->browser()->listView()->ensureItemVisible( it );
+ }
+ else
+ SUIT_MessageBox::info1( this, tr( "FIND" ), tr( "NOT_FOUND" ), tr( "OK" ) );
+}
+
+OB_ObjSearch* OB_FindDlg::getSearch() const
+{
+ return mySearch;
+}
+
+void OB_FindDlg::setSearch( OB_ObjSearch* s )
+{
+ mySearch = s;
+}
--- /dev/null
+
+#ifndef OBJECT_BROWSER_FIND_DIALOG_HEADER
+#define OBJECT_BROWSER_FIND_DIALOG_HEADER
+
+#include <qgroupbox.h>
+
+class OB_ObjSearch;
+class QLineEdit;
+class QPushButton;
+class QCheckBox;
+
+class OB_FindDlg : public QGroupBox
+{
+ Q_OBJECT
+
+public:
+ OB_FindDlg( QWidget* = 0 );
+ virtual ~OB_FindDlg();
+
+ OB_ObjSearch* getSearch() const;
+ void setSearch( OB_ObjSearch* );
+
+private slots:
+ void onFind();
+ void onClose();
+
+private:
+ QLineEdit* myData;
+ QPushButton *myToFirst, *myToLast, *myNext, *myPrev, *myClose;
+ QCheckBox *myIsCaseSens, *myIsRegExp;
+ OB_ObjSearch* mySearch;
+};
+
+#endif
--- /dev/null
+
+#include <OB_ObjSearch.h>
+#include <OB_ListItem.h>
+#include <OB_Browser.h>
+
+#include <qregexp.h>
+
+OB_ObjSearch::OB_ObjSearch( OB_Browser* b )
+: myBrowser( b )
+{
+}
+
+OB_ObjSearch::~OB_ObjSearch()
+{
+}
+
+OB_ListItem* OB_ObjSearch::tail( const bool first ) const
+{
+ QListView* lv = myBrowser->listView();
+ return dynamic_cast<OB_ListItem*>( first ? lv->firstChild() : lv->lastItem() );
+}
+
+OB_ListItem* OB_ObjSearch::next( OB_ListItem* i, const bool forward ) const
+{
+ QListViewItemIterator it( i );
+ if( forward )
+ it++;
+ else
+ it--;
+ return dynamic_cast<OB_ListItem*>( *it );
+}
+
+SUIT_DataObject* OB_ObjSearch::data( OB_ListItem* i ) const
+{
+ return i ? i->dataObject() : 0;
+}
+
+void OB_ObjSearch::setPattern( const QString& data, const bool is_reg_exp, const bool is_case_sens )
+{
+ myData = data;
+ myIsRegExp = is_reg_exp;
+ myIsCaseSens = is_case_sens;
+}
+
+bool OB_ObjSearch::matches( SUIT_DataObject* obj ) const
+{
+ if( !obj )
+ return false;
+
+ QString txt = obj->name();
+ if( myIsRegExp )
+ {
+ QRegExp re( myData );
+ re.setCaseSensitive( myIsCaseSens );
+ return txt.contains( re );
+ }
+ else
+ return txt.contains( myData, myIsCaseSens );
+}
+
+OB_Browser* OB_ObjSearch::browser() const
+{
+ return myBrowser;
+}
+
+OB_ListItem* OB_ObjSearch::findFirst() const
+{
+ return find( tail( true ), true, false, false );
+}
+
+OB_ListItem* OB_ObjSearch::findLast() const
+{
+ return find( tail( false ), false, false, false );
+}
+
+OB_ListItem* OB_ObjSearch::findNext() const
+{
+ return find( current(), true, true, true );
+}
+
+OB_ListItem* OB_ObjSearch::findPrev() const
+{
+ return find( current(), false, true, true );
+}
+
+OB_ListItem* OB_ObjSearch::find( OB_ListItem* i, const bool forward,
+ const bool ignore_first, const bool cyclic ) const
+{
+ if( !i )
+ i = tail( forward );
+
+ if( ignore_first )
+ i = next( i, forward );
+
+ while( i && !matches( data( i ) ) )
+ i = next( i, forward );
+
+ if( !i && cyclic )
+ return find( tail( forward ), forward, false, false );
+
+ return i;
+}
+
+OB_ListItem* OB_ObjSearch::current() const
+{
+ return dynamic_cast<OB_ListItem*>( myBrowser->listView()->currentItem() );
+}
--- /dev/null
+
+#ifndef OBJECT_BROWSER_OBJECT_SEARCH_HEADER
+#define OBJECT_BROWSER_OBJECT_SEARCH_HEADER
+
+#include <qstring.h>
+
+class OB_ListItem;
+class OB_Browser;
+class SUIT_DataObject;
+
+class OB_ObjSearch
+{
+public:
+ OB_ObjSearch( OB_Browser* );
+ virtual ~OB_ObjSearch();
+
+ void setPattern( const QString&, const bool, const bool );
+ OB_Browser* browser() const;
+
+ OB_ListItem* findFirst() const;
+ OB_ListItem* findLast() const;
+ OB_ListItem* findNext() const;
+ OB_ListItem* findPrev() const;
+
+protected:
+ virtual OB_ListItem* current() const;
+ virtual OB_ListItem* tail( const bool ) const;
+ virtual OB_ListItem* next( OB_ListItem*, const bool ) const;
+ virtual SUIT_DataObject* data( OB_ListItem* ) const;
+ virtual bool matches( SUIT_DataObject* ) const;
+ OB_ListItem* find( OB_ListItem*, const bool, const bool, const bool ) const;
+
+private:
+ OB_Browser* myBrowser;
+ QString myData;
+ bool myIsRegExp, myIsCaseSens;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SUIT_MsgDlg.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
+#include "SUIT_MsgDlg.h"
+
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+
+/*!
+ \class SUIT_MsgDlg
+ \brief Information message dialog box with custom number of buttons.
+
+ The class provides a functionality to display message box with the custom number
+ of buttons. Each button is identified by the unique non-zero number which can
+ be tested after dialog box finishes its execution. Pressing each button except
+ causes dialog box to finish execution with return status equal to the button
+ identifier. In addition, pressing "Cancel" button finishes dialog box execution
+ wih return status 0.
+
+ It is also possible to display custom pixmap or icon at the left side of the
+ dialog box. Pass the required pixmap to the constructor or use method setPixmap().
+
+ The typical usage of the dialog box:
+ \code
+ SUIT_MsgDlg dlg( this, tr( "Warning!" ),
+ tr( "File %s exists. Overwrite?" ).arg( files[i] ),
+ QMessageBox::standardIcon( QMessageBox::Warning ) );
+ dlg.addButton( "Yes", YesId );
+ dlg.addButton( "No", NoId );
+ dlg.addButton( "Yes to all", YesAllId );
+ dlg.addButton( "No to all", NoAllId );
+ int ret = dlg.exec();
+ switch( ret ) {
+ case YesId:
+ // process one file
+ processOneFile();
+ break;
+ case NoId:
+ // skip current file processing and proceed to the next file
+ break;
+ case YesAllId:
+ // process all files
+ processAllFiles();
+ stopped = true;
+ break;
+ case NoAllId:
+ // skip all process all files
+ processAllFiles();
+ break;
+ default:
+ // operation is cancelled
+ break;
+ }
+ \endcode
+
+ \sa addButton(), setPixmap()
+*/
+
+/*!
+ \brief Constructor.
+ \param parent parent widget
+ \param title dialog box caption
+ \param msg dialog box message
+ \param icon dialog box icon
+*/
+SUIT_MsgDlg::SUIT_MsgDlg( QWidget* parent,
+ const QString& title,
+ const QString& msg,
+ const QPixmap& icon )
+: QDialog ( parent, "SUIT_MsgDlg", true )
+{
+ // title
+ setCaption( title );
+
+ // icon
+ myIconLab = new QLabel( this );
+ myIconLab->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
+ myIconLab->setScaledContents( false );
+ myIconLab->setAlignment( Qt::AlignCenter );
+
+ if ( !icon.isNull() )
+ myIconLab->setPixmap( icon );
+
+ // info message
+ myMsgLab = new QLabel( msg, this );
+ myMsgLab->setTextFormat( Qt::RichText );
+ myMsgLab->setAlignment( Qt::AlignCenter );
+
+ // Buttons
+ myButtonLayout = new QHBoxLayout();
+ myButtonLayout->setMargin( 0 );
+ myButtonLayout->setSpacing( 6 );
+
+ // <Cancel>
+ QPushButton* cancelBtn = new QPushButton( tr( "CANCEL" ), this );
+ myButtonLayout->addSpacing( 20 );
+ myButtonLayout->addStretch();
+ myButtonLayout->addWidget( cancelBtn );
+
+ QGridLayout* layout = new QGridLayout( this );
+ layout->setMargin( 11 );
+ layout->setSpacing( 6 );
+
+ layout->addWidget( myIconLab, 0, 0 );
+ layout->addWidget( myMsgLab, 0, 1 );
+ layout->addMultiCellLayout( myButtonLayout, 1, 1, 0, 1 );
+
+ // signals and slots connections
+ connect( cancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+/*!
+ \brief Destructor.
+*/
+SUIT_MsgDlg::~SUIT_MsgDlg()
+{
+}
+
+/*!
+ \brief Add operation button to the dialog box.
+
+ If the parameter \a id is equal to -1, then the
+ button identifier is generated automatically.
+
+ \param btext button text
+ \param id button identifier
+ \return button identifier
+*/
+int SUIT_MsgDlg::addButton( const QString& btext, const int id )
+{
+ static int lastId = 0;
+ int bid = id == -1 ? --lastId : id;
+
+ QPushButton* b = button( bid );
+ if ( b ) {
+ myButtons.remove( b );
+ delete b;
+ }
+
+ QPushButton* newButton = new QPushButton( btext, this );
+
+ myButtonLayout->insertWidget( myButtons.count(), newButton );
+
+ if ( myButtons.empty() ) newButton->setDefault(true);
+
+ myButtons.insert( newButton, bid );
+ connect( newButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
+
+ return bid;
+}
+
+/*!
+ \brief Set icon to the dialog box
+ \param icon pixmap
+*/
+void SUIT_MsgDlg::setPixmap( const QPixmap& icon )
+{
+ myIconLab->setPixmap( icon );
+}
+
+
+/*!
+ \brief Called when any dialog button (except \c Cancel)
+ is clicked.
+
+ Closes the dialog and sets its result code to the identifier
+ of the button clicked by the user.
+*/
+void SUIT_MsgDlg::accept()
+{
+ QPushButton* btn = ( QPushButton* )sender();
+ done( myButtons[ btn ] );
+}
+
+/*!
+ \brief Search button with the specified identifier.
+ \param id button identifier
+ \return button or 0 if \a id is invalid
+*/
+QPushButton* SUIT_MsgDlg::button( const int id ) const
+{
+ QPushButton* btn = 0;
+ for ( ButtonMap::ConstIterator it = myButtons.begin();
+ it != myButtons.end() && !btn; ++it ) {
+ if ( it.data() == id )
+ btn = it.key();
+ }
+ return btn;
+}
+
+/*!
+ \brief Get information icon label.
+ \return information icon label
+*/
+QLabel* SUIT_MsgDlg::iconLabel() const
+{
+ return myIconLab;
+}
+
+/*!
+ \brief Get information message label.
+ \return information message label
+*/
+QLabel* SUIT_MsgDlg::messageLabel() const
+{
+ return myMsgLab;
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SUIT_MsgDlg.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
+#ifndef SUIT_MSGDLG_H
+#define SUIT_MSGDLG_H
+
+#include "SUIT.h"
+
+#include <qdialog.h>
+#include <qpixmap.h>
+#include <qmap.h>
+
+class QLabel;
+class QPushButton;
+class QHBoxLayout;
+
+class SUIT_EXPORT SUIT_MsgDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ SUIT_MsgDlg( QWidget*, const QString&, const QString&, const QPixmap& = QPixmap() ) ;
+ ~SUIT_MsgDlg();
+
+ int addButton( const QString&, const int = -1);
+ void setPixmap( const QPixmap& );
+
+public slots:
+ void accept();
+
+protected:
+ QPushButton* button( const int ) const;
+ QLabel* iconLabel() const;
+ QLabel* messageLabel() const;
+
+private:
+ typedef QMap<QPushButton*,int> ButtonMap;
+
+private:
+ ButtonMap myButtons;
+ QHBoxLayout* myButtonLayout;
+ QLabel* myIconLab;
+ QLabel* myMsgLab;
+};
+
+#endif // SUIT_MSGDLG_H
+
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File: SalomeApp_ExitDlg.cxx
+// Author: Margarita KARPUNINA, Open CASCADE S.A.S.
+//
+
+#include "SalomeApp_ExitDlg.h"
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qmessagebox.h>
+#include <qcheckbox.h>
+
+/*!
+ * \brief creates a Exit dialog box
+ * \param parent a parent widget
+ * \param modal bool argument, if true the dialog box is a modal dialog box
+ * \param f style flags
+ */
+SalomeApp_ExitDlg::SalomeApp_ExitDlg( QWidget* parent )
+ : QDialog( parent, "SalomeApp_ExitDlg", true )
+{
+ setSizeGripEnabled( true );
+ setCaption( tr( "INF_DESK_EXIT" ) );
+
+ QVBoxLayout* m_vbL = new QVBoxLayout( this );
+ m_vbL->setMargin( 11 );
+ m_vbL->setSpacing( 6 );
+
+ QLabel* m_lIcon = new QLabel( this, "m_lDescr" );
+ QPixmap pm = QMessageBox::standardIcon( QMessageBox::Question );
+ m_lIcon->setPixmap( pm );
+ m_lIcon->setScaledContents( false );
+ m_lIcon->setAlignment( Qt::AlignCenter );
+
+ QLabel* m_lDescr = new QLabel (this, "m_lDescr");
+ m_lDescr->setText ( tr ("QUE_DESK_EXIT") );
+ m_lDescr->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+
+ myServersShutdown = new QCheckBox( tr("SHUTDOWN_SERVERS"), this );
+ myServersShutdown->setChecked(true);
+
+ QVBoxLayout* m_vl1 = new QVBoxLayout();
+ m_vl1->setMargin( 10 ); m_vl1->setSpacing( 16 );
+ m_vl1->addWidget( m_lDescr );
+ m_vl1->addWidget( myServersShutdown );
+
+ QHBoxLayout* m_hl1 = new QHBoxLayout();
+ m_hl1->setMargin( 0 ); m_hl1->setSpacing( 6 );
+ m_hl1->addWidget( m_lIcon );
+ m_hl1->addStretch();
+ m_hl1->addLayout( m_vl1 );
+ m_hl1->addStretch();
+
+ QPushButton* m_pbOk = new QPushButton( tr( "BUT_OK" ), this );
+ QPushButton* m_pbCancel = new QPushButton( tr( "BUT_CANCEL" ), this );
+
+ QGridLayout* m_hl2 = new QGridLayout();
+ m_hl2->setMargin( 0 ); m_hl2->setSpacing( 6 );
+ m_hl2->addWidget( m_pbOk, 0, 0 );
+ m_hl2->setColStretch( 1, 5 );
+ m_hl2->addWidget( m_pbCancel, 0, 2 );
+
+ m_vbL->addStretch();
+ m_vbL->addLayout( m_hl1 );
+ m_vbL->addStretch();
+ m_vbL->addLayout( m_hl2 );
+
+ connect( m_pbOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( m_pbCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+/*!
+ * \brief Destructor
+ */
+SalomeApp_ExitDlg::~SalomeApp_ExitDlg()
+{
+}
+
+/*!
+ * \brief get the check box status
+ */
+bool SalomeApp_ExitDlg::isServersShutdown()
+{
+ return myServersShutdown->isChecked();
+}
+
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File: SalomeApp_ExitDlg.h
+// Author: Margarita KARPUNINA, Open CASCADE S.A.S.
+//
+
+#ifndef SALOMEAPP_EXITDLG_H
+#define SALOMEAPP_EXITDLG_H
+
+#include <qdialog.h>
+
+class QCheckBox;
+
+/*!\class SalomeApp_ExitDlg
+ * \brief Describes a dialog box shown on question about quit application
+ */
+class SalomeApp_ExitDlg: public QDialog
+{
+ Q_OBJECT
+
+public:
+ SalomeApp_ExitDlg( QWidget* ) ;
+ ~SalomeApp_ExitDlg();
+
+ bool isServersShutdown();
+
+private:
+ QCheckBox* myServersShutdown;
+};
+
+#endif // SALOMEAPP_EXITDLG_H
+