aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/border_delegate.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-10-02 00:15:52 +0800
committercrupest <crupest@outlook.com>2018-10-02 00:15:52 +0800
commit3b7e3d0ca26b526c8c4e6fc335085ac28d63bbab (patch)
tree095da7f36e7f4e150080feb753a2995fe2bac8c3 /src/ui/controls/border_delegate.cpp
parentc9a423ef94f684ff21e79526f77f8ddc31a2100d (diff)
downloadcru-3b7e3d0ca26b526c8c4e6fc335085ac28d63bbab.tar.gz
cru-3b7e3d0ca26b526c8c4e6fc335085ac28d63bbab.tar.bz2
cru-3b7e3d0ca26b526c8c4e6fc335085ac28d63bbab.zip
Make button use border delegate.
Diffstat (limited to 'src/ui/controls/border_delegate.cpp')
-rw-r--r--src/ui/controls/border_delegate.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ui/controls/border_delegate.cpp b/src/ui/controls/border_delegate.cpp
index 4031d787..ec7ba437 100644
--- a/src/ui/controls/border_delegate.cpp
+++ b/src/ui/controls/border_delegate.cpp
@@ -61,12 +61,19 @@ namespace cru::ui::controls
border_property_->RemovePropertyChangedListener(border_property_changed_listener_);
border_property_ = std::move(border_property);
border_property_->AddPropertyChangedListener(border_property_changed_listener_);
+ control_->Repaint();
}
void BorderDelegate::Draw(ID2D1DeviceContext* device_context, const Size& size) const
{
device_context->DrawRoundedRectangle(
- D2D1::RoundedRect(D2D1::RectF(0.0f, 0.0f, size.width, size.height),
+ D2D1::RoundedRect(
+ D2D1::RectF(
+ border_property_->GetWidth() / 2.0f,
+ border_property_->GetWidth() / 2.0f,
+ size.width - border_property_->GetWidth(),
+ size.height - border_property_->GetWidth()
+ ),
border_property_->GetRadiusX(),
border_property_->GetRadiusY()
),