File indexing completed on 2024-05-12 15:56:38
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #ifndef KOACTIVECANVASRESOURCEDEPENDENCY_H 0007 #define KOACTIVECANVASRESOURCEDEPENDENCY_H 0008 0009 #include <QScopedPointer> 0010 #include <QSharedPointer> 0011 #include "kritaflake_export.h" 0012 0013 0014 /** 0015 * @brief A representation of dependency between different canvas 0016 * resources stored in KoReosurceManager. 0017 * 0018 * A resource dependency looks like that 0019 * 0020 * source ----->----- depends on ----->----- target 0021 * 0022 * , that is, when 'target' changes 'source' should be updated. 0023 */ 0024 class KRITAFLAKE_EXPORT KoActiveCanvasResourceDependency 0025 { 0026 public: 0027 KoActiveCanvasResourceDependency(int sourceKey, int targetKey); 0028 virtual ~KoActiveCanvasResourceDependency(); 0029 0030 /** 0031 * @return the resource type that should be updated when targetKey() is changed 0032 */ 0033 int sourceKey() const; 0034 0035 /** 0036 * @return the resource type that should cause updates sourceKey() 0037 */ 0038 int targetKey() const; 0039 0040 /** 0041 * @return true if \p source does really depend on \p target and the 0042 * manager should emit notification about \p target's change 0043 */ 0044 virtual bool shouldUpdateSource(QVariant &source, const QVariant &target) = 0; 0045 0046 private: 0047 struct Private; 0048 const QScopedPointer<Private> m_d; 0049 }; 0050 0051 typedef QSharedPointer<KoActiveCanvasResourceDependency> KoActiveCanvasResourceDependencySP; 0052 0053 #endif // KOACTIVECANVASRESOURCEDEPENDENCY_H