#include <SkEventSink.h>
Inherits SkRefCnt.
Inherited by SkAnimator, SkListSource, and SkView.
Public Types | |
enum | EventResult { kHandled_EventResult, kNotHandled_EventResult, kSinkNotFound_EventResult } |
Public Member Functions | |
SkEventSink () | |
virtual | ~SkEventSink () |
SkEventSinkID | getSinkID () const |
bool | doEvent (const SkEvent &) |
bool | doQuery (SkEvent *query) |
void | addListenerID (SkEventSinkID sinkID) |
void | copyListeners (const SkEventSink &from) |
void | removeListenerID (SkEventSinkID) |
bool | hasListeners () const |
void | postToListeners (const SkEvent &evt, SkMSec delay=0) |
Static Public Member Functions | |
static EventResult | DoEvent (const SkEvent &, SkEventSinkID targetID) |
static SkEventSink * | FindSink (SkEventSinkID) |
Protected Member Functions | |
virtual bool | onEvent (const SkEvent &) |
virtual bool | onQuery (SkEvent *) |
SkTagList * | findTagList (U8CPU tag) const |
void | addTagList (SkTagList *) |
void | removeTagList (U8CPU tag) |
SkEventSink is the base class for all objects that receive SkEvents.
Definition at line 29 of file SkEventSink.h.
Definition at line 67 of file SkEventSink.h.
SkEventSink::SkEventSink | ( | ) |
virtual SkEventSink::~SkEventSink | ( | ) | [virtual] |
void SkEventSink::addListenerID | ( | SkEventSinkID | sinkID | ) |
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 SkEventSink::addTagList | ( | SkTagList * | ) | [protected] |
void SkEventSink::copyListeners | ( | const SkEventSink & | from | ) |
Copy listeners from one event sink to another, typically from parent to child.
from | the event sink to copy the listeners from |
static EventResult SkEventSink::DoEvent | ( | const SkEvent & | , | |
SkEventSinkID | targetID | |||
) | [static] |
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.
bool SkEventSink::doEvent | ( | const SkEvent & | ) |
Call this to pass an event to this object for processing. Returns true if the event was handled.
bool SkEventSink::doQuery | ( | SkEvent * | query | ) |
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".
static SkEventSink* SkEventSink::FindSink | ( | SkEventSinkID | ) | [static] |
Returns the matching eventsink, or null if not found
SkTagList* SkEventSink::findTagList | ( | U8CPU | tag | ) | const [protected] |
SkEventSinkID SkEventSink::getSinkID | ( | ) | const [inline] |
Returns this eventsink's unique ID. Use this to post SkEvents to this eventsink.
Definition at line 37 of file SkEventSink.h.
bool SkEventSink::hasListeners | ( | ) | const |
Returns true if there are 1 or more listeners attached to this eventsink
virtual bool SkEventSink::onEvent | ( | const SkEvent & | ) | [protected, virtual] |
Override this to handle events in your subclass. Be sure to call the inherited version for events that you don't handle.
Reimplemented in SkAnimatorView, SkBorderView, SkImageView, SkOSWindow, SkProgressBarView, SkScrollBarView, SkPushButtonWidget, SkCheckBoxWidget, SkListView, SkGridView, SkButtonView, SkListView, and SkWindow.
virtual bool SkEventSink::onQuery | ( | SkEvent * | ) | [protected, virtual] |
Posts a copy of evt to each of the eventsinks in the lisener list.
void SkEventSink::removeListenerID | ( | SkEventSinkID | ) |
Remove sinkID from the list of listeners. If sinkID does not appear in the list, no change is made.
void SkEventSink::removeTagList | ( | U8CPU | tag | ) | [protected] |