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

部件。 More...

#include <ywidget.h>

Inheritance diagram for YSLib::Components::Widget:
Collaboration diagram for YSLib::Components::Widget:

Classes

struct  NoBackgroundTag
 无背景标记。 More...
 

Public Member Functions

 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 > &&)
 设置渲染器为指定指针指向的对象,同时更新渲染器状态。
 
virtual void Refresh (PaintEventArgs &&)
 刷新:按指定参数绘制界面并更新状态。
 
- Public Member Functions inherited from YSLib::Components::IWidget
virtual ~IWidget ()
 

Public Attributes

HBrush Background
 背景。
 
Color ForeColor
 默认前景色。
 

Private Member Functions

void InitializeEvents ()
 初始化事件组。
 

Private Attributes

unique_ptr< Viewview_ptr
 部件视图指针。
 
unique_ptr< Rendererrenderer_ptr
 渲染器指针。
 
unique_ptr< AControllercontroller_ptr
 控制器指针。
 

Detailed Description

部件。

Since
早于 build 132

Definition at line 321 of file ywidget.h.

Constructor & Destructor Documentation

YSLib::Components::Widget::Widget ( const Rect = {},
Color  = Drawing::ColorSpace::White,
Color  = Drawing::ColorSpace::Black 
)
explicit
Since
build 337
template<typename _tView , typename _tRenderer , typename _tController >
YSLib::Components::Widget::Widget ( _tView &&  pView_ = make_unique<View>(),
_tRenderer &&  pRenderer_ = make_unique<Renderer>(),
_tController &&  pController_ = {} 
)
inlineexplicit

构造:使用视图指针、渲染器指针和控制器指针,无背景。

Parameters
pView_视图指针。
pRenderer_渲染器指针。
pController_控制器指针。
Precondition
bool(pView_) && bool(pRenderer_)

Definition at line 360 of file ywidget.h.

YSLib::Components::Widget::Widget ( const Widget )

复制构造:除容器指针为空外深复制。

YSLib::Components::Widget::Widget ( Widget &&  )
default
Widget::~Widget ( )
virtual

析构:虚实现。

自动释放焦点后释放部件资源。

Note
由于不完整类型 WidgetController 的依赖性无法使用 inline 实现。

Definition at line 174 of file ywidget.cpp.

References DoReleaseFocus().

Here is the call graph for this function:

Member Function Documentation

virtual WidgetRange YSLib::Components::Widget::GetChildren ( )
inlineoverridevirtual
AController & Widget::GetController ( ) const
overridevirtual

取控制器。

Implements YSLib::Components::IWidget.

Definition at line 187 of file ywidget.cpp.

SDst YSLib::Components::Widget::GetHeight ( ) const
inline

Definition at line 397 of file ywidget.h.

Referenced by YSLib::Components::ScrollableContainer::FixLayout(), and YSLib::Components::DropDownList::Refresh().

Here is the caller graph for this function:

virtual Renderer& YSLib::Components::Widget::GetRenderer ( ) const
inlinevirtual

取渲染器。

Implements YSLib::Components::IWidget.

Definition at line 398 of file ywidget.h.

virtual View& YSLib::Components::Widget::GetView ( ) const
inlinevirtual

取部件视图。

Warning
注意修改容器指针或焦点指针时,应保持和容器包含部件的状态同步。

Implements YSLib::Components::IWidget.

Definition at line 399 of file ywidget.h.

SDst YSLib::Components::Widget::GetWidth ( ) const
inline

Definition at line 396 of file ywidget.h.

Referenced by YSLib::Components::ScrollableContainer::FixLayout(), YSLib::Components::DropDownList::Refresh(), and DualScreenReader::Stretch().

Here is the caller graph for this function:

SPos YSLib::Components::Widget::GetX ( ) const
inline

Definition at line 394 of file ywidget.h.

SPos YSLib::Components::Widget::GetY ( ) const
inline

Definition at line 395 of file ywidget.h.

void Widget::InitializeEvents ( )
private

初始化事件组。

Since
build 294

Definition at line 180 of file ywidget.cpp.

References YSLib::Components::BackgroundPriority().

Here is the call graph for this function:

void Widget::Refresh ( PaintEventArgs &&  e)
virtual

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

See Also
PaintContext 。
Note
默认按 GetChildren() 得到的迭代器范围绘制可见子部件。
Since
build 294

由参数指定的信息绘制事件发送者。参数的 ClipArea 成员指定边界。 边界仅为暗示,允许实现忽略,但应保证调用后边界内的区域保持最新显示状态。 绘制结束后更新边界,表示实际被绘制的区域。 若部件的内部状态能够保证显示状态最新,则返回的区域可能比传入时表示的范围更小。

Reimplemented in YSLib::Components::TextList, YSLib::Components::DropDownList, YSLib::Components::CheckButton, YSLib::Components::Button, YSLib::Components::Label, YSLib::Components::CheckBox, YSLib::Components::Panel, YSLib::Components::BufferedTextArea, and YSLib::Components::ProgressBar.

Definition at line 208 of file ywidget.cpp.

References YSLib::Components::IsVisible(), and YSLib::Components::PaintChild().

Here is the call graph for this function:

void YSLib::Components::Widget::SetHeight ( SDst  _tempArgName)
inline

Definition at line 408 of file ywidget.h.

void Widget::SetRenderer ( unique_ptr< Renderer > &&  p)

设置渲染器为指定指针指向的对象,同时更新渲染器状态。

Note
若指针为空,则使用以当前部件边界新建的 Renderer 对象。
取得指定对象的所有权。

Definition at line 195 of file ywidget.cpp.

References YSLib::Components::GetSizeOf().

Here is the call graph for this function:

void Widget::SetView ( unique_ptr< View > &&  p)

设置渲染器为指定指针指向的对象,同时更新渲染器状态。

Note
若指针为空,则使用以当前部件边界新建的 View 对象。
取得指定对象的所有权。

Definition at line 201 of file ywidget.cpp.

References YSLib::Components::GetBoundsOf().

Here is the call graph for this function:

void YSLib::Components::Widget::SetWidth ( SDst  _tempArgName)
inline

Definition at line 407 of file ywidget.h.

void YSLib::Components::Widget::SetX ( SDst  _tempArgName)
inline

Definition at line 405 of file ywidget.h.

void YSLib::Components::Widget::SetY ( SDst  _tempArgName)
inline

Definition at line 406 of file ywidget.h.

Member Data Documentation

HBrush YSLib::Components::Widget::Background
mutable

背景。

Since
build 294

Definition at line 344 of file ywidget.h.

unique_ptr<AController> YSLib::Components::Widget::controller_ptr
private

控制器指针。

Definition at line 336 of file ywidget.h.

Color YSLib::Components::Widget::ForeColor

默认前景色。

Definition at line 345 of file ywidget.h.

Referenced by YSLib::Components::CheckButton::Refresh(), and YSLib::Components::DropDownList::Refresh().

unique_ptr<Renderer> YSLib::Components::Widget::renderer_ptr
private

渲染器指针。

Definition at line 335 of file ywidget.h.

unique_ptr<View> YSLib::Components::Widget::view_ptr
private

部件视图指针。

Since
build 346

Definition at line 334 of file ywidget.h.


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