From 714a757ee435b83156ddee6b16edc99408357170 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 14 Nov 2018 21:07:59 +0800 Subject: Add fore/bakcground brush. --- src/ui/control.hpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/ui/control.hpp') diff --git a/src/ui/control.hpp b/src/ui/control.hpp index 776eacb0..a1ad7ea7 100644 --- a/src/ui/control.hpp +++ b/src/ui/control.hpp @@ -129,6 +129,29 @@ namespace cru::ui virtual void Repaint(); + Microsoft::WRL::ComPtr GetForegroundBrush() const + { + return foreground_brush_; + } + + void SetForegroundBrush(Microsoft::WRL::ComPtr foreground_brush) + { + foreground_brush_ = std::move(foreground_brush); + Repaint(); + } + + Microsoft::WRL::ComPtr GetBackgroundBrush() const + { + return background_brush_; + } + + void SetBackgroundBrush(Microsoft::WRL::ComPtr background_brush) + { + background_brush_ = std::move(background_brush); + Repaint(); + } + + //*************** region: focus *************** bool RequestFocus(); @@ -245,6 +268,8 @@ namespace cru::ui void OnDrawCore(ID2D1DeviceContext* device_context); protected: + + //*************** region: graphic events *************** virtual void OnDrawContent(ID2D1DeviceContext* device_context); virtual void OnDrawForeground(ID2D1DeviceContext* device_context); virtual void OnDrawBackground(ID2D1DeviceContext* device_context); @@ -373,6 +398,10 @@ namespace cru::ui BorderProperty border_property_; Microsoft::WRL::ComPtr border_geometry_ = nullptr; + Microsoft::WRL::ComPtr in_border_geometry_ = nullptr; //used for foreground and background brush. + + Microsoft::WRL::ComPtr foreground_brush_ = nullptr; + Microsoft::WRL::ComPtr background_brush_ = nullptr; AnyMap additional_property_map_{}; -- cgit v1.2.3