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.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : SMESHGUI_FilterLibraryDlg.h
25 // Author : Sergey LITONIN
29 #ifndef SMESHGUI_FilterLibraryDlg_H
30 #define SMESHGUI_FilterLibraryDlg_H
32 #include "SMESH_SMESHGUI.hxx"
35 #include <SMESHGUI_FilterDlg.h>
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SMESH_Filter)
49 Class : SMESHGUI_FilterLibraryDlg
50 Description : Dialog to specify filters for VTK viewer
53 class SMESHGUI_EXPORT SMESHGUI_FilterLibraryDlg : public QDialog
58 enum { BTN_OK, BTN_Cancel, BTN_Apply, BTN_Close, BTN_Help };
65 enum { ADD_TO, COPY_FROM, EDIT };
69 SMESHGUI_FilterLibraryDlg( SMESHGUI*,
71 const QValueList<int>& types,
73 const char* name = 0 );
75 SMESHGUI_FilterLibraryDlg( SMESHGUI*,
79 const char* name = 0 );
81 virtual ~SMESHGUI_FilterLibraryDlg();
83 void Init( const QValueList<int>& types, const int theMode );
84 void Init( const int type, const int theMode );
86 const SMESHGUI_FilterTable* GetTable() const;
87 void SetTable( const SMESHGUI_FilterTable* );
91 void closeEvent( QCloseEvent* e ) ;
92 void enterEvent ( QEvent * ) ;
104 void onReturnPressed();
105 void onFilterChanged( const QString& );
106 void onAddBtnPressed();
107 void onDeleteBtnPressed();
108 void onFilterNameChanged( const QString& );
109 void onEntityTypeChanged( const int );
110 void onNeedValidation();
114 void construct( const QValueList<int>& types, const int mode );
115 QFrame* createButtonFrame( QWidget* );
116 QFrame* createMainFrame ( QWidget* );
117 bool isValid( const bool theMess = true ) const;
118 bool isNameValid( const bool theMess = true ) const;
119 SMESH::Filter_ptr createFilter( const int theType = -1 );
120 QStringList prepareFilters() const;
121 QString autoExtension( const QString& ) const;
122 bool setSelected( const QString& );
123 int getIndex( const QString& ) const;
124 void updateControlsVisibility();
125 void updateMainButtons();
126 void enableMainButtons();
127 void processNewLibrary();
128 QString getFileName() const;
129 void setFileName( const QString& txt, const bool autoExtension = true );
130 QStringList filterWildCards( const QString& theFilter ) const;
131 QString& getDefaultLibraryName() const;
132 QString getDefaultFilterName() const;
133 void addFilterToLib( const QString& name );
135 bool isPermissionValid( const bool theIsExistingOnly );
140 QMap<int, QPushButton*> myButtons;
141 SMESHGUI_FilterTable* myTable;
142 QLineEdit* myFileName;
143 QPushButton* myOpenBtn;
145 QPushButton* myAddBtn;
146 QPushButton* myDeleteBtn;
147 QGroupBox* myNameGrp;
149 SMESHGUI* mySMESHGUI;
151 QValueList<int> myTypes;
154 SMESH::FilterLibrary_var myLibrary;
155 QString myCurrFilterName;
158 QString myHelpFileName;