CMultiBitmapViewComp.h
Go to the documentation of this file.
1 #ifndef iqt2d_CMultiBitmapViewComp_included
2 #define iqt2d_CMultiBitmapViewComp_included
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>
22 #include <iprm/CSelectionParam.h>
26 #include <iqt2d/IViewExtender.h>
27 #include <iqt2d/IViewProvider.h>
28 #include <iview/CConsoleGui.h>
30 #include <iimg/CBitmap.h>
31 
32 
33 namespace iqt2d
34 {
35 
36 
39  iqtgui::TGuiComponentBase<QWidget>,
40  imod::TSingleModelObserverBase<iimg::IMultiBitmapProvider> >,
42 {
43 public:
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 
62 protected:
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;
84  virtual iview::IShapeView* GetView() const;
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);
114 
115  // reimplemented (iqtgui::TGuiObserverWrap)
116  virtual void UpdateGui(const istd::IChangeable::ChangeSet& changeSet);
117  virtual void OnGuiModelAttached();
118 
119  // reimplemented (iqtgui::CGuiComponentBase)
120  virtual void OnGuiCreated();
121 
122  // reimplemented (icomp::CComponentBase)
123  virtual void OnComponentDestroyed();
124 
125 private:
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 
133 protected:
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
151 
152 
153 #endif // !iqt2d_CMultiBitmapViewComp_included
Interface for GUI objects presenting its results using extern view objects.
Definition: IViewExtender.h:19
istd::TPointerVector< CSingleView > m_views
static QIcon GetCategoryIcon(istd::IInformationProvider::InformationCategory category)
virtual QString GetTitleByIndex(int index) const
imod::CMultiModelDispatcherBase BaseClass2
virtual iview::IShapeView * GetView() const
Called when items should be removed from specified view.
Join functionality of iqtgui::IGuiObject interface and imod::IObserver.
virtual void SetInspectionResult(int result)
virtual void AddStatusItems(QBoxLayout *layoutPtr)
Generic implementation of a data model changes notifier.
Common interface for a general shape view implementations.
Definition: IShapeView.h:24
virtual void Init(bool hasStatusLabel, bool hasStatusBackground, bool useVerticalLayout)
imod::TModelWrap< iimg::CBitmap > m_backgroundModel
void SetBackgroundColor(const QColor &color)
virtual CSingleView * CreateView(QWidget *parentPtr, int id, const QString &title, const QByteArray &bitmapId)
virtual void UpdateGui(const istd::IChangeable::ChangeSet &changeSet)
Do update of the GUI to reflect the state of model.
virtual void OnViewCreated(int index, CSingleView *viewPtr)
virtual int GetViewId() const
Get ID indentifing this view.
iqtgui::TGuiObserverWrap< iqtgui::TGuiComponentBase< QWidget >, imod::TSingleModelObserverBase< iimg::IMultiBitmapProvider > > BaseClass
virtual void OnGuiModelAttached()
Called when model is attached and GUI is created.
Definition of single plane bitmap.
Definition: IBitmap.h:17
virtual void ConnectModels()
Implementation of a pointer container, which controls the live cycle of the pointer object...
virtual void ResetAllViews()
InformationCategory
Category of information.
Basic implementation of selection parameter.
void UpdateImage(const iimg::IBitmap *bitmapPtr)
CSingleView(QWidget *parentPtr, int id, const QString &title, const QByteArray &bitmapId)
Common interface for class providing some basic information object.
Common interface for model objects, that supports Model/Observer design pattern.
Definition: IModel.h:23
iprm::CSelectionParam m_activeViewIndex
Set of change flags (its IDs).
Definition: IChangeable.h:30
virtual void UpdateInspectionCategory(int index)
Interface allowing to select single option from list of options.
Interface for GUI objects managing view.
Definition: IViewProvider.h:24
virtual void EnsureViewsCreated()
virtual void OnComponentDestroyed()
virtual void OnGuiCreated()
Called just after GUI is initialized.
virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet &changeSet)

© 2007-2017 Witold Gantzke and Kirill Lepskiy