aboutsummaryrefslogtreecommitdiff
path: root/src/ui/control.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-11-20 21:02:49 +0800
committercrupest <crupest@outlook.com>2018-11-20 21:03:07 +0800
commite8589550140d20b675fa7736441d7cdd1daee4d7 (patch)
tree50b61f34dd63e235a6c89b84511f3910b566af00 /src/ui/control.hpp
parent30333294fcd5917a9f3572f0c4c6dfc2ec429a3c (diff)
downloadcru-e8589550140d20b675fa7736441d7cdd1daee4d7.tar.gz
cru-e8589550140d20b675fa7736441d7cdd1daee4d7.tar.bz2
cru-e8589550140d20b675fa7736441d7cdd1daee4d7.zip
Add clip to padding.
Diffstat (limited to 'src/ui/control.hpp')
-rw-r--r--src/ui/control.hpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/ui/control.hpp b/src/ui/control.hpp
index 2ca5fa9e..4374983b 100644
--- a/src/ui/control.hpp
+++ b/src/ui/control.hpp
@@ -124,6 +124,13 @@ namespace cru::ui
//*************** region: graphic ***************
+ bool IsClipToPadding() const
+ {
+ return clip_to_padding_;
+ }
+
+ void SetClipToPadding(bool clip);
+
//Draw this control and its child controls.
void Draw(ID2D1DeviceContext* device_context);
@@ -264,12 +271,11 @@ namespace cru::ui
//Invoked when the control is detached to a window. Overrides should invoke base.
virtual void OnDetachToWindow(Window* window);
+ //*************** region: graphic events ***************
private:
+ void OnDrawDecoration(ID2D1DeviceContext* device_context);
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);
@@ -364,10 +370,8 @@ namespace cru::ui
private:
bool is_container_;
- protected:
- Window * window_ = nullptr; // protected for Window class to write it as itself in constructor.
+ Window * window_ = nullptr;
- private:
Control * parent_ = nullptr;
std::vector<Control*> children_{};
@@ -397,6 +401,8 @@ namespace cru::ui
bool is_bordered_ = false;
BorderProperty border_property_;
+ bool clip_to_padding_ = false;
+
Microsoft::WRL::ComPtr<ID2D1Geometry> border_geometry_ = nullptr;
Microsoft::WRL::ComPtr<ID2D1Geometry> in_border_geometry_ = nullptr; //used for foreground and background brush.