YSTest: ywgtview.h 源文件

YSTest PreAlpha_b500_20140530 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
ywgtview.h
浏览该文件的文档.
1 /*
2 © 2009-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_ywgtview_h_
29 #define YSL_INC_UI_ywgtview_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 private:
67 bool visible;
68 Point location;
69 Size size;
70
71 public:
76 Visual(const Rect& = {});
77
78 DefPred(const ynothrow, Visible, visible)
79
80 DefGetter(const ynothrow, SPos, X, GetLocation().X)
81 DefGetter(const ynothrow, SPos, Y, GetLocation().Y)
82 DefGetter(const ynothrow, SDst, Width, GetSize().Width)
83 DefGetter(const ynothrow, SDst, Height, GetSize().Height)
84 DefGetter(const ynothrow, const Point&, Location, location)
85 DefGetter(const ynothrow, const Size&, Size, size)
87 DefGetter(ynothrow, Point&, LocationRef, location)
89 DefGetter(ynothrow, Size&, SizeRef, size)
90
91 DefSetter(bool, Visible, visible)
95 PDefH(void, SetX, SPos x)
96 ImplBodyBase(Visual, SetLocation, Point(x, GetY()))
100 PDefH(void, SetY, SPos y)
101 ImplBodyBase(Visual, SetLocation, Point(GetX(), y))
105 PDefH(void, SetWidth, SDst w)
106 ImplBodyBase(Visual, SetSize, Size(w, GetHeight()))
110 PDefH(void, SetHeight, SDst h)
111 ImplBodyBase(Visual, SetSize, Size(GetWidth(), h))
115 DefSetter(const Point&, Location, location)
119 PDefH(void, SetLocation, SPos x, SPos y)
120 ImplBodyBase(Visual, SetLocation, Point(x, y))
124 DefSetter(const Size&, Size, size)
128 PDefH(void, SetSize, SDst w, SDst h)
129 ImplBodyBase(Visual, SetSize, Size(w, h))
130 };
131
132
137 class YF_API View
138 {
139 private:
140 Visual visual;
141
142 public:
144
145 mutable IWidget* ContainerPtr;
146
151 mutable IWidget* DependencyPtr;
152 mutable IWidget* FocusingPtr;
153
154
159 View(const Rect& r = {})
160 : visual(r), ContainerPtr(), DependencyPtr(), FocusingPtr()
161 {}
162 View(const View& v)
163 : visual(v.visual), ContainerPtr(), DependencyPtr(), FocusingPtr()
164 {}
165 View(View&& v)
166 : visual(v.visual), ContainerPtr(v.ContainerPtr),
167 DependencyPtr(v.DependencyPtr), FocusingPtr(v.FocusingPtr)
168 {
169 yunseq(v.ContainerPtr = {}, v.DependencyPtr = {}, v.FocusingPtr = {});
170 }
171 virtual DefDeDtor(View)
172
173
177 View&
178 operator=(const View& v)
179 {
180 visual = v.visual;
181 return *this;
182 }
187 View&
188 operator=(View&& v)
189 {
190 visual = std::move(v.visual);
191 return *this;
192 }
193
194 bool
195 IsVisible() const ynothrow;
196
197 DefGetterMem(const ynothrow, SPos, X, visual)
198 DefGetterMem(const ynothrow, SPos, Y, visual)
199 DefGetterMem(const ynothrow, SDst, Width, visual)
200 DefGetterMem(const ynothrow, SDst, Height, visual)
201 DefGetterMem(const ynothrow, const Point&, Location, visual)
202 DefGetterMem(const ynothrow, const Size&, Size, visual)
204 DefGetterMem(ynothrow, Point&, LocationRef, visual)
206 DefGetterMem(ynothrow, Size&, SizeRef, visual)
207
208 void
209 SetVisible(bool);
210 DefSetterMem(SPos, X, visual)
211 DefSetterMem(SPos, Y, visual)
212 DefSetterMem(SDst, Width, visual)
213 DefSetterMem(SDst, Height, visual)
214 virtual DefSetterMem(const Point&, Location, visual)
215 virtual DefSetterMem(const Size&, Size, visual)
216 PDefH(void, SetLocation, SPos x, SPos y)
217 ImplBodyMem(visual, SetLocation, Point(x, y))
218 PDefH(void, SetSize, SDst w, SDst h)
219 ImplBodyMem(visual, SetSize, Size(w, h))
220
222 virtual DefClone(const, View)
223 };
224
225 } // namespace UI;
226
227 } // namespace YSLib;
228
229 #endif
230
YSLib::UI::Visual::location
Point location
左上角所在位置（相对于容器的偏移坐标）。
Definition: ywgtview.h:68
ImplBodyMem
#define ImplBodyMem(_m, _n,...)
Definition: YBaseMacro.h:116
YSLib::UI::View::View
View(View &&v)
Definition: ywgtview.h:165
YModules.h
DefDeDtor
#define DefDeDtor(_t)
定义默认析构函数。
Definition: YBaseMacro.h:146
DefPred
#define DefPred(_q, _n,...)
Definition: YBaseMacro.h:172
YSLib::UI::View::View
View(const View &v)
Definition: ywgtview.h:162
YSLib::UI::View::ContainerPtr
IWidget * ContainerPtr
从属的部件容器的指针。
Definition: ywgtview.h:145
YSLib::UI::MOriented
方向模块。
Definition: ywgtview.h:44
YSLib::UI::IsVisible
IsVisible
Definition: ywidget.h:96
YSLib::UI::MOriented::MOriented
MOriented(Drawing::Orientation o)
Definition: ywgtview.h:50
YF_API
#define YF_API
Definition: Platform.h:64
platform::SDst
std::uint16_t SDst
屏幕坐标距离。
Definition: Video.h:39
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:180
YSLib::UI::X
pt X
Definition: ywidget.h:110
DefSetterMem
#define DefSetterMem(_t, _n, _m)
Definition: YBaseMacro.h:200
YSLib::Drawing::operator=
CompactPixmapEx & operator=(const CompactPixmapEx &buf)
Definition: ygdi.h:328
YSLib::UI::PDefH
PDefH(void, Activate, Console &console, Drawing::Color fc=Drawing::ColorSpace::White) ImplExpr(Activate(console
激活：使用指定屏幕、有效性、前景色和默认背景色。
YSLib::UI::Visual::size
Size size
部件大小。
Definition: ywgtview.h:69
YSLib::Drawing::SetSize
sizeof(AlphaType)*GetAreaOf(GetSize())) using CompactPixmap void SetSize(const Size &) override
重新设置缓冲区大小。
yunseq
#define yunseq
无序列依赖表达式组求值。
Definition: ydef.h:748
YSLib::UI::Visual
可视状态。
Definition: ywgtview.h:64
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
YSLib::UI::MOriented::Orientation
Drawing::Orientation Orientation
Definition: ywgtview.h:47
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: ygdibase.h:416
YSLib::Drawing::Orientation
Orientation
二元方向。
Definition: ygdibase.h:880
DefSetter
#define DefSetter(_t, _n, _m)
Definition: YBaseMacro.h:188
YSLib::Drawing::GBinaryGroup< SPos >
YSLib::UI::SPos
const IWidget &wgt SPos
Definition: ywidget.h:104
ImplBodyBase
#define ImplBodyBase(_b, _n,...)
Definition: YBaseMacro.h:114
YSLib::Drawing::Y
p1 p1 Y
Definition: ydraw.h:188
YSLib::UI::View
部件视图。
Definition: ywgtview.h:137
DefClone
#define DefClone(_q, _t)
动态复制。
Definition: YBaseMacro.h:221
YSLib::UI::View::FocusingPtr
IWidget * FocusingPtr
焦点指针。
Definition: ywgtview.h:152
YSLib::UI::DefGetterMem
DefGetterMem(const ynothrow, ListType::size_type, SelectedIndex, viewer) SDst GetFullViewHeight() const
取完整视图高。
YSLib::UI::View::visual
Visual visual
当前可视状态。
Definition: ywgtview.h:140
YSLib::Drawing::r
bounds & r
Definition: ydraw.h:220
YSLib::Drawing::Width
if(YB_UNLIKELY(r >=sGraphics.Height)) throw std return pBuffer r *sGraphics Width
Definition: ygdibase.cpp:155
YSLib::UI::View::DependencyPtr
IWidget * DependencyPtr
从属的部件指针。
Definition: ywgtview.h:151
YSLib::UI::View::View
View(const Rect &r={})
构造：使用指定边界、前景色和背景色。
Definition: ywgtview.h:159
YSLib::Drawing::Size
屏幕区域大小。
Definition: ygdibase.h:249
YSLib::UI::Visual::visible
bool visible
可见性。
Definition: ywgtview.h:67
v
byte v
Definition: CharRenderer.cpp:73