StringInputWindow::StringInputWindow(const char *title, const char *text, BMessage msg, BMessenger target) : DWindow(BRect(0,0,300,200),title,B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_V_RESIZABLE), fMessage(msg), fMessenger(target) { MakeCenteredOnShow(true); BView *top = GetBackgroundView(); BRect r = Bounds().InsetByCopy(10,10); r.bottom = r.top + 10; BRect textRect = r.OffsetToCopy(0,0); textRect.InsetBy(10,10); fTextView = new BTextView(r,"paneltext",textRect,B_FOLLOW_LEFT | B_FOLLOW_TOP); top->AddChild(fTextView); fTextView->MakeEditable(false); fTextView->SetText(text); fTextView->ResizeTo(r.Width(), 20.0 + (fTextView->CountLines() * fTextView->TextHeight(0,fTextView->TextLength()))); fTextView->SetViewColor(top->ViewColor()); fText = new BTextControl(BRect(10,10,11,11),"nametext","", "", new BMessage); top->AddChild(fText); fText->ResizeToPreferred(); fText->ResizeTo(Bounds().Width() - 20,fText->Bounds().Height()); fText->SetDivider(0.0); fText->MoveTo(10,fTextView->Frame().bottom + 10.0); r = fText->Frame(); r.OffsetBy(0,r.Height() + 10.0); BButton *cancel = new BButton(r,"cancel","Cancel", new BMessage(B_QUIT_REQUESTED)); cancel->ResizeToPreferred(); top->AddChild(cancel); ResizeTo(300, cancel->Frame().bottom + 10); cancel->MoveTo( Bounds().Width() - (cancel->Bounds().Width() * 2) - 20, cancel->Frame().top); r = cancel->Frame(); r.OffsetBy(r.Width() + 10,0); BButton *open = new BButton(r,"ok","OK", new BMessage(M_INVOKE)); top->AddChild(open); open->MakeDefault(true); fText->MakeFocus(true); open->MakeDefault(true); }
void SetupView::AttachedToWindow() { float width = MAX(StringWidth(SERVER_TEXT), StringWidth(QUEUE_TEXT)) + 10; /* server name box */ fServerAddress = new BTextControl(SERVER_RECT, "", SERVER_TEXT, "<printer's hostname or address>", NULL); AddChild(fServerAddress); fServerAddress->SetDivider(width); /* queue name box */ fQueuePort = new BTextControl(QUEUE_RECT, "", QUEUE_TEXT, "9100", NULL); // 9100 is default HP JetDirect port number AddChild(fQueuePort); fQueuePort->SetDivider(width); /* cancel */ BButton* button = new BButton(CANCEL_RECT, "", CANCEL_TEXT, new BMessage(M_CANCEL)); AddChild(button); /* ok */ button = new BButton(OK_RECT, "", OK_TEXT, new BMessage(M_OK)); AddChild(button); button->MakeDefault(true); }
TStatusWindow::TStatusWindow(BRect rect, BMessenger target, const char* status) : BWindow(rect, "", B_MODAL_WINDOW, B_NOT_RESIZABLE), fTarget(target) { BView* view = new BView(Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW); view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(view); BRect r(STATUS_FIELD_H, STATUS_FIELD_V, STATUS_FIELD_WIDTH, STATUS_FIELD_V + STATUS_FIELD_HEIGHT); fStatus = new BTextControl(r, "", STATUS_TEXT, status, new BMessage(STATUS)); view->AddChild(fStatus); fStatus->SetDivider(fStatus->StringWidth(STATUS_TEXT) + 6); fStatus->BTextControl::MakeFocus(true); r.Set(S_OK_BUTTON_X1, S_OK_BUTTON_Y1, S_OK_BUTTON_X2, S_OK_BUTTON_Y2); BButton *button = new BButton(r, "", S_OK_BUTTON_TEXT, new BMessage(OK)); view->AddChild(button); button->MakeDefault(true); r.Set(S_CANCEL_BUTTON_X1, S_CANCEL_BUTTON_Y1, S_CANCEL_BUTTON_X2, S_CANCEL_BUTTON_Y2); button = new BButton(r, "", S_CANCEL_BUTTON_TEXT, new BMessage(CANCEL)); view->AddChild(button); Show(); }
GroupPropertiesView::GroupPropertiesView(BRect rect, const char *name) : BView(rect, "GroupInfoView", B_FOLLOW_ALL, B_WILL_DRAW) { newGroup = name == NULL; strcpy(group, newGroup ? "unknown" : name); getGroupDesc(group, desc, sizeof(desc)); rgb_color gray = ui_color(B_PANEL_BACKGROUND_COLOR); SetViewColor(gray); BRect bmpRect(0.0, 0.0, 31.0, 31.0); icon = new BBitmap(bmpRect, B_CMAP8); BMimeType mime("application/x-vnd.Teldar-Group"); mime.GetIcon(icon, B_LARGE_ICON); BRect r(10, 52, 200, 72); editName = new BTextControl(r, "GroupName", "Name:", group, NULL); editName->SetDivider(70); editName->SetEnabled(newGroup); AddChild(editName); r.Set(10, 77, 250, 97); editDesc = new BTextControl(r, "Description", "Description:", desc, NULL); editDesc->SetDivider(70); AddChild(editDesc); r.Set(205, 320, 275, 340); BButton *okBtn = new BButton(r, "OkayBtn", "OK", new BMessage(MSG_GROUP_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); okBtn->MakeDefault(true); AddChild(okBtn); r.Set(285, 320, 360, 340); AddChild(new BButton(r, "CancelBtn", "Cancel", new BMessage(MSG_GROUP_CANCEL), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM)); r.Set(285, 125, 360, 145); AddChild(new BButton(r, "AddUserBtn", "Add", new BMessage(MSG_GROUP_ADD), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM)); r.Set(285, 155, 360, 175); removeBtn = new BButton(r, "RemoveBtn", "Remove", new BMessage(MSG_GROUP_REMOVE), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); removeBtn->SetEnabled(false); AddChild(removeBtn); // Now add the membership list. CLVContainerView *listContView; r.Set(13, 125, 280 - B_V_SCROLL_BAR_WIDTH, 305); listView = new SmartColumnListView(r, &listContView, NULL, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE, B_SINGLE_SELECTION_LIST, false, false, true, false, B_FANCY_BORDER); listView->AddColumn(new CLVColumn(NULL, 20.0, CLV_LOCK_AT_BEGINNING | CLV_NOT_MOVABLE | CLV_NOT_RESIZABLE | CLV_PUSH_PASS | CLV_MERGE_WITH_RIGHT)); listView->AddColumn(new CLVColumn("User", 85.0, CLV_SORT_KEYABLE, 50.0)); listView->AddColumn(new CLVColumn("Full Name", 130.0, CLV_SORT_KEYABLE)); listView->SetSelectionMessage(new BMessage(MSG_MEMBER_SELECT)); listView->SetInvocationMessage(new BMessage(MSG_LIST_DESELECT)); AddGroupMembers(listView); AddChild(listContView); }
LoginView::LoginView(BRect rect, char *server, char *share) : BView(rect, "LoginView", B_FOLLOW_ALL, B_WILL_DRAW) { strcpy(resource, share); strcat(resource, " on "); strcat(resource, server); rgb_color gray = ui_color(B_PANEL_BACKGROUND_COLOR); SetViewColor(gray); BRect bmpRect(0.0, 0.0, 31.0, 31.0); icon = new BBitmap(bmpRect, B_CMAP8); BMimeType mime("application/x-vnd.Teldar-FileSharing"); mime.GetIcon(icon, B_LARGE_ICON); BRect r(10, 72, 240, 92); user = new BTextControl(r, "User", "User:"******"", NULL); user->SetDivider(55); AddChild(user); r.top = 97; r.bottom = r.top + 20; password = new BTextControl(r, "Password", "Password:"******"", NULL); password->SetDivider(55); password->TextView()->HideTyping(true); AddChild(password); r.Set(LOGIN_PANEL_WIDTH - 160, LOGIN_PANEL_HEIGHT - 33, LOGIN_PANEL_WIDTH - 90, LOGIN_PANEL_HEIGHT - 13); BButton *okBtn = new BButton(r, "OkayBtn", "Login", new BMessage(MSG_LOGIN_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); okBtn->MakeDefault(true); AddChild(okBtn); r.Set(LOGIN_PANEL_WIDTH - 80, LOGIN_PANEL_HEIGHT - 33, LOGIN_PANEL_WIDTH - 10, LOGIN_PANEL_HEIGHT - 13); AddChild(new BButton(r, "CancelBtn", "Cancel", new BMessage(MSG_LOGIN_CANCEL), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM)); }
InetHostView(BRect rect) : BView(rect, "InetHostView", B_FOLLOW_ALL, B_WILL_DRAW) { rgb_color gray = ui_color(B_PANEL_BACKGROUND_COLOR); SetViewColor(gray); BRect bmpRect(0.0, 0.0, 31.0, 31.0); icon = new BBitmap(bmpRect, B_CMAP8); BMimeType mime("application/x-vnd.BeServed-inetserver"); mime.GetIcon(icon, B_LARGE_ICON); BRect r(10, 52, 310, 72); editName = new BTextControl(r, "ShareName", "Name or Address:", "", NULL); editName->SetDivider(90); AddChild(editName); r.Set(155, 97, 225, 117); BButton *okBtn = new BButton(r, "OkayBtn", "OK", new BMessage(MSG_HOST_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); okBtn->MakeDefault(true); AddChild(okBtn); r.Set(235, 97, 310, 117); AddChild(new BButton(r, "CancelBtn", "Cancel", new BMessage(MSG_HOST_CANCEL), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM)); editName->MakeFocus(); }
void LprSetupView::AttachedToWindow() { float width = max(StringWidth(SERVER_TEXT), StringWidth(QUEUE_TEXT)) + 10; /* server name box */ // TODO remember previous value fServer = new BTextControl(SERVER_RECT, "", SERVER_TEXT, "192.168.0.0", NULL); AddChild(fServer); fServer->SetDivider(width); /* queue name box */ // TODO remember previous value fQueue = new BTextControl(QUEUE_RECT, "", QUEUE_TEXT, "LPT1_PASSTHRU", NULL); AddChild(fQueue); fQueue->SetDivider(width); /* cancel */ BButton *button = new BButton(CANCEL_RECT, "", CANCEL_TEXT, new BMessage(M_CANCEL)); AddChild(button); /* ok */ button = new BButton(OK_RECT, "", OK_TEXT, new BMessage(M_OK)); AddChild(button); button->MakeDefault(true); }
void AboutBoxView::AttachedToWindow() { BRect rect; rect.Set(110, 50, 175, 55); BButton *button = new BButton(rect, "", "OK", new BMessage(kMsgOK)); AddChild(button); button->MakeDefault(true); }
FindOpenFileWindow::FindOpenFileWindow(const char* panelText) : DWindow(BRect(0, 0, 0, 0), TR("Find and open file"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) { AddCommonFilter(new EscapeCancelFilter()); BView* top = GetBackgroundView(); fNameTextControl = new AutoTextControl("nameText", TR("Open: "), "", new BMessage); fNameTextControl->SetExplicitMinSize( BSize(fNameTextControl->StringWidth("M") * 20, B_SIZE_UNSET)); fSystemCheckBox = new BCheckBox("systembox", TR("Search only system folders"), new BMessage); BButton* cancel = new BButton("cancel", TR("Cancel"), new BMessage(B_QUIT_REQUESTED)); BButton* open = new BButton("open", TR("Open"), new BMessage(M_FIND_FILE)); BLayoutBuilder::Group<>(top, B_VERTICAL) .AddGrid(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) .Add(fNameTextControl->CreateLabelLayoutItem(), 0, 0) .Add(fNameTextControl->CreateTextViewLayoutItem(), 1, 0) .Add(fSystemCheckBox, 1, 1) .End() .AddGlue() .AddGroup(B_HORIZONTAL) .AddGlue() .Add(cancel) .Add(open) .End() .SetInsets(B_USE_WINDOW_INSETS) .End(); BString text = panelText; if (text.CountChars() > 1) { fNameTextControl->SetText(text.String()); int32 position = text.FindLast("."); if (position > 0) fNameTextControl->TextView()->Select(0, position); else fNameTextControl->TextView()->SelectAll(); } else { fNameTextControl->SetText(".h"); fNameTextControl->TextView()->GoToLine(0); } open->MakeDefault(true); fNameTextControl->MakeFocus(true); CenterOnScreen(); }
AskName::AskName(): BWindow(BRect(100, 100, 500, 200), "Enter your name", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE), Text(NULL), text(NULL) { BView *back; BButton * Accept; BTextView *TV; BStringView *str; const char *names[] = { "BeOS forever!", "BShisen Rules!", "Thanks Sheppy", "Say NO to drugs!", "Say NO to piracy!", "Say YES to BeOS!", "Just say \"BShisen\"", "Say YES to BShisen!", }; back = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW); back->SetViewColor(216, 216, 216); AddChild(back); str = new BStringView(BRect(10, 10, 390, 25), "", "Congratulations! Enter your name for posterity."); str->SetFont(be_bold_font); back->AddChild(str); Accept = new BButton( BRect(10, 60+5, 90, 75+5), "Accept", "Accept", new BMessage(ACCEPT_BUTTON)); Accept->MakeDefault(true); back->AddChild(Accept); Text = new BTextControl(BRect(10, 35, 390, 50), "", "Your Name", "", NULL); Text->SetDivider(Text->StringWidth("Your Name ")); TV = Text->TextView(); TV->SetMaxBytes(31); Text->SetText(REGISTERED ? names[rand() % 8] : "I Want To Register!"); back->AddChild(Text); Text->MakeFocus(true); }
ID_Win::ID_Win(BLooper *l, unsigned int g): Txt_Ctl(NULL), done(0), Game(0), BWindow(BRect(100, 100, 300, 180), "New Game By ID", B_TITLED_WINDOW, B_NOT_RESIZABLE | /*B_NOT_CLOSABLE |*/ B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE) { BView *back; BButton * Cancel; BButton * Accept; BTextView *T; register int i; loop = l; Game = g; back = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW); back->SetViewColor(216, 216, 216); AddChild(back); Accept = new BButton( BRect(10, 40, 90, 55), "Accept", "Accept", new BMessage(ACCEPT_BUTTON)); Accept->MakeDefault(true); back->AddChild(Accept); Cancel = new BButton( BRect(120, 40, 190, 55), "Cancel", "Cancel", new BMessage(CANCEL_BUTTON)); back->AddChild(Cancel); Txt_Ctl = new BTextControl(BRect(10, 10, 190, 25), "", "Game Number", "", NULL); T = Txt_Ctl->TextView(); /* * Only allow #s in there. */ for (i = 0; i < 256; i++) T->DisallowChar(i); for (i = '0'; i < '9' + 1; i++) T->AllowChar(i); back->AddChild(Txt_Ctl); char buffer[64]; if (!Game) Game = rand(); sprintf(buffer, "%d", Game); Txt_Ctl->SetText(buffer); Txt_Ctl->MakeFocus(true); //Port = create_port(1, "ID Window Port"); Show(); }
AlertView::AlertView(BRect frame, const char *name) : BView(frame, name, B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED), // we will wait 12 seconds until we send a message fSeconds(12) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fBitmap = InitIcon(); BRect rect(60, 8, 400, 36); BStringView *stringView = new BStringView(rect, NULL, "Do you wish to keep these settings?"); stringView->SetFont(be_bold_font); stringView->ResizeToPreferred(); AddChild(stringView); rect = stringView->Frame(); rect.OffsetBy(0, rect.Height()); fCountdownView = new BStringView(rect, "countdown", NULL); UpdateCountdownView(); fCountdownView->ResizeToPreferred(); AddChild(fCountdownView); BButton* keepButton = new BButton(rect, "keep", "Keep", new BMessage(BUTTON_KEEP_MSG), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); keepButton->ResizeToPreferred(); AddChild(keepButton); BButton* button = new BButton(rect, "undo", "Undo", new BMessage(BUTTON_UNDO_MSG), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); button->ResizeToPreferred(); AddChild(button); // we're resizing ourselves to the right size // (but we're not implementing GetPreferredSize(), bad style!) float width = stringView->Frame().right; if (fCountdownView->Frame().right > width) width = fCountdownView->Frame().right; if (width < Bounds().Width()) width = Bounds().Width(); float height = fCountdownView->Frame().bottom + 24 + button->Bounds().Height(); ResizeTo(width, height); keepButton->MoveTo(Bounds().Width() - 8 - keepButton->Bounds().Width(), Bounds().Height() - 8 - keepButton->Bounds().Height()); button->MoveTo(keepButton->Frame().left - button->Bounds().Width() - 8, keepButton->Frame().top); keepButton->MakeDefault(true); }
//===========================PrefsWindow====================================== PrefsWindow::PrefsWindow(BRect frame, BMessenger *messenger) : BWindow(frame, "Preferences", B_FLOATING_WINDOW, B_NOT_ZOOMABLE|B_NOT_RESIZABLE|B_NOT_CLOSABLE|B_ASYNCHRONOUS_CONTROLS), m_msgr(messenger), m_colourPrefsChanged(false), m_fontSizeChanged(false), m_toolbarChanged(false) { SetFeel(B_NORMAL_WINDOW_FEEL); m_parent = new BView(Bounds(), "parent", B_FOLLOW_ALL_SIDES, B_WILL_DRAW); m_parent->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(m_parent); prefsLock.Lock(); BFont font(be_fixed_font); float fontSize = 10.0f; if (preferences.FindFloat(K_FONT_SIZE, &fontSize) == B_OK) font.SetSize(fontSize); prefsLock.Unlock(); float prefsListWidth = 80.0f; BRect prefsListFrame(10.0f, 10.0f, 10.0f + prefsListWidth, Bounds().bottom - 10.0f); PrefsListView *prefsListView = new PrefsListView(prefsListFrame, m_parent); BScrollView *prefsListScroll = new BScrollView("ScrollView", prefsListView, B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW,false,false); m_parent->AddChild(prefsListScroll); float bwidth = 80.0f, bheight = 30.0f, bspacing = 10.0f ; BRect okButtonFrame(Bounds().right - bspacing - bwidth, Bounds().bottom - bspacing - bheight, Bounds().right - bspacing,Bounds().bottom - bspacing); BButton *okButton = new BButton(okButtonFrame, "okButton", "Ok", new BMessage(PrefsConstants::K_PREFS_VIEW_OK)); m_parent->AddChild(okButton); okButton->MakeDefault(true); BRect cancelButtonFrame = okButtonFrame; cancelButtonFrame.OffsetBy(-(bwidth + 2.0f * bspacing), 0.0f); BButton *cancelButton = new BButton(cancelButtonFrame,"cancelButton","Cancel",new BMessage(PrefsConstants::K_PREFS_VIEW_CANCEL)); m_parent->AddChild(cancelButton); float respiteWidth = 41.0f; BRect boxRect(10.0f + prefsListWidth + 10.0f , 2.0f, Bounds().right - 7.0f , Bounds().bottom - 10.0f - respiteWidth); prefsListView->AddItem(new PrefsListItem(constructGeneralBox(boxRect), m_parent, "General")); prefsListView->AddItem(new PrefsListItem(constructCommandBox(boxRect), m_parent, "Commands")); prefsListView->AddItem(new PrefsListItem(constructColourBox(boxRect), m_parent, "TexView")); prefsListView->AddItem(new PrefsListItem(constructToolbarBox(boxRect), m_parent, "Toolbars")); prefsListView->Select(0); prefsListView->MakeFocus(true); }
void SeqPrefWin::AddViews(const BMessage& prefs) { BRect b = Bounds(); /* Add the bottom panel with the Cancel OK buttons. When this * block is done, it will adjust the bounds accordingly (i.e., * without the space used by this view). */ { float buttonW = 60, buttonH = 24; float edgeR = 8, edgeB = 8, edgeT = 8; BRect f(b); f.top = f.bottom - edgeB - buttonH - edgeT; BView* v = new BView( f, "button_panel", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM, 0 ); if( v ) { BRect f( b.right - edgeR - buttonW, edgeT, b.right - edgeR, edgeT + buttonH ); BButton* button = new BButton( f, "ok_button", "OK", new BMessage( OK_MSG ), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM ); if( button ) { v->AddChild( button ); button->MakeDefault( true ); } f.OffsetBy( 0-(buttonW + 10), 0 ); button = new BButton( f, "cancel_button", "Cancel", new BMessage( CANCEL_MSG ), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM ); if( button ) v->AddChild( button ); v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) ); AddChild( v ); b.bottom = b.bottom - edgeB - buttonH - edgeT - 1; } } BTabView* tv = new BTabView(b, TABVIEW_STR); if (!tv) return; BView* fileView = NewFileView(b, prefs); if (fileView) tv->AddTab(fileView); BView* editView = NewEditView(b, prefs); if (editView) tv->AddTab(editView); BView* playbackView = NewTrackView(b, prefs); if (playbackView) tv->AddTab(playbackView); mFactoryView = NewFactoriesView(b, prefs); if (mFactoryView) tv->AddTab(mFactoryView); AddChild(tv); /* NOTE: Have to do this after the tab view's been added to the window or else * you get a crash. It's a bug in the tab view, nothing to be done about it. */ tv->SetTabWidth(B_WIDTH_FROM_WIDEST); }
BackupView::BackupView(BRect frame) : BView(frame, "BackupView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLowColor(ViewColor()); SetHighColor(0, 0, 0); SetLayout(new BGroupLayout(B_VERTICAL)); fBackupList = new BListView(BRect(0, 0, 0, 0), "items", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES); for (uint32 i = 0; i < LOCATION_COUNT; i++) { BackupListItem* item = new BackupListItem(i, gLocationMap[i].name, gLocationMap[i].description); fBackupList->AddItem(item); } // Add total size BStringView* backupSize = new BStringView("total size", "Total size:"); fBackupSizeText = new BStringView("backup size", ""); fBackupSizeText->SetAlignment(B_ALIGN_RIGHT); BButton* button = new BButton(BRect(0, 0, 10, 10), "backup", "Backup!", new BMessage(kMsgDoBackup)); button->MakeDefault(true); BGroupLayout* totalGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0) .AddGrid() .Add(backupSize, 0, 0) .Add(fBackupSizeText, 1, 0) .End() .SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) ; // Attach all of the LayoutGroups to the view AddChild(BLayoutBuilder::Group<>(B_VERTICAL, 0.0) .Add(new BScrollView("backup item list", fBackupList, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true)) .Add(totalGroup) .Add(button) ); // Refresh the sizes of each item RefreshSizes(); Show(); }
PasswordWindow::PasswordWindow() : BWindow(BRect(100, 100, 400, 230), "Enter password", B_NO_BORDER_WINDOW_LOOK, kPasswordWindowFeel /* TODO: B_MODAL_APP_WINDOW_FEEL should also behave correctly */, B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS, B_ALL_WORKSPACES) { BView* topView = new BView(Bounds(), "topView", B_FOLLOW_ALL, B_WILL_DRAW); topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(topView); BRect bounds(Bounds()); bounds.InsetBy(10.0, 10.0); BBox *customBox = new BBox(bounds, "customBox", B_FOLLOW_NONE); topView->AddChild(customBox); customBox->SetLabel("Unlock screen saver"); bounds.top += 10.0; fPassword = new BTextControl(bounds, "password", "Enter password:"******"VeryLongPasswordPossible", B_FOLLOW_NONE); customBox->AddChild(fPassword); fPassword->MakeFocus(true); fPassword->ResizeToPreferred(); fPassword->TextView()->HideTyping(true); fPassword->SetDivider(be_plain_font->StringWidth("Enter password:"******"unlock", "Unlock", new BMessage(kMsgUnlock), B_FOLLOW_NONE); customBox->AddChild(button); button->MakeDefault(true); button->ResizeToPreferred(); button->SetTarget(NULL, be_app); BRect frame = fPassword->Frame(); button->MoveTo(frame.right - button->Bounds().Width(), frame.bottom + 10.0); customBox->ResizeTo(frame.right + 10.0, button->Frame().bottom + 10.0); frame = customBox->Frame(); ResizeTo(frame.right + 10.0, frame.bottom + 10.0); BScreen screen(this); MoveTo(screen.Frame().left + (screen.Frame().Width() - Bounds().Width()) / 2, screen.Frame().top + (screen.Frame().Height() - Bounds().Height()) / 2); }
CColorPicker::CColorPicker(BRect frame, const char *name, bool stayOpen) : BWindow(frame, name, stayOpen ? B_TITLED_WINDOW : B_MODAL_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE) { fStayOpen = stayOpen; fCaller = NULL; BView *main = new BView(Bounds(), "main", 0, B_WILL_DRAW); AddChild(main); main->SetViewColor(kGray); BRect r(10, 10, 145, 130); fHSV = new CHSVView(r, "hsvview"); main->AddChild(fHSV); r.Set(155, 10, 205, 130); fON = new CONView(r, "o&n"); main->AddChild(fON); r.Set(215, 10, 380, 130); fRGB = new CRGBView(r, "rgbview"); main->AddChild(fRGB); if (fStayOpen) { BRect b(Bounds()); ResizeTo(b.Width(), b.Height() - 30); } else { r.Set(320, 140, 380, 160); BButton * ok = new BButton(r, "ok", "OK", new BMessage(msg_OK)); main->AddChild(ok); ok->MakeDefault(true); r.Set(250, 140, 310, 160); main->AddChild(new BButton(r, "cancel", "Cancel", new BMessage(msg_Cancel))); // TPV 00-02-27 KeyFilter * kf = new KeyFilter(B_ESCAPE, msg_Cancel) ; AddCommonFilter( kf ) ; } } /* CColorPicker::CColorPicker */
void IppSetupView::AttachedToWindow() { /* url box */ url = new BTextControl(URL_RECT, "", URL_TEXT, "", NULL); AddChild(url); url->SetDivider(StringWidth(URL_TEXT) + 10); /* cancel */ BButton *button = new BButton(CANCEL_RECT, "", CANCEL_TEXT, new BMessage(M_CANCEL)); AddChild(button); /* ok */ button = new BButton(OK_RECT, "", OK_TEXT, new BMessage(M_OK)); AddChild(button); button->MakeDefault(true); }
ListChooseWindow::ListChooseWindow(list<string>* strL, string title, string text1, string text2, string str) : BWindow(BRect(200, 200, 415, 400), title.c_str(), B_FLOATING_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_CLOSABLE) { BRect rect(200, 200, 415, 400); rect.OffsetTo(0, 0); BView* backview = new BView(rect, "ListChooseBackView", 0, B_WILL_DRAW); backview->SetViewColor(222, 222, 222); AddChild(backview); BStringView* sv = new BStringView(BRect(15, 5, 185, 20), "ListChooseSV", text1.c_str()); backview->AddChild(sv); sv = new BStringView(BRect(15, 20, 185, 33), "ListChooseSV", text2.c_str()); backview->AddChild(sv); lv = new BListView(BRect(15, 40, 185, 153), "ListChooseLV"); backview->AddChild(new BScrollView("scrollregister", lv, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true)); BStringItem* si; for (list<string>::iterator iter = strL->begin(); iter != strL->end(); iter++) { si = new BStringItem((*iter).c_str()); lv->AddItem(si); if (*iter == str) si->SetEnabled(false); } BButton* button = new BButton(BRect(15, 165, 95, 185), "okB", "OK", new BMessage(ListChooseOKMSG)); backview->AddChild(button); button->MakeDefault(true); button = new BButton(BRect(105, 165, 200, 185), "cancelB", "Cancel", new BMessage(ListChooseCancelMSG)); backview->AddChild(button); clickWait = create_sem(0, "clickWait"); }
BottomPrefsView::BottomPrefsView(BRect rect, const char *name) : BView(rect, name, B_FOLLOW_NONE, B_WILL_DRAW) { // Set the background color dynamically, don't hardcode 216, 216, 216 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); BRect r = Bounds(); r.right -= 13; r.left = r.right - 75; r.top += 10; r.bottom = r.top + 24; BButton *ok = new BButton(r, "OKButton", "OK", new BMessage(PRV_BOTTOM_OK)); AddChild(ok); r.right = r.left - 10; r.left = r.right - 75; BButton *defaults = new BButton(r, "DefaultsButton", "Defaults", new BMessage(PRV_BOTTOM_DEFAULTS)); AddChild(defaults); ok->MakeDefault(true); }
OpenWindow::OpenWindow() : BWindow(BRect(0, 0, 35, 10), B_TRANSLATE_SYSTEM_NAME("DiskProbe"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS) { fDevicesMenu = new BPopUpMenu("devices"); CollectDevices(fDevicesMenu); if (BMenuItem *item = fDevicesMenu->ItemAt(0)) item->SetMarked(true); BMenuField *field = new BMenuField(B_TRANSLATE("Examine device:"), fDevicesMenu); BButton *probeDeviceButton = new BButton("device", B_TRANSLATE("Probe device"), new BMessage(kMsgProbeDevice)); probeDeviceButton->MakeDefault(true); BButton *probeFileButton = new BButton("file", B_TRANSLATE("Probe file" B_UTF8_ELLIPSIS), new BMessage(kMsgProbeFile)); BButton *cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"), new BMessage(B_QUIT_REQUESTED)); SetLayout(new BGroupLayout(B_HORIZONTAL)); AddChild(BGridLayoutBuilder(8, 8) .Add(field, 0, 0, 3) .Add(cancelButton, 0, 1) .Add(probeFileButton, 1, 1) .Add(probeDeviceButton, 2, 1) .SetInsets(8, 8, 8, 8) ); CenterOnScreen(); }
ScreenshotWindow::ScreenshotWindow(const Utility& utility, bool silent, bool clipboard) : BWindow(BRect(0, 0, 200.0, 100.0), B_TRANSLATE_SYSTEM_NAME("Screenshot"), B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AVOID_FRONT | B_QUIT_ON_WINDOW_CLOSE | B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE), fUtility(utility), fDelayControl(NULL), fScreenshot(NULL), fOutputPathPanel(NULL), fLastSelectedPath(NULL), fSettingsWindow(NULL), fDelay(0), fIncludeBorder(false), fIncludeCursor(false), fGrabActiveWindow(false), fOutputFilename(NULL), fExtension(""), fImageFileType(B_PNG_FORMAT) { // _ReadSettings() needs a valid fOutputPathMenu fOutputPathMenu = new BMenu(B_TRANSLATE("Please select")); _ReadSettings(); // _NewScreenshot() needs a valid fNameControl BString name(B_TRANSLATE_NOCOLLECT(fUtility.sDefaultFileNameBase)); name << 1; name = _FindValidFileName(name.String()); fNameControl = new BTextControl("", B_TRANSLATE("Name:"), name, NULL); // Check if fUtility contains valid data if (fUtility.wholeScreen == NULL) { _NewScreenshot(silent, clipboard, true); return; } fScreenshot = fUtility.MakeScreenshot(fIncludeCursor, fGrabActiveWindow, fIncludeBorder); fActiveWindow = new BCheckBox(B_TRANSLATE("Capture active window"), new BMessage(kActiveWindow)); if (fGrabActiveWindow) fActiveWindow->SetValue(B_CONTROL_ON); fWindowBorder = new BCheckBox(B_TRANSLATE("Include window border"), new BMessage(kIncludeBorder)); if (fIncludeBorder) fWindowBorder->SetValue(B_CONTROL_ON); if (!fGrabActiveWindow) fWindowBorder->SetEnabled(false); fShowCursor = new BCheckBox(B_TRANSLATE("Include mouse pointer"), new BMessage(kIncludeCursor)); if (fIncludeCursor) fShowCursor->SetValue(B_CONTROL_ON); BString delay; delay << fDelay / 1000000; fDelayControl = new BTextControl("", B_TRANSLATE("Delay:"), delay.String(), NULL); _DisallowChar(fDelayControl->TextView()); fDelayControl->TextView()->SetAlignment(B_ALIGN_RIGHT); BStringView* seconds = new BStringView("", B_TRANSLATE("seconds")); seconds->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); BMenuField* menuLocation = new BMenuField(B_TRANSLATE("Save in:"), fOutputPathMenu); menuLocation->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); fTranslatorMenu = new BMenu(B_TRANSLATE("Please select")); _SetupTranslatorMenu(); BMenuField* menuFormat = new BMenuField(B_TRANSLATE("Save as:"), fTranslatorMenu); menuFormat->SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BButton* showSettings = new BButton("", B_TRANSLATE("Settings" B_UTF8_ELLIPSIS), new BMessage(kSettings)); showSettings->SetExplicitAlignment( BAlignment(B_ALIGN_RIGHT, B_ALIGN_BOTTOM)); BBox* divider = new BBox(B_FANCY_BORDER, NULL); divider->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1)); BButton* saveScreenshot = new BButton("", B_TRANSLATE("Save"), new BMessage(kSaveScreenshot)); const float kSpacing = be_control_look->DefaultItemSpacing(); const float kLabelSpacing = be_control_look->DefaultLabelSpacing(); fPreview = new BView("preview", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); BBox* previewBox = new BBox(B_FANCY_BORDER, fPreview); BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .AddGroup(B_HORIZONTAL) .SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING) .Add(previewBox) .AddGroup(B_VERTICAL, 0) .Add(fActiveWindow) .Add(fWindowBorder) .Add(fShowCursor) .AddStrut(kSpacing) .AddGrid(0.0, kSpacing / 2) .Add(fDelayControl->CreateLabelLayoutItem(), 0, 0) .Add(fDelayControl->CreateTextViewLayoutItem(), 1, 0) .Add(BSpaceLayoutItem::CreateHorizontalStrut(kLabelSpacing), 2, 0) .Add(seconds, 3, 0) .Add(fNameControl->CreateLabelLayoutItem(), 0, 1) .Add(fNameControl->CreateTextViewLayoutItem(), 1, 1, 3, 1) .Add(menuLocation->CreateLabelLayoutItem(), 0, 2) .Add(menuLocation->CreateMenuBarLayoutItem(), 1, 2, 3, 1) .Add(menuFormat->CreateLabelLayoutItem(), 0, 3) .Add(menuFormat->CreateMenuBarLayoutItem(), 1, 3, 3, 1) .End() .AddStrut(kSpacing / 2) .Add(showSettings) .AddGlue() .End() .End() .Add(new BSeparatorView(B_HORIZONTAL)) .AddGroup(B_HORIZONTAL) .SetInsets(B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING, B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING) .Add(new BButton("", B_TRANSLATE("Copy to clipboard"), new BMessage(B_COPY))) .Add(new BButton("", B_TRANSLATE("New screenshot"), new BMessage(kNewScreenshot))) .AddGlue() .Add(saveScreenshot); saveScreenshot->MakeDefault(true); _UpdatePreviewPanel(); _UpdateFilenameSelection(); CenterOnScreen(); Show(); }
void InstallerApp::ReadyToRun() { BString infoText; infoText << B_TRANSLATE( "Welcome to the Haiku Installer!\n\n"); infoText << B_TRANSLATE( "IMPORTANT INFORMATION BEFORE INSTALLING HAIKU\n\n"); infoText << B_TRANSLATE( "This is alpha-quality software! It means there is a high risk of " "losing important data. Make frequent backups! You have been " "warned.\n\n\n"); infoText << B_TRANSLATE( "1) If you are installing Haiku onto real hardware (not inside an " "emulator) it is recommended that you have already prepared a hard " "disk partition. The Installer and the DriveSetup tool offer to " "initialize existing partitions with the Haiku native file system, " "but the options to change the actual partition layout may not have " "been tested on a sufficiently great variety of computer " "configurations so we do not recommend using it.\n"); infoText << B_TRANSLATE( "If you have not created a partition yet, simply reboot, create the " "partition using whatever tool you feel most comfortable with, and " "reboot into Haiku to continue with the installation. You could for " "example use the GParted Live-CD, it can also resize existing " "partitions to make room.\n\n\n"); infoText << B_TRANSLATE( "2) The Installer will make the Haiku partition itself bootable, " "but takes no steps to integrate Haiku into an existing boot menu. " "If you have GRUB already installed, you can add Haiku to its boot " "menu. Depending on what version of GRUB you use, this is done " "differently.\n\n\n"); infoText << B_TRANSLATE( "2.1) GRUB 1\n"); infoText << B_TRANSLATE( "Configure your /boot/grub/menu.lst by launching your favorite " "editor from a Terminal like this:\n\n"); infoText << B_TRANSLATE( "\tsudo <your favorite text editor> /boot/grub/menu.lst\n\n"); infoText << B_TRANSLATE( "You'll note that GRUB uses a different naming strategy for hard " "drives than Linux.\n\n"); infoText << B_TRANSLATE( "With GRUB it's: (hdN,n)\n\n"); infoText << B_TRANSLATE( "All hard disks start with \"hd\".\n"); infoText << B_TRANSLATE( "\"N\" is the hard disk number, starting with \"0\".\n"); infoText << B_TRANSLATE( "\"n\" is the partition number, also starting with \"0\".\n"); infoText << B_TRANSLATE( "The first logical partition always has the number \"4\", regardless " "of the number of primary partitions.\n\n"); infoText << B_TRANSLATE( "So behind the other menu entries towards the bottom of the file, add " "something similar to these lines:\n\n"); infoText << B_TRANSLATE( "\t# Haiku on /dev/sda7\n"); infoText << B_TRANSLATE( "\ttitle\t\t\t\tHaiku\n"); infoText << B_TRANSLATE( "\trootnoverify\t\t(hd0,6)\n"); infoText << B_TRANSLATE( "\tchainloader\t\t+1\n\n"); infoText << B_TRANSLATE( "You can see the correct partition in GParted for example.\n\n\n"); infoText << B_TRANSLATE( "2.2) GRUB 2\n"); infoText << B_TRANSLATE( "Newer versions of GRUB use an extra configuration file to add " "custom entries to the boot menu. To add them to the top, you have " "to create/edit a file by launching your favorite editor from a " "Terminal like this:\n\n"); infoText << B_TRANSLATE( "\tsudo <your favorite text editor> /etc/grub.d/40_custom\n\n"); infoText << B_TRANSLATE( "NOTE: While the naming strategy for hard disks is still as described " "under 2.1) the naming scheme for partitions has changed.\n\n"); infoText << B_TRANSLATE( "GRUB's naming scheme is still: (hdN,n)\n\n"); infoText << B_TRANSLATE( "All hard disks start with \"hd\".\n"); infoText << B_TRANSLATE( "\"N\" is the hard disk number, starting with \"0\".\n"); infoText << B_TRANSLATE( "\"n\" is the partition number, which for GRUB 2 starts with \"1\"\n"); infoText << B_TRANSLATE( "With GRUB 2 the first logical partition always has the number \"5\", " "regardless of the number of primary partitions.\n\n"); infoText << B_TRANSLATE( "So below the heading that must not be edited, add something similar " "to these lines:\n\n"); infoText << B_TRANSLATE( "\t# Haiku on /dev/sda7\n"); infoText << B_TRANSLATE( "\tmenuentry \"Haiku Alpha\" {\n"); infoText << B_TRANSLATE( "\t\tset root=(hd0,7)\n"); infoText << B_TRANSLATE( "\t\tchainloader +1\n"); infoText << B_TRANSLATE( "\t}\n\n"); infoText << B_TRANSLATE( "Additionally you have to edit another file to actually display the " "boot menu:\n\n"); infoText << B_TRANSLATE( "\tsudo <your favorite text editor> /etc/default/grub\n\n"); infoText << B_TRANSLATE( "Here you have to comment out the line \"GRUB_HIDDEN_TIMEOUT=0\" by " "putting a \"#\" in front of it in order to actually display the " "boot menu.\n\n"); infoText << B_TRANSLATE( "Finally, you have to update the boot menu by entering:\n\n"); infoText << B_TRANSLATE( "\tsudo update-grub\n\n\n"); infoText << B_TRANSLATE( "3) When you successfully boot into Haiku for the first time, make " "sure to read our \"Welcome\" documentation, there is a link on the " "Desktop.\n\n"); infoText << B_TRANSLATE( "Have fun and thanks a lot for trying out Haiku! We hope you like it!"); #if 1 // Show the EULA first. BTextView* textView = new BTextView("eula", be_plain_font, NULL, B_WILL_DRAW); textView->SetInsets(10, 10, 10, 10); textView->MakeEditable(false); textView->MakeSelectable(false); textView->SetText(infoText); BScrollView* scrollView = new BScrollView("eulaScroll", textView, B_WILL_DRAW, false, true); BButton* cancelButton = new BButton(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED)); cancelButton->SetTarget(this); BButton* continueButton = new BButton(B_TRANSLATE("Continue"), new BMessage(kMsgAgree)); continueButton->SetTarget(this); continueButton->MakeDefault(true); BRect eulaFrame = BRect(0, 0, 600, 450); fEULAWindow = new BWindow(eulaFrame, B_TRANSLATE("README"), B_MODAL_WINDOW, B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS); BLayoutBuilder::Group<>(fEULAWindow, B_VERTICAL, 10) .SetInsets(10) .Add(scrollView) .AddGroup(B_HORIZONTAL, 10) .AddGlue() .Add(cancelButton) .Add(continueButton); fEULAWindow->CenterOnScreen(); fEULAWindow->Show(); #else // Show the installer window without EULA. new InstallerWindow(); #endif }
SettingsWindow::SettingsWindow(BRect frame) : BWindow(frame, "MediaPlayer settings", B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE #ifdef __ANTARES__ | B_AUTO_UPDATE_SIZE_LIMITS) #else ) #endif { #ifdef __ANTARES__ BBox* settingsBox = new BBox(B_PLAIN_BORDER, NULL); BGroupLayout* settingsLayout = new BGroupLayout(B_VERTICAL, 5); settingsBox->SetLayout(settingsLayout); BBox* buttonBox = new BBox(B_PLAIN_BORDER, NULL); BGroupLayout* buttonLayout = new BGroupLayout(B_HORIZONTAL, 5); buttonBox->SetLayout(buttonLayout); BStringView* playModeLabel = new BStringView("stringViewPlayMode", "Play mode"); BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions", "View options"); BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg", "Play background clips at"); BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER); playModeLabel->SetExplicitAlignment(alignment); playModeLabel->SetFont(be_bold_font); viewOptionsLabel->SetExplicitAlignment(alignment); viewOptionsLabel->SetFont(be_bold_font); bgMoviesModeLabel->SetExplicitAlignment(alignment); bgMoviesModeLabel->SetFont(be_bold_font); fAutostartCB = new BCheckBox("chkboxAutostart", "Automatically start playing", new BMessage(M_AUTOSTART)); fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies", "Close window when done playing movies", new BMessage(M_CLOSE_WINDOW_MOVIE)); fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds", "Close window when done playing sounds", new BMessage(M_CLOSE_WINDOW_SOUNDS)); fLoopMoviesCB = new BCheckBox("chkBoxLoopMovie", "Loop movies by default", new BMessage(M_LOOP_MOVIE)); fLoopSoundsCB = new BCheckBox("chkBoxLoopSounds", "Loop sounds by default", new BMessage(M_LOOP_SOUND)); fUseOverlaysCB = new BCheckBox("chkBoxUseOverlays", "Use hardware video overlays if available", new BMessage(M_USE_OVERLAYS)); fScaleBilinearCB = new BCheckBox("chkBoxScaleBilinear", "Scale movies smoothly (non-overlay mode)", new BMessage(M_SCALE_BILINEAR)); fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume", "Full volume", new BMessage(M_START_FULL_VOLUME)); fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume", "Low volume", new BMessage(M_START_HALF_VOLUME)); fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume", "Muted", new BMessage(M_START_MUTE_VOLUME)); fRevertB = new BButton("revert", "Revert", new BMessage(M_SETTINGS_REVERT)); BButton* cancelButton = new BButton("cancel", "Cancel", new BMessage(M_SETTINGS_CANCEL)); BButton* okButton = new BButton("ok", "OK", new BMessage(M_SETTINGS_SAVE)); okButton->MakeDefault(true); // Build the layout SetLayout(new BGroupLayout(B_HORIZONTAL)); AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) .Add(BGroupLayoutBuilder(settingsLayout) .Add(playModeLabel) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0) .Add(BSpaceLayoutItem::CreateHorizontalStrut(10)) .Add(BGroupLayoutBuilder(B_VERTICAL, 0) .Add(fAutostartCB) .Add(BGridLayoutBuilder(5, 0) .Add(BSpaceLayoutItem::CreateHorizontalStrut(10), 0, 0) .Add(fCloseWindowMoviesCB, 1, 0) .Add(BSpaceLayoutItem::CreateHorizontalStrut(10), 0, 1) .Add(fCloseWindowSoundsCB, 1, 1) ) .Add(fLoopMoviesCB) .Add(fLoopSoundsCB) ) ) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(viewOptionsLabel) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0) .Add(BSpaceLayoutItem::CreateHorizontalStrut(10)) .Add(BGroupLayoutBuilder(B_VERTICAL, 0) .Add(fUseOverlaysCB) .Add(fScaleBilinearCB) ) ) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(bgMoviesModeLabel) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0) .Add(BSpaceLayoutItem::CreateHorizontalStrut(10)) .Add(BGroupLayoutBuilder(B_VERTICAL, 0) .Add(fFullVolumeBGMoviesRB) .Add(fHalfVolumeBGMoviesRB) .Add(fMutedVolumeBGMoviesRB) ) ) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .SetInsets(5, 5, 15, 5) ) .Add(BGroupLayoutBuilder(buttonLayout) .Add(fRevertB) .AddGlue() .Add(cancelButton) .Add(okButton) .SetInsets(5, 5, 5, 5) ) ); #else frame = Bounds(); BView* view = new BView(frame,"SettingsView",B_FOLLOW_ALL_SIDES,B_WILL_DRAW); view->SetViewColor(216, 216, 216); BRect btnRect(80.00, frame.bottom - (SPACE + BUTTONHEIGHT), 145.00, frame.bottom-SPACE); fRevertB = new BButton(btnRect, "revert", "Revert", new BMessage(M_SETTINGS_REVERT)); view->AddChild(fRevertB); btnRect.OffsetBy(btnRect.Width() + SPACE, 0); BButton* btn = new BButton(btnRect, "btnCancel", "Cancel", new BMessage(M_SETTINGS_CANCEL)); view->AddChild(btn); btnRect.OffsetBy(btnRect.Width() + SPACE, 0); btn = new BButton(btnRect, "btnOK", "OK", new BMessage(M_SETTINGS_SAVE)); view->AddChild(btn); BRect rectBox(frame.left + SPACE, frame.top + SPACE, frame.right - SPACE, btnRect.top- SPACE); BBox* bbox = new BBox(rectBox, "box1", B_FOLLOW_ALL_SIDES,B_WILL_DRAW | B_NAVIGABLE, B_FANCY_BORDER); bbox->SetLabel("MediaPlayer Settings"); BFont font; font_height fh1; font.GetHeight(&fh1); BString str("Play Mode:"); BRect rect(rectBox.left, rectBox.top + SPACE, rectBox.right - (12*2), rectBox.top + fh1.leading + fh1.ascent + 10); bbox->AddChild(new BStringView(rect, "stringViewPlayMode", str.String())); rect.OffsetBy(0, rect.Height()); bbox->AddChild(fAutostartCB = new BCheckBox(rect, "chkboxAutostart", "Automatically start playing", new BMessage(M_AUTOSTART))); rect.OffsetBy(SPACE, rect.Height() + SPACEING); bbox->AddChild(fCloseWindowMoviesCB = new BCheckBox(rect, "chkBoxCloseWindowMovies", "Close window when done playing movies", new BMessage(M_CLOSE_WINDOW_MOVIE))); rect.OffsetBy(0, rect.Height() + SPACEING); bbox->AddChild(fCloseWindowSoundsCB = new BCheckBox(rect, "chkBoxCloseWindowSounds", "Close window when done playing sounds", new BMessage(M_CLOSE_WINDOW_SOUNDS))); rect.OffsetBy(-SPACE, rect.Height() + SPACEING); bbox->AddChild(fLoopMoviesCB = new BCheckBox(rect, "chkBoxLoopMovie", "Loop movies by default", new BMessage(M_LOOP_MOVIE))); rect.OffsetBy(0, rect.Height() + SPACEING); bbox->AddChild(fLoopSoundsCB = new BCheckBox(rect, "chkBoxLoopSounds", "Loop sounds by default", new BMessage(M_LOOP_SOUND))); rect.OffsetBy(0, rect.Height() + SPACEING); bbox->AddChild(fUseOverlaysCB = new BCheckBox(rect, "chkBoxUseOverlays", "Use hardware video overlays if available", new BMessage(M_USE_OVERLAYS))); rect.OffsetBy(0, rect.Height() + SPACEING); bbox->AddChild(fScaleBilinearCB = new BCheckBox(rect, "chkBoxScaleBilinear", "Scale movies smoothly (non-overlay mode)", new BMessage(M_SCALE_BILINEAR))); rect.OffsetBy(0, rect.Height() + SPACE + SPACEING); bbox->AddChild(new BStringView(rect, "stringViewPlayBackg", "Play backgrounds clips at:")); rect.OffsetBy(SPACE, rect.Height() + SPACEING); fFullVolumeBGMoviesRB = new BRadioButton(rect, "rdbtnfullvolume", "Full Volume", new BMessage(M_START_FULL_VOLUME)); bbox->AddChild(fFullVolumeBGMoviesRB); rect.OffsetBy(0, rect.Height() + SPACEING); fHalfVolumeBGMoviesRB = new BRadioButton(rect, "rdbtnhalfvolume", "Low Volume", new BMessage(M_START_HALF_VOLUME)); bbox->AddChild(fHalfVolumeBGMoviesRB); rect.OffsetBy(0, rect.Height() + SPACEING); fMutedVolumeBGMoviesRB = new BRadioButton(rect, "rdbtnfullvolume", "Muted", new BMessage(M_START_MUTE_VOLUME)); bbox->AddChild(fMutedVolumeBGMoviesRB); view->AddChild(bbox); AddChild(view); #endif // disable currently unsupported features fLoopMoviesCB->SetEnabled(false); fLoopSoundsCB->SetEnabled(false); }
SplitWindow::SplitWindow(BRect frame, Proxy* theProxy, BHandler* targetHandler, Prefs* prefs, uint32 total = 0, uint8 pam = 1, SplCat* sc = 0) : BWindow(frame, "Transaction Split", B_FLOATING_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE) { #ifdef DEBUG printf("SplitWindow::SplitWindow\n"); printf("\tsc = %p\n", sc); #endif this->prefs = prefs; // char buffer[20]; frame.OffsetTo(0, 0); v = new BView(frame, "backview", B_FOLLOW_ALL_SIDES, B_WILL_DRAW); v->SetViewColor(222, 222, 222); AddChild(v); BButton* b = new BButton(BRect(20, frame.bottom - 40, 100, frame.bottom - 20), "AddCatButton", "Add Category", new BMessage(AddCatMSG), B_FOLLOW_BOTTOM); v->AddChild(b); b = new BButton(BRect(frame.right - 100, frame.bottom - 40, frame.right - 20, frame.bottom - 20), "SplitEnter", "Enter", new BMessage(SplitEnterMSG), B_FOLLOW_BOTTOM); b->MakeDefault(true); v->AddChild(b); BStringView* sv = new BStringView(BRect(frame.right - 150, frame.bottom - 75, frame.right - 70, frame.bottom - 55), "TotalField", "Total", B_FOLLOW_BOTTOM); v->AddChild(sv); sv = new BStringView(BRect(frame.right - 150, frame.bottom - 95, frame. right - 100, frame.bottom - 75), "DifferenceField", "Difference", B_FOLLOW_BOTTOM); v->AddChild(sv); totalText = new BStringView(BRect(frame.right - 85, frame.bottom - 75, frame.right - 20, frame.bottom - 55), "TotalNumField", prefs->currencyToString(total).c_str(), B_FOLLOW_BOTTOM); totalText->SetAlignment(B_ALIGN_RIGHT); v->AddChild(totalText); diffText = new BStringView(BRect(frame.right - 85, frame.bottom - 95, frame.right - 20, frame.bottom - 75), "DiffNumField", prefs->currencyToString(total).c_str(), B_FOLLOW_BOTTOM); diffText->SetAlignment(B_ALIGN_RIGHT); v->AddChild(diffText); depRadio = new BRadioButton(BRect(120, frame.bottom - 45, 180, frame.bottom - 45), "DepositRadioButton", "Deposit", 0, B_FOLLOW_BOTTOM); v->AddChild(depRadio); pamRadio = new BRadioButton(BRect(120, frame.bottom - 25, 180, frame.bottom - 25), "PaymentRadioButton", "Payment", 0, B_FOLLOW_BOTTOM); v->AddChild(pamRadio); if (pam == 0) depRadio->SetValue(1); else if (pam == 1) pamRadio->SetValue(1); ypos = 25; this->total = total; this->pam = pam; this->theProxy = theProxy; this->catS = theProxy->GetCatS(); this->targetHandler = targetHandler; catnum = 0; if (!sc) AddCat(); else { list<int32>::iterator itera = sc->amtL->begin(); for (cal::iterator iterc = sc->catL->begin(); iterc != sc->catL->end(); iterc++) { AddCat(); (*catTexts.rbegin())->SetText((*iterc)->Name().c_str()); (*amtTexts.rbegin())->SetText(prefs->currencyToString(*itera).c_str()); itera++; } } }
_OwqWindow(BMessenger target, const BMessage* prefs = 0) : BWindow( BRect(100, 100, 300, 300), "Open From Query", B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE), mTarget(target), mFilePanel(0), mOnBox(0), mNameCtrl(0), mFileButton(0), mSkipBox(0), mRef(0) { BRect b = Bounds(); BView* v = new BView( b, "bg", B_FOLLOW_ALL, 0 ); float bottom = b.bottom; if (v) { v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) ); float cbH = check_box_height( v ); BRect f(5, 5, b.right - 5, 5 + cbH); mOnBox = new BCheckBox( f, "on_box", "On", new BMessage( OWQ_ON_MSG ) ); if( mOnBox ) { mOnBox->SetValue( B_CONTROL_ON ); v->AddChild( mOnBox ); } f.OffsetBy( 0, f.Height() + 10 ); f.bottom = f.top + text_control_height( v ); mNameCtrl = new BTextControl( f, "name_ctrl", "Name: ", "", new BMessage( OWQ_NAME_MSG ) ); if( mNameCtrl ) { mNameCtrl->SetDivider( v->StringWidth( "Name:" ) + 10 ); v->AddChild( mNameCtrl ); } f.OffsetBy( 0, f.Height() + 10 ); f.bottom = f.top + button_height( v ); mFileButton = new BButton( f, "file_ctrl", "Choose Query", new BMessage( OWQ_CHOOSE_FILE_MSG ) ); if( mFileButton ) v->AddChild( mFileButton ); /* I've turned off skip for now -- I think just having it on * is easier than explaining it. */ #if 0 f.OffsetBy( 0, f.Height() + 5 ); f.bottom = f.top + cbH; mSkipBox = new BCheckBox( f, "skip_box", "Skip top level", new BMessage( OWQ_SKIP_MSG ) ); if( mSkipBox ) v->AddChild( mSkipBox ); #endif f.top = f.bottom + 10; f.bottom = f.top + button_height( v ); float buttonW = 60; f.left = f.right - buttonW; BButton* button = new BButton( f, "ok_button", "OK", new BMessage( OK_MSG ) ); if( button ) { v->AddChild( button ); button->MakeDefault( true ); } f.OffsetBy( 0-(buttonW + 10), 0 ); button = new BButton( f, "cancel_button", "Cancel", new BMessage( CANCEL_MSG ) ); if( button ) v->AddChild( button ); bottom = f.bottom + 5; AddChild( v ); } ResizeTo( b.Width(), bottom ); if( prefs ) SetPrefs( prefs ); bool enable = false; if( mOnBox && mOnBox->Value() == B_CONTROL_ON ) enable = true; SetControlEnable(enable); }
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); }
void PageSetupView::AttachedToWindow() { BMenuItem *item = NULL; bool marked; int count; // margin MarginUnit units = fJobData->GetMarginUnit(); BRect paper = fJobData->GetPaperRect(); BRect margin = fJobData->GetPrintableRect(); // re-calculate the margin from the printable rect in points margin.top -= paper.top; margin.left -= paper.left; margin.right = paper.right - margin.right; margin.bottom = paper.bottom - margin.bottom; fMarginView = new MarginView( paper.IntegerWidth(), paper.IntegerHeight(), margin, units); // paper selection marked = false; fPaper = new BPopUpMenu("paperSize"); fPaper->SetRadioMode(true); count = fPrinterCap->CountCap(PrinterCap::kPaper); PaperCap **paper_cap = (PaperCap **)fPrinterCap->GetCaps(PrinterCap::kPaper); while (count--) { BMessage *msg = new BMessage(kMsgPaperChanged); msg->AddPointer("paperCap", *paper_cap); item = new BMenuItem((*paper_cap)->fLabel.c_str(), msg); fPaper->AddItem(item); item->SetTarget(this); if ((*paper_cap)->fPaper == fJobData->GetPaper()) { item->SetMarked(true); marked = true; } paper_cap++; } if (!marked) item->SetMarked(true); BMenuField* paperSize = new BMenuField("paperSize", "Paper size:", fPaper); // orientation fOrientation = new BPopUpMenu("orientation"); fOrientation->SetRadioMode(true); BMenuField* orientation = new BMenuField("orientation", "Orientation:", fOrientation); count = fPrinterCap->CountCap(PrinterCap::kOrientation); if (count == 0) { AddOrientationItem("Portrait", JobData::kPortrait); AddOrientationItem("Landscape", JobData::kLandscape); } else { OrientationCap **orientation_cap = (OrientationCap **)fPrinterCap->GetCaps(PrinterCap::kOrientation); while (count--) { AddOrientationItem((*orientation_cap)->fLabel.c_str(), (*orientation_cap)->fOrientation); orientation_cap++; } } // resolution marked = false; fResolution = new BPopUpMenu("resolution"); fResolution->SetRadioMode(true); count = fPrinterCap->CountCap(PrinterCap::kResolution); ResolutionCap **resolution_cap = (ResolutionCap **)fPrinterCap->GetCaps(PrinterCap::kResolution); while (count--) { item = new BMenuItem((*resolution_cap)->fLabel.c_str(), NULL); fResolution->AddItem(item); item->SetTarget(this); if (((*resolution_cap)->fXResolution == fJobData->GetXres()) && ((*resolution_cap)->fYResolution == fJobData->GetYres())) { item->SetMarked(true); marked = true; } resolution_cap++; } if (!marked) item->SetMarked(true); BMenuField* resolution = new BMenuField("resolution", "Resolution:", fResolution); // scale BString scale; scale << (int)fJobData->GetScaling(); fScaling = new BTextControl("scale", "Scale [%]:", scale.String(), NULL); int num; for (num = 0; num <= 255; num++) { fScaling->TextView()->DisallowChar(num); } for (num = 0; num <= 9; num++) { fScaling->TextView()->AllowChar('0' + num); } fScaling->TextView()->SetMaxBytes(3); // cancel and ok BButton* cancel = new BButton("cancel", "Cancel", new BMessage(kMsgCancel)); BButton* ok = new BButton("ok", "OK", new BMessage(kMsgOK)); ok->MakeDefault(true); BGridView* settings = new BGridView(); BGridLayout* settingsLayout = settings->GridLayout(); settingsLayout->AddItem(paperSize->CreateLabelLayoutItem(), 0, 0); settingsLayout->AddItem(paperSize->CreateMenuBarLayoutItem(), 1, 0); settingsLayout->AddItem(orientation->CreateLabelLayoutItem(), 0, 1); settingsLayout->AddItem(orientation->CreateMenuBarLayoutItem(), 1, 1); settingsLayout->AddItem(resolution->CreateLabelLayoutItem(), 0, 2); settingsLayout->AddItem(resolution->CreateMenuBarLayoutItem(), 1, 2); settingsLayout->AddItem(fScaling->CreateLabelLayoutItem(), 0, 3); settingsLayout->AddItem(fScaling->CreateTextViewLayoutItem(), 1, 3); settingsLayout->SetSpacing(0, 0); SetLayout(new BGroupLayout(B_VERTICAL)); AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) .AddGroup(B_HORIZONTAL, 5, 1.0f) .AddGroup(B_VERTICAL, 0, 1.0f) .Add(fMarginView) .AddGlue() .End() .AddGroup(B_VERTICAL, 0, 1.0f) .Add(settings) .AddGlue() .End() .End() .AddGroup(B_HORIZONTAL, 10, 1.0f) .AddGlue() .Add(cancel) .Add(ok) .End() .SetInsets(10, 10, 10, 10) ); }
SettingsWindow::SettingsWindow(BRect frame) : BWindow(frame, B_TRANSLATE("MediaPlayer settings"), B_FLOATING_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS) { const float kSpacing = be_control_look->DefaultItemSpacing(); BBox* settingsBox = new BBox(B_PLAIN_BORDER, NULL); BGroupLayout* settingsLayout = new BGroupLayout(B_VERTICAL, kSpacing / 2); settingsBox->SetLayout(settingsLayout); BBox* buttonBox = new BBox(B_PLAIN_BORDER, NULL); BGroupLayout* buttonLayout = new BGroupLayout(B_HORIZONTAL, kSpacing / 2); buttonBox->SetLayout(buttonLayout); BStringView* playModeLabel = new BStringView("stringViewPlayMode", B_TRANSLATE("Play mode")); BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions", B_TRANSLATE("View options")); BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg", B_TRANSLATE("Volume of background clips")); BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER); playModeLabel->SetExplicitAlignment(alignment); playModeLabel->SetFont(be_bold_font); viewOptionsLabel->SetExplicitAlignment(alignment); viewOptionsLabel->SetFont(be_bold_font); bgMoviesModeLabel->SetExplicitAlignment(alignment); bgMoviesModeLabel->SetFont(be_bold_font); fAutostartCB = new BCheckBox("chkboxAutostart", B_TRANSLATE("Automatically start playing"), new BMessage(M_SETTINGS_CHANGED)); fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies", B_TRANSLATE("Close window after playing video"), new BMessage(M_SETTINGS_CHANGED)); fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds", B_TRANSLATE("Close window after playing audio"), new BMessage(M_SETTINGS_CHANGED)); fLoopMoviesCB = new BCheckBox("chkBoxLoopMovie", B_TRANSLATE("Loop video"), new BMessage(M_SETTINGS_CHANGED)); fLoopSoundsCB = new BCheckBox("chkBoxLoopSounds", B_TRANSLATE("Loop audio"), new BMessage(M_SETTINGS_CHANGED)); fUseOverlaysCB = new BCheckBox("chkBoxUseOverlays", B_TRANSLATE("Use hardware video overlays if available"), new BMessage(M_SETTINGS_CHANGED)); fScaleBilinearCB = new BCheckBox("chkBoxScaleBilinear", B_TRANSLATE("Scale movies smoothly (non-overlay mode)"), new BMessage(M_SETTINGS_CHANGED)); fScaleFullscreenControlsCB = new BCheckBox("chkBoxScaleControls", B_TRANSLATE("Scale controls in full screen mode"), new BMessage(M_SETTINGS_CHANGED)); fSubtitleSizeOP = new BOptionPopUp("subtitleSize", B_TRANSLATE("Subtitle size:"), new BMessage(M_SETTINGS_CHANGED)); fSubtitleSizeOP->AddOption( B_TRANSLATE("Small"), mpSettings::SUBTITLE_SIZE_SMALL); fSubtitleSizeOP->AddOption( B_TRANSLATE("Medium"), mpSettings::SUBTITLE_SIZE_MEDIUM); fSubtitleSizeOP->AddOption( B_TRANSLATE("Large"), mpSettings::SUBTITLE_SIZE_LARGE); fSubtitlePlacementOP = new BOptionPopUp("subtitlePlacement", B_TRANSLATE("Subtitle placement:"), new BMessage(M_SETTINGS_CHANGED)); fSubtitlePlacementOP->AddOption(B_TRANSLATE("Bottom of video"), mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_VIDEO); fSubtitlePlacementOP->AddOption(B_TRANSLATE("Bottom of screen"), mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_SCREEN); fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume", B_TRANSLATE("Full volume"), new BMessage(M_SETTINGS_CHANGED)); fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume", B_TRANSLATE("Low volume"), new BMessage(M_SETTINGS_CHANGED)); fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume", B_TRANSLATE("Muted"), new BMessage(M_SETTINGS_CHANGED)); fRevertB = new BButton("revert", B_TRANSLATE("Revert"), new BMessage(M_SETTINGS_REVERT)); BButton* cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"), new BMessage(M_SETTINGS_CANCEL)); BButton* okButton = new BButton("ok", B_TRANSLATE("OK"), new BMessage(M_SETTINGS_SAVE)); okButton->MakeDefault(true); // Build the layout BGroupLayout* volumeGroup; BGroupLayout* startGroup; BGroupLayout* playGroup; BLayoutBuilder::Group<>(this, B_VERTICAL, 0) .AddGroup(settingsLayout) .SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING) .Add(playModeLabel) .AddGroup(B_HORIZONTAL, 0) .GetLayout(&playGroup) .AddStrut(10) .AddGroup(B_VERTICAL, 0) .GetLayout(&startGroup) .Add(fAutostartCB) .AddGrid(kSpacing, 0) .Add(BSpaceLayoutItem::CreateHorizontalStrut(kSpacing), 0, 0) .Add(fCloseWindowMoviesCB, 1, 0) .Add(BSpaceLayoutItem::CreateHorizontalStrut(kSpacing), 0, 1) .Add(fCloseWindowSoundsCB, 1, 1) .End() .Add(fLoopMoviesCB) .Add(fLoopSoundsCB) .End() .End() .AddStrut(kSpacing) .Add(viewOptionsLabel) .AddGroup(B_HORIZONTAL, 0) .AddStrut(10) .AddGroup(B_VERTICAL, 0) .Add(fUseOverlaysCB) .Add(fScaleBilinearCB) .Add(fScaleFullscreenControlsCB) .Add(fSubtitleSizeOP) .Add(fSubtitlePlacementOP) .End() .End() .AddStrut(kSpacing) .Add(bgMoviesModeLabel) .AddGroup(B_HORIZONTAL, 0) .AddStrut(10) .AddGroup(B_VERTICAL, 0) .GetLayout(&volumeGroup) .Add(fFullVolumeBGMoviesRB) .Add(fHalfVolumeBGMoviesRB) .Add(fMutedVolumeBGMoviesRB) .End() .End() .AddStrut(kSpacing) .End() .AddGroup(buttonLayout) .SetInsets(B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING, B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING) .Add(fRevertB) .AddGlue() .Add(cancelButton) .Add(okButton); startGroup->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); playGroup->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); volumeGroup->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); }
EULAWindow::EULAWindow() : BWindow(BRect(0, 0, 600, 450), B_TRANSLATE("README"), B_MODAL_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS) { BString infoText; infoText << B_TRANSLATE( "Welcome to the Haiku Installer!\n\n"); infoText << B_TRANSLATE( "IMPORTANT INFORMATION BEFORE INSTALLING HAIKU\n\n"); infoText << B_TRANSLATE( "This is beta-quality software! It means there is a risk of " "losing important data. Make frequent backups! You have been " "warned.\n\n\n"); infoText << B_TRANSLATE( "1) If you are installing Haiku onto real hardware (not inside an " "emulator), you may want to prepare a hard disk partition from " "another OS (you could, for example, use a GParted Live-CD, which " "can also resize existing partitions to make room).\n" "You can also set up partitions by launching DriveSetup from " "Installer, but you won't be able to resize existing partitions with " "it. While DriveSetup has been quite thoroughly tested over the " "years, it's recommended to have up-to-date backups of the other " "partitions on your system. Just in case" B_UTF8_ELLIPSIS); infoText << "\n\n\n"; infoText << B_TRANSLATE( "2) The Installer will make the Haiku partition itself bootable, " "but takes no steps to integrate Haiku into an existing boot menu. " "If you have GRUB already installed, you can add Haiku to it.\n" "For details, please consult the guide on booting Haiku on our " "website at https://www.haiku-os.org/guides/booting.\n" "Or you can set up a boot menu from Installer's \"Tools\" menu, see " "the Userguide's topic on the application \"BootManager\".\n\n\n"); infoText << B_TRANSLATE( "3) When you successfully boot into Haiku for the first time, make " "sure to read our \"Welcome\" and \"Userguide\" documentation. There " "are links on the Desktop and in WebPositive's bookmarks.\n\n"); infoText << B_TRANSLATE( "Have fun and thanks for trying out Haiku!"); BTextView* textView = new BTextView("eula", be_plain_font, NULL, B_WILL_DRAW); textView->SetInsets(10, 10, 10, 10); textView->MakeEditable(false); textView->MakeSelectable(false); textView->SetText(infoText); BScrollView* scrollView = new BScrollView("eulaScroll", textView, B_WILL_DRAW, false, true); BButton* cancelButton = new BButton(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED)); cancelButton->SetTarget(be_app); BButton* continueButton = new BButton(B_TRANSLATE("Continue"), new BMessage(kMsgAgree)); continueButton->SetTarget(be_app); continueButton->MakeDefault(true); if (!be_roster->IsRunning(kTrackerSignature)) SetWorkspaces(B_ALL_WORKSPACES); BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING) .SetInsets(B_USE_WINDOW_SPACING) .Add(scrollView) .AddGroup(B_HORIZONTAL, B_USE_ITEM_SPACING) .AddGlue() .Add(cancelButton) .Add(continueButton); CenterOnScreen(); Show(); }