aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/CMakeLists.txt3
-rw-r--r--src/ui/ShortcutHub.cpp5
-rw-r--r--src/ui/render/RenderObject.cpp27
3 files changed, 22 insertions, 13 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index 6c50ec57..a83ab1d7 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -10,6 +10,7 @@ add_library(cru_ui STATIC
Helper.cpp
LayoutControl.cpp
NoChildControl.cpp
+ ShortcutHub.cpp
UiEvent.cpp
UiHost.cpp
UiManager.cpp
@@ -36,8 +37,10 @@ target_sources(cru_ui PUBLIC
${CRU_UI_INCLUDE_DIR}/ClickDetector.hpp
${CRU_UI_INCLUDE_DIR}/ContentControl.hpp
${CRU_UI_INCLUDE_DIR}/Control.hpp
+ ${CRU_UI_INCLUDE_DIR}/DebugFlags.hpp
${CRU_UI_INCLUDE_DIR}/LayoutControl.hpp
${CRU_UI_INCLUDE_DIR}/NoChildControl.hpp
+ ${CRU_UI_INCLUDE_DIR}/ShortcutHub.hpp
${CRU_UI_INCLUDE_DIR}/UiEvent.hpp
${CRU_UI_INCLUDE_DIR}/UiHost.hpp
${CRU_UI_INCLUDE_DIR}/UiManager.hpp
diff --git a/src/ui/ShortcutHub.cpp b/src/ui/ShortcutHub.cpp
new file mode 100644
index 00000000..2246b6eb
--- /dev/null
+++ b/src/ui/ShortcutHub.cpp
@@ -0,0 +1,5 @@
+#include "cru/ui/ShortcutHub.hpp"
+
+namespace cru::ui {
+
+}
diff --git a/src/ui/render/RenderObject.cpp b/src/ui/render/RenderObject.cpp
index 57116f93..c85f8080 100644
--- a/src/ui/render/RenderObject.cpp
+++ b/src/ui/render/RenderObject.cpp
@@ -2,6 +2,7 @@
#include "cru/common/Logger.hpp"
#include "cru/platform/graph/util/Painter.hpp"
+#include "cru/ui/DebugFlags.hpp"
#include "cru/ui/UiHost.hpp"
#include <algorithm>
@@ -69,18 +70,18 @@ void RenderObject::Measure(const MeasureRequirement& requirement,
MeasureSize merged_preferred_size =
preferred_size.OverrideBy(preferred_size_);
-#if CRUUI_DEBUG_LAYOUT
- log::Debug(u"{} Measure begins :\nrequirement: {}\npreferred size: {}",
- this->GetDebugPathInTree(), requirement.ToDebugString(),
- preferred_size.ToDebugString());
-#endif
+ if constexpr (cru::ui::debug_flags::layout) {
+ log::Debug(u"{} Measure begins :\nrequirement: {}\npreferred size: {}",
+ this->GetDebugPathInTree(), requirement.ToDebugString(),
+ preferred_size.ToDebugString());
+ }
size_ = OnMeasureCore(merged_requirement, merged_preferred_size);
-#if CRUUI_DEBUG_LAYOUT
- log::Debug(u"{} Measure ends :\nresult size: {}", this->GetDebugPathInTree(),
- size_.ToDebugString());
-#endif
+ if constexpr (cru::ui::debug_flags::layout) {
+ log::Debug(u"{} Measure ends :\nresult size: {}",
+ this->GetDebugPathInTree(), size_.ToDebugString());
+ }
Ensures(size_.width >= 0);
Ensures(size_.height >= 0);
@@ -88,10 +89,10 @@ void RenderObject::Measure(const MeasureRequirement& requirement,
}
void RenderObject::Layout(const Point& offset) {
-#if CRUUI_DEBUG_LAYOUT
- log::Debug(u"{} Layout :\noffset: {}", this->GetDebugPathInTree(),
- offset.ToDebugString());
-#endif
+ if constexpr (cru::ui::debug_flags::layout) {
+ log::Debug(u"{} Layout :\noffset: {}", this->GetDebugPathInTree(),
+ offset.ToDebugString());
+ }
offset_ = offset;
OnLayoutCore();
}