aboutsummaryrefslogtreecommitdiff
path: root/src/ui/control.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-11-25 22:57:07 +0800
committercrupest <crupest@outlook.com>2018-11-25 22:57:07 +0800
commit22322daf6f51da53740ff95ef2eaceed9a6efcae (patch)
tree06b17b482e2e15cb0692d05b279c61cbd6923b4d /src/ui/control.cpp
parent5391e781e4682731721c841462904809bc618870 (diff)
downloadcru-22322daf6f51da53740ff95ef2eaceed9a6efcae.tar.gz
cru-22322daf6f51da53740ff95ef2eaceed9a6efcae.tar.bz2
cru-22322daf6f51da53740ff95ef2eaceed9a6efcae.zip
Develop basic functions of ScrollControl.
Diffstat (limited to 'src/ui/control.cpp')
-rw-r--r--src/ui/control.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index 66f22c58..32909c75 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -8,6 +8,7 @@
#include "exception.hpp"
#include "cru_debug.hpp"
#include "convert_util.hpp"
+#include "math_util.hpp"
#ifdef CRU_DEBUG_LAYOUT
#include "ui_manager.hpp"
@@ -316,6 +317,7 @@ namespace cru::ui
{
SetPositionRelative(rect.GetLeftTop());
SetSize(rect.GetSize());
+ AfterLayoutSelf();
OnLayoutCore(Rect(Point::Zero(), rect.GetSize()));
}
@@ -385,7 +387,7 @@ namespace cru::ui
void Control::UpdateBorder()
{
- RegenerateGeometries();
+ RegenerateGeometryInfo();
InvalidateLayout();
InvalidateDraw();
}
@@ -554,7 +556,7 @@ namespace cru::ui
void Control::OnSizeChangedCore(SizeChangedEventArgs & args)
{
- RegenerateGeometries();
+ RegenerateGeometryInfo();
#ifdef CRU_DEBUG_LAYOUT
margin_geometry_ = CalculateSquareRingGeometry(GetRect(RectRange::Margin), GetRect(RectRange::FullBorder));
padding_geometry_ = CalculateSquareRingGeometry(GetRect(RectRange::Padding), GetRect(RectRange::Content));
@@ -575,7 +577,7 @@ namespace cru::ui
size_changed_event.Raise(args);
}
- void Control::RegenerateGeometries()
+ void Control::RegenerateGeometryInfo()
{
if (IsBordered())
{
@@ -1044,6 +1046,11 @@ namespace cru::ui
}
}
+ void Control::AfterLayoutSelf()
+ {
+
+ }
+
void Control::CheckAndNotifyPositionChanged()
{
if (this->old_position_ != this->position_)