YSTest: Border.h 源文件

YSTest PreAlpha_b900_20201012 The YSLib Test Project

Border.h
浏览该文件的文档.
1 /*
2 © 2013-2015, 2018, 2020 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YSL_INC_UI_Border_h_
29 #define YSL_INC_UI_Border_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YSLib_UI_YComponent
33 #include YFM_YSLib_Service_YBrush
34
35 namespace YSLib
36 {
37
38 namespace UI
39 {
40
46 class YF_API BorderStyle
47 {
48 public:
49 Color ActiveColor, InactiveColor;
50
51 BorderStyle();
53 BorderStyle(Color c)
54 : BorderStyle(c, c)
55 {}
57 BorderStyle(Color a, Color i)
58 : ActiveColor(a), InactiveColor(i)
59 {}
60 };
61
62
68 class YF_API BorderBrush
69 {
70 public:
75 BorderStyle Style;
76
77 DefDeCtor(BorderBrush)
82 DefDeCopyCtor(BorderBrush)
87 BorderBrush(const BorderStyle& style)
88 : Style(style)
89 {}
90
91 DefDeCopyAssignment(BorderBrush)
92
93
94 void
95 operator()(PaintEventArgs&&) const;
96 };
97
98
103 enum class BorderArea : std::uint8_t
104 {
105 Left = 0,
106 Up = 0,
107 Center = 1,
108 Right = 2,
109 Down = 2
110 };
111
112
121 class YF_API BorderResizer
122 {
123 public:
125 using Area = pair<BorderArea, BorderArea>;
126
127 private:
128 Point orig_loc{Point::Invalid};
134 Rect locked_bounds{};
135 Area focused{BorderArea::Center, BorderArea::Center};
137 lref<IWidget> widget;
138
139 public:
147 bool RootMode = {};
149 Drawing::Padding Margin;
154 Size MinSize;
155
156 BorderResizer(IWidget& wgt, size_t w = 4, const Size& min_size = {})
157 : widget(wgt), Margin(SPos(w)),
158 MinSize(min_size.Width + w + w, min_size.Height + w + w)
159 {
160 Wrap();
161 }
162
163 DefGetter(const ynothrow, IWidget&, WidgetRef, widget)
164
165
169 YB_ATTR_nodiscard YB_PURE Area
170 CheckArea(const Point&) const;
171
172 private:
177 void
178 Wrap();
179 };
180
181 } // namespace UI;
182
183 } // namespace YSLib;
184
185 #endif
186
YSLib::UI::BorderStyle::BorderStyle
BorderStyle(Color c)
Definition: Border.h:53
YB_ATTR_nodiscard
#define YB_ATTR_nodiscard
标记返回值不被忽略的属性。
Definition: ydef.h:715
YSLib::UI::BorderStyle::InactiveColor
Color InactiveColor
Definition: Border.h:49
YSLib::UI::BorderResizer::widget
lref< IWidget > widget
Definition: Border.h:137
YSLib::UI::SPos
const IWidget &wgt SPos
Definition: YWidget.h:109
YSLib::UI::BorderArea::Left
@ Left
YSLib::UI::ynothrow
AView &y ynothrow
Definition: YWidgetView.cpp:47
YSLib::Drawing::Size
屏幕区域大小。
Definition: YGDIBase.h:536
CHRLib::c
c
Definition: CharacterProcessing.h:84
ystdex::lref
左值引用包装。
Definition: ref.hpp:61
YB_PURE
#define YB_PURE
指示函数或函数模板实例为纯函数。
Definition: ydef.h:919
YSLib::UI::BorderBrush::Style
BorderStyle Style
边框样式。
Definition: Border.h:75
YSLib::UI::BorderArea::Up
@ Up
YSLib::UI::BorderArea::Center
@ Center
YSLib::UI::BorderBrush
边框画刷。
Definition: Border.h:69
YSLib::Drawing::GBinaryGroup< SPos >::Invalid
static const GBinaryGroup Invalid
无效（不在屏幕坐标系中）对象。
Definition: YGDIBase.h:298
YSLib::UI::BorderResizer::DefGetter
DefGetter(const ynothrow, IWidget &, WidgetRef, widget) YB_ATTR_nodiscard YB_PURE Area CheckArea(const Point &) const
检查相对部件点指定区域。
YSLib::UI::BorderBrush::DefDeCopyAssignment
DefDeCopyAssignment(BorderBrush) void operator()(PaintEventArgs &&) const
YF_API
#define YF_API
Definition: Platform.h:56
YSLib::UI::BorderArea::Down
@ Down
YSLib::UI::BorderArea
BorderArea
边框区域。
Definition: Border.h:104
NPL::A1::Forms::Wrap
YF_API ReductionStatus Wrap(TermNode &, ContextNode &)
包装合并子为应用子。
Definition: NPLA1Forms.cpp:2505
YSLib::UI::BorderArea::Right
@ Right
YSLib::UI::BorderResizer::BorderResizer
BorderResizer(IWidget &wgt, size_t w=4, const Size &min_size={})
Definition: Border.h:156
YSLib::Drawing::Padding
空白样式。
Definition: YGDI.h:47
YSLib::Drawing::GBinaryGroup< SPos >
YSLib::i
return i
Definition: YCoreUtilities.h:177
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: YGDIBase.h:788
YSLib::UI::BorderResizer::MinSize
Size MinSize
指定部件应该保持的最小大小。
Definition: Border.h:154
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:46
Color
Pixel Color
Definition: CharRenderer.cpp:59
YSLib::UI::BorderStyle
边框样式。
Definition: Border.h:47
YModules.h
YSLib 用户界面模块配置文件。
YSLib::Drawing::Rect::Height
SDst Height
宽。
Definition: YGDIBase.h:545
YSLib::UI::wgt
IWidget & wgt
Definition: YControl.h:113
YSLib::UI::PaintEventArgs
部件绘制参数。
Definition: YWidgetEvent.h:330
YSLib::Drawing::w
The boundary is out of the const Rect SDst w
Definition: YDraw.h:127
YSLib::UI::BorderResizer
调整大小的边框。
Definition: Border.h:122
DefDeCopyCtor
#define DefDeCopyCtor(_t)
Definition: YBaseMacro.h:162
YSLib::UI::BorderStyle::BorderStyle
BorderStyle(Color a, Color i)
Definition: Border.h:57
YSLib::UI::BorderResizer::Margin
Drawing::Padding Margin
指定边框相对部件边界以内的范围的边距。
Definition: Border.h:149
YSLib::UI::BorderResizer::Area
pair< BorderArea, BorderArea > Area
区域类型。
Definition: Border.h:125
YSLib::a
YB_PURE const _type * a
Definition: YCoreUtilities.h:168
YSLib::UI::BorderBrush::DefDeCtor
DefDeCtor(BorderBrush) DefDeCopyCtor(BorderBrush) BorderBrush(const BorderStyle &style)
复制构造：默认实现。
Definition: Border.h:77