YSTest: YDesktop.cpp 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

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

- 文件列表
- 文件成员

YDesktop.cpp
浏览该文件的文档.
1 /*
2 © 2010-2016 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 "YSLib/UI/YModules.h"
29 #include YFM_YSLib_UI_YDesktop
30 #include YFM_YSLib_Service_YBrush
31 #include <ystdex/cast.hpp> // for ystdex::polymorphic_downcast;
32
33 namespace YSLib
34 {
35
36 using namespace Drawing;
37
38 namespace UI
39 {
40
41 namespace
42 {
43
45 BufferedRenderer&
46 GetBufferedRendererOf(const IWidget& wgt) ynothrow
47 {
48 return ystdex::polymorphic_downcast<BufferedRenderer&>(wgt.GetRenderer());
49 }
50
51 } // unnamed namespace;
52
53
54 Desktop::Desktop(Devices::Screen& s, Color c, const shared_ptr<Image>& hImg,
55 unique_ptr<BufferedRenderer> p)
56 : Window(Rect(s.GetSize()), p ? std::move(p) : std::move(
57 make_unique<BufferedRenderer>(true, s.GetBackBuffer()))), screen(s)
58 {
59 Background = hImg ? HBrush(ImageBrush(hImg)) : HBrush(SolidBrush(c)),
60 GetBufferedRendererOf(*this).IgnoreBackground = true;
61 }
62 ImplDeDtor(Desktop)
63
64 void
65 Desktop::Update()
66 {
67 // if(!GetBufferedRendererOf(*this).RequiresRefresh())
68 screen.Update(GetBufferedRendererOf(*this).GetContext().GetBufferPtr());
69 }
70
71 Rect
72 Desktop::Validate()
73 {
74 auto& rd(GetBufferedRendererOf(*this));
75
76 return rd.Validate(*this, *this,
77 {rd.GetContext(), Point(), GetBoundsOf(*this)});
78 }
79
80 } // namespace UI;
81
82 } // namespace YSLib;
83
YSLib::Drawing::ImageBrush
图像画刷。
Definition: YBrush.h:128
platform::p
while p p
Definition: YCLib/FileSystem.h:225
YSLib::UI::GetBoundsOf
pt pt Y const IWidget &wgt const IWidget &wgt const IWidget &wgt GetBoundsOf
Definition: YWidget.h:168
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
platform::Color
颜色。
Definition: Video.h:451
YSLib::Devices::Screen
屏幕。
Definition: YDevice.h:136
YSLib::UI::Desktop::Validate
Rect Validate()
验证：绘制缓冲区使之有效。
Definition: YDesktop.cpp:72
YSLib::UI::ImplDeDtor
ImplDeDtor(Thumb) void DecorateAsCloseButton(Thumb &tmb)
Definition: Button.cpp:125
YSLib::ynothrow
YB_PURE const _type size_t n ynothrow
Definition: YCoreUtilities.h:168
YSLib::UI::HBrush
std::function< void(PaintEventArgs &&)> HBrush
画刷回调函数。
Definition: YComponent.h:81
cast.hpp
C++ 转换模板。
std
Definition: memory.hpp:1100
YSLib::UI::Desktop::Desktop
Desktop(Devices::Screen &, Color=Drawing::ColorSpace::Black, const shared_ptr< Drawing::Image > &={}, unique_ptr< BufferedRenderer >={})
构造：使用指定屏幕对象引用、渲染器指针和背景。
Definition: YDesktop.cpp:54
ystdex::cpp2014::make_unique
enable_if_t<!is_array< _type >::value, std::unique_ptr< _type > > make_unique(_tParams &&...args)
使用 new 和指定参数构造指定类型的 std::unique_ptr 对象。
Definition: memory.hpp:729
YSLib::Drawing::c
The boundary is out of the const Graphics const Rect const Point const Point Color c const Rect const Rect Color c
Definition: YDraw.h:174
YSLib::UI::BufferedRenderer
带缓冲的部件渲染器。
Definition: YRenderer.h:111
YSLib::UI::Widget::Background
HBrush Background
背景。
Definition: YWidget.h:391
YSLib::UI::wgt
IWidget & wgt
Definition: YControl.h:112
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: YGDIBase.h:540
YSLib::Drawing::SolidBrush
单色画刷。
Definition: YBrush.h:58
Drawing
UI
YSLib::UI::Desktop
桌面。
Definition: YDesktop.h:46
YModules.h
YSLib::Drawing::Point
GBinaryGroup< SPos > Point
屏幕二维点（直角坐标表示）。
Definition: YGDIBase.h:278
YSLib::UI::Window
窗口。
Definition: YWindow.h:44
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:140
YSLib::UI::Desktop::Update
void Update()
更新缓冲区至屏幕。