Home | History | Annotate | Download | only in animator
      1 /* libs/graphics/animator/SkDisplayEvent.h
      2 **
      3 ** Copyright 2006, The Android Open Source Project
      4 **
      5 ** Licensed under the Apache License, Version 2.0 (the "License");
      6 ** you may not use this file except in compliance with the License.
      7 ** You may obtain a copy of the License at
      8 **
      9 **     http://www.apache.org/licenses/LICENSE-2.0
     10 **
     11 ** Unless required by applicable law or agreed to in writing, software
     12 ** distributed under the License is distributed on an "AS IS" BASIS,
     13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 ** See the License for the specific language governing permissions and
     15 ** limitations under the License.
     16 */
     17 
     18 #ifndef SkDisplayEvent_DEFINED
     19 #define SkDisplayEvent_DEFINED
     20 
     21 #include "SkDisplayable.h"
     22 #include "SkMemberInfo.h"
     23 #include "SkIntArray.h"
     24 #include "SkKey.h"
     25 
     26 class SkEvent;
     27 
     28 class SkDisplayEvent : public SkDisplayable {
     29     DECLARE_DISPLAY_MEMBER_INFO(Event);
     30     enum Kind {
     31         kNo_kind,
     32         kKeyChar,
     33         kKeyPress,
     34         kKeyPressUp,    //i assume the order here is intended to match with skanimatorscript.cpp
     35         kMouseDown,
     36         kMouseDrag,
     37         kMouseMove,
     38         kMouseUp,
     39         kOnEnd,
     40         kOnload,
     41         kUser
     42     };
     43     SkDisplayEvent();
     44     virtual ~SkDisplayEvent();
     45     virtual bool add(SkAnimateMaker& , SkDisplayable* child);
     46     virtual bool contains(SkDisplayable*);
     47     virtual SkDisplayable* contains(const SkString& );
     48 #ifdef SK_DEBUG
     49     void dumpEvent(SkAnimateMaker* );
     50 #endif
     51     bool enableEvent(SkAnimateMaker& );
     52     virtual bool getProperty(int index, SkScriptValue* ) const;
     53     virtual void onEndElement(SkAnimateMaker& maker);
     54     void populateInput(SkAnimateMaker& , const SkEvent& fEvent);
     55     virtual bool setProperty(int index, SkScriptValue& );
     56 protected:
     57     SkKey code;
     58     SkBool disable;
     59     Kind kind;
     60     SkString target;
     61     SkScalar x;
     62     SkScalar y;
     63     SkTDDisplayableArray fChildren;
     64     mutable SkString fKeyString;
     65     SkKey fLastCode; // last key to trigger this event
     66     SkKey fMax; // if the code expresses a range
     67     SkDisplayable* fTarget; // used by onEnd
     68 private:
     69     void deleteMembers();
     70     friend class SkEvents;
     71     typedef SkDisplayable INHERITED;
     72 };
     73 
     74 #endif // SkDisplayEvent_DEFINED
     75 
     76