2003-01-24 18:19:27 +03:00
|
|
|
#ifndef _LAYER_H_
|
|
|
|
#define _LAYER_H_
|
|
|
|
|
|
|
|
#include <GraphicsDefs.h>
|
|
|
|
#include <Rect.h>
|
|
|
|
#include <Region.h>
|
|
|
|
#include <List.h>
|
|
|
|
#include <String.h>
|
|
|
|
#include <OS.h>
|
2003-02-07 20:30:17 +03:00
|
|
|
#include <Locker.h>
|
2004-02-24 15:02:47 +03:00
|
|
|
#include "RGBColor.h"
|
2003-01-24 18:19:27 +03:00
|
|
|
|
|
|
|
class ServerWindow;
|
2003-02-12 14:24:26 +03:00
|
|
|
class RootLayer;
|
2004-02-24 15:02:47 +03:00
|
|
|
//class MyDriver;
|
2003-11-14 03:15:29 +03:00
|
|
|
class DisplayDriver;
|
2004-02-24 15:02:47 +03:00
|
|
|
class LayerData;
|
2003-01-24 18:19:27 +03:00
|
|
|
|
|
|
|
class Layer
|
|
|
|
{
|
|
|
|
public:
|
2004-01-13 03:56:36 +03:00
|
|
|
Layer(BRect frame, const char *name, int32 token, uint32 resize,
|
2004-02-24 15:02:47 +03:00
|
|
|
uint32 flags, DisplayDriver *driver);
|
2004-01-13 03:56:36 +03:00
|
|
|
virtual ~Layer(void);
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2004-02-24 15:02:47 +03:00
|
|
|
void AddChild(Layer *child, RootLayer *rootLayer = NULL);
|
2004-01-13 03:56:36 +03:00
|
|
|
void RemoveChild(Layer *child);
|
|
|
|
void RemoveSelf();
|
2004-02-24 15:02:47 +03:00
|
|
|
bool HasChild(Layer* layer);
|
|
|
|
RootLayer* GetRootLayer() const { return fRootLayer; }
|
2004-01-13 03:56:36 +03:00
|
|
|
|
|
|
|
uint32 CountChildren(void) const;
|
|
|
|
Layer* FindLayer(const int32 token);
|
|
|
|
Layer* LayerAt(const BPoint &pt);
|
2004-03-28 19:01:46 +04:00
|
|
|
bool IsTopLayer() { return fIsTopLayer; }
|
2004-01-13 03:56:36 +03:00
|
|
|
|
2004-02-24 15:02:47 +03:00
|
|
|
virtual Layer* VirtualTopChild() const;
|
|
|
|
virtual Layer* VirtualLowerSibling() const;
|
|
|
|
virtual Layer* VirtualUpperSibling() const;
|
|
|
|
virtual Layer* VirtualBottomChild() const;
|
2004-01-13 03:56:36 +03:00
|
|
|
|
|
|
|
const char* GetName(void) const { return (_name)?_name->String():NULL; }
|
2004-01-12 01:12:55 +03:00
|
|
|
|
2004-02-24 15:02:47 +03:00
|
|
|
void FullInvalidate(const BRect &rect);
|
|
|
|
void FullInvalidate(const BRegion ®ion);
|
2004-01-13 03:56:36 +03:00
|
|
|
void Invalidate(const BRegion ®ion);
|
2004-02-24 15:02:47 +03:00
|
|
|
|
2004-03-28 19:01:46 +04:00
|
|
|
virtual void RebuildFullRegion(void);
|
2004-02-24 15:02:47 +03:00
|
|
|
void StartRebuildRegions( const BRegion& reg, Layer *target, uint32 action, BPoint& pt);
|
|
|
|
void RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint ptOffset);
|
|
|
|
uint32 ResizeOthers(float x, float y, BPoint coords[], BPoint *ptOffset);
|
|
|
|
|
|
|
|
void Redraw(const BRegion& reg, Layer *startFrom=NULL);
|
|
|
|
|
|
|
|
void EmptyGlobals();
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
virtual void Draw(const BRect &r);
|
|
|
|
|
2004-02-24 15:02:47 +03:00
|
|
|
void SendViewMovedMsg();
|
|
|
|
void SendViewResizedMsg();
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
virtual void Show(void);
|
|
|
|
virtual void Hide(void);
|
|
|
|
bool IsHidden(void) const;
|
|
|
|
|
|
|
|
BRect Bounds(void) const;
|
|
|
|
BRect Frame(void) const;
|
|
|
|
|
|
|
|
virtual void MoveBy(float x, float y);
|
|
|
|
virtual void ResizeBy(float x, float y);
|
|
|
|
|
|
|
|
BRect ConvertToParent(BRect rect);
|
|
|
|
BRegion ConvertToParent(BRegion *reg);
|
|
|
|
BRect ConvertFromParent(BRect rect);
|
|
|
|
BRegion ConvertFromParent(BRegion *reg);
|
|
|
|
BRegion ConvertToTop(BRegion *reg);
|
|
|
|
BRect ConvertToTop(BRect rect);
|
|
|
|
BRegion ConvertFromTop(BRegion *reg);
|
|
|
|
BRect ConvertFromTop(BRect rect);
|
|
|
|
|
2004-02-24 15:02:47 +03:00
|
|
|
DisplayDriver* GetDisplayDriver() const { return fDriver; }
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
void PruneTree(void);
|
|
|
|
|
|
|
|
void PrintToStream(void);
|
|
|
|
void PrintNode(void);
|
|
|
|
void PrintTree();
|
|
|
|
|
|
|
|
// server "private" - should not be used
|
2004-02-24 15:02:47 +03:00
|
|
|
void SetRootLayer(RootLayer* rl){ fRootLayer = rl; }
|
|
|
|
void SetServerWindow(ServerWindow *win);
|
2004-03-28 19:01:46 +04:00
|
|
|
void SetAsTopLayer(bool option) { fIsTopLayer = option; }
|
2004-02-24 15:02:47 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
void RequestClientUpdate(const BRegion ®, Layer *startFrom);
|
|
|
|
void RequestDraw(const BRegion ®, Layer *startFrom, bool redraw=false);
|
|
|
|
ServerWindow* SearchForServerWindow() const;
|
|
|
|
|
2003-01-24 18:19:27 +03:00
|
|
|
protected:
|
2003-06-23 06:54:52 +04:00
|
|
|
friend class RootLayer;
|
|
|
|
friend class WinBorder;
|
2003-08-31 21:38:34 +04:00
|
|
|
friend class Screen;
|
2003-09-09 01:18:39 +04:00
|
|
|
friend class ServerWindow;
|
2004-01-13 03:56:36 +03:00
|
|
|
friend class Desktop;
|
|
|
|
friend class Workspace;
|
2004-02-24 15:02:47 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
BRect _frame;
|
|
|
|
BPoint _boundsLeftTop;
|
|
|
|
Layer *_parent,
|
|
|
|
*_uppersibling,
|
|
|
|
*_lowersibling,
|
|
|
|
*_topchild,
|
|
|
|
*_bottomchild;
|
|
|
|
|
2004-02-24 15:02:47 +03:00
|
|
|
mutable Layer *fCurrent;
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
BRegion _visible,
|
|
|
|
_fullVisible,
|
2004-02-24 15:02:47 +03:00
|
|
|
_full,
|
|
|
|
fUpdateReg;
|
2004-01-13 03:56:36 +03:00
|
|
|
|
|
|
|
BRegion *clipToPicture;
|
|
|
|
bool clipToPictureInverse;
|
|
|
|
|
|
|
|
ServerWindow *_serverwin;
|
|
|
|
BString *_name;
|
|
|
|
int32 _view_token;
|
|
|
|
int32 _level;
|
|
|
|
uint32 _flags;
|
|
|
|
uint32 _resize_mode;
|
|
|
|
bool _hidden;
|
|
|
|
bool _is_updating;
|
2004-03-28 19:01:46 +04:00
|
|
|
bool fIsTopLayer;
|
2004-02-24 15:02:47 +03:00
|
|
|
|
|
|
|
DisplayDriver *fDriver;
|
2004-01-13 03:56:36 +03:00
|
|
|
LayerData *_layerdata;
|
2004-04-03 19:09:10 +04:00
|
|
|
// RGBColor fBackColor;
|
2004-02-24 15:02:47 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
RootLayer* fRootLayer;
|
2003-01-24 18:19:27 +03:00
|
|
|
};
|
|
|
|
|
2003-02-07 20:30:17 +03:00
|
|
|
#endif
|