blob: 952faeac6349b67c2c8f84c5b222a3f6087176ef [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();
tfarina@chromium.org1d3c4112012-12-03 14:38:08 +000037 virtual bool addChild(SkAnimateMaker& , SkDisplayable* child) SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000038 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& );
48protected:
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