28 #ifndef YSL_INC_UI_viewer_hpp_
29 #define YSL_INC_UI_viewer_hpp_ 1
32 #include YFM_YSLib_UI_YComponent
59 static_assert(std::is_unsigned<SizeType>::value,
60 "Invalid size type found!");
62 static_assert(std::is_signed<DifferenceType>::value,
63 "Invalid difference type found!");
92 PDefHOp(GSequenceViewer&, ++,
int) \
95 PDefHOp(GSequenceViewer&, --,
int) \
110 return GetTotal() != 0 && GetLength() != 0
111 && IsInInterval<SizeType>(i - GetHeadIndex(), GetLength());
120 ? GetSelectedIndex() - GetHeadIndex() : -1) \
142 if(t < GetTotal() && t !=
head)
146 else if(
length + t > GetTotal())
193 const auto total(GetTotal());
199 return RestrictView();
typename _tCon::difference_type DifferenceType
项目索引差值类型。
#define DefPred(_q, _n,...)
PDefHOp(GSequenceViewer &,++,) ImplRet(IncreaseSelected(1)) PDefHOp(GSequenceViewer &
ImplRet(IncreaseSelected(-1)) PDefHOp(GSequenceViewer &
< 选中项目的索引自减。
bool SetSelectedIndex(SizeType t)
设置选中项目的索引。
bool SetHeadIndex(SizeType t)
设置视图中首个项目的索引。
SizeType head
视图中首个项目的索引,大于等于 GetTotal() 时无效。
length selected min(GetTotal()-GetHeadIndex(), GetLength())) void SetContainer(ContainerType &con)
< 取当前视图中有效项目个数。
PDefH(void, Activate, Console &console, Drawing::Color fc=Drawing::ColorSpace::White) ImplExpr(Activate(console
激活:使用指定屏幕、有效性、前景色和默认背景色。
#define yunseq
无序列依赖表达式组求值。
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
SizeType selected
选中项目的索引,大于等于 GetTotal() 时无效。
bool AdjustForContent()
按序列内容大小依次调整选中和首个项目的索引。
typename _tCon::size_type SizeType
项目索引类型。
GSequenceViewer(ContainerType &con)
构造:使用指定容器。
auto total(size_t n, _fNow now, _fCallable &&f, _tParams &&...args) -> decltype(now()-now())
测试指定函数执行若干次的总时间。
unsigned long Reset(COMPtr< _iCOM > &ptr) ynothrow
void RestrictInInterval(_type &i, int a, int b) ynothrow
约束整数 i 在左闭右开区间 [a, b) 中。
bool SetLength(SizeType l)
设置长度。
SizeType length
视图长度:最大可视项目数。
int int is_selected bool Contains(SizeType i) const
判断是否在有效范围内包含指定项目索引。
DefGetter(const ynothrow, SizeType, Total, p_con->size()) DefGetter(const ynothrow