Salome HOME
Add file dialog options in QtxPathEdit
[modules/gui.git] / src / Qtx / QtxPathEdit.h
1 // Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File:      QtxPathEdit.h
21 // Author:    Sergey TELKOV
22 //
23 #ifndef QTXPATHEDIT_H
24 #define QTXPATHEDIT_H
25
26 #include "Qtx.h"
27
28 #include <QFrame>
29 #include <QFileDialog>
30
31 class QLineEdit;
32
33 class QTX_EXPORT QtxPathEdit : public QFrame
34 {
35   Q_OBJECT
36
37 public:
38   QtxPathEdit( const Qtx::PathType, QWidget* = 0, bool = false );
39   QtxPathEdit( QWidget* = 0, bool = false );
40   virtual ~QtxPathEdit();
41
42   QString       path() const;
43   void          setPath( const QString& );
44
45   Qtx::PathType pathType() const;
46   void          setPathType( const Qtx::PathType );
47
48   QString       pathFilter() const;
49   void          setPathFilter( const QString& );
50
51   QFileDialog::Options pathOptions() const;
52   void setPathOptions( const QFileDialog::Options );
53
54 private slots:
55   void          onBrowse( bool = false );
56
57 protected:
58   QLineEdit*    lineEdit() const;
59
60 private:
61   void          initialize();
62   void          updateState();
63
64 private:
65   QLineEdit*    myPath;
66   Qtx::PathType myType;
67   QString       myFilter;
68   QFileDialog::Options myOptions;
69   bool          myBrowse;
70 };
71
72 #endif