29 #include YFM_YSLib_UI_YGUI
30 #include YFM_YSLib_UI_YDesktop
36 using namespace Drawing;
46 FetchTopEnabledAndVisibleWidgetPtr(IWidget& con,
const Point& pt)
48 for(
auto pr(con.GetChildren()); pr.first != pr.second; ++pr.first)
50 IWidget&
wgt(*pr.first);
60 FetchVisibleEnabledFocusingPtr(IWidget& con)
123 return tmr.
RefreshHeld(st, initial_delay, repeated_delay) || b;
129 DraggingOffset(
Vec::Invalid), HeldTimer(), CursorLocation(
Point::Invalid),
179 p_cascade_focus = &
wgt;
209 auto p(&e.GetSender());
219 const auto t(FetchVisibleEnabledFocusingPtr(*p_con));
239 while(!e.
Handled && (p_con = FetchContainerPtr(*p)))
241 e.SetSender(*(p = p_con));
249 YAssert(op == KeyUp || op == KeyDown || op == KeyHeld,
250 "Invalid operation found.");
251 DoEvent<HKeyEvent>(e.GetSender().GetController(), op, std::move(e));
259 auto p(&e.GetSender());
269 const auto t(FetchTopEnabledAndVisibleWidgetPtr(*p_con, e));
290 while(!e.
Handled && (p_con = FetchContainerPtr(*p)))
293 e.SetSender(*(p = p_con));
301 auto& controller(e.GetSender().GetController());
312 DoEvent<HCursorEvent>(controller, op, std::move(e));
315 DoEvent<HCursorWheelEvent>(controller, CursorWheel,
316 std::move(ystdex::polymorphic_downcast<CursorWheelEventArgs&>(e)));
319 YAssert(
false,
"Invalid operation found.");
328 CallEvent<Enter>(e.GetSender(), e);
338 CallEvent<Leave>(e.GetSender(), e);
358 auto& controller(wgt.GetController());
361 FetchEvent<KeyUp>(controller).Add([
this](
KeyEventArgs&& e){
362 auto&
wgt(e.GetSender());
368 CallEvent<KeyPress>(
wgt, e);
371 FetchEvent<KeyDown>(controller).Add([
this](
KeyEventArgs&& e){
379 auto& wgt(e.GetSender());
381 if(p_CursorOver != &wgt)
384 CallEvent<Leave>(*p_CursorOver, CursorEventArgs(
385 *p_CursorOver, e.Keys, e.Position - LocateForWidget(wgt,
387 CallEvent<Enter>(e.GetSender(), CursorEventArgs(e));
395 auto& wgt(e.GetSender());
399 e.SetSender(*p_indp_focus);
400 TryLeaving(std::move(e));
401 e.SetSender(e.GetSender());
403 ResetHeldState(TouchHeldState, e.Keys),
405 if(p_indp_focus == &
wgt)
406 CallEvent<Click>(
wgt, e);
407 else if(p_indp_focus)
408 CallEvent<ClickAcross>(*p_indp_focus, e);
412 FetchEvent<TouchDown>(controller).Add([
this](CursorEventArgs&& e){
415 p_indp_focus = &e.GetSender();
416 TryEntering(std::move(e));
419 FetchEvent<TouchHeld>(controller).Add([
this](CursorEventArgs&& e){
422 auto& wgt(e.GetSender());
424 if(p_indp_focus == &wgt)
425 TryEntering(CursorEventArgs(e));
431 CallEvent<Leave>(*p_indp_focus, CursorEventArgs(*p_indp_focus,
432 e.Keys, e.Position - LocateForWidget(wgt, *p_indp_focus)));
void ResponseCursor(CursorEventArgs &, VisualEvent)
响应屏幕接触状态。
Drawing::Vec DraggingOffset
拖放偏移量。
pt pt Y const IWidget &wgt GetLocationOf
YF_API GUIState & FetchGUIState()
取默认图形用户界面公共状态。
Drawing::Point CursorLocation
最近的指针设备操作时的控件全局位置(相对于顶层部件的坐标)。
void TryLeaving(CursorEventArgs &&)
IWidget * p_cascade_focus
级联焦点指针:缓冲最后一次通过直接策略路由事件的进入的部件状态。
void ResetHeldState(InputTimer::HeldStateType &, const KeyInput &)
复位接触保持状态。
virtual nBase YF_API friend void Activate(Timer &)
激活:当时间间隔非零时同步时间基点。
Timers::Duration Duration
static const GBinaryGroup Invalid
无效(不在屏幕坐标系中)对象。
size_t master_key
记录需要映射的主要字符的按键编码。
IWidget * p_CursorOver
光标设备指针对应的部件。
InputTimer::HeldStateType TouchHeldState
bool CheckDraggingOffset(IWidget *={})
若拖放偏移量无效则按指定部件的屏幕坐标更新拖放偏移量。
Duration Interval
重复刷新有效的最小时间间隔。
void ResetInput()
复位输入计时状态。
char UpdateChar(KeyInput &)
当指定按键状态和按键保持状态不同时按需更新映射的字符和参数。
InputTimer(const Duration &=Timers::TimeSpan(1000U))
#define YB_UNLIKELY(expr)
分支预测提示。
GBinaryGroup< SPos > Point
屏幕二维点(直角坐标表示)。
#define yunseq
无序列依赖表达式组求值。
YF_API bool IsFocused(const IWidget &)
判断部件是否取得焦点。
KeyInput checked_held
记录检查时的按键输入。
RoutingStrategy Strategy
事件路由策略。
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
size_t RefreshClick(size_t, const Duration &=Timers::TimeSpan(400))
重复检测连续点击状态。
#define YAssertNonnull(_expr)
void ResponseKey(KeyEventArgs &, VisualEvent)
响应标准按键状态。
InputTimer::HeldStateType KeyHeldState
输入接触状态。
bool RefreshHeld(HeldStateType &, const Duration &=Timers::TimeSpan(240), const Duration &=Timers::TimeSpan(120))
重复检测输入接触保持状态。
bool IsEnabled(const IWidget &wgt)
判断部件是否为可用的控件。
void CleanupReferences(IWidget &)
清除状态对指定部件的引用。
Selected const shared_ptr< ListType > const pair< Color, Color > viewer Contains
IWidget * p_indp_focus
独立焦点指针:自由状态时即时输入(按下)状态捕获的部件指针。
void HandleCascade(RoutedEventArgs &, IWidget &)
处理级联焦点指针,保证指向的部件具有焦点。
void Wrap(IWidget &)
包装部件响应 Enter/Leave 事件。
YF_API KeyIndex FindFirstKeyInCategroy(const KeyInput &, KeyIndex) ynothrow
找到第一个在指定类别的按键编码。
InputTimer HeldTimer
输入接触保持计时器。
HighResolutionClock::duration Duration
高精度时间间隔。
void TryEntering(CursorEventArgs &&)
std::chrono::milliseconds TimeSpan
低精度时间间隔。
const KeyInput checked_held IWidget p_indp_focus KeyHeldState bool CheckHeldState(const KeyInput &, InputTimer::HeldStateType &)
bool entered
记录按键时的光标是否在部件内部。
std::bitset< KeyBitsetWidth > KeyInput
按键并行位宽。
void ResponseKeyBase(KeyEventArgs &, VisualEvent)
响应标准按键状态。
void ResponseCursorBase(CursorEventArgs &, VisualEvent)
响应标准指针设备状态。
#define YAssert(_expr, _msg)
YF_API bool RepeatHeld(InputTimer &, InputTimer::HeldStateType &, const Timers::Duration &, const Timers::Duration &)
向指定计时器传递参数,根据状态重复按键。