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

带滚动条的文本列表框。 More...

#include <ComboList.h>

Inheritance diagram for YSLib::Components::ListBox:
Collaboration diagram for YSLib::Components::ListBox:

Public Types

typedef TextList::ListType ListType
 
typedef TextList::ViewArgs ViewArgs
 
typedef TextList::HViewEvent HViewEvent
 
typedef TextList::IndexType IndexType
 
typedef TextList::ItemType ItemType
 
typedef
ystdex::subscriptive_iterator
< ListBox, IWidget
Iterator
 
- Public Types inherited from YSLib::Components::ScrollableContainer
typedef
ystdex::subscriptive_iterator
< ScrollableContainer, IWidget
Iterator
 

Public Member Functions

 ListBox (const Rect &={}, const shared_ptr< ListType > &={})
 
 ListBox (ListBox &&)=default
 
Iterator GetBegin ()
 
Iterator GetEnd ()
 
WidgetRange GetChildren () override
 
IWidgetoperator[] (size_t idx) ynoexcept
 
size_t GetChildrenCount () const ynothrow
 
bool IsSelected () const ynothrow
 
bool Contains (ListType::size_type i)
 
ListType::size_type GetHeadIndex () const ynothrow
 
ListType::size_type GetSelectedIndex () const ynothrow
 
ListTypeGetList () const ynothrow
 
GEvent< void(HViewEvent::EventArgsType)> & GetViewChanged () ynothrow
 视图变更事件。
 
GEvent< void(HIndexEvent::EventArgsType)> & GetSelected () ynothrow
 项目选择状态变更事件。
 
GEvent< void(HIndexEvent::EventArgsType)> & GetConfirmed () ynothrow
 项目选中确定事件。
 
void SetList (const shared_ptr< ListType > &_tempArgName)
 设置文本列表。
 
void SetSelected (ListType::size_type i)
 设置选中项。
 
void AdjustViewLength ()
 调整视图长度。
 
void ClearSelected ()
 清除选中项。
 
IndexType Find (const ItemType &text)
 查找项。
 
void ResetView ()
 
void ResizeForPreferred (const Size &sup, Size s={})
 按指定大小上限和内容调整大小。
 
void UpdateView ()
 
- Public Member Functions inherited from YSLib::Components::ScrollableContainer
 ScrollableContainer (const Rect &={})
 
 ScrollableContainer (ScrollableContainer &&)=default
 
Iterator GetBegin ()
 
Iterator GetEnd ()
 
WidgetRange GetChildren () override
 
IWidgetoperator[] (size_t idx) ynoexcept
 
size_t GetChildrenCount () 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
 取控制器。
 
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 ()
 

Protected Attributes

TextList lstText
 
- Protected Attributes inherited from YSLib::Components::ScrollableContainer
HorizontalScrollBar hsbHorizontal
 控制水平可视区域的水平滚动条。
 
VerticalScrollBar vsbVertical
 控制竖直可视区域的竖直滚动条。
 

Additional Inherited Members

- Public Attributes inherited from YSLib::Components::Control
std::function< IWidget *(const
KeyInput &)> 
BoundControlPtr
 按键-指针设备输入事件组映射。
 
- Protected Member Functions inherited from YSLib::Components::ScrollableContainer
Size FixLayout (const Size &)
 固定布局。
 

Detailed Description

带滚动条的文本列表框。

Since
build 205
Todo:
实现 Resize 事件调整内容布局。

Definition at line 45 of file ComboList.h.

Member Typedef Documentation

Since
build 316

Definition at line 52 of file ComboList.h.

Since
build 316

Definition at line 54 of file ComboList.h.

Constructor & Destructor Documentation

YSLib::Components::ListBox::ListBox ( const Rect = {},
const shared_ptr< ListType > &  = {} 
)
explicit
Since
build 337
YSLib::Components::ListBox::ListBox ( ListBox &&  )
inlinedefault

Member Function Documentation

void YSLib::Components::ListBox::AdjustViewLength ( )
inline

调整视图长度。

See Also
TextList::AdjustViewLength
Since
build 285

Definition at line 107 of file ComboList.h.

void YSLib::Components::ListBox::ClearSelected ( )
inline

清除选中项。

See Also
TextList::ClearSelected
Since
build 285

Definition at line 115 of file ComboList.h.

bool YSLib::Components::ListBox::Contains ( ListType::size_type  i)
inline

Definition at line 75 of file ComboList.h.

IndexType YSLib::Components::ListBox::Find ( const ItemType text)
inline

查找项。

See Also
TextList::Find
Since
build 316

Definition at line 123 of file ComboList.h.

Iterator YSLib::Components::ListBox::GetBegin ( )
inline
Since
build 357

Definition at line 72 of file ComboList.h.

WidgetRange YSLib::Components::ListBox::GetChildren ( )
inlineoverridevirtual
Since
build 357

Reimplemented from YSLib::Components::Widget.

Definition at line 72 of file ComboList.h.

size_t YSLib::Components::ListBox::GetChildrenCount ( ) const
inline

Definition at line 72 of file ComboList.h.

GEvent<void( HIndexEvent ::EventArgsType)>& YSLib::Components::ListBox::GetConfirmed ( )
inline

项目选中确定事件。

Definition at line 86 of file ComboList.h.

Iterator YSLib::Components::ListBox::GetEnd ( )
inline

Definition at line 72 of file ComboList.h.

ListType::size_type YSLib::Components::ListBox::GetHeadIndex ( ) const
inline

Definition at line 78 of file ComboList.h.

ListType& YSLib::Components::ListBox::GetList ( ) const
inline

Definition at line 81 of file ComboList.h.

Referenced by YSLib::Components::FileBox::GetPath().

Here is the caller graph for this function:

GEvent<void( HIndexEvent ::EventArgsType)>& YSLib::Components::ListBox::GetSelected ( )
inline

项目选择状态变更事件。

Definition at line 84 of file ComboList.h.

ListType::size_type YSLib::Components::ListBox::GetSelectedIndex ( ) const
inline

Definition at line 80 of file ComboList.h.

Referenced by YSLib::Components::FileBox::GetPath().

Here is the caller graph for this function:

GEvent<void( HViewEvent ::EventArgsType)>& YSLib::Components::ListBox::GetViewChanged ( )
inline

视图变更事件。

Definition at line 82 of file ComboList.h.

bool YSLib::Components::ListBox::IsSelected ( ) const
inline

Definition at line 74 of file ComboList.h.

Referenced by YSLib::Components::FileBox::GetPath().

Here is the caller graph for this function:

IWidget& YSLib::Components::ListBox::operator[] ( size_t  idx)
inline

Definition at line 72 of file ComboList.h.

void YSLib::Components::ListBox::ResetView ( )
inline

Definition at line 126 of file ComboList.h.

void ListBox::ResizeForPreferred ( const Size sup,
Size  s = {} 
)

按指定大小上限和内容调整大小。

Parameters
sup指定调整的大小的上限,当为 Size() 时忽略大小限制。
Note
s 指定大小,分量为 0 时对应分量大小由内容确定(其中宽度含边距)。
Since
build 337

Definition at line 90 of file ComboList.cpp.

References YSL_BEGIN::defMinScrollBarWidth(), YSLib::Drawing::GetHorizontalOf(), YSLib::Drawing::Size::Height, SetSizeOf(), YSLib::Drawing::Size::Width, and yunseq.

Here is the call graph for this function:

void YSLib::Components::ListBox::SetList ( const shared_ptr< ListType > &  _tempArgName)
inline

设置文本列表。

Since
build 292

Definition at line 93 of file ComboList.h.

void YSLib::Components::ListBox::SetSelected ( ListType::size_type  i)
inline

设置选中项。

See Also
TextList::SetSelected
Since
build 285。

Definition at line 99 of file ComboList.h.

void YSLib::Components::ListBox::UpdateView ( )
inline

Definition at line 138 of file ComboList.h.

Referenced by YSLib::Components::FileBox::SetPath().

Here is the caller graph for this function:

Member Data Documentation

TextList YSLib::Components::ListBox::lstText
protected

Definition at line 63 of file ComboList.h.


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