Added some support for WinBorders. support B_DOCUMENT_WINDOW_LOOK remains to implemented as the border in this case overlaps the white view area with the resize box

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12861 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2005-05-28 08:53:19 +00:00
parent 1afd64e8b1
commit 67c26792aa
2 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,55 @@
#include <Window.h>
#include "MyView.h"
#include "WinBorder.h"
extern BWindow* wind;
WinBorder::WinBorder(BRect frame, const char* name,
uint32 rm, uint32 flags, rgb_color c)
: Layer(frame, name, rm, flags, c)
{
fColor.red = 255;
fColor.green = 203;
fColor.blue = 0;
}
WinBorder::~WinBorder()
{
}
void WinBorder::set_decorator_region(BRect bounds)
{
// NOTE: frame is in screen coords
fDecRegion.Include(BRect(bounds.left-3, bounds.top-3, bounds.right+3, bounds.top));
fDecRegion.Include(BRect(bounds.left-3, bounds.bottom, bounds.right+3, bounds.bottom+3));
fDecRegion.Include(BRect(bounds.left-3, bounds.top, bounds.left, bounds.bottom));
fDecRegion.Include(BRect(bounds.right, bounds.top, bounds.right+3, bounds.bottom));
fDecRegion.Include(BRect(bounds.left-3, bounds.top-3-10, bounds.left+bounds.Width()/2, bounds.top-3));
// fDecRegion
}
void WinBorder::operate_on_visible(BRegion &region)
{
}
void WinBorder::set_user_regions(BRegion &reg)
{
set_decorator_region(Bounds());
ConvertToScreen2(&fDecRegion);
BRect screenFrame(Bounds());
ConvertToScreen2(&screenFrame);
reg.Set(screenFrame);
wind->Lock();
BRegion screenReg(GetRootLayer()->Bounds());
wind->Unlock();
reg.IntersectWith(&screenReg);
reg.Include(&fDecRegion);
//reg.PrintToStream();
}

View File

@ -0,0 +1,16 @@
#include <Region.h>
#include "Layer.h"
class WinBorder : public Layer
{
public:
WinBorder(BRect frame, const char* name,
uint32 rm, uint32 flags, rgb_color c);
~WinBorder();
private:
void set_decorator_region(BRect frame);
virtual void operate_on_visible(BRegion &region);
virtual void set_user_regions(BRegion &reg);
BRegion fDecRegion;
};