YSTest: ywgtview.h 源文件

YSTest PreAlpha_b400_20130424 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
ywgtview.h
浏览该文件的文档.
1 ﻿/*
2 Copyright by FrankHB 2009 - 2013.
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 "ycomp.h"
32
33 YSL_BEGIN
34
35 YSL_BEGIN_NAMESPACE(UI)
36
37
41 class YF_API MOriented
42 {
43 protected:
44 Drawing::Orientation Orientation;
45
46 explicit
47 MOriented(Drawing::Orientation o)
48 : Orientation(o)
49 {}
50
51 DefGetter(const ynothrow, Drawing::Orientation, Orientation, Orientation)
52 };
53
54
60 class YF_API Visual
61 {
62 private:
63 bool visible;
64 Point location;
65 Size size;
66
67 public:
72 Visual(const Rect& = {});
73
74 DefPred(const ynothrow, Visible, visible)
75
76 DefGetter(const ynothrow, SPos, X, GetLocation().X)
77 DefGetter(const ynothrow, SPos, Y, GetLocation().Y)
78 DefGetter(const ynothrow, SDst, Width, GetSize().Width)
79 DefGetter(const ynothrow, SDst, Height, GetSize().Height)
80 DefGetter(const ynothrow, const Point&, Location, location)
81 DefGetter(const ynothrow, const Size&, Size, size)
83 DefGetter(ynothrow, Point&, LocationRef, location)
85 DefGetter(ynothrow, Size&, SizeRef, size)
86
87 DefSetter(bool, Visible, visible)
92 PDefH(void, SetX, SPos x)
93 ImplBodyBase(Visual, SetLocation, Point(x, GetY()))
98 PDefH(void, SetY, SPos y)
99 ImplBodyBase(Visual, SetLocation, Point(GetX(), y))
104 PDefH(void, SetWidth, SDst w)
105 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)
120 PDefH(void, SetLocation, SPos x, SPos y)
121 ImplBodyBase(Visual, SetLocation, Point(x, y))
126 DefSetter(const Size&, Size, size)
131 PDefH(void, SetSize, SDst w, SDst h)
132 ImplBodyBase(Visual, SetSize, Size(w, h))
133 };
134
135
140 class YF_API View
141 {
142 private:
143 Visual visual;
144
145 public:
147
148 mutable IWidget* ContainerPtr;
149
154 mutable IWidget* DependencyPtr;
155 mutable IWidget* FocusingPtr;
156
157
162 View(const Rect& r = {})
163 : visual(r), ContainerPtr(), DependencyPtr(), FocusingPtr()
164 {}
165 View(const View& v)
166 : visual(v.visual), ContainerPtr(), DependencyPtr(), FocusingPtr()
167 {}
168 View(View&& v)
169 : visual(v.visual), ContainerPtr(v.ContainerPtr),
170 DependencyPtr(v.DependencyPtr), FocusingPtr(v.FocusingPtr)
171 {
172 yunseq(v.ContainerPtr = nullptr, v.DependencyPtr = nullptr,
173 v.FocusingPtr = nullptr);
174 }
175 virtual DefEmptyDtor(View)
176
177
181 View&
182 operator=(const View& v)
183 {
184 visual = v.visual;
185 return *this;
186 }
191 View&
192 operator=(View&& v)
193 {
194 visual = std::move(v.visual);
195 return *this;
196 }
197
198 bool
199 IsVisible() const ynothrow;
200
201 DefGetterMem(const ynothrow, SPos, X, visual)
202 DefGetterMem(const ynothrow, SPos, Y, visual)
203 DefGetterMem(const ynothrow, SDst, Width, visual)
204 DefGetterMem(const ynothrow, SDst, Height, visual)
205 DefGetterMem(const ynothrow, const Point&, Location, visual)
206 DefGetterMem(const ynothrow, const Size&, Size, visual)
208 DefGetterMem(ynothrow, Point&, LocationRef, visual)
210 DefGetterMem(ynothrow, Size&, SizeRef, visual)
211
212 void
213 SetVisible(bool);
214 DefSetterMem(SPos, X, visual)
215 DefSetterMem(SPos, Y, visual)
216 DefSetterMem(SDst, Width, visual)
217 DefSetterMem(SDst, Height, visual)
218 virtual DefSetterMem(const Point&, Location, visual)
219 virtual DefSetterMem(const Size&, Size, visual)
220 PDefH(void, SetLocation, SPos x, SPos y)
221 ImplBodyMem(visual, SetLocation, Point(x, y))
222 PDefH(void, SetSize, SDst w, SDst h)
223 ImplBodyMem(visual, SetSize, Size(w, h))
224
225 virtual DefClone(const, View, Clone)
226 };
227
228 YSL_END_NAMESPACE(UI)
229
230 YSL_END
231
232 #endif
233