00001 #ifndef _RECT_CACHE_H_ 00002 #define _RECT_CACHE_H_ 00003 00004 #include "woopsiarray.h" 00005 #include "gadget.h" 00006 00007 namespace WoopsiUI { 00008 00014 class RectCache { 00015 public: 00016 00021 RectCache(const Gadget* gadget); 00022 00026 inline ~RectCache() { }; 00027 00031 void cache(); 00032 00036 inline void invalidate() { 00037 _foregroundInvalid = true; 00038 _backgroundInvalid = true; 00039 }; 00040 00046 inline WoopsiArray<Rect>* getBackgroundRegions() { return &_backgroundRegions; }; 00047 00055 inline WoopsiArray<Rect>* getForegroundRegions() { return &_foregroundRegions; }; 00056 00069 void splitRectangles(WoopsiArray<Rect>* invalidRectangles, WoopsiArray<Rect>* validRects, const Gadget* sender) const; 00070 00079 void removeOverlappedRects(WoopsiArray<Rect>* visibleRects, WoopsiArray<Rect>* invisibleRects, const Gadget* gadget) const; 00080 00081 private: 00082 WoopsiArray<Rect> _foregroundRegions; 00083 WoopsiArray<Rect> _backgroundRegions; 00084 const Gadget* _gadget; 00085 bool _foregroundInvalid; 00086 bool _backgroundInvalid; 00091 void cacheForegroundRegions(); 00092 00096 void cacheBackgroundRegions(); 00097 00098 }; 00099 } 00100 00101 #endif