YSTest: Win32Control.h 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

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

- 文件列表
- 文件成员

Win32Control.h
浏览该文件的文档.
1 /*
2 © 2013-2015 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
29 #ifndef INC_Helper_Win32Control_h_
30 #define INC_Helper_Win32Control_h_ 1
31
32 #include "Helper/YModules.h"
33 #include YFM_Helper_GUIApplication
34 #include YFM_YSLib_Core_YMessage
35 #include YFM_YSLib_UI_YWidgetView
36 #include YFM_Helper_HostWindow
37
38 namespace YSLib
39 {
40
41 #if YCL_Win32
42
43 namespace Windows
44 {
45
46 namespace UI
47 {
48
49 using namespace YSLib::UI;
50
56 class YF_API ControlView : public UI::AView, private WindowReference
57 {
58 public:
59 ControlView(NativeWindowHandle h)
60 : AView(), WindowReference(h)
61 {
62 if(!::IsWindow(h))
63 throw std::invalid_argument("Invalid native window found.");
64 }
65 DefDeCopyMoveCtorAssignment(ControlView)
66
67 DefPredBase(const ynothrow ImplI(AView), Visible, WindowReference)
68
69 #define YF_Impl_TryWin32View(...) \
70 [&, this]{ \
71 TryRet(__VA_ARGS__) \
72 CatchThrow(Win32Exception& e, ViewSignal(e.what())) \
73 }()
74
75 DefGetter(const override, Rect, Bounds,
76 YF_Impl_TryWin32View(WindowReference::GetClientBounds()))
77 DefGetter(const ImplI(AView), Point, Location,
78 YF_Impl_TryWin32View(WindowReference::GetClientLocation()))
79 DefGetter(const ImplI(AView), Size, Size,
80 YF_Impl_TryWin32View(WindowReference::GetClientSize()))
81
82 PDefH(void, SetBounds, const Rect& r) override
83 ImplExpr(YF_Impl_TryWin32View(WindowReference::SetClientBounds(r)))
84 PDefH(void, SetLocation, const Point& pt) ImplI(AView)
85 ImplExpr(YF_Impl_TryWin32View(WindowReference::MoveClient(pt)))
86 PDefH(void, SetSize, const Size& s) ImplI(AView)
87 ImplExpr(YF_Impl_TryWin32View(WindowReference::ResizeClient(s)))
88 PDefH(void, SetVisible, bool v) ImplI(AView)
89 ImplExpr(YF_Impl_TryWin32View(
90 WindowReference::Show(v ? SW_SHOWNORMAL : SW_HIDE)))
91
92 #undef YF_Impl_TryWin32View
93
95 bool
96 HitChildren(const Point&) const override;
97
98 DefClone(const ImplI(AView), ControlView)
99 };
100
101 } // namespace UI;
102
103 } // namespace Windows;
104
105 #endif
106
107 } // namespace YSLib;
108
109 #endif
110
YSLib::UI::AView
抽象部件视图。
Definition: YWidgetView.h:111
v
byte v
Definition: CharRenderer.cpp:75
DefDeCopyMoveCtorAssignment
#define DefDeCopyMoveCtorAssignment(_t)
Definition: YBaseMacro.h:201
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
ImplI
#define ImplI(...)
Definition: YBaseMacro.h:386
YSLib::PDefH
PDefH(Environment &, FetchEnvironment,) ImplRet(FetchGlobalInstance().GetEnvironmentRef()) inline PDefH(GUIHost &
取单一环境对象引用。
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:240
YSLib::ynothrow
YB_PURE const _type size_t n ynothrow
Definition: YCoreUtilities.h:168
DefClone
#define DefClone(_q, _t)
动态复制。
Definition: YBaseMacro.h:293
DefPredBase
#define DefPredBase(_q, _n, _b)
Definition: YBaseMacro.h:235
YSLib::UI
Definition: ShellHelper.h:267
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::Show
YF_API void Show(IWidget &)
显示部件。
Definition: YWidget.cpp:202
UI
YModules.h
YSLib::Drawing::Point
GBinaryGroup< SPos > Point
屏幕二维点（直角坐标表示）。
Definition: YGDIBase.h:278
YF_API
#define YF_API
Definition: Platform.h:56
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:140