headers/bsd: Add sys/queue.h.
[haiku.git] / src / tests / servers / app / newClipping / Layer.h
blobd83a67dbc5b91d424d07b796cdc177d97732e147
2 #ifndef __LAYER_H__
3 #define __LAYER_H__
5 #include <OS.h>
6 #include <Region.h>
7 #include <Rect.h>
8 #include <GraphicsDefs.h>
10 class MyView;
12 class Layer
14 public:
15 Layer(BRect frame, const char* name, uint32 rm, uint32 flags, rgb_color c);
16 virtual ~Layer();
18 void AddLayer(Layer* layer);
19 bool RemLayer(Layer* layer);
21 void MoveBy(float dx, float dy);
22 void ResizeBy(float dx, float dy);
23 void ScrollBy(float dx, float dy);
25 bool IsHidden() const;
26 void Hide();
27 void Show();
29 void Invalidate( const BRegion &invalid,
30 const Layer *startFrom = NULL);
32 virtual void MovedByHook(float dx, float dy) { }
33 virtual void ResizedByHook(float dx, float dy, bool automatic) { }
34 virtual void ScrolledByHook(float dx, float dy) { }
36 Layer* BottomChild() const;
37 Layer* TopChild() const;
38 Layer* UpperSibling() const;
39 Layer* LowerSibling() const;
41 void RebuildVisibleRegions( const BRegion &invalid,
42 const Layer *startFrom);
43 void ConvertToScreen2(BRect* rect) const;
44 void ConvertToScreen2(BRegion* reg) const;
45 MyView* GetRootLayer() const;
46 void SetRootLayer(MyView* view) { fView = view; }
48 BRegion* Visible() { return &fVisible; }
49 BRegion* FullVisible() { return &fFullVisible; }
50 void GetWantedRegion(BRegion &reg);
52 BRect Frame() const { return fFrame; }
53 BRect Bounds() const { BRect r(fFrame);
54 r.OffsetTo(fOrigin);
55 return r; }
56 const char* Name() const { return fName; }
57 Layer* Parent() const { return fParent; }
58 void PrintToStream() const;
59 bool IsTopLayer() const { return fView? true: false; }
61 rgb_color HighColor() const { return fColor; }
63 void rebuild_visible_regions(const BRegion &invalid,
64 const BRegion &parentLocalVisible,
65 const Layer *startFrom);
66 protected:
67 rgb_color fColor;
69 private:
70 virtual bool alter_visible_for_children(BRegion &region);
71 virtual void get_user_regions(BRegion &reg);
73 void clear_visible_regions();
74 void resize_layer_frame_by(float x, float y);
75 void rezize_layer_redraw_more(BRegion &reg, float dx, float dy);
76 void resize_layer_full_update_on_resize(BRegion &reg, float dx, float dy);
78 char fName[50];
79 BRegion fVisible;
80 BRegion fFullVisible;
82 BRect fFrame;
83 BPoint fOrigin;
84 uint32 fResizeMode;
86 Layer* fBottom;
87 Layer* fUpper;
88 Layer* fLower;
89 Layer* fTop;
90 Layer* fParent;
91 mutable Layer* fCurrent;
93 uint32 fFlags;
94 bool fHidden;
96 MyView* fView;
99 #endif