YSTest: YWindow.cpp 源文件

YSTest PreAlpha_b900_20201012 The YSLib Test Project

YWindow.cpp
浏览该文件的文档.
1 /*
2 © 2009-2014, 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
32 namespace YSLib
33 {
34
35 using namespace Drawing;
36
37 namespace UI
38 {
39
40 Window::Window(const Rect& r, unique_ptr<Renderer> p_renderer)
41 : Panel(r)
42 {
43 if(p_renderer)
44 SetRenderer(std::move(p_renderer));
45 }
46
47 void
48 Window::operator+=(IWidget& wgt)
49 {
50 MUIContainer::operator+=(wgt);
51 SetContainerPtrOf(wgt, make_observer(this));
52 }
53 void
54 Window::operator+=(Window& wnd)
55 {
56 MUIContainer::Add(wnd, DefaultWindowZOrder);
57 SetContainerPtrOf(wnd, make_observer(this));
58 }
59
60 bool
61 Window::operator-=(IWidget& wgt)
62 {
63 if(FetchContainerPtr(wgt).get() == this)
64 {
65 SetContainerPtrOf(wgt);
66 if(FetchFocusingPtr(*this).get() == &wgt)
67 GetView().FocusingPtr = {};
68 return MUIContainer::operator-=(wgt);
69 }
70 return {};
71 }
72 bool
73 Window::operator-=(Window& wnd)
74 {
75 if(FetchContainerPtr(wnd).get() == this)
76 {
77 SetContainerPtrOf(wnd);
78 if(FetchFocusingPtr(*this).get() == &wnd)
79 GetView().FocusingPtr = {};
80 return MUIContainer::operator-=(wnd);
81 }
82 return {};
83 }
84
85 void
86 Window::Add(IWidget& wgt, ZOrder z)
87 {
88 MUIContainer::Add(wgt, z);
89 SetContainerPtrOf(wgt, make_observer(this));
90 }
91
92 } // namespace UI;
93
94 } // namespace YSLib;
95
YSLib::UI::ZOrder
std::uint8_t ZOrder
Z 顺序类型：覆盖顺序，值越大表示越接近顶层。
Definition: YUIContainer.h:179
YSLib::UI::Window::Add
void Add(IWidget &, ZOrder=DefaultZOrder) override
Definition: YWindow.cpp:86
YSLib::UI::Window::operator+=
void operator+=(IWidget &) override
Definition: YWindow.cpp:48
YSLib::UI::Panel
面板。
Definition: YPanel.h:46
YSLib::Drawing::r
The boundary is out of the const Graphics const Rect const Point const Point Color c const Rect const Rect & r
Definition: YDraw.h:174
YSLib::UI::Window::operator-=
bool operator-=(IWidget &) override
Definition: YWindow.cpp:61
YSLib::UI::DefaultWindowZOrder
const ZOrder DefaultWindowZOrder(128)
默认窗口 Z 顺序值。
YSLib::UI::Window
窗口。
Definition: YWindow.h:45
YSLib::UI::FetchFocusingPtr
YB_ATTR_nodiscard YB_PURE pt pt Y YB_ATTR_nodiscard YB_PURE FetchFocusingPtr
Definition: YWidget.h:149
ystdex::make_observer
observer_ptr< _type > make_observer(_type *p)
Definition: pointer.hpp:405
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: YGDIBase.h:788
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:46
YModules.h
YSLib 用户界面模块配置文件。
YSLib::UI::wgt
IWidget & wgt
Definition: YControl.h:113
YSLib::UI::Widget::GetView
GetView()) DefGetter(const ImplI(IWidget)
YSLib::UI::Window::Window
Window(const Rect &={}, unique_ptr< Renderer >=make_unique< BufferedRenderer >())
构造：使用指定边界并设置渲染器。
Definition: YWindow.cpp:40
NPL::get
PDefH(void, LiftTermRef, TermNode &term, const TermNode &tm) ImplExpr(NPL ref get()
Definition: NPLA.h:1737