YSTest: GUIApplication.h 源文件

YSTest PreAlpha_b400_20130424 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
GUIApplication.h
浏览该文件的文档.
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 #ifndef INC_Helper_GUIApplication_h_
29 #define INC_Helper_GUIApplication_h_ 1
30
31 #include "Helper/yglobal.h"
32 #include "YCLib/Input.h"
33 #include "YSLib/Core/yapp.h"
34 #include "YSLib/Core/ValueNode.h"
35 #include <ystdex/cast.hpp>
36 #include "Helper/GUIShell.h"
37
38 YSL_BEGIN
39
40 YSL_BEGIN_NAMESPACE(Drawing)
41 class FontCache;
42 YSL_END_NAMESPACE(Drawing)
43 #if YCL_HOSTED
44 YSL_BEGIN_NAMESPACE(Host)
45 #if YCL_MINGW32
46
47 typedef ::HWND NativeWindowHandle;
48 #endif
49 class Window;
50 class RenderWindow;
51 class WindowThread;
52 class HostRenderer;
53 class Environment;
54 YSL_END_NAMESPACE(Host)
55 #endif
56
57
63 class YF_API GUIApplication : public Application
64 {
65 #if YCL_HOSTED
66 private:
70 unique_ptr<Host::Environment> p_hosted;
71 #endif
72
73 protected:
78 unique_ptr<Drawing::FontCache> pFontCache;
79
80 public:
88 Messaging::Priority UIResponseLimit;
92 ValueNode Root;
93
98 GUIApplication();
102 ~GUIApplication() override;
103
108 Drawing::FontCache&
109 GetFontCache() const ynothrow;
110 #if YCL_HOSTED
111 Host::Environment&
112 GetHost();
113 #endif
114
124 bool
125 DealMessage();
126 };
127
128
136 YF_API GUIApplication&
137 FetchGlobalInstance() ynothrow;
138 template<class _tApp>
139 inline _tApp&
140 FetchGlobalInstance() ynothrow
141 {
142 return ystdex::polymorphic_downcast<_tApp&>(FetchGlobalInstance());
143 }
145
151 inline Drawing::FontCache&
152 FetchDefaultFontCache() ynothrow
153 {
154 return FetchGlobalInstance().GetFontCache();
155 }
156
157 #if YCL_HOSTED
158 YSL_BEGIN_NAMESPACE(Host)
159
160
161 inline Environment&
162 FetchEnvironment() ynothrow
163 {
164 return FetchGlobalInstance().GetHost();
165 }
166
167 YSL_END_NAMESPACE(Host)
168 #endif
169
175 YF_API void
176 Execute(GUIApplication&, shared_ptr<Shell> = make_shared<Shells::GUIShell>());
177
178 YSL_END
179
180 #endif
181