ImagingTools Core SDK
CSelectionComp.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
8// ImtCore includes
9#include <imtbase/CSelection.h>
10
11
12namespace imtbase
13{
14
15
16class CSelectionComp:
17 public icomp::CComponentBase,
18 public CSelection
19{
20public:
21 typedef icomp::CComponentBase BaseClass;
22
23 enum AutoSelectionMode
24 {
25 ASM_NO_ACTION,
26 ASM_SELECT_ALL,
27 ASM_DESELECT_ALL,
28 ASM_SET_PRESET,
29 ASM_UNSELECT_MISSING
30 };
31
32 I_BEGIN_COMPONENT(CSelectionComp);
33 I_REGISTER_INTERFACE(ISelection);
34 I_REGISTER_INTERFACE(iser::ISerializable);
35 I_ASSIGN(m_constraintsCompPtr, "Constraints", "Selection constraints", false, "");
36 I_ASSIGN(m_initialSelectionModeAttrPtr, "SelectionMode", "Initial selection mode\n0 - SM_SINGLE\n1 - SM_MULTI", true, 0);
37 I_ASSIGN(m_autoSelectioModeAttrPtr, "AutoSelectionMode", "Automatic selection mode when changing constraints.\n0 - Do nothing\n1 - Select all\n2 - Clear selection\n3 - Set predefined IDs\n4 - Unselect missing IDs", true, 0);
38 I_ASSIGN_MULTI_0(m_initialSelectionIdsAttrPtr, "InitialSelectionIds", "Predefined IDs for initial selection", false);
39 I_ASSIGN_MULTI_0(m_autoSelectionIdsAttrPtr, "AutoSelectionIds", "Predefined IDs for auto selection mode 3", false);
40 I_END_COMPONENT;
41
42protected:
43 // reimplemented (CSelection)
44 virtual void OnConstraintsUpdated(const istd::IChangeable::ChangeSet& changeset, const ICollectionInfo* modelPtr) override;
45
46 // reimplemented (icomp::CComponentBase)
47 virtual void OnComponentCreated() override;
48 virtual void OnComponentDestroyed() override;
49
50private:
51 I_REF(ICollectionInfo, m_constraintsCompPtr);
52 I_ATTR(int, m_initialSelectionModeAttrPtr);
53 I_ATTR(int, m_autoSelectioModeAttrPtr);
54 I_MULTIATTR(QByteArray, m_initialSelectionIdsAttrPtr);
55 I_MULTIATTR(QByteArray, m_autoSelectionIdsAttrPtr);
56
57 ICollectionInfo::Ids m_lastConstraints;
58};
59
60
61} // namespace imtbase
62
63