YSTest: DSWindow.cpp 源文件

YSTest PreAlpha_b500_20140530 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
DSWindow.cpp
浏览该文件的文档.
1 /*
2 © 2013-2014 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 #include "DSWindow.h"
29 #include "DSScreen.h" // for GSurface;
30
31 namespace YSLib
32 {
33
34 #if YF_Hosted
35 using Devices::DSScreen;
36 using Drawing::Point;
37
38 namespace Host
39 {
40
41 DSWindow::DSWindow(NativeWindowHandle h, DSScreen& s_up, DSScreen& s_dn,
42 Environment& e)
43 : Window(h, e), scr_up(s_up), scr_dn(s_dn)
44 {
45 # if YCL_Win32
46 yunseq(
47 BoundsLimited = true,
48 MessageMap[WM_DESTROY] += []{
49 YSLib::PostQuitMessage(0);
50 // NOTE: Try to make sure all shells are released before destructing the
51 // instance of %DSApplication.
52 },
53 MessageMap[WM_PAINT] += [this]{
54 // NOTE: Painting using %::GetDC and manually managing clipping areas
55 // instead of %::GetDCEx, for performance and convenience of
56 // implementing %DSWindow::GetInputBounds.
57 GSurface<WindowRegionDeviceContext> sf(GetNativeHandle());
58
59 scr_up.UpdateToSurface(sf),
60 scr_dn.UpdateToSurface(sf);
61 }
62 );
63 # endif
64 }
65
66 pair<Point, Point>
67 DSWindow::GetInputBounds() const ynothrow
68 {
69 return {Point(0, MainScreenHeight),
70 Point(MainScreenWidth, MainScreenHeight << 1)};
71 }
72
73 } // namespace Host;
74 #endif
75
76 } // namespace YSLib;
77
YSLib::PostQuitMessage
YF_API void PostQuitMessage(int nExitCode, Messaging::Priority p=0xF0)
以优先级 p 发起 Shell 终止请求，返回 nExitCode。
Definition: yapp.cpp:83
DSWindow.h
DS 宿主窗口。
DSScreen.h
DS 屏幕。
YSLib::UI::Styles::Window
窗口背景。
Definition: ystyle.h:182
YSLib::Drawing::Point
GBinaryGroup< SPos > Point
屏幕二维点（直角坐标表示）。
Definition: ygdibase.h:235
yunseq
#define yunseq
无序列依赖表达式组求值。
Definition: ydef.h:748
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
platform_ex::NativeWindowHandle
::ANativeWindow * NativeWindowHandle
Definition: Android.h:50