YSTest: HostedUI.cpp 源文件

YSTest PreAlpha_b400_20130424 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
HostedUI.cpp
浏览该文件的文档.
1 ﻿/*
2 Copyright by FrankHB 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 #include "Helper/HostedUI.h"
29 #include "Host.h"
30
31 YSL_BEGIN
32
33 using namespace Drawing;
34 using namespace UI;
35
36 #if YCL_HOSTED
37 YSL_BEGIN_NAMESPACE(Host)
38
39 BufferedRenderer*
40 GetHostRendererPtrOf(UI::IWidget& wgt)
41 {
42 return dynamic_cast<HostRenderer*>(&wgt.GetRenderer());
43 }
44
45 Window*
46 GetWindowPtrOf(UI::IWidget& wgt)
47 {
48 if(const auto p_r = dynamic_cast<HostRenderer*>(&wgt.GetRenderer()))
49 return p_r->GetWindowPtr();
50 return nullptr;
51 }
52
53
54 unique_ptr<BufferedRenderer>
55 MakeHostRenderer(IWidget& wgt, std::function<NativeWindowHandle()> f)
56 {
57 return unique_ptr<BufferedRenderer>(new HostRenderer(wgt, std::move(f)));
58 }
59
60 YSL_END_NAMESPACE(Host)
61 #endif
62
63 YSL_END
64