aboutsummaryrefslogtreecommitdiff
path: root/CruUI-Generate/cru_ui.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-11-13 22:24:17 +0800
committercrupest <crupest@outlook.com>2018-11-13 22:24:17 +0800
commit38a523be0085a9b529043bddc61e4aee04a6768d (patch)
tree4003c4795f111631f1df07e0b1fdd1c2b626b608 /CruUI-Generate/cru_ui.hpp
parent91dda866a0919f9e6cfb5e7857ac0466572d96d8 (diff)
downloadcru-38a523be0085a9b529043bddc61e4aee04a6768d.tar.gz
cru-38a523be0085a9b529043bddc61e4aee04a6768d.tar.bz2
cru-38a523be0085a9b529043bddc61e4aee04a6768d.zip
Add enhanced bound check.
Diffstat (limited to 'CruUI-Generate/cru_ui.hpp')
-rw-r--r--CruUI-Generate/cru_ui.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/CruUI-Generate/cru_ui.hpp b/CruUI-Generate/cru_ui.hpp
index d6df9b13..2196c918 100644
--- a/CruUI-Generate/cru_ui.hpp
+++ b/CruUI-Generate/cru_ui.hpp
@@ -1596,6 +1596,8 @@ namespace cru::ui
//Absolute point to local point.
Point WindowToControl(const Point& point) const;
+ // Default implement in Control is test point in border geometry's
+ // fill and stroke with width of border.
virtual bool IsPointInside(const Point& point);
@@ -1743,6 +1745,8 @@ namespace cru::ui
void RaisePositionChangedEvent(events::PositionChangedEventArgs& args);
void RaiseSizeChangedEvent(events::SizeChangedEventArgs& args);
+ void RegenerateBorderGeometry();
+
//*************** region: mouse event ***************
virtual void OnMouseEnter(events::MouseEventArgs& args);
virtual void OnMouseLeave(events::MouseEventArgs& args);
@@ -1847,6 +1851,8 @@ namespace cru::ui
bool is_bordered_ = false;
BorderProperty border_property_;
+ Microsoft::WRL::ComPtr<ID2D1RoundedRectangleGeometry> border_geometry_ = nullptr;
+
AnyMap additional_property_map_{};
bool is_focus_on_pressed_ = true;
@@ -2094,6 +2100,9 @@ namespace cru::ui
//This method has no effect for a window. Use SetClientSize instead.
void SetSize(const Size& size) override final;
+ //Override. If point is in client area, it is in window.
+ bool IsPointInside(const Point& point) override final;
+
//*************** region: layout ***************
void WindowInvalidateLayout();
@@ -3025,6 +3034,11 @@ namespace cru::ui
namespace cru::ui
{
+ inline D2D1_POINT_2F Convert(const Point& point)
+ {
+ return D2D1::Point2F(point.x, point.y);
+ }
+
inline D2D1_RECT_F Convert(const Rect& rect)
{
return D2D1::RectF(rect.left, rect.top, rect.left + rect.width, rect.top + rect.height);