• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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      bool addChild(SkAnimateMaker& , SkDisplayable* child) override;
38      bool contains(SkDisplayable*) override;
39      SkDisplayable* contains(const SkString& ) override;
40  #ifdef SK_DEBUG
41      void dumpEvent(SkAnimateMaker* );
42  #endif
43      bool enableEvent(SkAnimateMaker& );
44      bool getProperty(int index, SkScriptValue* ) const override;
45      void onEndElement(SkAnimateMaker& maker) override;
46      void populateInput(SkAnimateMaker& , const SkEvent& fEvent);
47      bool setProperty(int index, SkScriptValue& ) override;
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