Salome HOME
Merge branch 'akl/tests_update'
[modules/paravis.git] / src / Plugins / MEDReader / ParaViewPlugin / VectBoolWidget.h
1 // Copyright (C) 2010-2014  CEA/DEN, EDF R&D
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 // Author : Anthony Geay
20
21 #ifndef __VECTBOOLWIDGET_H__
22 #define __VECTBOOLWIDGET_H__
23
24 #include <QFrame>
25 #include <QLabel>
26
27 class QSlider;
28 class QGroupBox;
29 class QHBoxLayout;
30 class QVBoxLayout;
31 class QGridLayout;
32 class QPushButton;
33 class VectBoolModel;
34 class VectBoolSpreadSheet;
35
36 class NbOfActiveTSDisplay : public QLabel
37 {
38 Q_OBJECT
39 public:
40   NbOfActiveTSDisplay(QWidget *parent=0);
41 public slots:
42   void display(int nbOfItemsOn, int totalNbOfItems);
43   void totalNbOfItemsChanged(int totalNbOfItems);
44 private:
45   int _nb_of_items_on;
46   int _total_nb_of_items;
47 };
48
49 class VectBoolItem : public QObject
50 {
51 Q_OBJECT
52 Q_PROPERTY(bool activated READ isActivated WRITE activated)
53 public:
54   VectBoolItem(QObject *parent, int pos, VectBoolModel *model);
55   bool isActivated() const;
56   void activated(bool val);
57 public slots:
58   void theModelHasChanged();
59 signals:
60   void changed();
61 private:
62   int _pos;
63   mutable bool _old_status;
64   VectBoolModel *_model;
65 };
66
67 class VectBoolWidget : public QFrame
68 {
69 public:
70   VectBoolWidget(QWidget *parent, int nbOfItems);
71   ~VectBoolWidget();
72   int getNumberOfBoolItems() const;
73   void setItems(const QStringList& dts, const QStringList& its, const QStringList& tts);
74   const QVector<VectBoolItem *>& getItems() const { return _items; }
75 private:
76   static int GetMaxTickValueOfSlider(int val);
77 private:
78   QVector<VectBoolItem *> _items;
79   QHBoxLayout *_horizontal_layout;
80   QFrame *_spreadsheet_container;
81   QGridLayout *_grid_layout;
82   QGroupBox *_group_box;
83   QVBoxLayout *_vertical_layout;
84   NbOfActiveTSDisplay *_nb_of_time_steps_on;
85   QSlider *_nb_of_rows_selecter;
86   QPushButton *_sel_unsel_all;
87   VectBoolSpreadSheet *_vbw;
88   VectBoolModel *_vbm;
89 };
90
91 #endif