Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
1.4 KB
Raw Blame
/*
 *  SPDX-FileCopyrightText: 2020 Dmitry Kazakov <[email protected]>
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 */
#ifndef KOACTIVECANVASRESOURCEDEPENDENCY_H
#define KOACTIVECANVASRESOURCEDEPENDENCY_H

#include <QScopedPointer>
#include <QSharedPointer>
#include "kritaflake_export.h"


/**
 * @brief A representation of dependency between different canvas
 * resources stored in KoResourceManager.
 *
 * A resource dependency looks like that
 *
 *     source ----->----- depends on ----->----- target
 *
 * , that is, when 'target' changes 'source' should be updated.
 */
class KRITAFLAKE_EXPORT KoActiveCanvasResourceDependency
{
public:
    KoActiveCanvasResourceDependency(int sourceKey, int targetKey);
    virtual ~KoActiveCanvasResourceDependency();

    /**
     * @return the resource type that should be updated when targetKey() is changed
     */
    int sourceKey() const;

    /**
     * @return the resource type that should cause updates sourceKey()
     */
    int targetKey() const;

    /**
     * @return true if \p source does really depend on \p target and the
     * manager should Q_EMIT notification about \p target's change
     */
    virtual bool shouldUpdateSource(QVariant &source, const QVariant &target) = 0;

private:
    struct Private;
    const QScopedPointer<Private> m_d;
};

typedef QSharedPointer<KoActiveCanvasResourceDependency> KoActiveCanvasResourceDependencySP;

#endif // KOACTIVECANVASRESOURCEDEPENDENCY_H