Update some apps/add-ons/preflets for impending changes to the layout API, specifically the layout builders. Also do a bit of style and layout cleanup in some places. This is part of #6407. Everything I've updated should look and function the same as it did before.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38064 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alex Wilson 2010-08-12 16:54:03 +00:00
parent aa818be69a
commit 25fd5c7b35
19 changed files with 234 additions and 299 deletions

View File

@ -140,6 +140,6 @@ InitializeBFSEditor::_CreateViewControls()
.Add(fBlockSizeMF->CreateMenuBarLayoutItem(), 1, 1)
// row 3
.Add(fUseIndicesCB, 0, 2, 2)
.Add(fUseIndicesCB, 0, 2, 2).View()
;
}

View File

@ -7,7 +7,7 @@
#include "CreationParameterEditor.h"
#include <DiskDeviceTypes.h>
#include <GroupLayoutBuilder.h>
#include <GroupView.h>
#include <PartitionParameterEditor.h>
#include <View.h>
@ -20,9 +20,8 @@ PrimaryPartitionEditor::PrimaryPartitionEditor()
fParameters(NULL)
{
fActiveCB = new BCheckBox("active", "Active partition", NULL);
fView = BGroupLayoutBuilder(B_VERTICAL)
.Add(fActiveCB)
;
fView = new BGroupView(B_VERTICAL);
fView->AddChild(fActiveCB);
}

View File

@ -129,7 +129,8 @@ CalendarMenuWindow::CalendarMenuWindow(BPoint where)
BView* view = BGroupLayoutBuilder(B_VERTICAL, 5.0)
.Add(gridLayout->View())
.Add(fCalendarView)
.SetInsets(5.0, 5.0, 5.0, 5.0);
.SetInsets(5.0, 5.0, 5.0, 5.0)
.TopView();
groupView->AddChild(view);
AddChild(groupView);

View File

@ -88,16 +88,17 @@ DevicesView::CreateLayout()
fTabView->AddTab(fAttributesView, fDetailedTab);
fDetailedTab->SetLabel("Detailed");
AddChild(BGroupLayoutBuilder(B_VERTICAL,0)
AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
.Add(menuBar)
.Add(BSplitLayoutBuilder(B_HORIZONTAL, 5)
.Add(BGroupLayoutBuilder(B_VERTICAL, 5)
.Add(fOrderByMenu, 1)
.Add(scrollView, 2)
.TopView()
)
.Add(fTabView, 2)
.SetInsets(5, 5, 5, 5)
)
).TopView()
);
}

View File

@ -6,8 +6,7 @@
#include <stdio.h>
#include <Button.h>
#include <GroupLayoutBuilder.h>
#include <SpaceLayoutItem.h>
#include <LayoutBuilder.h>
#include <Screen.h>
#include <TextControl.h>
@ -35,35 +34,30 @@ NamePanel::NamePanel(const char* label, const char* text, BWindow* window,
new BMessage(MSG_PANEL_CANCEL));
fNameTC = new BTextControl(label, text, NULL);
BView* topView = BGroupLayoutBuilder(B_VERTICAL, 10)
BLayoutBuilder::Group<>(this, B_VERTICAL, 10)
.AddGlue()
// controls
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 5)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
.AddGroup(B_HORIZONTAL, 5)
.AddStrut(5)
// text control
.Add(fNameTC->CreateLabelLayoutItem())
.Add(fNameTC->CreateTextViewLayoutItem())
.Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
)
.AddStrut(5)
.End()
.AddGlue()
// buttons
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 5)
.Add(BSpaceLayoutItem::CreateGlue())
.AddGroup(B_HORIZONTAL, 5)
.AddGlue()
.Add(cancelButton)
.Add(defaultButton)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
)
.AddStrut(5)
.End()
.AddGlue()
;
SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(topView);
.AddGlue();
SetDefaultButton(defaultButton);
fNameTC->MakeFocus(true);

View File

@ -11,8 +11,8 @@
#include <Autolock.h>
#include <Catalog.h>
#include <GroupLayoutBuilder.h>
#include <GroupLayout.h>
#include <LayoutBuilder.h>
#include <Locale.h>
#include <stdio.h>
@ -43,57 +43,9 @@ StopButton::Draw(BRect updateRect)
}
// #pragma mark -
/*PackageStatus::PackageStatus(BHandler *parent, const char *title,
const char *label, const char *trailing)
: BWindow(BRect(200, 200, 550, 275), title, B_TITLED_WINDOW,
B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_NOT_ZOOMABLE, 0)
{
SetSizeLimits(0, 100000, 0, 100000);
fBackground = new BView(Bounds(), "background", B_FOLLOW_NONE, B_WILL_DRAW);
fBackground->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BRect rect(Bounds());
float width, height;
rect.left += 6;
rect.right -= 40;
rect.top += 6;
rect.bottom = rect.top + 15;
fStatus = new BStatusBar(rect, "status_bar", T("Installing package"));
fStatus->SetBarHeight(12);
fStatus->GetPreferredSize(&width, &height);
fStatus->ResizeTo(fStatus->Frame().Width(), height);
fBackground->AddChild(fStatus);
font_height fontHeight;
fBackground->GetFontHeight(&fontHeight);
BRect frame = fStatus->Frame();
fBackground->ResizeTo(Bounds().Width(), (2 * frame.top) + frame.Height() +
fontHeight.leading + fontHeight.ascent + fontHeight.descent);
rect = Bounds();
rect.left = rect.right - 32;
//rect.right = rect.left + 17;
rect.top += 18;
//rect.bottom = rect.top + 10;
fButton = new StopButton();
fButton->MoveTo(BPoint(rect.left, rect.top));
fButton->ResizeTo(22, 18);
fBackground->AddChild(fButton);
AddChild(fBackground);
fButton->SetTarget(parent);
ResizeTo(Bounds().Width(), fBackground->Bounds().Height());
Run();
}*/
PackageStatus::PackageStatus(const char *title, const char *label,
const char *trailing, BHandler *parent)
:
@ -102,21 +54,16 @@ PackageStatus::PackageStatus(const char *title, const char *label,
fIsStopped(false),
fParent(parent)
{
SetLayout(new BGroupLayout(B_VERTICAL));
fStatus = new BStatusBar("status_bar", B_TRANSLATE("Installing package"));
fStatus->SetBarHeight(12);
fButton = new StopButton();
fButton->SetExplicitMaxSize(BSize(22, 18));
fBackground = BGroupLayoutBuilder(B_HORIZONTAL)
BLayoutBuilder::Group<>(this, B_HORIZONTAL, 0)
.AddStrut(5.0f)
.Add(fStatus)
.Add(fButton);
fBackground->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(fBackground);
fButton->SetTarget(this);
Run();

View File

@ -42,7 +42,6 @@ class PackageStatus : public BWindow {
bool Stopped();
private:
BView *fBackground;
BStatusBar *fStatus;
StopButton *fButton;
bool fIsStopped;

View File

@ -15,8 +15,6 @@
#include <Catalog.h>
#include <CheckBox.h>
#include <ColorControl.h>
#include <GridLayoutBuilder.h>
#include <GroupLayoutBuilder.h>
#include <LayoutBuilder.h>
#include <Locale.h>
#include <Menu.h>
@ -84,8 +82,6 @@ AppearancePrefView::AppearancePrefView(const char* name,
NULL
};
SetLayout(new BGroupLayout(B_HORIZONTAL));
fWarnOnExit = new BCheckBox(
B_TRANSLATE("Confirm exit if active programs exist"),
new BMessage(MSG_WARN_ON_EXIT_CHANGED));
@ -100,8 +96,8 @@ AppearancePrefView::AppearancePrefView(const char* name,
fFont = new BMenuField(B_TRANSLATE("Font:"), fontMenu);
fFontSize = new BMenuField(B_TRANSLATE("Size:"), sizeMenu);
BPopUpMenu* schemasPopUp =_MakeColorSchemaMenu(MSG_COLOR_SCHEMA_CHANGED, gPredefinedSchemas,
gPredefinedSchemas[0]);
BPopUpMenu* schemasPopUp =_MakeColorSchemaMenu(MSG_COLOR_SCHEMA_CHANGED,
gPredefinedSchemas, gPredefinedSchemas[0]);
fColorSchemaField = new BMenuField(B_TRANSLATE("Color schema:"),
schemasPopUp);
@ -112,10 +108,12 @@ AppearancePrefView::AppearancePrefView(const char* name,
colorsPopUp);
fColorField->SetEnabled(false);
BView* layoutView = BLayoutBuilder::Group<>()
BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL);
SetLayout(layout);
BLayoutBuilder::Group<>(layout)
.SetInsets(5, 5, 5, 5)
.AddGroup(B_VERTICAL, 5)
.Add(BGridLayoutBuilder(5, 5)
.AddGrid(5, 5)
.Add(fFont->CreateLabelLayoutItem(), 0, 0)
.Add(fFont->CreateMenuBarLayoutItem(), 1, 0)
.Add(fFontSize->CreateLabelLayoutItem(), 0, 1)
@ -124,16 +122,12 @@ AppearancePrefView::AppearancePrefView(const char* name,
.Add(fColorSchemaField->CreateMenuBarLayoutItem(), 1, 2)
.Add(fColorField->CreateLabelLayoutItem(), 0, 3)
.Add(fColorField->CreateMenuBarLayoutItem(), 1, 3)
)
. End()
.AddGroup(B_VERTICAL, 5)
.AddGlue()
.Add(fColorControl = new BColorControl(BPoint(10, 10),
B_CELLS_32x8, 8.0, "", new BMessage(MSG_COLOR_CHANGED)))
.Add(fWarnOnExit)
.End()
.End();
AddChild(layoutView);
.Add(fWarnOnExit);
fFont->SetAlignment(B_ALIGN_RIGHT);
fFontSize->SetAlignment(B_ALIGN_RIGHT);
@ -421,7 +415,8 @@ AppearancePrefView::_MakeSizeMenu(uint32 command, uint8 defaultSize)
if (sizes[i] > defaultSize) {
BString string;
string << defaultSize;
BMenuItem* item = new BMenuItem(string.String(), new BMessage(command));
BMenuItem* item = new BMenuItem(string.String(),
new BMessage(command));
item->SetMarked(true);
menu->AddItem(item, i);
break;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2007-2009, Haiku, Inc. All rights reserved.
* Copyright 2007-2010, Haiku, Inc. All rights reserved.
* Copyright 2003-2004 Kian Duffy, myob@users.sourceforge.net
* Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai.
* All rights reserved. Distributed under the terms of the MIT license.
@ -45,7 +45,7 @@ FindWindow::FindWindow(BMessenger messenger, const BString& str,
BRadioButton* useSelection = NULL;
const float spacing = be_control_look->DefaultItemSpacing();
BView* layoutView = BGroupLayoutBuilder(B_VERTICAL, 5.0)
AddChild(BGroupLayoutBuilder(B_VERTICAL, 5.0)
.SetInsets(spacing, spacing, spacing, spacing)
.Add(BGridLayoutBuilder()
.Add(fTextRadio = new BRadioButton(B_TRANSLATE("Use text:"),
@ -57,11 +57,9 @@ FindWindow::FindWindow(BMessenger messenger, const BString& str,
.Add(fForwardSearchBox = new BCheckBox(B_TRANSLATE("Search forward")))
.Add(fMatchCaseBox = new BCheckBox(B_TRANSLATE("Match case")))
.Add(fMatchWordBox = new BCheckBox(B_TRANSLATE("Match word")))
.Add(fFindButton = new BButton(B_TRANSLATE("Find"), new BMessage(MSG_FIND)))
.End();
AddChild(layoutView);
layoutView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
.Add(fFindButton = new BButton(B_TRANSLATE("Find"),
new BMessage(MSG_FIND)))
.TopView());
fFindLabel->SetDivider(0.0);

View File

@ -23,6 +23,7 @@
#include <GridLayoutBuilder.h>
#include <GroupLayoutBuilder.h>
#include <GroupView.h>
#include <LayoutBuilder.h>
#include <ListView.h>
#include <Locale.h>
#include <MenuBar.h>
@ -308,7 +309,8 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
.Add(fSingleLaunchButton, 0, 0).Add(fArgsOnlyCheckBox, 1, 0)
.Add(fMultipleLaunchButton, 0, 1).Add(fBackgroundAppCheckBox, 1, 1)
.Add(fExclusiveLaunchButton, 0, 2)
.SetInsets(padding, padding, padding, padding));
.SetInsets(padding, padding, padding, padding)
.View());
flagsBox->SetLabel(fFlagsCheckBox);
// "Icon" group
@ -319,7 +321,8 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
fIconView->SetModificationMessage(new BMessage(kMsgIconChanged));
iconBox->AddChild(BGroupLayoutBuilder(B_HORIZONTAL)
.Add(fIconView)
.SetInsets(padding, padding, padding, padding));
.SetInsets(padding, padding, padding, padding)
.TopView());
// "Supported Types" group
@ -340,7 +343,8 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
new BMessage(kMsgRemoveType));
fTypeIconView = new IconView("type icon");
BView* iconHolder = BGroupLayoutBuilder(B_HORIZONTAL).Add(fTypeIconView);
BGroupView* iconHolder = new BGroupView(B_HORIZONTAL);
iconHolder->AddChild(fTypeIconView);
fTypeIconView->SetModificationMessage(new BMessage(kMsgTypeIconsChanged));
typeBox->AddChild(BGridLayoutBuilder(padding, padding)
@ -351,7 +355,8 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
.SetInsets(padding, padding, padding, padding)
.SetColumnWeight(0, 3)
.SetColumnWeight(1, 2)
.SetColumnWeight(2, 1));
.SetColumnWeight(2, 1)
.View());
iconHolder->SetExplicitAlignment(
BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));
@ -416,19 +421,22 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
.Add(longLabel, 0, 2)
.Add(scrollView, 1, 2, 10, 3)
.SetInsets(padding, padding, padding, padding)
.SetRowWeight(3, 3));
.SetRowWeight(3, 3)
.View());
// put it all together
SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(menuBar);
AddChild(BGroupLayoutBuilder(B_VERTICAL, padding)
.Add(fSignatureControl)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, padding)
.Add(flagsBox, 3)
.Add(iconBox, 1))
.Add(typeBox)
.Add(versionBox)
.SetInsets(padding, padding, padding, padding));
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(0, 0, 0, 0)
.Add(menuBar)
.AddGroup(B_VERTICAL, padding)
.SetInsets(padding, padding, padding, padding)
.Add(fSignatureControl)
.AddGroup(B_HORIZONTAL, padding)
.Add(flagsBox, 3)
.Add(iconBox, 1)
.End()
.Add(typeBox)
.Add(versionBox);
SetKeyMenuBar(menuBar);

View File

@ -117,12 +117,11 @@ ProgressWindow::ProgressWindow(const char* message,
fAbortButton = new BButton("abort", B_TRANSLATE("Abort"),
new BMessage(B_CANCEL));
SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 3.0f)
float padding = be_control_look->DefaultItemSpacing();
BLayoutBuilder::Group<>(this, B_VERTICAL, padding)
.SetInsets(padding, padding, padding, padding)
.Add(fStatusBar)
.Add(fAbortButton)
.SetInsets(3.0f, 3.0f, 3.0f, 3.0f)
);
.Add(fAbortButton);
// center on screen
BScreen screen(this);
@ -190,8 +189,6 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
BButton* button = new BButton("remove", B_TRANSLATE("Remove uninstalled"),
new BMessage(kMsgRemoveUninstalled));
SetLayout(BGroupLayoutBuilder(B_HORIZONTAL));
// "Information" group
BBox* infoBox = new BBox((char*)NULL);
@ -215,7 +212,8 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
.Add(fSignatureView->TextView(), 1, 1, 2)
.Add(fPathView->LabelView(), 0, 2)
.Add(fPathView->TextView(), 1, 2, 2)
.SetInsets(padding, padding, padding, padding));
.SetInsets(padding, padding, padding, padding)
.View());
// "Version" group
@ -238,7 +236,8 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
.Add(fVersionView->TextView(), 1, 0)
.Add(fDescriptionLabel->LabelView(), 0, 1)
.Add(fDescriptionView, 1, 1, 2, 2)
.SetInsets(padding, padding, padding, padding));
.SetInsets(padding, padding, padding, padding)
.View());
// Launch and Tracker buttons
@ -249,7 +248,8 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
fTrackerButton = new BButton(
B_TRANSLATE("Show in Tracker" B_UTF8_ELLIPSIS));
AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, padding)
BLayoutBuilder::Group<>(this, B_HORIZONTAL, padding)
.AddGroup(B_VERTICAL, padding, 3)
.Add(scrollView)
.AddGroup(B_HORIZONTAL)
@ -257,19 +257,18 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
.AddGlue()
.End()
.End()
// .AddGlue())//, 3)
.AddGroup(B_VERTICAL, padding)
.Add(infoBox)
.Add(versionBox)
.AddGroup(B_HORIZONTAL, padding)
.AddGlue()
.Add(fEditButton)
.Add(fLaunchButton)
.Add(fTrackerButton)
.AddGlue()
.End()
.AddGlue()
.End()
.SetInsets(padding, padding, padding, padding));
.SetInsets(padding, padding, padding, padding);
BMimeType::StartWatching(this);
_SetType(NULL);

View File

@ -15,6 +15,7 @@
#include <ControlLook.h>
#include <GridLayoutBuilder.h>
#include <GroupLayoutBuilder.h>
#include <LayoutBuilder.h>
#include <Locale.h>
#include <MenuField.h>
#include <MenuItem.h>
@ -142,6 +143,10 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
BMenuField* typeMenuField = new BMenuField("types" , B_TRANSLATE("Type:"),
fTypeMenu);
typeMenuField->SetAlignment(B_ALIGN_RIGHT);
// we must set the color manually when adding a menuField directly
// into a window.
typeMenuField->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
typeMenuField->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fVisibleCheckBox = new BCheckBox("visible", B_TRANSLATE("Visible"),
new BMessage(kMsgVisibilityChanged));
@ -238,18 +243,18 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
new BMessage(B_QUIT_REQUESTED));
BBox* visibleBox;
SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, padding)
BLayoutBuilder::Group<>(this, B_VERTICAL, padding)
.SetInsets(padding, padding, padding, padding)
.Add(BGridLayoutBuilder(padding, padding / 2)
.AddGrid(padding, padding / 2)
.Add(fPublicNameControl->CreateLabelLayoutItem(), 0, 0)
.Add(fPublicNameControl->CreateTextViewLayoutItem(), 1, 0)
.Add(fAttributeControl->CreateLabelLayoutItem(), 0, 1)
.Add(fAttributeControl->CreateTextViewLayoutItem(), 1, 1)
.Add(typeMenuField->CreateLabelLayoutItem(), 0, 2)
.Add(typeMenuField->CreateMenuBarLayoutItem(), 1, 2))
.Add(typeMenuField->CreateMenuBarLayoutItem(), 1, 2)
.End()
.Add(visibleBox = new BBox(B_FANCY_BORDER,
BGridLayoutBuilder(padding, padding / 2)
BLayoutBuilder::Grid<>(padding, padding / 2)
.Add(fDisplayAsMenuField->CreateLabelLayoutItem(), 0, 0)
.Add(fDisplayAsMenuField->CreateMenuBarLayoutItem(), 1, 0)
.Add(fEditableCheckBox, 3, 0)
@ -259,12 +264,15 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
.Add(fWidthControl->CreateTextViewLayoutItem(), 1, 2, 3)
.Add(fAlignmentMenuField->CreateLabelLayoutItem(), 0, 3)
.Add(fAlignmentMenuField->CreateMenuBarLayoutItem(), 1, 3, 3)
.SetInsets(padding, padding, padding, padding)))
.Add(BGroupLayoutBuilder(B_HORIZONTAL, padding)
.SetInsets(padding, padding, padding, padding)
.View())
)
.AddGroup(B_HORIZONTAL, padding)
.Add(BSpaceLayoutItem::CreateGlue())
.Add(BSpaceLayoutItem::CreateGlue())
.Add(cancelButton)
.Add(fAcceptButton)));
.Add(fAcceptButton);
visibleBox->SetLabel(fVisibleCheckBox);
fAcceptButton->MakeDefault(true);

View File

@ -11,8 +11,7 @@
#include <Button.h>
#include <Catalog.h>
#include <ControlLook.h>
#include <GridLayoutBuilder.h>
#include <GroupLayout.h>
#include <LayoutBuilder.h>
#include <Locale.h>
#include <MenuField.h>
#include <MenuItem.h>
@ -120,10 +119,6 @@ ExtensionWindow::ExtensionWindow(FileTypesWindow* target, BMimeType& type,
fMimeType(type.Type()),
fExtension(extension)
{
SetLayout(new BGroupLayout(B_VERTICAL));
float padding = be_control_look->DefaultItemSpacing();
fExtensionControl = new BTextControl(B_TRANSLATE("Extension:"),
extension, NULL);
fExtensionControl->SetModificationMessage(
@ -145,13 +140,12 @@ ExtensionWindow::ExtensionWindow(FileTypesWindow* target, BMimeType& type,
BButton* button = new BButton(B_TRANSLATE("Cancel"),
new BMessage(B_QUIT_REQUESTED));
AddChild(BGridLayoutBuilder(padding, padding)
.Add(fExtensionControl->CreateLabelLayoutItem(), 0, 0)
.Add(fExtensionControl->CreateTextViewLayoutItem(), 1, 0)
.Add(fAcceptButton, 0, 1)
.Add(button, 1, 1)
float padding = be_control_look->DefaultItemSpacing();
BLayoutBuilder::Grid<>(this, padding, padding)
.SetInsets(padding, padding, padding, padding)
);
.AddTextControl(fExtensionControl, 0, 0)
.Add(fAcceptButton, 0, 1)
.Add(button, 1, 1);
// omit the leading dot
if (fExtension.ByteAt(0) == '.')

View File

@ -82,7 +82,8 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
.Add(fTypeControl, 0, 0, 2, 1)
.Add(fSelectTypeButton, 0, 1)
.Add(fSameTypeAsButton, 1, 1)
.SetInsets(padding, padding, padding, padding));
.SetInsets(padding, padding, padding, padding)
.View());
// "Icon" group
@ -91,7 +92,8 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
fIconView = new IconView("icon");
iconBox->AddChild(BGroupLayoutBuilder(B_HORIZONTAL)
.Add(fIconView)
.SetInsets(padding, padding, padding, padding));
.SetInsets(padding, padding, padding, padding)
.TopView());
// "Preferred Application" group
@ -118,14 +120,15 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
.Add(fPreferredField, 0, 0, 2, 1)
.Add(fSelectAppButton, 0, 1)
.Add(fSameAppAsButton, 1, 1)
.SetInsets(padding, padding, padding, padding));
.SetInsets(padding, padding, padding, padding)
.View());
BLayoutBuilder::Group<>(this, B_HORIZONTAL, padding)
.SetInsets(padding, padding, padding, padding)
.AddGroup(B_VERTICAL, padding)
.Add(fileTypeBox)
.Add(preferredBox)
.End()
.SetInsets(padding, padding, padding, padding)
.Add(iconBox);
fTypeControl->MakeFocus(true);

View File

@ -26,6 +26,7 @@
#include <ControlLook.h>
#include <GridLayoutBuilder.h>
#include <GroupLayoutBuilder.h>
#include <LayoutBuilder.h>
#include <ListView.h>
#include <Locale.h>
#include <MenuBar.h>
@ -302,8 +303,6 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
if (settings.FindBool("show_rule", &showRule) != B_OK)
showRule = false;
SetLayout(new BGroupLayout(B_VERTICAL));
float padding = be_control_look->DefaultItemSpacing();
BAlignment labelAlignment = be_control_look->DefaultLabelAlignment();
BAlignment fullAlignment(B_ALIGN_USE_FULL_WIDTH, B_ALIGN_USE_FULL_HEIGHT);
@ -352,8 +351,6 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
item->SetTarget(this);
menu->AddItem(item);
menuBar->AddItem(menu);
AddChild(menuBar);
menuBar->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
// MIME Types list
@ -379,7 +376,8 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
.Add(BSpaceLayoutItem::CreateGlue(), 1)
.Add(fIconView, 3)
.Add(BSpaceLayoutItem::CreateGlue(), 1)
.SetInsets(padding, padding, padding, padding));
.SetInsets(padding, padding, padding, padding)
.TopView());
// "File Recognition" group
@ -413,7 +411,8 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
fRuleControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
fRuleControl->Hide();
BView* recognitionBoxGrid = BGridLayoutBuilder(padding, padding / 2)
BGridView* recognitionBoxGrid = new BGridView(padding, padding / 2);
BGridLayoutBuilder(recognitionBoxGrid)
.Add(fExtensionLabel->LabelView(), 0, 0)
.Add(scrollView, 0, 1, 2, 3)
.Add(fAddExtensionButton, 2, 1)
@ -444,7 +443,8 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
.Add(fTypeNameControl->CreateTextViewLayoutItem(), 1, 1, 2)
.Add(fDescriptionControl->CreateLabelLayoutItem(), 0, 2)
.Add(fDescriptionControl->CreateTextViewLayoutItem(), 1, 2, 2)
.SetInsets(padding, padding, padding, padding));
.SetInsets(padding, padding, padding, padding)
.View());
// "Preferred Application" group
@ -469,7 +469,8 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
.Add(fPreferredField)
.Add(fSelectButton)
.Add(fSameAsButton)
.SetInsets(padding, padding, padding, padding));
.SetInsets(padding, padding, padding, padding)
.TopView());
// "Extra Attributes" group
@ -497,27 +498,31 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
.Add(attributesScroller, 0, 0, 2, 3)
.Add(fAddAttributeButton, 2, 0)
.Add(fRemoveAttributeButton, 2, 1)
.SetInsets(padding, padding, padding, padding));
BView* topView = BGroupLayoutBuilder(B_HORIZONTAL, padding)
.SetInsets(padding, padding, padding, padding)
.Add(BGroupLayoutBuilder(B_VERTICAL, padding)
.Add(typeListScrollView)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, padding)
.Add(addTypeButton)
.Add(fRemoveTypeButton)
.AddGlue()))
// Right side
.Add(BGroupLayoutBuilder(B_VERTICAL, padding)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, padding)
.Add(fIconBox, 1).Add(fRecognitionBox, 3))
.Add(fDescriptionBox)
.Add(fPreferredBox)
.Add(fAttributeBox, 5));
.View());
//topView->SetExplicitAlignment(fullAlignment);
//topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(topView);
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(0, 0, 0, 0)
.Add(menuBar)
.AddGroup(B_HORIZONTAL, padding)
.SetInsets(padding, padding, padding, padding)
.AddGroup(B_VERTICAL, padding)
.Add(typeListScrollView)
.AddGroup(B_HORIZONTAL, padding)
.Add(addTypeButton)
.Add(fRemoveTypeButton)
.AddGlue()
.End()
.End()
// Right side
.AddGroup(B_VERTICAL, padding)
.AddGroup(B_HORIZONTAL, padding)
.Add(fIconBox, 1)
.Add(fRecognitionBox, 3)
.End()
.Add(fDescriptionBox)
.Add(fPreferredBox)
.Add(fAttributeBox, 5);
_SetType(NULL);
_ShowSnifferRule(showRule);

View File

@ -121,6 +121,7 @@ FontSelectionView::FontSelectionView(const char* name,
fPreviewBox->AddChild(BGroupLayoutBuilder(B_HORIZONTAL)
.Add(fPreviewText)
.SetInsets(5, 5, 5, 5)
.TopView()
);
}

View File

@ -19,12 +19,11 @@
#include <Button.h>
#include <Box.h>
#include <Catalog.h>
#include <GridLayoutBuilder.h>
#include <GroupLayoutBuilder.h>
#include <ControlLook.h>
#include <LayoutBuilder.h>
#include <Locale.h>
#include <MessageRunner.h>
#include <Screen.h>
#include <SpaceLayoutItem.h>
#include <TabView.h>
#include <TextView.h>
@ -62,22 +61,17 @@ MainWindow::MainWindow()
fFontsView->UpdateFonts();
SetLayout(new BGroupLayout(B_VERTICAL));
const float kInset = 10;
AddChild(BGroupLayoutBuilder(B_VERTICAL)
const float kInset = be_control_look->DefaultItemSpacing();
BLayoutBuilder::Group<>(this, B_VERTICAL)
.SetInsets(kInset, kInset, kInset, kInset)
.Add(box)
// .Add(tabView)
.Add(BSpaceLayoutItem::CreateVerticalStrut(kInset))
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
.AddStrut(kInset)
.AddGroup(B_HORIZONTAL)
.Add(fDefaultsButton)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(kInset))
.AddStrut(kInset)
.Add(fRevertButton)
.Add(BSpaceLayoutItem::CreateGlue())
)
.SetInsets(kInset, kInset, kInset, kInset)
);
.AddGlue();
if (fSettings.WindowCorner() == BPoint(-1, -1)) {
// center window on screen

View File

@ -153,8 +153,6 @@ FormatView::FormatView(const BLocale& locale)
BView("WindowsSettingsView", B_FRAME_EVENTS),
fLocale(locale)
{
SetLayout(new BGroupLayout(B_HORIZONTAL));
fLongDateExampleView = new BStringView("", "");
for (int i = 0; i < 4; i++) {
@ -248,7 +246,8 @@ FormatView::FormatView(const BLocale& locale)
formatBox->AddChild(BGroupLayoutBuilder(B_VERTICAL)
.Add(beforeRadioButton)
.Add(afterRadioButton)
.SetInsets(spacing, 0, spacing, 0));
.SetInsets(spacing, 0, spacing, 0)
.TopView());
_UpdateExamples();
_ParseDateFormat();
@ -263,62 +262,60 @@ FormatView::FormatView(const BLocale& locale)
fNumbersBox->SetLabel(B_TRANSLATE("Numbers"));
fCurrencyBox->SetLabel(B_TRANSLATE("Currency"));
fDateBox->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL)
.AddGroup(B_VERTICAL, spacing / 2)
.AddGroup(B_HORIZONTAL, spacing)
.Add(new BStringView("", B_TRANSLATE("Long format:")))
.Add(fLongDateExampleView)
.AddGlue()
.End()
.AddGroup(B_HORIZONTAL, spacing)
.Add(fLongDateMenu[0])
.Add(fLongDateSeparator[0])
.End()
.AddGroup(B_HORIZONTAL, spacing)
.Add(fLongDateMenu[1])
.Add(fLongDateSeparator[1])
.End()
.AddGroup(B_HORIZONTAL, spacing)
.Add(fLongDateMenu[2])
.Add(fLongDateSeparator[2])
.End()
.AddGroup(B_HORIZONTAL, spacing)
.Add(fLongDateMenu[3])
.Add(fLongDateSeparator[3])
.End()
.AddGroup(B_HORIZONTAL, spacing)
.Add(new BStringView("", B_TRANSLATE("Short format:")))
.Add(fShortDateExampleView)
.AddGlue()
.End()
.Add(fDateMenu[0])
.Add(fDateMenu[1])
.Add(fDateMenu[2])
fDateBox->AddChild(BLayoutBuilder::Group<>(B_VERTICAL, spacing / 2)
.SetInsets(spacing, spacing, spacing, spacing)
.AddGroup(B_HORIZONTAL, spacing)
.Add(new BStringView("", B_TRANSLATE("Long format:")))
.Add(fLongDateExampleView)
.AddGlue()
.End()
.SetInsets(spacing, spacing, spacing, spacing));
fTimeBox->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, spacing)
.AddGroup(B_VERTICAL, spacing / 2)
.AddGroup(B_HORIZONTAL, spacing)
.Add(new BStringView("", B_TRANSLATE("Long format:")))
.Add(fLongTimeExampleView)
.AddGlue()
.End()
.AddGroup(B_HORIZONTAL, spacing)
.Add(new BStringView("", B_TRANSLATE("Short format:")))
.Add(fShortTimeExampleView)
.AddGlue()
.End()
.AddGroup(B_HORIZONTAL, spacing)
.Add(f24HrRadioButton)
.Add(f12HrRadioButton)
.AddGlue()
.End()
.AddGroup(B_HORIZONTAL, spacing)
.Add(fLongDateMenu[0])
.Add(fLongDateSeparator[0])
.End()
.SetInsets(spacing, spacing, spacing, spacing));
.AddGroup(B_HORIZONTAL, spacing)
.Add(fLongDateMenu[1])
.Add(fLongDateSeparator[1])
.End()
.AddGroup(B_HORIZONTAL, spacing)
.Add(fLongDateMenu[2])
.Add(fLongDateSeparator[2])
.End()
.AddGroup(B_HORIZONTAL, spacing)
.Add(fLongDateMenu[3])
.Add(fLongDateSeparator[3])
.End()
.AddGroup(B_HORIZONTAL, spacing)
.Add(new BStringView("", B_TRANSLATE("Short format:")))
.Add(fShortDateExampleView)
.AddGlue()
.End()
.Add(fDateMenu[0])
.Add(fDateMenu[1])
.Add(fDateMenu[2])
.View());
fNumbersBox->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, spacing)
.AddGroup(B_VERTICAL, spacing / 2)
fTimeBox->AddChild(BLayoutBuilder::Group<>(B_VERTICAL, spacing / 2)
.SetInsets(spacing, spacing, spacing, spacing)
.AddGroup(B_HORIZONTAL, spacing)
.Add(new BStringView("", B_TRANSLATE("Long format:")))
.Add(fLongTimeExampleView)
.AddGlue()
.End()
.AddGroup(B_HORIZONTAL, spacing)
.Add(new BStringView("", B_TRANSLATE("Short format:")))
.Add(fShortTimeExampleView)
.AddGlue()
.End()
.AddGroup(B_HORIZONTAL, spacing)
.Add(f24HrRadioButton)
.Add(f12HrRadioButton)
.AddGlue()
.End()
.View());
fNumbersBox->AddChild(BLayoutBuilder::Group<>(B_VERTICAL, spacing / 2)
.SetInsets(spacing, spacing, spacing, spacing)
.AddGroup(B_HORIZONTAL, spacing)
.Add(new BStringView("", B_TRANSLATE("Example:")))
.Add(fNumberFormatExampleView)
@ -328,23 +325,25 @@ FormatView::FormatView(const BLocale& locale)
.Add(numberDecimal)
.Add(numberLeadingZero)
.Add(numberList)
.End()
.SetInsets(spacing, spacing, spacing, spacing));
.View());
fCurrencyBox->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, spacing)
.AddGroup(B_VERTICAL, spacing / 2)
.Add(currencySymbol)
.Add(currencyNegative)
.Add(currencyDecimal)
.Add(currencyLeadingZero)
.AddGroup(B_HORIZONTAL, spacing)
.Add(formatBox)
.AddGlue()
.End()
fCurrencyBox->AddChild(BLayoutBuilder::Group<>(B_VERTICAL, spacing / 2)
.SetInsets(spacing, spacing, spacing, spacing)
.Add(currencySymbol)
.Add(currencyNegative)
.Add(currencyDecimal)
.Add(currencyLeadingZero)
.AddGroup(B_HORIZONTAL, spacing)
.Add(formatBox)
.AddGlue()
.End()
.SetInsets(spacing, spacing, spacing, spacing));
.View());
AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, spacing)
BGroupLayout* rootLayout = new BGroupLayout(B_HORIZONTAL, spacing);
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetLayout(rootLayout);
BLayoutBuilder::Group<>(rootLayout)
.AddGroup(B_VERTICAL, spacing)
.Add(fDateBox)
.Add(fTimeBox)
@ -353,8 +352,7 @@ FormatView::FormatView(const BLocale& locale)
.AddGroup(B_VERTICAL, spacing)
.Add(fNumbersBox)
.Add(fCurrencyBox)
.AddGlue()
.End());
.AddGlue();
}

View File

@ -222,12 +222,13 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
.AddGroup(B_HORIZONTAL, 0, 2, 1)
.Add(_CreateColumnRowButton(true, false))
.Add(_CreateColumnRowButton(true, true))
.End()
.End()
.AddTextControl(fRowsControl, 0, 2, B_ALIGN_RIGHT)
.AddGroup(B_HORIZONTAL, 0, 2, 2)
.Add(_CreateColumnRowButton(false, false))
.Add(_CreateColumnRowButton(false, true))
.End());
.End()
.View());
fBackgroundsButton = new BButton("BackgroundsButton",
"Set background" B_UTF8_ELLIPSIS,
@ -239,8 +240,8 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
BBox* controlsBox = new BBox("controls box");
controlsBox->SetLabel(workspaceMenuField);
BView* outerControlsView = BLayoutBuilder::Group<>(B_VERTICAL, 10.0)
.SetInsets(10, 10, 10, 10);
BGroupView* outerControlsView = new BGroupView(B_VERTICAL, 10.0);
outerControlsView->GroupLayout()->SetInsets(10, 10, 10, 10);
controlsBox->AddChild(outerControlsView);
fResolutionMenu = new BPopUpMenu("resolution", true, true);
@ -274,10 +275,6 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
fMonitorView->SetMaxResolution(maxWidth, maxHeight);
BRect rect(0.0, 0.0, 200.0, 15.0);
// fResolutionField needs to be at the correct
// left-top offset, because all other menu fields
// will be layouted relative to it
fResolutionField = new BMenuField("ResolutionMenu", "Resolution:",
fResolutionMenu, NULL);
@ -298,8 +295,6 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
fColorsMenu->AddItem(item);
}
rect.OffsetTo(B_ORIGIN);
fColorsField = new BMenuField("ColorsMenu", "Colors:", fColorsMenu, NULL);
fRefreshMenu = new BPopUpMenu("refresh rate", true, true);
@ -440,15 +435,16 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
fTVStandardField->Hide();
}
BView* controlsView = BLayoutBuilder::Grid<>(5.0, 5.0)
.AddMenuField(fResolutionField, 0, 0, B_ALIGN_RIGHT)
.AddMenuField(fColorsField, 0, 1, B_ALIGN_RIGHT)
.AddMenuField(fRefreshField, 0, 2, B_ALIGN_RIGHT)
.AddMenuField(fCombineField, 0, 3, B_ALIGN_RIGHT)
.AddMenuField(fSwapDisplaysField, 0, 4, B_ALIGN_RIGHT)
.AddMenuField(fUseLaptopPanelField, 0, 5, B_ALIGN_RIGHT)
.AddMenuField(fTVStandardField, 0, 6, B_ALIGN_RIGHT);
outerControlsView->AddChild(controlsView);
BLayoutBuilder::Group<>(outerControlsView)
.AddGrid(5.0, 5.0)
.AddMenuField(fResolutionField, 0, 0, B_ALIGN_RIGHT)
.AddMenuField(fColorsField, 0, 1, B_ALIGN_RIGHT)
.AddMenuField(fRefreshField, 0, 2, B_ALIGN_RIGHT)
.AddMenuField(fCombineField, 0, 3, B_ALIGN_RIGHT)
.AddMenuField(fSwapDisplaysField, 0, 4, B_ALIGN_RIGHT)
.AddMenuField(fUseLaptopPanelField, 0, 5, B_ALIGN_RIGHT)
.AddMenuField(fTVStandardField, 0, 6, B_ALIGN_RIGHT)
.End();
// TODO: we don't support getting the screen's preferred settings
/* fDefaultsButton = new BButton(buttonRect, "DefaultsButton", "Defaults",
@ -457,22 +453,21 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
fApplyButton = new BButton("ApplyButton", "Apply",
new BMessage(BUTTON_APPLY_MSG));
fApplyButton->SetEnabled(false);
outerControlsView->GetLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
outerControlsView->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL)
BLayoutBuilder::Group<>(outerControlsView)
.AddGlue()
.Add(fApplyButton));
.AddGroup(B_HORIZONTAL)
.AddGlue()
.Add(fApplyButton);
fRevertButton = new BButton("RevertButton", "Revert",
new BMessage(BUTTON_REVERT_MSG));
fRevertButton->SetEnabled(false);
SetLayout(new BGroupLayout(B_VERTICAL, 10.0));
GetLayout()->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BLayoutBuilder::Group<>(static_cast<BGroupLayout*>(GetLayout()))
BLayoutBuilder::Group<>(this, B_VERTICAL, 10.0)
.SetInsets(10, 10, 10, 10)
.AddGroup(B_HORIZONTAL, 10.0)
.AddGroup(B_VERTICAL)
.AddStrut(controlsBox->TopBorderOffset() - 1)
.Add(screenBox)
.End()
.Add(controlsBox)
@ -481,10 +476,6 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
.Add(fRevertButton)
.AddGlue();
screenBox->Parent()->GetLayout()->AddItem(0,
BSpaceLayoutItem::CreateVerticalStrut(
controlsBox->TopBorderOffset() - 1));
_UpdateControls();
_UpdateMonitor();
}