Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: samples/ui_lib/touch/TouchUtil.dart

Issue 10928139: Changed interfaces to abstract classes where possible in {lib,samples,pkg} (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Wraps a callback with translations of mouse events to touch events. Use 6 * Wraps a callback with translations of mouse events to touch events. Use
7 * this function to invoke your callback that expects touch events after 7 * this function to invoke your callback that expects touch events after
8 * touch events are created from the actual mouse events. 8 * touch events are created from the actual mouse events.
9 */ 9 */
10 EventListener mouseToTouchCallback(EventListener callback) { 10 EventListener mouseToTouchCallback(EventListener callback) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 while (target != null) { 97 while (target != null) {
98 if (target == node) { 98 if (target == node) {
99 return true; 99 return true;
100 } 100 }
101 target = target.parent; 101 target = target.parent;
102 } 102 }
103 103
104 return false; 104 return false;
105 } 105 }
106 106
107 interface Touchable { 107 abstract class Touchable {
108 /** 108 /**
109 * Provide the HTML element that should respond to touch events. 109 * Provide the HTML element that should respond to touch events.
110 */ 110 */
111 Element getElement(); 111 Element getElement();
112 112
113 /** 113 /**
114 * The object has received a touchend event. 114 * The object has received a touchend event.
115 */ 115 */
116 void onTouchEnd(); 116 void onTouchEnd();
117 117
118 /** 118 /**
119 * The object has received a touchstart event. 119 * The object has received a touchstart event.
120 * Returns return true if you want to allow a drag sequence to begin, 120 * Returns return true if you want to allow a drag sequence to begin,
121 * false you want to disable dragging for the duration of this touch. 121 * false you want to disable dragging for the duration of this touch.
122 */ 122 */
123 bool onTouchStart(TouchEvent e); 123 bool onTouchStart(TouchEvent e);
124 } 124 }
125 125
126 interface Draggable extends Touchable { 126 abstract class Draggable implements Touchable {
127 /** 127 /**
128 * The object's drag sequence is now complete. 128 * The object's drag sequence is now complete.
129 */ 129 */
130 void onDragEnd(); 130 void onDragEnd();
131 131
132 /** 132 /**
133 * The object has been dragged to a new position. 133 * The object has been dragged to a new position.
134 */ 134 */
135 void onDragMove(); 135 void onDragMove();
136 136
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 int get which => wrapped.which; 233 int get which => wrapped.which;
234 234
235 bool get altKey => wrapped.altKey; 235 bool get altKey => wrapped.altKey;
236 236
237 bool get ctrlKey => wrapped.ctrlKey; 237 bool get ctrlKey => wrapped.ctrlKey;
238 238
239 bool get metaKey => wrapped.metaKey; 239 bool get metaKey => wrapped.metaKey;
240 240
241 bool get shiftKey => wrapped.shiftKey; 241 bool get shiftKey => wrapped.shiftKey;
242 } 242 }
OLDNEW
« pkg/unittest/interfaces.dart ('K') | « samples/ui_lib/touch/ScrollWatcher.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698