]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModuleBase/ModuleBase_WidgetConcealedObjects.h
Salome HOME
Merge branch 'master' of salome:modules/shaper
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetConcealedObjects.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_WidgetConcealedObjects.h
4 // Created:     29 Jul 2016
5 // Author:      Natalia ERMOLAEVA
6
7 #ifndef MODULEBASE_WIDGETCONCEALEDOBJECTS_H_
8 #define MODULEBASE_WIDGETCONCEALEDOBJECTS_H_
9
10 #include <ModuleBase.h>
11 #include <ModuleBase_ModelWidget.h>
12
13 #include <string>
14 #include <map>
15 #include <memory>
16
17 class ModelAPI_Object;
18
19 class QWidget;
20 class QTableWidget;
21 class QToolButton;
22
23 /**
24 * \ingroup GUI
25 * Implementation of model widget for table of concealed objects.
26 */
27 class MODULEBASE_EXPORT ModuleBase_WidgetConcealedObjects : public ModuleBase_ModelWidget
28 {
29   Q_OBJECT
30  public:
31   /// Constructor
32   /// \param theParent the parent object
33   /// \param theData the widget configuration.
34   ModuleBase_WidgetConcealedObjects(QWidget* theParent,
35                                     const Config_WidgetAPI* theData);
36   virtual ~ModuleBase_WidgetConcealedObjects();
37
38   /// Redefinition of virtual method
39   virtual QList<QWidget*> getControls() const;
40
41   /// The widget can not accept focus
42   virtual bool canAcceptFocus() const { return false; };
43
44 protected:
45   /// Saves the internal parameters to the given feature
46   /// \return True in success
47   virtual bool storeValueCustom();
48
49   /// Redefinition of virtual method
50   virtual bool restoreValueCustom();
51
52 private:
53   /// Creates a row in view
54   /// \param theResult a result for the row
55   void addViewRow(const std::shared_ptr<ModelAPI_Result>& theResult);
56
57 private slots:
58   /// Processes the display button click in the view.
59   /// \param theState a new state
60   void onItemToggled(bool theState);
61
62 private:
63   /// Updates icon of button
64   /// \param theButton a button of the table
65   void updateItemIcon(QToolButton* theButton);
66
67 private:
68   std::string myBaseShapeAttribute; ///< attribute of the base object
69   QTableWidget* myView; ///< table view of visibility states
70
71   std::shared_ptr<ModelAPI_Feature> myBaseFeature; ///< backup of feature of filling the table view
72   /// backup of visualized in the view concealed objects, stored to avoid table rebuild by restore
73   std::map<int, std::shared_ptr<ModelAPI_Result> > myConcealedResults;
74 };
75
76 #endif /* MODULEBASE_WIDGETCONCEALEDOBJECTS_H_ */