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


C++ BAlert::TextView方法代码示例

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


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

示例1: ShowAboutWindow

void ShowAboutWindow(void)
{
	char str[512];
	sprintf(str,
		"Basilisk II\nVersion %d.%d\n\n"
		"Copyright " B_UTF8_COPYRIGHT " 1997-2008 Christian Bauer et al.\n"
		"E-mail: [email protected]\n"
		"http://www.uni-mainz.de/~bauec002/B2Main.html\n\n"
		"Basilisk II comes with ABSOLUTELY NO\n"
		"WARRANTY. This is free software, and\n"
		"you are welcome to redistribute it\n"
		"under the terms of the GNU General\n"
		"Public License.\n",
		VERSION_MAJOR, VERSION_MINOR
	);
	BAlert *about = new BAlert("", str, GetString(STR_OK_BUTTON), NULL, NULL, B_WIDTH_FROM_LABEL);
	BTextView *theText = about->TextView();
	if (theText) {
		theText->SetStylable(true);
		theText->Select(0, 11);
		BFont ourFont;
		theText->SetFontAndColor(be_bold_font);
		theText->GetFontAndColor(2, &ourFont, NULL);
		ourFont.SetSize(24);
		theText->SetFontAndColor(&ourFont);
	}
	about->Go();
}
开发者ID:DavidLudwig,项目名称:macemu,代码行数:28,代码来源:about_window.cpp

示例2: name

void
SyslogDaemon::AboutRequested()
{
	BPath path;
	find_directory(B_SYSTEM_LOG_DIRECTORY, &path);
	path.Append("syslog");

	BString name(B_TRANSLATE("Syslog Daemon"));
	BString message;
	snprintf(message.LockBuffer(512), 512,
		B_TRANSLATE("%s\n\nThis daemon is responsible for collecting "
			"all system messages and write them to the system-wide log "
			"at \"%s\".\n\n"), name.String(), path.Path());
	message.UnlockBuffer();

	BAlert *alert = new BAlert(name.String(), message.String(), B_TRANSLATE("OK"));
	BTextView *view = alert->TextView();
	BFont font;

	view->SetStylable(true);

	view->GetFont(&font);
	font.SetSize(21);
	font.SetFace(B_BOLD_FACE); 			
	view->SetFontAndColor(0, name.Length(), &font);

	alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
	alert->Go(NULL);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:29,代码来源:SyslogDaemon.cpp

示例3: BAlert

void
PulseApp::ShowAbout(bool asApplication)
{
	// static version to be used in replicant mode
	BString name;
	if (asApplication)
		name = B_TRANSLATE_SYSTEM_NAME("Pulse");
	else
		name = B_TRANSLATE("Pulse");

	BString message = B_TRANSLATE(
		"%s\n\nBy David Ramsey and Arve Hjønnevåg\n"
		"Revised by Daniel Switkin\n");
	message.ReplaceFirst("%s", name);
	BAlert *alert = new BAlert(B_TRANSLATE("Info"),
		message.String(), B_TRANSLATE("OK"));

	BTextView* view = alert->TextView();
	BFont font;
				
	view->SetStylable(true);			
	view->GetFont(&font);
	
	font.SetSize(18);
	font.SetFace(B_BOLD_FACE);
	view->SetFontAndColor(0, name.Length(), &font);
	alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
	// Use the asynchronous version so we don't block the window's thread
	alert->Go(NULL);
}
开发者ID:MaddTheSane,项目名称:haiku,代码行数:30,代码来源:PulseApp.cpp

示例4: BAlert

void
WorkspacesView::_AboutRequested()
{
	BString text = B_TRANSLATE("Workspaces\n"
		"written by %1, and %2.\n\n"
		"Copyright %3, Haiku.\n\n"
		"Send windows behind using the Option key. "
		"Move windows to front using the Control key.\n");
	text.ReplaceFirst("%1", "François Revol, Axel Dörfler");
	text.ReplaceFirst("%2", "Matt Madia");
	text.ReplaceFirst("%3", "2002-2008");
		
	BAlert *alert = new BAlert("about", text.String(), B_TRANSLATE("OK"));
	BTextView *view = alert->TextView();
	BFont font;

	view->SetStylable(true);

	view->GetFont(&font);
	font.SetSize(18);
	font.SetFace(B_BOLD_FACE);
	view->SetFontAndColor(0, 10, &font);

	alert->Go();
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例5: AboutText

void
HWindow::AboutRequested()
{
	const char* aboutText = AboutText();
	if (aboutText == NULL)
		return;

	BAlert *about = new BAlert("About", aboutText, "Cool");
	BTextView *v = about->TextView();
	if (v) {
		rgb_color red = {255, 0, 51, 255};
		rgb_color blue = {0, 102, 255, 255};

		v->SetStylable(true);
		char *text = (char*)v->Text();
		char *s = text;
		// set all Be in blue and red
		while ((s = strstr(s, "Be")) != NULL) {
			int32 i = s - text;
			v->SetFontAndColor(i, i+1, NULL, 0, &blue);
			v->SetFontAndColor(i+1, i+2, NULL, 0, &red);
			s += 2;
		}
		// first text line 
		s = strchr(text, '\n');
		BFont font;
		v->GetFontAndColor(0, &font);
		font.SetSize(12); // font.SetFace(B_OUTLINED_FACE);
		v->SetFontAndColor(0, s-text+1, &font, B_FONT_SIZE);
	};
	about->SetFlags(about->Flags() | B_CLOSE_ON_ESCAPE);
	about->Go();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:33,代码来源:BlockingWindow.cpp

示例6: BAlert

void
DataTranslationsWindow::_ShowInfoAlert(int32 id)
{
	const char* name = NULL;
	const char* info = NULL;
	BPath path;
	int32 version = 0;
	_GetTranslatorInfo(id, name, info, version, path);

	const char* labels[] = { B_TRANSLATE("Name:"), B_TRANSLATE("Version:"),
		B_TRANSLATE("Info:"), B_TRANSLATE("Path:"), NULL };
	int offsets[4];

	BString message;
	BString temp;

	offsets[0] = 0;
	temp.SetToFormat("%s %s\n", labels[0], name);

	message.Append(temp);

	offsets[1] = message.Length();
	// Convert the version number into a readable format
	temp.SetToFormat("%s %" B_PRId32 ".%" B_PRId32 ".%" B_PRId32 "\n\n", labels[1],
		B_TRANSLATION_MAJOR_VERSION(version),
		B_TRANSLATION_MINOR_VERSION(version),
		B_TRANSLATION_REVISION_VERSION(version));

	message.Append(temp);

	offsets[2] = message.Length();
	temp.SetToFormat("%s\n%s\n\n", labels[2], info);

	message.Append(temp);

	offsets[3] = message.Length();
	temp.SetToFormat("%s %s\n", labels[3], path.Path());

	message.Append(temp);

	BAlert* alert = new BAlert(B_TRANSLATE("Info"), message.String(),
		B_TRANSLATE("OK"));
	BTextView* view = alert->TextView();
	BFont font;

	view->SetStylable(true);

	view->GetFont(&font);
	font.SetFace(B_BOLD_FACE);

	for (int32 i = 0; labels[i]; i++) {
		view->SetFontAndColor(offsets[i], offsets[i] + strlen(labels[i]), &font);
	}

	alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
	alert->Go();
}
开发者ID:looncraz,项目名称:haiku,代码行数:57,代码来源:DataTranslationsWindow.cpp

示例7: BAlert

void
AboutWindow::Show()
{
    BAlert* alert = new BAlert("About" B_UTF8_ELLIPSIS, fText->String(), "Close");
    BTextView* view = alert->TextView();
    BFont font;
    view->SetStylable(true);
    view->GetFont(&font);
    font.SetFace(B_BOLD_FACE);
    font.SetSize(font.Size() * 1.7f);
    view->SetFontAndColor(0, fAppName->Length(), &font);
    alert->Go();
}
开发者ID:ModeenF,项目名称:Caya,代码行数:13,代码来源:AboutWindow.cpp

示例8: BAlert

void
NetServer::AboutRequested()
{
	BAlert *alert = new BAlert("about", "Networking Server\n"
		"\tCopyright " B_UTF8_COPYRIGHT "2006, Antares.\n", "OK");
	BTextView *view = alert->TextView();
	BFont font;

	view->SetStylable(true);

	view->GetFont(&font);
	font.SetSize(18);
	font.SetFace(B_BOLD_FACE);
	view->SetFontAndColor(0, 17, &font);

	alert->Go(NULL);
}
开发者ID:mmanley,项目名称:Antares,代码行数:17,代码来源:NetServer.cpp

示例9: AboutRequested

void BepdfApplication::AboutRequested()
{
	BString version;
	BString str("BePDF\n");
	str += B_TRANSLATE("Version");
	str += " ";
	str += GetVersion(version);
	str += "\n";

	str += bePDFCopyright;

	str += "\n";
	str += B_TRANSLATE_COMMENT("Language 'English', translated by the BePDF authors.",
		"Replace 'English' with the language you're translating to, and 'the BePDF authors' with your name or your translation group's name.");
	str += "\n\n";

	str += BString().SetToFormat(B_TRANSLATE_COMMENT("BePDF is based on XPDF %s, %s.", "XPDF version, copyright"),
		xpdfVersion, xpdfCopyright);

	str += GPLCopyright;

	BAlert *about = new BAlert("About", str.String(), "OK");
	BTextView *v = about->TextView();
	if (v) {
		rgb_color red = {255, 0, 51, 255};
		rgb_color blue = {0, 102, 255, 255};

		v->SetStylable(true);
		char *text = (char*)v->Text();
		char *s = text;
		// set all Be in BePDF in blue and red
		while ((s = strstr(s, "BePDF")) != NULL) {
			int32 i = s - text;
			v->SetFontAndColor(i, i+1, NULL, 0, &blue);
			v->SetFontAndColor(i+1, i+2, NULL, 0, &red);
			s += 2;
		}
		// first text line
		s = strchr(text, '\n');
		BFont font;
		v->GetFontAndColor(0, &font);
		font.SetSize(16);
		v->SetFontAndColor(0, s-text+1, &font, B_FONT_SIZE);
	};
	about->Go();
}
开发者ID:HaikuArchives,项目名称:BePDF,代码行数:46,代码来源:BepdfApplication.cpp

示例10: BAlert

void
FontsApp::AboutRequested()
{
	BAlert *alert = new BAlert("about", B_TRANSLATE("Fonts\n"
		"\tCopyright 2004-2005, Haiku.\n\n"), B_TRANSLATE("OK"));
	BTextView *view = alert->TextView();
	BFont font;

	view->SetStylable(true);

	view->GetFont(&font);
	font.SetSize(18);
	font.SetFace(B_BOLD_FACE);
	view->SetFontAndColor(0, 5, &font);

	alert->Go();
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:17,代码来源:main.cpp

示例11: BAlert

void
InstallerApp::AboutRequested()
{
	BAlert *alert = new BAlert("about", B_TRANSLATE("Installer\n"
		"\twritten by Jérôme Duval and Stephan Aßmus\n"
		"\tCopyright 2005-2010, Haiku.\n\n"), B_TRANSLATE("OK"));
	BTextView *view = alert->TextView();
	BFont font;

	view->SetStylable(true);

	view->GetFont(&font);
	font.SetSize(18);
	font.SetFace(B_BOLD_FACE);
	view->SetFontAndColor(0, 9, &font);

	alert->Go();
}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:18,代码来源:InstallerApp.cpp

示例12: BAlert

void
CharacterMap::AboutRequested()
{
	BAlert *alert = new BAlert("about", "CharacterMap\n"
		"\twritten by Axel Dörfler\n"
		"\tCopyright 2009, Antares, Inc.\n", "OK");
	BTextView *view = alert->TextView();
	BFont font;

	view->SetStylable(true);

	view->GetFont(&font);
	font.SetSize(18);
	font.SetFace(B_BOLD_FACE);
	view->SetFontAndColor(0, 12, &font);

	alert->Go();
}
开发者ID:mmanley,项目名称:Antares,代码行数:18,代码来源:CharacterMap.cpp

示例13: BAlert

/*static*/ void
Debugger::ShowAbout()
{
    BAlert *alert = new BAlert("about", "Debugger\n"
        "\twritten by Philippe Houdoin\n"
        "\tCopyright 2009, Haiku, Inc.\n", "OK");
    BTextView *view = alert->TextView();
    BFont font;

    view->SetStylable(true);

    view->GetFont(&font);
    font.SetSize(18);
    font.SetFace(B_BOLD_FACE);
    view->SetFontAndColor(0, 15, &font);

    alert->Go();
}
开发者ID:mariuz,项目名称:haiku,代码行数:18,代码来源:hdb.cpp

示例14: BAlert

void
DataTranslationsApplication::AboutRequested()
{
	BAlert* alert = new BAlert("about", "DataTranslations\n\twritten by Oliver "
		"Siebenmarck and others\n\tCopyright 2002-2010, Haiku Inc. All rights "
		"reserved.\n", "OK");

	BTextView* view = alert->TextView();
	view->SetStylable(true);

	BFont font;
	view->GetFont(&font);
	font.SetSize(18);
	font.SetFace(B_BOLD_FACE);
	view->SetFontAndColor(0, 16, &font);

	alert->Go();
}
开发者ID:mariuz,项目名称:haiku,代码行数:18,代码来源:DataTranslations.cpp

示例15: BAlert

void
VirtualMemory::AboutRequested()
{
	BAlert* alert = new BAlert("about", TR("VirtualMemory\n"
		"\twritten by Axel Dörfler\n"
		"\tCopyright 2005, Antares.\n"), TR("OK"));
	BTextView* view = alert->TextView();
	BFont font;

	view->SetStylable(true);

	view->GetFont(&font);
	font.SetSize(18);
	font.SetFace(B_BOLD_FACE); 			
	view->SetFontAndColor(0, 13, &font);

	alert->Go();
}
开发者ID:mmanley,项目名称:Antares,代码行数:18,代码来源:VirtualMemory.cpp


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