diff options
author | crupest <crupest@outlook.com> | 2020-03-18 22:37:41 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-03-18 22:37:41 +0800 |
commit | 477155d6fccc8eafadb6d7f4c468c9141d7d4e92 (patch) | |
tree | 0fe935c8f699a1c42c8750a39b6ca70d31f941a0 /src | |
parent | 068714c0f2fe7ab003462e5483f9944b0bf2f8e0 (diff) | |
download | cru-477155d6fccc8eafadb6d7f4c468c9141d7d4e92.tar.gz cru-477155d6fccc8eafadb6d7f4c468c9141d7d4e92.tar.bz2 cru-477155d6fccc8eafadb6d7f4c468c9141d7d4e92.zip |
...
Diffstat (limited to 'src')
-rw-r--r-- | src/platform/native/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/ui/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/ui/control.cpp | 1 | ||||
-rw-r--r-- | src/ui/controls/button.cpp | 2 | ||||
-rw-r--r-- | src/ui/controls/flex_layout.cpp | 20 | ||||
-rw-r--r-- | src/ui/ui_manager.cpp | 4 | ||||
-rw-r--r-- | src/win/native/dpi_util.hpp | 2 |
7 files changed, 28 insertions, 5 deletions
diff --git a/src/platform/native/CMakeLists.txt b/src/platform/native/CMakeLists.txt index c3ca3d7e..5caf84e4 100644 --- a/src/platform/native/CMakeLists.txt +++ b/src/platform/native/CMakeLists.txt @@ -3,9 +3,8 @@ add_library(cru_platform_native STATIC ui_application.cpp ) target_sources(cru_platform_native PUBLIC - ${CRU_PLATFORM_NATIVE_INCLUDE_DIR}/basic_types.hpp + ${CRU_PLATFORM_NATIVE_INCLUDE_DIR}/base.hpp ${CRU_PLATFORM_NATIVE_INCLUDE_DIR}/cursor.hpp - ${CRU_PLATFORM_NATIVE_INCLUDE_DIR}/event.hpp ${CRU_PLATFORM_NATIVE_INCLUDE_DIR}/window.hpp ${CRU_PLATFORM_NATIVE_INCLUDE_DIR}/ui_application.hpp ) diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index dbd42d38..14cbf2fb 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -45,6 +45,7 @@ target_sources(cru_ui PUBLIC ${CRU_UI_INCLUDE_DIR}/controls/text_box.hpp ${CRU_UI_INCLUDE_DIR}/controls/text_block.hpp ${CRU_UI_INCLUDE_DIR}/controls/text_common.hpp + ${CRU_UI_INCLUDE_DIR}/render/base.hpp ${CRU_UI_INCLUDE_DIR}/render/border_render_object.hpp ${CRU_UI_INCLUDE_DIR}/render/canvas_render_object.hpp ${CRU_UI_INCLUDE_DIR}/render/flex_layout_render_object.hpp diff --git a/src/ui/control.cpp b/src/ui/control.cpp index cde602b7..04d89b5f 100644 --- a/src/ui/control.cpp +++ b/src/ui/control.cpp @@ -1,6 +1,5 @@ #include "cru/ui/control.hpp" -#include "cru/platform/native/basic_types.hpp" #include "cru/platform/native/cursor.hpp" #include "cru/platform/native/ui_application.hpp" #include "cru/platform/native/window.hpp" diff --git a/src/ui/controls/button.cpp b/src/ui/controls/button.cpp index 7dc5a5d7..7dd087ba 100644 --- a/src/ui/controls/button.cpp +++ b/src/ui/controls/button.cpp @@ -58,6 +58,8 @@ Button::Button() : click_detector_(this) { }); } +Button::~Button() = default; + render::RenderObject* Button::GetRenderObject() const { return render_object_.get(); } diff --git a/src/ui/controls/flex_layout.cpp b/src/ui/controls/flex_layout.cpp index 6ea26d92..1c649e3b 100644 --- a/src/ui/controls/flex_layout.cpp +++ b/src/ui/controls/flex_layout.cpp @@ -10,6 +10,8 @@ FlexLayout::FlexLayout() { render_object_->SetAttachedControl(this); } +FlexLayout::~FlexLayout() = default; + render::RenderObject* FlexLayout::GetRenderObject() const { return render_object_.get(); } @@ -39,6 +41,24 @@ void FlexLayout::SetChildLayoutData(Control* control, FindPosition(render_object_.get(), control->GetRenderObject())) = data; } +FlexMainAlignment FlexLayout::GetContentMainAlign() const { + return render_object_->GetContentMainAlign(); +} + +void FlexLayout::SetContentMainAlign(FlexMainAlignment value) { + if (value == GetContentMainAlign()) return; + render_object_->SetContentMainAlign(value); +} + +FlexDirection FlexLayout::GetFlexDirection() const { + return render_object_->GetFlexDirection(); +} + +void FlexLayout::SetFlexDirection(FlexDirection direction) { + if (direction == GetFlexDirection()) return; + render_object_->SetFlexDirection(direction); +} + void FlexLayout::OnAddChild(Control* child, int position) { render_object_->AddChild(child->GetRenderObject(), position); } diff --git a/src/ui/ui_manager.cpp b/src/ui/ui_manager.cpp index 2a6d6e5b..5c7e4577 100644 --- a/src/ui/ui_manager.cpp +++ b/src/ui/ui_manager.cpp @@ -58,6 +58,8 @@ UiManager::UiManager() { theme_resource_.button_style.hover.border_radius = theme_resource_.button_style.press.border_radius = theme_resource_.button_style.press_cancel.border_radius = - controls::CornerRadius({5, 5}); + CornerRadius({5, 5}); } + +UiManager::~UiManager() = default; } // namespace cru::ui diff --git a/src/win/native/dpi_util.hpp b/src/win/native/dpi_util.hpp index 0ebcd7e2..d8c5610c 100644 --- a/src/win/native/dpi_util.hpp +++ b/src/win/native/dpi_util.hpp @@ -1,5 +1,5 @@ #pragma once -#include "cru/platform/native/basic_types.hpp" +#include "cru/platform/native/base.hpp" // The dpi awareness needs to be implemented in the future. Currently we use 96 // as default. |