Home | History | Annotate | Download | only in animator
      1 
      2 /*
      3  * Copyright 2006 The Android Open Source Project
      4  *
      5  * Use of this source code is governed by a BSD-style license that can be
      6  * found in the LICENSE file.
      7  */
      8 
      9 
     10 #ifndef SkDisplayEvent_DEFINED
     11 #define SkDisplayEvent_DEFINED
     12 
     13 #include "SkDisplayable.h"
     14 #include "SkMemberInfo.h"
     15 #include "SkIntArray.h"
     16 #include "SkKey.h"
     17 
     18 class SkEvent;
     19 
     20 class SkDisplayEvent : public SkDisplayable {
     21     DECLARE_DISPLAY_MEMBER_INFO(Event);
     22     enum Kind {
     23         kNo_kind,
     24         kKeyChar,
     25         kKeyPress,
     26         kKeyPressUp,    //i assume the order here is intended to match with skanimatorscript.cpp
     27         kMouseDown,
     28         kMouseDrag,
     29         kMouseMove,
     30         kMouseUp,
     31         kOnEnd,
     32         kOnload,
     33         kUser
     34     };
     35     SkDisplayEvent();
     36     virtual ~SkDisplayEvent();
     37     virtual bool addChild(SkAnimateMaker& , SkDisplayable* child) SK_OVERRIDE;
     38     virtual bool contains(SkDisplayable*);
     39     virtual SkDisplayable* contains(const SkString& );
     40 #ifdef SK_DEBUG
     41     void dumpEvent(SkAnimateMaker* );
     42 #endif
     43     bool enableEvent(SkAnimateMaker& );
     44     virtual bool getProperty(int index, SkScriptValue* ) const;
     45     virtual void onEndElement(SkAnimateMaker& maker);
     46     void populateInput(SkAnimateMaker& , const SkEvent& fEvent);
     47     virtual bool setProperty(int index, SkScriptValue& );
     48 protected:
     49     SkKey code;
     50     SkBool disable;
     51     Kind kind;
     52     SkString target;
     53     SkScalar x;
     54     SkScalar y;
     55     SkTDDisplayableArray fChildren;
     56     mutable SkString fKeyString;
     57     SkKey fLastCode; // last key to trigger this event
     58     SkKey fMax; // if the code expresses a range
     59     SkDisplayable* fTarget; // used by onEnd
     60 private:
     61     void deleteMembers();
     62     friend class SkEvents;
     63     typedef SkDisplayable INHERITED;
     64 };
     65 
     66 #endif // SkDisplayEvent_DEFINED
     67