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 
39 
40 YSL_BEGIN_NAMESPACE(Drawing)
41 class FontCache;
42 YSL_END_NAMESPACE(Drawing)
43 #if YCL_HOSTED
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;
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:
92  ValueNode Root;
93 
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 
138 template<class _tApp>
139 inline _tApp&
141 {
142  return ystdex::polymorphic_downcast<_tApp&>(FetchGlobalInstance());
143 }
145 
151 inline Drawing::FontCache&
153 {
155 }
156 
157 #if YCL_HOSTED
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