YSTest: uicontx.cpp 源文件

YSTest PreAlpha_b400_20130424 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
uicontx.cpp
浏览该文件的文档.
1 ﻿/*
2 Copyright by FrankHB 2011 - 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/uicontx.h"
29 #include "YSLib/UI/ygui.h"
30 #include "YSLib/UI/YBrush.h"
31
32 YSL_BEGIN
33
34 YSL_BEGIN_NAMESPACE(UI)
35
36 DialogBox::DialogBox(const Rect& r)
37 : Control(r),
38 btnClose(Rect(GetWidth() - 20, 4, 16, 16), 330)
39 {
40 DecorateAsCloseButton(btnClose),
41 SetContainerPtrOf(btnClose, this),
42 FetchEvent<Paint>(*this).Add(BorderBrush(), BackgroundPriority);
43 }
44
45
46 DialogPanel::DialogPanel(const Rect& r)
47 : Panel(r),
48 btnClose(Rect(GetWidth() - 20, 4, 16, 16), 330),
49 btnOK(Rect(GetWidth() - 40, 4, 16, 16), 120)
50 {
51 AddWidgets(*this, btnClose, btnOK),
52 DecorateAsCloseButton(btnClose),
53 yunseq(
54 FetchEvent<Paint>(*this).Add(BorderBrush(), BackgroundPriority),
55 FetchEvent<Click>(btnOK) += [this](TouchEventArgs&&){
56 Close(*this);
57 },
58 FetchEvent<Paint>(btnOK) += [this](PaintEventArgs&& e){
59 DrawCircle(e.Target, {e.Location.X + 8, e.Location.Y + 8},
60 4, IsEnabled(btnOK) ? btnOK.ForeColor
61 : FetchGUIState().Colors[Styles::Workspace]);
62 }
63 );
64 }
65
66 YSL_END_NAMESPACE(UI)
67
68 YSL_END
69