当前位置: 首页>>代码示例>>C++>>正文


C++ BView::AddChild方法代码示例

本文整理汇总了C++中BView::AddChild方法的典型用法代码示例。如果您正苦于以下问题:C++ BView::AddChild方法的具体用法?C++ BView::AddChild怎么用?C++ BView::AddChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BView的用法示例。


在下文中一共展示了BView::AddChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: oRect

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();
}
开发者ID:mmadia,项目名称:befar-svn_clone,代码行数:28,代码来源:BF_GUI_TopMenu.cpp

示例2: NewEditView

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;
}
开发者ID:dtbinh,项目名称:Sequitur,代码行数:27,代码来源:SeqPrefWin.cpp

示例3: r

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();
}
开发者ID:DonCN,项目名称:haiku,代码行数:28,代码来源:Status.cpp

示例4: b

// 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();
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:31,代码来源:main.cpp

示例5: BView

/***********************************************************
 * 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);
}
开发者ID:HaikuArchives,项目名称:SilverWing,代码行数:29,代码来源:HAddTrackerWindow.cpp

示例6: BView

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;
}
开发者ID:AlexandreCo,项目名称:macemu,代码行数:35,代码来源:prefs_editor_beos.cpp

示例7: BView

/***********************************************************
 * 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);
}
开发者ID:kallisti5,项目名称:beget,代码行数:28,代码来源:HAddUrlDlg.cpp

示例8: BView

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);
}
开发者ID:brennanos,项目名称:XFile-Haiku,代码行数:32,代码来源:FieldWindow.cpp

示例9: Frame

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);
}
开发者ID:HaikuArchives,项目名称:Finance,代码行数:35,代码来源:PyeManagerWindow.cpp

示例10: textRect

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();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:59,代码来源:TextRequestDialog.cpp

示例11: bounds

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);
}
开发者ID:mariuz,项目名称:haiku,代码行数:57,代码来源:DocInfoWindow.cpp

示例12: rect

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();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:56,代码来源:ImageFilePanel.cpp

示例13: BView

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:HaikuArchives,项目名称:BShisen,代码行数:55,代码来源:Hall.cpp

示例14: done

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();
}
开发者ID:HaikuArchives,项目名称:BShisen,代码行数:52,代码来源:ID_Win.cpp

示例15: NewGeneralView

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;
}
开发者ID:dtbinh,项目名称:Sequitur,代码行数:51,代码来源:SeqEditMultiFilterWindow.cpp


注:本文中的BView::AddChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。