YSTest  PreAlpha_b400_20130424
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
ywindow.cpp
浏览该文件的文档.
1 /*
2  Copyright by FrankHB 2009 - 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 "YSLib/UI/ydesktop.h"
29 #include "YSLib/UI/YBrush.h"
30 
32 
33 using namespace Drawing;
34 
36 
37 Window::Window(const Rect& r, const shared_ptr<Image>& hImg)
38  : Panel(r)
39 {
40  Background = ImageBrush(hImg),
41  SetRenderer(make_unique<BufferedRenderer>());
42 }
43 
44 void
45 Window::operator+=(IWidget& wgt)
46 {
47  MUIContainer::operator+=(wgt);
48  SetContainerPtrOf(wgt, this);
49 }
50 void
51 Window::operator+=(Window& wnd)
52 {
53  MUIContainer::Add(wnd, DefaultWindowZOrder);
54  SetContainerPtrOf(wnd, this);
55 }
56 
57 bool
58 Window::operator-=(IWidget& wgt)
59 {
60  if(FetchContainerPtr(wgt) == this)
61  {
62  SetContainerPtrOf(wgt);
63  if(FetchFocusingPtr(*this) == &wgt)
64  GetView().FocusingPtr = nullptr;
65  return MUIContainer::operator-=(wgt);
66  }
67  return false;
68 }
69 bool
70 Window::operator-=(Window& wnd)
71 {
72  if(FetchContainerPtr(wnd) == this)
73  {
74  SetContainerPtrOf(wnd);
75  if(FetchFocusingPtr(*this) == &wnd)
76  GetView().FocusingPtr = nullptr;
77  return MUIContainer::operator-=(wnd);
78  }
79  return false;
80 }
81 
82 void
83 Window::Add(IWidget& wgt, ZOrderType z)
84 {
85  MUIContainer::Add(wgt, z);
86  SetContainerPtrOf(wgt, this);
87 }
88 
90 
91 YSL_END
92