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 * ) ;
93 void keyPressEvent( QKeyEvent* e );
105 void onReturnPressed();
106 void onFilterChanged( const QString& );
107 void onAddBtnPressed();
108 void onDeleteBtnPressed();
109 void onFilterNameChanged( const QString& );
110 void onEntityTypeChanged( const int );
111 void onNeedValidation();
115 void construct( const QValueList<int>& types, const int mode );
116 QFrame* createButtonFrame( QWidget* );
117 QFrame* createMainFrame ( QWidget* );
118 bool isValid( const bool theMess = true ) const;
119 bool isNameValid( const bool theMess = true ) const;
120 SMESH::Filter_ptr createFilter( const int theType = -1 );
121 QStringList prepareFilters() const;
122 QString autoExtension( const QString& ) const;
123 bool setSelected( const QString& );
124 int getIndex( const QString& ) const;
125 void updateControlsVisibility();
126 void updateMainButtons();
127 void enableMainButtons();
128 void processNewLibrary();
129 QString getFileName() const;
130 void setFileName( const QString& txt, const bool autoExtension = true );
131 QStringList filterWildCards( const QString& theFilter ) const;
132 QString& getDefaultLibraryName() const;
133 QString getDefaultFilterName() const;
134 void addFilterToLib( const QString& name );
136 bool isPermissionValid( const bool theIsExistingOnly );
141 QMap<int, QPushButton*> myButtons;
142 SMESHGUI_FilterTable* myTable;
143 QLineEdit* myFileName;
144 QPushButton* myOpenBtn;
146 QPushButton* myAddBtn;
147 QPushButton* myDeleteBtn;
148 QGroupBox* myNameGrp;
150 SMESHGUI* mySMESHGUI;
152 QValueList<int> myTypes;
155 SMESH::FilterLibrary_var myLibrary;
156 QString myCurrFilterName;
159 QString myHelpFileName;