Salome HOME
Issue #1834: Fix length of lines
[modules/shaper.git] / src / CollectionPlugin / CollectionPlugin_WidgetField.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        CollectionPlugin_WidgetField.h
4 // Created:     16 Nov 2016
5 // Author:      Vitaly SMETANNIKOV
6
7
8 #ifndef CollectionPlugin_WidgetField_H
9 #define CollectionPlugin_WidgetField_H
10
11
12 #include "CollectionPlugin.h"
13
14 #include <ModuleBase_WidgetSelector.h>
15 #include <ModuleBase_ViewerPrs.h>
16
17 #include <QList>
18 #include <QStringList>
19
20
21 class QWidget;
22 class QComboBox;
23 class QSpinBox;
24 class QLabel;
25 class QSlider;
26 class QTableWidget;
27 class QStackedWidget;
28 class QPushButton;
29
30 /*!
31  * \ingroup GUI
32  * Represent a content of the property panel to show/modify parameters of a Field feature.
33  */
34 class CollectionPlugin_WidgetField : public ModuleBase_WidgetSelector
35 {
36  Q_OBJECT
37 public:
38   CollectionPlugin_WidgetField(QWidget* theParent, 
39                                ModuleBase_IWorkshop* theWorkshop, 
40                                const Config_WidgetAPI* theData);
41
42   virtual ~CollectionPlugin_WidgetField() {}
43
44   /// Returns list of widget controls
45   /// \return a control list
46   virtual QList<QWidget*> getControls() const;
47
48   /// Checks the widget validity. By default, it returns true.
49   /// \param thePrs a selected presentation in the view
50   /// \return a boolean value
51   virtual bool isValidSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
52
53
54 protected:
55   /// Saves the internal parameters to the given feature
56   /// \return True in success
57   virtual bool storeValueCustom();
58
59   /// Restore value from attribute data to the widget's control
60   virtual bool restoreValueCustom();
61
62   /// Retunrs a list of possible shape types
63   /// \return a list of shapes
64   virtual QIntList shapeTypes() const;
65
66
67 protected slots:
68   /// Slot which is called on selection event
69   virtual void onSelectionChanged();
70
71 private slots:
72   void onNbCompChanged(int theVal);
73
74   void onAddStep();
75
76   void onRemoveStep();
77
78   void onStepMove(int theStep);
79
80   void onFieldTypeChanged(int theIdx);
81
82 private:
83   void clearData();
84
85   void appendStepControls();
86   void removeStepControls();
87
88   /// Types of shapes selection
89   QComboBox* myShapeTypeCombo;
90
91   /// Types of field data
92   QComboBox* myFieldTypeCombo;
93
94   /// Number of components
95   QSpinBox* myNbComponentsSpn;
96
97   /// Label of current step
98   QLabel* myCurStepLbl;
99
100   /// Slider for steps management
101   QSlider* myStepSlider;
102
103   /// Stamp value
104   QList<QSpinBox*> myStampSpnList;
105
106   QList<QTableWidget*> myDataTblList;
107
108   QLabel* myMaxLbl;
109
110   QStackedWidget* myStepWgt;
111
112   QStringList myCompNamesList;
113
114   QList<ModuleBase_ViewerPrsPtr> mySelection;
115
116   QPushButton* myRemoveBtn;
117 };
118
119 #endif