YSTest: Scroll.cpp 源文件

YSTest PreAlpha_b900_20201012 The YSLib Test Project

Scroll.cpp
浏览该文件的文档.
1 /*
2 © 2011-2017 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 YB_ATTR_fallthrough;
223 case ScrollCategory::First:
224 value = 0;
225 SetThumbPosition(0);
226 break;
227 case ScrollCategory::SmallIncrement:
228 case ScrollCategory::LargeIncrement:
229 if(value + val < max_value)
230 {
231 SetValue(value + val);
232 break;
233 }
234 YB_ATTR_fallthrough;
235 case ScrollCategory::Last:
236 value = max_value;
237 // XXX: Conversion to 'SPos' might be implementation-defined.
238 SetThumbPosition(SPos(GetScrollableLength()));
239 default:
240 ;
241 }
242 }
243 Scroll(ScrollEventArgs(*this, t, value, old_value));
244 }
245
246
247 void
248 DrawTrackBackground(PaintEventArgs&& e, ATrack& trk)
249 {
250 const auto& g(e.Target);
251 const auto& pt(e.Location);
252 const Rect& bounds(Rect(pt, GetSizeOf(trk)) & e.ClipArea);
253 auto& pal(FetchGUIConfiguration().Colors);
254
255 FillRect(g, bounds, pal[Styles::Track]);
256
257 #define YSL_UI_Impl_ATrack_Partial_Invalidation 1
258 // NOTE: Partial invalidation made no efficiency improved here.
259 const auto c(pal[Styles::Light]);
260 #if YSL_UI_Impl_ATrack_Partial_Invalidation
261 SPos x(pt.X);
262 SPos y(pt.Y);
263 // XXX: Conversion to 'SPos' might be implementation-defined.
264 SPos xr(x + SPos(trk.GetWidth()));
265 SPos yr(y + SPos(trk.GetHeight()));
266 #else
267 const SPos xr(pt.X + trk.GetWidth());
268 const SPos yr(pt.Y + trk.GetHeight());
269 #endif
270
271 if(trk.IsHorizontal())
272 {
273 #if YSL_UI_Impl_ATrack_Partial_Invalidation
274 RestrictInInterval(y, bounds.Y, bounds.GetBottom()),
275 RestrictInInterval(yr, bounds.Y, bounds.GetBottom());
276 #endif
277 DrawHLineSeg(g, bounds, pt.Y, pt.X, xr, c),
278 DrawHLineSeg(g, bounds, yr, pt.X, xr, c);
279 }
280 else
281 {
282 #if YSL_UI_Impl_ATrack_Partial_Invalidation
283 RestrictInInterval(x, bounds.X, bounds.GetRight()),
284 RestrictInInterval(xr, bounds.X, bounds.GetRight());
285 #endif
286 DrawVLineSeg(g, bounds, pt.X, pt.Y, yr, c),
287 DrawVLineSeg(g, bounds, xr, pt.Y, yr, c);
288 }
289 }
290
291
292 HorizontalTrack::HorizontalTrack(const Rect& r, SDst uMinThumbLength)
293 : ATrack(r, uMinThumbLength)
294 {
295 YAssert(GetWidth() > GetHeight(), "Width is not greater than height.");
296 FetchEvent<TouchHeld>(tmbScroll) += [this](CursorEventArgs&& e){
297 if(e.Strategy == RoutedEventArgs::Direct)
298 {
299 auto& st(FetchGUIState());
300
301 if(st.CheckDraggingOffset())
302 {
303 SPos x(st.CursorLocation.X + st.DraggingOffset.X);
304
305 // XXX: Conversion to 'SPos' might be implementation-defined.
306 RestrictInClosedInterval<SPos>(x, 0,
307 SPos(GetWidth()) - SPos(tmbScroll.GetWidth()));
308 Invalidate(tmbScroll);
309 SetLocationOf(tmbScroll, Point(x, GetLocationOf(tmbScroll).Y));
310 ThumbDrag(UIEventArgs(*this));
311 }
312 }
313 };
314 }
315 ImplDeDtor(HorizontalTrack)
316
317
318 VerticalTrack::VerticalTrack(const Rect& r, SDst uMinThumbLength)
319 : ATrack(r, uMinThumbLength)
320 {
321 YAssert(GetHeight() > GetWidth(), "height is not greater than width.");
322 FetchEvent<TouchHeld>(tmbScroll) += [this](CursorEventArgs&& e){
323 if(e.Strategy == RoutedEventArgs::Direct)
324 {
325 auto& st(FetchGUIState());
326
327 if(st.CheckDraggingOffset())
328 {
329 SPos y(st.CursorLocation.Y + st.DraggingOffset.Y);
330
331 // XXX: Conversion to 'SPos' might be implementation-defined.
332 RestrictInClosedInterval<SPos>(y, 0,
333 SPos(GetHeight()) - SPos(tmbScroll.GetHeight()));
334 Invalidate(tmbScroll);
335 SetLocationOf(tmbScroll, Point(GetLocationOf(tmbScroll).X, y));
336 ThumbDrag(UIEventArgs(*this));
337 }
338 }
339 };
340 }
341 ImplDeDtor(VerticalTrack)
342
343
344 ScrollBar::ScrollBar(const Rect& r, Orientation o, SDst min_thumb)
345 : Control(r),
346 // XXX: Conversion to 'SPos' might be implementation-defined.
347 pTrack(o == Horizontal ? static_cast<ATrack*>(new
348 HorizontalTrack(Rect(SPos(r.Height), 0, r.Width - r.Height * 2, r.Height),
349 min_thumb)) : static_cast<ATrack*>(new VerticalTrack(Rect(0, SPos(r.Width),
350 r.Width, r.Height - r.Width * 2), min_thumb))),
351 btnPrev(Rect()), btnNext(Rect()), small_delta(2)
352 {
353 SetContainerPtrOf(*pTrack, make_observer(this)),
354 SetContainerPtrOf(btnPrev, make_observer(this));
355 SetContainerPtrOf(btnNext, make_observer(this));
356 yunseq(
357 FetchEvent<Resize>(*this) += [this](UIEventArgs&& e){
358 auto& track(GetTrackRef());
359 const bool is_h(track.IsHorizontal());
360 const SDst prev_metric(GetSizeOf(btnPrev).GetRef(is_h));
361 const SDst sum(prev_metric + GetSizeOf(btnNext).GetRef(is_h));
362
363 YAssert(GetSizeOf(e.GetSender()).GetRef(is_h) - sum > 0,
364 "No enough space for track.");
365
366 const SDst tl(GetSizeOf(e.GetSender()).GetRef(is_h) - sum);
367 auto pt(GetLocationOf(btnNext));
368 Size s(GetSizeOf(track));
369
370 // XXX: Conversion to 'SPos' might be implementation-defined.
371 yunseq(pt.GetRef(is_h) = SPos(tl + prev_metric), s.GetRef(is_h) = tl);
372 btnNext.GetView().SetLocation(pt), track.GetView().SetSize(s);
373 // NOTE: No event %(Resize, Move) is raised.
374 },
375 FetchEvent<KeyUp>(*this) += OnKey_Bound_TouchUp,
376 FetchEvent<KeyDown>(*this) += OnKey_Bound_TouchDown,
377 FetchEvent<KeyHeld>(*this) += OnKeyHeld,
378 FetchEvent<CursorWheel>(*this) += [this](CursorWheelEventArgs&& e){
379 if(e.GetDelta() > 0)
380 LocateThumb(small_delta, ScrollCategory::SmallDecrement);
381 else if(e.GetDelta() < 0)
382 LocateThumb(small_delta, ScrollCategory::SmallIncrement);
383 },
384 FetchEvent<TouchHeld>(btnPrev) += OnTouchHeld,
385 FetchEvent<TouchDown>(btnPrev) += [this]{
386 LocateThumb(small_delta, ScrollCategory::SmallDecrement);
387 },
388 FetchEvent<TouchHeld>(btnNext) += OnTouchHeld,
389 FetchEvent<TouchDown>(btnNext) += [this]{
390 LocateThumb(small_delta, ScrollCategory::SmallIncrement);
391 }
392 );
393
394 Size s(GetSizeOf(*this));
395 const bool bHorizontal(o == Horizontal);
396 const SDst l(s.GetRef(!bHorizontal));
397
398 s.GetRef(bHorizontal) = l;
399 SetSizeOf(btnPrev, s);
400 SetSizeOf(btnNext, s);
401 // Button.SetLocationOf(btnPrev, Point());
402 MoveToBottom(btnNext);
403 MoveToRight(btnNext);
404 if(o == Horizontal)
405 InitializeArrowPainters(RDeg180, RDeg0);
406 else
407 InitializeArrowPainters(RDeg90, RDeg270);
408 }
409
410 void
411 ScrollBar::InitializeArrowPainters(Rotation prev, Rotation next)
412 {
413 using namespace std;
414 using namespace placeholders;
415
416 yunseq(
417 FetchEvent<Paint>(btnPrev) += [this, prev](PaintEventArgs&& e){
418 DrawArrow(e.Target, e.ClipArea, {e.Location, GetSizeOf(btnPrev)}, 4,
419 prev, ForeColor);
420 },
421 FetchEvent<Paint>(btnNext) += [this, next](PaintEventArgs&& e){
422 DrawArrow(e.Target, e.ClipArea, {e.Location, GetSizeOf(btnNext)}, 4,
423 next, ForeColor);
424 }
425 );
426 }
427
428 observer_ptr<IWidget>
429 ScrollBar::GetBoundControlPtr(const KeyInput& k)
430 {
431 if(k.count() == 1)
432 {
433 if(GetOrientation() == Horizontal)
434 {
435 if(k[KeyCodes::Left])
436 return make_observer(&btnPrev);
437 if(k[KeyCodes::Right])
438 return make_observer(&btnNext);
439 }
440 else
441 {
442 if(k[KeyCodes::Up])
443 return make_observer(&btnPrev);
444 if(k[KeyCodes::Down])
445 return make_observer(&btnNext);
446 }
447 }
448 return {};
449 }
450
451
452 ScrollableContainer::ScrollableContainer(const Rect& r)
453 : Control(r, MakeBlankBrush()),
454 hsbHorizontal(Size(r.Width, defMinScrollBarHeight), Horizontal),
455 vsbVertical(Size(defMinScrollBarWidth, r.Height), Vertical)
456 {
457 // TODO: Allow user to choose whether background is drawn.
458 SetContainerPtrOf(hsbHorizontal, make_observer(this)),
459 SetContainerPtrOf(vsbVertical, make_observer(this)),
460 MoveToBottom(hsbHorizontal),
461 MoveToRight(vsbVertical),
462 FetchEvent<CursorWheel>(*this) += [this](CursorWheelEventArgs&& e){
463 if(IsVisible(vsbVertical))
464 CallEvent<CursorWheel>(vsbVertical, std::move(e));
465 };
466 }
467 ImplDeDtor(ScrollableContainer)
468
469 Size
470 ScrollableContainer::FixLayout(const Size& s)
471 {
472 Size arena(GetSizeOf(*this));
473
474 try
475 {
476 const pair<bool, bool> p(FixScrollBarLayout(arena, s,
477 defMinScrollBarWidth, defMinScrollBarHeight));
478
479 if(p.first && p.second && GetWidth() > defMinScrollBarWidth
480 && GetHeight() > defMinScrollBarHeight)
481 {
482 hsbHorizontal.SetWidth(GetWidth() - defMinScrollBarWidth);
483 vsbVertical.SetHeight(GetHeight() - defMinScrollBarHeight);
484 }
485 else if(p.first)
486 {
487 SetSizeOf(hsbHorizontal, Size(GetWidth(),
488 hsbHorizontal.GetHeight()));
489 MoveToBottom(hsbHorizontal);
490 }
491 else if(p.second)
492 {
493 SetSizeOf(vsbVertical, Size(vsbVertical.GetWidth(),
494 GetHeight()));
495 MoveToRight(vsbVertical);
496 }
497 SetVisibleOf(hsbHorizontal, p.first);
498 SetVisibleOf(vsbVertical, p.second);
499 }
500 CatchIgnore(GeneralEvent&)
501 return arena;
502 }
503
504 } // namespace UI;
505
506 } // namespace YSLib;
507
YSLib::UI::SetLocationOf
YF_API void SetLocationOf(IWidget &, const Point &)
设置部件左上角所在位置（相对容器的偏移坐标）。
Definition: YWidget.cpp:76
YSLib::GMRange
判断是否持有相同对象。
Definition: YObject.h:1737
YSLib::Drawing::RDeg270
@ RDeg270
Definition: YGDIBase.h:1149
YSLib::UI::ScrollBar::InitializeArrowPainters
void InitializeArrowPainters(Rotation, Rotation)
Definition: Scroll.cpp:411
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:221
YSLib::UI::Widget::Y
Renderer AView Y
Definition: YWidget.h:464
platform::KeyCodes::DS::Down
@ Down
Definition: Keys.h:224
YSLib::UI::SPos
const IWidget &wgt SPos
Definition: YWidget.h:109
YSLib::UI::ATrack::SetThumbPosition
void SetThumbPosition(SPos)
设置滑块位置。
Definition: Scroll.cpp:144
YSLib::Drawing::Size
屏幕区域大小。
Definition: YGDIBase.h:536
CatchIgnore
#define CatchIgnore(_ex)
指定异常处理器忽略指定异常。
Definition: YBaseMacro.h:133
YSLib::UI::ATrack::OnPrev
@ OnPrev
Definition: Scroll.h:141
YSLib::Drawing::FillRect
c YF_API void FillRect(const Graphics &g, const Rect &r, Color c)
填充标准矩形。
Definition: YDraw.cpp:150
CHRLib::c
c
Definition: CharacterProcessing.h:84
YSLib::UI::OnTouchHeld
YF_API void OnTouchHeld(CursorEventArgs &&)
处理屏幕接触保持事件。
Definition: YControl.cpp:132
YSLib::UI::OnKey_Bound_TouchUp
YF_API void OnKey_Bound_TouchUp(KeyEventArgs &&)
处理按键事件：按键-指针设备接触结束。
Definition: YControl.cpp:160
yconstexpr
#define yconstexpr
指定编译时常量表达式。
Definition: ydef.h:1072
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:53
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::ATrack::ThumbDrag
GEvent< void(UIEventArgs &&)> ThumbDrag
滑块拖动事件。
Definition: Scroll.h:165
YSLib::Drawing::GGraphics::Height
const SizeType sGraphics Height
Definition: YGraphics.h:136
YSLib::UI::ScrollCategory::ThumbTrack
@ ThumbTrack
滚动框当前正在移动。
YSLib::UI::ATrack::min_thumb_length
SDst min_thumb_length
最小滑块长度。
Definition: Scroll.h:157
YSLib::UI::ATrack
轨道。
Definition: Scroll.h:131
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::Control
控件。
Definition: YControl.h:271
ImplDeDtor
#define ImplDeDtor(_t)
Definition: YBaseMacro.h:183
YSLib::UI::CursorEventArgs
指针设备输入事件参数类。
Definition: YWidgetEvent.h:216
YSLib::UI::ScrollBar::ScrollBar
ScrollBar(const Rect &={}, Orientation=Horizontal, SDst=8)
构造：使用指定边界、大小和方向。
YSLib::UI::MoveToBottom
YF_API void MoveToBottom(IWidget &)
移动部件至容器下端。
Definition: YUIContainer.cpp:128
next
tidy_ptr< slink > next
Definition: memory_resource.cpp:223
CHRLib::d
_tDst * d
Definition: CharacterProcessing.h:142
YSLib::UI::GetSizeOf
YB_ATTR_nodiscard YB_PURE pt pt Y YB_ATTR_nodiscard YB_PURE const IWidget &wgt const IWidget &wgt GetSizeOf
无效化：使相对部件的子部件的指定区域在直接和间接的窗口缓冲区中无效。
Definition: YWidget.h:165
YSLib::UI::Widget::SPos
Renderer AView SPos
Definition: YWidget.h:463
YSLib::UI::ATrack::large_delta
ValueType large_delta
大距离滚动偏移量：滚动事件关联的滑块位置变化绝对值。
Definition: Scroll.h:159
YSLib::UI::VerticalTrack
竖直轨道。
Definition: Scroll.h:291
YB_ATTR_fallthrough
#define YB_ATTR_fallthrough
用于 switch 语句的 fallthrough 属性。
Definition: ydef.h:655
YSLib::GeneralEvent
std::runtime_error GeneralEvent
一般运行时异常事件类。
Definition: YException.h:46
YSLib::UI::VerticalTrack::VerticalTrack
VerticalTrack(const Rect &={}, SDst=8)
构造：使用指定边界和最小滑块长。
YSLib::ImplDeDtor
ImplDeDtor(LoggedEvent) FatalError
Definition: YException.cpp:49
YSLib::Drawing::RDeg180
@ RDeg180
Definition: YGDIBase.h:1148
YSLib::UI::ImplDeDtor
ImplDeDtor(Thumb) void DecorateAsCloseButton(Thumb &tmb)
Definition: Button.cpp:125
YSLib::Drawing::g
The boundary is out of the const Graphics & g
Definition: YDraw.h:161
YSLib::UI::ATrack::OnNext
@ OnNext
Definition: Scroll.h:142
YSLib::UI::ScrollCategory
ScrollCategory
滚动类别。
Definition: Scroll.h:50
YSLib::Drawing::Rect::Contains
YB_ATTR_nodiscard YB_PURE bool Contains(SPos px, SPos py) const ynothrow
判断点 (px, py) 是否在矩形内或边上。
Definition: YGDIBase.cpp:91
YSLib::UI::ScrollEventArgs
滚动事件参数类。
Definition: Scroll.h:68
YSLib::UI::ScrollableContainer
带滚动条的容器。
Definition: Scroll.h:404
YSLib::UI::Styles::Track
@ Track
滚动条背景。
Definition: YStyle.h:313
YSLib::UI::Invalidate
YF_API void Invalidate(IWidget &, const Rect &)
无效化：使相对部件的指定区域在直接和间接的窗口缓冲区中无效。
Definition: YWidget.cpp:108
YSLib::UI::ATrack::LocateThumb
void LocateThumb(ValueType, ScrollCategory=ScrollCategory::ThumbPosition)
定位滑块。
Definition: Scroll.cpp:199
YSLib::UI::ScrollBar::btnPrev
Thumb btnPrev
前滚动条按钮。
Definition: Scroll.h:336
YSLib::UI::ATrack::ValueType
ScrollEventArgs::ValueType ValueType
Definition: Scroll.h:145
YSLib::YAssert
YAssert(!(v< Deref(a)), "Value less than lower bound found.")
YSLib::UI::ATrack::OnThumb
@ OnThumb
Definition: Scroll.h:140
ystdex::make_observer
observer_ptr< _type > make_observer(_type *p)
Definition: pointer.hpp:405
YSLib::Drawing::Point
GBinaryGroup< SPos > Point
屏幕二维点（直角坐标表示）。
Definition: YGDIBase.h:520
YSLib::UI::RoutedEventArgs::Direct
@ Direct
直接事件：仅当遍历至目标控件时触发。
Definition: YWidgetEvent.h:113
YSLib::UI::ScrollBar::ForeColor
Color ForeColor
默认前景色。
Definition: Scroll.h:325
YSLib::Drawing::Rotation
Rotation
逆时针旋转角度指示输出指向。
Definition: YGDIBase.h:1145
YSLib::UI::ATrack::Area
Area
轨道区域。
Definition: Scroll.h:138
YSLib::UI::ATrack::tmbScroll
Thumb tmbScroll
滑块：轨道区域上的滚动框。
Definition: Scroll.h:154
std
Definition: optional.h:982
YSLib::UI::FetchGUIConfiguration
GUIConfiguration & FetchGUIConfiguration()
Definition: YGUI.cpp:517
YSLib::UI::DrawTrackBackground
YF_API void DrawTrackBackground(PaintEventArgs &&e, ATrack &)
绘制指定色调的基本按钮背景。
Definition: Scroll.cpp:248
YSLib::Drawing::GBinaryGroup< SPos >
YSLib::UI::ScrollCategory::Last
@ Last
滚动框移动至最大位置。
yunseq
#define yunseq
无序列依赖表达式组求值。
Definition: ydef.h:1535
platform::SDst
std::uint16_t SDst
屏幕坐标距离。
Definition: Video.h:44
YSLib::UI::HorizontalTrack
水平轨道。
Definition: Scroll.h:266
YSLib::UI::Styles::Light
@ Light
明亮背景。
Definition: YStyle.h:317
YSLib::UI::ScrollableContainer::ScrollableContainer
ScrollableContainer(const Rect &={})
Definition: Scroll.cpp:452
YSLib::UI::OnKeyHeld
YF_API void OnKeyHeld(KeyEventArgs &&)
处理键接触保持事件。
Definition: YControl.cpp:109
YSLib::UI::ScrollCategory::First
@ First
滚动框移动至最小位置。
YSLib::UI::y
SPos SPos y
Definition: YWidget.cpp:44
YSLib::Drawing::GBinaryGroup::X
_type X
分量。
Definition: YGDIBase.h:305
YSLib::GMRange< ScrollEventArgs::ValueType >::value
ValueType value
值。
Definition: YObject.h:1743
YSLib::UI::ATrack::None
@ None
Definition: Scroll.h:139
YSLib::UI::e
void e
Definition: YWidget.h:356
YSLib::UI::ScrollBar::btnNext
Thumb btnNext
后滚动条按钮。
Definition: Scroll.h:342
platform::KeyCodes::DS::Up
@ Up
Definition: Keys.h:223
YSLib::UI::Widget::Width
Renderer AView Width
Definition: YWidget.h:462
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: YGDIBase.h:788
YSLib::UI::ATrack::CheckArea
YB_ATTR_nodiscard YB_PURE Area CheckArea(SPos) const
检查轨道方向指定位置所在的区域。
Definition: Scroll.cpp:183
platform::KeyInput
std::bitset< KeyBitsetWidth > KeyInput
按键并行位宽。
Definition: Keys.h:67
YSLib::UI::ATrack::Scroll
GEvent< void(ScrollEventArgs &&)> Scroll
滚动事件。
Definition: Scroll.h:167
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:46
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:143
YSLib::UI::MoveToRight
YF_API void MoveToRight(IWidget &)
移动部件至容器右端。
Definition: YUIContainer.cpp:149
YSLib::UI::ScrollableContainer::hsbHorizontal
ScrollBar hsbHorizontal
控制水平和竖直可视区域的水平滚动条。
Definition: Scroll.h:415
YSLib::UI::ATrack::SetValue
void SetValue(ValueType)
设置滚动事件关联值。
Definition: Scroll.cpp:170
YModules.h
YSLib 用户界面模块配置文件。
YSLib::UI::Widget::Height
Height
Definition: YWidget.h:458
YSLib::GMRange< ScrollEventArgs::ValueType >::max_value
ValueType max_value
最大取值。
Definition: YObject.h:1742
YSLib::UI::UIEventArgs
用户界面事件参数基类。
Definition: YWidgetEvent.h:61
YSLib::Drawing::RDeg0
@ RDeg0
Definition: YGDIBase.h:1146
YSLib::Drawing::bounds
The boundary is out of the const Rect & bounds
Definition: YDraw.h:127
YSLib::UI::CursorWheelEventArgs
滚轮事件参数。
Definition: YWidgetEvent.h:257
YSLib::UI::ScrollCategory::LargeIncrement
@ LargeIncrement
滚动框大距离增量移动。
ystdex
<memory> 特性测试宏。
Definition: ydef.h:1262
YSLib::UI::PaintEventArgs
部件绘制参数。
Definition: YWidgetEvent.h:330
YSLib::UI::ScrollCategory::EndScroll
@ EndScroll
滚动框移动停止。
YSLib::UI::ScrollCategory::LargeDecrement
@ LargeDecrement
滚动框大距离减量移动。
YSLib::UI::x
SPos x
Definition: YWidget.cpp:43
YSLib::UI::ScrollCategory::SmallIncrement
@ SmallIncrement
滚动框小距离增量移动。
YSLib::UI::SetSizeOf
YF_API void SetSizeOf(IWidget &, const Size &)
设置部件大小。
Definition: YWidget.cpp:83
YSLib::Drawing::GBinaryGroup::Y
_type Y
Definition: YGDIBase.h:305
platform::p
return p p
Definition: YCLib/FileSystem.h:209
platform::KeyCodes::DS::Left
@ Left
Definition: Keys.h:222
YSLib::UI::X
YB_ATTR_nodiscard YB_PURE pt X
Definition: YWidget.h:116
YSLib::UI::GetLocationOf
YB_ATTR_nodiscard YB_PURE pt pt Y YB_ATTR_nodiscard YB_PURE const IWidget &wgt GetLocationOf
Definition: YWidget.h:157
platform::SPos
std::int16_t SPos
屏幕坐标度量。
Definition: Video.h:43
YSLib::Drawing::RDeg90
@ RDeg90
Definition: YGDIBase.h:1147
YSLib::Drawing::GetHeight
YB_ATTR_nodiscard YB_PURE tr GetHeight())) inline PDefH(void
按字体高度和行距调整文本区域的底边距。
YSLib::UI::ATrack::SetMaxValue
void SetMaxValue(ValueType)
设置滚动事件关联值最大取值。
Definition: Scroll.cpp:160
YSLib::UI::IsVisible
IsVisible
Definition: YWidget.h:101
YSLib::UI::FetchGUIState
GUIState & FetchGUIState() ynothrow
Definition: YGUI.cpp:506
YSLib::UI::OnKey_Bound_TouchDown
YF_API void OnKey_Bound_TouchDown(KeyEventArgs &&)
处理按键事件：按键-指针设备接触开始。
Definition: YControl.cpp:166
platform::KeyCodes::DS::Right
@ Right
Definition: Keys.h:221
ystdex::ref
void ref(const _type &&)=delete
ystdex::observer_ptr
观察者指针：无所有权的智能指针。
Definition: pointer.hpp:269
YSLib::UI::HorizontalTrack::HorizontalTrack
HorizontalTrack(const Rect &={}, SDst=8)
构造：使用指定边界和最小滑块长。
Definition: Scroll.cpp:292
YSLib::UI::Widget::SDst
SDst
Definition: YWidget.h:458
YSLib::UI::ScrollCategory::SmallDecrement
@ SmallDecrement
滚动框小距离减量移动。
YSLib::a
YB_PURE const _type * a
Definition: YCoreUtilities.h:168
platform::l
return l
Definition: YCLib/FileSystem.h:402
YSLib::UI::ScrollableContainer::vsbVertical
ScrollBar vsbVertical
Definition: Scroll.h:415