diff options
author | Derek Sollenberger <djsollen@google.com> | 2012-02-06 13:31:51 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-02-06 13:31:51 -0800 |
commit | 0a6004fdb6c99bccb8bc0bb9686616870dae73f3 (patch) | |
tree | 2852f9dc2481f639122e18fc7831ae6ca43d6d5a /include/views/SkEventSink.h | |
parent | e2d01455540d4414ebfc6acb06f06d357849335c (diff) | |
parent | 1cab2921ab279367f8206cdadc9259d12e603548 (diff) | |
download | external_skia-0a6004fdb6c99bccb8bc0bb9686616870dae73f3.zip external_skia-0a6004fdb6c99bccb8bc0bb9686616870dae73f3.tar.gz external_skia-0a6004fdb6c99bccb8bc0bb9686616870dae73f3.tar.bz2 |
am 1cab2921: Skia merge (revision 3022)
* commit '1cab2921ab279367f8206cdadc9259d12e603548':
Skia merge (revision 3022)
Diffstat (limited to 'include/views/SkEventSink.h')
-rw-r--r-- | include/views/SkEventSink.h | 92 |
1 files changed, 49 insertions, 43 deletions
diff --git a/include/views/SkEventSink.h b/include/views/SkEventSink.h index 27a6743..69981fa 100644 --- a/include/views/SkEventSink.h +++ b/include/views/SkEventSink.h @@ -1,19 +1,12 @@ + /* - * Copyright (C) 2006 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * Copyright 2006 The Android Open Source Project * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + #ifndef SkEventSink_DEFINED #define SkEventSink_DEFINED @@ -31,53 +24,66 @@ public: SkEventSink(); virtual ~SkEventSink(); - /** Returns this eventsink's unique ID. Use this to post SkEvents to - this eventsink. - */ + /** + * Returns this eventsink's unique ID. Use this to post SkEvents to + * this eventsink. + */ SkEventSinkID getSinkID() const { return fID; } - /** Call this to pass an event to this object for processing. Returns true if the - event was handled. - */ + /** + * Call this to pass an event to this object for processing. Returns true if the + * event was handled. + */ bool doEvent(const SkEvent&); + /** Returns true if the sink (or one of its subclasses) understands the event as a query. If so, the sink may modify the event to communicate its "answer". */ bool doQuery(SkEvent* query); - /** Add sinkID to the list of listeners, to receive events from calls to sendToListeners() - and postToListeners(). If sinkID already exists in the listener list, no change is made. - */ - void addListenerID(SkEventSinkID sinkID); - /** Copy listeners from one event sink to another, typically from parent to child. - @param from the event sink to copy the listeners from - */ + /** + * Add sinkID to the list of listeners, to receive events from calls to sendToListeners() + * and postToListeners(). If sinkID already exists in the listener list, no change is made. + */ + void addListenerID(SkEventSinkID sinkID); + + /** + * Copy listeners from one event sink to another, typically from parent to child. + * @param from the event sink to copy the listeners from + */ void copyListeners(const SkEventSink& from); - /** Remove sinkID from the list of listeners. If sinkID does not appear in the list, - no change is made. - */ - void removeListenerID(SkEventSinkID); - /** Returns true if there are 1 or more listeners attached to this eventsink - */ - bool hasListeners() const; - /** Posts a copy of evt to each of the eventsinks in the lisener list. - */ - void postToListeners(const SkEvent& evt, SkMSec delay = 0); + + /** + * Remove sinkID from the list of listeners. If sinkID does not appear in the list, + * no change is made. + */ + void removeListenerID(SkEventSinkID); + + /** + * Returns true if there are 1 or more listeners attached to this eventsink + */ + bool hasListeners() const; + + /** + * Posts a copy of evt to each of the eventsinks in the lisener list. + * This ignores the targetID and target proc in evt. + */ + void postToListeners(const SkEvent& evt, SkMSec delay = 0); enum EventResult { kHandled_EventResult, //!< the eventsink returned true from its doEvent method kNotHandled_EventResult, //!< the eventsink returned false from its doEvent method kSinkNotFound_EventResult //!< no matching eventsink was found for the event's getSink(). }; - /** DoEvent handles searching for an eventsink object that matches the targetID. - If one is found, it calls the sink's doEvent method, returning - either kHandled_EventResult or kNotHandled_EventResult. If no matching - eventsink is found, kSinkNotFound_EventResult is returned. - */ - static EventResult DoEvent(const SkEvent&, SkEventSinkID targetID); - /** Returns the matching eventsink, or null if not found - */ + /** + * DoEvent handles dispatching the event to its target ID or proc. + */ + static EventResult DoEvent(const SkEvent&); + + /** + * Returns the matching eventsink, or null if not found + */ static SkEventSink* FindSink(SkEventSinkID); protected: |