git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7080 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2004-03-28 14:58:39 +00:00
parent 9599477715
commit e9c79f8def
+51 -17
View File
@@ -84,7 +84,6 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
_hidden = true; _hidden = true;
_serverwin = win; _serverwin = win;
fWindow = win;
fMouseButtons = 0; fMouseButtons = 0;
fKeyModifiers = 0; fKeyModifiers = 0;
fMainWinBorder = NULL; fMainWinBorder = NULL;
@@ -94,23 +93,16 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
fLastMousePosition.Set(-1,-1); fLastMousePosition.Set(-1,-1);
SetLevel(); SetLevel();
if (feel == B_NO_BORDER_WINDOW_LOOK) if (feel == B_NO_BORDER_WINDOW_LOOK){
{
fDecFull = NULL;
_full = fWindow->fTopLayer->_full;
} }
else else{
{
fDecorator = new_decorator(r, name, look, feel, flags, fDriver); fDecorator = new_decorator(r, name, look, feel, flags, fDriver);
fDecFull = new BRegion(); fDecFull = new BRegion();
fDecorator->GetFootprint(fDecFull);
fDecorator->GetFootprint( fDecFull );
// our full region is the union between decorator's region and fTopLayer's region
_full = fWindow->fTopLayer->_full;
_full.Include( fDecFull );
} }
_full.MakeEmpty();
STRACE(("WinBorder %s:\n",GetName())); STRACE(("WinBorder %s:\n",GetName()));
STRACE(("\tFrame: (%.1f,%.1f,%.1f,%.1f)\n",r.left,r.top,r.right,r.bottom)); STRACE(("\tFrame: (%.1f,%.1f,%.1f,%.1f)\n",r.left,r.top,r.right,r.bottom));
STRACE(("\tWindow %s\n",win?win->Title():"NULL")); STRACE(("\tWindow %s\n",win?win->Title():"NULL"));
@@ -128,6 +120,21 @@ STRACE(("WinBorder %s:~WinBorder()\n",GetName()));
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void WinBorder::RebuildFullRegion(void){
_full.MakeEmpty();
if(fDecorator)
fDecFull->MakeEmpty();
_serverwin->fTopLayer->RebuildFullRegion();
_full = _serverwin->fTopLayer->_full;
if (fDecorator){
fDecorator->GetFootprint(fDecFull);
_full.Include(fDecFull);
_serverwin->fTopLayer->_full.Exclude(fDecFull);
}
}
//---------------------------------------------------------------------------
void WinBorder::MouseDown(const BPoint &pt, const int32 &buttons, const int32 &modifiers) void WinBorder::MouseDown(const BPoint &pt, const int32 &buttons, const int32 &modifiers)
{ {
// this is important to determine how much we should resize or move the Layer(WinBorder)(window) // this is important to determine how much we should resize or move the Layer(WinBorder)(window)
@@ -150,18 +157,45 @@ void WinBorder::HighlightDecorator(const bool &active)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void WinBorder::Draw(const BRect &r) void WinBorder::Draw(const BRect &r)
{ {
printf("WinBorder(%s)::Draw()\n", GetName());
if(fDecorator){
BRegion reg(r);
reg.IntersectWith(fDecFull);
if (reg.CountRects() > 0){
// restrict Decorator drawing to the update region only.
fDriver->ConstrainClippingRegion(&fUpdateReg);
fUpdateReg.PrintToStream();
fDriver->FillRect(r, fBackColor);
snooze(1000000);
// NOTE: r is NOT transformed from Screen coordinates
fDecorator->Draw(r);
// remove the additional clipping region.
fDriver->ConstrainClippingRegion(NULL);
}
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void WinBorder::MoveBy(float x, float y) void WinBorder::MoveBy(float x, float y)
{ {
if(fDecorator){
fDecorator->MoveBy(x,y);
}
Layer::MoveBy(x,y);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void WinBorder::ResizeBy(float x, float y) void WinBorder::ResizeBy(float x, float y)
{ {
if(fDecorator){
fDecorator->ResizeBy(x,y);
}
Layer::ResizeBy(x,y);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool WinBorder::HasPoint(BPoint& pt) const{ bool WinBorder::HasPoint(BPoint& pt) const{
return _full.Contains(pt); return _fullVisible.Contains(pt);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void WinBorder::SetMainWinBorder(WinBorder *newMain){ void WinBorder::SetMainWinBorder(WinBorder *newMain){
@@ -173,7 +207,7 @@ WinBorder* WinBorder::MainWinBorder() const{
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void WinBorder::SetLevel(){ void WinBorder::SetLevel(){
switch(fWindow->Feel()){ switch(_serverwin->Feel()){
case B_NORMAL_WINDOW_FEEL: case B_NORMAL_WINDOW_FEEL:
_level = B_NORMAL_FEEL; _level = B_NORMAL_FEEL;
break; break;
@@ -201,10 +235,10 @@ void WinBorder::SetLevel(){
// if(_win->ServerTeamID() != _win->ClientTeamID()) // if(_win->ServerTeamID() != _win->ClientTeamID())
// _win->QuietlySetFeel(B_NORMAL_WINDOW_FEEL); // _win->QuietlySetFeel(B_NORMAL_WINDOW_FEEL);
// else // else
_level = fWindow->Feel(); _level = _serverwin->Feel();
break; break;
default: default:
fWindow->QuietlySetFeel(B_NORMAL_WINDOW_FEEL); _serverwin->QuietlySetFeel(B_NORMAL_WINDOW_FEEL);
_level = B_NORMAL_FEEL; _level = B_NORMAL_FEEL;
break; break;
} }