Salome HOME
f16343391d5aa4980d7a1fa1d5963483c2ed8106
[modules/gui.git] / src / Qtx / QtxDirListEditor.h
1 #ifndef QTX_DIRLISTEDITOR_H
2 #define QTX_DIRLISTEDITOR_H
3
4 #include "Qtx.h"
5
6 #include <qwidget.h>
7 #include <qtoolbutton.h>
8 #include <qlineedit.h>
9 #include <qlistbox.h>
10 #include <qcombobox.h>
11
12 #ifdef WIN32
13 #pragma warning( disable:4251 )
14 #endif
15
16 /*!
17  * \brief The GUI implementation of the directory list
18  */
19 class QTX_EXPORT QtxDirListEditor : public QWidget {
20
21   Q_OBJECT
22
23 public:
24
25   /*!
26    * \brief Constructor
27    * \param parent - the parent of the widget
28    */
29   QtxDirListEditor(QWidget* parent);
30
31   /*!
32    * \brief Destructor
33    */
34   ~QtxDirListEditor();
35
36   /*!
37    * \brief Gets list of paths
38    * \param list - the returned reference to the list of paths
39    */
40   void          getPathList(QStringList& list);
41
42   /*!
43    * \brief Sets list of paths
44    * \param list - the list of paths to set
45    */
46   void          setPathList(const QStringList& list);
47
48   /*!
49    * \brief Event filter, redefined from QObject class
50    */
51   bool          eventFilter(QObject* object, QEvent* event);
52
53 protected:
54
55   /*!
56    * \brief Validates entered path
57    * \retval bool - returns status (true if OK)
58    */
59   bool          validate();
60
61   /*!
62    * \brief Appends/changes path
63    * \param item - the item in QListBox
64    * \param dir - the path
65    */
66   void          appendDir(QListBoxItem* item, const QString& dir);
67
68   /*!
69    * \brief Removes directory from list
70    * \param item - the item in QListBox
71    */
72   void          removeDir(QListBoxItem* item);
73
74   /*!
75    * \brief Resize event handler, reimplemented from QWidget
76    * \param event - the resize event
77    */
78   void          resizeEvent(QResizeEvent* event);
79
80 protected slots:
81
82   /*!
83    * \brief Called when user clicks inside directories list box
84    */
85   void          onMouseButtonClicked(int, QListBoxItem*, const QPoint&);
86
87   /*!
88    * \brief Called when user double-clicks on any item
89    */
90   void          onDblClicked(QListBoxItem*);
91
92   /*!
93    * \brief <...> (Browse dir) button slot
94    */
95   void          onBtnClicked();
96
97   /*!
98    * \brief Ccalled when user finises editing of path by pressing <Enter>
99    */
100   void          onEditFinished();
101
102   /*!
103    * \brief <Insert> button slot
104    */
105   void          onInsert();
106
107   /*!
108    * \brief  <Delete> button slot
109    */
110   void          onDelete();
111
112   /*!
113    * \brief  <Move up> button slot
114    */
115   void          onUp();
116
117   /*!
118    * \brief  <Move down> button slot
119    */
120   void          onDown();
121
122 private:
123   QListBox*     myDirList;          //!< directory list
124   QLineEdit*    myEdit;             //!< path edit box
125   QToolButton*  myBtn;              //!<  browse pah button
126   bool          myEdited;           //!<  edit mode flag
127   QListBoxItem* myLastSelected;     //!< last selected row
128
129 };
130
131 #endif