-
Notifications
You must be signed in to change notification settings - Fork 976
Expand file tree
/
Copy pathControllerExtensions.cs
More file actions
167 lines (153 loc) · 7.77 KB
/
Copy pathControllerExtensions.cs
File metadata and controls
167 lines (153 loc) · 7.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ControllerExtensions.cs" company="OxyPlot">
// Copyright (c) 2014 OxyPlot contributors
// </copyright>
// <summary>
// Provides extension methods for the <see cref="IController" />.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace OxyPlot
{
/// <summary>
/// Provides extension methods for the <see cref="IController" />.
/// </summary>
public static class ControllerExtensions
{
/// <summary>
/// Binds the specified key to the specified command.
/// </summary>
/// <param name="controller">The plot controller.</param>
/// <param name="key">The key.</param>
/// <param name="command">A plot controller command that takes key event arguments.</param>
public static void BindKeyDown(this IController controller, OxyKey key, IViewCommand<OxyKeyEventArgs> command)
{
controller.Bind(new OxyKeyGesture(key), command);
}
/// <summary>
/// Binds the specified modifier+key to the specified command.
/// </summary>
/// <param name="controller">The plot controller.</param>
/// <param name="key">The key.</param>
/// <param name="modifiers">The key modifiers.</param>
/// <param name="command">A plot controller command that takes key event arguments.</param>
public static void BindKeyDown(this IController controller, OxyKey key, OxyModifierKeys modifiers, IViewCommand<OxyKeyEventArgs> command)
{
controller.Bind(new OxyKeyGesture(key, modifiers), command);
}
/// <summary>
/// Binds the specified mouse button to the specified command.
/// </summary>
/// <param name="controller">The plot controller.</param>
/// <param name="mouseButton">The mouse button.</param>
/// <param name="command">A plot controller command that takes mouse event arguments.</param>
public static void BindMouseDown(this IController controller, OxyMouseButton mouseButton, IViewCommand<OxyMouseDownEventArgs> command)
{
controller.Bind(new OxyMouseDownGesture(mouseButton), command);
}
/// <summary>
/// Binds the specified modifier+mouse button gesture to the specified command.
/// </summary>
/// <param name="controller">The plot controller.</param>
/// <param name="mouseButton">The mouse button.</param>
/// <param name="modifiers">The modifiers.</param>
/// <param name="command">A plot controller command that takes mouse event arguments.</param>
public static void BindMouseDown(this IController controller, OxyMouseButton mouseButton, OxyModifierKeys modifiers, IViewCommand<OxyMouseDownEventArgs> command)
{
controller.Bind(new OxyMouseDownGesture(mouseButton, modifiers), command);
}
/// <summary>
/// Binds the specified modifiers+mouse button+click count gesture to the specified command.
/// </summary>
/// <param name="controller">The plot controller.</param>
/// <param name="mouseButton">The mouse button.</param>
/// <param name="modifiers">The modifiers.</param>
/// <param name="clickCount">The click count.</param>
/// <param name="command">A plot controller command that takes mouse event arguments.</param>
public static void BindMouseDown(this IController controller, OxyMouseButton mouseButton, OxyModifierKeys modifiers, int clickCount, IViewCommand<OxyMouseDownEventArgs> command)
{
controller.Bind(new OxyMouseDownGesture(mouseButton, modifiers, clickCount), command);
}
/// <summary>
/// Binds the touch down event to the specified command.
/// </summary>
/// <param name="controller">The plot controller.</param>
/// <param name="command">A plot controller command that takes touch event arguments.</param>
public static void BindTouchDown(this IController controller, IViewCommand<OxyTouchEventArgs> command)
{
controller.Bind(new OxyTouchGesture(), command);
}
/// <summary>
/// Binds the mouse enter event to the specified command.
/// </summary>
/// <param name="controller">The plot controller.</param>
/// <param name="command">A plot controller command that takes mouse event arguments.</param>
public static void BindMouseEnter(this IController controller, IViewCommand<OxyMouseEventArgs> command)
{
controller.Bind(new OxyMouseEnterGesture(), command);
}
/// <summary>
/// Binds the mouse wheel event to the specified command.
/// </summary>
/// <param name="controller">The plot controller.</param>
/// <param name="command">A plot controller command that takes mouse wheel event arguments.</param>
public static void BindMouseWheel(this IController controller, IViewCommand<OxyMouseWheelEventArgs> command)
{
controller.Bind(new OxyMouseWheelGesture(), command);
}
/// <summary>
/// Binds the modifier+mouse wheel event to the specified command.
/// </summary>
/// <param name="controller">The plot controller.</param>
/// <param name="modifiers">The modifier key(s).</param>
/// <param name="command">A plot controller command that takes mouse wheel event arguments.</param>
public static void BindMouseWheel(this IController controller, OxyModifierKeys modifiers, IViewCommand<OxyMouseWheelEventArgs> command)
{
controller.Bind(new OxyMouseWheelGesture(modifiers), command);
}
/// <summary>
/// Unbinds the specified mouse down gesture.
/// </summary>
/// <param name="controller">The controller.</param>
/// <param name="mouseButton">The mouse button.</param>
/// <param name="modifiers">The modifier keys.</param>
/// <param name="clickCount">The click count.</param>
public static void UnbindMouseDown(this IController controller, OxyMouseButton mouseButton, OxyModifierKeys modifiers = OxyModifierKeys.None, int clickCount = 1)
{
controller.Unbind(new OxyMouseDownGesture(mouseButton, modifiers, clickCount));
}
/// <summary>
/// Unbinds the specified key down gesture.
/// </summary>
/// <param name="controller">The controller.</param>
/// <param name="key">The key.</param>
/// <param name="modifiers">The modifier keys.</param>
public static void UnbindKeyDown(this IController controller, OxyKey key, OxyModifierKeys modifiers = OxyModifierKeys.None)
{
controller.Unbind(new OxyKeyGesture(key, modifiers));
}
/// <summary>
/// Unbinds the mouse enter gesture.
/// </summary>
/// <param name="controller">The controller.</param>
public static void UnbindMouseEnter(this IController controller)
{
controller.Unbind(new OxyMouseEnterGesture());
}
/// <summary>
/// Unbinds the touch down gesture.
/// </summary>
/// <param name="controller">The controller.</param>
public static void UnbindTouchDown(this IController controller)
{
controller.Unbind(new OxyTouchGesture());
}
/// <summary>
/// Unbinds the mouse wheel gesture.
/// </summary>
/// <param name="controller">The controller.</param>
public static void UnbindMouseWheel(this IController controller)
{
controller.Unbind(new OxyMouseWheelGesture());
}
}
}