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 XGUI_PropertyPanel(QWidget* theParent, XGUI_OperationMgr* theMgr);
52 virtual ~XGUI_PropertyPanel();
54 /// Returns header widget
55 virtual QWidget* headerWidget() const { return myHeaderWidget; }
57 /// Returns main widget of the property panel, which children will be created
58 /// by WidgetFactory using the XML definition
59 ModuleBase_PageBase* contentWidget();
61 /// Brings back all widget created by widget factory for signal/slot
62 /// connections and further processing
63 void setModelWidgets(const QList<ModuleBase_ModelWidget*>& theWidgets);
65 /// Returns all property panel's widget created by WidgetFactory
66 virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const;
68 /// Removes all widgets in the widget area of the property panel
69 virtual void cleanContent();
71 /// Returns currently active widget
72 virtual ModuleBase_ModelWidget* activeWidget() const { return myActiveWidget; }
74 /// Activate the next widget in the property panel
75 /// \param theWidget a widget. The next widget should be activated
76 virtual void activateNextWidget(ModuleBase_ModelWidget* theWidget);
78 /// Activate the next from current widget in the property panel
79 virtual void activateNextWidget();
81 /// Set focus on the Ok button
82 virtual void setFocusOnOkButton();
84 /// Set Enable/Disable state of Cancel button
85 /// \param theEnabled Enable/Disable state of Cancel button
86 virtual void setCancelEnabled(bool theEnabled);
88 /// \return Enable/Disable state of Cancel button
89 virtual bool isCancelEnabled() const;
91 /// Editing mode depends on mode of current operation. This value is defined by it.
92 /// \param isEditing state of editing mode flag
93 virtual void setEditingMode(bool isEditing);
95 //! Allows to set predefined actions for the property panel fetched from the ActionsMgr
96 void setupActions(XGUI_ActionsMgr* theMgr);
98 /// Returns widget processed by preselection
99 virtual ModuleBase_ModelWidget* preselectionWidget() const;
101 /// Sets widget processed by preselection
102 virtual void setPreselectionWidget(ModuleBase_ModelWidget* theWidget);
104 /// Returns operation manager
105 XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
109 /// \brief Update all widgets in property panel with values from the given feature
110 /// \param theFeature a Feature to update values in widgets
111 void updateContentWidget(FeaturePtr theFeature);
114 * Makes the given widget active, highlights it and removes
115 * highlighting from the previous active widget
116 * emits widgetActivated(theWidget) signal
117 * \param theWidget which has to be activated
119 virtual void activateWidget(ModuleBase_ModelWidget* theWidget);
121 void onFocusNextPrev();
124 /// Makes the widget active, deactivate the previous, activate and hightlight the given one
125 /// \param theWidget a widget
126 bool setActiveWidget(ModuleBase_ModelWidget* theWidget);
128 /// The parent method that processes the "Tab"/"SHIF + Tab" keyboard events
129 /// Emits a signal about focus change
130 /// If theIsNext is true, this function searches forward, if next is false, it searches backward.
131 virtual bool focusNextPrevChild(bool theIsNext);
134 /// A method called on the property panel closed
135 /// \param theEvent a close event
136 void closeEvent(QCloseEvent* theEvent);
139 QWidget* myHeaderWidget;
142 ModuleBase_PageWidget* myPanelPage;
143 QList<ModuleBase_ModelWidget*> myWidgets;
145 /// Currently active widget
146 ModuleBase_ModelWidget* myActiveWidget;
147 /// Currently widget processed by preselection
148 ModuleBase_ModelWidget* myPreselectionWidget;
150 XGUI_OperationMgr* myOperationMgr;
153 #endif /* XGUI_PROPERTYPANEL_H_ */