smesh/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h

142 lines
4.3 KiB
C
Raw Normal View History

2013-04-01 19:05:47 +06:00
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
//
2012-08-09 16:03:55 +06:00
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
2012-08-09 16:03:55 +06:00
// 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.
//
2012-08-09 16:03:55 +06:00
// 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.
//
2012-08-09 16:03:55 +06:00
// 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
2009-02-17 10:27:49 +05:00
//
2012-08-09 16:03:55 +06:00
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2009-02-17 10:27:49 +05:00
//
2012-08-09 16:03:55 +06:00
2009-02-17 10:27:49 +05:00
// File : StdMeshersGUI_ObjectReferenceParamWdg.h
// Author : Open CASCADE S.A.S.
//
#ifndef STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H
#define STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H
2009-02-17 10:27:49 +05:00
// SMESH includes
#include "SMESH_StdMeshersGUI.hxx"
2009-02-17 10:27:49 +05:00
#include <SMESH_Type.h>
// Qt includes
#include <QWidget>
2009-02-17 10:27:49 +05:00
// CORBA includes
#include <CORBA.h>
2012-08-09 16:03:55 +06:00
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
class SUIT_SelectionFilter;
class SMESHGUI;
class LightApp_SelectionMgr;
class QLineEdit;
class QPushButton;
/*!
* \brief Widget controlling hypothesis parameter that is an object reference
*/
2009-02-17 10:27:49 +05:00
class STDMESHERSGUI_EXPORT StdMeshersGUI_ObjectReferenceParamWdg : public QWidget
{
Q_OBJECT
public:
StdMeshersGUI_ObjectReferenceParamWdg( SUIT_SelectionFilter* filter,
2012-08-09 16:03:55 +06:00
QWidget* parent,
bool multiSelection=false,
bool stretch=true);
2012-12-13 17:41:29 +06:00
StdMeshersGUI_ObjectReferenceParamWdg( SMESH::MeshObjectType objType,
2012-08-09 16:03:55 +06:00
QWidget* parent,
bool multiSelection=false);
~StdMeshersGUI_ObjectReferenceParamWdg();
void SetObject(CORBA::Object_ptr obj);
2012-08-09 16:03:55 +06:00
void SetObjects(SMESH::string_array_var& objEntries);
template<class TInterface>
2012-08-09 16:03:55 +06:00
typename TInterface::_var_type GetObject(unsigned i=0) const {
if ( IsObjectSelected(i) ) return TInterface::_narrow(myObjects[i]);
return TInterface::_nil();
}
2012-08-09 16:03:55 +06:00
int NbObjects() const { return myObjects.size(); }
QString GetValue() const { return myParamValue; }
2012-08-09 16:03:55 +06:00
bool IsObjectSelected(unsigned i=0) const
{ return i < myObjects.size() && !CORBA::is_nil(myObjects[i]); }
/*!
* \brief Get the selection status
*
* Useful to know which Object Reference param widget is activated
* to be able to activate the next one when the content of this
* one has been modified
*/
bool IsSelectionActivated() const { return mySelectionActivated; }
void AvoidSimultaneousSelection( StdMeshersGUI_ObjectReferenceParamWdg* other);
2012-08-09 16:03:55 +06:00
void SetDefaultText(QString defaultText="", QString styleSheet="");
public slots:
/*!
* \brief Activates selection (if not yet done), emits selectionActivated()
*
* Useful to deactivate one Object Reference param widget when an other
* one is activated
*/
void activateSelection();
void deactivateSelection();
signals:
/*!
* \brief Emitted when selection is activated
*
* Useful to deactivate one Object Reference param widget when an other
* one is activated
*/
void selectionActivated();
2012-08-09 16:03:55 +06:00
void contentModified();
private slots:
void onSelectionDone();
private:
void init();
private:
2012-08-09 16:03:55 +06:00
bool myMultiSelection;
std::vector<CORBA::Object_var> myObjects;
SUIT_SelectionFilter* myFilter;
bool mySelectionActivated;
2012-08-09 16:03:55 +06:00
bool myStretchActivated;
SMESHGUI* mySMESHGUI;
LightApp_SelectionMgr* mySelectionMgr;
QLineEdit* myObjNameLineEdit;
QPushButton* mySelButton;
QString myParamValue;
2012-08-09 16:03:55 +06:00
QString myEmptyText;
QString myEmptyStyleSheet;
};
2009-02-17 10:27:49 +05:00
#endif // STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H