ImagingTools Core SDK
CPopupTestGuiComp.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// ACF includes
6#include <ilog/TLoggerCompWrap.h>
7#include <iqtgui/TDesignerGuiCompBase.h>
8
9// ImtCore includes
10#include <imtgui/IClientAreaProvider.h>
11#include <imtgui/IPopupController.h>
12#include <GeneratedFiles/imtgui/ui_CPopupTestGuiComp.h>
13
14
15namespace imtgui
16{
17
18
19class CPopupTestGuiComp:
20 public ilog::TLoggerCompWrap<iqtgui::TDesignerGuiCompBase<Ui::CPopupTestGuiComp>>
21{
22 Q_OBJECT
23public:
24 typedef ilog::TLoggerCompWrap<iqtgui::TDesignerGuiCompBase<Ui::CPopupTestGuiComp>> BaseClass;
25
26 I_BEGIN_COMPONENT(CPopupTestGuiComp);
27 I_REGISTER_SUBELEMENT(ClientAreaProvider);
28 I_REGISTER_SUBELEMENT_INTERFACE(ClientAreaProvider, IClientAreaProvider, ExtractClientAreaProvider);
29 I_ASSIGN(m_popupControllerCompPtr, "PopupController", "Popup controller", false, "PopupController");
30 I_END_COMPONENT;
31
32 CPopupTestGuiComp();
33
34protected:
35 // reimplemented (iqtgui::CGuiComponentBase)
36 virtual void OnGuiCreated() override;
37
38 // reimplemented (iqtgui::TDesignSchemaHandlerWrap)
39 virtual void OnDesignSchemaChanged(const QByteArray& themeId) override;
40
41 // reimplemented (QObject)
42 virtual bool eventFilter(QObject* watched, QEvent* event) override;
43
44private Q_SLOTS:
45 void on_AnchorTL_clicked();
46 void on_AnchorTR_clicked();
47 void on_AnchorBL_clicked();
48 void on_AnchorBR_clicked();
49
50 void on_InfoButton_clicked();
51 void on_WarningButton_clicked();
52 void on_ErrorButton_clicked();
53 void on_CriticalButton_clicked();
54
55 void on_MessageButton_clicked();
56 void on_WidgetButton_clicked();
57 void on_WidgetControlsButton_clicked();
58
59 void on_TimeoutUser_toggled(bool checked);
60
61 void on_AllowClosing_toggled(bool checked);
62 void on_UseAreaProvider_toggled(bool checked);
63
64private:
65 QRect CalculatePopupAreaFromScreen();
66 void UpdateClientArea();
67 istd::IInformationProvider::InformationCategory GetCategory();
68 int GetTimeout();
69
70 static QRect Normalize(const QRect& rect);
71
72private:
73 class ClientAreaProvider: virtual public IClientAreaProvider
74 {
75 public:
76 ClientAreaProvider();
77
78 void SetCorner(Qt::Corner corner);
79 void SetRect(const QRect& rect/*, bool isMoved*/);
80
81 // reimplemented (IClientAreaProvider)
82 virtual QPoint GetAnchor() const override;
83 virtual QSize GetSize() const override;
84
85 private:
86 Qt::Corner m_corner;
87 QPoint m_anchor;
88 QSize m_size;
89 };
90
91 template <typename InterfaceType>
92 static InterfaceType* ExtractClientAreaProvider(CPopupTestGuiComp& component)
93 {
94 return &component.m_clientAreaProvider;
95 }
96
97private:
98 I_REF(IPopupController, m_popupControllerCompPtr);
99
100 int m_messageCounter;
101 imod::TModelWrap<ClientAreaProvider> m_clientAreaProvider;
102};
103
104
105} // namespace imtgui
106
107