void ProxyView::DrawSadTab(const char *error) { BBitmap *sadTab = RetrieveBitmap(kSadTabBitmap, BRect(0, 0, 255, 255)); if (Window()->Lock()) { MovePenTo(Bounds().Width() / 2 - 127, Bounds().Height() / 2 - 177); DrawBitmap(sadTab); MovePenTo(Bounds().Width() / 2 - 45, Bounds().Height() / 2 + 55); BFont font; GetFont(&font); font.SetSize(18.0); font.SetFace(B_BOLD_FACE); SetFont(&font, B_FONT_SIZE | B_FONT_FACE); SetLowColor(0, 0, 0); SetHighColor(255, 255, 255); DrawString("Aw, Snap!"); MovePenTo(Bounds().Width() / 2 - 90, Bounds().Height() / 2 + 70); font.SetSize(12.0); font.SetFace(B_REGULAR_FACE); SetFont(&font, B_FONT_SIZE | B_FONT_FACE); DrawString(error); Window()->Unlock(); } }
// // appends 'line' to output widget with proper attributes void ydpDictionary::UpdateAttr(int newattr) { if (line.Length() == 0) return; rgb_color *colour; BFont myfont = cnf->currentFont; colour = &cnf->colour; if (newattr & A_SUPER) { myfont.SetSize(10.0); } if (newattr & A_BOLD) { myfont.SetFace(B_BOLD_FACE); } if (newattr & A_ITALIC) { myfont.SetFace(B_ITALIC_FACE); } if (newattr & A_COLOR0) { colour = &cnf->colour0; } if (newattr & A_COLOR1) { colour = &cnf->colour1; } if (newattr & A_COLOR2) { colour = &cnf->colour2; } outputView->SetFontAndColor(&myfont,B_FONT_ALL,colour); line = ConvertToUtf(line.String()); outputView->Insert(textlen,line.String(),line.Length()); textlen+=line.Length(); line=""; }
void MediaFileInfoView::Draw(BRect /*update*/) { font_height fh; GetFontHeight(&fh); BPoint p(2, fh.ascent + fh.leading); BFont font; GetFont(&font); font.SetFace(B_BOLD_FACE); font.SetSize(12); SetFont(&font); if (fMediaFile == NULL) { DrawString(NO_FILE_LABEL, p); return; } BString aFmt, vFmt, aDetails, vDetails, duration; _GetFileInfo(&aFmt, &vFmt, &aDetails, &vDetails, &duration); // draw filename DrawString(fRef.name, p); float lineHeight = fh.ascent + fh.descent + fh.leading; p.y += (float)ceil(lineHeight * 1.5); float durLen = StringWidth(DURATION_LABEL) + 5; float audLen = StringWidth(AUDIO_INFO_LABEL) + 5; float vidLen = StringWidth(VIDEO_INFO_LABEL) + 5; float maxLen = MAX(durLen, audLen); maxLen = MAX(maxLen, vidLen); // draw labels DrawString(AUDIO_INFO_LABEL, p + BPoint(maxLen - audLen, 0)); BPoint p2 = p; p2.x += maxLen + 4; p.y += lineHeight * 2; DrawString(VIDEO_INFO_LABEL, p + BPoint(maxLen - vidLen, 0)); p.y += lineHeight * 2; DrawString(DURATION_LABEL, p + BPoint(maxLen - durLen, 0)); // draw audio/video/duration info font.SetFace(B_REGULAR_FACE); font.SetSize(10); SetFont(&font); DrawString(aFmt.String(), p2); p2.y += lineHeight; DrawString(aDetails.String(), p2); p2.y += lineHeight; DrawString(vFmt.String(), p2); p2.y += lineHeight; DrawString(vDetails.String(), p2); p2.y += lineHeight; DrawString(duration.String(), p2); }
PieView::PieView(BVolume* volume) : BView(NULL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_SUBPIXEL_PRECISE), fWindow(NULL), fScanner(NULL), fVolume(volume), fMouseOverInfo(), fClicked(false), fDragging(false), fUpdateFileAt(false) { fMouseOverMenu = new BPopUpMenu(kEmptyStr, false, false); fMouseOverMenu->AddItem(new BMenuItem(B_TRANSLATE("Get Info"), NULL), kIdxGetInfo); fMouseOverMenu->AddItem(new BMenuItem(B_TRANSLATE("Open"), NULL), kIdxOpen); fFileUnavailableMenu = new BPopUpMenu(kEmptyStr, false, false); BMenuItem* item = new BMenuItem(B_TRANSLATE("file unavailable"), NULL); item->SetEnabled(false); fFileUnavailableMenu->AddItem(item); BFont font; GetFont(&font); font.SetSize(ceilf(font.Size() * 1.33)); font.SetFace(B_BOLD_FACE); SetFont(&font); struct font_height fh; font.GetHeight(&fh); fFontHeight = ceilf(fh.ascent) + ceilf(fh.descent) + ceilf(fh.leading); }
status_t ScreenSaver::StartSaver(BView *view, bool preview) { // save view dimensions and preview mode fIsPreview = preview; fSizeX = view->Bounds().Width(); fSizeY = view->Bounds().Height(); // set a new font, about 1/8th of view height, and bold BFont font; view->GetFont(&font); font.SetSize(fSizeY / 8); font.SetFace(B_BOLD_FACE); view->SetFont(&font); // find out space needed for text display BRect rect; escapement_delta delta; delta.nonspace = 0; delta.space = 0; font.GetBoundingBoxesForStrings(&fText, 1, B_SCREEN_METRIC, &delta, &rect); fTextHeight = rect.Height(); fTextWith = rect.Width(); // seed the random number generator srand((int)system_time()); return B_OK; }
void SyslogDaemon::AboutRequested() { BPath path; find_directory(B_SYSTEM_LOG_DIRECTORY, &path); path.Append("syslog"); BString name(B_TRANSLATE("Syslog Daemon")); BString message; snprintf(message.LockBuffer(512), 512, B_TRANSLATE("%s\n\nThis daemon is responsible for collecting " "all system messages and write them to the system-wide log " "at \"%s\".\n\n"), name.String(), path.Path()); message.UnlockBuffer(); BAlert *alert = new BAlert(name.String(), message.String(), B_TRANSLATE("OK")); BTextView *view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); font.SetSize(21); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, name.Length(), &font); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(NULL); }
status_t CanvasMessage::ReadFontState(BFont& font) { uint8 encoding, spacing; uint16 face; uint32 flags, familyAndStyle; font_direction direction; float falseBoldWidth, rotation, shear, size; Read(direction); Read(encoding); Read(flags); Read(spacing); Read(shear); Read(rotation); Read(falseBoldWidth); Read(size); Read(face); status_t result = Read(familyAndStyle); if (result != B_OK) return result; font.SetFamilyAndStyle(familyAndStyle); font.SetEncoding(encoding); font.SetFlags(flags); font.SetSpacing(spacing); font.SetShear(shear); font.SetRotation(rotation); font.SetFalseBoldWidth(falseBoldWidth); font.SetSize(size); font.SetFace(face); return B_OK; }
void PulseApp::ShowAbout(bool asApplication) { // static version to be used in replicant mode BString name; if (asApplication) name = B_TRANSLATE_SYSTEM_NAME("Pulse"); else name = B_TRANSLATE("Pulse"); BString message = B_TRANSLATE( "%s\n\nBy David Ramsey and Arve Hjønnevåg\n" "Revised by Daniel Switkin\n"); message.ReplaceFirst("%s", name); BAlert *alert = new BAlert(B_TRANSLATE("Info"), message.String(), B_TRANSLATE("OK")); BTextView* view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); font.SetSize(18); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, name.Length(), &font); alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); // Use the asynchronous version so we don't block the window's thread alert->Go(NULL); }
void WorkspacesView::_AboutRequested() { BString text = B_TRANSLATE("Workspaces\n" "written by %1, and %2.\n\n" "Copyright %3, Haiku.\n\n" "Send windows behind using the Option key. " "Move windows to front using the Control key.\n"); text.ReplaceFirst("%1", "François Revol, Axel Dörfler"); text.ReplaceFirst("%2", "Matt Madia"); text.ReplaceFirst("%3", "2002-2008"); BAlert *alert = new BAlert("about", text.String(), B_TRANSLATE("OK")); BTextView *view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); font.SetSize(18); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 10, &font); alert->Go(); }
void URLInputGroup::URLTextView::InsertText(const char* inText, int32 inLength, int32 inOffset, const text_run_array* inRuns) { // Filter all line breaks, note that inText is not terminated. if (inLength == 1) { if (*inText == '\n' || *inText == '\r') BTextView::InsertText(" ", 1, inOffset, inRuns); else BTextView::InsertText(inText, 1, inOffset, inRuns); } else { BString filteredText(inText, inLength); filteredText.ReplaceAll('\n', ' '); filteredText.ReplaceAll('\r', ' '); BTextView::InsertText(filteredText.String(), inLength, inOffset, inRuns); } // Make the base URL part bold. BString text(Text(), TextLength()); int32 baseUrlStart = text.FindFirst("://"); if (baseUrlStart >= 0) baseUrlStart += 3; else baseUrlStart = 0; int32 baseUrlEnd = text.FindFirst("/", baseUrlStart); if (baseUrlEnd < 0) baseUrlEnd = TextLength(); BFont font; GetFont(&font); const rgb_color black = (rgb_color) { 0, 0, 0, 255 }; const rgb_color gray = (rgb_color) { 60, 60, 60, 255 }; if (baseUrlStart > 0) SetFontAndColor(0, baseUrlStart, &font, B_FONT_ALL, &gray); if (baseUrlEnd > baseUrlStart) { font.SetFace(B_BOLD_FACE); SetFontAndColor(baseUrlStart, baseUrlEnd, &font, B_FONT_ALL, &black); } if (baseUrlEnd < TextLength()) { font.SetFace(B_REGULAR_FACE); SetFontAndColor(baseUrlEnd, TextLength(), &font, B_FONT_ALL, &gray); } fURLAutoCompleter->TextModified(fUpdateAutoCompleterChoices); }
void AccListItem::DrawItem(BView *owner, BRect frame, bool complete) { if (disabled) return; if (IsSelected()) { rgb_color c = cm.ColorNumber(((BListView*)owner)->CurrentSelection()); owner->SetHighColor(c); owner->SetLowColor(c); } else { owner->SetHighColor(255, 255, 255); owner->SetLowColor(255, 255, 255); } owner->FillRect(frame); if (IsSelected()) { owner->SetHighColor(156, 156, 156); owner->StrokeRect(frame); } if (IsEnabled()) owner->SetHighColor(0, 0, 0); else owner->SetHighColor(222, 222, 222); BFont font; owner->GetFont(&font); font.SetFace(B_BOLD_FACE); font.SetSize(11); owner->SetFont(&font); owner->DrawString(acc->name.c_str(), BPoint(frame.left + 5, frame.top + 14)); font.SetFace(B_REGULAR_FACE); font.SetSize(10); owner->SetFont(&font); if (!acc->traS.empty()) { string text = "Balance = "; text += prefs->currencyToString((*acc->traS.rbegin())->balFol); owner->DrawString(text.c_str(), BPoint(frame.left + 5, frame.top + 26)); text = "Rec.Bal. = "; text += prefs->currencyToString((*acc->traS.rbegin())->recBalFol); owner->DrawString(text.c_str(), BPoint(frame.left + 5, frame.top + 38)); } }
void DataTranslationsWindow::_ShowInfoAlert(int32 id) { const char* name = NULL; const char* info = NULL; BPath path; int32 version = 0; _GetTranslatorInfo(id, name, info, version, path); const char* labels[] = { B_TRANSLATE("Name:"), B_TRANSLATE("Version:"), B_TRANSLATE("Info:"), B_TRANSLATE("Path:"), NULL }; int offsets[4]; BString message; BString temp; offsets[0] = 0; temp.SetToFormat("%s %s\n", labels[0], name); message.Append(temp); offsets[1] = message.Length(); // Convert the version number into a readable format temp.SetToFormat("%s %" B_PRId32 ".%" B_PRId32 ".%" B_PRId32 "\n\n", labels[1], B_TRANSLATION_MAJOR_VERSION(version), B_TRANSLATION_MINOR_VERSION(version), B_TRANSLATION_REVISION_VERSION(version)); message.Append(temp); offsets[2] = message.Length(); temp.SetToFormat("%s\n%s\n\n", labels[2], info); message.Append(temp); offsets[3] = message.Length(); temp.SetToFormat("%s %s\n", labels[3], path.Path()); message.Append(temp); BAlert* alert = new BAlert(B_TRANSLATE("Info"), message.String(), B_TRANSLATE("OK")); BTextView* view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); font.SetFace(B_BOLD_FACE); for (int32 i = 0; labels[i]; i++) { view->SetFontAndColor(offsets[i], offsets[i] + strlen(labels[i]), &font); } alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); }
void TeamDescriptionView::SetItem(TeamListItem* item) { fItem = item; if (item == NULL) { int32 styleStart = 0; int32 styleEnd = 0; BString text; text.SetToFormat(fInfoString, fSeconds); fInfoTextView->SetText(text); if (fRebootRunner != NULL && fSeconds < 4) { styleStart = text.FindLast('\n'); styleEnd = text.Length(); } if (styleStart != styleEnd && fInfoTextView != NULL) { BFont font; fInfoTextView->GetFont(&font); font.SetFace(B_BOLD_FACE); fInfoTextView->SetStylable(true); fInfoTextView->SetFontAndColor(styleStart, styleEnd, &font); } } else { fTeamName->SetText(item->Path()->Path()); if (item->IsSystemServer()) { if (fSysComponent->IsHidden(fSysComponent)) fSysComponent->Show(); } else { if (!fSysComponent->IsHidden(fSysComponent)) fSysComponent->Hide(); } if (item->IsRefusingToQuit()) { if (fQuitOverdue->IsHidden(fQuitOverdue)) fQuitOverdue->Show(); } else { if (!fQuitOverdue->IsHidden(fQuitOverdue)) fQuitOverdue->Hide(); } fIconView->SetIcon(item->Path()->Path()); } if (fLayout == NULL) return; if (item == NULL) fLayout->SetVisibleItem((int32)0); else fLayout->SetVisibleItem((int32)1); Invalidate(); }
/*********************************************************** * DrawString ***********************************************************/ void HToolbarButton::DrawString(BView *view ,const char* label,bool downState,bool enabled) { BRect bounds = view->Bounds(); if(NORMAL_WIDTH == bounds.Width()) return; int32 x,y; BFont font; font.SetFamilyAndStyle("Swis721 BT","Roman"); font.SetSize(10); font.SetSpacing(B_BITMAP_SPACING); font_height height; font.GetHeight(&height); float h = height.ascent + height.descent; y = (int32)(bounds.bottom - h + 4); float w = view->StringWidth(label); if(w > bounds.Width()) x = 1; else{ x = (int32)(bounds.Width() - w)/2; } if(downState) { x ++; y ++; } view->SetLowColor(bgcolor); /* if(enabled && !downState) { view->SetHighColor(237,237,237); view->SetDrawingMode(B_OP_COPY); font.SetFace(B_BOLD_FACE); view->SetFont(&font); view->DrawString(label,BPoint(x+1,y+1)); } */ if(enabled) { if(!downState) view->SetHighColor(Black); else view->SetHighColor(255,0,0); }else view->SetHighColor(BeDarkShadow); font.SetFace(B_REGULAR_FACE); view->SetFont(&font); view->DrawString(label,BPoint(x,y)); }
void SpecialModelMenuItem::DrawContent() { Menu()->PushState(); BFont font; Menu()->GetFont(&font); font.SetFace(B_ITALIC_FACE); Menu()->SetFont(&font); _inherited::DrawContent(); Menu()->PopState(); }
void AboutWindow::Show() { BAlert* alert = new BAlert("About" B_UTF8_ELLIPSIS, fText->String(), "Close"); BTextView* view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); font.SetFace(B_BOLD_FACE); font.SetSize(font.Size() * 1.7f); view->SetFontAndColor(0, fAppName->Length(), &font); alert->Go(); }
AboutView::AboutView(const char* appName, const char* signature) : BGroupView("AboutView", B_VERTICAL) { fNameView = new BStringView("name", appName); BFont font; fNameView->GetFont(&font); font.SetFace(B_BOLD_FACE); font.SetSize(font.Size() * 2.0); fNameView->SetFont(&font, B_FONT_FAMILY_AND_STYLE | B_FONT_SIZE | B_FONT_FLAGS); fVersionView = new BStringView("version", _GetVersionFromSignature(signature)); fInfoView = new BTextView("info", B_WILL_DRAW); fInfoView->SetExplicitMinSize(BSize(210.0, 160.0)); fInfoView->MakeEditable(false); fInfoView->SetWordWrap(true); fInfoView->SetInsets(5.0, 5.0, 5.0, 5.0); fInfoView->SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR)); fInfoView->SetHighColor(ui_color(B_DOCUMENT_TEXT_COLOR)); fInfoView->SetStylable(true); BScrollView* infoViewScroller = new BScrollView( "infoViewScroller", fInfoView, B_WILL_DRAW | B_FRAME_EVENTS, false, true, B_PLAIN_BORDER); fStripeView = new StripeView(_GetIconFromSignature(signature)); const char* ok = B_TRANSLATE_MARK("Ok"); BButton* closeButton = new BButton("ok", gSystemCatalog.GetString(ok, "AboutWindow"), new BMessage(B_QUIT_REQUESTED)); GroupLayout()->SetSpacing(0); BLayoutBuilder::Group<>(this) .AddGroup(B_HORIZONTAL, 0) .Add(fStripeView) .AddGroup(B_VERTICAL, B_USE_SMALL_SPACING) .SetInsets(0, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) .Add(fNameView) .Add(fVersionView) .Add(infoViewScroller) .Add(closeButton) .End() .AddGlue() .End(); }
void WizardPageView::MakeHeading(BTextView* view) { const char* text = view->Text(); const char* firstLineEnd = strchr(text, '\n'); if (firstLineEnd != NULL) { int indexFirstLineEnd = firstLineEnd - text; BFont font; view->GetFont(&font); font.SetSize(ceil(font.Size() * 1.2)); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, indexFirstLineEnd, &font); } }
void TeamDescriptionView::SetItem(TeamListItem* item) { fItem = item; int32 styleStart = 0; int32 styleEnd = 0; BTextView* view = NULL; if (item == NULL) { BString text; text.SetToFormat(fInfoString, fSeconds); fInfoTextView->SetText(text); if (fRebootRunner != NULL && fSeconds < 4) { styleStart = text.FindLast('\n'); styleEnd = text.Length(); } view = fInfoTextView; } else { BString text = item->Path()->Path(); if (item->IsSystemServer()) text << "\n" << fSysComponentString; if (item->IsRefusingToQuit()) { text << "\n\n" << fQuitOverdueString; styleStart = text.FindLast('\n'); styleEnd = text.Length(); } view = fIconTextView; fIconTextView->SetText(text); fIconView->SetIcon(item->Path()->Path()); } if (styleStart != styleEnd && view != NULL) { BFont font; view->GetFont(&font); font.SetFace(B_BOLD_FACE); view->SetStylable(true); view->SetFontAndColor(styleStart, styleEnd, &font); } if (fLayout == NULL) return; if (item == NULL) fLayout->SetVisibleItem((int32)0); else fLayout->SetVisibleItem((int32)1); Invalidate(); }
void AntialiasingSettingsView::_UpdateColors() { #ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING rgb_color infoColor = disable_color(ui_color(B_PANEL_BACKGROUND_COLOR), ui_color(B_PANEL_TEXT_COLOR)); BFont font; uint32 mode = 0; fSubpixelAntialiasingDisabledLabel->GetFontAndColor(&font, &mode); font.SetFace(B_ITALIC_FACE); fSubpixelAntialiasingDisabledLabel->SetFontAndColor(&font, mode, &infoColor); #endif }
void NetServer::AboutRequested() { BAlert *alert = new BAlert("about", "Networking Server\n" "\tCopyright " B_UTF8_COPYRIGHT "2006, Antares.\n", "OK"); BTextView *view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); font.SetSize(18); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 17, &font); alert->Go(NULL); }
void FontsApp::AboutRequested() { BAlert *alert = new BAlert("about", B_TRANSLATE("Fonts\n" "\tCopyright 2004-2005, Haiku.\n\n"), B_TRANSLATE("OK")); BTextView *view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); font.SetSize(18); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 5, &font); alert->Go(); }
void InstallerApp::AboutRequested() { BAlert *alert = new BAlert("about", B_TRANSLATE("Installer\n" "\twritten by Jérôme Duval and Stephan Aßmus\n" "\tCopyright 2005-2010, Haiku.\n\n"), B_TRANSLATE("OK")); BTextView *view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); font.SetSize(18); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 9, &font); alert->Go(); }
void CharacterMap::AboutRequested() { BAlert *alert = new BAlert("about", "CharacterMap\n" "\twritten by Axel Dörfler\n" "\tCopyright 2009, Antares, Inc.\n", "OK"); BTextView *view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); font.SetSize(18); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 12, &font); alert->Go(); }
/*static*/ void Debugger::ShowAbout() { BAlert *alert = new BAlert("about", "Debugger\n" "\twritten by Philippe Houdoin\n" "\tCopyright 2009, Haiku, Inc.\n", "OK"); BTextView *view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); font.SetSize(18); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 15, &font); alert->Go(); }
void DataTranslationsApplication::AboutRequested() { BAlert* alert = new BAlert("about", "DataTranslations\n\twritten by Oliver " "Siebenmarck and others\n\tCopyright 2002-2010, Haiku Inc. All rights " "reserved.\n", "OK"); BTextView* view = alert->TextView(); view->SetStylable(true); BFont font; view->GetFont(&font); font.SetSize(18); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 16, &font); alert->Go(); }
void VirtualMemory::AboutRequested() { BAlert* alert = new BAlert("about", TR("VirtualMemory\n" "\twritten by Axel Dörfler\n" "\tCopyright 2005, Antares.\n"), TR("OK")); BTextView* view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); font.SetSize(18); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 13, &font); alert->Go(); }
void PowerStatusReplicant::_AboutRequested() { BAlert* alert = new BAlert(B_TRANSLATE("About"), B_TRANSLATE("PowerStatus\n" "written by Axel Dörfler, Clemens Zeidler\n" "Copyright 2006, Haiku, Inc.\n"), B_TRANSLATE("OK")); BTextView *view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); font.SetSize(18); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, strlen(B_TRANSLATE("PowerStatus")), &font); alert->Go(); }
void StatusView::_AboutRequested() { BAlert *alert = new BAlert("about", B_TRANSLATE("CPUFrequency\n" "\twritten by Clemens Zeidler\n" "\tCopyright 2009, Haiku, Inc.\n"), B_TRANSLATE("Ok")); BTextView *view = alert->TextView(); BFont font; view->SetStylable(true); view->GetFont(&font); font.SetSize(18); font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 13, &font); alert->Go(); }
bool ResultWindow::AddLocationChanges(const char* location, const PackageList& packagesToInstall, const PackageSet& packagesAlreadyAdded, const PackageList& packagesToUninstall, const PackageSet& packagesAlreadyRemoved) { BGroupView* locationGroup = new BGroupView(B_VERTICAL); ObjectDeleter<BGroupView> locationGroupDeleter(locationGroup); locationGroup->GroupLayout()->SetInsets(B_USE_SMALL_INSETS); rgb_color background = ui_color(B_LIST_BACKGROUND_COLOR); if ((fContainerView->CountChildren() & 1) != 0) background = tint_color(background, 1.04); locationGroup->SetViewColor(background); BStringView* locationView = new BStringView(NULL, BString().SetToFormat("in %s:", location)); locationGroup->AddChild(locationView); locationView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); BFont locationFont; locationView->GetFont(&locationFont); locationFont.SetFace(B_BOLD_FACE); locationView->SetFont(&locationFont); BGroupLayout* packagesGroup = new BGroupLayout(B_VERTICAL); locationGroup->GroupLayout()->AddItem(packagesGroup); packagesGroup->SetInsets(20, 0, 0, 0); bool packagesAdded = _AddPackages(packagesGroup, packagesToInstall, packagesAlreadyAdded, true); packagesAdded |= _AddPackages(packagesGroup, packagesToUninstall, packagesAlreadyRemoved, false); if (!packagesAdded) return false; fContainerView->AddChild(locationGroup); locationGroupDeleter.Detach(); return true; }