TMDescView is now resized to preferred before computing other views positions
fixed bug #599 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17563 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f146dc9614
commit
ab61875fe6
@ -131,32 +131,8 @@ TMView::TMView(BRect bounds, const char* name, uint32 resizeFlags,
|
|||||||
uint32 flags, border_style border)
|
uint32 flags, border_style border)
|
||||||
: BBox(bounds, name, resizeFlags, flags | B_PULSE_NEEDED, border)
|
: BBox(bounds, name, resizeFlags, flags | B_PULSE_NEEDED, border)
|
||||||
{
|
{
|
||||||
BRect rect = bounds;
|
|
||||||
rect.InsetBy(12, 12);
|
|
||||||
rect.right -= B_V_SCROLL_BAR_WIDTH;
|
|
||||||
rect.bottom = rect.top + TMListItem::MinimalHeight() * 8 + 6;
|
|
||||||
|
|
||||||
BFont font = be_plain_font;
|
BFont font = be_plain_font;
|
||||||
|
BRect rect = bounds;
|
||||||
fListView = new BListView(rect, "teams", B_SINGLE_SELECTION_LIST,
|
|
||||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP_BOTTOM);
|
|
||||||
fListView->SetSelectionMessage(new BMessage(TM_SELECTED_TEAM));
|
|
||||||
|
|
||||||
BScrollView *scrollView = new BScrollView("scroll_teams", fListView,
|
|
||||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP_BOTTOM, 0, false, true, B_FANCY_BORDER);
|
|
||||||
AddChild(scrollView);
|
|
||||||
|
|
||||||
rect.left = 10;
|
|
||||||
rect.top = rect.bottom + 10;
|
|
||||||
rect.bottom = rect.top + 20;
|
|
||||||
rect.right = rect.left + font.StringWidth("Kill Application") + 20;
|
|
||||||
|
|
||||||
fKillButton = new BButton(rect, "kill", "Kill Application",
|
|
||||||
new BMessage(TM_KILL_APPLICATION), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
|
||||||
AddChild(fKillButton);
|
|
||||||
fKillButton->SetEnabled(false);
|
|
||||||
|
|
||||||
rect = bounds;
|
|
||||||
rect.right -= 10;
|
rect.right -= 10;
|
||||||
rect.left = rect.right - font.StringWidth("Cancel") - 40;
|
rect.left = rect.right - font.StringWidth("Cancel") - 40;
|
||||||
rect.bottom -= 14;
|
rect.bottom -= 14;
|
||||||
@ -183,10 +159,37 @@ TMView::TMView(BRect bounds, const char* name, uint32 resizeFlags,
|
|||||||
|
|
||||||
rect.left += 4;
|
rect.left += 4;
|
||||||
rect.bottom = rect.top - 8;
|
rect.bottom = rect.top - 8;
|
||||||
rect.top = fKillButton->Frame().bottom + 8;
|
rect.top = rect.bottom - 30;
|
||||||
rect.right = bounds.right - 10;
|
rect.right = bounds.right - 10;
|
||||||
fDescView = new TMDescView(rect, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
|
fDescView = new TMDescView(rect, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
|
||||||
AddChild(fDescView);
|
AddChild(fDescView);
|
||||||
|
fDescView->ResizeToPreferred();
|
||||||
|
|
||||||
|
rect = fDescView->Frame();
|
||||||
|
rect.left = 10;
|
||||||
|
rect.right = rect.left + font.StringWidth("Kill Application") + 20;
|
||||||
|
rect.bottom = rect.top - 8;
|
||||||
|
rect.top = rect.bottom - 20;
|
||||||
|
|
||||||
|
fKillButton = new BButton(rect, "kill", "Kill Application",
|
||||||
|
new BMessage(TM_KILL_APPLICATION), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
||||||
|
AddChild(fKillButton);
|
||||||
|
fKillButton->SetEnabled(false);
|
||||||
|
|
||||||
|
rect = bounds;
|
||||||
|
rect.InsetBy(12, 12);
|
||||||
|
rect.right -= B_V_SCROLL_BAR_WIDTH;
|
||||||
|
rect.bottom = fKillButton->Frame().top - 10;
|
||||||
|
|
||||||
|
fListView = new BListView(rect, "teams", B_SINGLE_SELECTION_LIST,
|
||||||
|
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP_BOTTOM);
|
||||||
|
fListView->SetSelectionMessage(new BMessage(TM_SELECTED_TEAM));
|
||||||
|
|
||||||
|
BScrollView *scrollView = new BScrollView("scroll_teams", fListView,
|
||||||
|
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP_BOTTOM, 0, false, true, B_FANCY_BORDER);
|
||||||
|
AddChild(scrollView);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -327,6 +330,14 @@ TMView::GetPreferredSize(float *_width, float *_height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TMDescView::ResizeToPreferred()
|
||||||
|
{
|
||||||
|
float bottom = Bounds().bottom;
|
||||||
|
BView::ResizeToPreferred();
|
||||||
|
MoveBy(0, bottom - Bounds().bottom);
|
||||||
|
}
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@ class TMDescView : public BBox {
|
|||||||
|
|
||||||
virtual void Draw(BRect bounds);
|
virtual void Draw(BRect bounds);
|
||||||
virtual void GetPreferredSize(float *_width, float *_height);
|
virtual void GetPreferredSize(float *_width, float *_height);
|
||||||
|
virtual void ResizeToPreferred();
|
||||||
|
|
||||||
void SetItem(TMListItem *item);
|
void SetItem(TMListItem *item);
|
||||||
TMListItem *Item() { return fItem; }
|
TMListItem *Item() { return fItem; }
|
||||||
|
Loading…
Reference in New Issue
Block a user