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


C++ BTextView::MakeEditable方法代码示例

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


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

示例1: BMessage

ServiceView::ServiceView(const char* name, const char* executable,
	const char* title, const char* description, BNetworkSettings& settings)
	:
	BView("service", 0),
	fName(name),
	fExecutable(executable),
	fSettings(settings)
{
	BStringView* titleView = new BStringView("service", title);
	titleView->SetFont(be_bold_font);
	titleView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));

	BTextView* descriptionView = new BTextView("description");
	descriptionView->SetText(description);
	descriptionView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	descriptionView->MakeEditable(false);

	fEnableButton = new BButton("toggler", B_TRANSLATE("Enable"),
		new BMessage(kMsgToggleService));

	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.Add(titleView)
		.Add(descriptionView)
		.AddGroup(B_HORIZONTAL)
			.AddGlue()
			.Add(fEnableButton);

	SetExplicitMinSize(BSize(200, B_SIZE_UNSET));
	_UpdateEnableButton();

	fWasEnabled = IsEnabled();
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:32,代码来源:ServiceView.cpp

示例2: BTextView

void
DataTranslationsWindow::_ShowInfoView()
{
	if (fConfigView) {
		fRightBox->RemoveChild(fConfigView);
		delete fConfigView;
		fConfigView = NULL;
	}

	BTextView* view = new BTextView("info text");
	view->MakeEditable(false);
	view->MakeSelectable(false);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	view->SetText(B_TRANSLATE(
		"Use this control panel to set default values for translators, "
		"to be used when no other settings are specified by an application."));

	BGroupView* group = new BGroupView(B_VERTICAL);
	group->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	group->AddChild(view);
	float spacing = be_control_look->DefaultItemSpacing();
	group->GroupLayout()->SetInsets(spacing, spacing, spacing, spacing);
	fRightBox->AddChild(group);
	fConfigView = group;
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:25,代码来源:DataTranslationsWindow.cpp

示例3: frame

void
Leaves::StartConfig(BView* view)
{
	BRect bounds = view->Bounds();
	bounds.InsetBy(10, 10);
	BRect frame(0, 0, bounds.Width(), 20);

	fDropRateSlider = new BSlider(frame, "drop rate",
		B_TRANSLATE("Drop rate:"), new BMessage(MSG_SET_DROP_RATE),
		kMinimumDropRate, kMaximumDropRate,	B_BLOCK_THUMB,
		B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
	fDropRateSlider->SetValue(fDropRate);
	fDropRateSlider->ResizeToPreferred();
	bounds.bottom -= fDropRateSlider->Bounds().Height() * 1.5;
	fDropRateSlider->MoveTo(bounds.LeftBottom());
	view->AddChild(fDropRateSlider);

	fLeafSizeSlider = new BSlider(frame, "leaf size",
		B_TRANSLATE("Leaf size:"), new BMessage(MSG_SET_LEAF_SIZE),
		kMinimumLeafSize, kMaximumLeafSize,	B_BLOCK_THUMB,
		B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
	fLeafSizeSlider->SetValue(fLeafSize);
	fLeafSizeSlider->ResizeToPreferred();
	bounds.bottom -= fLeafSizeSlider->Bounds().Height() * 1.5;
	fLeafSizeSlider->MoveTo(bounds.LeftBottom());
	view->AddChild(fLeafSizeSlider);

	fSizeVariationSlider = new BSlider(frame, "variation",
		B_TRANSLATE("Size variation:"),	new BMessage(MSG_SET_SIZE_VARIATION),
		0, kMaximumSizeVariation, B_BLOCK_THUMB,
		B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
	fSizeVariationSlider->SetValue(fSizeVariation);
	fSizeVariationSlider->ResizeToPreferred();
	bounds.bottom -= fSizeVariationSlider->Bounds().Height() * 1.5;
	fSizeVariationSlider->MoveTo(bounds.LeftBottom());
	view->AddChild(fSizeVariationSlider);

	BTextView* textView = new BTextView(bounds, B_EMPTY_STRING,
		bounds.OffsetToCopy(0., 0.), B_FOLLOW_ALL, B_WILL_DRAW);
	textView->SetViewColor(view->ViewColor());
	BString name = B_TRANSLATE("Leaves");
	BString text = name;
	text << "\n\n";
	text << B_TRANSLATE("by Deyan Genovski, Geoffry Song");
	text << "\n\n";

	textView->Insert(text.String());
	textView->SetStylable(true);
	textView->SetFontAndColor(0, name.Length(), be_bold_font);
	textView->MakeEditable(false);
	view->AddChild(textView);

	BWindow* window = view->Window();
	if (window) window->AddHandler(this);

	fDropRateSlider->SetTarget(this);
	fLeafSizeSlider->SetTarget(this);
	fSizeVariationSlider->SetTarget(this);
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:59,代码来源:Leaves.cpp

示例4: BStringView

void 
Shelf::StartConfig(BView *view) 
{
	PRINT(("%p:%s()\n", this, __FUNCTION__));
	fInConfig = true;

	BStringView* titleString = new BStringView("Title",
		B_TRANSLATE("Shelf"));
	titleString->SetFont(be_bold_font);

	BStringView* copyrightString = new BStringView("Copyright",
		B_TRANSLATE("© 2012 François Revol."));

	BTextView* helpText = new BTextView("Help Text");
	helpText->MakeEditable(false);
	helpText->SetViewColor(view->ViewColor());
	rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
	helpText->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor);
	BString help;
	help << B_TRANSLATE("Drop replicants on the full-screen window "
		"behind the preferences panel.");
	//help << "\n\n";
	//help << B_TRANSLATE("You can also drop colors.");
	helpText->SetText(help.String());

	BLayoutBuilder::Group<>(view, B_VERTICAL, B_USE_HALF_ITEM_SPACING)
		.SetInsets(B_USE_DEFAULT_SPACING)
		.Add(titleString)
		.Add(copyrightString)
		.AddStrut(roundf(be_control_look->DefaultItemSpacing() / 2))
		.Add(helpText)
		.AddGlue()
	.End();

	BScreen screen;
	fConfigWindow = new BWindow(screen.Frame(), "Shelf Config",
		B_UNTYPED_WINDOW, B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE
		| B_NOT_MINIMIZABLE | B_NOT_RESIZABLE | B_AVOID_FRONT | B_AVOID_FOCUS);

	BView *shelfView = new BView(fConfigWindow->Bounds(), "ShelfView", 
		B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS);
	shelfView->SetViewColor(216, 216, 216, 0);

	fConfigWindow->AddChild(shelfView);

	fShelfData.Seek(SEEK_SET, 0LL);
	fShelf = new BShelf(&fShelfData, shelfView);
	fShelf->SetDisplaysZombies(true);
	fShelfData.Seek(SEEK_SET, 0LL);

	// start the Looper
	fConfigWindow->Show();

	fConfigWindow->Lock();
	fConfigWindow->SendBehind(view->Window());
	fConfigWindow->Unlock();

	//"\nDrop replicants on me!"
} 
开发者ID:,项目名称:,代码行数:59,代码来源:

示例5: BBitmap

void
ConfigWindow::MakeHowToView()
{
	BResources *resources = BApplication::AppResources();
	if (resources)
	{
		size_t length;
		char *buffer = (char *)resources->FindResource('ICON',101,&length);
		if (buffer)
		{
			BBitmap *bitmap = new BBitmap(BRect(0,0,63,63),B_CMAP8);
			if (bitmap && bitmap->InitCheck() == B_OK)
			{
				// copy and enlarge a 32x32 8-bit bitmap
				char *bits = (char *)bitmap->Bits();
				for (int32 i = 0,j = -64;i < length;i++)
				{
					if ((i % 32) == 0)
						j += 64;

					char *b = bits + (i << 1) + j;
					b[0] = b[1] = b[64] = b[65] = buffer[i];
				}
				fConfigView->AddChild(new BitmapView(bitmap));
			}
			else
				delete bitmap;
		}
	}

	BRect rect = fConfigView->Bounds();
	BTextView *text = new BTextView(rect,NULL,rect,B_FOLLOW_NONE,B_WILL_DRAW);
	text->SetViewColor(fConfigView->Parent()->ViewColor());
	text->SetAlignment(B_ALIGN_CENTER);
	text->SetText(
		MDR_DIALECT_CHOICE ("\n\nCreate a new account using the \"Add\" button.\n\n"
		"Delete accounts (or only the inbound/outbound) by using the \"Remove\" button on the selected item.\n\n"
		"Select an item in the list to edit its configuration.",
		"\n\nアカウントの新規作成は\"追加\"ボタンを\n使います。"
		"\n\nアカウント自体またはアカウントの\n送受信設定を削除するには\n項目を選択して\"削除\"ボタンを使います。"
		"\n\nアカウント内容の変更は、\nマウスで項目をクリックしてください。"));
	rect = text->Bounds();
	text->ResizeTo(rect.Width(),text->TextHeight(0,42));
	text->SetTextRect(rect);

	text->MakeEditable(false);
	text->MakeSelectable(false);

	fConfigView->AddChild(text);
	
	static_cast<CenterContainer *>(fConfigView)->Layout();
}
开发者ID:HaikuArchives,项目名称:BeMailDaemon,代码行数:52,代码来源:ConfigWindow.cpp

示例6: BTextView

BTextView*
WizardPageView::CreateDescription(BRect frame, const char* name,
	const char* description)
{
	BTextView* view = new BTextView(frame, "text", 
		frame.OffsetToCopy(0, 0),
		B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
		B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS);
	view->MakeEditable(false);
	view->SetViewColor(ViewColor());
	view->SetStylable(true);
	view->SetText(description);
	return view;
}
开发者ID:mariuz,项目名称:haiku,代码行数:14,代码来源:WizardPageView.cpp

示例7: appFile

void
ConfigWindow::_MakeHowToView()
{
	app_info info;
	if (be_app->GetAppInfo(&info) == B_OK) {
		BFile appFile(&info.ref, B_READ_ONLY);
		BAppFileInfo appFileInfo(&appFile);
		if (appFileInfo.InitCheck() == B_OK) {
			BBitmap *bitmap = new (nothrow) BBitmap(BRect(0, 0, 63, 63),
				B_RGBA32);
			if (appFileInfo.GetIcon(bitmap, B_LARGE_ICON) == B_OK) {
				fConfigView->AddChild(new BitmapView(bitmap));
			} else
				delete bitmap;
		}
	}

	BRect rect = fConfigView->Bounds();
	BTextView *text = new BTextView(rect, NULL, rect, B_FOLLOW_NONE,
		B_WILL_DRAW);
	text->SetViewColor(fConfigView->Parent()->ViewColor());
	text->SetAlignment(B_ALIGN_CENTER);
	text->SetText(B_TRANSLATE(
		"\n\nCreate a new account with the Add button.\n\n"
		"Remove an account with the Remove button on the selected item.\n\n"
		"Select an item in the list to change its settings."));
	rect = text->Bounds();
	text->ResizeTo(rect.Width(), text->TextHeight(0, 42));
	text->SetTextRect(rect);

	text->MakeEditable(false);
	text->MakeSelectable(false);

	fConfigView->AddChild(text);

	fConfigView->Layout();
}
开发者ID:mylegacy,项目名称:haiku,代码行数:37,代码来源:ConfigWindow.cpp

示例8: IconLabel

AudioView::AudioView(BRect size)
	:
	BView(size, "AudioView", B_FOLLOW_NONE, B_WILL_DRAW)
{
	BRect r, r2;
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	IconLabel* advLabel = new IconLabel(BRect(0, 0, 19 + be_bold_font->StringWidth(" Audio Options (see help before change options)"), 19), 
							" Audio Options (see help before change options)", "audiocd_16.png");
	advLabel->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	advLabel->SetDrawingMode(B_OP_ALPHA);
	r = Bounds();
	r.InsetBy(5.0, 5.0);
	r.bottom = 80;
	BBox* advOptionsBox = new BBox(r, "fAdvOptionsBox", B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
	advOptionsBox->SetLabel(advLabel);
	AddChild(advOptionsBox);


	r = advOptionsBox->Bounds();
	r.InsetBy(5.0, 5.0);
	r.top += 10;
	r.right = 120;
	r.bottom = 25;
	fPadCheckBox = new BCheckBox(r, "pad", "Padding", new BMessage(AUDIO_PAD));
	if (!strncmp(PAD, "-pad", 4))
		fPadCheckBox->SetValue(B_CONTROL_ON);

	advOptionsBox->AddChild(fPadCheckBox);

	r.bottom += 15;
	r.top += 15;
	r.right = 120;
	fNoFixCheckBox = new BCheckBox(r, "nofix", "No fixate", new BMessage(AUDIO_NOFIX));
	if (!strncmp(NOFIX, "-nofix", 6))
		fNoFixCheckBox->SetValue(B_CONTROL_ON);

	advOptionsBox->AddChild(fNoFixCheckBox);

	r.bottom += 15;
	r.top += 15;
	fPreEmpCheckBox = new BCheckBox(r, "preemp", "Preemp", new BMessage(AUDIO_PREEMP));
	if (!strncmp(PREEMP, "-preemp", 7))
		fPreEmpCheckBox->SetValue(B_CONTROL_ON);

	advOptionsBox->AddChild(fPreEmpCheckBox);

	r = advOptionsBox->Bounds();
	r.InsetBy(5.0, 5.0);
	r.top += 10;
	r.left = 125;
	r.bottom = 25;

	fSwabCheckBox = new BCheckBox(r, "swab", "Swab", new BMessage(AUDIO_SWAB));
	if (!strncmp(SWAB, "-swab", 5))
		fSwabCheckBox->SetValue(B_CONTROL_ON);

	advOptionsBox->AddChild(fSwabCheckBox);


	// Info box
	r = Bounds();
	r.InsetBy(5.0, 5.0);
	r.top = 85;
	BBox* infoBox = new BBox(r, "Info", B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
	infoBox->SetLabel("Audio Info");
	AddChild(infoBox);

	r = infoBox->Bounds();
	r.InsetBy(5.0, 5.0);
	r.top += 10;
	r.right -= B_V_SCROLL_BAR_WIDTH;
	r2 = r;
	r2.InsetBy(2.0, 2.0);
	BTextView* infoTextView = new BTextView(r, "infoTextView", r2, B_FOLLOW_NONE, B_WILL_DRAW);
	infoTextView->MakeEditable(false);
	infoTextView->SetStylable(true);
	BScrollView* infoScrollView = new BScrollView("infoScrollView", infoTextView, B_FOLLOW_NONE, 0, false, true, B_FANCY_BORDER);
	infoBox->AddChild(infoScrollView);
	infoTextView->SetFontAndColor(be_fixed_font, B_FONT_ALL, &darkblue);
	infoTextView->Insert("Here will be some AudioInfo in the future like what codecs there are on the system.");
}
开发者ID:mmadia,项目名称:burnitnow-svn_clone,代码行数:82,代码来源:AudioView.cpp

示例9: gradiants

void
TestPageView::AttachedToWindow()
{
	BTextView* statusView = new BTextView("statusView",
		be_plain_font, NULL, B_WILL_DRAW);

	statusView->SetInsets(10, 10, 10, 10);
	statusView->MakeEditable(false);
	statusView->MakeSelectable(false);

	const char* title = B_TRANSLATE("Test Page");
	BString text;
	text << title << "\n\n";
	text << B_TRANSLATE(
		"Printer: %printer_name%\n"
		"Driver:  %driver%\n");

	text.ReplaceFirst("%printer_name%", fPrinter->Name());
	text.ReplaceFirst("%driver%", fPrinter->Driver());
	if (strlen(fPrinter->Transport()) > 0) {
		text << B_TRANSLATE("Transport: %transport% %transport_address%");

		text.ReplaceFirst("%transport%", fPrinter->Transport());
		text.ReplaceFirst("%transport_address%", fPrinter->TransportAddress());
	}

	statusView->SetText(text.String());
	BFont font;
	statusView->SetStylable(true);
	statusView->GetFont(&font);
	font.SetFace(B_BOLD_FACE);
	font.SetSize(font.Size() * 1.7);
	statusView->SetFontAndColor(0, strlen(title), &font);

	BGridLayoutBuilder gradiants(2.0);
	gradiants.View()->SetViewColor(B_TRANSPARENT_COLOR);

	for (int i = 0; i < kNumColorGradients; ++i) {
		BStringView* label = new BStringView(kColorGradients[i].name,
			kColorGradients[i].name);
		// label->SetAlignment(B_ALIGN_RIGHT);
		gradiants.Add(label, 0, i);
		gradiants.Add(new ColorGradientView(kColorGradients[i].color), 1, i);
	}

	SetLayout(new BGroupLayout(B_HORIZONTAL));
	AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
		.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
			.Add(statusView)
			.Add(new LeafView())
		)
		.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
			.Add(gradiants, 0.60)
			.Add(new RadialLinesView(), 0.40)
		)
		.AddGlue()
		.End()
	);

	// set layout background color to transparent instead
	// of default UI panel color
	ChildAt(0)->SetViewColor(B_TRANSPARENT_COLOR);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:63,代码来源:TestPageView.cpp

示例10: BMessage


//.........这里部分代码省略.........
		"\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
}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:101,代码来源:InstallerApp.cpp

示例11: frame

// StartConfig
void
IFSSaver::StartConfig(BView *view)
{
	BRect bounds = view->Bounds();
	bounds.InsetBy(10.0, 10.0);
	BRect frame(0.0, 0.0, bounds.Width(), 20.0);

	// the additive check box
	fAdditiveCB = new BCheckBox(frame, "additive setting",
								B_TRANSLATE("Render dots additive"),
								new BMessage(MSG_TOGGLE_ADDITIVE),
								B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);

	fAdditiveCB->SetValue(fAdditive);

	fAdditiveCB->ResizeToPreferred();
	bounds.bottom -= fAdditiveCB->Bounds().Height() * 2.0;
	fAdditiveCB->MoveTo(bounds.LeftBottom());

	view->AddChild(fAdditiveCB);

	// the additive check box
	fSpeedS = new BSlider(frame, "speed setting",
						  B_TRANSLATE("Morphing speed:"),
						  new BMessage(MSG_SET_SPEED),
						  1, 12, B_BLOCK_THUMB,
						  B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);

	fSpeedS->SetValue(fSpeed);
	fSpeedS->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fSpeedS->SetHashMarkCount(12);

	fSpeedS->ResizeToPreferred();
	bounds.bottom -= fSpeedS->Bounds().Height() + 15.0;
	fSpeedS->MoveTo(bounds.LeftBottom());

	view->AddChild(fSpeedS);

	// the info text view
	BRect textRect = bounds;
	textRect.OffsetTo(0.0, 0.0);
	BTextView* textView = new BTextView(bounds, B_EMPTY_STRING, textRect,
										B_FOLLOW_ALL, B_WILL_DRAW);
	textView->SetViewColor(view->ViewColor());
	textView->Insert(B_TRANSLATE("Iterated Function System\n\n"
					 ""B_UTF8_COPYRIGHT" 1997 Massimino Pascal\n\n"
					 "xscreensaver port by Stephan Aßmus\n"
					 "<[email protected]>"));


	textView->SetStylable(true);
	textView->SetFontAndColor(0, 24, be_bold_font);
//	textView->SetFontAndColor(25, 255, be_plain_font);

	textView->MakeEditable(false);

	view->AddChild(textView);

	// make sure we receive messages from the views we added
	if (BWindow* window = view->Window())
		window->AddHandler(this);

	fAdditiveCB->SetTarget(this);
	fSpeedS->SetTarget(this);
}
开发者ID:,项目名称:,代码行数:66,代码来源:

示例12: BMessage

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

示例13: createViews

/**
 *	@brief	Creates child views.
 */
void BePreferencesDlg::createViews()
{
    BeDialogControlHelper dch(getDialogLayout());
    NativeStringLoader* nsl = CoveredCalcApp::GetInstance();

    rgb_color viewColor = { 216, 216, 216, 255 };
    rgb_color highColor = { 0, 0, 0, 255 };

    // dialog title
    SetTitle(nsl->LoadNativeString(NSID_PREFERENCES_TITLE));

    // BaseView
    BView* baseView = new BView(Bounds(), PREFERENCES_DIALOG_VIEW_BASE_VIEW,
                                B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
    AddChild(baseView);

    baseView->SetViewColor(viewColor);

    // LangBox
    MBCString itemnameLangBox = ALITERAL("IDC_GROUP_LANGUAGE");
    BBox* langBox = new BBox(dch.GetItemRect(itemnameLangBox, ITEMNAME_WINDOW), PREFERENCES_DIALOG_VIEW_LANG_BOX);
    baseView->AddChild(langBox);

    langBox->SetLabel(nsl->LoadNativeString(NSID_PREFERENCES_GROUP_LANGUAGE));

    // LangPopup
    langMenu = new BMenu("");
    langMenu->SetLabelFromMarked(true);
    BMenuField* langPopup = new BMenuField(dch.GetItemRect(ALITERAL("IDC_CMB_LANGUAGE"), itemnameLangBox), PREFERENCES_DIALOG_VIEW_LANG_POPUP,
                                           nsl->LoadNativeString(NSID_PREFERENCES_LANGUAGE), langMenu);
    langBox->AddChild(langPopup);

    langPopup->SetDivider(dch.GetItemPos(true, ALITERAL("IDC_CMB_LANGUAGE.divider"), ALITERAL("IDC_CMB_LANGUAGE.left")));
    langPopup->SetAlignment(B_ALIGN_LEFT);
    uicLanguageListBox.Init(langPopup, ID_NULL);

    // LangNotice
    BRect frameRect = dch.GetItemRect(ALITERAL("IDC_STATIC_LANGUAGE_MESSAGE"), itemnameLangBox);
    BRect textRect = frameRect;
    textRect.OffsetTo(0, 0);
    BTextView* langNotice = new BTextView(frameRect, PREFERENCES_DIALOG_VIEW_LANG_NOTICE,
                                          textRect, B_FOLLOW_LEFT | B_FOLLOW_TOP);
    langBox->AddChild(langNotice);

    const char* text = nsl->LoadNativeString(NSID_PREFERENCES_LANGUAGE_MESSAGE);
    langNotice->SetText(text);
    langNotice->SetFontAndColor(0, strlen(text), be_plain_font, B_FONT_ALL, &highColor);
    langNotice->SetViewColor(viewColor);
    langNotice->MakeEditable(false);

    // KeyMappingBox
    MBCString itemnameKeyMappingBox = ALITERAL("IDC_GROUP_KEYMAP");
    BBox* keyMappingBox = new BBox(dch.GetItemRect(itemnameKeyMappingBox, ITEMNAME_WINDOW), PREFERENCES_DIALOG_VIEW_KEYMAPPING_BOX);
    baseView->AddChild(keyMappingBox);

    keyMappingBox->SetLabel(nsl->LoadNativeString(NSID_PREFERENCES_GROUP_KEYMAP));

    // KeyMappingPopup
    BMenu* keyMappingMenu = new BMenu("");
    keyMappingMenu->SetLabelFromMarked(true);
    BMenuField* keyMappingPopup = new BMenuField(dch.GetItemRect(ALITERAL("IDC_CMB_KEYMAPPINGS"), itemnameKeyMappingBox), PREFERENCES_DIALOG_VIEW_KEYMAPPING_POPUP,
            nsl->LoadNativeString(NSID_PREFERENCES_KEYMAP), keyMappingMenu);
    keyMappingBox->AddChild(keyMappingPopup);

    keyMappingPopup->SetDivider(dch.GetItemPos(true, ALITERAL("IDC_CMB_KEYMAPPINGS.divider"), ALITERAL("IDC_CMB_KEYMAPPINGS.left")));
    keyMappingPopup->SetAlignment(B_ALIGN_LEFT);
    uicKeyMapListBox.Init(keyMappingPopup, ID_PREF_KEYMAP_SELECTED);

    // EditKeyMappingButton
    BButton* editKeymapButton = new BButton(dch.GetItemRect(ALITERAL("IDC_EDIT_KEYMAPPING"), itemnameKeyMappingBox), PREFERENCES_DIALOG_VIEW_EDIT_KEYMAPPING_BUTTON,
                                            nsl->LoadNativeString(NSID_PREFERENCES_EDIT_KEYMAP), new BMessage(ID_PREF_EDIT_KEYMAP));
    keyMappingBox->AddChild(editKeymapButton);
    uicEditKeyMapButton.Init(editKeymapButton);

    // DuplicateKeyMappingButton
    BButton* dupKeymapButton = new BButton(dch.GetItemRect(ALITERAL("IDC_DUPLICATE_KEYMAPPING"), itemnameKeyMappingBox), PREFERENCES_DIALOG_VIEW_DUPLICATE_KEYMAPPING_BUTTON,
                                           nsl->LoadNativeString(NSID_PREFERENCES_DUPLICATE_KEYMAP), new BMessage(ID_PREF_DUPLICATE_KEYMAP));
    keyMappingBox->AddChild(dupKeymapButton);
    uicDuplicateKeyMapButton.Init(dupKeymapButton);

    // DeleteKeyMappingButton
    BButton* delKeymapButton = new BButton(dch.GetItemRect(ALITERAL("IDC_DELETE_KEYMAPPING"), itemnameKeyMappingBox), PREFERENCES_DIALOG_VIEW_DELETE_KEYMAPPING_BUTTON,
                                           nsl->LoadNativeString(NSID_PREFERENCES_DELETE_KEYMAP), new BMessage(ID_PREF_DELETE_KEYMAP));
    keyMappingBox->AddChild(delKeymapButton);
    uicDeleteKeyMapButton.Init(delKeymapButton);

    // CancelButton
    BButton* cancelButton = new BButton(dch.GetItemRect(ALITERAL("IDCANCEL"), ITEMNAME_WINDOW), PREFERENCES_DIALOG_VIEW_CANCEL,
                                        nsl->LoadNativeString(NSID_PREFERENCES_CANCEL), new BMessage(ID_DIALOG_CANCEL));
    baseView->AddChild(cancelButton);

    // OKButton
    BButton* okButton = new BButton(dch.GetItemRect(ALITERAL("IDOK"), ITEMNAME_WINDOW), PREFERENCES_DIALOG_VIEW_OK,
                                    nsl->LoadNativeString(NSID_PREFERENCES_OK), new BMessage(ID_DIALOG_OK));
    baseView->AddChild(okButton);

    SetDefaultButton(okButton);
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:CoveredCalc,代码行数:101,代码来源:BePreferencesDlg.cpp

示例14: appFile

void
ConfigWindow::MakeHowToView()
{
#ifndef HAIKU_TARGET_PLATFORM_HAIKU
    BResources *resources = BApplication::AppResources();
    if (resources) {
        size_t length;
        char *buffer = (char *)resources->FindResource(B_LARGE_ICON_TYPE, 101,
                       &length);
        if (buffer) {
            BBitmap *bitmap = new (nothrow) BBitmap(BRect(0, 0, 63, 63),
                                                    B_CMAP8);
            if (bitmap && bitmap->InitCheck() == B_OK) {
                // copy and enlarge a 32x32 8-bit bitmap
                char *bits = (char *)bitmap->Bits();
                for (int32 i = 0, j = -64; i < (int32)length; i++) {
                    if ((i % 32) == 0)
                        j += 64;

                    char *b = bits + (i << 1) + j;
                    b[0] = b[1] = b[64] = b[65] = buffer[i];
                }
                fConfigView->AddChild(new BitmapView(bitmap));
            } else
                delete bitmap;
        }
    }
#else
    app_info info;
    if (be_app->GetAppInfo(&info) == B_OK) {
        BFile appFile(&info.ref, B_READ_ONLY);
        BAppFileInfo appFileInfo(&appFile);
        if (appFileInfo.InitCheck() == B_OK) {
            BBitmap *bitmap = new (nothrow) BBitmap(BRect(0, 0, 63, 63),
                                                    B_RGBA32);
            if (appFileInfo.GetIcon(bitmap, B_LARGE_ICON) == B_OK) {
                fConfigView->AddChild(new BitmapView(bitmap));
            } else
                delete bitmap;
        }
    }
#endif // HAIKU_TARGET_PLATFORM_HAIKU

    BRect rect = fConfigView->Bounds();
    BTextView *text = new BTextView(rect, NULL, rect, B_FOLLOW_NONE,
                                    B_WILL_DRAW);
    text->SetViewColor(fConfigView->Parent()->ViewColor());
    text->SetAlignment(B_ALIGN_CENTER);
    text->SetText(B_TRANSLATE(
                      "\n\nCreate a new account with the Add button.\n\n"
                      "Remove an account with the Remove button on the selected item.\n\n"
                      "Select an item in the list to change its settings."));
    rect = text->Bounds();
    text->ResizeTo(rect.Width(), text->TextHeight(0, 42));
    text->SetTextRect(rect);

    text->MakeEditable(false);
    text->MakeSelectable(false);

    fConfigView->AddChild(text);

    static_cast<CenterContainer *>(fConfigView)->Layout();
}
开发者ID:mmadia,项目名称:haiku-1,代码行数:63,代码来源:ConfigWindow.cpp

示例15: font

void
PackageView::_InitView()
{
	SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

	float fontHeight = be_plain_font->Size();
	rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);

	BTextView* packageDescriptionView = new DescriptionTextView(
		"package description", fontHeight * 13);
	packageDescriptionView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
	packageDescriptionView->SetText(fInfo.GetDescription());
	packageDescriptionView->MakeEditable(false);
	packageDescriptionView->MakeSelectable(false);
	packageDescriptionView->SetFontAndColor(be_plain_font, B_FONT_ALL,
		&textColor);

	BScrollView* descriptionScrollView = new BScrollView(
		"package description scroll view", packageDescriptionView,
		0, false, true, B_NO_BORDER);

	// Install type menu field
	fInstallTypes = new BPopUpMenu(B_TRANSLATE("none"));
	BMenuField* installType = new BMenuField("install_type",
		B_TRANSLATE("Installation type:"), fInstallTypes);

	// Install type description text view
	fInstallTypeDescriptionView = new DescriptionTextView(
		"install type description", fontHeight * 4);
	fInstallTypeDescriptionView->MakeEditable(false);
	fInstallTypeDescriptionView->MakeSelectable(false);
	fInstallTypeDescriptionView->SetInsets(8, 0, 0, 0);
		// Left inset needs to match BMenuField text offset
	fInstallTypeDescriptionView->SetText(
		B_TRANSLATE("No installation type selected"));
	fInstallTypeDescriptionView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
	BFont font(be_plain_font);
	font.SetSize(ceilf(font.Size() * 0.85));
	fInstallTypeDescriptionView->SetFontAndColor(&font, B_FONT_ALL,
		&textColor);

	BScrollView* installTypeScrollView = new BScrollView(
		"install type description scroll view", fInstallTypeDescriptionView,
		 0, false, true, B_NO_BORDER);

	// Destination menu field
	fDestination = new BPopUpMenu(B_TRANSLATE("none"));
	fDestField = new BMenuField("install_to", B_TRANSLATE("Install to:"),
		fDestination);

	fBeginButton = new BButton("begin_button", B_TRANSLATE("Begin"),
		new BMessage(P_MSG_INSTALL));

	BLayoutItem* typeLabelItem = installType->CreateLabelLayoutItem();
	BLayoutItem* typeMenuItem = installType->CreateMenuBarLayoutItem();

	BLayoutItem* destFieldLabelItem = fDestField->CreateLabelLayoutItem();
	BLayoutItem* destFieldMenuItem = fDestField->CreateMenuBarLayoutItem();

	float forcedMinWidth = be_plain_font->StringWidth("XXX") * 5;
	destFieldMenuItem->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET));
	typeMenuItem->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET));

	BAlignment labelAlignment(B_ALIGN_RIGHT, B_ALIGN_VERTICAL_UNSET);
	typeLabelItem->SetExplicitAlignment(labelAlignment);
	destFieldLabelItem->SetExplicitAlignment(labelAlignment);

	// Build the layout
	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.Add(descriptionScrollView)
		.AddGrid(B_USE_SMALL_SPACING, B_USE_DEFAULT_SPACING)
			.Add(typeLabelItem, 0, 0)
			.Add(typeMenuItem, 1, 0)
			.Add(installTypeScrollView, 1, 1)
			.Add(destFieldLabelItem, 0, 2)
			.Add(destFieldMenuItem, 1, 2)
		.End()
		.AddGroup(B_HORIZONTAL)
			.AddGlue()
			.Add(fBeginButton)
		.End()
		.SetInsets(B_USE_DEFAULT_SPACING)
	;

	fBeginButton->MakeDefault(true);
}
开发者ID:looncraz,项目名称:haiku,代码行数:86,代码来源:PackageView.cpp


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