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
22 // File : SMESHGUI_FilterLibraryDlg.h
23 // Author : Sergey LITONIN, Open CASCADE S.A.S.
26 #ifndef SMESHGUI_FILTERLIBRARYDLG_H
27 #define SMESHGUI_FILTERLIBRARYDLG_H
30 #include "SMESH_SMESHGUI.hxx"
38 #include <SALOMEconfig.h>
39 #include CORBA_SERVER_HEADER(SMESH_Filter)
45 class SMESHGUI_FilterTable;
48 Class : SMESHGUI_FilterLibraryDlg
49 Description : Dialog to specify filters for VTK viewer
52 class SMESHGUI_EXPORT SMESHGUI_FilterLibraryDlg : public QDialog
57 enum { BTN_OK, BTN_Cancel, BTN_Apply, BTN_Close, BTN_Help };
64 enum { ADD_TO, COPY_FROM, EDIT };
67 SMESHGUI_FilterLibraryDlg( SMESHGUI*, QWidget*, const QList<int>&, const int );
68 SMESHGUI_FilterLibraryDlg( SMESHGUI*, QWidget*, const int, const int );
69 virtual ~SMESHGUI_FilterLibraryDlg();
71 void Init( const QList<int>&, const int );
72 void Init( const int, const int );
74 const SMESHGUI_FilterTable* GetTable() const;
75 void SetTable( const SMESHGUI_FilterTable* );
78 void closeEvent( QCloseEvent* );
79 void enterEvent( QEvent* );
80 void keyPressEvent( QKeyEvent* );
91 void onReturnPressed();
92 void onFilterChanged( const QString& );
93 void onAddBtnPressed();
94 void onDeleteBtnPressed();
95 void onFilterNameChanged( const QString& );
96 void onEntityTypeChanged( const int );
97 void onNeedValidation();
100 void construct( const QList<int>&, const int );
101 QWidget* createButtonFrame( QWidget* );
102 QWidget* createMainFrame( QWidget* );
103 bool isValid( const bool = true ) const;
104 bool isNameValid( const bool = true ) const;
105 SMESH::Filter_ptr createFilter( const int = -1 );
106 QStringList prepareFilters() const;
107 QString autoExtension( const QString& ) const;
108 bool setSelected( const QString& );
109 int getIndex( const QString& ) const;
110 void updateControlsVisibility();
111 void updateMainButtons();
112 void enableMainButtons();
113 void processNewLibrary();
114 QString getFileName() const;
115 void setFileName( const QString&, const bool = true );
116 QStringList filterWildCards( const QString& ) const;
117 QString& getDefaultLibraryName() const;
118 QString getDefaultFilterName() const;
119 void addFilterToLib( const QString& );
121 bool isPermissionValid( const bool );
125 QWidget* myMainFrame;
126 QMap<int, QPushButton*> myButtons;
127 SMESHGUI_FilterTable* myTable;
128 QLineEdit* myFileName;
129 QPushButton* myOpenBtn;
130 QListWidget* myListBox;
131 QPushButton* myAddBtn;
132 QPushButton* myDeleteBtn;
135 SMESHGUI* mySMESHGUI;
140 SMESH::FilterLibrary_var myLibrary;
141 QString myCurrFilterName;
144 QString myHelpFileName;
147 #endif // SMESHGUI_FILTERLIBRARYDLG_H