blob: d223771a7d60be9c7877cc14f9fc98bacd89a1b8 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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
reed@android.com8a1c16f2008-12-17 15:59:43 +00009
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
18class SkEvent;
19
20class 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();
mtklein36352bf2015-03-25 18:17:31 -070037 bool addChild(SkAnimateMaker& , SkDisplayable* child) override;
38 bool contains(SkDisplayable*) override;
39 SkDisplayable* contains(const SkString& ) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000040#ifdef SK_DEBUG
41 void dumpEvent(SkAnimateMaker* );
42#endif
43 bool enableEvent(SkAnimateMaker& );
mtklein36352bf2015-03-25 18:17:31 -070044 bool getProperty(int index, SkScriptValue* ) const override;
45 void onEndElement(SkAnimateMaker& maker) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000046 void populateInput(SkAnimateMaker& , const SkEvent& fEvent);
mtklein36352bf2015-03-25 18:17:31 -070047 bool setProperty(int index, SkScriptValue& ) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000048protected:
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
60private:
61 void deleteMembers();
62 friend class SkEvents;
63 typedef SkDisplayable INHERITED;
64};
65
66#endif // SkDisplayEvent_DEFINED