ACF $AcfVersion:0$
CModelEditorGuiComp.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// ACF includes
6#include <imod/IModel.h>
7#include <imod/IModelEditor.h>
8#include <imod/IObserver.h>
9
11
12#include <iqtgui/IGuiObject.h>
13
14
15namespace iqtgui
16{
17
18
25 virtual public iqtgui::IGuiObject,
26 virtual public imod::IModelEditor
27{
28public:
30
31 I_BEGIN_COMPONENT(CModelEditorGuiComp);
32 I_REGISTER_INTERFACE(iqtgui::IGuiObject);
33 I_REGISTER_INTERFACE(imod::IModelEditor);
34 I_ASSIGN(m_slaveEditorCompPtr, "SlaveEditorGui", "Slave GUI object will be connected to model", true, "SlaveEditor");
35 I_ASSIGN_TO(m_slaveGuiCompPtr, m_slaveEditorCompPtr, true);
36 I_ASSIGN_TO(m_slaveObserverCompPtr, m_slaveEditorCompPtr, false);
37 I_ASSIGN(m_modelCompPtr, "Model", "Model will be observed and modify using editor", true, "Model");
38 I_END_COMPONENT;
39
41
42 // reimplemented (iqtgui::IGuiObject)
43 virtual bool IsGuiCreated() const override;
44 virtual bool CreateGui(QWidget* parentPtr) override;
45 virtual bool DestroyGui() override;
46 virtual QWidget* GetWidget() const override;
47 virtual void OnTryClose(bool* ignoredPtr = NULL) override;
48
49 // reimplemented (imod::IModelEditor)
50 virtual void UpdateEditor(const istd::IChangeable::ChangeSet& changeSet) override;
51 virtual void UpdateModelFromEditor() const override;
52 virtual bool IsReadOnly() const override;
53 virtual void SetReadOnly(bool state) override;
54
55protected:
56 // reimplemented (icomp::CComponentBase)
57 virtual void OnComponentCreated() override;
58 virtual void OnComponentDestroyed() override;
59
60private:
61 I_REF(iqtgui::IGuiObject, m_slaveGuiCompPtr);
62 I_REF(imod::IObserver, m_slaveObserverCompPtr);
63 I_REF(imod::IModelEditor, m_slaveEditorCompPtr);
64 I_REF(imod::IModel, m_modelCompPtr);
65
66 bool m_isConnected;
67};
68
69
70} // namespace iqtgui
71
72
73
74
Base class for component implementation.
Common interface for an model editor.
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:25
Common interface for all classes implementing the Observer functionality in the Model/Observer design...
Definition IObserver.h:156
Component realizing static connection between GUI and model components.
virtual void SetReadOnly(bool state) override
Set flag that the model data can be changed.
virtual void UpdateModelFromEditor() const override
Updates model from editor.
icomp::CComponentBase BaseClass
virtual bool DestroyGui() override
Releases GUI resources and disconnects from the parent.
virtual QWidget * GetWidget() const override
Gets access to the internal QWidget object.
virtual bool IsReadOnly() const override
Returns true if the model data can be changed.
virtual void UpdateEditor(const istd::IChangeable::ChangeSet &changeSet) override
Updates editor with model data.
virtual void OnTryClose(bool *ignoredPtr=NULL) override
Called when the application is attempting to close.
virtual bool CreateGui(QWidget *parentPtr) override
Initializes the GUI and connects it to the parent widget.
virtual bool IsGuiCreated() const override
Checks if the GUI has been initialized and created.
virtual void OnComponentDestroyed() override
virtual void OnComponentCreated() override
Common interface for GUI objects used in ACF component context.
Definition IGuiObject.h:133
Set of change flags (its IDs).
Definition IChangeable.h:36
#define NULL
Definition istd.h:74
Standard GUI specific interfaces and components based on Qt.