ICF 3.1.1.10
Technical documentation of ICF Libraries
CComposedParamsSetGuiComp.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#ifndef iqtprm_CComposedParamsSetGuiComp_included
7#define iqtprm_CComposedParamsSetGuiComp_included
8
9
10// Qt includes
11#include <QtCore/QString>
12#include <QtCore/QSet>
13
14// ICF includes
16#include <iprm/IParamsSet.h>
19#include <iview/IShapeFactory.h>
20
21
22#include <GeneratedFiles/iprmgui/ui_CComposedParamsSetGuiComp.h>
23
24
25namespace iprmgui
26{
27
28
30 public istdgui::TDesignerGuiObserverCompBase<Ui::CComposedParamsSetGuiComp, iprm::IParamsSet>,
31 virtual public i2dgui::IViewExtender,
32 virtual public iview::IShapeFactory
33{
34 Q_OBJECT
35
36public:
38
46
47 I_BEGIN_COMPONENT(CComposedParamsSetGuiComp);
48 I_REGISTER_INTERFACE(i2dgui::IViewExtender);
49 I_ASSIGN_MULTI_0(m_editorsCompPtr, "Editors", "List of GUI's for parameters edition", true);
50 I_ASSIGN_TO(m_guisCompPtr, m_editorsCompPtr, true);
51 I_ASSIGN_TO(m_observersCompPtr, m_editorsCompPtr, true);
52 I_ASSIGN_TO(m_extendersCompPtr, m_editorsCompPtr, false);
53 I_ASSIGN_TO(m_shapeFactoriesCompPtr, m_editorsCompPtr, false);
54 I_ASSIGN(m_paramsLoaderCompPtr, "ParamsLoader", "Loader for the parameter set", false, "ParamsLoader");
55 I_ASSIGN_MULTI_0(m_idsAttrPtr, "Ids", "List of parameter ID's according to defined editors, if ID equals '*' then the observed parameter set will be used, if it is empty than only GUI will be shown, but no parameter will be connected", true);
56 I_ASSIGN_MULTI_0(m_namesAttrPtr, "Names", "List of of gui names", false);
57 I_ASSIGN(m_useHorizontalLayoutAttrPtr, "UseHorizontalLayout", "Use horizontal layout", true, false);
58 I_ASSIGN(m_useVerticalSpacerAttrPtr, "UseVerticalSpacer", "Use vertical spacer to keep inserted objects in place", true, false);
59 I_ASSIGN(m_showAllShapesAttrPtr, "ShowAllShapes", "If true all shapes, also generated by inactive GUI, will be shown", true, false);
60 I_ASSIGN(m_designTypeAttrPtr, "DesignType", "Type of design:\n* 0 - simple\n* 1 - tool box\n* 2 - tab\n* 3 - simple scrollable", true, DT_SIMPLE);
61 I_ASSIGN(m_tabOrientationAttrPtr, "TabBarOrientation", "Orientation of the tab bar for tab design\n 0 - North\n 1 - South\n 2 - West\n 3 - East", true, 0);
62 I_END_COMPONENT;
63
65
66 // reimplemented (istdgui::TGuiObserverWrap)
67 void UpdateGui(const istd::IChangeable::ChangeSet& changeSet) override;
68
69 // reimplemented (istdgui::CGuiComponentBase)
70 void OnGuiCreated() override;
71 void OnGuiDestroyed() override;
72 void OnGuiRetranslate() override;
73
74 // reimplemented (i2dgui::IViewExtender)
75 void AddItemsToScene(i2dgui::IViewProvider* providerPtr, int flags) override;
76 void RemoveItemsFromScene(i2dgui::IViewProvider* providerPtr) override;
77
78 // reimplemented (iview::IShapeFactory)
79 std::unique_ptr<iview::IShape> CreateShape(const istd::IChangeable* objectPtr, bool connectToModel = false) const override;
80
81protected:
82 struct PanelData
83 {
84 QWidget* pagePtr = nullptr;
85 QWidget* paramWidgetPtr = nullptr;
86 bool isOptional = false;
87 bool isEnabled = false;
88 };
89
90 void AttachToScene(i2dgui::IViewProvider* providerPtr, int flags);
92
93 QList<imod::IModelEditor*> GetModelEditors() const;
94 QList<QByteArray> GetIds() const;
95
96 void UpdateEnabledState(int listIndex, const PanelData& panelData, imod::IModelEditor* editorPtr);
97
98 // reimplemented (istdgui::TGuiObserverWrap)
99 void OnGuiModelAttached() override;
100 void OnGuiModelDetached() override;
101 void UpdateModel() const override;
102
103protected Q_SLOTS:
104 void OnEditorChanged(int index);
108
109private:
110 I_MULTIREF(imod::IModelEditor, m_editorsCompPtr);
111 I_MULTIREF(istdgui::IGuiObject, m_guisCompPtr);
112 I_MULTIREF(imod::IObserver, m_observersCompPtr);
113 I_MULTIREF(i2dgui::IViewExtender, m_extendersCompPtr);
114 I_MULTIREF(iview::IShapeFactory, m_shapeFactoriesCompPtr);
115 I_REF(ifile::IFilePersistence, m_paramsLoaderCompPtr);
116 I_MULTIATTR(QByteArray, m_idsAttrPtr);
117 I_MULTITEXTATTR(m_namesAttrPtr);
118 I_ATTR(bool, m_useHorizontalLayoutAttrPtr);
119 I_ATTR(bool, m_useVerticalSpacerAttrPtr);
120 I_ATTR(bool, m_showAllShapesAttrPtr);
121 I_ATTR(int, m_designTypeAttrPtr);
122 I_ATTR(int, m_tabOrientationAttrPtr);
123 I_ATTR(bool, m_flatViewAttrPtr);
124
125 typedef QMap<imod::IModelEditor*, bool> ConnectedEditorsMap;
126 ConnectedEditorsMap m_connectedEditorsMap;
127
128 int m_currentGuiIndex;
129
130 typedef QMap<i2dgui::IViewProvider*, int> ConnectedSceneFlags; // maps connected scene provider to connection flags
131 ConnectedSceneFlags m_connectedSceneFlags;
132
136 QWidget* m_guiContainerPtr;
137 QMap<istdgui::IGuiObject*, PanelData> m_guiToWidgetMap;
138};
139
140
141} // namespace iprmgui
142
143
144#endif // !iqtprm_CComposedParamsSetGuiComp_included
145
146
Interface for GUI objects presenting its results using extern view objects.
Interface for GUI objects managing view.
Interface providing loading and saving of data objects.
Common interface for an model editor.
Common interface for all classes implementing the Observer functionality in the Model/Observer design...
Definition IObserver.h:30
istdgui::TDesignerGuiObserverCompBase< Ui::CComposedParamsSetGuiComp, iprm::IParamsSet > BaseClass
void UpdateEnabledState(int listIndex, const PanelData &panelData, imod::IModelEditor *editorPtr)
void OnGuiCreated() override
Called just after GUI is initialized.
QList< QByteArray > GetIds() const
void UpdateGui(const istd::IChangeable::ChangeSet &changeSet) override
void UpdateModel() const override
void AttachToScene(i2dgui::IViewProvider *providerPtr, int flags)
void AddItemsToScene(i2dgui::IViewProvider *providerPtr, int flags) override
Called when items should be added to specified scene.
std::unique_ptr< iview::IShape > CreateShape(const istd::IChangeable *objectPtr, bool connectToModel=false) const override
Create a graphical representation of the given 2D-object object.
void RemoveItemsFromScene(i2dgui::IViewProvider *providerPtr) override
Called when items should be removed from specified scene.
void OnGuiDestroyed() override
Called just before GUI is released.
void OnGuiRetranslate() override
Called from widget event filter when GUI should be retranslated.
void DetachFromScene(i2dgui::IViewProvider *providerPtr)
QList< imod::IModelEditor * > GetModelEditors() const
Set of change flags (its IDs).
Definition IChangeable.h:38
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
Common interface for GUI objects using in component context.
Definition IGuiObject.h:27
Base class for all Qt GUI components.
Interface for creation of visualization shapes of some geometrical object.
This package contains Qt based implementations of standard parameter components.

© Witold Gantzke and Kirill Lepskiy