00001 #ifndef SkDrawable_DEFINED 00002 #define SkDrawable_DEFINED 00003 00004 #include "SkFlattenable.h" 00005 #include "SkMatrix.h" 00006 00007 class SkCanvas; 00008 struct SkRect; 00009 00010 class SkDrawable : public SkFlattenable { 00011 public: 00012 SkDrawable(); 00013 virtual ~SkDrawable(); 00014 00015 void getMatrix(SkMatrix*) const; 00016 void setMatrix(const SkMatrix&); 00017 void resetMatrix(); 00018 00019 void draw(SkCanvas*); 00020 00021 void inval() {} 00022 00023 SkDrawable* attachChildToFront(SkDrawable* child); 00024 SkDrawable* attachChildToBack(SkDrawable* child); 00025 00026 SkDrawable* getParent() const { return fParent; } 00027 void detachFromParent(); 00028 void detachAllChildren(); 00029 00030 class B2FIter { 00031 public: 00032 B2FIter(const SkDrawable* parent); 00033 SkDrawable* next(); 00034 private: 00035 SkDrawable* fFirstChild; 00036 SkDrawable* fChild; 00037 }; 00038 00039 protected: 00040 virtual void onDraw(SkCanvas*) {} 00041 00042 private: 00043 SkMatrix fMatrix; 00044 00045 SkDrawable* fParent; 00046 SkDrawable* fFirstChild; 00047 SkDrawable* fNextSibling; 00048 SkDrawable* fPrevSibling; 00049 00050 typedef SkFlattenable INHERITED; 00051 }; 00052 00053 #endif 00054