1 // Copyright (C) 2007-2011 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.
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 closeEvent( QCloseEvent* );
81 void enterEvent( QEvent* );
82 void keyPressEvent( QKeyEvent* );
93 void onReturnPressed();
94 void onFilterChanged();
95 void onAddBtnPressed();
96 void onDeleteBtnPressed();
97 void onFilterNameChanged( const QString& );
98 void onEntityTypeChanged( const int );
99 void onNeedValidation();
102 void construct( const QList<int>&, const int );
103 QWidget* createButtonFrame( QWidget* );
104 QWidget* createMainFrame( QWidget* );
105 bool isValid( const bool = true ) const;
106 bool isNameValid( const bool = true ) const;
107 SMESH::Filter_ptr createFilter( const int = -1 );
108 QStringList prepareFilters() const;
109 QString autoExtension( const QString& ) const;
110 bool setSelected( const QString& );
111 int getIndex( const QString& ) const;
112 void updateControlsVisibility();
113 void updateMainButtons();
114 void enableMainButtons();
115 void processNewLibrary();
116 QString getFileName() const;
117 void setFileName( const QString&, const bool = true );
118 QStringList filterWildCards( const QString& ) const;
119 QString& getDefaultLibraryName() const;
120 QString getDefaultFilterName() const;
121 void addFilterToLib( const QString& );
123 bool isPermissionValid( const bool );
127 QWidget* myMainFrame;
128 QMap<int, QPushButton*> myButtons;
129 SMESHGUI_FilterTable* myTable;
130 QLineEdit* myFileName;
131 QPushButton* myOpenBtn;
132 QListWidget* myListBox;
133 QPushButton* myAddBtn;
134 QPushButton* myDeleteBtn;
137 SMESHGUI* mySMESHGUI;
142 SMESH::FilterLibrary_var myLibrary;
143 QString myCurrFilterName;
146 QString myHelpFileName;
149 #endif // SMESHGUI_FILTERLIBRARYDLG_H