TextRequestDialog::TextRequestDialog(const char *title, const char *information, const char *request, const char *text) : BWindow(kWindowRect, title, B_MODAL_WINDOW, B_NOT_RESIZABLE | B_NOT_CLOSABLE, 0), fInvoker(NULL) { BRect rect = Bounds(); BView *backgroundView = new BView(rect, "background", B_FOLLOW_ALL_SIDES, 0); backgroundView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); rect.InsetBy(5, 5); rect.bottom = rect.top; // init if(information) { BRect textRect(rect); textRect.OffsetTo(0, 0); fTextView = new BTextView(rect, "TextView", textRect, B_FOLLOW_NONE, B_WILL_DRAW); fTextView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fTextView->MakeSelectable(false); fTextView->MakeEditable(false); fTextView->SetText(information); float textHeight = fTextView->TextHeight(0, fTextView->CountLines()); backgroundView->ResizeBy(0, textHeight + 5); ResizeBy(0, textHeight + 5); fTextView->ResizeBy(0, textHeight - textRect.Height()); rect.bottom += textHeight + 5; backgroundView->AddChild(fTextView); } else fTextView = NULL; rect.top = rect.bottom + 5; rect.bottom = rect.top + 20; fTextControl = new BTextControl(rect, "request", request, text, NULL); fTextControl->SetModificationMessage(new BMessage(kMsgUpdateControls)); fTextControl->SetDivider(fTextControl->StringWidth(fTextControl->Label()) + 5); if(text && strlen(text) > 0) fTextControl->TextView()->SelectAll(); rect.top = rect.bottom + 10; rect.bottom = rect.top + 25; rect.left = rect.right - kDefaultButtonWidth; BMessage message(kMsgButton); message.AddInt32("which", 1); fOKButton = new BButton(rect, "okButton", kLabelOK, new BMessage(message)); rect.right = rect.left - 10; rect.left = rect.right - kDefaultButtonWidth; message.ReplaceInt32("which", 0); BButton *cancelButton = new BButton(rect, "cancelButton", kLabelCancel, new BMessage(message)); backgroundView->AddChild(cancelButton); backgroundView->AddChild(fOKButton); backgroundView->AddChild(fTextControl); AddChild(backgroundView); fTextControl->MakeFocus(true); SetDefaultButton(fOKButton); UpdateControls(); }
ScreenSaverWindow::ScreenSaverWindow() : BWindow(BRect(50.0f, 50.0f, 50.0f + kWindowWidth, 50.0f + kWindowHeight), B_TRANSLATE_SYSTEM_NAME("ScreenSaver"), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS) { fSettings.Load(); fMinWidth = floorf(be_control_look->DefaultItemSpacing() * (kWindowWidth / kDefaultItemSpacingAt12pt)); font_height fontHeight; be_plain_font->GetHeight(&fontHeight); float textHeight = ceilf(fontHeight.ascent + fontHeight.descent); fMinHeight = ceilf(std::max(kWindowHeight, textHeight * 28)); // Create the password editing window fPasswordWindow = new PasswordWindow(fSettings); fPasswordWindow->Run(); // Create the tab view fTabView = new TabView(); fTabView->SetBorder(B_NO_BORDER); // Create the controls inside the tabs fFadeView = new FadeView(B_TRANSLATE("General"), fSettings); fModulesView = new ModulesView(B_TRANSLATE("Screensavers"), fSettings); fTabView->AddTab(fFadeView); fTabView->AddTab(fModulesView); // Create the topmost background view BView* topView = new BView("topView", B_WILL_DRAW); topView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); topView->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH, B_ALIGN_USE_FULL_HEIGHT)); topView->SetExplicitMinSize(BSize(fMinWidth, fMinHeight)); BLayoutBuilder::Group<>(topView, B_VERTICAL) .SetInsets(0, B_USE_DEFAULT_SPACING, 0, B_USE_WINDOW_SPACING) .Add(fTabView) .End(); SetLayout(new BGroupLayout(B_VERTICAL)); GetLayout()->AddView(topView); fTabView->Select(fSettings.WindowTab()); if (fSettings.WindowFrame().left > 0 && fSettings.WindowFrame().top > 0) MoveTo(fSettings.WindowFrame().left, fSettings.WindowFrame().top); if (fSettings.WindowFrame().Width() > 0 && fSettings.WindowFrame().Height() > 0) { ResizeTo(fSettings.WindowFrame().Width(), fSettings.WindowFrame().Height()); } CenterOnScreen(); }
DocInfoWindow::DocInfoWindow(BMessage *docInfo) : HWindow(BRect(0, 0, 400, 250), "Document information", B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_MINIMIZABLE | B_CLOSE_ON_ESCAPE), fDocInfo(docInfo) { BRect bounds(Bounds()); BView *background = new BView(bounds, "bachground", B_FOLLOW_ALL, B_WILL_DRAW); background->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(background); bounds.InsetBy(10.0, 10.0); BButton *button = new BButton(bounds, "ok", "OK", new BMessage(OK_MSG), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); background->AddChild(button); button->ResizeToPreferred(); button->MoveTo(bounds.right - button->Bounds().Width(), bounds.bottom - button->Bounds().Height()); BRect buttonFrame(button->Frame()); button = new BButton(buttonFrame, "cancel", "Cancel", new BMessage(CANCEL_MSG), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); background->AddChild(button); button->ResizeToPreferred(); button->MoveTo(buttonFrame.left - (button->Bounds().Width() + 10.0), buttonFrame.top); bounds.bottom = buttonFrame.top - 10.0; #if HAVE_FULLVERSION_PDF_LIB BString permissions; if (_DocInfo()->FindString("permissions", &permissions) == B_OK) fPermissions.Decode(permissions.String()); BTabView *tabView = new BTabView(bounds, "tabView"); _SetupDocInfoView(_CreateTabPanel(tabView, "Information")); _SetupPasswordView(_CreateTabPanel(tabView, "Password")); _SetupPermissionsView(_CreateTabPanel(tabView, "Permissions")); background->AddChild(tabView); #else BBox* panel = new BBox(bounds, "top_panel", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_NO_BORDER); _SetupDocInfoView(panel); background->AddChild(panel); #endif if (fTable->ChildAt(0)) fTable->ChildAt(0)->MakeFocus(); BRect winFrame(Frame()); BRect screenFrame(BScreen().Frame()); MoveTo((screenFrame.right - winFrame.right) / 2, (screenFrame.bottom - winFrame.bottom) / 2); SetSizeLimits(400.0, 10000.0, 250.0, 10000.0); }
PowerStatusWindow::PowerStatusWindow() : BWindow(BRect(100, 150, 281, 299), B_TRANSLATE_SYSTEM_NAME("PowerStatus"), B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) { BView* topView = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW); topView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(topView); topView->AddChild(new PowerStatusReplicant(Bounds(), B_FOLLOW_ALL)); }
void ModulesView::_OpenSaver() { // create new screen saver preview & config BView* view = fPreviewView->AddPreview(); fCurrentName = fSettings.ModuleName(); fSaverRunner = new ScreenSaverRunner(view->Window(), view, fSettings); #ifdef __HAIKU__ BRect rect = fSettingsBox->InnerFrame().InsetByCopy(4, 4); #else BRect rect = fSettingsBox->Bounds().InsetByCopy(4, 4); rect.top += 14; #endif fSettingsView = new BView(rect, "SettingsView", B_FOLLOW_ALL, B_WILL_DRAW); fSettingsView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fSettingsBox->AddChild(fSettingsView); BScreenSaver* saver = ScreenSaver(); if (saver != NULL && fSettingsView != NULL) { saver->StartConfig(fSettingsView); if (saver->StartSaver(view, true) == B_OK) { fPreviewView->HideNoPreview(); fSaverRunner->Run(); } else fPreviewView->ShowNoPreview(); } else { // Failed to load OR this is the "Blackness" screensaver. Show a black // preview (this is what will happen in both cases when screen_blanker // runs). fPreviewView->HideNoPreview(); } if (fSettingsView->ChildAt(0) == NULL) { // There are no settings at all, we add the module name here to // let it look a bit better at least. BPrivate::BuildDefaultSettingsView(fSettingsView, fSettings.ModuleName()[0] ? fSettings.ModuleName() : B_TRANSLATE("Blackness"), saver != NULL || !fSettings.ModuleName()[0] ? B_TRANSLATE("No options available") : B_TRANSLATE("Could not load screen saver")); } }
ImageEditor::ImageEditor(const BRect &frame, ResourceData *data, BHandler *owner) : Editor(frame, data, owner) { SetFlags(Flags() | B_NOT_RESIZABLE | B_NOT_ZOOMABLE); SetTitle(data->GetName()); // Set up the image and the viewer for such BMemoryIO memio(data->GetData(), data->GetLength()); fImage = BTranslationUtils::GetBitmap(&memio); BRect imgsize; if (fImage) imgsize = ScaleRectToFit(fImage->Bounds(), BRect(0, 0, 200, 200)); else imgsize.Set(0, 0, 200, 200); BView *back = new BView(Bounds(), "back", B_FOLLOW_ALL, B_WILL_DRAW); back->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(back); 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: ", data->GetIDString(), NULL); fIDBox->SetDivider(labelwidth + 5); back->AddChild(fIDBox); r = fIDBox->Frame(); r.OffsetBy(r.Width() + 10, 0); r.right = Bounds().right - 10; fNameBox = new BTextControl(r, "name", "Name: ", data->GetName(), NULL, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); fNameBox->SetDivider(be_plain_font->StringWidth("Name: ") + 5); back->AddChild(fNameBox); r = imgsize; r.OffsetTo( (Bounds().Width() - r.Width()) / 2, fNameBox->Frame().bottom + 10); fImageView = new BitmapView(r, "imageview", new BMessage(M_IMAGE_CHANGED), fImage, NULL, B_PLAIN_BORDER, B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS); back->AddChild(fImageView); fImageView->SetConstrainDrops(false); // No limit on bitmap size fImageView->SetMaxBitmapSize(0, 0); fImageView->SetBitmapRemovable(false); 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"); fOK->MakeDefault(true); back->AddChild(fOK); fOK->MoveTo(Bounds().right - fOK->Bounds().Width() - 10, Bounds().bottom - fOK->Bounds().Height() - 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); back->AddChild(fCancel); ResizeTo(MAX(fImageView->Frame().right, fNameBox->Frame().right) + 20, fImageView->Frame().bottom + fOK->Frame().Height() + 20); SetSizeLimits(Bounds().right, 30000, Bounds().bottom, 30000); }
FindWindow::FindWindow(BRect _rect, BMessage& previous, BMessenger& target, const BMessage* settings) : BWindow(_rect, B_TRANSLATE("Find"), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_CLOSE_ON_ESCAPE), fTarget(target) { BView* view = new BView(Bounds(), "main", B_FOLLOW_ALL, 0); view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(view); int8 mode = kAsciiMode; if (previous.FindInt8("find_mode", &mode) != B_OK && settings != NULL) settings->FindInt8("find_mode", &mode); // add the top widgets fMenu = new BPopUpMenu("mode"); BMessage* message; BMenuItem* item; fMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Text"), message = new BMessage(kMsgFindMode))); message->AddInt8("mode", kAsciiMode); if (mode == kAsciiMode) item->SetMarked(true); fMenu->AddItem(item = new BMenuItem(B_TRANSLATE_COMMENT("Hexadecimal", "A menu item, as short as possible, noun is recommended if it is " "shorter than adjective."), message = new BMessage(kMsgFindMode))); message->AddInt8("mode", kHexMode); if (mode == kHexMode) item->SetMarked(true); BRect rect = Bounds().InsetByCopy(5, 5); BMenuField* menuField = new BMenuField(rect, B_EMPTY_STRING, B_TRANSLATE("Mode:"), fMenu, B_FOLLOW_LEFT | B_FOLLOW_TOP); menuField->SetDivider(menuField->StringWidth(menuField->Label()) + 8); menuField->ResizeToPreferred(); view->AddChild(menuField); // add the bottom widgets BButton* button = new BButton(rect, B_EMPTY_STRING, B_TRANSLATE("Find"), new BMessage(kMsgStartFind), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); button->MakeDefault(true); button->ResizeToPreferred(); button->MoveTo(rect.right - button->Bounds().Width(), rect.bottom - button->Bounds().Height()); view->AddChild(button); fCaseCheckBox = new BCheckBox(rect, B_EMPTY_STRING, B_TRANSLATE("Case sensitive"), NULL, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); fCaseCheckBox->ResizeToPreferred(); fCaseCheckBox->MoveTo(5, button->Frame().top); bool caseSensitive; if (previous.FindBool("case_sensitive", &caseSensitive) != B_OK) { if (settings == NULL || settings->FindBool("case_sensitive", &caseSensitive) != B_OK) caseSensitive = true; } fCaseCheckBox->SetValue(caseSensitive); view->AddChild(fCaseCheckBox); // and now those inbetween rect.top = menuField->Frame().bottom + 5; rect.bottom = fCaseCheckBox->Frame().top - 8; rect.InsetBy(2, 2); fTextView = new FindTextView(rect, B_EMPTY_STRING, rect.OffsetToCopy(B_ORIGIN).InsetByCopy(3, 3), B_FOLLOW_ALL); fTextView->SetWordWrap(true); fTextView->SetMode((find_mode)mode); fTextView->SetData(previous); BScrollView* scrollView = new BScrollView("scroller", fTextView, B_FOLLOW_ALL, B_WILL_DRAW, false, false); view->AddChild(scrollView); ResizeTo(290, button->Frame().Height() * 3 + 30); SetSizeLimits(fCaseCheckBox->Bounds().Width() + button->Bounds().Width() + 20, 32768, button->Frame().Height() * 3 + 10, 32768); }
SelectionWindow::SelectionWindow(BContainerWindow* window) : BWindow(BRect(0, 0, 270, 0), B_TRANSLATE("Select"), B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_V_RESIZABLE | B_NO_WORKSPACE_ACTIVATION | B_ASYNCHRONOUS_CONTROLS | B_NOT_ANCHORED_ON_ACTIVATE), fParentWindow(window) { if (window->Feel() & kDesktopWindowFeel) { // The window will not show up if we have // B_FLOATING_SUBSET_WINDOW_FEEL and use it with the desktop window // since it's never in front. SetFeel(B_NORMAL_WINDOW_FEEL); } AddToSubset(fParentWindow); BView* backgroundView = new BView(Bounds(), "bgView", B_FOLLOW_ALL, B_WILL_DRAW); backgroundView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); AddChild(backgroundView); BMenu* menu = new BPopUpMenu(""); menu->AddItem(new BMenuItem(B_TRANSLATE("starts with"), NULL)); menu->AddItem(new BMenuItem(B_TRANSLATE("ends with"), NULL)); menu->AddItem(new BMenuItem(B_TRANSLATE("contains"), NULL)); menu->AddItem(new BMenuItem(B_TRANSLATE("matches wildcard expression"), NULL)); menu->AddItem(new BMenuItem(B_TRANSLATE("matches regular expression"), NULL)); menu->SetLabelFromMarked(true); menu->ItemAt(3)->SetMarked(true); // Set wildcard matching to default. // Set up the menu field fMatchingTypeMenuField = new BMenuField(BRect(7, 6, Bounds().right - 5, 0), NULL, B_TRANSLATE("Name"), menu); backgroundView->AddChild(fMatchingTypeMenuField); fMatchingTypeMenuField->SetDivider(fMatchingTypeMenuField->StringWidth( B_TRANSLATE("Name")) + 8); fMatchingTypeMenuField->ResizeToPreferred(); // Set up the expression text control fExpressionTextControl = new BTextControl(BRect(7, fMatchingTypeMenuField->Bounds().bottom + 11, Bounds().right - 6, 0), NULL, NULL, NULL, NULL, B_FOLLOW_LEFT_RIGHT); backgroundView->AddChild(fExpressionTextControl); fExpressionTextControl->ResizeToPreferred(); fExpressionTextControl->MakeFocus(true); // Set up the Invert checkbox fInverseCheckBox = new BCheckBox( BRect(7, fExpressionTextControl->Frame().bottom + 6, 6, 6), NULL, B_TRANSLATE("Invert"), NULL); backgroundView->AddChild(fInverseCheckBox); fInverseCheckBox->ResizeToPreferred(); // Set up the Ignore Case checkbox fIgnoreCaseCheckBox = new BCheckBox( BRect(fInverseCheckBox->Frame().right + 10, fInverseCheckBox->Frame().top, 6, 6), NULL, B_TRANSLATE("Ignore case"), NULL); fIgnoreCaseCheckBox->SetValue(1); backgroundView->AddChild(fIgnoreCaseCheckBox); fIgnoreCaseCheckBox->ResizeToPreferred(); // Set up the Select button fSelectButton = new BButton(BRect(0, 0, 5, 5), NULL, B_TRANSLATE("Select"), new BMessage(kSelectButtonPressed), B_FOLLOW_RIGHT); backgroundView->AddChild(fSelectButton); fSelectButton->ResizeToPreferred(); fSelectButton->MoveTo(Bounds().right - 10 - fSelectButton->Bounds().right, fExpressionTextControl->Frame().bottom + 9); fSelectButton->MakeDefault(true); #if !B_BEOS_VERSION_DANO fSelectButton->SetLowColor(backgroundView->ViewColor()); fSelectButton->SetViewColor(B_TRANSPARENT_COLOR); #endif font_height fh; be_plain_font->GetHeight(&fh); // Center the checkboxes vertically to the button float topMiddleButton = (fSelectButton->Bounds().Height() / 2 - (fh.ascent + fh.descent + fh.leading + 4) / 2) + fSelectButton->Frame().top; fInverseCheckBox->MoveTo(fInverseCheckBox->Frame().left, topMiddleButton); fIgnoreCaseCheckBox->MoveTo(fIgnoreCaseCheckBox->Frame().left, topMiddleButton); float bottomMinWidth = 32 + fSelectButton->Bounds().Width() + fInverseCheckBox->Bounds().Width() + fIgnoreCaseCheckBox->Bounds().Width(); float topMinWidth = be_plain_font->StringWidth( B_TRANSLATE("Name matches wildcard expression:###")); float minWidth = bottomMinWidth > topMinWidth ? bottomMinWidth : topMinWidth; class EscapeFilter : public BMessageFilter { public: EscapeFilter(BWindow* target) : BMessageFilter(B_KEY_DOWN), fTarget(target) { } virtual filter_result Filter(BMessage* message, BHandler** _target) { int8 byte; if (message->what == B_KEY_DOWN && message->FindInt8("byte", &byte) == B_OK && byte == B_ESCAPE) { fTarget->Hide(); return B_SKIP_MESSAGE; } return B_DISPATCH_MESSAGE; } private: BWindow* fTarget; }; AddCommonFilter(new(std::nothrow) EscapeFilter(this)); Run(); Lock(); ResizeTo(minWidth, fSelectButton->Frame().bottom + 6); SetSizeLimits(minWidth, 1280, Bounds().bottom, Bounds().bottom); MoveCloseToMouse(); Unlock(); }
ActivityWindow::ActivityWindow() : BWindow(BRect(100, 100, 500, 350), B_TRANSLATE_SYSTEM_NAME("ActivityMonitor"), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE) { BMessage settings; _LoadSettings(settings); BRect frame; if (settings.FindRect("window frame", &frame) == B_OK) { MoveTo(frame.LeftTop()); ResizeTo(frame.Width(), frame.Height()); } else { float scaling = be_plain_font->Size() / 12.0f; ResizeTo(Frame().Width() * scaling, Frame().Height() * scaling); CenterOnScreen(); } #ifdef __HAIKU__ BGroupLayout* layout = new BGroupLayout(B_VERTICAL, 0); SetLayout(layout); // create GUI BMenuBar* menuBar = new BMenuBar("menu"); layout->AddView(menuBar); fLayout = new BGroupLayout(B_VERTICAL); float inset = ceilf(be_plain_font->Size() * 0.7); fLayout->SetInsets(B_USE_WINDOW_SPACING); fLayout->SetSpacing(inset); BView* top = new BView("top", 0, fLayout); layout->AddView(top); top->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BMessage viewState; int32 count = 0; for (int32 i = 0; settings.FindMessage("activity view", i, &viewState) == B_OK; i++) { ActivityView* view = new ActivityView("ActivityMonitor", &viewState); fLayout->AddItem(view->CreateHistoryLayoutItem()); fLayout->AddItem(view->CreateLegendLayoutItem()); count++; } if (count == 0) { // Add default views (memory & CPU usage) _AddDefaultView(); _AddDefaultView(); } #else // !__HAIKU__ BView *layout = new BView(Bounds(), "topmost", B_FOLLOW_NONE, 0); AddChild(layout); // create GUI BRect mbRect(Bounds()); mbRect.bottom = 10; BMenuBar* menuBar = new BMenuBar(mbRect, "menu"); layout->AddChild(menuBar); BRect topRect(Bounds()); topRect.top = menuBar->Bounds().bottom + 1; BView* top = new BView(topRect, "top", B_FOLLOW_ALL, 0); layout->AddChild(top); BMessage viewState; int32 count = 0; ActivityView *aview; BRect rect; for (int32 i = 0; settings.FindMessage("activity view", i, &viewState) == B_OK; i++) { aview = new ActivityView("ActivityMonitor", &viewState); if (!rect.IsValid()) rect = aview->Bounds(); else rect.OffsetBySelf(0.0, aview->Bounds().Height()); top->AddChild(aview); count++; } if (count == 0) top->AddChild(new ActivityView("ActivityMonitor", NULL)); #endif // add menu // "File" menu BMenu* menu = new BMenu(B_TRANSLATE("File")); menu->AddItem(new BMenuItem(B_TRANSLATE("Add graph"), new BMessage(kMsgAddView))); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED), 'Q')); menu->SetTargetForItems(this); menuBar->AddItem(menu); // "Settings" menu menu = new BMenu(B_TRANSLATE("Settings")); menu->AddItem(new BMenuItem(B_TRANSLATE("Settings" B_UTF8_ELLIPSIS), new BMessage(kMsgShowSettings))); menu->AddSeparatorItem(); fAlwaysOnTop = new BMenuItem(B_TRANSLATE("Always on top"), new BMessage(kMsgAlwaysOnTop)); _SetAlwaysOnTop(settings.GetBool("always on top", false)); menu->AddItem(fAlwaysOnTop); menu->SetTargetForItems(this); menuBar->AddItem(menu); }