QtViewPane.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #ifndef CRYINCLUDE_EDITORCOMMON_QTVIEWPANE_H
  9. #define CRYINCLUDE_EDITORCOMMON_QTVIEWPANE_H
  10. #pragma once
  11. #include "IEditor.h"
  12. #include "Include/IEditorClassFactory.h"
  13. #include "Include/ObjectEvent.h"
  14. #include "Objects/ClassDesc.h"
  15. #include <QRect>
  16. #include <QWidget>
  17. namespace Serialization {
  18. class IArchive;
  19. }
  20. using Serialization::IArchive;
  21. // ---------------------------------------------------------------------------
  22. template<class TObject>
  23. class CTemplateObjectClassDesc
  24. : public CObjectClassDesc
  25. {
  26. public:
  27. const char* m_className;
  28. const char* m_category;
  29. const char* m_textureIcon;
  30. ObjectType m_objectType;
  31. int m_order;
  32. const char* m_fileSpec;
  33. const char* m_toolClassName;
  34. CTemplateObjectClassDesc(const char* className, const char* category, const char* textureIcon, ObjectType objectType, int order = 100, const char* fileSpec = "", const char* toolClassName = nullptr)
  35. : m_className(className)
  36. , m_category(category)
  37. , m_textureIcon(textureIcon)
  38. , m_objectType(objectType)
  39. , m_order(order)
  40. , m_fileSpec(fileSpec)
  41. , m_toolClassName(toolClassName)
  42. {
  43. }
  44. REFGUID ClassID() override
  45. {
  46. return TObject::GetClassID();
  47. }
  48. QString GetFileSpec() override
  49. {
  50. return m_fileSpec;
  51. }
  52. ESystemClassID SystemClassID() override
  53. {
  54. return ESYSTEM_CLASS_OBJECT;
  55. };
  56. ObjectType GetObjectType() override
  57. {
  58. return m_objectType;
  59. }
  60. QString ClassName() override
  61. {
  62. return m_className;
  63. }
  64. QString Category() override
  65. {
  66. return m_category;
  67. }
  68. QString GetTextureIcon() override
  69. {
  70. return m_textureIcon;
  71. }
  72. QObject* CreateQObject() const override
  73. {
  74. return new TObject;
  75. }
  76. int GameCreationOrder() override
  77. {
  78. return m_order;
  79. };
  80. bool IsEnabled() const override
  81. {
  82. return TObject::IsEnabled();
  83. }
  84. QString GetToolClassName() override
  85. {
  86. return m_toolClassName ? m_toolClassName : CObjectClassDesc::GetToolClassName();
  87. }
  88. };
  89. #endif // CRYINCLUDE_EDITORCOMMON_QTVIEWPANE_H