CModelEditorGuiComp.h
Go to the documentation of this file.
1 #ifndef iqtgui_CModelEditorGuiComp_included
2 #define iqtgui_CModelEditorGuiComp_included
3 
4 
5 // ACF includes
6 #include <imod/IModel.h>
7 #include <imod/IModelEditor.h>
8 #include <imod/IObserver.h>
9 
10 #include <icomp/CComponentBase.h>
11 
12 #include <iqtgui/IGuiObject.h>
13 
14 
15 namespace iqtgui
16 {
17 
18 
24  public icomp::CComponentBase,
25  virtual public iqtgui::IGuiObject,
26  virtual public imod::IModelEditor
27 {
28 public:
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;
44  virtual bool CreateGui(QWidget* parentPtr);
45  virtual bool DestroyGui();
46  virtual QWidget* GetWidget() const;
47  virtual void OnTryClose(bool* ignoredPtr = NULL);
48 
49  // reimplemented (imod::IModelEditor)
50  virtual void UpdateEditor(const istd::IChangeable::ChangeSet& changeSet);
51  virtual void UpdateModelFromEditor() const;
52  virtual bool IsReadOnly() const;
53  virtual void SetReadOnly(bool state);
54 
55 protected:
56  // reimplemented (icomp::CComponentBase)
57  virtual void OnComponentCreated();
58  virtual void OnComponentDestroyed();
59 
60 private:
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 #endif // !iqtgui_CModelEditorGuiComp_included
74 
75 
icomp::CComponentBase BaseClass
virtual void SetReadOnly(bool state)
Set flag that the model data can be changed.
virtual void UpdateEditor(const istd::IChangeable::ChangeSet &changeSet)
Updates editor with model data.
Base class for component implementation.
virtual bool IsGuiCreated() const
Inform if GUI was initilized.
virtual bool IsReadOnly() const
Returns true if the model data can be changed.
Component realizing static connection between GUI and model components.
Common interface for an model editor.
Definition: IModelEditor.h:19
virtual bool DestroyGui()
Release GUI and disconnect it from parent.
virtual void OnComponentCreated()
virtual bool CreateGui(QWidget *parentPtr)
Initialize GUI and connect it to the parent.
virtual void OnComponentDestroyed()
Common interface for GUI objects using in component context.
Definition: IGuiObject.h:25
virtual void OnTryClose(bool *ignoredPtr=NULL)
Called on trying to close application.
#define NULL
Definition: istd.h:64
Common interface for all classes implementing the Observer functionality in the Model/Observer design...
Definition: IObserver.h:24
Common interface for model objects, that supports Model/Observer design pattern.
Definition: IModel.h:23
Set of change flags (its IDs).
Definition: IChangeable.h:30
virtual QWidget * GetWidget() const
Get access to internal QWidget object.
virtual void UpdateModelFromEditor() const
Updates model from editor.

© 2007-2017 Witold Gantzke and Kirill Lepskiy