YSTest: Scroll.cpp 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

Scroll.cpp
浏览该文件的文档.
1 /*
2 © 2011-2016 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #include "YSLib/UI/YModules.h"
29 #include YFM_YSLib_UI_Scroll
30 #include YFM_YSLib_UI_YGUI
31 #include YFM_YSLib_Core_YStorage
32
33 using namespace ystdex;
34
35 namespace YSLib
36 {
37
38 namespace UI
39 {
40
41 ImplDeDtor(ScrollEventArgs)
42
43 namespace
44 {
45
46 pair<bool, bool>
47 FixScrollBarLayout(Size& d, const Size& s, SDst min_width, SDst min_height)
48 {
49 bool need_h(d.Width < s.Width), need_v(d.Height < s.Height);
50
51 if(need_h)
52 {
53 if(d.Height < min_height)
54 throw GeneralEvent("Scroll bar need more height.");
55 d.Height -= min_height;
56 }
57 if(need_v)
58 {
59 if(d.Width < min_width)
60 throw GeneralEvent("Scroll bar need more width.");
61 d.Width -= min_width;
62 }
63 if(need_h != need_v)
64 {
65 if(!need_h && d.Width < s.Width)
66 {
67 need_h = true;
68 if(d.Height < min_height)
69 throw GeneralEvent("Scroll bar need more height.");
70 d.Height -= min_height;
71 }
72 if(!need_v && d.Height < s.Height)
73 {
74 need_v = true;
75 if(d.Width < min_width)
76 throw GeneralEvent("Scroll bar need more width.");
77 d.Width -= min_width;
78 }
79 }
80 return pair<bool, bool>(need_h, need_v);
81 }
82
83 const SDst defMinScrollBarWidth(16);
84 const SDst defMinScrollBarHeight(16);
85
86 } //unnamed namespace;
87
88
89 ATrack::ATrack(const Rect& r, SDst uMinThumbLength)
90 : Control({r.GetPoint(), max<SDst>(defMinScrollBarWidth, r.Width),
91 max<SDst>(defMinScrollBarHeight, r.Height)}),
92 GMRange<ValueType>(0xFF, 0),
93 tmbScroll(Size(defMinScrollBarWidth, defMinScrollBarHeight)),
94 min_thumb_length(uMinThumbLength), large_delta(min_thumb_length)
95 {
96 SetContainerPtrOf(tmbScroll, make_observer(this));
97 yunseq(
98 Background = ystdex::bind1(DrawTrackBackground, std::ref(*this)),
99 ThumbDrag += [this]{
100 LocateThumb(0, ScrollCategory::ThumbTrack);
101 },
102 FetchEvent<TouchHeld>(*this) += OnTouchHeld,
103 FetchEvent<TouchDown>(*this) += [this](CursorEventArgs&& e){
104 if(e.Strategy == RoutedEventArgs::Direct && &e.GetSender() == this
105 && Rect(GetSizeOf(*this)).Contains(e))
106 {
107 ScrollCategory t;
108
109 switch(CheckArea(e.Position.GetRef(IsHorizontal())))
110 {
111 case OnPrev:
112 t = ScrollCategory::LargeDecrement;
113 break;
114 case OnNext:
115 t = ScrollCategory::LargeIncrement;
116 break;
117 case None:
118 return;
119 default:
120 t = ScrollCategory::EndScroll;
121 }
122 LocateThumb(0, t);
123 }
124 }
125 );
126 }
127
128 void
129 ATrack::SetThumbLength(SDst l)
130 {
131 RestrictInInterval(l, min_thumb_length, GetTrackLength());
132
133 Size s(GetSizeOf(tmbScroll));
134 const bool is_h(IsHorizontal());
135
136 if(l != s.GetRef(is_h))
137 {
138 Invalidate(tmbScroll);
139 s.GetRef(is_h) = l;
140 SetSizeOf(tmbScroll, s);
141 }
142 }
143 void
144 ATrack::SetThumbPosition(SPos pos)
145 {
146 // XXX: Conversion to 'SPos' might be implementation-defined.
147 RestrictInClosedInterval<SPos>(pos, 0, SPos(GetScrollableLength()));
148
149 Point pt(GetLocationOf(tmbScroll));
150 const bool is_h(IsHorizontal());
151
152 if(pos != pt.GetRef(is_h))
153 {
154 Invalidate(tmbScroll);
155 pt.GetRef(is_h) = pos;
156 SetLocationOf(tmbScroll, pt);
157 }
158 }
159 void
160 ATrack::SetMaxValue(ValueType m)
161 {
162 if(m > 0)
163 {
164 if(large_delta > m)
165 large_delta = m;
166 max_value = m;
167 }
168 }
169 void
170 ATrack::SetValue(ValueType val)
171 {
172 value = val;
173 SetThumbPosition(SPos(round(val * GetScrollableLength() / max_value)));
174 }
175 void
176 ATrack::SetLargeDelta(ValueType val)
177 {
178 large_delta = val;
179 SetThumbLength(SDst(round(val * GetTrackLength() / (val + max_value))));
180 }
181
182 ATrack::Area
183 ATrack::CheckArea(SPos q) const
184 {
185 if(q >= 0)
186 {
187 yconstexpr const Area lst[]{OnPrev, OnThumb, OnNext};
188 const SPos a[]{SPos(), SPos(GetThumbPosition()),
189 SPos(GetThumbPosition() + SPos(GetThumbLength()))};
190 const auto n(SwitchInterval(q, a, 3));
191
192 if(n < 3)
193 return lst[n];
194 }
195 return None;
196 }
197
198 void
199 ATrack::LocateThumb(ValueType val, ScrollCategory t)
200 {
201 ValueType old_value(value);
202
203 if(t == ScrollCategory::ThumbTrack)
204 // XXX: Conversion to 'SPos' might be implementation-defined.
205 value = GetThumbPosition() == SPos(GetScrollableLength()) ? max_value
206 : max_value * GetThumbPosition()
207 / (GetTrackLength() - GetThumbLength());
208 else
209 {
210 if(t == ScrollCategory::LargeDecrement
211 || t == ScrollCategory::LargeIncrement)
212 val = GetLargeDelta();
213 switch(t)
214 {
215 case ScrollCategory::SmallDecrement:
216 case ScrollCategory::LargeDecrement:
217 if(value > val)
218 {
219 SetValue(value - val);
220 break;
221 }
222 case ScrollCategory::First:
223 value = 0;
224 SetThumbPosition(0);
225 break;
226 case ScrollCategory::SmallIncrement:
227 case ScrollCategory::LargeIncrement:
228 if(value + val < max_value)
229 {
230 SetValue(value + val);
231 break;
232 }
233 case ScrollCategory::Last:
234 value = max_value;
235 // XXX: Conversion to 'SPos' might be implementation-defined.
236 SetThumbPosition(SPos(GetScrollableLength()));
237 default:
238 ;
239 }
240 }
241 Scroll(ScrollEventArgs(*this, t, value, old_value));
242 }
243
244
245 void
246 DrawTrackBackground(PaintEventArgs&& e, ATrack& trk)
247 {
248 const auto& g(e.Target);
249 const auto& pt(e.Location);
250 const Rect& bounds(Rect(pt, GetSizeOf(trk)) & e.ClipArea);
251 auto& pal(FetchGUIConfiguration().Colors);
252
253 FillRect(g, bounds, pal[Styles::Track]);
254
255 #define YSL_UI_Impl_ATrack_Partial_Invalidation 1
256 // NOTE: Partial invalidation made no efficiency improved here.
257 const auto c(pal[Styles::Light]);
258 #if YSL_UI_Impl_ATrack_Partial_Invalidation
259 SPos x(pt.X);
260 SPos y(pt.Y);
261 // XXX: Conversion to 'SPos' might be implementation-defined.
262 SPos xr(x + SPos(trk.GetWidth()));
263 SPos yr(y + SPos(trk.GetHeight()));
264 #else
265 const SPos xr(pt.X + trk.GetWidth());
266 const SPos yr(pt.Y + trk.GetHeight());
267 #endif
268
269 if(trk.IsHorizontal())
270 {
271 #if YSL_UI_Impl_ATrack_Partial_Invalidation
272 RestrictInInterval(y, bounds.Y, bounds.GetBottom()),
273 RestrictInInterval(yr, bounds.Y, bounds.GetBottom());
274 #endif
275 DrawHLineSeg(g, bounds, pt.Y, pt.X, xr, c),
276 DrawHLineSeg(g, bounds, yr, pt.X, xr, c);
277 }
278 else
279 {
280 #if YSL_UI_Impl_ATrack_Partial_Invalidation
281 RestrictInInterval(x, bounds.X, bounds.GetRight()),
282 RestrictInInterval(xr, bounds.X, bounds.GetRight());
283 #endif
284 DrawVLineSeg(g, bounds, pt.X, pt.Y, yr, c),
285 DrawVLineSeg(g, bounds, xr, pt.Y, yr, c);
286 }
287 }
288
289
290 HorizontalTrack::HorizontalTrack(const Rect& r, SDst uMinThumbLength)
291 : ATrack(r, uMinThumbLength)
292 {
293 YAssert(GetWidth() > GetHeight(), "Width is not greater than height.");
294 FetchEvent<TouchHeld>(tmbScroll) += [this](CursorEventArgs&& e){
295 if(e.Strategy == RoutedEventArgs::Direct)
296 {
297 auto& st(FetchGUIState());
298
299 if(st.CheckDraggingOffset())
300 {
301 SPos x(st.CursorLocation.X + st.DraggingOffset.X);
302
303 // XXX: Conversion to 'SPos' might be implementation-defined.
304 RestrictInClosedInterval<SPos>(x, 0,
305 SPos(GetWidth()) - SPos(tmbScroll.GetWidth()));
306 Invalidate(tmbScroll);
307 SetLocationOf(tmbScroll, Point(x, GetLocationOf(tmbScroll).Y));
308 ThumbDrag(UIEventArgs(*this));
309 }
310 }
311 };
312 }
313 ImplDeDtor(HorizontalTrack)
314
315
316 VerticalTrack::VerticalTrack(const Rect& r, SDst uMinThumbLength)
317 : ATrack(r, uMinThumbLength)
318 {
319 YAssert(GetHeight() > GetWidth(), "height is not greater than width.");
320 FetchEvent<TouchHeld>(tmbScroll) += [this](CursorEventArgs&& e){
321 if(e.Strategy == RoutedEventArgs::Direct)
322 {
323 auto& st(FetchGUIState());
324
325 if(st.CheckDraggingOffset())
326 {
327 SPos y(st.CursorLocation.Y + st.DraggingOffset.Y);
328
329 // XXX: Conversion to 'SPos' might be implementation-defined.
330 RestrictInClosedInterval<SPos>(y, 0,
331 SPos(GetHeight()) - SPos(tmbScroll.GetHeight()));
332 Invalidate(tmbScroll);
333 SetLocationOf(tmbScroll, Point(GetLocationOf(tmbScroll).X, y));
334 ThumbDrag(UIEventArgs(*this));
335 }
336 }
337 };
338 }
339 ImplDeDtor(VerticalTrack)
340
341
342 ScrollBar::ScrollBar(const Rect& r, Orientation o, SDst min_thumb)
343 : Control(r),
344 // XXX: Conversion to 'SPos' might be implementation-defined.
345 pTrack(o == Horizontal ? static_cast<ATrack*>(new
346 HorizontalTrack(Rect(SPos(r.Height), 0, r.Width - r.Height * 2, r.Height),
347 min_thumb)) : static_cast<ATrack*>(new VerticalTrack(Rect(0, SPos(r.Width),
348 r.Width, r.Height - r.Width * 2), min_thumb))),
349 btnPrev(Rect()), btnNext(Rect()), small_delta(2)
350 {
351 SetContainerPtrOf(*pTrack, make_observer(this)),
352 SetContainerPtrOf(btnPrev, make_observer(this));
353 SetContainerPtrOf(btnNext, make_observer(this));
354 yunseq(
355 FetchEvent<Resize>(*this) += [this](UIEventArgs&& e){
356 auto& track(GetTrackRef());
357 const bool is_h(track.IsHorizontal());
358 const SDst prev_metric(GetSizeOf(btnPrev).GetRef(is_h));
359 const SDst sum(prev_metric + GetSizeOf(btnNext).GetRef(is_h));
360
361 YAssert(GetSizeOf(e.GetSender()).GetRef(is_h) - sum > 0,
362 "No enough space for track.");
363
364 const SDst tl(GetSizeOf(e.GetSender()).GetRef(is_h) - sum);
365 auto pt(GetLocationOf(btnNext));
366 Size s(GetSizeOf(track));
367
368 // XXX: Conversion to 'SPos' might be implementation-defined.
369 yunseq(pt.GetRef(is_h) = SPos(tl + prev_metric), s.GetRef(is_h) = tl);
370 btnNext.GetView().SetLocation(pt), track.GetView().SetSize(s);
371 // NOTE: No event %(Resize, Move) is raised.
372 },
373 FetchEvent<KeyUp>(*this) += OnKey_Bound_TouchUp,
374 FetchEvent<KeyDown>(*this) += OnKey_Bound_TouchDown,
375 FetchEvent<KeyHeld>(*this) += OnKeyHeld,
376 FetchEvent<CursorWheel>(*this) += [this](CursorWheelEventArgs&& e){
377 if(e.GetDelta() > 0)
378 LocateThumb(small_delta, ScrollCategory::SmallDecrement);
379 else if(e.GetDelta() < 0)
380 LocateThumb(small_delta, ScrollCategory::SmallIncrement);
381 },
382 FetchEvent<TouchHeld>(btnPrev) += OnTouchHeld,
383 FetchEvent<TouchDown>(btnPrev) += [this]{
384 LocateThumb(small_delta, ScrollCategory::SmallDecrement);
385 },
386 FetchEvent<TouchHeld>(btnNext) += OnTouchHeld,
387 FetchEvent<TouchDown>(btnNext) += [this]{
388 LocateThumb(small_delta, ScrollCategory::SmallIncrement);
389 }
390 );
391
392 Size s(GetSizeOf(*this));
393 const bool bHorizontal(o == Horizontal);
394 const SDst l(s.GetRef(!bHorizontal));
395
396 s.GetRef(bHorizontal) = l;
397 SetSizeOf(btnPrev, s);
398 SetSizeOf(btnNext, s);
399 // Button.SetLocationOf(btnPrev, Point());
400 MoveToBottom(btnNext);
401 MoveToRight(btnNext);
402 if(o == Horizontal)
403 InitializeArrowPainters(RDeg180, RDeg0);
404 else
405 InitializeArrowPainters(RDeg90, RDeg270);
406 }
407
408 void
409 ScrollBar::InitializeArrowPainters(Rotation prev, Rotation next)
410 {
411 using namespace std;
412 using namespace placeholders;
413
414 yunseq(
415 FetchEvent<Paint>(btnPrev) += [this, prev](PaintEventArgs&& e){
416 DrawArrow(e.Target, e.ClipArea, {e.Location, GetSizeOf(btnPrev)}, 4,
417 prev, ForeColor);
418 },
419 FetchEvent<Paint>(btnNext) += [this, next](PaintEventArgs&& e){
420 DrawArrow(e.Target, e.ClipArea, {e.Location, GetSizeOf(btnNext)}, 4,
421 next, ForeColor);
422 }
423 );
424 }
425
426 observer_ptr<IWidget>
427 ScrollBar::GetBoundControlPtr(const KeyInput& k)
428 {
429 if(k.count() == 1)
430 {
431 if(GetOrientation() == Horizontal)
432 {
433 if(k[KeyCodes::Left])
434 return make_observer(&btnPrev);
435 if(k[KeyCodes::Right])
436 return make_observer(&btnNext);
437 }
438 else
439 {
440 if(k[KeyCodes::Up])
441 return make_observer(&btnPrev);
442 if(k[KeyCodes::Down])
443 return make_observer(&btnNext);
444 }
445 }
446 return {};
447 }
448
449
450 ScrollableContainer::ScrollableContainer(const Rect& r)
451 : Control(r, MakeBlankBrush()),
452 hsbHorizontal(Size(r.Width, defMinScrollBarHeight), Horizontal),
453 vsbVertical(Size(defMinScrollBarWidth, r.Height), Vertical)
454 {
455 // TODO: Allow user to choose whether background is drawn.
456 SetContainerPtrOf(hsbHorizontal, make_observer(this)),
457 SetContainerPtrOf(vsbVertical, make_observer(this)),
458 MoveToBottom(hsbHorizontal),
459 MoveToRight(vsbVertical),
460 FetchEvent<CursorWheel>(*this) += [this](CursorWheelEventArgs&& e){
461 if(IsVisible(vsbVertical))
462 CallEvent<CursorWheel>(vsbVertical, std::move(e));
463 };
464 }
465 ImplDeDtor(ScrollableContainer)
466
467 Size
468 ScrollableContainer::FixLayout(const Size& s)
469 {
470 Size arena(GetSizeOf(*this));
471
472 try
473 {
474 const pair<bool, bool> p(FixScrollBarLayout(arena, s,
475 defMinScrollBarWidth, defMinScrollBarHeight));
476
477 if(p.first && p.second && GetWidth() > defMinScrollBarWidth
478 && GetHeight() > defMinScrollBarHeight)
479 {
480 hsbHorizontal.SetWidth(GetWidth() - defMinScrollBarWidth);
481 vsbVertical.SetHeight(GetHeight() - defMinScrollBarHeight);
482 }
483 else if(p.first)
484 {
485 SetSizeOf(hsbHorizontal, Size(GetWidth(),
486 hsbHorizontal.GetHeight()));
487 MoveToBottom(hsbHorizontal);
488 }
489 else if(p.second)
490 {
491 SetSizeOf(vsbVertical, Size(vsbVertical.GetWidth(),
492 GetHeight()));
493 MoveToRight(vsbVertical);
494 }
495 SetVisibleOf(hsbHorizontal, p.first);
496 SetVisibleOf(vsbVertical, p.second);
497 }
498 CatchIgnore(GeneralEvent&)
499 return arena;
500 }
501
502 } // namespace UI;
503
504 } // namespace YSLib;
505
YSLib::UI::ScrollBar::btnNext
Thumb btnNext
后滚动条按钮。
Definition: Scroll.h:345
platform::p
while p p
Definition: YCLib/FileSystem.h:225
YSLib::GMRange< ScrollEventArgs::ValueType >::value
ValueType value
值。
Definition: YObject.h:558
yconstexpr
#define yconstexpr
指定编译时常量表达式。
Definition: ydef.h:653
YSLib::UI::ATrack::ValueType
ScrollEventArgs::ValueType ValueType
Definition: Scroll.h:145
YSLib::UI::ScrollCategory::First
滚动框移动至最小位置。
YSLib::UI::ATrack::SetLargeDelta
void SetLargeDelta(ValueType)
设置大距离滚动偏移量。
Definition: Scroll.cpp:176
YSLib::RestrictInInterval
void RestrictInInterval(_type &i, const _type &a, const _type &b) ynothrow
约束整数 i 在左闭右开区间 [a, b) 中。
Definition: YCoreUtilities.h:220
YSLib::UI::HorizontalTrack
水平轨道。
Definition: Scroll.h:266
placeholders
YSLib::UI::ATrack::OnPrev
Definition: Scroll.h:141
YSLib::Drawing::Rect::Contains
bool Contains(SPos px, SPos py) const ynothrow
判断点 (px, py) 是否在矩形内或边上。
Definition: YGDIBase.cpp:92
ImplDeDtor
#define ImplDeDtor(_t)
Definition: YBaseMacro.h:182
YSLib::UI::CursorWheelEventArgs
滚轮事件参数。
Definition: YWidgetEvent.h:250
YSLib::UI::Control
控件。
Definition: YControl.h:275
YSLib::Drawing::Rotation
Rotation
逆时针旋转角度指示输出指向。
Definition: YGDIBase.h:895
YSLib::GeneralEvent
std::runtime_error GeneralEvent
一般运行时异常事件类。
Definition: YException.h:45
YSLib::UI::FetchGUIState
GUIState & FetchGUIState() ynothrow
Definition: YGUI.cpp:508
YSLib::UI::DrawTrackBackground
YF_API void DrawTrackBackground(PaintEventArgs &&e, ATrack &)
绘制指定色调的基本按钮背景。
Definition: Scroll.cpp:246
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
YSLib::UI::ATrack::Scroll
GEvent< void(ScrollEventArgs &&)> Scroll
滚动事件。
Definition: Scroll.h:167
YSLib::UI::SPos
const IWidget &wgt SPos
Definition: YWidget.h:109
YSLib::Drawing::bounds
The boundary is out of the const Rect & bounds
Definition: YDraw.h:127
YSLib::UI::ScrollEventArgs
滚动事件参数类。
Definition: Scroll.h:67
YSLib::Drawing::GBinaryGroup::X
_type X
Definition: YGDIBase.h:63
YSLib::UI::FetchGUIConfiguration
GUIConfiguration & FetchGUIConfiguration()
Definition: YGUI.cpp:519
YSLib::Drawing::Size::Width
SDst Width
Definition: YGDIBase.h:302
YSLib::UI::MoveToBottom
YF_API void MoveToBottom(IWidget &)
移动部件至容器下端。
Definition: YUIContainer.cpp:128
YSLib::UI::OnKey_Bound_TouchUp
YF_API void OnKey_Bound_TouchUp(KeyEventArgs &&)
处理按键事件：按键-指针设备接触结束。
Definition: YControl.cpp:160
YSLib::UI::Widget::Height
Height
Definition: YWidget.h:454
YSLib::UI::ScrollCategory
ScrollCategory
滚动类别。
Definition: Scroll.h:49
YSLib::Drawing::GBinaryGroup::Y
_type Y
分量。
Definition: YGDIBase.h:63
CHRLib::d
_tDst * d
Definition: CharacterProcessing.h:139
YSLib::UI::ScrollCategory::ThumbTrack
滚动框当前正在移动。
YSLib::UI::RoutedEventArgs::Direct
直接事件：仅当遍历至目标控件时触发。
Definition: YWidgetEvent.h:109
YSLib::UI::HorizontalTrack::HorizontalTrack
HorizontalTrack(const Rect &={}, SDst=8)
构造：使用指定边界和最小滑块长。
Definition: Scroll.cpp:290
CHRLib::c
c
Definition: CharacterProcessing.h:81
YSLib::UI::IsVisible
IsVisible
Definition: YWidget.h:101
YSLib::UI::UIEventArgs
用户界面事件参数基类。
Definition: YWidgetEvent.h:59
YSLib::UI::ATrack::tmbScroll
Thumb tmbScroll
滑块：轨道区域上的滚动框。
Definition: Scroll.h:154
YSLib::UI::Widget::Y
Renderer AView Y
Definition: YWidget.h:460
YSLib::UI::ATrack::OnThumb
Definition: Scroll.h:140
YSLib::UI::ImplDeDtor
ImplDeDtor(Thumb) void DecorateAsCloseButton(Thumb &tmb)
Definition: Button.cpp:125
YSLib::UI::Invalidate
YF_API void Invalidate(IWidget &, const Rect &)
无效化：使相对部件的指定区域在直接和间接的窗口缓冲区中无效。
Definition: YWidget.cpp:108
YSLib::UI::X
pt X
Definition: YWidget.h:115
CatchIgnore
#define CatchIgnore(_ex)
指定异常处理器忽略指定异常。
Definition: YBaseMacro.h:133
YSLib::UI::SetSizeOf
YF_API void SetSizeOf(IWidget &, const Size &)
设置部件大小。
Definition: YWidget.cpp:83
YSLib::Drawing::RDeg180
Definition: YGDIBase.h:899
YSLib::UI::ScrollableContainer::vsbVertical
ScrollBar vsbVertical
Definition: Scroll.h:419
std
Definition: memory.hpp:1100
platform::SPos
std::int16_t SPos
屏幕坐标度量。
Definition: Video.h:42
YSLib::UI::OnKeyHeld
YF_API void OnKeyHeld(KeyEventArgs &&)
处理键接触保持事件。
Definition: YControl.cpp:109
YSLib::GMRange
范围模块类。
Definition: YObject.h:551
YSLib::UI::x
SPos x
Definition: YWidget.cpp:43
YSLib::UI::ATrack::SetValue
void SetValue(ValueType)
设置滚动事件关联值。
Definition: Scroll.cpp:170
YSLib::UI::Widget::SDst
SDst
Definition: YWidget.h:454
YSLib::YAssert
YAssert(!(v< Deref(a)),"Value less than lower bound found.")
yunseq
#define yunseq
无序列依赖表达式组求值。
Definition: ydef.h:996
YSLib::UI::CursorEventArgs
指针设备输入事件参数类。
Definition: YWidgetEvent.h:210
YSLib::UI::ATrack::LocateThumb
void LocateThumb(ValueType, ScrollCategory=ScrollCategory::ThumbPosition)
定位滑块。
Definition: Scroll.cpp:199
YSLib::UI::ScrollBar::ForeColor
Color ForeColor
默认前景色。
Definition: Scroll.h:328
ystdex::bind1
auto bind1(_func &&f, _tParams &&...args) -> decltype(std::bind(std::forward< decltype(f)>(f), std::placeholders::_1, std::forward< decltype(args)>(args)...))
复合调用 std::bind 和 std::placeholders::_1 。
Definition: functional.hpp:583
YSLib::Drawing::GetHeight
tr GetHeight())) inline PDefH(void
按字体高度和行距调整文本区域的底边距。
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: YGDIBase.h:540
YSLib::UI::ATrack::SetMaxValue
void SetMaxValue(ValueType)
设置滚动事件关联值最大取值。
Definition: Scroll.cpp:160
YSLib::UI::BorderArea::Down
ystdex
特性测试宏。
Definition: ydef.h:796
YSLib::UI::ScrollableContainer
带滚动条的容器。
Definition: Scroll.h:407
YSLib::Drawing::Size
屏幕区域大小。
Definition: YGDIBase.h:293
YSLib::UI::SetLocationOf
YF_API void SetLocationOf(IWidget &, const Point &)
设置部件左上角所在位置（相对容器的偏移坐标）。
Definition: YWidget.cpp:76
YSLib::UI::ATrack::min_thumb_length
SDst min_thumb_length
最小滑块长度。
Definition: Scroll.h:157
YSLib::UI::Widget::Width
Renderer AView Width
Definition: YWidget.h:458
YSLib::UI::ATrack::SetThumbPosition
void SetThumbPosition(SPos)
设置滑块位置。
Definition: Scroll.cpp:144
YSLib::Drawing::r
The boundary is out of the const Graphics const Rect const Point const Point Color c const Rect const Rect & r
Definition: YDraw.h:174
YSLib::UI::ScrollCategory::LargeIncrement
滚动框大距离增量移动。
YSLib::UI::OnKey_Bound_TouchDown
YF_API void OnKey_Bound_TouchDown(KeyEventArgs &&)
处理按键事件：按键-指针设备接触开始。
Definition: YControl.cpp:166
YSLib::GMRange< ScrollEventArgs::ValueType >::max_value
ValueType max_value
最大取值。
Definition: YObject.h:557
UI
YSLib::UI::y
SPos SPos y
Definition: YWidget.cpp:44
platform::KeyInput
std::bitset< KeyBitsetWidth > KeyInput
按键并行位宽。
Definition: Keys.h:67
YSLib::UI::BorderArea::Left
YSLib::UI::ATrack::ThumbDrag
GEvent< void(UIEventArgs &&)> ThumbDrag
滑块拖动事件。
Definition: Scroll.h:165
YSLib::UI::ATrack::None
Definition: Scroll.h:139
YSLib::UI::Widget::SPos
Renderer AView SPos
Definition: YWidget.h:459
YSLib::UI::e
void e
Definition: YWidget.h:352
YSLib::UI::ATrack::CheckArea
Area CheckArea(SPos) const
检查轨道方向指定位置所在的区域。
Definition: Scroll.cpp:183
YModules.h
YSLib::UI::ATrack::Area
Area
轨道区域。
Definition: Scroll.h:137
YSLib::Drawing::Size::Height
SDst Height
宽和高。
Definition: YGDIBase.h:302
YSLib::UI::ScrollCategory::Last
滚动框移动至最大位置。
ystdex::observer_ptr
观察者指针：无所有权的智能指针。
Definition: memory.hpp:917
YSLib::Drawing::Point
GBinaryGroup< SPos > Point
屏幕二维点（直角坐标表示）。
Definition: YGDIBase.h:278
YSLib::a
YB_PURE const _type * a
Definition: YCoreUtilities.h:167
YSLib::UI::ScrollableContainer::ScrollableContainer
ScrollableContainer(const Rect &={})
Definition: Scroll.cpp:450
YSLib::UI::ScrollCategory::EndScroll
滚动框移动停止。
YSLib::Drawing::FillRect
c YF_API void FillRect(const Graphics &g, const Rect &r, Color c)
填充标准矩形。
Definition: YDraw.cpp:150
YSLib::Drawing::DrawArrow
YF_API void DrawArrow(const Graphics &, const Rect &, const Rect &, SDst=4, Rotation=RDeg0, Color=ColorSpace::Black, bool={})
在指定图形接口上下文上描画底边和坐标轴共线的等腰直角三角形箭头。
Definition: YStyle.cpp:202
YSLib::UI::MoveToRight
YF_API void MoveToRight(IWidget &)
移动部件至容器右端。
Definition: YUIContainer.cpp:149
YSLib::UI::GetSizeOf
pt pt Y const IWidget &wgt const IWidget &wgt GetSizeOf
无效化：使相对部件的子部件的指定区域在直接和间接的窗口缓冲区中无效。
Definition: YWidget.h:161
ystdex::make_observer
observer_ptr< _type > make_observer(_type *p)
Definition: memory.hpp:1042
YSLib::UI::ATrack::large_delta
ValueType large_delta
大距离滚动偏移量：滚动事件关联的滑块位置变化绝对值。
Definition: Scroll.h:159
YSLib::UI::VerticalTrack
竖直轨道。
Definition: Scroll.h:292
YSLib::UI::PaintEventArgs
部件绘制参数。
Definition: YWidgetEvent.h:323
YSLib::Drawing::RDeg0
Definition: YGDIBase.h:897
YSLib::Drawing::RDeg90
Definition: YGDIBase.h:898
YSLib::UI::OnTouchHeld
YF_API void OnTouchHeld(CursorEventArgs &&)
处理屏幕接触保持事件。
Definition: YControl.cpp:132
YSLib::UI::BorderArea::Up
YSLib::UI::ScrollBar::btnPrev
Thumb btnPrev
前滚动条按钮。
Definition: Scroll.h:339
YSLib::UI::ScrollBar
滚动条。
Definition: Scroll.h:317
YSLib::UI::ScrollCategory::SmallDecrement
滚动框小距离减量移动。
YSLib::UI::ATrack
轨道。
Definition: Scroll.h:130
YSLib::UI::Styles::Track
滚动条背景。
Definition: YStyle.h:313
YSLib::UI::ScrollableContainer::hsbHorizontal
ScrollBar hsbHorizontal
控制水平和竖直可视区域的水平滚动条。
Definition: Scroll.h:419
YSLib::UI::GetLocationOf
pt pt Y const IWidget &wgt GetLocationOf
Definition: YWidget.h:153
YSLib::Drawing::g
The boundary is out of the const Graphics & g
Definition: YDraw.h:161
YSLib::UI::ScrollCategory::SmallIncrement
滚动框小距离增量移动。
YSLib::UI::Styles::Light
明亮背景。
Definition: YStyle.h:317
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:140
YSLib::UI::ATrack::OnNext
Definition: Scroll.h:142
YSLib::UI::ScrollCategory::LargeDecrement
滚动框大距离减量移动。
YSLib::Drawing::RDeg270
Definition: YGDIBase.h:900
platform::n
size_t n
Definition: YCLib/FileSystem.cpp:321
platform::SDst
std::uint16_t SDst
屏幕坐标距离。
Definition: Video.h:43
ystdex::ref
lref< _type > ref(_type &t)
构造引用包装。
Definition: ref.hpp:120
YSLib::UI::BorderArea::Right
YSLib::Drawing::GBinaryGroup< SPos >