1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESHGUI_FilterLibraryDlg.h
25 // Author : Sergey LITONIN
29 #ifndef SMESHGUI_FilterLibraryDlg_H
30 #define SMESHGUI_FilterLibraryDlg_H
33 #include <SMESHGUI_FilterDlg.h>
35 #include <SALOMEconfig.h>
36 #include CORBA_SERVER_HEADER(SMESH_Filter)
47 Class : SMESHGUI_FilterLibraryDlg
48 Description : Dialog to specify filters for VTK viewer
51 class SMESHGUI_FilterLibraryDlg : public QDialog
56 enum { BTN_OK, BTN_Cancel, BTN_Apply, BTN_Close };
63 enum { ADD_TO, COPY_FROM, EDIT };
67 SMESHGUI_FilterLibraryDlg( QWidget* parent,
68 const QValueList<int>& types,
70 const char* name = 0 );
72 SMESHGUI_FilterLibraryDlg( QWidget* parent,
75 const char* name = 0 );
77 virtual ~SMESHGUI_FilterLibraryDlg();
79 void Init( const QValueList<int>& types, const int theMode );
80 void Init( const int type, const int theMode );
82 const SMESHGUI_FilterTable* GetTable() const;
83 void SetTable( const SMESHGUI_FilterTable* );
87 void closeEvent( QCloseEvent* e ) ;
88 void enterEvent ( QEvent * ) ;
99 void onReturnPressed();
100 void onFilterChanged( const QString& );
101 void onAddBtnPressed();
102 void onDeleteBtnPressed();
103 void onFilterNameChanged( const QString& );
104 void onEntityTypeChanged( const int );
105 void onNeedValidation();
109 void construct( const QValueList<int>& types, const int mode );
110 QFrame* createButtonFrame( QWidget* );
111 QFrame* createMainFrame ( QWidget* );
112 bool isValid( const bool theMess = true ) const;
113 bool isNameValid( const bool theMess = true ) const;
114 SMESH::Filter_ptr createFilter( const int theType = -1 );
115 QStringList prepareFilters() const;
116 QString autoExtension( const QString& ) const;
117 bool setSelected( const QString& );
118 int getIndex( const QString& ) const;
119 void updateControlsVisibility();
120 void updateMainButtons();
121 void enableMainButtons();
122 void processNewLibrary();
123 QString getFileName() const;
124 void setFileName( const QString& txt, const bool autoExtension = true );
125 QStringList filterWildCards( const QString& theFilter ) const;
126 QString& getDefaultLibraryName() const;
127 QString getDefaultFilterName() const;
128 void addFilterToLib( const QString& name );
130 bool isPermissionValid( const bool theIsExistingOnly );
135 QMap<int, QPushButton*> myButtons;
136 SMESHGUI_FilterTable* myTable;
137 QLineEdit* myFileName;
138 QPushButton* myOpenBtn;
140 QPushButton* myAddBtn;
141 QPushButton* myDeleteBtn;
142 QGroupBox* myNameGrp;
145 QValueList<int> myTypes;
148 SMESH::FilterLibrary_var myLibrary;
149 QString myCurrFilterName;