6#include <imod/CMultiModelDispatcherBase.h>
7#include <idoc/CSingleDocumentManagerBase.h>
8#include <iqtdoc/CSingleDocumentWorkspaceGuiComp.h>
11#include <imtgui/IDocumentViewDecorator.h>
18class SdiDocumentViewDecorator;
21class CSingleDocumentWorkspaceGuiComp:
public iqtdoc::CSingleDocumentWorkspaceGuiComp,
public imod::CMultiModelDispatcherBase
26 typedef iqtdoc::CSingleDocumentWorkspaceGuiComp BaseClass;
28 I_BEGIN_COMPONENT(CSingleDocumentWorkspaceGuiComp);
29 I_REGISTER_SUBELEMENT(Commands);
30 I_REGISTER_SUBELEMENT_INTERFACE(Commands, ibase::ICommandsProvider, ExtractCommands);
31 I_REGISTER_SUBELEMENT_INTERFACE(Commands, istd::IChangeable, ExtractCommands);
32 I_REGISTER_SUBELEMENT_INTERFACE(Commands, imod::IModel, ExtractCommands);
33 I_ASSIGN(m_iconSizeAttrPtr,
"IconSize",
"Size of the icon used in the document command tool bar",
true, 16);
34 I_ASSIGN(m_showDocumentTitleAttrPtr,
"ShowDocumentTitle",
"If enabled, the document title is shown inside of the decorator area",
true,
true);
35 I_ASSIGN(m_undoButtonsStyleAttrPtr,
"UndoButtonsStyle",
"Style of the command buttons for undo manager (See Qt::QToolButtonStyle for reference)",
true, Qt::ToolButtonFollowStyle);
36 I_ASSIGN(m_fileButtonsStyleAttrPtr,
"FileButtonsStyle",
"Style of the command buttons for file operations (See Qt::QToolButtonStyle for reference)",
true, Qt::ToolButtonFollowStyle);
37 I_ASSIGN(m_documentButtonsStyleAttrPtr,
"DocumentButtonsStyle",
"Style of the command buttons for document operations (See Qt::QToolButtonStyle for reference)",
true, Qt::ToolButtonFollowStyle);
40 CSingleDocumentWorkspaceGuiComp();
42 virtual IDocumentViewDecorator* CreateDocumentViewDecorator(
43 istd::IPolymorphic* viewPtr,
44 QWidget* parentWidgetPtr,
45 const ifile::IFilePersistence* persistencePtr);
48 virtual void UpdateTitle()
override;
51 virtual void OnViewRegistered(istd::IPolymorphic* viewPtr)
override;
52 virtual void OnViewRemoved(istd::IPolymorphic* viewPtr)
override;
55 virtual void OnModelChanged(
int modelId,
const istd::IChangeable::ChangeSet& changeSet)
override;
60 void OnSaveDocument();
61 void OnSaveDocumentAs();
62 virtual void OnCloseDocument();
63 virtual void OnUndo();
64 virtual void OnRedo();
67 class Commands:
virtual public ibase::ICommandsProvider
72 void SetParent(CSingleDocumentWorkspaceGuiComp* parentPtr);
76 virtual const ibase::IHierarchicalCommand* GetCommands()
const override;
79 CSingleDocumentWorkspaceGuiComp* m_parentPtr;
82 template <
typename InterfaceType>
83 static InterfaceType* ExtractCommands(CSingleDocumentWorkspaceGuiComp& component)
85 return &component.m_commands;
91 DR_PATH = Qt::UserRole,
100 friend class SdiDocumentViewDecorator;
102 imod::TModelWrap<Commands> m_commands;
104 istd::TDelPtr<IDocumentViewDecorator> m_documentViewPtr;
106 I_ATTR(
int, m_iconSizeAttrPtr);
107 I_ATTR(
bool, m_showDocumentTitleAttrPtr);
108 I_ATTR(
int, m_undoButtonsStyleAttrPtr);
109 I_ATTR(
int, m_fileButtonsStyleAttrPtr);
110 I_ATTR(
int, m_documentButtonsStyleAttrPtr);