ACF $AcfVersion:0$
CUndoManagerCommandsProviderComp.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// Qt includes
6#include <QtCore/QObject>
7
8// ACF includes
10#include <ibase/ICommand.h>
13#include <idoc/IUndoManager.h>
14#include <imod/IModel.h>
17
18
19namespace iqtdoc
20{
21
22
24 public QObject,
25 public iqtgui::TMakeIconProviderCompWrap<icomp::CComponentBase>,
27 virtual public ibase::ICommandsProvider
28{
29 Q_OBJECT
30
31public:
33
34 I_BEGIN_COMPONENT(CUndoManagerCommandsProviderComp);
35 I_REGISTER_INTERFACE(ibase::ICommandsProvider);
36 I_ASSIGN(m_undoManagerCompPtr, "UndoManager", "Undo/Redo-manager", true, "UndoManager");
37 I_ASSIGN_TO(m_undoManagerModelCompPtr, m_undoManagerCompPtr, true);
38 I_END_COMPONENT;
39
41
42 // reimplemented (ibase::ICommandsProvider)
43 virtual const ibase::IHierarchicalCommand* GetCommands() const override;
44
45protected:
46 // reimplemented from (imod::CSingleModelObserverBase)
47 virtual void OnUpdate(const istd::IChangeable::ChangeSet& changeSet) override;
48
49 // reimplemented (icomp::CComponentBase)
50 virtual void OnComponentCreated() override;
51 virtual void OnComponentDestroyed() override;
52
53private Q_SLOTS:
54 void OnUndoCommand();
55 void OnRedoCommand();
56
57private:
58 I_REF(idoc::IUndoManager, m_undoManagerCompPtr);
59 I_REF(imod::IModel, m_undoManagerModelCompPtr);
60
61 iqtgui::CHierarchicalCommand m_rootCommands;
62 iqtgui::CHierarchicalCommand m_editCommands;
63 iqtgui::CHierarchicalCommand m_undoCommand;
64 iqtgui::CHierarchicalCommand m_redoCommand;
65};
66
67
68} // namespace iqtdoc
69
70
Interface for a provider of the heriarchical commands.
Interface providing UNDO/REDO functionality.
Basic implementation for a single model observer.
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:25
virtual const ibase::IHierarchicalCommand * GetCommands() const override
Get list of menu commands.
virtual void OnComponentCreated() override
iqtgui::TMakeIconProviderCompWrap< icomp::CComponentBase > BaseClass
virtual void OnUpdate(const istd::IChangeable::ChangeSet &changeSet) override
Called on update of observed model.
virtual void OnComponentDestroyed() override
Implementation of hierarchical command based on QAction from Qt.
Set of change flags (its IDs).
Definition IChangeable.h:36
Common interface to define the hierarchical graph structures.
This package contains Qt implementations related to Document/View concept.