1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "VTKViewer_MarkerDlg.h"
21 #include "VTKViewer_MarkerWidget.h"
23 #include <SUIT_Application.h>
24 #include <SUIT_MessageBox.h>
25 #include <SUIT_ResourceMgr.h>
26 #include <SUIT_Session.h>
29 #include <QHBoxLayout>
33 * Class : VTKViewer_MarkerDlg
34 * Description : Dialog for specifying point marker parameters
40 VTKViewer_MarkerDlg::VTKViewer_MarkerDlg( QWidget* theParent )
41 : QtxDialog( theParent, true, true )
43 setWindowTitle( tr( "SET_MARKER_TLT" ) );
45 myMarkerWidget = new VTKViewer_MarkerWidget( mainFrame() );
47 QBoxLayout* aTopLayout = new QHBoxLayout( mainFrame() );
48 aTopLayout->setSpacing( 0 );
49 aTopLayout->setMargin( 0 );
50 aTopLayout->addWidget( myMarkerWidget );
52 connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
58 VTKViewer_MarkerDlg::~VTKViewer_MarkerDlg()
62 void VTKViewer_MarkerDlg::setHelpData( const QString& theModuleName,
63 const QString& theHelpFileName )
65 myModuleName = theModuleName;
66 myHelpFileName = theHelpFileName;
69 void VTKViewer_MarkerDlg::keyPressEvent( QKeyEvent* e )
71 QtxDialog::keyPressEvent( e );
72 if ( e->isAccepted() )
75 if ( e->key() == Qt::Key_F1 ) {
81 void VTKViewer_MarkerDlg::onHelp()
83 if( myModuleName.isNull() || myHelpFileName.isNull() )
86 SUIT_Application* app = SUIT_Session::session()->activeApplication();
88 app->onHelpContextModule(myModuleName, myHelpFileName);
92 platform = "winapplication";
94 platform = "application";
96 SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
97 tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
98 arg(app->resourceMgr()->stringValue("ExternalBrowser",
100 arg(myHelpFileName));
104 void VTKViewer_MarkerDlg::setCustomMarkerMap( VTK::MarkerMap theMarkerMap )
106 myMarkerWidget->setCustomMarkerMap( theMarkerMap );
109 VTK::MarkerMap VTKViewer_MarkerDlg::getCustomMarkerMap()
111 return myMarkerWidget->getCustomMarkerMap();
114 void VTKViewer_MarkerDlg::setStandardMarker( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
116 myMarkerWidget->setStandardMarker( theMarkerType, theMarkerScale );
119 void VTKViewer_MarkerDlg::setCustomMarker( int theId )
121 myMarkerWidget->setCustomMarker( theId );
124 VTK::MarkerType VTKViewer_MarkerDlg::getMarkerType() const
126 return myMarkerWidget->getMarkerType();
129 VTK::MarkerScale VTKViewer_MarkerDlg::getStandardMarkerScale() const
131 return myMarkerWidget->getStandardMarkerScale();
134 int VTKViewer_MarkerDlg::getCustomMarkerID() const
136 return myMarkerWidget->getCustomMarkerID();
139 void VTKViewer_MarkerDlg::addExtraStdMarker( VTK::MarkerType theMarkerType, const QPixmap& thePixmap )
141 myMarkerWidget->addExtraStdMarker( theMarkerType, thePixmap );