YSTest
PreAlpha_b380_20130211
The YSLib Test Project
|
文本列表。 More...
#include <textlist.h>
Public Types | |
typedef GSequenceViewer< ListType > | ViewerType |
视图类型。 | |
typedef GValueEventArgs< bool > | ViewArgs |
视图参数类型。 | |
typedef GHEvent< void(ViewArgs)> | HViewEvent |
视图事件委托类型。 | |
typedef String | ItemType |
项目类型:字符串。 | |
typedef vector< ItemType > | ListType |
列表类型。 | |
typedef ListType::size_type | IndexType |
索引类型。 | |
Public Member Functions | |
TextList (const Rect &={}, const shared_ptr< ListType > &={}, pair< Color, Color >=FetchGUIState().Colors.GetPair(Styles::Highlight, Styles::HighlightText)) | |
构造:使用指定边界、文本列表和高亮背景色/文本色对。 | |
TextList (TextList &&)=default | |
bool | IsSelected () const ynothrow |
bool | Contains (ListType::size_type i) |
GEvent< void(HViewEvent::EventArgsType)> & | GetViewChanged () ynothrow |
视图变更事件。 | |
GEvent< void(HIndexEvent::EventArgsType)> & | GetSelected () ynothrow |
项目选择状态变更事件。 | |
GEvent< void(HIndexEvent::EventArgsType)> & | GetConfirmed () ynothrow |
项目选中确定事件。 | |
ListType::size_type | GetHeadIndex () const ynothrow |
ListType::size_type | GetSelectedIndex () const ynothrow |
SDst | GetFullViewHeight () const |
取完整视图高。 | |
SDst | GetViewPosition () const |
取视图顶端竖直位置。 | |
void | SetList (const shared_ptr< ListType > &) |
设置文本列表。 | |
void | SetSelected (ListType::size_type) |
按指定项目索引设置选中项目。 | |
void | SetSelected (SPos, SPos) |
按接触点设置选中项目。 | |
void | SetSelected (const Point &pt) |
按接触点设置选中项目。 | |
void | AdjustViewLength () |
调整视图长度。 | |
virtual bool | CheckConfirmed (ListType::size_type) const |
检查列表中的指定项是否有效。 | |
ListType::size_type | CheckPoint (SPos, SPos) |
检查点(相对于所在缓冲区的控件坐标)是否在选择范围内, | |
ListType::size_type | CheckPoint (const Point &pt) |
检查点(相对于所在缓冲区的控件坐标)是否在选择范围内, | |
void | ClearSelected () |
void | LocateViewPosition (SDst) |
定位视图顶端至指定竖直位置。 | |
void | Refresh (PaintEventArgs &&) override |
刷新:按指定参数绘制界面并更新状态。 | |
void | ResetView () |
复位视图。 | |
void | SelectFirst () |
选择第一个项目。 | |
void | SelectLast () |
选择最后一个项目。 | |
void | UpdateView (bool is_active=false, bool need_invalidation=true) |
更新视图。 | |
![]() | |
Control (const Rect &={}) | |
构造:使用指定边界,默认背景(同 Widget 默认构造)。 | |
Control (const Rect &, NoBackgroundTag) | |
构造:使用指定边界,无背景。 | |
Control (const Control &) | |
复制构造:除容器为空外深复制。 | |
Control (Control &&)=default | |
virtual IWidget * | GetBoundControlPtr (const KeyInput &) |
取按键-指针设备输入默认事件组映射。 | |
void | OnTouch_Close (TouchEventArgs &&) |
处理屏幕事件:关闭显示。 | |
![]() | |
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 Renderer & | GetRenderer () const ynothrow |
取渲染器。 | |
virtual View & | GetView () const ynothrow |
取部件视图。 | |
virtual AController & | GetController () 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 | ~IWidget () |
Public Attributes | |
Color | HilightBackColor |
高亮背景色。 | |
Color | HilightTextColor |
高亮文本色。 | |
bool | CyclicTraverse |
循环选择遍历。 | |
![]() | |
std::function< IWidget *(const KeyInput &)> | BoundControlPtr |
按键-指针设备输入事件组映射。 | |
![]() | |
HBrush | Background |
背景。 | |
Color | ForeColor |
默认前景色。 | |
Protected Member Functions | |
void | InvalidateSelected (ListType::difference_type offset, ListType::size_type diff=1) |
无效化偏移量对应的列表项区域。 | |
void | InvalidateSelected2 (ListType::difference_type, ListType::difference_type) |
无效化偏移量对应的列表项区域。 | |
virtual void | DrawItem (const Graphics &, const Rect &mask, const Rect &, ListType::size_type) |
绘制列表项。 | |
virtual void | DrawItemBackground (const PaintContext &, const Rect &r) |
描画列表项背景。 | |
virtual void | DrawItems (const PaintContext &) |
绘制列表。 | |
![]() | |
ListType & | GetList () const ynothrow |
取文本列表。 | |
ItemType * | GetItemPtr (IndexType) const |
取指定项目索引的项目指针。 | |
SDst | GetItemHeight () const ynothrow |
取项目行高。 | |
SDst | GetMaxTextWidth () const |
取文本列表中的最大文本宽度。 | |
void | SetList (const shared_ptr< ListType > &h) |
设置文本列表。 | |
IndexType | Find (const ItemType &) const |
查找项。 | |
void | RefreshTextState () |
刷新文本状态。 | |
MTextList (const shared_ptr< ListType > &={}, const Drawing::Font &={}) | |
构造:使用文本列表句柄和字体指针。 | |
MTextList (MTextList &&)=default | |
Private Member Functions | |
SDst | AdjustOffset (bool) |
调整列表视图底项目的竖直偏移量为零。 | |
void | CallSelected () |
调用选中事件处理器。 | |
void | InvokeConfirmed (ListType::size_type) |
检查和调用确认事件处理器。 | |
Private Attributes | |
ViewerType | viewer |
列表视图。 | |
SDst | top_offset |
列表视图首项目超出上边界的竖直偏移量。 | |
GEvent< void(HViewEvent::EventArgsType)> | ViewChanged |
视图变更事件。 | |
GEvent< void(HIndexEvent::EventArgsType)> | Selected |
项目选择状态变更事件。 | |
GEvent< void(HIndexEvent::EventArgsType)> | Confirmed |
项目选中确认事件。 | |
Additional Inherited Members | |
![]() | |
typedef String | ItemType |
项目类型:字符串。 | |
typedef vector< ItemType > | ListType |
列表类型。 | |
typedef ListType::size_type | IndexType |
索引类型。 | |
![]() | |
Drawing::Font | Font |
字体。 | |
Drawing::Padding | Margin |
文本和容器的间距。 | |
TextAlignment | HorizontalAlignment |
文本水平和竖直对齐属性。 | |
TextAlignment | VerticalAlignment |
bool | AutoWrapLine |
启用自动换行。 | |
String | Text |
标签文本。 | |
typedef GHEvent<void( ViewArgs )> YSLib::Components::TextList::HViewEvent |
typedef ListType::size_type YSLib::Components::MTextList::IndexType |
typedef String YSLib::Components::MTextList::ItemType |
typedef vector<ItemType> YSLib::Components::MTextList::ListType |
typedef GValueEventArgs<bool> YSLib::Components::TextList::ViewArgs |
视图类型。
Definition at line 57 of file textlist.h.
|
explicit |
构造:使用指定边界、文本列表和高亮背景色/文本色对。
|
inlinedefault |
|
private |
调整列表视图底项目的竖直偏移量为零。
GetItemHeight()
) )。 top_offset == 0
。 参数为 true
时,调整列表视图底项目(可能不完全)超出下边界以上的竖直 偏移量为零;否则,调整列表视图首项目(可能不完全)超出上边界以上的竖直偏移量为零。
Definition at line 181 of file textlist.cpp.
void TextList::AdjustViewLength | ( | ) |
调整视图长度。
Definition at line 215 of file textlist.cpp.
|
private |
调用选中事件处理器。
Definition at line 398 of file textlist.cpp.
|
virtual |
检查列表中的指定项是否有效。
Reimplemented in YSLib::Components::Menu.
Definition at line 228 of file textlist.cpp.
ListType::size_type YSLib::Components::TextList::CheckPoint | ( | SPos | , |
SPos | |||
) |
检查点(相对于所在缓冲区的控件坐标)是否在选择范围内,
|
inline |
检查点(相对于所在缓冲区的控件坐标)是否在选择范围内,
Definition at line 210 of file textlist.h.
References YSLib::Drawing::GBinaryGroup< _type >::X, and YSLib::Drawing::GBinaryGroup< _type >::Y.
|
inline |
Definition at line 215 of file textlist.h.
|
inline |
Definition at line 113 of file textlist.h.
|
protectedvirtual |
绘制列表项。
Reimplemented in YSLib::Components::Menu.
Definition at line 286 of file textlist.cpp.
References YSLib::Drawing::DrawClippedText().
|
protectedvirtual |
描画列表项背景。
r | 列表项有效区域边界。 |
Definition at line 293 of file textlist.cpp.
References YSLib::Drawing::PaintContext::ClipArea, YSLib::Drawing::Graphics::GetBufferPtr(), YSLib::Drawing::Graphics::GetSize(), YSLib::Drawing::Size::Height, YSLib::Drawing::PaintContext::Target, YSLib::Drawing::Size::Width, YSLib::Drawing::GBinaryGroup< _type >::X, and YSLib::Drawing::GBinaryGroup< _type >::Y.
|
protectedvirtual |
绘制列表。
Definition at line 301 of file textlist.cpp.
References YSLib::Drawing::AdjustEndOfLine(), YSLib::Drawing::PaintContext::ClipArea, YSLib::Drawing::Rect::GetPoint(), YSLib::Drawing::Size::Height, YSLib::Drawing::PaintContext::Location, YSLib::Drawing::PaintContext::Target, YSLib::Drawing::GBinaryGroup< _type >::Y, and yunseq.
|
inline |
项目选中确定事件。
Definition at line 120 of file textlist.h.
SDst TextList::GetFullViewHeight | ( | ) | const |
|
inline |
Definition at line 123 of file textlist.h.
|
inline |
项目选择状态变更事件。
Definition at line 118 of file textlist.h.
|
inline |
Definition at line 128 of file textlist.h.
|
inline |
视图变更事件。
Definition at line 116 of file textlist.h.
SDst TextList::GetViewPosition | ( | ) | const |
|
protected |
无效化偏移量对应的列表项区域。
offset | 起始偏移量。 |
diff | 终止偏移量相对于起始偏移量的距离偏移量。 |
Definition at line 241 of file textlist.cpp.
References YSLib::Drawing::Size::Height, YSLib::Components::Invalidate(), YSLib::RestrictUnsignedStrict(), and YSLib::Drawing::GBinaryGroup< _type >::Y.
|
protected |
无效化偏移量对应的列表项区域。
Definition at line 259 of file textlist.cpp.
References YSLib::IO::swap().
|
private |
检查和调用确认事件处理器。
Definition at line 404 of file textlist.cpp.
|
inline |
Definition at line 112 of file textlist.h.
void TextList::LocateViewPosition | ( | SDst | h | ) |
定位视图顶端至指定竖直位置。
Definition at line 268 of file textlist.cpp.
References YSLib::RestrictInInterval().
|
overridevirtual |
刷新:按指定参数绘制界面并更新状态。
Reimplemented from YSLib::Components::Widget.
Definition at line 356 of file textlist.cpp.
References YSLib::Components::GetSizeOf().
void TextList::ResetView | ( | ) |
void TextList::SelectFirst | ( | ) |
void TextList::SelectLast | ( | ) |
void TextList::SetList | ( | const shared_ptr< ListType > & | h | ) |
void YSLib::Components::TextList::SetSelected | ( | ListType::size_type | ) |
按指定项目索引设置选中项目。
void YSLib::Components::TextList::SetSelected | ( | SPos | , |
SPos | |||
) |
按接触点设置选中项目。
|
inline |
按接触点设置选中项目。
Definition at line 163 of file textlist.h.
void TextList::UpdateView | ( | bool | is_active = false , |
bool | need_invalidation = true |
||
) |
更新视图。
is_active | 是否确定仅变更视图位置。 |
need_invalidation | 更新后无效化自身。 |
调用视图变更事件并调整视图长度。
Definition at line 389 of file textlist.cpp.
References YSLib::Components::Invalidate().
|
private |
bool YSLib::Components::TextList::CyclicTraverse |
循环选择遍历。
Definition at line 77 of file textlist.h.
Color YSLib::Components::TextList::HilightBackColor |
高亮背景色。
Definition at line 75 of file textlist.h.
Color YSLib::Components::TextList::HilightTextColor |
高亮文本色。
Definition at line 76 of file textlist.h.
|
private |
|
private |
列表视图首项目超出上边界的竖直偏移量。
Definition at line 81 of file textlist.h.
|
private |
|
private |
列表视图。
Definition at line 80 of file textlist.h.