ACF $AcfVersion:0$
CDialogGuiComp.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// ACF includes
8#include <imod/TModelWrap.h>
9#include <iqtgui/IDialog.h>
13
14
15namespace iqtgui
16{
17
18
20{
21public:
23
24 I_BEGIN_COMPONENT(CDialogGuiCompAttr);
25 I_ASSIGN(m_initialDialogSizeAttrPtr, "DialogSize", "Initial size of the dialog. The value is proportion of dialog size to desktop size", false, 0.5);
26 I_ASSIGN(m_initialDialogSizeXAttrPtr, "DialogSizeX", "Initial size of the dialog. The value is proportion of dialog size to desktop width", false, 0.5);
27 I_ASSIGN(m_initialDialogSizeYAttrPtr, "DialogSizeY", "Initial size of the dialog. The value is proportion of dialog size to desktop height", false, 0.5);
28 I_END_COMPONENT;
29
30protected:
31 I_ATTR(double, m_initialDialogSizeAttrPtr);
32 I_ATTR(double, m_initialDialogSizeXAttrPtr);
33 I_ATTR(double, m_initialDialogSizeYAttrPtr);
34};
35
36
42 public QObject,
44 ibase::TLocalizableWrap<CDialogGuiCompAttr>>,
45 virtual public iqtgui::IDialog
46{
47 Q_OBJECT
48public:
50 typedef QObject BaseClass2;
51
52 I_BEGIN_COMPONENT(CDialogGuiComp);
53 I_REGISTER_INTERFACE(iqtgui::IDialog);
54 I_REGISTER_SUBELEMENT(Command);
55 I_REGISTER_SUBELEMENT_INTERFACE(Command, ibase::ICommandsProvider, GetCommandsProvider);
56 I_REGISTER_SUBELEMENT_INTERFACE(Command, imod::IModel, GetCommandsProvider);
57 I_REGISTER_SUBELEMENT_INTERFACE(Command, istd::IChangeable, GetCommandsProvider);
58 I_ASSIGN(m_guiCompPtr, "Gui", "UI to show in the dialog", true, "Gui");
59 I_ASSIGN(m_dialogTitleAttrPtr, "DialogTitle", "Title for the dialog", false, "DialogTitle");
60 I_ASSIGN(m_dialogIconPathAttrPtr, "DialogIconPath", "Icon path for the dialog", false, "IconPath");
61 I_ASSIGN(m_menuNameAttrPtr, "MenuName", "Name of the menu for the action group", true, "MenuName");
62 I_ASSIGN(m_menuDescriptionAttrPtr, "MenuDescription", "Description for the action group", true, "");
63 I_ASSIGN(m_rootMenuNameAttrPtr, "RootMenu", "Name of the root command", true, "");
64 I_ASSIGN(m_isModalAttrPtr, "IsModal", "Modality of the dialog", true, true);
65 I_ASSIGN(m_dialogButtonsAttrPtr, "DialogButtons", "Dialog buttons. See QDialogButtonBox::StandardButton for details", true, QDialogButtonBox::Ok);
66 I_ASSIGN(m_defaultButtonAttrPtr, "DefaultDialogButton", "Default dialog button.See Qt::StandardButton for details", true, 0);
67 I_ASSIGN(m_defaultButtonPropertyAttrPtr, "DefaultDialogButtonProperty", "Key of the boolean property that will be set to TRUE in context of the default button. Can be used for defining custom style of the primary action of the dialog", true, "DefaultButton");
68 I_ASSIGN(m_windowFlagsAttrPtr, "WindowFlags", "Window flags is used to specify various window-system properties for the widget. See Qt::WindowFlags for details", true, 134295555);
69 I_ASSIGN(m_commandIdAttrPtr, "CommandId", "Dialog activation command ID", true, "");
70 I_END_COMPONENT;
71
73
74 // reimplemented (iqtgui::IDialog)
75 virtual int ExecuteDialog(IGuiObject* parentPtr) override;
76
77protected:
78 virtual iqtgui::CGuiComponentDialog* CreateComponentDialog(int buttons, IGuiObject* parentPtr) const;
79
80protected:
82
83 // reimplemented (ibase::TLocalizableWrap)
84 virtual void OnLanguageChanged() override;
85
86 // reimplemented (iqtgui::TDesignSchemaHandlerWrap)
87 virtual void OnDesignSchemaChanged(const QByteArray& themeId) override;
88
89 // reimplemented (icomp::CComponentBase)
90 virtual void OnComponentCreated() override;
91
92 // reimplemented (QObject)
93 virtual bool eventFilter(QObject* sourcePtr, QEvent* eventPtr) override;
94
95protected Q_SLOTS:
97
98private:
99 class CommandsProvider: virtual public ibase::ICommandsProvider
100 {
101 public:
102 CommandsProvider();
103
104 void SetParent(CDialogGuiComp* parentPtr);
105
106 // reimplemented (ibase::ICommandsProvider)
107 virtual const ibase::IHierarchicalCommand* GetCommands() const override;
108
109 private:
110 CDialogGuiComp* m_parentPtr;
111 };
112
113
114 template <class InterfaceType>
115 static InterfaceType* GetCommandsProvider(CDialogGuiComp& parent)
116 {
117 return &parent.m_commandsProvider;
118 }
119
120private:
121 I_REF(iqtgui::IGuiObject, m_guiCompPtr);
122 I_TEXTATTR(m_dialogTitleAttrPtr);
123 I_ATTR(QString, m_dialogIconPathAttrPtr);
124 I_TEXTATTR(m_menuNameAttrPtr);
125 I_TEXTATTR(m_menuDescriptionAttrPtr);
126 I_TEXTATTR(m_rootMenuNameAttrPtr);
127 I_ATTR(bool, m_isModalAttrPtr);
128 I_ATTR(int, m_dialogButtonsAttrPtr);
129 I_ATTR(int, m_defaultButtonAttrPtr);
130 I_ATTR(QByteArray, m_defaultButtonPropertyAttrPtr);
131 I_ATTR(int, m_windowFlagsAttrPtr);
132 I_ATTR(QByteArray, m_commandIdAttrPtr);
133
134 iqtgui::CHierarchicalCommand m_rootCommand;
135 iqtgui::CHierarchicalCommand m_rootMenuCommand;
136 iqtgui::CHierarchicalCommand m_dialogCommand;
137
138 imod::TModelWrap<CommandsProvider> m_commandsProvider;
139
140 QDialog* m_dialogPtr;
141};
142
143
144} // namespace iqtgui
145
146
147
Interface for a provider of the heriarchical commands.
Base class for component implementation.
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:25
This model wrapper provides a simple connection between a concrete istd::IChangeable implementation a...
Definition TModelWrap.h:24
icomp::CComponentBase BaseClass
Dialog based representation of any UI-Component.
TMakeIconProviderCompWrap< ibase::TLocalizableWrap< CDialogGuiCompAttr > > BaseClass
virtual void OnDesignSchemaChanged(const QByteArray &themeId) override
virtual iqtgui::CGuiComponentDialog * CreateComponentDialog(int buttons, IGuiObject *parentPtr) const
virtual void OnLanguageChanged() override
virtual void OnComponentCreated() override
virtual bool eventFilter(QObject *sourcePtr, QEvent *eventPtr) override
virtual int ExecuteDialog(IGuiObject *parentPtr) override
Execute dialog instance.
Class to display an ACF GUI component in a dialog.
Implementation of hierarchical command based on QAction from Qt.
Interface for a dialog widget.
Definition IDialog.h:18
Common interface for GUI objects used in ACF component context.
Definition IGuiObject.h:133
Common interface for data model objects, which can be changed.
Definition IChangeable.h:28
Common interface to define the hierarchical graph structures.
#define I_TEXTATTR(member)
Declare translatable text attribute member.
Standard GUI specific interfaces and components based on Qt.