From 07d99c8278c26580bd193c5ff75947e40647c20b Mon Sep 17 00:00:00 2001 From: Albin Johansson Date: Fri, 12 Jul 2024 00:55:44 +0200 Subject: [PATCH] Expand object view interface --- .../inc/tactile/base/document/object_view.hpp | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/source/base/inc/tactile/base/document/object_view.hpp b/source/base/inc/tactile/base/document/object_view.hpp index 02aad08338..e22d310e52 100644 --- a/source/base/inc/tactile/base/document/object_view.hpp +++ b/source/base/inc/tactile/base/document/object_view.hpp @@ -2,18 +2,94 @@ #pragma once +#include "tactile/base/container/string.hpp" +#include "tactile/base/layer/object_type.hpp" +#include "tactile/base/numeric/vec.hpp" #include "tactile/base/prelude.hpp" namespace tactile { class IDocumentVisitor; +class ILayerView; +class IMetaView; +/** + * A read-only view of an object in an object layer. + */ class IObjectView { public: TACTILE_INTERFACE_CLASS(IObjectView); + /** + * Inspects the object. + * + * \param visitor The visitor to use. + */ virtual void accept(IDocumentVisitor& visitor) const = 0; + + /** + * Returns a view of the parent object layer. + * + * \return + * An object layer view. + */ + [[nodiscard]] + virtual auto get_parent_layer() const -> const ILayerView& = 0; + + /** + * Returns the type of the object. + * + * \return + * An object type. + */ + [[nodiscard]] + virtual auto get_type() const -> ObjectType = 0; + + /** + * Returns the position of the object. + * + * \return + * An object position. + */ + [[nodiscard]] + virtual auto get_position() const -> Float2 = 0; + + /** + * Returns the size of the object. + * + * \return + * An object size. + */ + [[nodiscard]] + virtual auto get_size() const -> Float2 = 0; + + /** + * Returns the type tag. + * + * \return + * A type tag. + */ + [[nodiscard]] + virtual auto get_tag() const -> StringView = 0; + + /** + * Indicates whether the object is visible. + * + * \return + * True if the object is rendered; false otherwise. + */ + [[nodiscard]] + virtual auto is_visible() const -> bool = 0; + + /** + * Returns a view of the associated metadata. + * + * \return + * A metadata view. + */ + [[nodiscard]] + virtual auto get_meta() const -> const IMetaView& = 0; }; } // namespace tactile