1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/animator/SkDisplayEvent.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,66 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2006 The Android Open Source Project 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 + 1.12 + 1.13 +#ifndef SkDisplayEvent_DEFINED 1.14 +#define SkDisplayEvent_DEFINED 1.15 + 1.16 +#include "SkDisplayable.h" 1.17 +#include "SkMemberInfo.h" 1.18 +#include "SkIntArray.h" 1.19 +#include "SkKey.h" 1.20 + 1.21 +class SkEvent; 1.22 + 1.23 +class SkDisplayEvent : public SkDisplayable { 1.24 + DECLARE_DISPLAY_MEMBER_INFO(Event); 1.25 + enum Kind { 1.26 + kNo_kind, 1.27 + kKeyChar, 1.28 + kKeyPress, 1.29 + kKeyPressUp, //i assume the order here is intended to match with skanimatorscript.cpp 1.30 + kMouseDown, 1.31 + kMouseDrag, 1.32 + kMouseMove, 1.33 + kMouseUp, 1.34 + kOnEnd, 1.35 + kOnload, 1.36 + kUser 1.37 + }; 1.38 + SkDisplayEvent(); 1.39 + virtual ~SkDisplayEvent(); 1.40 + virtual bool addChild(SkAnimateMaker& , SkDisplayable* child) SK_OVERRIDE; 1.41 + virtual bool contains(SkDisplayable*); 1.42 + virtual SkDisplayable* contains(const SkString& ); 1.43 +#ifdef SK_DEBUG 1.44 + void dumpEvent(SkAnimateMaker* ); 1.45 +#endif 1.46 + bool enableEvent(SkAnimateMaker& ); 1.47 + virtual bool getProperty(int index, SkScriptValue* ) const; 1.48 + virtual void onEndElement(SkAnimateMaker& maker); 1.49 + void populateInput(SkAnimateMaker& , const SkEvent& fEvent); 1.50 + virtual bool setProperty(int index, SkScriptValue& ); 1.51 +protected: 1.52 + SkKey code; 1.53 + SkBool disable; 1.54 + Kind kind; 1.55 + SkString target; 1.56 + SkScalar x; 1.57 + SkScalar y; 1.58 + SkTDDisplayableArray fChildren; 1.59 + mutable SkString fKeyString; 1.60 + SkKey fLastCode; // last key to trigger this event 1.61 + SkKey fMax; // if the code expresses a range 1.62 + SkDisplayable* fTarget; // used by onEnd 1.63 +private: 1.64 + void deleteMembers(); 1.65 + friend class SkEvents; 1.66 + typedef SkDisplayable INHERITED; 1.67 +}; 1.68 + 1.69 +#endif // SkDisplayEvent_DEFINED