better ResizeToPreferred implementation

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12946 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-06-03 19:51:34 +00:00
parent 59345e264f
commit 743a147353

View File

@ -945,7 +945,6 @@ BView::FrameResized(float new_width, float new_height)
void
BView::GetPreferredSize(float* width, float* height)
{
// HOOK function
STRACE(("\tHOOK: BView(%s)::GetPreferredSize()\n", Name()));
*width = fBounds.Width();
*height = fBounds.Height();
@ -955,10 +954,16 @@ BView::GetPreferredSize(float* width, float* height)
void
BView::ResizeToPreferred()
{
// HOOK function
STRACE(("\tHOOK: BView(%s)::ResizeToPreferred()\n", Name()));
ResizeTo(fBounds.Width(), fBounds.Height());
// TODO: Test if this version of the implementation is
// in BView or BControl in R5.
float width;
float height;
GetPreferredSize(&width, &height);
ResizeTo(width, height);
}
@ -1212,10 +1217,12 @@ BView::GetMouse(BPoint *location, uint32 *buttons, bool checkMessageQueue)
owner->fLink->GetNextReply(&rCode);
if (rCode == SERVER_TRUE) {
owner->fLink->Read<BPoint>(location);
owner->fLink->Read((int32 *)buttons, sizeof(int32));
owner->fLink->Read<uint32>(buttons);
// TODO: See above comment about coordinates
ConvertFromScreen(location);
} else {
buttons = 0;
}
}