Version: 6.3.1

src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File   : StdMeshersGUI_ObjectReferenceParamWdg.h
00024 // Author : Open CASCADE S.A.S.
00025 //
00026 #ifndef STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H
00027 #define STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H
00028 
00029 // SMESH includes
00030 #include "SMESH_StdMeshersGUI.hxx"
00031 
00032 #include <SMESH_Type.h>
00033 
00034 // Qt includes
00035 #include <QWidget>
00036 
00037 // CORBA includes
00038 #include <CORBA.h>
00039 
00040 #include CORBA_SERVER_HEADER(SMESH_Mesh)
00041 
00042 class SUIT_SelectionFilter;
00043 class SMESHGUI;
00044 class LightApp_SelectionMgr;
00045 class QLineEdit;
00046 class QPushButton;
00047 
00051 class STDMESHERSGUI_EXPORT StdMeshersGUI_ObjectReferenceParamWdg : public QWidget
00052 {
00053   Q_OBJECT
00054 
00055 public:
00056   StdMeshersGUI_ObjectReferenceParamWdg( SUIT_SelectionFilter* filter, 
00057                                          QWidget*              parent,
00058                                          bool                  multiSelection=false,
00059                                          bool                  stretch=true);
00060   StdMeshersGUI_ObjectReferenceParamWdg( MeshObjectType objType,
00061                                          QWidget*       parent,
00062                                          bool           multiSelection=false);
00063   ~StdMeshersGUI_ObjectReferenceParamWdg();
00064 
00065   void SetObject(CORBA::Object_ptr obj);
00066 
00067   void SetObjects(SMESH::string_array_var& objEntries);
00068 
00069   template<class TInterface> 
00070     typename TInterface::_var_type GetObject(unsigned i=0) const {
00071     if ( IsObjectSelected(i) ) return TInterface::_narrow(myObjects[i]);
00072     return TInterface::_nil();
00073   }
00074 
00075   int NbObjects() const { return myObjects.size(); }
00076 
00077   QString GetValue() const { return myParamValue; }
00078 
00079   bool IsObjectSelected(unsigned i=0) const
00080   { return i < myObjects.size() && !CORBA::is_nil(myObjects[i]); }
00081 
00082   void AvoidSimultaneousSelection( StdMeshersGUI_ObjectReferenceParamWdg* other);
00083   
00084   void SetDefaultText(QString defaultText="", QString styleSheet="");
00085 
00086 public slots:
00093   void activateSelection();
00094   void deactivateSelection();
00095 
00096 signals:
00103   void selectionActivated();
00104   void contentModified();
00105   
00106 private slots:
00107   void onSelectionDone(); 
00108 
00109 private:
00110   void init();
00111   
00112 private:
00113 
00114   bool                                myMultiSelection;
00115   std::vector<CORBA::Object_var>      myObjects;
00116 
00117  SUIT_SelectionFilter*  myFilter;
00118  bool                   mySelectionActivated;
00119  bool                   myStretchActivated;
00120 
00121  SMESHGUI*              mySMESHGUI;
00122  LightApp_SelectionMgr* mySelectionMgr;
00123 
00124  QLineEdit*             myObjNameLineEdit;
00125  QPushButton*           mySelButton;
00126  QString                myParamValue;
00127  QString                myEmptyText;
00128  QString                myEmptyStyleSheet;
00129 };
00130 
00131 #endif // STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS