ACF $AcfVersion:0$
CMultiBitmapViewComp.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/QGroupBox>
9#include <QtWidgets/QBoxLayout>
10#include <QtWidgets/QLabel>
11#else
12#include <QtGui/QGroupBox>
13#include <QtGui/QBoxLayout>
14#include <QtGui/QLabel>
15#endif
16
17// ACF includes
18#include <istd/TPointerVector.h>
26#include <iqt2d/IViewExtender.h>
27#include <iqt2d/IViewProvider.h>
28#include <iview/CConsoleGui.h>
30#include <iimg/CBitmap.h>
31
32
33namespace iqt2d
34{
35
36
39 iqtgui::TGuiComponentBase<QWidget>,
40 imod::TSingleModelObserverBase<iimg::IMultiBitmapProvider> >,
42{
43public:
47
49
50 I_BEGIN_COMPONENT(CMultiBitmapViewComp);
51 I_REGISTER_SUBELEMENT(ActiveViewIndex);
52 I_REGISTER_SUBELEMENT_INTERFACE(ActiveViewIndex, iprm::ISelectionParam, ExtractActiveViewIndex);
53 I_ASSIGN(m_horizontalViewsAttrPtr, "HorizontalViewsCount", "Number of horizontal views", false, 1);
54 I_ASSIGN(m_verticalViewsAttrPtr, "VerticalViewsCount", "Number of vertical views", false, 1);
55 I_ASSIGN(m_verticalViewLayoutAttrPtr, "UseVerticalLayout", "Layout of the single view", true, true);
56 I_ASSIGN(m_viewExtenderCompPtr, "ViewExtender", "View extender", false, "ViewExtender");
57 I_ASSIGN(m_generalInformationProviderCompPtr, "GeneralInformationProvider", "General information provider", false, "GeneralInformationProvider");
58 I_ASSIGN_TO(m_generalInformationModelCompPtr, m_generalInformationProviderCompPtr, true);
59 I_ASSIGN(m_viewBackgroundColorAttrPtr, "BackgroundColor", "Background color of the console", false, "black");
60 I_END_COMPONENT;
61
62protected:
63 static const int GeneralStatusModelId = -1;
64
66
67 class CSingleView: public QGroupBox, public iqt2d::IViewProvider
68 {
69 public:
70 typedef QGroupBox BaseClass;
71
72 CSingleView(QWidget* parentPtr, int id, const QString& title, const QByteArray& bitmapId);
73
74 void UpdateImage(const iimg::IBitmap* bitmapPtr);
75
76 void SetBackgroundColor(const QColor& color);
77
78 // called once at initialization stage, at this moment the model should be connected already.
79 virtual void Init(bool hasStatusLabel, bool hasStatusBackground, bool useVerticalLayout);
80 virtual void SetInspectionResult(int result);
81
82 // reimplemented (iqt2d::IViewProvider)
83 virtual int GetViewId() const override;
84 virtual iview::IShapeView* GetView() const override;
85
86 protected:
87 // called from Init() to add status labels etc. to the main widget layout (layoutPtr).
88 virtual void AddStatusItems(QBoxLayout* layoutPtr);
89
90 protected:
93
95 int m_id;
98
99 QByteArray m_bitmapId;
100 };
101
103
104 virtual CSingleView* CreateView(QWidget* parentPtr, int id, const QString& title, const QByteArray& bitmapId);
105 virtual void EnsureViewsCreated();
106 virtual QString GetTitleByIndex(int index) const;
107 virtual void UpdateInspectionCategory(int index);
108 virtual void ResetAllViews();
109 virtual void ConnectModels();
110 virtual void OnViewCreated(int index, CSingleView* viewPtr);
111
112 // reimplemented (imod::CMultiModelDispatcherBase)
113 virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet& changeSet) override;
114
115 // reimplemented (iqtgui::TGuiObserverWrap)
116 virtual void UpdateGui(const istd::IChangeable::ChangeSet& changeSet) override;
117 virtual void OnGuiModelAttached() override;
118
119 // reimplemented (iqtgui::CGuiComponentBase)
120 virtual void OnGuiCreated() override;
121
122 // reimplemented (icomp::CComponentBase)
123 virtual void OnComponentDestroyed() override;
124
125private:
126 // static template methods for subelement access
127 template <class InterfaceType>
128 static InterfaceType* ExtractActiveViewIndex(CMultiBitmapViewComp& component)
129 {
130 return &component.m_activeViewIndex;
131 }
132
133protected:
134 I_ATTR(int, m_horizontalViewsAttrPtr);
135 I_ATTR(int, m_verticalViewsAttrPtr);
136 I_ATTR(bool, m_verticalViewLayoutAttrPtr);
137 I_REF(istd::IInformationProvider, m_generalInformationProviderCompPtr);
138 I_REF(imod::IModel, m_generalInformationModelCompPtr);
139 I_REF(iqt2d::IViewExtender, m_viewExtenderCompPtr);
140 I_ATTR(QByteArray, m_viewBackgroundColorAttrPtr);
141
145
147};
148
149
150} // namespace iqt2d
Definition of single plane bitmap.
Definition IBitmap.h:21
Generic implementation of a data model changes notifier.
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
Basic implementation for a single model observer with binding to concrete data object interface.
Basic implementation of selection parameter.
Interface allowing to select single option from list of options.
void SetBackgroundColor(const QColor &color)
virtual iview::IShapeView * GetView() const override
Called when items should be removed from specified view.
CSingleView(QWidget *parentPtr, int id, const QString &title, const QByteArray &bitmapId)
imod::TModelWrap< iimg::CBitmap > m_backgroundModel
void UpdateImage(const iimg::IBitmap *bitmapPtr)
virtual void Init(bool hasStatusLabel, bool hasStatusBackground, bool useVerticalLayout)
virtual void SetInspectionResult(int result)
virtual int GetViewId() const override
Get ID indentifing this view.
virtual void AddStatusItems(QBoxLayout *layoutPtr)
virtual void OnComponentDestroyed() override
virtual void OnGuiModelAttached() override
Called when model is attached and GUI is created.
virtual void ConnectModels()
iqtgui::TGuiObserverWrap< iqtgui::TGuiComponentBase< QWidget >, imod::TSingleModelObserverBase< iimg::IMultiBitmapProvider > > BaseClass
virtual void UpdateGui(const istd::IChangeable::ChangeSet &changeSet) override
Do update of the GUI to reflect the state of model.
virtual void EnsureViewsCreated()
virtual QString GetTitleByIndex(int index) const
virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet &changeSet) override
Called when some model observed by dispatcher will be changed.
iprm::CSelectionParam m_activeViewIndex
virtual CSingleView * CreateView(QWidget *parentPtr, int id, const QString &title, const QByteArray &bitmapId)
imod::CMultiModelDispatcherBase BaseClass2
virtual void ResetAllViews()
virtual void UpdateInspectionCategory(int index)
virtual void OnViewCreated(int index, CSingleView *viewPtr)
istd::TPointerVector< CSingleView > m_views
virtual void OnGuiCreated() override
Called just after GUI is initialized.
static QIcon GetCategoryIcon(istd::IInformationProvider::InformationCategory category)
Interface for GUI objects presenting its results using extern view objects.
Interface for GUI objects managing view.
Base class for all Qt GUI componentes.
Join functionality of iqtgui::IGuiObject interface and imod::IObserver.
Set of change flags (its IDs).
Definition IChangeable.h:36
Common interface for class providing some basic information object.
InformationCategory
Category of information.
Implementation of a pointer container, which controls the live cycle of the pointer object.
Common interface for a general shape view implementations.
Definition IShapeView.h:30
This package contains Qt based implementations for 2D graphic objects.