diff --git a/include/cru/ui/document/DocumentElement.h b/include/cru/ui/document/DocumentElement.h new file mode 100644 index 00000000..34c25f11 --- /dev/null +++ b/include/cru/ui/document/DocumentElement.h @@ -0,0 +1,19 @@ +#pragma once + +#include "../Base.h" +#include "DocumentElementType.h" + +namespace cru::ui::document { +class CRU_UI_API DocumentElement : public Object { + public: + explicit DocumentElement(DocumentElementType* type); + + ~DocumentElement() override; + + public: + DocumentElementType* GetType() const { return type_; } + + private: + DocumentElementType* type_; +}; +} // namespace cru::ui::document diff --git a/include/cru/ui/document/DocumentElementType.h b/include/cru/ui/document/DocumentElementType.h new file mode 100644 index 00000000..a94bf029 --- /dev/null +++ b/include/cru/ui/document/DocumentElementType.h @@ -0,0 +1,25 @@ +#pragma once + +#include "cru/common/String.h" + +#include "../Base.h" + +namespace cru::ui::document { +class CRU_UI_API DocumentElementType : public Object { + public: + explicit DocumentElementType(String name); + + ~DocumentElementType() override; + + public: + String GetName() const { return name_; } + + private: + String name_; +}; + +struct CRU_UI_API DocumentElementTypes { + static DocumentElementType* const kRootElementType; +}; + +} // namespace cru::ui::document diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index b6987c74..1e227fd7 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -24,6 +24,8 @@ add_library(CruUi controls/TextHostControlService.cpp controls/TreeView.cpp controls/Window.cpp + document/DocumentElement.cpp + document/DocumentElementType.cpp events/MouseEventArgs.cpp helper/ClickDetector.cpp helper/ShortcutHub.cpp diff --git a/src/ui/document/DocumentElement.cpp b/src/ui/document/DocumentElement.cpp new file mode 100644 index 00000000..4fa8adb1 --- /dev/null +++ b/src/ui/document/DocumentElement.cpp @@ -0,0 +1,8 @@ +#include "cru/ui/document/DocumentElement.h" +#include "cru/ui/document/DocumentElementType.h" + +namespace cru::ui::document { +DocumentElement::DocumentElement(DocumentElementType* type) : type_(type) {} + +DocumentElement::~DocumentElement() {} +} // namespace cru::ui::document diff --git a/src/ui/document/DocumentElementType.cpp b/src/ui/document/DocumentElementType.cpp new file mode 100644 index 00000000..8a057b69 --- /dev/null +++ b/src/ui/document/DocumentElementType.cpp @@ -0,0 +1,13 @@ +#include "cru/ui/document/DocumentElementType.h" + +#include + +namespace cru::ui::document { +DocumentElementType::DocumentElementType(String name) + : name_(std::move(name)) {} + +DocumentElementType::~DocumentElementType() {} + +DocumentElementType* const DocumentElementTypes::kRootElementType = + new DocumentElementType(u"Root"); +} // namespace cru::ui::document