BBox: Fixed broken fBounds position update.
* FrameMoved() is only for frame movements; only scrolling affects the bounds position. * Thanks stippi!
This commit is contained in:
parent
6bbb8b3022
commit
fe9ddedc07
@ -286,7 +286,7 @@ BBox::AttachedToWindow()
|
|||||||
AdoptSystemColors();
|
AdoptSystemColors();
|
||||||
|
|
||||||
// The box could have been resized in the mean time
|
// The box could have been resized in the mean time
|
||||||
fBounds = Bounds();
|
fBounds = Bounds().OffsetToCopy(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -322,37 +322,39 @@ BBox::FrameResized(float width, float height)
|
|||||||
// TODO: this must be made part of the be_control_look stuff!
|
// TODO: this must be made part of the be_control_look stuff!
|
||||||
int32 borderSize = fStyle == B_PLAIN_BORDER ? 0 : 2;
|
int32 borderSize = fStyle == B_PLAIN_BORDER ? 0 : 2;
|
||||||
|
|
||||||
BRect invalid(fBounds);
|
// Horizontal
|
||||||
if (fBounds.right < bounds.right) {
|
BRect invalid(bounds);
|
||||||
|
if (fBounds.Width() < bounds.Width()) {
|
||||||
// enlarging
|
// enlarging
|
||||||
invalid.left = fBounds.right - borderSize;
|
invalid.left = bounds.left + fBounds.right - borderSize;
|
||||||
invalid.right = fBounds.right;
|
invalid.right = bounds.left + fBounds.right;
|
||||||
|
|
||||||
Invalidate(invalid);
|
Invalidate(invalid);
|
||||||
} else if (fBounds.right > bounds.right) {
|
} else if (fBounds.Width() > bounds.Width()) {
|
||||||
// shrinking
|
// shrinking
|
||||||
invalid.left = bounds.right - borderSize;
|
invalid.left = bounds.left + bounds.right - borderSize;
|
||||||
|
|
||||||
Invalidate(invalid);
|
Invalidate(invalid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Vertical
|
||||||
invalid = bounds;
|
invalid = bounds;
|
||||||
if (fBounds.bottom < bounds.bottom) {
|
if (fBounds.Height() < bounds.Height()) {
|
||||||
// enlarging
|
// enlarging
|
||||||
invalid.top = fBounds.bottom - borderSize;
|
invalid.top = bounds.top + fBounds.bottom - borderSize;
|
||||||
invalid.bottom = fBounds.bottom;
|
invalid.bottom = bounds.top + fBounds.bottom;
|
||||||
|
|
||||||
Invalidate(invalid);
|
Invalidate(invalid);
|
||||||
} else if (fBounds.bottom > bounds.bottom) {
|
} else if (fBounds.Height() > bounds.Height()) {
|
||||||
// shrinking
|
// shrinking
|
||||||
invalid.top = bounds.bottom - borderSize;
|
invalid.top = bounds.top + bounds.bottom - borderSize;
|
||||||
|
|
||||||
Invalidate(invalid);
|
Invalidate(invalid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fBounds.right = fBounds.left + width;
|
fBounds.right = width;
|
||||||
fBounds.bottom = fBounds.top + height;
|
fBounds.bottom = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -395,7 +397,6 @@ void
|
|||||||
BBox::FrameMoved(BPoint newLocation)
|
BBox::FrameMoved(BPoint newLocation)
|
||||||
{
|
{
|
||||||
BView::FrameMoved(newLocation);
|
BView::FrameMoved(newLocation);
|
||||||
fBounds.OffsetTo(newLocation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -629,7 +630,7 @@ BBox::operator=(const BBox &)
|
|||||||
void
|
void
|
||||||
BBox::_InitObject(BMessage* archive)
|
BBox::_InitObject(BMessage* archive)
|
||||||
{
|
{
|
||||||
fBounds = Bounds();
|
fBounds = Bounds().OffsetToCopy(0, 0);
|
||||||
|
|
||||||
fLabel = NULL;
|
fLabel = NULL;
|
||||||
fLabelView = NULL;
|
fLabelView = NULL;
|
||||||
@ -783,8 +784,6 @@ BBox::_DrawFancy(BRect labelBox)
|
|||||||
void
|
void
|
||||||
BBox::_ClearLabel()
|
BBox::_ClearLabel()
|
||||||
{
|
{
|
||||||
fBounds.top = 0;
|
|
||||||
|
|
||||||
if (fLabel) {
|
if (fLabel) {
|
||||||
free(fLabel);
|
free(fLabel);
|
||||||
fLabel = NULL;
|
fLabel = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user