ImagingTools Core SDK
CSelectionIdBinderComp.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 <icomp/CComponentBase.h>
7#include <imod/CMultiModelDispatcherBase.h>
8#include <iprm/ISelectionParam.h>
9
10// ImtCore includes
11#include <imtbase/CCollectionInfo.h>
12#include <imtbase/ISelection.h>
13
14
15namespace imtbase
16{
17
18
19class CSelectionIdBinderComp:
20 public icomp::CComponentBase,
21 virtual public CCollectionInfo
22{
23public:
24 typedef icomp::CComponentBase BaseClass;
25
26 I_BEGIN_COMPONENT(CSelectionIdBinderComp);
27 I_REGISTER_INTERFACE(ICollectionInfo);
28 I_ASSIGN_MULTI_0(m_selectionCompPtr, "Slave selection components", "Slave selection components", false);
29 I_ASSIGN_MULTI_0(m_selectionParamCompPtr, "Slave selection param components", "Slave selection param components", false);
30 I_END_COMPONENT;
31
32 CSelectionIdBinderComp();
33
34protected:
35 // reimplemented (icomp::CComponentBase)
36 virtual void OnComponentCreated() override;
37 virtual void OnComponentDestroyed() override;
38
39private:
40 class Observer : public imod::CMultiModelDispatcherBase
41 {
42 public:
43 Observer(CSelectionIdBinderComp& parent);
44
45 protected:
46 // reimplemented methods (imod::CMultiModelDispatcherBase)
47 virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet& changeSet) override;
48
49 private:
50 CSelectionIdBinderComp& m_parent;
51 };
52
53private:
54 void UpdateIds();
55
56private:
57 I_MULTIREF(ISelection, m_selectionCompPtr);
58 I_MULTIREF(iprm::ISelectionParam, m_selectionParamCompPtr);
59
60 Observer m_observer;
61};
62
63
64} // namespace imtbase
65
66