window resizing support
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7605 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -100,6 +100,7 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
|
|||||||
|
|
||||||
fLastMousePosition.Set(-1,-1);
|
fLastMousePosition.Set(-1,-1);
|
||||||
SetLevel();
|
SetLevel();
|
||||||
|
fNewTopLayerFrame = &(win->fTopLayer->_frame);
|
||||||
|
|
||||||
if (feel == B_NO_BORDER_WINDOW_LOOK){
|
if (feel == B_NO_BORDER_WINDOW_LOOK){
|
||||||
}
|
}
|
||||||
@@ -129,17 +130,36 @@ STRACE(("WinBorder %s:~WinBorder()\n",GetName()));
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void WinBorder::RebuildFullRegion(void){
|
void WinBorder::RebuildFullRegion(void){
|
||||||
_full.MakeEmpty();
|
BRegion topLayerFull;
|
||||||
if(fDecorator)
|
Layer *topLayer = _serverwin->fTopLayer;
|
||||||
fDecFull->MakeEmpty();
|
topLayerFull.Set( ConvertToTop(*fNewTopLayerFrame) );
|
||||||
|
fNewTopLayerFrame = &(_serverwin->fTopLayer->_frame);
|
||||||
|
|
||||||
_serverwin->fTopLayer->RebuildFullRegion();
|
// TODO: Convert to screen coordinates!
|
||||||
_full = _serverwin->fTopLayer->_full;
|
LayerData *ld;
|
||||||
|
ld = topLayer->_layerdata;
|
||||||
|
do{
|
||||||
|
// clip to user region
|
||||||
|
if(ld->clippReg)
|
||||||
|
topLayerFull.IntersectWith( ld->clippReg );
|
||||||
|
} while( (ld = ld->prevState) );
|
||||||
|
|
||||||
|
// clip to user picture region
|
||||||
|
if(topLayer->clipToPicture)
|
||||||
|
if(topLayer->clipToPictureInverse) {
|
||||||
|
topLayerFull.Exclude( topLayer->clipToPicture );
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
topLayerFull.IntersectWith( topLayer->clipToPicture );
|
||||||
|
}
|
||||||
|
|
||||||
|
_full.MakeEmpty();
|
||||||
|
_full = topLayerFull;
|
||||||
|
|
||||||
if (fDecorator){
|
if (fDecorator){
|
||||||
|
fDecFull->MakeEmpty();
|
||||||
fDecorator->GetFootprint(fDecFull);
|
fDecorator->GetFootprint(fDecFull);
|
||||||
_full.Include(fDecFull);
|
_full.Include(fDecFull);
|
||||||
_serverwin->fTopLayer->_full.Exclude(fDecFull);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -297,16 +317,20 @@ void WinBorder::Draw(const BRect &r)
|
|||||||
{
|
{
|
||||||
printf("WinBorder(%s)::Draw()\n", GetName());
|
printf("WinBorder(%s)::Draw()\n", GetName());
|
||||||
if(fDecorator){
|
if(fDecorator){
|
||||||
|
// decorator is allowed to draw in its entire visible region, not just in the update one.
|
||||||
|
fUpdateReg = _visible;
|
||||||
|
fUpdateReg.IntersectWith(fDecFull);
|
||||||
// restrict Decorator drawing to the update region only.
|
// restrict Decorator drawing to the update region only.
|
||||||
fDriver->ConstrainClippingRegion(&fUpdateReg);
|
fDriver->ConstrainClippingRegion(&fUpdateReg);
|
||||||
/*
|
/*
|
||||||
fUpdateReg.PrintToStream();
|
fUpdateReg.PrintToStream();
|
||||||
RGBColor c(128, 56, 98);
|
RGBColor c(128, 56, 98);
|
||||||
fDriver->FillRect(r, c);
|
//fDriver->FillRect(r, c);
|
||||||
|
fDriver->FillRect(fUpdateReg.Frame(), c);
|
||||||
snooze(1000000);
|
snooze(1000000);
|
||||||
*/
|
*/
|
||||||
// NOTE: r is NOT transformed from Screen coordinates
|
// TODO: pass 'r' not as you do now!!! Let Decorator object handle update problems
|
||||||
fDecorator->Draw(r);
|
fDecorator->Draw(fUpdateReg.Frame());
|
||||||
|
|
||||||
// remove the additional clipping region.
|
// remove the additional clipping region.
|
||||||
fDriver->ConstrainClippingRegion(NULL);
|
fDriver->ConstrainClippingRegion(NULL);
|
||||||
@@ -317,6 +341,7 @@ void WinBorder::MoveBy(float x, float y)
|
|||||||
{
|
{
|
||||||
if(fDecorator){
|
if(fDecorator){
|
||||||
fDecorator->MoveBy(x,y);
|
fDecorator->MoveBy(x,y);
|
||||||
|
fDecFull->OffsetBy(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Layer::MoveBy(x,y);
|
Layer::MoveBy(x,y);
|
||||||
@@ -327,8 +352,14 @@ void WinBorder::ResizeBy(float x, float y)
|
|||||||
if(fDecorator){
|
if(fDecorator){
|
||||||
fDecorator->ResizeBy(x,y);
|
fDecorator->ResizeBy(x,y);
|
||||||
}
|
}
|
||||||
|
BRect *localRect = new BRect(_serverwin->fTopLayer->_frame);
|
||||||
|
fNewTopLayerFrame = localRect;
|
||||||
|
// force topLayer's frame to resize
|
||||||
|
fNewTopLayerFrame->right += x;
|
||||||
|
fNewTopLayerFrame->bottom += y;
|
||||||
|
|
||||||
Layer::ResizeBy(x,y);
|
Layer::ResizeBy(x,y);
|
||||||
|
delete localRect;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool WinBorder::HasPoint(BPoint& pt) const{
|
bool WinBorder::HasPoint(BPoint& pt) const{
|
||||||
|
|||||||
Reference in New Issue
Block a user