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 // File: QtxPathDialog.h
23 // Author: Sergey TELKOV
25 #ifndef QTXPATHDIALOG_H
26 #define QTXPATHDIALOG_H
28 #include "QtxDialog.h"
38 #pragma warning( disable:4251 )
41 class QTX_EXPORT QtxPathDialog : public QtxDialog
46 QtxPathDialog( QWidget* = 0, const bool = true, const bool = false,
47 const int = Standard, Qt::WindowFlags = 0 );
50 QtxPathDialog( const bool, QWidget* = 0, const bool = true,
51 const bool = false, const int = Standard, Qt::WindowFlags = 0 );
52 virtual ~QtxPathDialog();
54 QString fileName() const;
55 void setFileName( const QString&, const bool = false );
57 QString filter() const;
58 void setFilter( const QString& );
61 void fileNameChanged( QString );
64 virtual void setVisible( bool );
71 void onReturnPressed();
72 void onTextChanged( const QString& );
75 virtual bool isValid();
76 virtual bool acceptData() const;
77 virtual void fileNameChanged( int, QString );
79 QFrame* optionsFrame();
80 QString fileName( const int ) const;
81 void setFileName( const int, const QString&, const bool = false );
83 QString filter( const int ) const;
84 void setFilter( const int, const QString& );
86 QLineEdit* fileEntry( const int ) const;
87 QLineEdit* fileEntry( const int, int& ) const;
88 int createFileEntry( const QString&, const int,
89 const QString& = QString(), const int = -1 );
91 int defaultEntry() const;
92 void setDefaultEntry( const int );
96 void updateVisibility();
97 QStringList prepareFilters( const QString& ) const;
98 bool hasVisibleChildren( QWidget* ) const;
99 QStringList filterWildCards( const QString& ) const;
100 QString autoExtension( const QString&, const QString& = QString() ) const;
103 enum { OpenFile, SaveFile, OpenDir, SaveDir, NewDir };
106 typedef struct { int mode; QLineEdit* edit; QString filter;
107 QPushButton* btn; QFileDialog* dlg; } FileEntry;
108 typedef QMap<int, FileEntry> FileEntryMap;
111 FileEntryMap myEntries;
113 QWidget* myEntriesFrame;
114 QFrame* myOptionsFrame;
118 #pragma warning( default:4251 )