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 
46 {
47 public:
48  Color ActiveColor, InactiveColor;
49 
50  BorderStyle();
51 };
52 
53 
60 {
61 public:
67 
78  BorderBrush(const BorderStyle& style)
79  : Style(style)
80  {}
81 
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 
112 {
113 public:
115  using Area = pair<BorderArea, BorderArea>;
116 
117 private:
124  Rect locked_bounds{};
126  std::reference_wrapper<IWidget> widget;
127 
128 public:
134  bool HostMode = false;
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 
Drawing::Padding Margin
Definition: Border.h:136
#define DefDeCopyCtor(_t)
Definition: YBaseMacro.h:136
部件绘制参数。
Definition: ywgtevt.h:276
#define YF_API
Definition: Platform.h:64
调整大小的边框。
Definition: Border.h:111
static const GBinaryGroup Invalid
无效(不在屏幕坐标系中)对象。
Definition: ygdibase.h:57
pair< BorderArea, BorderArea > Area
区域类型。
Definition: Border.h:115
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:180
边框样式。
Definition: Border.h:45
边框画刷。
Definition: Border.h:59
BorderStyle Style
边框样式。
Definition: Border.h:66
_tWidget & wgt
Definition: ywgtevt.h:596
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
屏幕标准矩形:表示屏幕矩形区域。
Definition: ygdibase.h:416
Area
样式区域类型。
Definition: ystyle.h:177
DefDeCtor(BorderBrush) DefDeCopyCtor(BorderBrush) BorderBrush(const BorderStyle &style)
复制构造:默认实现。
Definition: Border.h:68
Size MinSize
指定部件应该保持的最小大小。
Definition: Border.h:141
BorderResizer(IWidget &wgt, size_t w=4, const Size &min_size={})
Definition: Border.h:143
std::uint8_t u8
通用数据类型。
Definition: yadaptor.h:67
空白样式。
Definition: ygdi.h:46
BorderArea
边框区域。
Definition: Border.h:93
颜色。
Definition: Video.h:339
屏幕区域大小。
Definition: ygdibase.h:249
std::reference_wrapper< IWidget > widget
Definition: Border.h:126
#define DefDeCopyAssignment(_t)
Definition: YBaseMacro.h:154