]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_InspectionPanel.h
Salome HOME
bos #29477 Information on shape in TUI. New 'shapeInfo' python method.
[modules/shaper.git] / src / XGUI / XGUI_InspectionPanel.h
1 // Copyright (C) 2014-2022  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
20 #ifndef XGUI_INSPECTIONPANEL_H_
21 #define XGUI_INSPECTIONPANEL_H_
22
23 #include "XGUI.h"
24
25 #include <ModelAPI_Feature.h>
26 #include <GeomAlgoAPI_ShapeInfo.h>
27
28 #include <QDockWidget>
29
30 #include <memory>
31
32 class XGUI_Workshop;
33 class QLineEdit;
34 class QTableWidget;
35 class QLabel;
36 class QTextBrowser;
37 class QVBoxLayout;
38 class QResizeEvent;
39 class QStackedWidget;
40 class QGridLayout;
41
42 class TopoDS_Shape;
43
44 class ModuleBase_PageWidget;
45
46 /// Internal name of property panel widget
47 MAYBE_UNUSED const static char* INSPECTION_PANEL = "inspection_panel_dock";
48
49 /**
50 * \ingroup GUI
51 * A class which represents an inspection panel: to show content of currently selected objects
52 */
53 class XGUI_EXPORT XGUI_InspectionPanel : public QDockWidget, public GeomAlgoAPI_ShapeInfo::Translator
54 {
55   Q_OBJECT
56 public:
57   /// Type of selected objects
58   enum SudShape {
59     ShapeId,
60     CompoundId,
61     CompsolidId,
62     SolidId,
63     ShellId,
64     FaceId,
65     WireId,
66     EdgeId,
67     VertexId
68   };
69
70   /// Constructor
71   /// \param theParent is a parent of the property panel
72   /// \param theMgr operation manager
73   XGUI_InspectionPanel(QWidget* theParent, XGUI_Workshop* theWorkshop);
74
75   // Destructor
76   virtual ~XGUI_InspectionPanel();
77
78   // A translator of resource strings, needed for ShapeInfo.
79   virtual std::string translate(const char* theSource) override;
80
81
82 protected:
83   virtual void showEvent(QShowEvent* theEvent);
84
85 private slots:
86   /// A slot to react on selection changed
87   void onSelectionChanged();
88
89 private:
90   /// Set counts of a sub-shapes
91   /// \param theId an id of sub-shape type
92   /// \param theVal a number of sub-shapes of corresponded type
93   void setSubShapeValue(SudShape theId, int theVal);
94
95   /// Set name of current selection
96   /// \param theName the name
97   void setName(const QString& theName);
98
99   /// Set content of selected shape into table
100   /// \param theShape the shape
101   void setShapeContent(const TopoDS_Shape& theShape);
102
103   /// Clear content of the window
104   void clearContent();
105
106   /// Set text into parameters area
107   /// \param theText the text
108   void setParamsText(const QString& theText);
109
110   /// Fills Feature panel with controls specific to the given feature
111   /// \param theFeature the selected feature
112   void buildFeaturePane(const FeaturePtr& theFeature);
113
114 private:
115   XGUI_Workshop* myWorkshop; //> selection manager
116
117   QLineEdit* myNameEdt; ///> Name field
118   QTableWidget* mySubShapesTab; ///> table of sub-shapes
119   QLabel* myTypeLbl; ///> label of a type
120   QTextBrowser* myTypeParams; ///> parameters area
121   QVBoxLayout* myMainLayout; ///> main layout
122   ModuleBase_PageWidget* myFeaturePane; ///> Content of feature property panel
123   QGridLayout* myFeatureLayout; ///> Layout of feature panel
124   QStackedWidget* myStackWgt; ///> base widget of the panel
125   int myShapePanelId;
126   int myFeaturePanelId;
127 };
128
129 #endif