1 // Copyright (C) 2007-2008 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
22 // SMESH SMESHGUI : GUI for SMESH component
23 // File : SMESHGUI_FilterLibraryDlg.h
24 // 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)
42 class QListWidgetItem;
46 class SMESHGUI_FilterTable;
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 };
68 SMESHGUI_FilterLibraryDlg( SMESHGUI*, QWidget*, const QList<int>&, const int );
69 SMESHGUI_FilterLibraryDlg( SMESHGUI*, QWidget*, const int, const int );
70 virtual ~SMESHGUI_FilterLibraryDlg();
72 void Init( const QList<int>&, const int );
73 void Init( const int, const int );
75 const SMESHGUI_FilterTable* GetTable() const;
76 void SetTable( const SMESHGUI_FilterTable* );
79 void closeEvent( QCloseEvent* );
80 void enterEvent( QEvent* );
81 void keyPressEvent( QKeyEvent* );
92 void onReturnPressed();
93 void onFilterChanged();
94 void onAddBtnPressed();
95 void onDeleteBtnPressed();
96 void onFilterNameChanged( const QString& );
97 void onEntityTypeChanged( const int );
98 void onNeedValidation();
101 void construct( const QList<int>&, const int );
102 QWidget* createButtonFrame( QWidget* );
103 QWidget* createMainFrame( QWidget* );
104 bool isValid( const bool = true ) const;
105 bool isNameValid( const bool = true ) const;
106 SMESH::Filter_ptr createFilter( const int = -1 );
107 QStringList prepareFilters() const;
108 QString autoExtension( const QString& ) const;
109 bool setSelected( const QString& );
110 int getIndex( const QString& ) const;
111 void updateControlsVisibility();
112 void updateMainButtons();
113 void enableMainButtons();
114 void processNewLibrary();
115 QString getFileName() const;
116 void setFileName( const QString&, const bool = true );
117 QStringList filterWildCards( const QString& ) const;
118 QString& getDefaultLibraryName() const;
119 QString getDefaultFilterName() const;
120 void addFilterToLib( const QString& );
122 bool isPermissionValid( const bool );
126 QWidget* myMainFrame;
127 QMap<int, QPushButton*> myButtons;
128 SMESHGUI_FilterTable* myTable;
129 QLineEdit* myFileName;
130 QPushButton* myOpenBtn;
131 QListWidget* myListBox;
132 QPushButton* myAddBtn;
133 QPushButton* myDeleteBtn;
136 SMESHGUI* mySMESHGUI;
141 SMESH::FilterLibrary_var myLibrary;
142 QString myCurrFilterName;
145 QString myHelpFileName;
148 #endif // SMESHGUI_FILTERLIBRARYDLG_H