Files
o3de/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/ComponentMimeData.h
T
2021-04-23 09:43:40 -07:00

73 lines
2.5 KiB
C++

/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzCore/PlatformDef.h>
#include <QString>
AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 4251: 'QTreeWidgetItemIterator::d_ptr': class 'QScopedPointer<QTreeWidgetItemIteratorPrivate,QScopedPointerDeleter<T>>' needs to have dll-interface to be used by clients of class 'QTreeWidgetItemIterator'
#include <QTreeWidgetItem>
AZ_POP_DISABLE_WARNING
#include <AzCore/base.h>
#include <AzCore/RTTI/RTTI.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/smart_ptr/unique_ptr.h>
#include <AzCore/RTTI/ReflectContext.h>
#include <AzCore/Serialization/SerializeContext.h>
class QMimeData;
namespace AZ
{
class Component;
}
namespace AzToolsFramework
{
class ComponentTypeMimeData
{
public:
using ClassDataType = const AZ::SerializeContext::ClassData*;
using ClassDataContainer = AZStd::vector<ClassDataType>;
static QString GetMimeType();
static AZStd::unique_ptr<QMimeData> Create(const ClassDataContainer& container);
static bool Get(const QMimeData* mimeData, ClassDataContainer& container);
};
class ComponentMimeData
{
public:
virtual ~ComponentMimeData() = default;
AZ_RTTI(ComponentMimeData, "{55A643D6-DDE9-4D48-9B6B-B14C46B6C08B}");
AZ_CLASS_ALLOCATOR(ComponentMimeData, AZ::SystemAllocator, 0);
using ComponentDataContainer = AZStd::vector<AZ::Component*>;
static void Reflect(AZ::ReflectContext* context);
static QString GetMimeType();
static AZStd::unique_ptr<QMimeData> Create(const ComponentDataContainer& components);
static void GetComponentDataFromMimeData(const QMimeData* mimeData, ComponentDataContainer& componentData);
static const QMimeData* GetComponentMimeDataFromClipboard();
static void PutComponentMimeDataOnClipboard(AZStd::unique_ptr<QMimeData> mimeData);
private:
ComponentDataContainer m_components;
};
}