ImagingTools Core SDK
TStandardDocumentViewDecorator.h
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ImtCore-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtWidgets/QToolButton>
7
8// ACF includes
9#include <imod/IModelEditor.h>
10#include <imod/IModel.h>
11#include <imod/CMultiModelDispatcherBase.h>
12#include <ilog/IMessageConsumer.h>
13#include <icomp/CComponentBase.h>
14#include <ibase/ICommandsProvider.h>
15#include <ifile/IFilePersistence.h>
16#include <idoc/IDocumentMetaInfo.h>
17#include <iqtgui/TMakeIconProviderCompWrap.h>
18#include <iqtgui/TDesignSchemaHandlerWrap.h>
19#include <iqtgui/CHierarchicalCommand.h>
20#include <iqtgui/CCommandTools.h>
21#include <iwidgets/iwidgets.h>
22#include <idoc/IDocumentManager.h>
23
24// ImtCore includes
25#include <imtgui/IDocumentViewConstraints.h>
26#include <imtgui/IDocumentViewDecorator.h>
27
28
29namespace imtgui
30{
31
32
33template <class WorkspaceImpl, class UI>
34class TStandardDocumentViewDecorator:
35 public QWidget,
36 public UI,
37 virtual public IDocumentViewDecorator,
38 virtual public ibase::ICommandsProvider,
39 protected imod::CMultiModelDispatcherBase
40{
41public:
42 enum ModelId
43 {
44 MI_VIEW_COMMANDS,
45 MI_VIEW_CONSTRAINTS,
46 MI_UNDO_MANAGER,
47 MI_DOCUMENT_META_INFO
48 };
49
50 enum CommandOptions
51 {
52 CO_SHOW_NEW = 1,
53 CO_SHOW_OPEN = 2,
54 CO_SHOW_SAVE = 4,
55 CO_SHOW_SAVE_AS = 8,
56 CO_SHOW_ALL = CO_SHOW_NEW | CO_SHOW_OPEN | CO_SHOW_SAVE | CO_SHOW_SAVE_AS
57 };
58
59 typedef WorkspaceImpl Workspace;
60
61 struct DecoratorConfiguration
62 {
63 DecoratorConfiguration()
64 :iconSize(16),
65 fileButtonsStyle(Qt::ToolButtonFollowStyle),
66 documentButtonsStyle(Qt::ToolButtonFollowStyle),
67 undoButtonsStyle(Qt::ToolButtonFollowStyle),
68 showDocumentTitle(true),
69 showDocumentControlFrame(false)
70 {
71 }
72
73 int iconSize;
74 Qt::ToolButtonStyle fileButtonsStyle;
75 Qt::ToolButtonStyle documentButtonsStyle;
76 Qt::ToolButtonStyle undoButtonsStyle;
77 int commandOptions = CO_SHOW_SAVE;
78 bool showDocumentTitle;
79 bool showDocumentControlFrame;
80 QVector<int> includedCommandGroups;
81 QVector<int> excludedCommandGroups;
82 };
83
84 TStandardDocumentViewDecorator(
85 WorkspaceImpl* parentPtr,
86 istd::IPolymorphic* viewPtr,
87 QWidget* parentWidgetPtr,
88 const ifile::IFilePersistence* persistencePtr,
89 const DecoratorConfiguration& configuration);
90
91 virtual void UpdateButtonsStatus();
92 virtual void UpdateAppearance();
93
94 // reimplemeneted (IDocumentViewDecorator)
95 virtual QWidget* GetDecoratorWidget() override;
96 virtual QWidget* GetViewFrame() override;
97 virtual istd::IPolymorphic* GetView() const override;
98 virtual void SetViewEnabled(bool isEnabled) override;
99 virtual QString GetTitle() override;
100 virtual void SetTitle(const QString& title) override;
101 virtual void SetDocumentTypeName(const QString& name) override;
102
103 // reimplemented (ibase::ICommandsProvider)
104 virtual const ibase::IHierarchicalCommand* GetCommands() const override;
105
106protected:
107 virtual void OnViewContraintsChanged();
108
109 // reimplemented (imod::CMultiModelDispatcherBase)
110 virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet& changeSet);
111
112protected:
113 istd::IPolymorphic* m_viewObjectPtr;
114 const ifile::IFilePersistence* m_filePersistencePtr;
115 idoc::IDocumentManager* m_parentPtr;
116 bool m_isInitialized;
117 QString m_documentName;
118 QString m_comment;
119
120 bool m_isUndoEnabled;
121 bool m_isRedoEnabled;
122
123 DecoratorConfiguration m_configuration;
124
125 iqtgui::CHierarchicalCommand m_commands;
126
127 iqtgui::CHierarchicalCommand m_newCommand;
128 iqtgui::CHierarchicalCommand m_openCommand;
129 iqtgui::CHierarchicalCommand m_saveCommand;
130 iqtgui::CHierarchicalCommand m_saveAsCommand;
131 iqtgui::CHierarchicalCommand m_undoCommand;
132 iqtgui::CHierarchicalCommand m_redoCommand;
133 iqtgui::CHierarchicalCommand m_closeCommand;
134
135 class UiResourcesManager: public iqtgui::TMakeIconProviderCompWrap<QObject>
136 {
137 public:
138 typedef iqtgui::TMakeIconProviderCompWrap<QObject> BaseClass;
139
140 UiResourcesManager(TStandardDocumentViewDecorator& parent)
141 :m_parent(parent)
142 {
143 }
144
145 protected:
146 virtual void OnDesignSchemaChanged(const QByteArray& themeId) override
147 {
148 BaseClass::OnDesignSchemaChanged(themeId);
149
150 m_parent.UpdateAppearance();
151 }
152
153 TStandardDocumentViewDecorator& m_parent;
154 };
155
156
157 UiResourcesManager m_uiResourcesManager;
158};
159
160
161// public methods
162template <class WorkspaceImpl, class UI>
163TStandardDocumentViewDecorator<WorkspaceImpl, UI>::TStandardDocumentViewDecorator(
164 WorkspaceImpl* parentPtr,
165 istd::IPolymorphic* viewPtr,
166 QWidget* parentWidgetPtr,
167 const ifile::IFilePersistence* persistencePtr,
168 const DecoratorConfiguration& configuration)
169 :QWidget(parentWidgetPtr),
170 m_viewObjectPtr(viewPtr),
171 m_filePersistencePtr(persistencePtr),
172 m_parentPtr(parentPtr),
173 m_isInitialized(false),
174 m_configuration(configuration),
175 m_newCommand("New", 110, ibase::ICommand::CF_GLOBAL_MENU | ibase::ICommand::CF_TOOLBAR, 20000),
176 m_openCommand("Open", 109, ibase::ICommand::CF_GLOBAL_MENU | ibase::ICommand::CF_TOOLBAR, 20000),
177 m_saveCommand("Save", 108, ibase::ICommand::CF_GLOBAL_MENU | ibase::ICommand::CF_TOOLBAR, 20000),
178 m_saveAsCommand("SaveAs", 100, ibase::ICommand::CF_GLOBAL_MENU, 20000),
179 m_undoCommand("Undo", 99, ibase::ICommand::CF_GLOBAL_MENU | ibase::ICommand::CF_TOOLBAR, 20000),
180 m_redoCommand("Redo", 99, ibase::ICommand::CF_GLOBAL_MENU | ibase::ICommand::CF_TOOLBAR, 20000),
181 m_closeCommand("Close", 99, ibase::ICommand::CF_GLOBAL_MENU | ibase::ICommand::CF_TOOLBAR, 20001),
182 m_uiResourcesManager(*this)
183{
184 m_uiResourcesManager.EnableDesignHandler();
185
186 Q_ASSERT(parentPtr != nullptr);
187 Q_ASSERT(viewPtr != nullptr);
188
189 UI::setupUi(this);
190
191 setObjectName("DocumentView");
192
193 UI::DocumentTitleFrame->setVisible(configuration.showDocumentTitle);
194
195 istd::IChangeable* documentPtr = m_parentPtr->GetDocumentFromView(*viewPtr);
196 Q_ASSERT(documentPtr != nullptr);
197
198 if (configuration.commandOptions & CO_SHOW_NEW){
199 m_commands.InsertChild(&m_newCommand);
200 }
201
202 if (configuration.commandOptions & CO_SHOW_OPEN){
203 m_commands.InsertChild(&m_openCommand);
204 }
205
206 m_commands.InsertChild(&m_undoCommand);
207 m_commands.InsertChild(&m_redoCommand);
208
209 if (configuration.commandOptions & CO_SHOW_SAVE){
210 m_commands.InsertChild(&m_saveCommand);
211 }
212
213 if (configuration.commandOptions & CO_SHOW_SAVE_AS){
214 m_commands.InsertChild(&m_saveAsCommand);
215 }
216
217 m_commands.InsertChild(&m_closeCommand);
218
219 m_isUndoEnabled = false;
220 m_isRedoEnabled = false;
221
222 idoc::IUndoManager* undoManagerPtr = m_parentPtr->GetUndoManagerForDocument(documentPtr);
223
224 UI::UndoButton->setVisible(undoManagerPtr != nullptr);
225 UI::RedoButton->setVisible(undoManagerPtr != nullptr);
226 UI::UndoButton->setIconSize(QSize(configuration.iconSize, configuration.iconSize));
227 UI::RedoButton->setIconSize(QSize(configuration.iconSize, configuration.iconSize));
228 m_undoCommand.setVisible(undoManagerPtr != nullptr);
229 m_redoCommand.setVisible(undoManagerPtr != nullptr);
230
231 m_newCommand.setShortcut(Qt::CTRL | Qt::Key_N);
232 m_openCommand.setShortcut(Qt::CTRL | Qt::Key_O);
233 m_saveCommand.setShortcut(Qt::CTRL | Qt::Key_S);
234 m_undoCommand.setShortcut(Qt::CTRL | Qt::Key_Z);
235 m_redoCommand.setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Z);
236
237 idoc::IDocumentMetaInfo* metaInfoPtr = CompCastPtr<idoc::IDocumentMetaInfo>(documentPtr);
238 if (metaInfoPtr != nullptr){
239 m_documentName = metaInfoPtr->GetMetaInfo(idoc::IDocumentMetaInfo::MIT_TITLE).toString();
240
241 m_comment = metaInfoPtr->GetMetaInfo(idoc::IDocumentMetaInfo::MIT_DESCRIPTION).toString();
242 }
243
244 UI::NewButton->setToolButtonStyle(configuration.fileButtonsStyle);
245 UI::NewButton->setDefaultAction(&m_newCommand);
246 UI::NewButton->setVisible(configuration.commandOptions & CO_SHOW_NEW);
247 UI::NewButton->setIconSize(QSize(configuration.iconSize, configuration.iconSize));
248
249 UI::OpenButton->setToolButtonStyle(configuration.fileButtonsStyle);
250 UI::OpenButton->setDefaultAction(&m_openCommand);
251 UI::OpenButton->setVisible(configuration.commandOptions & CO_SHOW_OPEN);
252 UI::OpenButton->setIconSize(QSize(configuration.iconSize, configuration.iconSize));
253
254 UI::UndoButton->setToolButtonStyle(configuration.undoButtonsStyle);
255 UI::UndoButton->setDefaultAction(&m_undoCommand);
256
257 UI::RedoButton->setToolButtonStyle(configuration.undoButtonsStyle);
258 UI::RedoButton->setDefaultAction(&m_redoCommand);
259
260 UI::CloseButton->setDefaultAction(&m_closeCommand);
261
262 UI::SaveButton->setToolButtonStyle(configuration.fileButtonsStyle);
263 UI::SaveButton->setDefaultAction(&m_saveCommand);
264 UI::SaveButton->setVisible(configuration.commandOptions & CO_SHOW_SAVE);
265 UI::SaveButton->setIconSize(QSize(configuration.iconSize, configuration.iconSize));
266
267 UI::SaveAsButton->setToolButtonStyle(configuration.fileButtonsStyle);
268 UI::SaveAsButton->setDefaultAction(&m_saveAsCommand);
269 UI::SaveAsButton->setVisible(configuration.commandOptions & CO_SHOW_SAVE_AS);
270
271 connect(&m_newCommand, &QAction::triggered, parentPtr, &WorkspaceImpl::OnNew);
272 connect(&m_openCommand, &QAction::triggered, parentPtr, &WorkspaceImpl::OnOpen);
273 connect(&m_undoCommand, &QAction::triggered, parentPtr, &WorkspaceImpl::OnUndo);
274 connect(&m_redoCommand, &QAction::triggered, parentPtr, &WorkspaceImpl::OnRedo);
275 connect(&m_closeCommand, &QAction::triggered, parentPtr, &WorkspaceImpl::OnCloseDocument);
276 connect(&m_saveCommand, &QAction::triggered, parentPtr, &WorkspaceImpl::OnSaveDocument);
277 connect(&m_saveAsCommand, &QAction::triggered, parentPtr, &WorkspaceImpl::OnSaveDocumentAs);
278
279 UpdateButtonsStatus();
280
281 UpdateAppearance();
282
283 m_isInitialized = true;
284
285 const imtgui::IDocumentViewConstraints* viewConstraintsPtr = CompCastPtr<imtgui::IDocumentViewConstraints>(viewPtr);
286 if (viewConstraintsPtr != nullptr){
287 imod::IModel* viewModelPtr = const_cast<imod::IModel*>(dynamic_cast<const imod::IModel*>(viewConstraintsPtr));
288 if (viewModelPtr != nullptr){
289 RegisterModel(viewModelPtr, MI_VIEW_CONSTRAINTS);
290 }
291 }
292
293 imod::IModel* modelPtr = dynamic_cast<imod::IModel*>(undoManagerPtr);
294 if (modelPtr != nullptr){
295 RegisterModel(modelPtr, MI_UNDO_MANAGER);
296 }
297
298 imod::IModel* documentMetaInfoModelPtr = dynamic_cast<imod::IModel*>(metaInfoPtr);
299 if (documentMetaInfoModelPtr != nullptr){
300 RegisterModel(documentMetaInfoModelPtr, MI_DOCUMENT_META_INFO);
301 }
302
303 ibase::ICommandsProvider* commandsProviderPtr = CompCastPtr<ibase::ICommandsProvider>(viewPtr);
304 if (commandsProviderPtr != nullptr){
305 imod::IModel* commandsModelPtr = dynamic_cast<imod::IModel*>(commandsProviderPtr);
306 if (commandsModelPtr != nullptr){
307 RegisterModel(commandsModelPtr, MI_VIEW_COMMANDS);
308 }
309 else{
310 OnModelChanged(MI_VIEW_COMMANDS, istd::IChangeable::GetAllChanges());
311 }
312 }
313
314 UI::HeaderFrame->setVisible(configuration.showDocumentControlFrame);
315}
316
317
318template <class WorkspaceImpl, class UI>
319void TStandardDocumentViewDecorator<WorkspaceImpl, UI>::UpdateButtonsStatus()
320{
321 bool isSaveActive = true;
322
323 idoc::IUndoManager* undoManagerPtr = this->template GetObjectAt<idoc::IUndoManager>(MI_UNDO_MANAGER);
324 if (undoManagerPtr != nullptr){
325 isSaveActive = isSaveActive && (undoManagerPtr->GetDocumentChangeFlag() != idoc::IDocumentStateComparator::DCF_EQUAL);
326 }
327
328 idoc::IDocumentManager::DocumentInfo documentInfo = {};
329 m_parentPtr->GetDocumentFromView(*m_viewObjectPtr, &documentInfo);
330
331 isSaveActive = isSaveActive || documentInfo.isDirty;
332
333 if (m_filePersistencePtr == nullptr){
334 isSaveActive = false;
335 }
336
337 m_saveCommand.setEnabled(isSaveActive);
338 UI::SaveButton->setEnabled(isSaveActive);
339
340 m_saveAsCommand.setEnabled(m_filePersistencePtr != nullptr);
341 UI::SaveAsButton->setEnabled(m_filePersistencePtr != nullptr);
342
343 const imtgui::IDocumentViewConstraints* viewConstraintsPtr = CompCastPtr<imtgui::IDocumentViewConstraints>(m_viewObjectPtr);
344 if (viewConstraintsPtr != nullptr){
345 bool isSaveEnabled = viewConstraintsPtr->GetViewConstraints() & imtgui::IDocumentViewConstraints::CF_SAVE_DOCUMENT;
346
347 m_saveCommand.setVisible(isSaveEnabled);
348 UI::SaveButton->setVisible(isSaveEnabled);
349
350 m_saveAsCommand.setVisible(isSaveEnabled);
351 UI::SaveAsButton->setVisible(isSaveEnabled);
352 }
353
354 UI::UndoButton->setEnabled(m_isUndoEnabled);
355 UI::RedoButton->setEnabled(m_isRedoEnabled);
356 m_undoCommand.setEnabled(m_isUndoEnabled);
357 m_redoCommand.setEnabled(m_isRedoEnabled);
358
359 UI::CloseButton->setEnabled(true);
360}
361
362
363template<class WorkspaceImpl, class UI>
364inline void TStandardDocumentViewDecorator<WorkspaceImpl, UI>::UpdateAppearance()
365{
366 m_newCommand.SetVisuals(QObject::tr("&New"), QObject::tr("New"), QObject::tr("Create new document"), m_uiResourcesManager.GetIcon(":/Icons/New"));
367 m_openCommand.SetVisuals(QObject::tr("&Open..."), QObject::tr("Open..."), QObject::tr("Open an existing document"), m_uiResourcesManager.GetIcon(":/Icons/Open"));
368 m_undoCommand.SetVisuals(QObject::tr("&Undo"), QObject::tr("Undo"), QObject::tr("Undo last document changes"), m_uiResourcesManager.GetIcon(":/Icons/Undo"));
369 m_redoCommand.SetVisuals(QObject::tr("&Redo"), QObject::tr("Redo"), QObject::tr("Redo last document changes"), m_uiResourcesManager.GetIcon(":/Icons/Redo"));
370 m_closeCommand.SetVisuals(QObject::tr("&Close"), QObject::tr("Close"), QObject::tr("Close the document"), m_uiResourcesManager.GetIcon(":/Icons/Close"));
371 m_saveCommand.SetVisuals(QObject::tr("&Save"), QObject::tr("Save"), QObject::tr("Save the document changes"), m_uiResourcesManager.GetIcon(":/Icons/Save"));
372 m_saveAsCommand.SetVisuals(QObject::tr("Save As"), QObject::tr("Save As"), QObject::tr("Save the document as..."), QIcon());
373}
374
375
376template <class WorkspaceImpl, class UI>
377void TStandardDocumentViewDecorator<WorkspaceImpl, UI>::OnViewContraintsChanged()
378{
379 const imtgui::IDocumentViewConstraints* viewConstraintsPtr = CompCastPtr<imtgui::IDocumentViewConstraints>(m_viewObjectPtr);
380 if (viewConstraintsPtr != nullptr){
381 int viewFlags = viewConstraintsPtr->GetViewConstraints();
382
383 imod::IModelEditor* modelEditorPtr = CompCastPtr<imod::IModelEditor>(m_viewObjectPtr);
384 if (modelEditorPtr != nullptr){
385 modelEditorPtr->SetReadOnly(!(viewFlags & imtgui::IDocumentViewConstraints::CF_EDIT_DOCUMENT));
386 }
387
388 UI::SaveButton->setVisible((viewFlags & imtgui::IDocumentViewConstraints::CF_SAVE_DOCUMENT));
389 UI::SaveAsButton->setVisible((viewFlags & imtgui::IDocumentViewConstraints::CF_SAVE_DOCUMENT));
390 UI::UndoButton->setVisible((viewFlags & imtgui::IDocumentViewConstraints::CF_UNDO_SUPPORT));
391 UI::RedoButton->setVisible((viewFlags & imtgui::IDocumentViewConstraints::CF_UNDO_SUPPORT));
392 UI::CloseButton->setVisible((viewFlags & imtgui::IDocumentViewConstraints::CF_CLOSE_SUPPORT));
393 m_saveCommand.setVisible((viewFlags & imtgui::IDocumentViewConstraints::CF_SAVE_DOCUMENT));
394 m_saveAsCommand.setVisible((viewFlags & imtgui::IDocumentViewConstraints::CF_SAVE_DOCUMENT));
395 m_undoCommand.setVisible((viewFlags & imtgui::IDocumentViewConstraints::CF_UNDO_SUPPORT));
396 m_redoCommand.setVisible((viewFlags & imtgui::IDocumentViewConstraints::CF_UNDO_SUPPORT));
397 m_closeCommand.setVisible((viewFlags & imtgui::IDocumentViewConstraints::CF_CLOSE_SUPPORT));
398 }
399}
400
401
402// reimplemeneted (IDocumentViewDecorator)
403
404template <class WorkspaceImpl, class UI>
405QWidget* TStandardDocumentViewDecorator<WorkspaceImpl, UI>::GetDecoratorWidget()
406{
407 return this;
408}
409
410
411template <class WorkspaceImpl, class UI>
412QWidget* TStandardDocumentViewDecorator<WorkspaceImpl, UI>::GetViewFrame()
413{
414 return UI::DocumentFrame;
415}
416
417
418template <class WorkspaceImpl, class UI>
419istd::IPolymorphic* TStandardDocumentViewDecorator<WorkspaceImpl, UI>::GetView() const
420{
421 return m_viewObjectPtr;
422}
423
424
425template <class WorkspaceImpl, class UI>
426void TStandardDocumentViewDecorator<WorkspaceImpl, UI>::SetViewEnabled(bool isEnabled)
427{
428 setEnabled(isEnabled);
429}
430
431
432template <class WorkspaceImpl, class UI>
433QString TStandardDocumentViewDecorator<WorkspaceImpl, UI>::GetTitle()
434{
435 return QString();
436}
437
438
439template <class WorkspaceImpl, class UI>
440void TStandardDocumentViewDecorator<WorkspaceImpl, UI>::SetTitle(const QString& title)
441{
442 UI::DocumentTitle->setText(title);
443
444 UI::DocumentTitle->setVisible(!title.isEmpty() && m_configuration.showDocumentTitle);
445}
446
447
448template <class WorkspaceImpl, class UI>
449void TStandardDocumentViewDecorator<WorkspaceImpl, UI>::SetDocumentTypeName(const QString& /*name*/)
450{
451}
452
453
454// reimplemented (ibase::ICommandsProvider)
455
456template <class WorkspaceImpl, class UI>
457const ibase::IHierarchicalCommand * TStandardDocumentViewDecorator<WorkspaceImpl, UI>::GetCommands() const
458{
459 return &m_commands;
460}
461
462
463// protected methods
464
465// reimplemented (imod::CMultiModelDispatcherBase)
466
467template <class WorkspaceImpl, class UI>
468void TStandardDocumentViewDecorator<WorkspaceImpl, UI>::OnModelChanged(int modelId, const istd::IChangeable::ChangeSet& /*changeSet*/)
469{
470 Q_ASSERT(m_parentPtr != nullptr);
471
472 if (!m_isInitialized){
473 return;
474 }
475
476 switch (modelId){
477 case MI_UNDO_MANAGER:
478 {
479 idoc::IUndoManager* undoManagerPtr = this->template GetObjectAt<idoc::IUndoManager>(MI_UNDO_MANAGER);
480 Q_ASSERT(undoManagerPtr != nullptr);
481
482 m_isUndoEnabled = undoManagerPtr->GetAvailableUndoSteps() > 0;
483 m_isRedoEnabled = undoManagerPtr->GetAvailableRedoSteps() > 0;
484 }
485 break;
486
487 case MI_VIEW_COMMANDS:{
488 ibase::ICommandsProvider* commandsProviderPtr = CompCastPtr<ibase::ICommandsProvider>(m_viewObjectPtr);
489 m_commands.ResetChilds();
490
491 if (commandsProviderPtr != nullptr){
492 iwidgets::ClearLayout(UI::CommandToolBarFrame->layout());
493 const iqtgui::CHierarchicalCommand* guiCommandPtr = dynamic_cast<const iqtgui::CHierarchicalCommand*>(commandsProviderPtr->GetCommands());
494 if (guiCommandPtr != nullptr){
495 QToolBar* toolBarPtr = new QToolBar(UI::CommandToolBarFrame);
496 toolBarPtr->setToolButtonStyle(m_configuration.documentButtonsStyle);
497 UI::CommandToolBarFrame->layout()->addWidget(toolBarPtr);
498 iqtgui::CCommandTools::SetupToolbar(*guiCommandPtr, *toolBarPtr, -1, m_configuration.includedCommandGroups, m_configuration.excludedCommandGroups);
499 toolBarPtr->setIconSize(QSize(m_configuration.iconSize, m_configuration.iconSize));
500 }
501
502 const ibase::IHierarchicalCommand* viewCommandsPtr = commandsProviderPtr->GetCommands();
503 if (viewCommandsPtr != nullptr){
504 m_commands.JoinLinkFrom(viewCommandsPtr);
505 }
506
507 m_commands.InsertChild(&m_undoCommand);
508 m_commands.InsertChild(&m_redoCommand);
509 m_commands.InsertChild(&m_saveCommand);
510 m_commands.InsertChild(&m_closeCommand);
511 }
512 }
513 break;
514
515 case MI_VIEW_CONSTRAINTS:
516 OnViewContraintsChanged();
517 break;
518
519 default:
520 break;
521 }
522
523 UpdateButtonsStatus();
524}
525
526
527} // namespace imtgui
528
529
virtual int GetViewConstraints() const =0