YSTest: Button.h 源文件

YSTest PreAlpha_b900_20201012 The YSLib Test Project

Button.h
浏览该文件的文档.
1 /*
2 © 2010-2015, 2020 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 #ifndef YSL_INC_UI_Button_h_
29 #define YSL_INC_UI_Button_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YSLib_UI_YControl
33 #include YFM_YSLib_UI_Label
34 #include YFM_YSLib_UI_YStyle
35
36 namespace YSLib
37 {
38
39 namespace UI
40 {
41
46 class YF_API Thumb : public Control
47 {
48 public:
53 enum StyleItem : Styles::StyleItem
54 {
55 ThumbBackground,
56 EndStyle
57 };
58
63 Color ForeColor{Drawing::ColorSpace::Black};
64
65 protected:
70 CursorState csCurrent;
71
72 private:
74 Drawing::Hue hue = 180;
75
76 public:
81 explicit
82 Thumb(const Rect& = {}, Drawing::Hue = 180);
83
84 protected:
89 explicit
90 Thumb(const Rect&, ystdex::raw_tag);
91
92 public:
97 ~Thumb() override;
98
103 DefPred(const ynothrow, Pressed, csCurrent == CursorState::Pressed)
104
105
106 DefGetter(const ynothrow, CursorState, CursorState, csCurrent)
108 DefGetter(const ynothrow, Hue, Hue, hue)
109 };
110
118 YF_API void
119 DecorateAsCloseButton(Thumb&);
120
121
126 class YF_API Button : public Thumb, protected MLabel
127 {
128 public:
130 using MLabel::ForeColor;
131 using MLabel::Font;
132 using MLabel::Margin;
133 using MLabel::HorizontalAlignment;
134 using MLabel::VerticalAlignment;
135 using MLabel::Text;
136
141 explicit
142 Button(const Rect& = {}, const Drawing::Font& = {}, Color
143 = Drawing::ColorSpace::Black, TextAlignment = TextAlignment::Center);
148 Button(const Rect&, Drawing::Hue, const Drawing::Font& = {}, Color
149 = Drawing::ColorSpace::Black, TextAlignment = TextAlignment::Center);
150
155 void
156 Refresh(PaintEventArgs&&) override;
157 };
158
159 } // namespace UI;
160
161 } // namespace YSLib;
162
163 #endif
164
YSLib::UI::Thumb::csCurrent
CursorState csCurrent
指针设备光标状态。
Definition: Button.h:70
YSLib::UI::MLabel::HorizontalAlignment
TextAlignment HorizontalAlignment
文本水平和竖直对齐属性。
Definition: Label.h:85
YSLib::UI::ynothrow
AView &y ynothrow
Definition: YWidgetView.cpp:47
YSLib::UI::CursorState
CursorState
指针设备光标相对控件的状态。
Definition: YControl.h:340
YSLib::UI::Button
按钮。
Definition: Button.h:127
YSLib::UI::Control
控件。
Definition: YControl.h:271
YSLib::UI::MLabel::VerticalAlignment
TextAlignment VerticalAlignment
Definition: Label.h:86
YF_API
#define YF_API
Definition: Platform.h:56
YSLib::UI::Thumb
基本按钮。
Definition: Button.h:47
YSLib::UI::Thumb::StyleItem
StyleItem
视觉样式项目。
Definition: Button.h:54
YSLib::UI::MLabel::Font
Drawing::Font Font
字体。
Definition: Label.h:78
YSLib::UI::TextAlignment::Center
@ Center
ystdex::raw_tag
直接构造类型（直接构造重载用）。
Definition: ydef.h:1432
YSLib::UI::Button::Button
Button(const Rect &, Drawing::Hue, const Drawing::Font &={}, Color=Drawing::ColorSpace::Black, TextAlignment=TextAlignment::Center)
构造：使用指定边界、色调、字体、文本颜色和文本对齐样式。
YSLib::Drawing::ColorSpace::Black
@ Black
Definition: YGDIBase.h:262
YSLib::UI::MLabel::ForeColor
Color ForeColor
默认前景色。
Definition: Label.h:77
YSLib::UI::Thumb::Thumb
Thumb(const Rect &={}, Drawing::Hue=180)
构造：使用指定边界和色调。
YSLib::UI::Thumb::DefPred
DefPred(const ynothrow, Pressed, csCurrent==CursorState::Pressed) DefGetter(const ynothrow
判断按钮当前是否处于按下状态。
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: YGDIBase.h:788
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:46
YSLib::UI::CursorState::Pressed
@ Pressed
Color
Pixel Color
Definition: CharRenderer.cpp:59
YSLib::UI::MLabel
标签模块。
Definition: Label.h:62
YModules.h
YSLib 用户界面模块配置文件。
YSLib::UI::MLabel::Margin
Drawing::Padding Margin
文本和容器的间距。
Definition: Label.h:79
YSLib::UI::Thumb::~Thumb
~Thumb() override
虚析构：类定义外默认实现。
YSLib::UI::PaintEventArgs
部件绘制参数。
Definition: YWidgetEvent.h:330
YSLib::UI::MLabel::Text
String Text
标签文本。
Definition: Label.h:94
YSLib::Drawing::Font
字体：字模，包含字型、样式和大小。
Definition: Font.h:589
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:241
YSLib::UI::Thumb::ThumbBackground
@ ThumbBackground
Definition: Button.h:55
const
const Decapsulate const Decapsulate &y ynothrow ContextNode &ctx const
Definition: NPLA1Forms.cpp:1629
YSLib::UI::TextAlignment
TextAlignment
Definition: Label.h:46
YSLib::UI::Styles::StyleItem
size_t StyleItem
标识样式渲染项的类型。
Definition: YStyle.h:377