YSTest: YWidgetView.h 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

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

- 文件列表
- 文件成员

YWidgetView.h
浏览该文件的文档.
1 /*
2 © 2009-2016 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_YWidgetView_h_
29 #define YSL_INC_UI_YWidgetView_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YSLib_UI_YComponent
33
34 namespace YSLib
35 {
36
37 namespace UI
38 {
39
44 class YF_API MOriented
45 {
46 protected:
47 Drawing::Orientation Orientation;
48
49 explicit
50 MOriented(Drawing::Orientation o)
51 : Orientation(o)
52 {}
53
54 DefGetter(const ynothrow, Drawing::Orientation, Orientation, Orientation)
55 };
56
57
64 class YF_API Visual
65 {
66 public:
71 bool Visible{true};
76 Rect Bounds{};
77
79 DefDeCtor(Visual)
84 Visual(const Rect& r)
85 : Bounds(r)
86 {}
87 };
88
89
94 class YF_API ViewSignal : public Messaging::MessageSignal
95 {
96 public:
97 using MessageSignal::MessageSignal;
98
100 DefDeCopyCtor(ViewSignal)
105 ~ViewSignal() override;
106 };
107
108
110
111 class YF_API AView : public ystdex::cloneable
112 {
113 public:
115
116 mutable observer_ptr<IWidget> ContainerPtr{};
123 mutable observer_ptr<IWidget> DependencyPtr{};
125 mutable observer_ptr<IWidget> FocusingPtr{};
127
128 DefDeCtor(AView)
129 AView(const AView&)
130 : AView()
131 {}
132 AView(AView&& v)
133 : ContainerPtr(v.ContainerPtr), DependencyPtr(v.DependencyPtr),
134 FocusingPtr(v.FocusingPtr)
135 {
136 yunseq(v.ContainerPtr = {}, v.DependencyPtr = {}, v.FocusingPtr = {});
137 }
139 ~AView() override;
140
141 DefDeCopyMoveAssignment(AView)
142
143 DeclIEntry(bool IsVisible() const)
144
145 virtual DefGetter(const, Rect, Bounds, {GetLocation(), GetSize()})
146 DefGetter(const ynothrow, SDst, Height, GetSize().Height)
147 DeclIEntry(Point GetLocation() const)
148 DefGetter(const ynothrow, SDst, Width, GetSize().Width)
149 DeclIEntry(Size GetSize() const)
150 DefGetterMem(const ynothrow, SPos, X, GetLocation())
151 DefGetterMem(const ynothrow, SPos, Y, GetLocation())
152
153 virtual PDefH(void, SetBounds, const Rect& r)
154 ImplExpr(SetLocation(r.GetPoint()), SetSize(r.GetSize()))
155 virtual PDefH(void, SetHeight, SDst h)
156 ImplExpr(SetSize(GetSize().Width, h))
157 DeclIEntry(void SetLocation(const Point&))
158 PDefH(void, SetLocation, SPos x, SPos y)
159 ImplExpr(SetLocation({x, y}))
160 DeclIEntry(void SetSize(const Size&))
161 PDefH(void, SetSize, SDst w, SDst h)
162 ImplExpr(SetSize({w, h}))
163 virtual PDefH(void, SetWidth, SDst w)
164 ImplExpr(SetSize(w, GetSize().Height))
165 virtual PDefH(void, SetX, SPos x)
166 ImplExpr(SetLocation(x, GetLocation().Y))
167 virtual PDefH(void, SetY, SPos y)
168 ImplExpr(SetLocation(GetLocation().X, y))
169
170 DeclIEntry(void SetVisible(bool))
171
177 virtual PDefH(bool, HitChildren, const Point&) const
178 ImplRet({})
179
180 DeclIEntry(AView* clone() const ImplI(ystdex::cloneable))
181
186 void
187 swap(AView&) ynothrow;
188 };
189
191
192 YF_API void
194 SwapLocationOf(AView&, Point&);
195
197 YF_API void
198 SwapSizeOf(AView&, Size&);
200
201
202
207 class YF_API View : public AView
208 {
209 private:
210 Visual visual;
211
212 public:
217 View(const Rect& r = {})
218 : AView(),
219 visual(r)
220 {}
221 DefDeCopyMoveCtor(View)
222
223 DefDeCopyMoveAssignment(View)
224
225 bool
226 IsVisible() const ynothrow ImplI(AView);
227
229 DefGetter(const ynothrow override, Rect, Bounds, visual.Bounds)
231 DefGetter(const ynothrow ImplI(AView), Point, Location,
232 View::GetBounds().GetPoint())
234 DefGetter(ynothrow, Point&, LocationRef, visual.Bounds.GetPointRef())
236 DefGetterMem(const ynothrow ImplI(AView), Size, Size, View::GetBounds())
238 DefGetterMem(ynothrow, Size&, SizeRef, visual.Bounds)
239
240 DefSetter(override, SDst, Height, GetSizeRef().Height)
241 void
242 SetVisible(bool) ImplI(AView);
243 DefSetter(override, SDst, Width, GetSizeRef().Width)
244 DefSetterMem(override, SPos, X, GetLocationRef())
245 DefSetterMem(override, SPos, Y, GetLocationRef())
247 DefSetter(override, const Rect&, Bounds, visual.Bounds)
248 DefSetter(ImplI(AView), const Point&, Location, visual.Bounds.GetPointRef())
249 DefSetter(ImplI(AView), const Size&, Size, visual.Bounds.GetSizeRef())
250
252 DefClone(const ImplI(AView), View)
253 };
254
255 } // namespace UI;
256
257 } // namespace YSLib;
258
259 #endif
260
YSLib::UI::Visual
可视状态。
Definition: YWidgetView.h:64
YSLib::UI::AView
抽象部件视图。
Definition: YWidgetView.h:111
YSLib::Drawing::w
The boundary is out of the const Rect SDst w
Definition: YDraw.h:127
YSLib::UI::ImplExpr
IWidget bool b ImplExpr(wgt.GetController().SetEnabled(b)) YF_API bool Enable(IWidget &
设置部件可用性，且当可用性改变时无效化部件区域。
YSLib::UI::View::visual
Visual visual
当前可视状态。
Definition: YWidgetView.h:210
ystdex::swap
void swap(container_adaptor< _tSeqCon > &x, container_adaptor< _tSeqCon > &y)
Definition: container.hpp:179
v
byte v
Definition: CharRenderer.cpp:75
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
ImplI
#define ImplI(...)
Definition: YBaseMacro.h:386
YSLib::UI::View::View
View(const Rect &r={})
构造：使用指定边界、前景色和背景色。
Definition: YWidgetView.h:217
YSLib::UI::SPos
const IWidget &wgt SPos
Definition: YWidget.h:109
ystdex::any_ops::clone
Definition: any.h:253
YSLib::UI::ImplRet
const IWidget &wgt ImplRet(wgt.GetView().IsVisible()) bool YF_API Contains(const IWidget &
判断点是否在部件的可视区域内。
DefDeCopyMoveCtor
#define DefDeCopyMoveCtor(_t)
Definition: YBaseMacro.h:172
YSLib::UI::MOriented::MOriented
MOriented(Drawing::Orientation o)
Definition: YWidgetView.h:50
DefGetterMem
#define DefGetterMem(_q, _t, _n, _m)
Definition: YBaseMacro.h:246
YSLib::UI::IsVisible
IsVisible
Definition: YWidget.h:101
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:240
YSLib::UI::View
部件视图。
Definition: YWidgetView.h:207
platform::KeyCodes::DS::Y
Definition: Keys.h:229
YSLib::UI::X
pt X
Definition: YWidget.h:115
YSLib::ynothrow
YB_PURE const _type size_t n ynothrow
Definition: YCoreUtilities.h:168
DefSetterMem
#define DefSetterMem(_q, _t, _n, _m)
Definition: YBaseMacro.h:267
DefClone
#define DefClone(_q, _t)
动态复制。
Definition: YBaseMacro.h:293
YSLib::UI::SwapSizeOf
YF_API void SwapSizeOf(AView &, Size &)
交换指定视图的大小。
Definition: YWidgetView.cpp:62
YSLib::UI::MOriented::Orientation
Drawing::Orientation Orientation
Definition: YWidgetView.h:47
platform::SPos
std::int16_t SPos
屏幕坐标度量。
Definition: Video.h:42
YSLib::UI::x
SPos x
Definition: YWidget.cpp:43
DeclIEntry
#define DeclIEntry(_sig)
Definition: YBaseMacro.h:394
DefDeCopyCtor
#define DefDeCopyCtor(_t)
Definition: YBaseMacro.h:161
yunseq
#define yunseq
无序列依赖表达式组求值。
Definition: ydef.h:996
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: YGDIBase.h:540
YSLib::UI::Visual::DefDeCtor
DefDeCtor(Visual) Visual(const Rect &r)
构造：使用指定边界。
Definition: YWidgetView.h:79
ystdex
特性测试宏。
Definition: ydef.h:796
YSLib::Drawing::Size
屏幕区域大小。
Definition: YGDIBase.h:293
YSLib::Drawing::r
The boundary is out of the const Graphics const Rect const Point const Point Color c const Rect const Rect & r
Definition: YDraw.h:174
YSLib::UI::AView::DefDeCtor
DefDeCtor(AView) AView(const AView &)
Definition: YWidgetView.h:128
YSLib::UI::MOriented
方向模块。
Definition: YWidgetView.h:44
UI
YSLib::UI::y
SPos SPos y
Definition: YWidget.cpp:44
YModules.h
YSLib::UI::SwapLocationOf
YF_API void SwapLocationOf(AView &, Point &)
交换指定视图的位置。
YSLib::UI::ViewSignal
视图操作消息信号。
Definition: YWidgetView.h:94
YSLib::Messaging::MessageSignal
消息信号：表示单一处理中断的异常。
Definition: YMessage.h:287
YSLib::Drawing::Point
GBinaryGroup< SPos > Point
屏幕二维点（直角坐标表示）。
Definition: YGDIBase.h:278
YF_API
#define YF_API
Definition: Platform.h:56
YSLib::UI::AView::AView
AView(AView &&v)
Definition: YWidgetView.h:132
YSLib::UI::PDefH
PDefH(void, DisplayFor, IWidget &wgt, Timers::TimeSpan delay) ImplExpr(Show(wgt)
在一定时间内显示部件。
DefDeCopyMoveAssignment
#define DefDeCopyMoveAssignment(_t)
Definition: YBaseMacro.h:196
ystdex::cloneable
可动态复制的抽象基类。
Definition: base.h:117
DefSetter
#define DefSetter(_q, _t, _n, _m)
Definition: YBaseMacro.h:251
platform::SDst
std::uint16_t SDst
屏幕坐标距离。
Definition: Video.h:43
YSLib::Drawing::GBinaryGroup< SPos >