1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
6 * Created on: Apr 29, 2014
10 #ifndef XGUI_PROPERTYPANEL_H_
11 #define XGUI_PROPERTYPANEL_H_
15 #include <ModuleBase_ModelWidget.h>
16 #include <ModuleBase_IPropertyPanel.h>
20 class XGUI_ActionsMgr;
23 class ModuleBase_PageBase;
24 class ModuleBase_PageWidget;
25 class XGUI_OperationMgr;
27 /// Internal name of property panel widget
28 const static char* PROP_PANEL = "property_panel_dock";
30 /// Internal name of Ok button
31 const static char* PROP_PANEL_OK = "property_panel_ok";
33 /// Internal name of Cancel button
34 const static char* PROP_PANEL_CANCEL = "property_panel_cancel";
36 /// Internal name of Help button
37 const static char* PROP_PANEL_HELP = "property_panel_help";
41 * Realization of Property panel object.
43 class XGUI_EXPORT XGUI_PropertyPanel : public ModuleBase_IPropertyPanel
49 /// \param theParent is a parent of the property panel
50 /// \param theMgr operation manager
51 XGUI_PropertyPanel(QWidget* theParent, XGUI_OperationMgr* theMgr);
53 virtual ~XGUI_PropertyPanel();
55 /// Returns header widget
56 virtual QWidget* headerWidget() const { return myHeaderWidget; }
58 /// Returns main widget of the property panel, which children will be created
59 /// by WidgetFactory using the XML definition
60 ModuleBase_PageBase* contentWidget();
62 /// Brings back all widget created by widget factory for signal/slot
63 /// connections and further processing
64 void setModelWidgets(const QList<ModuleBase_ModelWidget*>& theWidgets);
66 /// Returns all property panel's widget created by WidgetFactory
67 virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const;
69 /// Removes all widgets in the widget area of the property panel
70 virtual void cleanContent();
72 /// Returns currently active widget
73 virtual ModuleBase_ModelWidget* activeWidget() const { return myActiveWidget; }
75 /// Activate the next widget in the property panel
76 /// \param theWidget a widget. The next widget should be activated
77 virtual void activateNextWidget(ModuleBase_ModelWidget* theWidget);
79 /// Activate the next from current widget in the property panel
80 virtual void activateNextWidget();
82 /// Set focus on the Ok button
83 virtual void setFocusOnOkButton();
85 /// Set Enable/Disable state of Cancel button
86 /// \param theEnabled Enable/Disable state of Cancel button
87 virtual void setCancelEnabled(bool theEnabled);
89 /// \return Enable/Disable state of Cancel button
90 virtual bool isCancelEnabled() const;
92 /// Editing mode depends on mode of current operation. This value is defined by it.
93 /// \param isEditing state of editing mode flag
94 virtual void setEditingMode(bool isEditing);
96 //! Allows to set predefined actions for the property panel fetched from the ActionsMgr
97 void setupActions(XGUI_ActionsMgr* theMgr);
99 /// Returns widget processed by preselection
100 virtual ModuleBase_ModelWidget* preselectionWidget() const;
102 /// Sets widget processed by preselection
103 virtual void setPreselectionWidget(ModuleBase_ModelWidget* theWidget);
105 /// Returns operation manager
106 XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
110 /// \brief Update all widgets in property panel with values from the given feature
111 /// \param theFeature a Feature to update values in widgets
112 void updateContentWidget(FeaturePtr theFeature);
115 * Makes the given widget active, highlights it and removes
116 * highlighting from the previous active widget
117 * emits widgetActivated(theWidget) signal
118 * \param theWidget which has to be activated
120 virtual void activateWidget(ModuleBase_ModelWidget* theWidget);
123 /// Makes the widget active, deactivate the previous, activate and hightlight the given one
124 /// \param theWidget a widget
125 bool setActiveWidget(ModuleBase_ModelWidget* theWidget);
127 /// The parent method that processes the "Tab"/"SHIF + Tab" keyboard events
128 /// Emits a signal about focus change
129 /// If theIsNext is true, this function searches forward, if next is false, it searches backward.
130 virtual bool focusNextPrevChild(bool theIsNext);
133 /// A method called on the property panel closed
134 /// \param theEvent a close event
135 void closeEvent(QCloseEvent* theEvent);
138 QWidget* myHeaderWidget;
141 ModuleBase_PageWidget* myPanelPage;
142 QList<ModuleBase_ModelWidget*> myWidgets;
144 /// Currently active widget
145 ModuleBase_ModelWidget* myActiveWidget;
146 /// Currently widget processed by preselection
147 ModuleBase_ModelWidget* myPreselectionWidget;
149 XGUI_OperationMgr* myOperationMgr;
152 #endif /* XGUI_PROPERTYPANEL_H_ */