YSTest  PreAlpha_b380_20130211
The YSLib Test Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
YSLib::Components::CheckBox Class Reference

复选框。 More...

#include <Selector.h>

Inheritance diagram for YSLib::Components::CheckBox:
Collaboration diagram for YSLib::Components::CheckBox:

Public Types

typedef GValueEventArgs< bool > TickedArgs
 复选框选中状态参数类型。
 
typedef GHEvent< void(TickedArgs)> HTickedEvent
 复选框选中事件委托类型。
 

Public Member Functions

 CheckBox (const Rect &={})
 构造:使用指定边界。
 
 CheckBox (CheckBox &&)=default
 
bool IsTicked () const ynothrow
 
GEvent< void(HTickedEvent::EventArgsType)> & GetTicked () ynothrow
 复选框选中事件。
 
void SetTicked (bool)
 设置选中状态并检查复选框选中事件。
 
void Tick (bool)
 设置选中状态并触发复选框选中事件。
 
void Refresh (PaintEventArgs &&) override
 刷新:按指定参数绘制界面并更新状态。
 
- Public Member Functions inherited from YSLib::Components::Thumb
 Thumb (const Rect &={}, Drawing::Hue=180)
 构造:使用指定边界和色调。
 
 Thumb (Thumb &&)=default
 
bool IsPressed () const ynothrow
 判断按钮当前是否处于按下状态。
 
- Public Member Functions inherited from YSLib::Components::Control
 Control (const Rect &={})
 构造:使用指定边界,默认背景(同 Widget 默认构造)。
 
 Control (const Rect &, NoBackgroundTag)
 构造:使用指定边界,无背景。
 
 Control (const Control &)
 复制构造:除容器为空外深复制。
 
 Control (Control &&)=default
 
virtual IWidgetGetBoundControlPtr (const KeyInput &)
 取按键-指针设备输入默认事件组映射。
 
void OnTouch_Close (TouchEventArgs &&)
 处理屏幕事件:关闭显示。
 
- Public Member Functions inherited from YSLib::Components::Widget
 Widget (const Rect &={}, Color=Drawing::ColorSpace::White, Color=Drawing::ColorSpace::Black)
 
template<typename _tView , typename _tRenderer , typename _tController >
 Widget (_tView &&pView_=make_unique< View >(), _tRenderer &&pRenderer_=make_unique< Renderer >(), _tController &&pController_={})
 构造:使用视图指针、渲染器指针和控制器指针,无背景。
 
 Widget (const Widget &)
 复制构造:除容器指针为空外深复制。
 
 Widget (Widget &&)=default
 
virtual ~Widget ()
 析构:虚实现。
 
SPos GetX () const ynothrow
 
SPos GetY () const ynothrow
 
SDst GetWidth () const ynothrow
 
SDst GetHeight () const ynothrow
 
virtual RendererGetRenderer () const ynothrow
 取渲染器。
 
virtual ViewGetView () const ynothrow
 取部件视图。
 
virtual AControllerGetController () const override
 取控制器。
 
virtual WidgetRange GetChildren () override
 
void SetX (SDst _tempArgName)
 
void SetY (SDst _tempArgName)
 
void SetWidth (SDst _tempArgName)
 
void SetHeight (SDst _tempArgName)
 
void SetRenderer (unique_ptr< Renderer > &&)
 设置渲染器为指定指针指向的对象,同时更新渲染器状态。
 
void SetView (unique_ptr< View > &&)
 设置渲染器为指定指针指向的对象,同时更新渲染器状态。
 
- Public Member Functions inherited from YSLib::Components::IWidget
virtual ~IWidget ()
 

Protected Member Functions

void PaintBox (const Graphics &, const Rect &)
 绘制复选框。
 
- Protected Member Functions inherited from YSLib::Components::Thumb
 Thumb (const Rect &, NoBackgroundTag)
 无背景构造:使用指定边界。
 

Protected Attributes

bool bTicked
 
- Protected Attributes inherited from YSLib::Components::Thumb
bool bPressed
 按下状态:表示按钮当前是否处于按下状态。
 

Private Attributes

GEvent< void(HTickedEvent::EventArgsType)> Ticked
 复选框选中事件。
 

Additional Inherited Members

- Public Attributes inherited from YSLib::Components::Control
std::function< IWidget *(const
KeyInput &)> 
BoundControlPtr
 按键-指针设备输入事件组映射。
 

Detailed Description

复选框。

Since
build 205

Definition at line 42 of file Selector.h.

Member Typedef Documentation

复选框选中事件委托类型。

Since
build 292

Definition at line 55 of file Selector.h.

复选框选中状态参数类型。

Note
bool 参数表示选中后的状态。
Since
build 292

Definition at line 50 of file Selector.h.

Constructor & Destructor Documentation

YSLib::Components::CheckBox::CheckBox ( const Rect = {})
explicit

构造:使用指定边界。

Since
build 337
YSLib::Components::CheckBox::CheckBox ( CheckBox &&  )
inlinedefault

Member Function Documentation

GEvent<void( HTickedEvent ::EventArgsType)>& YSLib::Components::CheckBox::GetTicked ( )
inline

复选框选中事件。

Since
build 292

Definition at line 82 of file Selector.h.

bool YSLib::Components::CheckBox::IsTicked ( ) const
inline

Definition at line 76 of file Selector.h.

void CheckBox::PaintBox ( const Graphics g,
const Rect r 
)
protected

绘制复选框。

Since
build 311

Definition at line 129 of file Selector.cpp.

References IsFocused(), YSLib::Components::IsFocusedByShell(), and YSL_BEGIN::RectDrawCheckBox().

Referenced by YSLib::Components::CheckButton::Refresh().

Here is the call graph for this function:

Here is the caller graph for this function:

void CheckBox::Refresh ( PaintEventArgs &&  e)
overridevirtual

刷新:按指定参数绘制界面并更新状态。

Since
build 311

Reimplemented from YSLib::Components::Widget.

Reimplemented in YSLib::Components::CheckButton.

Definition at line 136 of file Selector.cpp.

References YSLib::Components::GetSizeOf().

Here is the call graph for this function:

void CheckBox::SetTicked ( bool  b)

设置选中状态并检查复选框选中事件。

Note
若选中状态发生改变则引起复选框选中事件。
Since
build 292

Definition at line 113 of file Selector.cpp.

void CheckBox::Tick ( bool  b)

设置选中状态并触发复选框选中事件。

Note
不检查状态改变。
Since
build 307

Definition at line 123 of file Selector.cpp.

Member Data Documentation

bool YSLib::Components::CheckBox::bTicked
protected

Definition at line 58 of file Selector.h.

GEvent<void( HTickedEvent ::EventArgsType)> YSLib::Components::CheckBox::Ticked
private

复选框选中事件。

Since
build 292

Definition at line 65 of file Selector.h.


The documentation for this class was generated from the following files: