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
27 #ifndef SMESHGUI_FilterLibraryDlg_H
28 #define SMESHGUI_FilterLibraryDlg_H
30 #include "SMESH_SMESHGUI.hxx"
33 #include <SMESHGUI_FilterDlg.h>
35 #include <SALOMEconfig.h>
36 #include CORBA_SERVER_HEADER(SMESH_Filter)
47 Class : SMESHGUI_FilterLibraryDlg
48 Description : Dialog to specify filters for VTK viewer
51 class SMESHGUI_EXPORT SMESHGUI_FilterLibraryDlg : public QDialog
56 enum { BTN_OK, BTN_Cancel, BTN_Apply, BTN_Close, BTN_Help };
63 enum { ADD_TO, COPY_FROM, EDIT };
67 SMESHGUI_FilterLibraryDlg( SMESHGUI*,
69 const QValueList<int>& types,
71 const char* name = 0 );
73 SMESHGUI_FilterLibraryDlg( SMESHGUI*,
77 const char* name = 0 );
79 virtual ~SMESHGUI_FilterLibraryDlg();
81 void Init( const QValueList<int>& types, const int theMode );
82 void Init( const int type, const int theMode );
84 const SMESHGUI_FilterTable* GetTable() const;
85 void SetTable( const SMESHGUI_FilterTable* );
89 void closeEvent( QCloseEvent* e ) ;
90 void enterEvent ( QEvent * ) ;
91 void keyPressEvent( QKeyEvent* e );
103 void onReturnPressed();
104 void onFilterChanged( const QString& );
105 void onAddBtnPressed();
106 void onDeleteBtnPressed();
107 void onFilterNameChanged( const QString& );
108 void onEntityTypeChanged( const int );
109 void onNeedValidation();
113 void construct( const QValueList<int>& types, const int mode );
114 QFrame* createButtonFrame( QWidget* );
115 QFrame* createMainFrame ( QWidget* );
116 bool isValid( const bool theMess = true ) const;
117 bool isNameValid( const bool theMess = true ) const;
118 SMESH::Filter_ptr createFilter( const int theType = -1 );
119 QStringList prepareFilters() const;
120 QString autoExtension( const QString& ) const;
121 bool setSelected( const QString& );
122 int getIndex( const QString& ) const;
123 void updateControlsVisibility();
124 void updateMainButtons();
125 void enableMainButtons();
126 void processNewLibrary();
127 QString getFileName() const;
128 void setFileName( const QString& txt, const bool autoExtension = true );
129 QStringList filterWildCards( const QString& theFilter ) const;
130 QString& getDefaultLibraryName() const;
131 QString getDefaultFilterName() const;
132 void addFilterToLib( const QString& name );
134 bool isPermissionValid( const bool theIsExistingOnly );
139 QMap<int, QPushButton*> myButtons;
140 SMESHGUI_FilterTable* myTable;
141 QLineEdit* myFileName;
142 QPushButton* myOpenBtn;
144 QPushButton* myAddBtn;
145 QPushButton* myDeleteBtn;
146 QGroupBox* myNameGrp;
148 SMESHGUI* mySMESHGUI;
150 QValueList<int> myTypes;
153 SMESH::FilterLibrary_var myLibrary;
154 QString myCurrFilterName;
157 QString myHelpFileName;