YSTest: Border.h 源文件

YSTest PreAlpha_b800_20170810 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

Border.h
浏览该文件的文档.
1 /*
2 © 2013-2015 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 void
94 operator()(PaintEventArgs&&);
95 };
96
97
102 enum class BorderArea : std::uint8_t
103 {
104 Left = 0,
105 Up = 0,
106 Center = 1,
107 Right = 2,
108 Down = 2
109 };
110
111
120 class YF_API BorderResizer
121 {
122 public:
124 using Area = pair<BorderArea, BorderArea>;
125
126 private:
127 Point orig_loc{Point::Invalid};
133 Rect locked_bounds{};
134 Area focused{BorderArea::Center, BorderArea::Center};
136 lref<IWidget> widget;
137
138 public:
146 bool RootMode = {};
148 Drawing::Padding Margin;
153 Size MinSize;
154
155 BorderResizer(IWidget& wgt, size_t w = 4, const Size& min_size = {})
156 : widget(wgt), Margin(SPos(w)),
157 MinSize(min_size.Width + w + w, min_size.Height + w + w)
158 {
159 Wrap();
160 }
161
162 DefGetter(const ynothrow, IWidget&, WidgetRef, widget)
163
164
165 Area
166 CheckArea(const Point&);
167
168 private:
173 void
174 Wrap();
175 };
176
177 } // namespace UI;
178
179 } // namespace YSLib;
180
181 #endif
182
YSLib::UI::BorderResizer
调整大小的边框。
Definition: Border.h:120
DefDeCopyAssignment
#define DefDeCopyAssignment(_t)
Definition: YBaseMacro.h:186
YSLib::UI::ynothrow
AView &y ynothrow
Definition: YWidgetView.cpp:47
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
YSLib::UI::BorderStyle
边框样式。
Definition: Border.h:46
UI
YSLib::UI::BorderResizer::Area
pair< BorderArea, BorderArea > Area
区域类型。
Definition: Border.h:124
NPL::A1::Forms::Wrap
YF_API ContextHandler Wrap(const ContextHandler &)
包装合并子为应用子。
Definition: NPLA1.cpp:1447
YSLib::UI::BorderBrush::DefDeCtor
DefDeCtor(BorderBrush) DefDeCopyCtor(BorderBrush) BorderBrush(const BorderStyle &style)
复制构造：默认实现。
Definition: Border.h:77
YSLib::UI::BorderBrush
边框画刷。
Definition: Border.h:68
YSLib::UI::BorderResizer::BorderResizer
BorderResizer(IWidget &wgt, size_t w=4, const Size &min_size={})
Definition: Border.h:155
YSLib::UI::BorderBrush::Style
BorderStyle Style
边框样式。
Definition: Border.h:75
YSLib::UI::wgt
IWidget & wgt
Definition: YControl.h:112
YSLib::UI::BorderArea
BorderArea
边框区域。
Definition: Border.h:102
Color
Pixel Color
Definition: CharRenderer.cpp:58
YSLib::UI::BorderArea::Center
ystdex::lref
左值引用包装。
Definition: ref.hpp:74
YSLib::a
YB_PURE const _type * a
Definition: YCoreUtilities.h:167
YSLib::Drawing::w
The boundary is out of the const Rect SDst w
Definition: YDraw.h:127
YSLib::UI::BorderArea::Down
YSLib::Drawing::GBinaryGroup< SPos >::Invalid
static const GBinaryGroup Invalid
无效（不在屏幕坐标系中）对象。
Definition: YGDIBase.h:58
YSLib::i
return i
Definition: YCoreUtilities.h:176
YSLib::UI::BorderResizer::widget
lref< IWidget > widget
Definition: Border.h:136
YF_API
#define YF_API
Definition: Platform.h:56
YSLib::UI::PaintEventArgs
部件绘制参数。
Definition: YWidgetEvent.h:323
YSLib::UI::BorderResizer::Margin
Drawing::Padding Margin
指定边框相对部件边界以内的范围的边距。
Definition: Border.h:148
YSLib::Drawing::GBinaryGroup< SPos >
YModules.h
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: YGDIBase.h:540
YSLib::Drawing::Size::Height
SDst Height
宽和高。
Definition: YGDIBase.h:302
YSLib::Drawing::Padding
空白样式。
Definition: YGDI.h:46
std
Definition: memory.hpp:1183
YSLib::UI::BorderStyle::BorderStyle
BorderStyle(Color c)
Definition: Border.h:53
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:241
YSLib::UI::Styles::Area
Area
样式区域类型。
Definition: YStyle.h:306
YSLib::UI::BorderResizer::MinSize
Size MinSize
指定部件应该保持的最小大小。
Definition: Border.h:153
DefDeCopyCtor
#define DefDeCopyCtor(_t)
Definition: YBaseMacro.h:162
YSLib::Drawing::Size
屏幕区域大小。
Definition: YGDIBase.h:293
CHRLib::c
c
Definition: CharacterProcessing.h:81
YSLib::UI::BorderArea::Right
YSLib::UI::SPos
const IWidget &wgt SPos
Definition: YWidget.h:109
YSLib::UI::BorderArea::Up
YSLib::UI::BorderStyle::InactiveColor
Color InactiveColor
Definition: Border.h:49
YSLib::UI::BorderStyle::BorderStyle
BorderStyle(Color a, Color i)
Definition: Border.h:57
YSLib::UI::BorderArea::Left