YSTest: GUIShell.cpp 源文件

YSTest PreAlpha_b400_20130424 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
GUIShell.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/shlds.h"
29 #include "Helper/DSMain.h"
30 #include "Helper/ShellHelper.h"
31 #include "YSLib/UI/ydesktop.h"
32 #include "YSLib/UI/ygui.h"
33 #include "Host.h"
34
35 YSL_BEGIN
36
37 YSL_BEGIN_NAMESPACE(Shells)
38
39 using namespace Messaging;
40
41 GUIShell::GUIShell()
42 : Shell(),
43 imMain()
44 {
45 YSLib::UI::FetchGUIState().Reset();
46 }
47
48 void
49 GUIShell::OnGotMessage(const Message& msg)
50 {
51 switch(msg.GetMessageID())
52 {
53 case SM_PAINT:
54 GUIShell::OnInput();
55 return;
56 case SM_INPUT:
57 if(auto p_wgt = imMain.Update())
58 imMain.DispatchInput(*p_wgt);
59 OnInput();
60 return;
61 default:
62 break;
63 }
64 Shell::OnGotMessage(msg);
65 }
66
67 void
68 GUIShell::OnInput()
69 {
70 #if YCL_HOSTED
71 // TODO: Use host reference stored by shell.
72 Host::FetchEnvironment().UpdateRenderWindows();
73 #endif
74 // NOTE: Use code below instead if asynchronous posting is necessary.
75 // PostMessage<SM_PAINT>(0xE0, nullptr);
76 }
77
78 void
79 GUIShell::OnPaint()
80 {}
81
82 YSL_END_NAMESPACE(Shells)
83
84 YSL_END
85