1 // Copyright (C) 2007-2016 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 // File: QtxPathDialog.h
24 // Author: Sergey TELKOV
26 #ifndef QTXPATHDIALOG_H
27 #define QTXPATHDIALOG_H
29 #include "QtxDialog.h"
39 #pragma warning( disable:4251 )
42 class QTX_EXPORT QtxPathDialog : public QtxDialog
47 QtxPathDialog( QWidget* = 0, const bool = true, const bool = false,
48 const int = Standard, Qt::WindowFlags = 0 );
51 QtxPathDialog( const bool, QWidget* = 0, const bool = true,
52 const bool = false, const int = Standard, Qt::WindowFlags = 0 );
53 virtual ~QtxPathDialog();
55 QString fileName() const;
56 void setFileName( const QString&, const bool = false );
58 QString filter() const;
59 void setFilter( const QString& );
62 void fileNameChanged( QString );
65 virtual void setVisible( bool );
72 void onReturnPressed();
73 void onTextChanged( const QString& );
76 virtual bool isValid();
77 virtual bool acceptData() const;
78 virtual void fileNameChanged( int, QString );
80 QFrame* optionsFrame();
81 QString fileName( const int ) const;
82 void setFileName( const int, const QString&, const bool = false );
84 QString filter( const int ) const;
85 void setFilter( const int, const QString& );
87 QLineEdit* fileEntry( const int ) const;
88 QLineEdit* fileEntry( const int, int& ) const;
89 int createFileEntry( const QString&, const int,
90 const QString& = QString(), const int = -1 );
92 int defaultEntry() const;
93 void setDefaultEntry( const int );
97 void updateVisibility();
98 QStringList prepareFilters( const QString& ) const;
99 bool hasVisibleChildren( QWidget* ) const;
100 QStringList filterWildCards( const QString& ) const;
101 QString autoExtension( const QString&, const QString& = QString() ) const;
104 enum { OpenFile, SaveFile, OpenDir, SaveDir, NewDir };
107 typedef struct { int mode; QLineEdit* edit; QString filter;
108 QPushButton* btn; QFileDialog* dlg; } FileEntry;
109 typedef QMap<int, FileEntry> FileEntryMap;
112 FileEntryMap myEntries;
114 QWidget* myEntriesFrame;
115 QFrame* myOptionsFrame;
119 #pragma warning( default:4251 )