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 
45 {
46 protected:
48 
49  explicit
51  : Orientation(o)
52  {}
53 
55 };
56 
57 
65 {
66 private:
67  bool visible;
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 
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 
Point location
左上角所在位置(相对于容器的偏移坐标)。
Definition: ywgtview.h:68
#define ImplBodyMem(_m, _n,...)
Definition: YBaseMacro.h:116
View(View &&v)
Definition: ywgtview.h:165
#define DefDeDtor(_t)
定义默认析构函数。
Definition: YBaseMacro.h:146
#define DefPred(_q, _n,...)
Definition: YBaseMacro.h:172
View(const View &v)
Definition: ywgtview.h:162
IWidget * ContainerPtr
从属的部件容器的指针。
Definition: ywgtview.h:145
方向模块。
Definition: ywgtview.h:44
MOriented(Drawing::Orientation o)
Definition: ywgtview.h:50
#define YF_API
Definition: Platform.h:64
std::uint16_t SDst
屏幕坐标距离。
Definition: Video.h:39
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:180
#define DefSetterMem(_t, _n, _m)
Definition: YBaseMacro.h:200
CompactPixmapEx & operator=(const CompactPixmapEx &buf)
Definition: ygdi.h:328
PDefH(void, Activate, Console &console, Drawing::Color fc=Drawing::ColorSpace::White) ImplExpr(Activate(console
激活:使用指定屏幕、有效性、前景色和默认背景色。
Size size
部件大小。
Definition: ywgtview.h:69
sizeof(AlphaType)*GetAreaOf(GetSize())) using CompactPixmap void SetSize(const Size &) override
重新设置缓冲区大小。
#define yunseq
无序列依赖表达式组求值。
Definition: ydef.h:748
可视状态。
Definition: ywgtview.h:64
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
Drawing::Orientation Orientation
Definition: ywgtview.h:47
屏幕标准矩形:表示屏幕矩形区域。
Definition: ygdibase.h:416
Orientation
二元方向。
Definition: ygdibase.h:880
#define DefSetter(_t, _n, _m)
Definition: YBaseMacro.h:188
const IWidget &wgt SPos
Definition: ywidget.h:104
#define ImplBodyBase(_b, _n,...)
Definition: YBaseMacro.h:114
p1 p1 Y
Definition: ydraw.h:188
部件视图。
Definition: ywgtview.h:137
#define DefClone(_q, _t)
动态复制。
Definition: YBaseMacro.h:221
IWidget * FocusingPtr
焦点指针。
Definition: ywgtview.h:152
DefGetterMem(const ynothrow, ListType::size_type, SelectedIndex, viewer) SDst GetFullViewHeight() const
取完整视图高。
Visual visual
当前可视状态。
Definition: ywgtview.h:140
bounds & r
Definition: ydraw.h:220
if(YB_UNLIKELY(r >=sGraphics.Height)) throw std return pBuffer r *sGraphics Width
Definition: ygdibase.cpp:155
IWidget * DependencyPtr
从属的部件指针。
Definition: ywgtview.h:151
View(const Rect &r={})
构造:使用指定边界、前景色和背景色。
Definition: ywgtview.h:159
屏幕区域大小。
Definition: ygdibase.h:249
bool visible
可见性。
Definition: ywgtview.h:67
byte v