ACF $AcfVersion:0$
CSingleDocumentWorkspaceGuiComp.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/QtGlobal>
7#if QT_VERSION >= 0x050000
8#include <QtWidgets/QWidget>
9#else
10#include <QtGui/QWidget>
11#endif
12
13// ACF includes
21
22
23namespace iqtdoc
24{
25
26
92 idoc::CSingleDocumentManagerBase,
93 iqtgui::TRestorableGuiWrap<
94 iqtgui::TGuiComponentBase<QWidget> > >
95{
96 Q_OBJECT
97
98public:
103
104 I_BEGIN_COMPONENT(CSingleDocumentWorkspaceGuiComp);
105 I_REGISTER_INTERFACE(idoc::IDocumentManager);
106 I_ASSIGN(m_defaultDocumentTitleAttrPtr, "DefaultDocumentTitle", "Name of the untitled document", true, "<no name>");
107 I_ASSIGN(m_documentTemplateCompPtr, "DocumentTemplate", "Document template", true, "DocumentTemplate");
108 I_ASSIGN(m_rememberOpenDocumentParamPtr, "RememberOpenDocumentOnExit", "If enabled, restores open document from previous session", false, "RememberOpenDocumentOnExit");
109 I_END_COMPONENT;
110
117
119
120 // reimplemented (idoc::IDocumentManager)
121 virtual void SetActiveView(istd::IPolymorphic* viewPtr) override;
122
123 // reimplemented (iqtgui::IGuiObject)
124 virtual void OnTryClose(bool* ignoredPtr = NULL) override;
125
126protected:
130 virtual void UpdateTitle();
131
135 virtual QString GenerateDocumentTitle() const;
136
137 // reimplemented (idoc::CSingleDocumentManagerBase)
138 virtual QString GetOpenFilePath(const QByteArray* documentTypeIdPtr = NULL) const override;
139 virtual void OnViewRegistered(istd::IPolymorphic* viewPtr) override;
140 virtual void OnViewRemoved(istd::IPolymorphic* viewPtr) override;
141 virtual void OnDocumentRegistered() override;
142 virtual void OnDocumentClosed() override;
143 virtual bool QueryDocumentSave(bool* ignoredPtr) override;
144
145 // reimplemented (iqt:CGuiComponentBase)
146 virtual void OnGuiCreated() override;
147 virtual void OnGuiDestroyed() override;
148
149 // reimplemented (icomp::CComponentBase)
150 virtual void OnComponentCreated() override;
151
152 // reimplemented (istd:IChangeable)
153 virtual void OnEndChanges(const ChangeSet& changeSet) override;
154
155 // reimplemented (TRestorableGuiWrap)
156 virtual void OnRestoreSettings(const QSettings& settings) override;
157
158protected:
159 I_TEXTATTR(m_defaultDocumentTitleAttrPtr);
160 I_REF(idoc::IDocumentTemplate, m_documentTemplateCompPtr);
161 I_REF(iprm::IEnableableParam, m_rememberOpenDocumentParamPtr);
162
164
167};
168
169
170} // namespace iqtdoc
171
172
Basic implementation of a template-based single document manager.
Provide set of user actions needed to manage documents in MVC (Model View Controller) concept.
Common interface for a document template.
Interface for objects which can be enabled/disabled.
Qt-based workspace implementation of a single document manager.
virtual void OnDocumentClosed() override
Called before document is closed.
virtual void OnRestoreSettings(const QSettings &settings) override
virtual void OnViewRemoved(istd::IPolymorphic *viewPtr) override
Called before view is removed.
virtual void OnDocumentRegistered() override
Called after document is registered.
virtual void SetActiveView(istd::IPolymorphic *viewPtr) override
Indicate that some view is active now.
virtual void OnGuiDestroyed() override
Called just before GUI is released.
I_TEXTATTR(m_defaultDocumentTitleAttrPtr)
virtual bool QueryDocumentSave(bool *ignoredPtr) override
Query user if this document can be closed.
virtual void OnGuiCreated() override
Called just after GUI is initialized.
virtual void OnTryClose(bool *ignoredPtr=NULL) override
Called when the application is attempting to close.
virtual void UpdateTitle()
Update titles of views or all views of specified document.
virtual void OnEndChanges(const ChangeSet &changeSet) override
Callback function for end change event.
virtual QString GenerateDocumentTitle() const
Generate the title of the current document.
virtual void OnComponentCreated() override
iqtdoc::TQtDocumentManagerWrap< idoc::CSingleDocumentManagerBase, iqtgui::TRestorableGuiWrap< iqtgui::TGuiComponentBase< QWidget > > > BaseClass
virtual QString GetOpenFilePath(const QByteArray *documentTypeIdPtr=NULL) const override
Gets open file names.
virtual void OnViewRegistered(istd::IPolymorphic *viewPtr) override
Called after view is registered.
Wrapper for general functionality of a Qt based document workspace.
Common interface for GUI objects used in ACF component context.
Definition IGuiObject.h:133
Base class for all Qt GUI componentes.
A wrapper for saving/restoring of GUI component states in the application settings.
Set of change flags (its IDs).
Definition IChangeable.h:36
Base interface for all used interfaces and implementations.
#define NULL
Definition istd.h:74
This package contains Qt implementations related to Document/View concept.