void BF_GUI_TopMenu::OpenVMenu(bool b_FocusHMenu) { if(poVMenu) return; printf("OpenVMenu()\n"); // BF_GUI_TopMenu_HItem *poHItem = (BF_GUI_TopMenu_HItem*)ploMenu->ItemAt( iNavCursorIndex ); if(!poHItem) return; // BView *poParent = Parent(); ASSERT(poParent); // BRect oRect(CalcItemXPos(iNavCursorIndex),Frame().bottom+1,0,0); // poVMenuPanel = new BF_GUI_DlgPanel(oRect,"","dlg",B_FOLLOW_NONE,0,false); poVMenuPanel->SetSizeBy( BF_GUI_ViewMenu_CalcMaxWidth(&poHItem->loVItem,&poSysSetup->oFontToolView,false), 5+poSysSetup->oFontToolView.fHeight*(poHItem->loVItem.CountItems() ) ); poVMenuPanel->LocalBounds(oRect); // poVMenu = new BF_GUI_TopVMenu(oRect,&poHItem->loVItem,this); // poVMenuPanel->AddChild(poVMenu); // poParent->AddChild(poVMenuPanel); if(b_FocusHMenu) poVMenu->MakeFocus(); }
BView* SeqPrefWin::NewEditView(BRect bounds, const BMessage& prefs) { BView* v = new BView(bounds, EDIT_STR, B_FOLLOW_ALL, 0); if (!v) return v; v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) ); const char* label = "Undo history:"; float top = INDENT; float fh = view_font_height(v); float ih = Prefs().Size(INT_CTRL_Y); float max = (fh > ih) ? fh : ih; BRect r(INDENT, top, INDENT + v->StringWidth(label), top + max); BStringView* sv = new BStringView(r, "undolevellabel", label); if (sv) v->AddChild(sv); r.left = r.right + LABEL_PAD; r.right = r.left + v->StringWidth("999") + 5; mUndoLevelCtrl = new ArpIntControl( r, UNDO_LEVEL_INT, NULL, new BMessage(CHANGE_UNDO_HISTORY_MSG) ); if (mUndoLevelCtrl) { mUndoLevelCtrl->SetLimits(0, UNDO_HISTORY_MAX); int32 level; if (prefs.FindInt32(UNDO_HISTORY_PREF, &level) != B_OK) level = AM_DEFAULT_UNDO_HISTORY; if (level < 0 || level > UNDO_HISTORY_MAX) level = AM_DEFAULT_UNDO_HISTORY; mUndoLevelCtrl->SetValue(level); v->AddChild(mUndoLevelCtrl); } return v; }
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(); }
// show_window void show_window(BRect frame, const char* name) { BWindow* window = new BWindow(frame, name, B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE); BView* view = new TestView(window->Bounds(), "test", B_FOLLOW_ALL, B_WILL_DRAW/* | B_FULL_UPDATE_ON_RESIZE*/); window->AddChild(view); BRect b(0.0, 0.0, 50.0, 15.0); b.OffsetTo(5.0, view->Bounds().bottom - (b.Height() + 15.0)); BButton* control = new BButton(b, "button", "Copy", new BMessage(MSG_COPY_BITS)); view->AddChild(control); control->SetTarget(view); // test CopyBits() on top of children b = BRect(80, 130, 130, 160); BView* child = new BView(b, "some child", B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, 0); child->SetViewColor(255, 0, 0); view->AddChild(child); b = BRect(136, 127, 158, 140); child = new BView(b, "some other child", B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, 0); child->SetViewColor(255, 255, 0); view->AddChild(child); window->Show(); }
/*********************************************************** * Set up GUIs. ***********************************************************/ void HAddTrackerWindow::InitGUI() { BView *view = new BView(Bounds(),"bgview",0,0); view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); BRect rect = Bounds(); rect.left += 20; rect.right -= 20; rect.top += 10; rect.bottom = rect.top + 20; BTextControl *control = new BTextControl(rect,"name","Name:","",new BMessage(M_END_NAME)); control->SetDivider(50); view->AddChild(control); rect.OffsetBy(0,30); control = new BTextControl(rect,"address","Address:","",NULL); control->SetDivider(50); view->AddChild(control); rect.OffsetBy(0,30); rect.left = rect.right - 70; BButton *btn = new BButton(rect,"ok","OK",new BMessage(M_OK_MSG)); view->AddChild(btn); rect.OffsetBy(-80,0); btn = new BButton(rect,"cancel","Cancel",new BMessage(B_QUIT_REQUESTED)); view->AddChild(btn); this->AddChild(view); }
BView *PrefsWindow::create_serial_pane(void) { BView *pane = new BView(BRect(0, 0, top_frame.right-20, top_frame.bottom-80), GetString(STR_SERIAL_NETWORK_PANE_TITLE), B_FOLLOW_NONE, B_WILL_DRAW); pane->SetViewColor(fill_color); float right = pane->Bounds().right-10; BMenuField *menu_field; BPopUpMenu *menu_a = new BPopUpMenu(""); add_serial_names(menu_a, MSG_SER_A); menu_field = new BMenuField(BRect(10, 5, right, 20), "seriala", GetString(STR_SERIALA_CTRL), menu_a); menu_field->SetDivider(90); pane->AddChild(menu_field); set_serial_label(menu_a, "seriala"); BPopUpMenu *menu_b = new BPopUpMenu(""); add_serial_names(menu_b, MSG_SER_B); menu_field = new BMenuField(BRect(10, 26, right, 41), "serialb", GetString(STR_SERIALB_CTRL), menu_b); menu_field->SetDivider(90); pane->AddChild(menu_field); set_serial_label(menu_b, "serialb"); ether_checkbox = new BCheckBox(BRect(10, 47, right, 62), "ether", GetString(STR_ETHER_ENABLE_CTRL), new BMessage(MSG_ETHER)); pane->AddChild(ether_checkbox); ether_checkbox->SetValue(PrefsFindString("ether") ? B_CONTROL_ON : B_CONTROL_OFF); udptunnel_checkbox = new BCheckBox(BRect(10, 67, right, 72), "udptunnel", GetString(STR_UDPTUNNEL_CTRL), new BMessage(MSG_UDPTUNNEL)); pane->AddChild(udptunnel_checkbox); udptunnel_checkbox->SetValue(PrefsFindBool("udptunnel") ? B_CONTROL_ON : B_CONTROL_OFF); udpport_ctrl = new NumberControl(BRect(10, 87, right / 2, 105), 118, "udpport", GetString(STR_UDPPORT_CTRL), PrefsFindInt32("udpport"), NULL); pane->AddChild(udpport_ctrl); hide_show_serial_ctrls(); return pane; }
/*********************************************************** * InitGUI ***********************************************************/ void HAddUrlDlg::InitGUI() { BView* bg = new BView(Bounds(), "bg", B_FOLLOW_ALL, B_WILL_DRAW); bg->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); BRect rect = Bounds(); rect.left += 5; rect.top += 5; rect.bottom -= 5 + 30 + B_H_SCROLL_BAR_HEIGHT; rect.right -= 5 + B_V_SCROLL_BAR_WIDTH; fURLView = new CTextView(rect, "url", B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE); BScrollView* scroll = new BScrollView("scroll", fURLView, B_FOLLOW_ALL, B_WILL_DRAW, false, true); bg->AddChild(scroll); rect.top = rect.bottom + 5 + B_H_SCROLL_BAR_HEIGHT; rect.bottom = Bounds().bottom - 5; rect.left = rect.right - 80; BButton* button = new BButton(rect, "add", _("Add"), new BMessage(M_OK_MESSAGE), B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT); bg->AddChild(button); AddChild(bg); }
FieldWindow::FieldWindow(MainWindow *mw) : BWindow(BRect(0, 0, 300, 190), "Field", B_FLOATING_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE, 0) { field = -1; main_window = mw; BView *view = new BView(Bounds(), "view", B_FOLLOW_ALL, B_WILL_DRAW); view->SetViewColor(225,225,225); field_name = new BTextControl(BRect(10, 10, 250, 40), "field_name", "Field Name:", NULL, NULL); field_name->SetModificationMessage(new BMessage(FW_MSG_TEXT_MODIFIED)); view->AddChild(field_name); field_menu = new BMenu("<Field Type>"); field_menu->SetLabelFromMarked(true); field_menu->AddItem(new BMenuItem("Single Line Text", new BMessage(FW_MSG_SINGLE_LINE))); field_menu->AddItem(new BMenuItem("Multi Line Text", new BMessage(FW_MSG_MULTI_LINE))); field_menu->AddItem(new BMenuItem("Number", new BMessage(FW_MSG_NUMBER))); field_type = new BMenuField(BRect(10, 40, 250, 60), "field_type", "Field Type:", field_menu); view->AddChild(field_type); b_create = new BButton(BRect(20, Bounds().IntegerHeight() - 10 - 25, 20 + 100, Bounds().IntegerHeight() - 10), "b_create", "Create", new BMessage(MSG_ADD_FIELD_TO_LAYOUT)); b_create->SetEnabled(false); b_cancel = new BButton(BRect(140, Bounds().IntegerHeight() - 10 - 25, 140 + 100, Bounds().IntegerHeight() - 10), "b_cancel", "Cancel", new BMessage(FW_MSG_CANCEL)); view->AddChild(b_create); view->AddChild(b_cancel); AddChild(view); //Center window BPoint p = Utils::GetScreenMidPointForWindow(Bounds()); MoveTo(p); }
PyeManagerWindow::PyeManagerWindow(BHandler* returnHandler, Proxy* theProxy) : BWindow(BRect(200, 200, 415, 500), "Payee Manager", B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE) { this->returnHandler = returnHandler; this->theProxy = theProxy; pyeS = theProxy->GetPyeS(); BRect frame = Frame(); frame.OffsetTo(0, 0); BView* backdrop = new BView(frame, "backview", B_FOLLOW_ALL_SIDES, B_WILL_DRAW); backdrop->SetViewColor(222, 222, 222); AddChild(backdrop); lv = new BListView(BRect(10, 10, frame.Width() - 10 - 15, frame.Height() - 70), "PyeManagerLV"); backdrop->AddChild(new BScrollView("scrolllv", lv, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true)); FillList(); BButton* b = new BButton(BRect(10, frame.bottom - 60, 100, frame.bottom - 40), "NewB", "New...", new BMessage(PyeManagerWindowNewMSG)); backdrop->AddChild(b); b = new BButton(BRect(110, frame.bottom - 60, 200, frame.bottom - 40), "RenameB", "Rename...", new BMessage(PyeManagerWindowRenameMSG)); backdrop->AddChild(b); b = new BButton(BRect(10, frame.bottom - 30, 100, frame.bottom - 10), "DeleteB", "Delete...", new BMessage(PyeManagerWindowDeleteMSG)); backdrop->AddChild(b); b = new BButton(BRect(110, frame.bottom - 30, 200, frame.bottom - 10), "CloseB", "Close", new BMessage(PyeManagerWindowCloseMSG)); backdrop->AddChild(b); }
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(); }
DocInfoWindow::DocInfoWindow(BMessage *docInfo) : HWindow(BRect(0, 0, 400, 250), "Document Information", B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_MINIMIZABLE), fDocInfo(docInfo) { BRect bounds(Bounds()); BView *background = new BView(bounds, "bachground", B_FOLLOW_ALL, B_WILL_DRAW); background->SetViewColor(ui_color(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); }
void ImageFilePanel::Show() { if (fImageView == NULL) { Window()->Lock(); BView* background = Window()->ChildAt(0); uint32 poseViewResizingMode = background->FindView("PoseView")->ResizingMode(); uint32 countVwResizingMode = background->FindView("CountVw")->ResizingMode(); uint32 vScrollBarResizingMode = background->FindView("VScrollBar")->ResizingMode(); uint32 hScrollBarResizingMode = background->FindView("HScrollBar")->ResizingMode(); background->FindView("PoseView") ->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP); background->FindView("CountVw") ->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP); background->FindView("VScrollBar") ->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP); background->FindView("HScrollBar") ->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP); Window()->ResizeBy(0, 70); background->FindView("PoseView")->SetResizingMode(poseViewResizingMode); background->FindView("CountVw")->SetResizingMode(countVwResizingMode); background->FindView("VScrollBar") ->SetResizingMode(vScrollBarResizingMode); background->FindView("HScrollBar") ->SetResizingMode(hScrollBarResizingMode); BRect rect(background->Bounds().left + 15, background->Bounds().bottom - 94, background->Bounds().left + 122, background->Bounds().bottom - 15); fImageView = new BView(rect, "ImageView", B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_SUBPIXEL_PRECISE); fImageView->SetViewColor(background->ViewColor()); background->AddChild(fImageView); rect = BRect(background->Bounds().left + 132, background->Bounds().bottom - 85, background->Bounds().right, background->Bounds().bottom - 65); fResolutionView = new BStringView(rect, "ResolutionView", NULL, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); background->AddChild(fResolutionView); rect.OffsetBy(0, -16); fImageTypeView = new BStringView(rect, "ImageTypeView", NULL, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); background->AddChild(fImageTypeView); Window()->Unlock(); } BFilePanel::Show(); }
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(); }
BView* SeqEditMultiFilterWindow::NewGeneralView(BRect frame) { BView* v = new BView(frame, GENERAL_STR, B_FOLLOW_ALL, 0); if (!v) return NULL; v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) ); float fh = arp_get_font_height(v); float spaceX = 5, spaceY = 5; float divider = v->StringWidth("Author:") + 10; BRect f(spaceX, 0, frame.Width() - spaceX, fh); /* The Name field. */ mNameCtrl = new BTextControl(f, "name_ctrl", "Name:", NULL, new BMessage(NAME_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); if (mNameCtrl) { f.top = mNameCtrl->Frame().bottom; mNameCtrl->SetDivider(divider); mNameCtrl->MakeFocus(true); v->AddChild(mNameCtrl); } /* The Key field. */ f.top += spaceY; f.bottom = f.top + fh; mKeyCtrl = new BTextControl(f, "key_ctrl", "Key:", NULL, new BMessage(KEY_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); if (mKeyCtrl) { f.top = mKeyCtrl->Frame().bottom; mKeyCtrl->SetDivider(divider); v->AddChild(mKeyCtrl); } /* The Author field. */ f.top += spaceY; f.bottom = f.top + fh; mAuthorCtrl = new BTextControl(f, "author_ctrl", "Author:", NULL, new BMessage(AUTHOR_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); if (mAuthorCtrl) { f.top = mAuthorCtrl->Frame().bottom; mAuthorCtrl->SetDivider(divider); v->AddChild(mAuthorCtrl); } /* The Email field. */ f.top += spaceY; f.bottom = f.top + fh; mEmailCtrl = new BTextControl(f, "email_ctrl", "Email:", NULL, new BMessage(EMAIL_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); if (mEmailCtrl) { f.top = mEmailCtrl->Frame().bottom; mEmailCtrl->SetDivider(divider); v->AddChild(mEmailCtrl); } return v; }
BFIV_PrefWin::BFIV_PrefWin(BRect frame) : BWindow(frame, "Preferences", B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_RESIZABLE|B_NOT_ZOOMABLE) { BRect rect = Bounds(); BView *back; BTextControl *scratchPath; BButton *cancelButton, *okButton, *selectButton; font_height fontHeight; float fontSize, tmp; // private data filePanel = NULL; // some font voodoo be_plain_font->GetHeight(&fontHeight); fontSize = fontHeight.ascent + fontHeight.descent; // the background back = new BView(rect, "background", B_FOLLOW_ALL, 0); back->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(back); // the select button tmp = be_plain_font->StringWidth("Select"); rect.Set(frame.Width() - tmp - 20., 5., frame.Width() - 5., 5. + fontSize + 10.); selectButton = new BButton(rect, "select", "Select", new BMessage(SELECT_SCRATCH_PATH)); back->AddChild(selectButton); // the path rect.Set(5.,5., selectButton->Frame().left - 5., 5. + fontSize + 10.); scratchPath = new BTextControl(rect, "path", "Scratch Location", NULL, NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW); back->AddChild(scratchPath); scratchPath->SetText(((BFIV_App *)be_app)->ScratchDirectory()); // current dir scratchPath->TextView()->MakeEditable(false); // only works after AddChild() (!!) // the ok button tmp = be_plain_font->StringWidth("OK"); rect.Set(frame.Width() - tmp - 35., Frame().Height() - fontSize - 20., frame.Width() - 10., Frame().Height() - 10.); okButton = new BButton(rect, "ok", "OK", new BMessage(APPLY_PREFS_CHANGE)); back->AddChild(okButton); okButton->MakeDefault(true); // the cancel button tmp = be_plain_font->StringWidth("Cancel"); rect.Set(okButton->Frame().left - tmp - 20., okButton->Frame().top, okButton->Frame().left - 5., okButton->Frame().bottom); cancelButton = new BButton(rect, "cancel", "Cancel", new BMessage(B_QUIT_REQUESTED)); back->AddChild(cancelButton); }
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); }
PreviewView::PreviewView(const char* name) : BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), fSaverView(NULL), fNoPreview(NULL) { SetViewUIColor(B_PANEL_BACKGROUND_COLOR); BGroupLayout* layout = new BGroupLayout(B_VERTICAL); // We draw the "monitor" around the preview, hence the strange insets. layout->SetInsets(7, 6, 8, 12); SetLayout(layout); // A BStringView would be enough, if only it handled word wrapping. fNoPreview = new BTextView("no preview"); fNoPreview->SetText(B_TRANSLATE("No preview available")); fNoPreview->SetFontAndColor(be_plain_font, B_FONT_ALL, &kWhite); fNoPreview->MakeEditable(false); fNoPreview->MakeResizable(false); fNoPreview->MakeSelectable(false); fNoPreview->SetViewColor(0, 0, 0); fNoPreview->SetLowColor(0, 0, 0); fNoPreview->Hide(); BView* container = new BView("preview container", 0); container->SetLayout(new BCardLayout()); AddChild(container); container->SetViewColor(0, 0, 0); container->SetLowColor(0, 0, 0); container->AddChild(fNoPreview); fNoPreview->SetHighColor(255, 255, 255); fNoPreview->SetAlignment(B_ALIGN_CENTER); }
NSDownloadWindow::NSDownloadWindow(download_context* ctx) : BWindow(BRect(30, 30, 400, 200), "Downloads", B_TITLED_WINDOW, B_NOT_RESIZABLE) , ctx(ctx) , progress(0) , success(false) { unsigned long dlsize = download_context_get_total_length(ctx); char* buffer = human_friendly_bytesize(dlsize); // Create the status bar BRect rect = Bounds(); rect.InsetBy(3, 3); bar = new BStatusBar(rect, "progress", download_context_get_filename(ctx), buffer); bar->SetMaxValue(dlsize); // Create the backgroundview (just so that the area around the progress bar // is B_PANEL_BACKGROUND_COLOR instead of white) BView* back = new BView(Bounds(), "back", B_FOLLOW_ALL_SIDES, B_WILL_DRAW); back->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); // Add the views to the window back->AddChild(bar); AddChild(back); // Resize the window to leave a margin around the progress bar BRect size = bar->Bounds(); ResizeTo(size.Width() + 6, size.Height() + 6); Show(); }
MWindow::MWindow(int width, int height, const char* title) : BWindow(BRect(80,80,80+width,80+height), title, B_TITLED_WINDOW_LOOK,B_NORMAL_WINDOW_FEEL,0)//B_NOT_RESIZABLE|B_NOT_ZOOMABLE) { BScreen scr; image_width = width; image_height = height; float oWidth = ( Frame().left + width )<scr.Frame().Width()?width:(scr.Frame().Width()-Frame().left-20); float oHeight = ( Frame().top + height )<scr.Frame().Height()?height:(scr.Frame().Height()-Frame().top-20); renderRect = Bounds(); prev_frame = Frame(); BView *view = new BView(Bounds(),"container",B_FOLLOW_ALL, B_WILL_DRAW); view->SetViewColor(0,0,0); AddChild(view); fb = new FBView(Bounds(), width, height); fb->SetViewColor(B_TRANSPARENT_32_BIT); view->AddChild(fb); ResizeTo(oWidth, oHeight); renderRect = Bounds(); prev_frame = Frame(); }
void TMediaTabView::ActivateView(EChildID which) { // Give the view the control buttons BView* view = ChildAt(which); BPoint pt = view->Bounds().LeftBottom(); // Get the target button position. Slightly different for the // different view types. if (which == kElementsView) pt.y -= kScrollHeight; else { pt.x++; pt.y -= kScrollHeight + 1; } for (int i = 0; i < 3; i++) { view->AddChild(fbuttons[i]); fbuttons[i]->MoveTo(pt); pt.x += kScrollHeight; } // Make sure it is visible if (view->IsHidden()) view->Show(); }
status_t addon_init (uint32 index, becasso_addon_info *info) { strcpy (info->name, "CaptureTest"); strcpy (info->author, "Sander Stoks"); strcpy (info->copyright, "© 1998-2001 ∑ Sum Software"); strcpy (info->description, "Fake Capture add-on"); info->type = BECASSO_CAPTURE; info->index = index; info->version = 1; info->release = 2; info->becasso_version = 2; info->becasso_release = 0; info->does_preview = 0; info->flags = 0; window = new CaptureWindow (BRect (100, 180, 100 + 188, 180 + 72)); BView *bg = new BView (BRect (0, 0, 188, 72), "bg", B_FOLLOW_ALL_SIDES, B_WILL_DRAW); bg->SetViewColor (LightGrey); window->AddChild (bg); BMessage *msg = new BMessage (CAPTURE_READY); msg->AddInt32 ("index", index); BButton *grab = new BButton (BRect (128, 40, 180, 64), "grab", "Grab", msg); grab->SetTarget (be_app); bg->AddChild (grab); window->Run(); return (0); }
ProgressWindow::ProgressWindow(BWindow* referenceWindow, bool center) : BWindow(BRect(0, 0, 250, 100), "Progress monitor", B_MODAL_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS), fRunner(NULL) { BRect rect = Bounds(); BView *view = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW); view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(view); rect = view->Bounds().InsetByCopy(5, 5); fStatusBar = new BStatusBar(rect, "status", NULL, NULL); float width, height; fStatusBar->GetPreferredSize(&width, &height); fStatusBar->ResizeTo(rect.Width(), height); fStatusBar->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT); view->AddChild(fStatusBar); BScreen screen(referenceWindow); if (!center) { ResizeTo(Bounds().Width(), height + 9); // TODO: frame width! MoveTo(screen.Frame().left + 5, screen.Frame().bottom - Bounds().Height() - 5); } else CenterIn(screen.Frame()); Run(); }
Window(BRect frame) : BWindow(frame, "BStatusBar Test", B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE | B_NOT_ZOOMABLE), fHomeFolderEntryCount(0), fHomeFolderCurrentEntry(0) { frame = Bounds(); BView* background = new BView(frame, "bg", B_FOLLOW_ALL, 0); background->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(background); frame = background->Bounds(); frame.InsetBy(10, 10); fStatusBar = new BStatusBar(frame, "status", "Label: ", "-Trailing"); fStatusBar->SetResizingMode(B_FOLLOW_ALL); background->AddChild(fStatusBar); fHomeFolder.SetTo("/boot/home/"); BEntry entry; while (fHomeFolder.GetNextEntry(&entry) == B_OK) fHomeFolderEntryCount++; fPulse = new BMessageRunner(BMessenger(this), new BMessage(MSG_PULSE), 1000000); }
/******************************************************* * Our wonderful BWindow, ya its kewl like that. * we dont do much here but set up the menubar and * let the view take over. We also nead some message * redirection and handling *******************************************************/ ToolTipWindow::ToolTipWindow() : BWindow(BRect(0,0,100,19),"Tool Tip", B_NO_BORDER_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS|B_NOT_RESIZABLE|B_AVOID_FRONT|B_AVOID_FOCUS){ Looper()->SetName(TOOL_TIP_WINDOW); BView *v = new BView(Bounds(),"",B_FOLLOW_ALL,0); v->SetViewColor(255,255,120); AddChild(v); BRect b = v->Bounds(); b.Set(b.left-1,b.top-1,b.right+1,b.bottom+1); BBox *bb = new BBox(b,"",B_FOLLOW_ALL); v->AddChild(bb); b = bb->Frame(); b.InsetBy(1,1); b.left = 4; b.bottom --; tipv = new BStringView(b,"","...",B_FOLLOW_ALL); tipv->SetAlignment(B_ALIGN_CENTER); bb->AddChild(tipv); Run(); }
void PecoApp::ChangeRenamer() { BMenuField *myField = (BMenuField *)fWindow->FindView("selectMode"); BMenu *myMenu = myField->Menu(); if (fRenameMode != myMenu->IndexOf(myField->Menu()->FindMarked())) { BView *bottomView = fWindow->FindView("bottomView"); fWindow->Lock(); if (fRenameMode != -1) bottomView->RemoveChild((BView *)((PecoApp *)be_app)->fRenamers[fRenameMode]); else { float deltaHeight = be_plain_font->Size()*2 + 40; fWindow->FindView("topView")->SetResizingMode(0); fWindow->FindView("bottomView")->SetResizingMode(B_FOLLOW_TOP_BOTTOM); fWindow->ResizeBy(0, deltaHeight); fWindow->FindView("topView")->SetResizingMode(B_FOLLOW_TOP_BOTTOM); fWindow->FindView("bottomView")->SetResizingMode(B_FOLLOW_BOTTOM); float min_h, max_h, min_v, max_v; fWindow->GetSizeLimits( &min_h, &max_h, &min_v, &max_v ); fWindow->SetSizeLimits( min_h, max_h, min_v + deltaHeight, max_v ); } fRenameMode = myMenu->IndexOf(myField->Menu()->FindMarked()); bottomView->AddChild(((PecoApp *)be_app)->fRenamers[fRenameMode]); if (((PecoApp *)be_app)->fRenamers[fRenameMode]->ChildAt(0) != NULL) ((PecoApp *)be_app)->fRenamers[fRenameMode]->ChildAt(0)->MakeFocus(); else fWindow->FindView("DoIt")->MakeFocus(); fWindow->Unlock(); MakeList(); } }
TestWindow::TestWindow(BApplication* myApp) : BWindow(BRect(20,20,100,100), "Code Profile", B_TITLED_WINDOW, 0) { BRect frm = Bounds(); BView* myview = new BView(BRect(),"testView",0,0); BOutlineListView* olist = new BOutlineListView(BRect(),"MyList", B_SINGLE_SELECTION_LIST,B_FOLLOW_NONE); if( myview && olist ) { myview->AddChild(olist); BView* vw = olist; vw->SetViewColor(0xc0,0xc0,0xc0); vw->Invalidate(); vw->SetLowColor(0xc0,0xc0,0xc0); vw->Invalidate(); vw->SetHighColor(0x00,0x00,0x00); vw->Invalidate(); vw->SetFont(be_bold_font); this->AddChild(myview); BRect frm = vw->Frame(); vw->ResizeTo(1,1); vw->Draw(vw->Bounds()); vw->ResizeToPreferred(); float w=0,h=0; vw->GetPreferredSize(&w,&h); printf("Preferred size = %f x %f\n",w,h); } string = new BStringView(BRect(0,0,100,20),"String", "Ready to profile..."); if( string ) { string->SetViewColor(0xc0,0xc0,0xc0); this->AddChild(string); float w=0, h=0; string->GetPreferredSize(&w,&h); MoveTo(30,30); ResizeTo(w,h); } BMenuBar* menu = new BMenuBar(BRect(),"MainMenu",B_FOLLOW_NONE); if( menu ) { this->AddChild(menu); float w=0, h=0; menu->GetPreferredSize(&w,&h); printf("Preferred Size = (%f,%f)\n",w,h); menu->SetFont(be_plain_font); menu->GetPreferredSize(&w,&h); printf("Preferred Size = (%f,%f)\n",w,h); menu->SetFont(be_bold_font); menu->GetPreferredSize(&w,&h); printf("Preferred Size = (%f,%f)\n",w,h); menu->SetFont(be_fixed_font); menu->GetPreferredSize(&w,&h); printf("Preferred Size = (%f,%f)\n",w,h); } }
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); }
AboutWindow::AboutWindow() : BWindow(BRect(250, 200, 650, 500), "AboutWindow", B_MODAL_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NOT_CLOSABLE) { BRect r; SetTitle("About"); r = Bounds(); BView* aroundView = new BView(r, "AroundView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW); aroundView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(aroundView); r = aroundView->Bounds(); r.InsetBy(5.0, 5.0); aroundView->AddChild(new BButton(r, "close", "Close", new BMessage('ClWi'))); aroundView->AddChild(new AboutView(r, "AboutView")); }
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 */