YSTest  PreAlpha_b500_20140530
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
ywgtevt.cpp
浏览该文件的文档.
1 /*
2  © 2010-2014 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_YWidgetEvent
30 #include YFM_YSLib_UI_YWidget
31 
32 namespace YSLib
33 {
34 
35 namespace UI
36 {
37 
40  : RoutedEventArgs(wgt, s), Keys(k)
41 {}
42 
43 
45  : InputEventArgs(wgt, k, s)
46 {}
47 
48 
50  const InputType& pt, RoutingStrategy s)
51  : InputEventArgs(wgt, k, s), Position(pt)
52 {}
53 
54 
56  const KeyInput& k, const InputType& pt, RoutingStrategy s)
57  : CursorEventArgs(wgt, k, pt, s), delta(d)
58 {}
59 
60 
62  const KeyInput& k, RoutingStrategy s)
63  : InputEventArgs(wgt, k, s), Text(std::move(str))
64 {}
66  : InputEventArgs(std::move(e)), Text(std::move(str))
67 {}
68 
69 
71  : UIEventArgs(wgt), PaintContext()
72 {}
73 PaintEventArgs::PaintEventArgs(IWidget& wgt, const PaintContext& pc)
74  : UIEventArgs(wgt), PaintContext(pc)
75 {}
77  const Drawing::Point& pt, const Drawing::Rect& r)
78  : UIEventArgs(wgt), PaintContext{g, pt, r}
79 {}
80 
81 
83  : AController(b),
84  Paint()
85 {}
86 
88 WidgetController::GetItem(const VisualEvent& id)
89 {
90  if(id == UI::Paint)
91  return Paint;
92  throw BadEvent();
93 }
94 
95 
97 GetEvent(EventMapping::MapType& m, const VisualEvent& id,
99 {
100  auto pr(ystdex::search_map(m, id));
101 
102  if(pr.second)
103  pr.first = m.insert(pr.first, EventMapping::PairType(id, f()));
104  return pr.first->second;
105 }
106 
107 } // namespace UI;
108 
109 } // namespace YSLib;
110 
控制器抽象类。
Definition: ywgtevt.h:468
CursorEventArgs(IWidget &, const KeyInput &, const InputType &={}, RoutingStrategy=Direct)
构造:使用按键输入类型对象、输入类型对象和事件路由策略。
Definition: ywgtevt.cpp:49
PaintEventArgs(IWidget &)
Definition: ywgtevt.cpp:70
GIHEvent< UIEventArgs && > ItemType
Definition: ywgtevt.h:424
YF_API EventMapping::ItemType & GetEvent(EventMapping::MapType &, const VisualEvent &, EventMapping::MappedType(&)())
在事件映射表中取指定 id 对应的事件。
用户界面事件参数基类。
Definition: ywgtevt.h:59
KeyEventArgs(IWidget &, const InputType &={}, RoutingStrategy=Direct)
构造:使用输入类型对象和事件路由策略。
Definition: ywgtevt.cpp:44
pair< VisualEvent, MappedType > PairType
Definition: ywgtevt.h:425
std::pair< typename _tMap::iterator, bool > search_map(_tMap &m, const typename _tMap::key_type &k)
按指定键值搜索指定映射。
Definition: container.hpp:475
map< VisualEvent, MappedType > MapType
映射表类型。
Definition: ywgtevt.h:426
YSLib 标准字符串(使用 UCS-2 作为内部编码)。
Definition: ystring.h:47
_tWidget & wgt
Definition: ywgtevt.h:596
GEventWrapper< EventT(HPaintEvent), UIEventArgs && > Paint
Definition: ywgtevt.h:612
事件项类型。
Definition: yevt.hpp:804
屏幕标准矩形:表示屏幕矩形区域。
Definition: ygdibase.h:416
CursorWheelEventArgs(IWidget &, WheelDelta, const KeyInput &, const InputType &={}, RoutingStrategy=Direct)
Definition: ywgtevt.cpp:55
WidgetController(bool={})
构造:使用指定可用性。
Definition: ywgtevt.cpp:82
二维图形接口上下文。
Definition: ygdibase.h:721
_tWidget _fCallable && f
Definition: ywgtevt.h:597
错误或不存在的部件事件异常。
Definition: ywgtevt.h:440
ptrdiff_t WheelDelta
滚轮度量:以角度计量的转动滚轮的幅度。
Definition: ywgtevt.h:210
路由事件参数基类。
Definition: ywgtevt.h:93
RoutingStrategy
事件路由策略枚举。
Definition: ywgtevt.h:100
bounds & r
Definition: ydraw.h:220
c yconstfn g
Definition: ystyle.h:104
KeyInput InputType
输入类型。
Definition: ywgtevt.h:170
TextInputEventArgs(IWidget &, String, const KeyInput &={}, RoutingStrategy=Direct)
Definition: ywgtevt.cpp:61
InputEventArgs(IWidget &, const KeyInput &={}, RoutingStrategy=Direct)
构造:使用本机键按下对象和路由事件类型。
Definition: ywgtevt.cpp:38
指针设备输入事件参数类。
Definition: ywgtevt.h:183
std::bitset< KeyBitsetWidth > KeyInput
按键并行位宽。
Definition: Keys.h:68
输入事件参数类。
Definition: ywgtevt.h:121