1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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, or (at your option) any later version.
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
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File : SMESHGUI_FilterLibraryDlg.h
25 // Author : Sergey LITONIN, Open CASCADE S.A.S.
27 #ifndef SMESHGUI_FILTERLIBRARYDLG_H
28 #define SMESHGUI_FILTERLIBRARYDLG_H
31 #include "SMESH_SMESHGUI.hxx"
39 #include <SALOMEconfig.h>
40 #include CORBA_SERVER_HEADER(SMESH_Filter)
43 class QListWidgetItem;
47 class SMESHGUI_FilterTable;
50 Class : SMESHGUI_FilterLibraryDlg
51 Description : Dialog to specify filters for VTK viewer
54 class SMESHGUI_EXPORT SMESHGUI_FilterLibraryDlg : public QDialog
59 enum { BTN_OK, BTN_Apply, BTN_Close, BTN_Help };
66 enum { ADD_TO, COPY_FROM, EDIT };
69 SMESHGUI_FilterLibraryDlg( SMESHGUI*, QWidget*, const QList<int>&, const int );
70 SMESHGUI_FilterLibraryDlg( SMESHGUI*, QWidget*, const int, const int );
71 virtual ~SMESHGUI_FilterLibraryDlg();
73 void Init( const QList<int>&, const int );
74 void Init( const int, const int );
76 const SMESHGUI_FilterTable* GetTable() const;
77 void SetTable( const SMESHGUI_FilterTable* );
80 void enterEvent( QEvent* );
81 void keyPressEvent( QKeyEvent* );
84 virtual void reject();
94 void onReturnPressed();
95 void onFilterChanged();
96 void onAddBtnPressed();
97 void onDeleteBtnPressed();
98 void onFilterNameChanged( const QString& );
99 void onEntityTypeChanged( const int );
100 void onNeedValidation();
101 void onSelectionDone();
104 void construct( const QList<int>&, const int );
105 QWidget* createButtonFrame( QWidget* );
106 QWidget* createMainFrame( QWidget* );
107 bool isValid( const bool = true ) const;
108 bool isNameValid( const bool = true ) const;
109 SMESH::Filter_ptr createFilter( const int = -1 );
110 QStringList prepareFilters() const;
111 QString autoExtension( const QString& ) const;
112 bool setSelected( const QString& );
113 int getIndex( const QString& ) const;
114 void updateControlsVisibility();
115 void updateMainButtons();
116 void enableMainButtons();
117 void processNewLibrary();
118 QString getFileName() const;
119 void setFileName( const QString&, const bool = true );
120 QStringList filterWildCards( const QString& ) const;
121 QString& getDefaultLibraryName() const;
122 QString getDefaultFilterName() const;
123 void addFilterToLib( const QString& );
125 bool isPermissionValid( const bool );
129 QWidget* myMainFrame;
130 QMap<int, QPushButton*> myButtons;
131 SMESHGUI_FilterTable* myTable;
132 QLineEdit* myFileName;
133 QPushButton* myOpenBtn;
134 QListWidget* myListBox;
135 QPushButton* myAddBtn;
136 QPushButton* myDeleteBtn;
139 SMESHGUI* mySMESHGUI;
144 SMESH::FilterLibrary_var myLibrary;
145 QString myCurrFilterName;
148 QString myHelpFileName;
151 #endif // SMESHGUI_FILTERLIBRARYDLG_H