BTitleView::BTitleView(BPoseView* view) : BView("BTitleView", B_WILL_DRAW), fPoseView(view), fTitleList(10, true), fHorizontalResizeCursor(B_CURSOR_ID_RESIZE_EAST_WEST), fPreviouslyClickedColumnTitle(0), fPreviousLeftClickTime(0), fTrackingState(NULL) { SetHighUIColor(B_PANEL_BACKGROUND_COLOR); SetLowUIColor(B_PANEL_BACKGROUND_COLOR); #if APP_SERVER_CLEARS_BACKGROUND SetViewUIColor(B_PANEL_BACKGROUND_COLOR); #else SetViewColor(B_TRANSPARENT_COLOR); #endif BFont font(be_plain_font); font.SetSize(floorf(be_plain_font->Size() * 0.75f)); SetFont(&font); font_height height; GetFontHeight(&height); fPreferredHeight = ceilf(height.ascent + height.descent) + 2; Reset(); }
WonderBrushView::WonderBrushView(const BRect &frame, const char *name, uint32 resize, uint32 flags, TranslatorSettings *settings) : BView(frame, name, resize, flags), fSettings(settings) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BStringView *titleView = new BStringView("title", B_TRANSLATE("WonderBrush image translator")); titleView->SetFont(be_bold_font); char version[100]; sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"), static_cast<int>(B_TRANSLATION_MAJOR_VERSION(WBI_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_MINOR_VERSION(WBI_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_REVISION_VERSION( WBI_TRANSLATOR_VERSION)), __DATE__); BStringView *versionView = new BStringView("version", version); BStringView *copyrightView = new BStringView("copyright", kWBICopyright); BStringView *copyright2View = new BStringView("copyright2", B_TRANSLATE("written by:")); BStringView *copyright3View = new BStringView("copyright3", kAuthor); BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .SetInsets(B_USE_DEFAULT_SPACING) .Add(titleView) .Add(versionView) .Add(copyrightView) .AddGlue() .Add(copyright2View) .Add(copyright3View); }
View::View(BRect rect, const char* name, uint32 followMode) : BView(rect, name, followMode, B_WILL_DRAW) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); SetHighColor(255, 0, 0); }
PreviewView::PreviewView(const char* name) : BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), fSaverView(NULL), fNoPreview(NULL) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BGroupLayout* layout = new BGroupLayout(B_VERTICAL); // We draw the "monitor" around the preview, hence the strange insets. layout->SetInsets(7, 6, 8, 12); SetLayout(layout); // A BStringView would be enough, if only it handled word wrapping. fNoPreview = new BTextView("no preview"); fNoPreview->SetText(B_TRANSLATE("No preview available")); fNoPreview->SetFontAndColor(be_plain_font, B_FONT_ALL, &kWhite); fNoPreview->MakeEditable(false); fNoPreview->MakeResizable(false); fNoPreview->MakeSelectable(false); fNoPreview->SetViewColor(0, 0, 0); fNoPreview->SetLowColor(0, 0, 0); fNoPreview->Hide(); BView* container = new BView("preview container", 0); container->SetLayout(new BCardLayout()); AddChild(container); container->SetViewColor(0, 0, 0); container->SetLowColor(0, 0, 0); container->AddChild(fNoPreview); fNoPreview->SetHighColor(255, 255, 255); fNoPreview->SetAlignment(B_ALIGN_CENTER); }
void IconView::AttachedToWindow() { if (Parent() != NULL) SetViewColor(Parent()->ViewColor()); else SetViewUIColor(B_PANEL_BACKGROUND_COLOR); }
// constructor Group::Group(BRect frame, const char* name, orientation direction) : BView(frame, name, B_FOLLOW_ALL, B_FRAME_EVENTS), fOrientation(direction), fInset(4.0), fSpacing(0.0) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); }
View::View(BRect rect, const char* name, uint32 followMode, uint8 red, uint8 green, uint8 blue) : BView(rect, name, followMode, B_WILL_DRAW), fLastTransit(B_OUTSIDE_VIEW) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); SetHighColor(red, green, blue); }
RatingView::RatingView(const char* name) : BView(name, B_WILL_DRAW), fStarBlueBitmap(RSRC_STAR_BLUE), fStarGrayBitmap(RSRC_STAR_GREY), fRating(RATING_MISSING) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); SetLowUIColor(ViewUIColor()); }
GearsView::GearsView() : BView("GearsView", B_WILL_DRAW), fGears(NULL) { SetExplicitMinSize(BSize(64.0 + 10.0, B_SIZE_UNSET)); SetExplicitPreferredSize(BSize(64.0 + 10.0, B_SIZE_UNLIMITED)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR); _InitGearsBitmap(); }
BitmapView::BitmapView(const BPoint &pt,BMessage *message, const BHandler *handler, const BLooper *looper=NULL) : BBox(BRect(0,0,75,75).OffsetToCopy(pt),"bitmapview",B_FOLLOW_NONE,B_WILL_DRAW, B_PLAIN_BORDER), BInvoker(message,handler,looper) { SetFont(be_plain_font); bitmap=NULL; SetViewUIColor(B_PANEL_BACKGROUND_COLOR); SetDrawingMode(B_OP_ALPHA); drawrect=Bounds().InsetByCopy(5,5); }
void APRView::AttachedToWindow() { fPicker->SetTarget(this); fAttrList->SetTarget(this); fColorPreview->SetTarget(this); fAttrList->Select(0); SetViewUIColor(B_PANEL_BACKGROUND_COLOR); }
void TInfoView::AttachedToWindow() { BBox::AttachedToWindow(); SetViewUIColor(B_PANEL_BACKGROUND_COLOR); dynamic_cast<TWindow*>(Window())->PixelCount(&fHPixelCount, &fVPixelCount); fPixelSize = dynamic_cast<TWindow*>(Window())->PixelSize(); AddMenu(); }
TimeSlider::TimeSlider(const char* name, uint32 changedMessage, uint32 updateMessage) : BSlider(name, B_TRANSLATE("30 seconds"), new BMessage(changedMessage), 0, kTimeUnitCount - 1, B_HORIZONTAL, B_TRIANGLE_THUMB) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); SetModificationMessage(new BMessage(updateMessage)); SetBarThickness(10); }
ResView::ResView(const BRect &frame, const char *name, const int32 &resize, const int32 &flags, const entry_ref *ref) : BView(frame, name, resize, flags), fRef(NULL), fSaveStatus(FILE_INIT), fOpenPanel(NULL), fSavePanel(NULL) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); if (ref) { fRef = new entry_ref; *fRef = *ref; fFileName = fRef->name; } else { fFileName = "Untitled "; fFileName << sUntitled; sUntitled++; } BRect r(Bounds()); r.bottom = 16; fBar = new BMenuBar(r, "bar"); AddChild(fBar); BuildMenus(fBar); r = Bounds(); r.top = fBar->Frame().bottom + 4; fListView = new ResListView(r, "gridview", B_FOLLOW_ALL, B_WILL_DRAW, B_FANCY_BORDER); AddChild(fListView); rgb_color white = { 255, 255, 255, 255 }; fListView->SetColor(B_COLOR_BACKGROUND, white); fListView->SetColor(B_COLOR_SELECTION, ui_color(B_MENU_BACKGROUND_COLOR)); float width = be_plain_font->StringWidth("00000") + 20; fListView->AddColumn(new BStringColumn("ID", width, width, 100, B_TRUNCATE_END), 0); fListView->AddColumn(new BStringColumn("Type", width, width, 100, B_TRUNCATE_END), 1); fListView->AddColumn(new BStringColumn("Name", 150, 50, 300, B_TRUNCATE_END), 2); fListView->AddColumn(new PreviewColumn("Data", 150, 50, 300), 3); // Editing is disabled for now fListView->SetInvocationMessage(new BMessage(M_EDIT_RESOURCE)); width = be_plain_font->StringWidth("1000 bytes") + 20; fListView->AddColumn(new BSizeColumn("Size", width, 10, 100), 4); fOpenPanel = new BFilePanel(B_OPEN_PANEL); if (ref) OpenFile(*ref); fSavePanel = new BFilePanel(B_SAVE_PANEL); }
void AntialiasingSettingsView::AttachedToWindow() { AdoptParentColors(); if (Parent() == NULL) SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fAntialiasingMenu->SetTargetForItems(this); fHintingMenu->SetTargetForItems(this); fAverageWeightControl->SetTarget(this); }
void DataView::AttachedToWindow() { fEditor.StartWatching(this); MakeFocus(true); // this seems to be necessary - if we don't do this here, // the view is sometimes focus, but IsFocus() returns false... SetViewUIColor(B_DOCUMENT_BACKGROUND_COLOR); SetLowUIColor(ViewUIColor()); SetHighUIColor(B_DOCUMENT_TEXT_COLOR); }
GroupListView::GroupListView(const char* name, GroupListModel* model, enum orientation orientation, float spacing) : BView(NULL, B_WILL_DRAW, new BGroupLayout(orientation, spacing)), fModel(NULL), fItemRenderer(NULL), fGroupRenderer(NULL), fSelectionMessage(NULL) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); SetModel(model); }
StringEditView::StringEditView(const BRect &frame) : BView(frame, "edit", B_FOLLOW_ALL, B_WILL_DRAW) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BRect r; float labelwidth = be_plain_font->StringWidth("ID: "); float strwidth = be_plain_font->StringWidth("(attr) "); font_height fh; be_plain_font->GetHeight(&fh); float strheight = fh.ascent + fh.descent + fh.leading + 5; fIDBox = new BTextControl(BRect(10, 10, 10 + (strwidth + labelwidth) + 15, 10 + strheight), "id", "ID: ", "", NULL); fIDBox->SetDivider(labelwidth + 5); AddChild(fIDBox); r = fIDBox->Frame(); r.OffsetBy(r.Width() + 10, 0); r.right = Bounds().right - 10; fNameBox = new BTextControl(r, "name", "Name: ", "", NULL, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); fNameBox->SetDivider(be_plain_font->StringWidth("Name: ") + 5); AddChild(fNameBox); r.OffsetBy(0, r.Height() + 10); r.left = 10; r.right -= B_V_SCROLL_BAR_WIDTH; BRect textRect(r.OffsetToCopy(0.0, 0.0)); textRect.InsetBy(5.0, 5.0); fValueView = new BTextView(r, "value", textRect, B_FOLLOW_ALL); BScrollView *scrollView = new BScrollView("scrollView", fValueView, B_FOLLOW_ALL, 0, false, true); AddChild(scrollView); fOK = new BButton(BRect(10, 10, 11, 11), "ok", "Cancel", new BMessage(M_UPDATE_RESOURCE), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); fOK->ResizeToPreferred(); fOK->SetLabel("OK"); AddChild(fOK); fOK->MoveTo(r.right - fOK->Bounds().Width(), r.bottom + 10); r = fOK->Frame(); r.OffsetBy(-r.Width() - 10, 0); fCancel = new BButton(r, "cancel", "Cancel", new BMessage(B_QUIT_REQUESTED), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); AddChild(fCancel); }
void TBarView::AttachedToWindow() { BView::AttachedToWindow(); SetViewUIColor(B_MENU_BACKGROUND_COLOR); SetFont(be_plain_font); fMouseFilter = new BarViewMessageFilter(this); Window()->AddCommonFilter(fMouseFilter); fTrackingHookData.fTrackingHook = MenuTrackingHook; fTrackingHookData.fTarget = BMessenger(this); fTrackingHookData.fDragMessage = new BMessage(B_REFS_RECEIVED); }
TGAView::TGAView(const char *name, uint32 flags, TranslatorSettings *settings) : BView(name, flags), fSettings(settings) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fTitle = new BStringView("title", B_TRANSLATE("TGA image translator")); fTitle->SetFont(be_bold_font); char detail[100]; sprintf(detail, B_TRANSLATE("Version %d.%d.%d, %s"), static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TGA_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_MINOR_VERSION(TGA_TRANSLATOR_VERSION)), static_cast<int>(B_TRANSLATION_REVISION_VERSION( TGA_TRANSLATOR_VERSION)), __DATE__); fDetail = new BStringView("detail", detail); fWrittenBy = new BStringView("writtenby", B_TRANSLATE("Written by the Haiku Translation Kit Team")); fpchkIgnoreAlpha = new BCheckBox(B_TRANSLATE("Ignore TGA alpha channel"), new BMessage(CHANGE_IGNORE_ALPHA)); int32 val = (fSettings->SetGetBool(TGA_SETTING_IGNORE_ALPHA)) ? 1 : 0; fpchkIgnoreAlpha->SetValue(val); fpchkIgnoreAlpha->SetViewColor(ViewColor()); fpchkRLE = new BCheckBox(B_TRANSLATE("Save with RLE compression"), new BMessage(CHANGE_RLE)); val = (fSettings->SetGetBool(TGA_SETTING_RLE)) ? 1 : 0; fpchkRLE->SetValue(val); fpchkRLE->SetViewColor(ViewColor()); // Build the layout BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .SetInsets(B_USE_DEFAULT_SPACING) .Add(fTitle) .Add(fDetail) .AddGlue() .Add(fpchkIgnoreAlpha) .Add(fpchkRLE) .AddGlue() .Add(fWrittenBy); BFont font; GetFont(&font); SetExplicitPreferredSize(BSize((font.Size() * 333)/12, (font.Size() * 200)/12)); }
void LookAndFeelSettingsView::AttachedToWindow() { AdoptParentColors(); if (Parent() == NULL) SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fDecorMenu->SetTargetForItems(this); fDecorInfoButton->SetTarget(this); fArrowStyleSingle->SetTarget(this); fArrowStyleDouble->SetTarget(this); if (fSavedDoubleArrowsValue) fArrowStyleDouble->SetValue(B_CONTROL_ON); else fArrowStyleSingle->SetValue(B_CONTROL_ON); }
PairsView::PairsView(BRect frame, const char* name, uint8 rows, uint8 cols, uint8 iconSize) : BView(frame, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS), fRows(rows), fCols(cols), fIconSize(iconSize), fButtonsCount(rows * cols), fCardsCount(fButtonsCount / 2), fPairsButtonList(new BObjectList<PairsButton>(fButtonsCount)), fSmallBitmapsList(new BObjectList<BBitmap>(fCardsCount)), fMediumBitmapsList(new BObjectList<BBitmap>(fCardsCount)), fLargeBitmapsList(new BObjectList<BBitmap>(fCardsCount)), fRandomPosition(new int32[fButtonsCount]), fPositionX(new int32[fButtonsCount]), fPositionY(new int32[fButtonsCount]) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); CreateGameBoard(); _SetPairsBoard(); }
// // StatusDock::Constructor of the view StatusDock::StatusDock(const char* name) : BView(name, B_WILL_DRAW | B_FRAME_EVENTS), modus(MODE_INIT) { SetExplicitMaxSize(BSize(B_SIZE_UNSET, 75)); SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BLayoutBuilder::Grid<>(this, B_USE_ITEM_SPACING, 0) .SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH, B_ALIGN_BOTTOM)) .SetInsets(B_USE_WINDOW_INSETS) .Add(statusIcon = new IconView("statusicon"), 0, 0, 1, 4) .AddGlue(1, 0, 2) .Add(statusMessage = new BStringView("statusmsg", NULL), 1, 1) .AddGlue(2,1) .Add(statusBar = new BStatusBar("statusbar"), 1, 2, 2) .End(); statusIcon->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER)); statusMessage->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH, B_ALIGN_VERTICAL_CENTER)); statusMessage->SetExplicitPreferredSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); statusBar->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH, B_ALIGN_VERTICAL_CENTER)); statusIcon->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER)); }
void BListView::_InitObject(list_view_type type) { fListType = type; fFirstSelected = -1; fLastSelected = -1; fAnchorIndex = -1; fSelectMessage = NULL; fScrollView = NULL; fTrack = new track_data; fTrack->drag_start = B_ORIGIN; fTrack->item_index = -1; fTrack->was_selected = false; fTrack->try_drag = false; fTrack->is_dragging = false; fTrack->last_click_time = 0; SetViewUIColor(B_LIST_BACKGROUND_COLOR); SetLowUIColor(B_LIST_BACKGROUND_COLOR); }
WrappingTextView::WrappingTextView(BRect a_frame,const char* a_name,int32 a_resize_mode,int32 a_flags) : BTextView(a_frame, a_name, BRect(4.0f,4.0f,a_frame.right-a_frame.left-4.0f,a_frame.bottom-a_frame.top-4.0f), a_resize_mode,a_flags) { m_vertical_offset = 0; m_modified = false; m_modified_disabled = false; m_fixed_width = 0; m_modification_msg = NULL; m_curr_undo_index = 0; m_max_undo_index = 0; m_in_undo_redo = false; m_undo_context = NULL; m_last_key_was_del = false; m_separator_chars = " "; // just a default, will be overridden by Beam-Prefs ResetTextRect(); SetViewUIColor(B_DOCUMENT_BACKGROUND_COLOR); SetLowUIColor(B_DOCUMENT_BACKGROUND_COLOR); SetHighUIColor(B_DOCUMENT_TEXT_COLOR); }
ModulesView::ModulesView(const char* name, ScreenSaverSettings& settings) : BView(name, B_WILL_DRAW), fSettings(settings), fScreenSaversListView(new BListView("SaversListView")), fTestButton(new BButton("TestButton", B_TRANSLATE("Test"), new BMessage(kMsgTestSaver))), fSaverRunner(NULL), fSettingsBox(new BBox("SettingsBox")), fSettingsView(NULL), fPreviewView(new PreviewView("preview")), fScreenSaverTestTeam(-1) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fScreenSaversListView->SetSelectionMessage( new BMessage(kMsgSaverSelected)); BScrollView* saversListScrollView = new BScrollView("scroll_list", fScreenSaversListView, 0, false, true); fSettingsBox->SetLabel(B_TRANSLATE("Screensaver settings")); fSettingsBox->SetExplicitMinSize(BSize( floorf(be_control_look->DefaultItemSpacing() * ((kWindowWidth - 157.0f) / kDefaultItemSpacingAt12pt)), B_SIZE_UNSET)); BLayoutBuilder::Group<>(this, B_HORIZONTAL) .SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING, 0) .AddGroup(B_VERTICAL) .Add(fPreviewView) .Add(saversListScrollView) .AddGroup(B_HORIZONTAL) .Add(fTestButton) .AddGlue() .End() .End() .Add(fSettingsBox) .End(); }
void NetworkStatusView::AttachedToWindow() { BView::AttachedToWindow(); if (Parent() != NULL) { if ((Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0) SetViewColor(B_TRANSPARENT_COLOR); else AdoptParentColors(); } else SetViewUIColor(B_PANEL_BACKGROUND_COLOR); if (ViewUIColor() != B_NO_COLOR) SetLowUIColor(ViewUIColor()); else SetLowColor(ViewColor()); start_watching_network( B_WATCH_NETWORK_INTERFACE_CHANGES | B_WATCH_NETWORK_LINK_CHANGES, this); _Update(); }
ConfigView::ConfigView(uint32 flags) : BView(kShortName2, flags) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BStringView *fTitle = new BStringView("title", B_TRANSLATE("RAW image translator")); fTitle->SetFont(be_bold_font); char version[256]; sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"), int(B_TRANSLATION_MAJOR_VERSION(RAW_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(RAW_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(RAW_TRANSLATOR_VERSION)), __DATE__); BStringView *fVersion = new BStringView("version", version); BStringView *fCopyright = new BStringView("copyright", B_UTF8_COPYRIGHT "2007-2009 Haiku Inc."); BStringView *fCopyright2 = new BStringView("copyright2", B_TRANSLATE("Based on Dave Coffin's dcraw 8.63")); BStringView *fCopyright3 = new BStringView("copyright3", B_UTF8_COPYRIGHT "1997-2007 Dave Coffin"); // Build the layout BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .SetInsets(B_USE_DEFAULT_SPACING) .Add(fTitle) .Add(fVersion) .Add(fCopyright) .AddGlue() .Add(fCopyright2) .Add(fCopyright3); BFont font; GetFont(&font); SetExplicitPreferredSize(BSize((font.Size() * 233)/12, (font.Size() * 200)/12)); }
NotifierConfigView::NotifierConfigView() : BMailSettingsView("notifier_config") { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false); const char *notifyMethods[] = { B_TRANSLATE("Beep"), B_TRANSLATE("Alert"), B_TRANSLATE("Keyboard LEDs"), B_TRANSLATE("Central alert"), B_TRANSLATE("Central beep"), B_TRANSLATE("Log window") }; for (int32 i = 0, j = 1;i < 6; i++, j *= 2) { menu->AddItem(new BMenuItem(notifyMethods[i], new BMessage(kMsgNotifyMethod))); } BLayoutBuilder::Group<>(this).Add( new BMenuField("notify", B_TRANSLATE("Method:"), menu)); }
void PackageView::_InitView() { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); float fontHeight = be_plain_font->Size(); rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR); BTextView* packageDescriptionView = new DescriptionTextView( "package description", fontHeight * 13); packageDescriptionView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); packageDescriptionView->SetText(fInfo.GetDescription()); packageDescriptionView->MakeEditable(false); packageDescriptionView->MakeSelectable(false); packageDescriptionView->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor); BScrollView* descriptionScrollView = new BScrollView( "package description scroll view", packageDescriptionView, 0, false, true, B_NO_BORDER); // Install type menu field fInstallTypes = new BPopUpMenu(B_TRANSLATE("none")); BMenuField* installType = new BMenuField("install_type", B_TRANSLATE("Installation type:"), fInstallTypes); // Install type description text view fInstallTypeDescriptionView = new DescriptionTextView( "install type description", fontHeight * 4); fInstallTypeDescriptionView->MakeEditable(false); fInstallTypeDescriptionView->MakeSelectable(false); fInstallTypeDescriptionView->SetInsets(8, 0, 0, 0); // Left inset needs to match BMenuField text offset fInstallTypeDescriptionView->SetText( B_TRANSLATE("No installation type selected")); fInstallTypeDescriptionView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BFont font(be_plain_font); font.SetSize(ceilf(font.Size() * 0.85)); fInstallTypeDescriptionView->SetFontAndColor(&font, B_FONT_ALL, &textColor); BScrollView* installTypeScrollView = new BScrollView( "install type description scroll view", fInstallTypeDescriptionView, 0, false, true, B_NO_BORDER); // Destination menu field fDestination = new BPopUpMenu(B_TRANSLATE("none")); fDestField = new BMenuField("install_to", B_TRANSLATE("Install to:"), fDestination); fBeginButton = new BButton("begin_button", B_TRANSLATE("Begin"), new BMessage(P_MSG_INSTALL)); BLayoutItem* typeLabelItem = installType->CreateLabelLayoutItem(); BLayoutItem* typeMenuItem = installType->CreateMenuBarLayoutItem(); BLayoutItem* destFieldLabelItem = fDestField->CreateLabelLayoutItem(); BLayoutItem* destFieldMenuItem = fDestField->CreateMenuBarLayoutItem(); float forcedMinWidth = be_plain_font->StringWidth("XXX") * 5; destFieldMenuItem->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET)); typeMenuItem->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET)); BAlignment labelAlignment(B_ALIGN_RIGHT, B_ALIGN_VERTICAL_UNSET); typeLabelItem->SetExplicitAlignment(labelAlignment); destFieldLabelItem->SetExplicitAlignment(labelAlignment); // Build the layout BLayoutBuilder::Group<>(this, B_VERTICAL) .Add(descriptionScrollView) .AddGrid(B_USE_SMALL_SPACING, B_USE_DEFAULT_SPACING) .Add(typeLabelItem, 0, 0) .Add(typeMenuItem, 1, 0) .Add(installTypeScrollView, 1, 1) .Add(destFieldLabelItem, 0, 2) .Add(destFieldMenuItem, 1, 2) .End() .AddGroup(B_HORIZONTAL) .AddGlue() .Add(fBeginButton) .End() .SetInsets(B_USE_DEFAULT_SPACING) ; fBeginButton->MakeDefault(true); }