From 434690369eb989e59821ca16a4bd3efca17ebc55 Mon Sep 17 00:00:00 2001 From: shatty Date: Tue, 19 Aug 2003 09:48:11 +0000 Subject: [PATCH] added radio buttons git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4309 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../tracker/filetype/AppTypeAppFlagsView.cpp | 50 +++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/src/add-ons/tracker/filetype/AppTypeAppFlagsView.cpp b/src/add-ons/tracker/filetype/AppTypeAppFlagsView.cpp index 1865a86b7b..45c34079f5 100644 --- a/src/add-ons/tracker/filetype/AppTypeAppFlagsView.cpp +++ b/src/add-ons/tracker/filetype/AppTypeAppFlagsView.cpp @@ -4,20 +4,64 @@ AppTypeAppFlagsView::AppTypeAppFlagsView(BRect viewFrame) : BView(viewFrame, "AppTypeAppFlagsView", B_FOLLOW_ALL, B_FRAME_EVENTS|B_WILL_DRAW) { + float width = 0, height = 0; SetViewColor( ui_color(B_PANEL_BACKGROUND_COLOR) ); - BRect appFlagsBoxFrame = Bounds(); - fAppFlagsBox = new BBox(appFlagsBoxFrame,"box", + fAppFlagsBox = new BBox(Bounds(),"box", B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP); AddChild(fAppFlagsBox); const char * appFlagsCheckBoxLabel = "Application Flags"; float appFlagsCheckBoxStringWidth = StringWidth(appFlagsCheckBoxLabel); - fAppFlagsCheckBox = new BCheckBox(appFlagsBoxFrame, + fAppFlagsCheckBox = new BCheckBox(fAppFlagsBox->Bounds(), appFlagsCheckBoxLabel, appFlagsCheckBoxLabel,NULL, B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP); fAppFlagsBox->SetLabel(fAppFlagsCheckBox); + + const char * singleRadioButtonLabel = "Single Launch"; + float singleRadioButtonStringWidth = StringWidth(singleRadioButtonLabel); + BRect singleRadioButtonFrame = fAppFlagsBox->Bounds(); + singleRadioButtonFrame.top += fAppFlagsCheckBox->Bounds().Height()/2 + 10; + singleRadioButtonFrame.left += 10; + singleRadioButtonFrame.right -= 10; + fAppFlagsSingleRadioButton = new BRadioButton(singleRadioButtonFrame, + singleRadioButtonLabel, + singleRadioButtonLabel,NULL); + fAppFlagsBox->AddChild(fAppFlagsSingleRadioButton); + fAppFlagsSingleRadioButton->GetPreferredSize(&width,&height); + fAppFlagsSingleRadioButton->ResizeTo(width,height); + + const char * multipleRadioButtonLabel = "Multiple Launch"; + float multipleRadioButtonStringWidth = StringWidth(multipleRadioButtonLabel); + BRect multipleRadioButtonFrame = fAppFlagsBox->Bounds(); + multipleRadioButtonFrame.top = fAppFlagsSingleRadioButton->Frame().bottom; + multipleRadioButtonFrame.left += 10; + multipleRadioButtonFrame.right -= 10; + fAppFlagsMultipleRadioButton = new BRadioButton(multipleRadioButtonFrame, + multipleRadioButtonLabel, + multipleRadioButtonLabel,NULL); + fAppFlagsBox->AddChild(fAppFlagsMultipleRadioButton); + fAppFlagsMultipleRadioButton->GetPreferredSize(&width,&height); + fAppFlagsMultipleRadioButton->ResizeTo(width,height); + + const char * exclusiveRadioButtonLabel = "Exclusive Launch"; + float exclusiveRadioButtonStringWidth = StringWidth(exclusiveRadioButtonLabel); + BRect exclusiveRadioButtonFrame = fAppFlagsBox->Bounds(); + exclusiveRadioButtonFrame.top = fAppFlagsMultipleRadioButton->Frame().bottom; + exclusiveRadioButtonFrame.left += 10; + exclusiveRadioButtonFrame.right -= 10; + fAppFlagsExclusiveRadioButton = new BRadioButton(exclusiveRadioButtonFrame, + exclusiveRadioButtonLabel, + exclusiveRadioButtonLabel,NULL); + fAppFlagsBox->AddChild(fAppFlagsExclusiveRadioButton); + fAppFlagsExclusiveRadioButton->GetPreferredSize(&width,&height); + fAppFlagsExclusiveRadioButton->ResizeTo(width,height); + + width = fAppFlagsBox->Bounds().Width(); + height = fAppFlagsExclusiveRadioButton->Frame().bottom + 5; + fAppFlagsBox->ResizeTo(width,height); + ResizeTo(width,height); } AppTypeAppFlagsView::~AppTypeAppFlagsView()