YSTest: Border.h 源文件

YSTest PreAlpha_b500_20140530 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
Border.h
浏览该文件的文档.
1 /*
2 © 2013 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_YBrush
33
34 namespace YSLib
35 {
36
37 namespace UI
38 {
39
45 class YF_API BorderStyle
46 {
47 public:
48 Color ActiveColor, InactiveColor;
49
50 BorderStyle();
51 };
52
53
59 class YF_API BorderBrush
60 {
61 public:
66 BorderStyle Style;
67
68 DefDeCtor(BorderBrush)
73 DefDeCopyCtor(BorderBrush)
78 BorderBrush(const BorderStyle& style)
79 : Style(style)
80 {}
81
82 DefDeCopyAssignment(BorderBrush)
83
84 void
85 operator()(PaintEventArgs&&);
86 };
87
88
93 enum class BorderArea : u8
94 {
95 Left = 0,
96 Up = 0,
97 Center = 1,
98 Right = 2,
99 Down = 2
100 };
101
102
111 class YF_API BorderResizer
112 {
113 public:
115 using Area = pair<BorderArea, BorderArea>;
116
117 private:
118 Point orig_loc{Point::Invalid};
124 Rect locked_bounds{};
125 Area focused{BorderArea::Center, BorderArea::Center};
126 std::reference_wrapper<IWidget> widget;
127
128 public:
134 bool HostMode = false;
136 Drawing::Padding Margin;
141 Size MinSize;
142
143 BorderResizer(IWidget& wgt, size_t w = 4, const Size& min_size = {})
144 : widget(wgt), Margin(w, w, w, w),
145 MinSize(min_size.Width + w + w, min_size.Height + w + w)
146 {
147 Wrap();
148 }
149
150 DefGetter(const ynothrow, IWidget&, WidgetRef, widget)
151
152
153 Area
154 CheckArea(const Point&);
155
156 private:
161 void
162 Wrap();
163 };
164
165 } // namespace UI;
166
167 } // namespace YSLib;
168
169 #endif
170
YSLib::UI::BorderArea::Right
YSLib::UI::BorderResizer::Margin
Drawing::Padding Margin
Definition: Border.h:136
YModules.h
YSLib::UI::BorderArea::Down
DefDeCopyCtor
#define DefDeCopyCtor(_t)
Definition: YBaseMacro.h:136
YSLib::UI::PaintEventArgs
部件绘制参数。
Definition: ywgtevt.h:276
YF_API
#define YF_API
Definition: Platform.h:64
YSLib::UI::BorderResizer
调整大小的边框。
Definition: Border.h:111
YSLib::Drawing::GBinaryGroup< SPos >::Invalid
static const GBinaryGroup Invalid
无效（不在屏幕坐标系中）对象。
Definition: ygdibase.h:57
YSLib::UI::BorderStyle::InactiveColor
Color InactiveColor
Definition: Border.h:48
YSLib::UI::BorderResizer::Area
pair< BorderArea, BorderArea > Area
区域类型。
Definition: Border.h:115
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:180
YSLib::UI::BorderStyle
边框样式。
Definition: Border.h:45
YSLib::UI::BorderBrush
边框画刷。
Definition: Border.h:59
YSLib::UI::BorderBrush::Style
BorderStyle Style
边框样式。
Definition: Border.h:66
YSLib::UI::wgt
_tWidget & wgt
Definition: ywgtevt.h:596
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
YSLib::UI::BorderArea::Up
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: ygdibase.h:416
YSLib::Drawing::GBinaryGroup< SPos >
YSLib::UI::Styles::Area
Area
样式区域类型。
Definition: ystyle.h:177
YSLib::UI::BorderBrush::DefDeCtor
DefDeCtor(BorderBrush) DefDeCopyCtor(BorderBrush) BorderBrush(const BorderStyle &style)
复制构造：默认实现。
Definition: Border.h:68
YSLib::UI::BorderResizer::MinSize
Size MinSize
指定部件应该保持的最小大小。
Definition: Border.h:141
YSLib::UI::BorderResizer::BorderResizer
BorderResizer(IWidget &wgt, size_t w=4, const Size &min_size={})
Definition: Border.h:143
YSLib::u8
std::uint8_t u8
通用数据类型。
Definition: yadaptor.h:67
YSLib::UI::BorderArea::Left
YSLib::UI::BorderArea::Center
YSLib::Drawing::Padding
空白样式。
Definition: ygdi.h:46
YSLib::UI::BorderArea
BorderArea
边框区域。
Definition: Border.h:93
platform::Color
颜色。
Definition: Video.h:339
YSLib::Drawing::Size
屏幕区域大小。
Definition: ygdibase.h:249
YSLib::UI::BorderResizer::widget
std::reference_wrapper< IWidget > widget
Definition: Border.h:126
DefDeCopyAssignment
#define DefDeCopyAssignment(_t)
Definition: YBaseMacro.h:154