#ifndef VIEW_LAYER_H
#define VIEW_LAYER_H
#include <GraphicsDefs.h>
#include <Region.h>
#include <String.h>
class BList;
class DrawingEngine;
class WindowLayer;
class ViewLayer {
public:
ViewLayer(BRect frame,
const char* name,
uint32 reizeMode,
uint32 flags,
rgb_color viewColor);
virtual ~ViewLayer();
inline BRect Frame() const
{ return fFrame; }
BRect Bounds() const;
void ConvertToVisibleInTopView(BRect* bounds) const;
inline rgb_color ViewColor() const
{ return fViewColor; }
void AttachedToWindow(WindowLayer* window);
void DetachedFromWindow();
void AddChild(ViewLayer* layer);
bool RemoveChild(ViewLayer* layer);
inline ViewLayer* Parent() const
{ return fParent; }
ViewLayer* FirstChild() const;
ViewLayer* PreviousChild() const;
ViewLayer* NextChild() const;
ViewLayer* LastChild() const;
ViewLayer* TopLayer();
uint32 CountChildren(bool deep = false) const;
void CollectTokensForChildren(BList* tokenMap) const;
ViewLayer* ViewAt(const BPoint& where,
BRegion* windowContentClipping);
void ConvertToParent(BPoint* point) const;
void ConvertToParent(BRect* rect) const;
void ConvertToParent(BRegion* region) const;
void ConvertFromParent(BPoint* point) const;
void ConvertFromParent(BRect* rect) const;
void ConvertFromParent(BRegion* region) const;
void ConvertToTop(BPoint* point) const;
void ConvertToTop(BRect* rect) const;
void ConvertToTop(BRegion* region) const;
void ConvertFromTop(BPoint* point) const;
void ConvertFromTop(BRect* rect) const;
void ConvertFromTop(BRegion* region) const;
void SetName(const char* string);
inline const char* Name() const
{ return fName.String(); }
void MoveBy( int32 dx, int32 dy,
BRegion* dirtyRegion);
void ResizeBy( int32 dx, int32 dy,
BRegion* dirtyRegion);
void ScrollBy( int32 dx, int32 dy,
BRegion* dirtyRegion);
void ParentResized( int32 dx, int32 dy,
BRegion* dirtyRegion);
void Draw( DrawingEngine* drawingEngine,
BRegion* effectiveClipping,
BRegion* windowContentClipping,
bool deep = false);
void ClientDraw( DrawingEngine* drawingEngine,
BRegion* effectiveClipping);
void SetHidden(bool hidden);
bool IsHidden() const;
bool IsVisible() const
{ return fVisible; }
void UpdateVisibleDeep(bool parentVisible);
void RebuildClipping(bool deep);
BRegion& ScreenClipping(BRegion* windowContentClipping,
bool force = false) const;
void InvalidateScreenClipping(bool deep);
void PrintToStream() const;
private:
void _MoveScreenClipping(int32 x, int32 y,
bool deep);
BString fName;
BRect fFrame;
BPoint fScrollingOffset;
rgb_color fViewColor;
uint32 fResizeMode;
uint32 fFlags;
bool fHidden;
bool fVisible;
WindowLayer* fWindow;
ViewLayer* fParent;
ViewLayer* fFirstChild;
ViewLayer* fPreviousSibling;
ViewLayer* fNextSibling;
ViewLayer* fLastChild;
mutable ViewLayer* fCurrentChild;
BRegion fLocalClipping;
mutable BRegion fScreenClipping;
mutable bool fScreenClippingValid;
};
#endif