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:
@@ -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 ®ion)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void WinBorder::set_user_regions(BRegion ®)
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
@@ -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 ®ion);
|
||||||
|
virtual void set_user_regions(BRegion ®);
|
||||||
|
|
||||||
|
BRegion fDecRegion;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user