blob: 74e12c920771ce1bcf70dd84c2090b1ac94f163f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#pragma once
#include <initializer_list>
#include "ui/control.h"
namespace cru::ui::controls
{
class Border : public Control
{
public:
static Border* Create(const std::initializer_list<Control*>& children = std::initializer_list<Control*>())
{
const auto border = new Border();
for (const auto control : children)
border->AddChild(control);
return border;
}
protected:
Border();
public:
Border(const Border& other) = delete;
Border(Border&& other) = delete;
Border& operator=(const Border& other) = delete;
Border& operator=(Border&& other) = delete;
~Border() override = default;
bool IsDrawBorder() const
{
return draw_border_;
}
void SetDrawBorder(bool draw_border);
Microsoft::WRL::ComPtr<ID2D1Brush> GetBorderBrush() const
{
return border_brush_;
}
void SetBorderBrush(Microsoft::WRL::ComPtr<ID2D1Brush> border_brush);
float GetBorderWidth() const
{
return border_width_;
}
void SetBorderWidth(float border_width);
Microsoft::WRL::ComPtr<ID2D1StrokeStyle> GetBorderStrokeStyle() const
{
return border_stroke_style_;
}
void SetBorderStrokeStyle(Microsoft::WRL::ComPtr<ID2D1StrokeStyle> stroke_style);
float GetBorderRadiusX() const
{
return border_radius_x_;
}
void SetBorderRadiusX(float border_radius_x);
float GetBorderRadiusY() const
{
return border_radius_y_;
}
void SetBorderRadiusY(float border_radius_y);
protected:
void OnDraw(ID2D1DeviceContext* device_context) override;
private:
bool draw_border_ = true;
Microsoft::WRL::ComPtr<ID2D1Brush> border_brush_;
float border_width_ = 1.0f;
Microsoft::WRL::ComPtr<ID2D1StrokeStyle> border_stroke_style_ = nullptr;
float border_radius_x_ = 0.0f;
float border_radius_y_ = 0.0f;
};
}
|