YSTest: HostedUI.h 源文件

YSTest PreAlpha_b500_20140530 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
HostedUI.h
浏览该文件的文档.
1 /*
2 © 2013-2014 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 INC_Helper_HostedUI_h_
29 #define INC_Helper_HostedUI_h_ 1
30
31 #include "YModules.h"
32 #include YFM_Helper_HostRenderer
33
34 namespace YSLib
35 {
36
37 #if YF_Hosted
38 namespace Host
39 {
40
46 inline HostRenderer*
47 GetHostRendererPtrOf(UI::IWidget& wgt)
48 {
49 return dynamic_cast<HostRenderer*>(&wgt.GetRenderer());
50 }
51
57 inline Window*
58 GetWindowPtrOf(UI::IWidget& wgt)
59 {
60 if(const auto p_r = dynamic_cast<HostRenderer*>(&wgt.GetRenderer()))
61 return p_r->GetWindowPtr();
62 return {};
63 }
64
71 YF_API Window&
72 WaitForHostWindow(UI::IWidget&);
73
74
80 template<typename _fCallable, typename... _tParams>
81 unique_ptr<HostRenderer>
82 MakeHostRenderer(UI::IWidget& wgt, _fCallable&& f, _tParams&&... args)
83 {
84 return make_unique<HostRenderer>(wgt, yforward(f), yforward(args)...);
85 }
86
88 template<typename _tParam>
89 void
90 WrapRenderer(UI::Widget& wgt, _tParam&& arg)
91 {
92 wgt.SetRenderer(MakeHostRenderer(wgt, yforward(arg)));
93 }
95 template<typename... _tParams>
96 void
97 WrapRenderer(UI::Widget& wgt, _tParams&&... args)
98 {
99 wgt.SetRenderer(MakeHostRenderer(wgt, std::bind(yforward(args)...)));
100 }
101
102 # if !YCL_Android
103
109 YF_API void
110 DragWindow(Window&, UI::CursorEventArgs&&);
111 # endif
112 # if YCL_Win32
113
120 YF_API void
121 ShowTopLevel(UI::Widget&, ::DWORD = WS_POPUP, ::DWORD = WS_EX_LAYERED,
122 const wchar_t* = L"");
123 # endif
124 # if !YCL_Android
125
132 YF_API void
133 ShowTopLevelDraggable(UI::Widget&);
134 # endif
135
136 } // namespace Host;
137 #endif
138
139 } // namespace YSLib;
140
141 #endif
142
YSLib::UI::args
yconstfn const string _tParams && args
Definition: Loader.h:111
YF_API
#define YF_API
Definition: Platform.h:64
yforward
#define yforward(_expr)
根据参数类型使用 std::forward 传递对应参数。
Definition: ydef.h:722
YSLib::UI::Styles::Window
窗口背景。
Definition: ystyle.h:182
YSLib::UI::wgt
_tWidget & wgt
Definition: ywgtevt.h:596
YSLib::UI::f
_tWidget _fCallable && f
Definition: ywgtevt.h:597
YModules.h