Salome HOME
Merge branch 'BR_LAND_COVER_MAP' of ssh://git.salome-platform.org/modules/hydro into...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_OrderedListWidget.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #ifndef HYDROGUI_ORDEREDLISTWIDGET_H
20 #define HYDROGUI_ORDEREDLISTWIDGET_H
21
22 #include "HYDROGUI_ListModel.h"
23
24 #include <QWidget>
25
26 class QListView;
27 class QPushButton;
28
29 /** 
30  * \class HYDROGUI_OrderedListWidget
31  * \brief The class representing widget for managing list of objects.
32  *
33  * The widget represents a list and a set of buttons (top, up, down and bottom)
34  * providing the possibility to change the list items order.
35  */
36 class HYDRO_EXPORT HYDROGUI_OrderedListWidget : public QWidget
37 {
38   Q_OBJECT
39
40 public:
41   HYDROGUI_OrderedListWidget( QWidget* theParent, int theArrowIconSize = 32 );
42   virtual ~HYDROGUI_OrderedListWidget();
43
44   void setObjects( const HYDROGUI_ListModel::Object2VisibleList& theObjects );
45   HYDROGUI_ListModel::ObjectList getObjects() const;
46
47   void addObject( const HYDROGUI_ListModel::Object2Visible& theObject );
48   void removeObjectByName( const QString& theObjectName );
49
50   void setHiddenObjectsShown( const bool theIsToShow );
51   void setVisibilityIconShown( const bool theIsToShow );
52
53   void setOrderingEnabled( const bool theIsToEnable );
54
55   QStringList getSelectedEntries() const;
56   void setSelectedEntries( const QStringList& theEntries ) const;
57
58   QStringList getSelectedNames() const;
59   QStringList getAllNames() const;
60
61   void undoLastMove();
62
63 signals:
64   void selectionChanged();
65   void orderChanged();
66
67 private slots:
68   void onMove( int theType );
69
70 private:
71   HYDROGUI_ListModel* getSourceModel() const;
72
73   QModelIndexList getSelectedIndexes() const;
74
75 private:
76   QListView*   myList;   ///< the list view
77   QPushButton* myTop;    ///< the move on top button
78   QPushButton* myUp;     ///< the move up button
79   QPushButton* myDown;   ///< the move down button
80   QPushButton* myBottom; ///< the move on bottom button
81
82   bool myIsHiddenObjectsShown; ///< defines whether to include hidden objects in the list
83   bool myIsVisibilityIconShown; ///< defines whether to show visibility icon (eye icon)
84 };
85
86 #endif