YSTest: HostedUI.h 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

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

- 文件列表
- 文件成员

HostedUI.h
浏览该文件的文档.
1 /*
2 © 2013-2016 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 #include YFM_YSLib_UI_Hover
34 #include YFM_YSLib_UI_Label
35 #include YFM_YSLib_UI_Menu
36
37 namespace YSLib
38 {
39
40 #if YF_Hosted
41 namespace Host
42 {
43
45
46
50 inline PDefH(observer_ptr<HostRenderer>, GetHostRendererPtrOf, UI::IWidget& wgt)
51 ImplRet(make_observer(dynamic_cast<HostRenderer*>(&wgt.GetRenderer())))
52
58 inline observer_ptr<Window>
59 GetWindowPtrOf(UI::IWidget& wgt)
60 {
61 return ystdex::call_value_or<observer_ptr<Window>>(
62 std::mem_fn(&HostRenderer::GetWindowPtr),
63 dynamic_cast<HostRenderer*>(&wgt.GetRenderer()));
64 }
66
73 YF_API Window&
74 WaitForHostWindow(UI::IWidget&);
75
76
77 # if !YCL_Android
78
85 YF_API void
86 AttachToHost(UI::Widget&, Window&, Messaging::Priority = 0xF8);
87
95 YF_API void
96 DragWindow(Window&, UI::CursorEventArgs&&, bool = {});
97
106 YF_API Drawing::Point
107 FetchDefaultTopLevelPosition() ynothrow;
108 # endif
109 # if YCL_Win32
110
128 YF_API HostRenderer&
129 ShowTopLevel(UI::Widget&, WindowStyle = WS_POPUP, WindowStyle
130 = WS_EX_LAYERED, int = SW_SHOWNORMAL, const wchar_t* = L"");
131 YF_API HostRenderer&
132 ShowTopLevel(UI::Widget&, WindowThread::GuardGenerator,
133 WindowStyle = WS_POPUP, WindowStyle = WS_EX_LAYERED,
134 int = SW_SHOWNORMAL, const wchar_t* = L"");
136 # endif
137 # if !YCL_Android
138
147 YF_API void
148 ShowTopLevelDraggable(UI::Widget&);
149 # endif
150
151
162 # if YCL_Win32
163
167 template<typename _func>
168 void
169 ActOnHover_ShowTopLevel(UI::IWidget& sender, UI::Widget& wgt, _func f,
170 WindowStyle wstyle_ex = WS_EX_NOACTIVATE | WS_EX_LAYERED | WS_EX_TOPMOST)
171 {
172 UI::ActOnHover(sender, [&]{
173 f();
174 ShowTopLevel(wgt, {}, WS_POPUP, wstyle_ex, SW_SHOWNOACTIVATE);
175 });
176 }
177 # endif
178
183 template<typename _func>
184 void
185 ActOnHover_ShowTopLevelAt(UI::IWidget& sender, UI::Widget& wgt, _func f)
186 {
187 # if YCL_Win32
188 Host::ActOnHover_ShowTopLevel(sender, wgt, [&, f]{
189 SetLocationOf(wgt, f());
190 });
191 # else
192 yunused(sender), yunused(wgt), yunused(f);
193 # endif
194 }
196
212 YF_API array<GEvent<UI::HCursorEvent::FuncType>::iterator, 2>
213 BindTimedTips(UI::TimedHoverState&, UI::IWidget&, UI::Widget&);
214
224 YF_API void
225 PrepareTopLevelPopupMenu(UI::Menu&, UI::Panel&);
226
239 YF_API void
240 SetupTopLevelTimedTips(UI::IWidget&, UI::TimedHoverState&,
241 UI::Label&, const String&, const Drawing::Rect& = Drawing::Rect::Invalid,
242 const Drawing::Font& = {},
243 const Drawing::Padding& = Drawing::DefaultMargin * 2);
244
254 YF_API void
255 SetupTopLevelContextMenu(UI::IWidget&, UI::MenuHost&, UI::Menu&);
257
258 } // namespace Host;
259 #endif
260
261 } // namespace YSLib;
262
263 #endif
264
platform::KeyCodes::DS::L
Definition: Keys.h:227
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
YSLib::PDefH
PDefH(Environment &, FetchEnvironment,) ImplRet(FetchGlobalInstance().GetEnvironmentRef()) inline PDefH(GUIHost &
取单一环境对象引用。
YSLib::UI::Styles::Window
窗口背景。
Definition: YStyle.h:311
yunused
#define yunused(...)
标记未使用的表达式。
Definition: ydef.h:942
YSLib::ynothrow
YB_PURE const _type size_t n ynothrow
Definition: YCoreUtilities.h:168
YSLib::UI::wgt
IWidget & wgt
Definition: YControl.h:112
YSLib::UI::SetLocationOf
YF_API void SetLocationOf(IWidget &, const Point &)
设置部件左上角所在位置（相对容器的偏移坐标）。
Definition: YWidget.cpp:76
YSLib::Drawing::DefaultMargin
yconstexpr const Padding DefaultMargin(2, 2, 2, 2)
默认边距。
YSLib::Messaging::Priority
std::uint8_t Priority
消息优先级。
Definition: YMessage.h:51
YSLib::Drawing::Rect::Invalid
static const Rect Invalid
无效对象。
Definition: YGDIBase.h:548
YModules.h
YSLib::Drawing::Point
GBinaryGroup< SPos > Point
屏幕二维点（直角坐标表示）。
Definition: YGDIBase.h:278
ystdex::make_observer
observer_ptr< _type > make_observer(_type *p)
Definition: memory.hpp:1042
YF_API
#define YF_API
Definition: Platform.h:56
YSLib::IO::f
const string &path const String &path _func f
Definition: YSLib/Service/FileSystem.h:430
YSLib::UI::ActOnHover
void ActOnHover(IWidget &wgt, _func f, _tParams &&...args)
设置悬停动作。
Definition: Hover.h:69
YSLib::ImplRet
ImplRet(FetchGlobalInstance().GetGUIHostRef()) YF_API void Execute(GUIApplication &
执行程序主消息循环。
platform::KeyCategory::Menu
表示菜单键（如 Menu 和 Win ）。
Definition: Keys.h:131
YSLib::UI::Styles::Panel
面板背景。
Definition: YStyle.h:312