Ejemplo n.º 1
0
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();
}
Ejemplo n.º 2
0
Archivo: hdb.cpp Proyecto: mariuz/haiku
/*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();
}
Ejemplo n.º 3
0
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();
}
Ejemplo n.º 4
0
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();
}
Ejemplo n.º 5
0
void ArpTextControl::copy_font(BView* v)
{
	// Make no assumptions about the structure of the children.
	if( !v ) return;
	int32 num = v->CountChildren();
	for( int32 i=0; i<num; i++ ) {
		BView* child = v->ChildAt(i);
		if( child ) {
			copy_font(child);
			BTextView* text = dynamic_cast<BTextView*>(child);
			if( text ) {
				text->SetFontAndColor(&PV_FillFont);
			} else {
				child->SetFont(&PV_FillFont);
			}
		}
	}
}
Ejemplo n.º 6
0
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();
}
Ejemplo n.º 7
0
void
THeaderView::MessageReceived(BMessage *msg)
{
	switch (msg->what) {
		case B_SIMPLE_DATA:
		{
			BTextView *textView = dynamic_cast<BTextView *>(Window()->CurrentFocus());
			if (dynamic_cast<TTextControl *>(textView->Parent()) != NULL)
				textView->Parent()->MessageReceived(msg);
			else {
				BMessage message(*msg);
				message.what = REFS_RECEIVED;
				Window()->PostMessage(&message, Window());
			}
			break;
		}

		case kMsgFrom:
		{
			BMenuItem *item;
			if (msg->FindPointer("source", (void **)&item) >= B_OK)
				item->SetMarked(true);

			uint32 chain;
			if (msg->FindInt32("id",(int32 *)&chain) >= B_OK)
				fChain = chain;
			break;
		}

		case kMsgEncoding:
		{
			BMessage message(*msg);
			int32 charSet;

			if (msg->FindInt32("charset", &charSet) == B_OK)
				fCharacterSetUserSees = charSet;

			message.what = CHARSET_CHOICE_MADE;
			message.AddInt32 ("charset", fCharacterSetUserSees);
			Window()->PostMessage (&message, Window());
			break;
		}
	}
}
Ejemplo n.º 8
0
static filter_result
TextViewFilter(BMessage *message, BHandler **, BMessageFilter *filter)
{
	uchar key;
	if (message->FindInt8("byte", (int8 *)&key) != B_OK)
		return B_DISPATCH_MESSAGE;

	BPoseView *poseView = dynamic_cast<BContainerWindow*>(filter->Looper())->
		PoseView();

	if (key == B_RETURN || key == B_ESCAPE) {
		poseView->CommitActivePose(key == B_RETURN);
		return B_SKIP_MESSAGE;
	}

	if (key == B_TAB) {
		if (poseView->ActivePose()) {
			if (message->FindInt32("modifiers") & B_SHIFT_KEY)
				poseView->ActivePose()->EditPreviousWidget(poseView);
			else
				poseView->ActivePose()->EditNextWidget(poseView);
		}

		return B_SKIP_MESSAGE;
	}

	// the BTextView doesn't respect window borders when resizing itself;
	// we try to work-around this "bug" here.

	// find the text editing view
	BView *scrollView = poseView->FindView("BorderView");
	if (scrollView != NULL) {
		BTextView *textView = dynamic_cast<BTextView *>(scrollView->FindView("WidgetTextView"));
		if (textView != NULL) {
			BRect rect = scrollView->Frame();

			if (rect.right + 3 > poseView->Bounds().right
				|| rect.left - 3 < 0)
				textView->MakeResizable(true, NULL);
		}
	}

	return B_DISPATCH_MESSAGE;
}
Ejemplo n.º 9
0
void
PowerStatusReplicant::_AboutRequested()
{
	BAlert* alert = new BAlert(B_TRANSLATE("About"),
		B_TRANSLATE("PowerStatus\n"
			"written by Axel Dörfler, Clemens Zeidler\n"
			"Copyright 2006, Haiku, Inc.\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, strlen(B_TRANSLATE("PowerStatus")), &font);

	alert->Go();
}
Ejemplo n.º 10
0
void
StatusView::_AboutRequested()
{
	BAlert *alert = new BAlert("about", B_TRANSLATE("CPUFrequency\n"
			"\twritten by Clemens Zeidler\n"
			"\tCopyright 2009, Haiku, Inc.\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, 13, &font);

	alert->Go();
}
Ejemplo n.º 11
0
void ArpTextControl::copy_colors(BView* v)
{
	// Make no assumptions about the structure of the children.
	if( !v ) return;
	int32 num = v->CountChildren();
	for( int32 i=0; i<num; i++ ) {
		BView* child = v->ChildAt(i);
		if( child ) {
			copy_colors(child);
			BTextView* text = dynamic_cast<BTextView*>(child);
			if( text ) {
				text->SetFontAndColor(NULL, B_FONT_ALL, &PV_FillForeColor);
			}
			child->SetViewColor(PV_FillBackColor);
			child->SetLowColor(PV_FillBackColor);
			child->SetHighColor(PV_FillForeColor);
			child->Invalidate();
		}
	}
}
Ejemplo n.º 12
0
void
OverlayView::OverlayAboutRequested()
{
	BAlert *alert = new BAlert("about",
		"OverlayImage\n"
		"Copyright 1999-2010\n\n\t"
		"originally by Seth Flaxman\n\t"
		"modified by Hartmuth Reh\n\t"
		"further modified by Humdinger\n",
		"OK");	
	BTextView *view = alert->TextView();
	BFont font;
	view->SetStylable(true);
	view->GetFont(&font);
	font.SetSize(font.Size() + 7.0f);
	font.SetFace(B_BOLD_FACE);
	view->SetFontAndColor(0, 12, &font);
	alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);	
	alert->Go();
}
Ejemplo n.º 13
0
void
WorkspacesView::_AboutRequested()
{
	BAlert *alert = new BAlert("about", "Workspaces\n"
		"written by François Revol, Axel Dörfler, and Matt Madia.\n\n"
		"Copyright 2002-2008, Antares.\n\n"
		"Send windows behind using the Option key. "
		"Move windows to front using the Control key.\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, 10, &font);

	alert->Go();
}
Ejemplo n.º 14
0
void
FileTypes::AboutRequested()
{
	BString aboutText(B_TRANSLATE("FileTypes"));
	int32 titleLength = aboutText.Length();
	aboutText << "\n";
	aboutText << B_TRANSLATE("\twritten by Axel Dörfler\n"
		"\tCopyright 2006-2007, Haiku.\n");
	BAlert *alert = new BAlert("about", aboutText.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, titleLength, &font);

	alert->Go();
}
Ejemplo n.º 15
0
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();
}
Ejemplo n.º 16
0
int32_t
PTextViewLineAtOffset(void *pobject, void *in, void *out, void *extraData)
{
	if (!pobject || !in || !out)
		return B_ERROR;

	PView *parent = static_cast<PView*>(pobject);
	if (!parent)
		return B_BAD_TYPE;
	
	BTextView *backend = (BTextView*)parent->GetView();


	PArgs *inArgs = static_cast<PArgs*>(in);

	PArgs *outArgs = static_cast<PArgs*>(out);

	int32 offset;
	if (inArgs->FindInt32("offset", &offset) != B_OK)
		return B_ERROR;

	if (backend->Window())
		backend->Window()->Lock();

	int32 outValue1;

	outValue1 = backend->LineAt(offset);

	if (backend->Window())
		backend->Window()->Unlock();

	outArgs->MakeEmpty();

	return B_OK;
}
Ejemplo n.º 17
0
int32_t
PTextViewCut(void *pobject, void *in, void *out, void *extraData)
{
	if (!pobject || !in || !out)
		return B_ERROR;
	
	PView *parent = static_cast<PView*>(pobject);
	if (!parent)
		return B_BAD_TYPE;
	
	BTextView *backend = (BTextView*)parent->GetView();
	
	PArgs *inArgs = static_cast<PArgs*>(in);
	
	uint64 id = 0;
	if (inArgs->FindInt64("clipid", (int64*)&id) != B_OK)
		return B_ERROR;
	
	PObject *obj = BROKER->FindObject(id);
	if (!obj || obj->GetType().ICompare("PClipboard") != 0)
		return B_BAD_DATA;
	
	PClipboard *clip = dynamic_cast<PClipboard*>(obj);
	
	if (backend->Window())
		backend->Window()->Lock();
	
	backend->Cut(clip->GetBackend());
	
	if (backend->Window())
		backend->Window()->Unlock();
	
	return B_OK;
}
Ejemplo n.º 18
0
int32_t
PTextViewHighlight(void *pobject, void *in, void *out, void *extraData)
{
	if (!pobject || !in || !out)
		return B_ERROR;

	PView *parent = static_cast<PView*>(pobject);
	if (!parent)
		return B_BAD_TYPE;
	
	BTextView *backend = (BTextView*)parent->GetView();


	PArgs *inArgs = static_cast<PArgs*>(in);

	int32 start;
	if (inArgs->FindInt32("start", &start) != B_OK)
		return B_ERROR;

	int32 end;
	if (inArgs->FindInt32("end", &end) != B_OK)
		return B_ERROR;

	if (backend->Window())
		backend->Window()->Lock();


	backend->Highlight(start, end);

	if (backend->Window())
		backend->Window()->Unlock();

	return B_OK;
}
Ejemplo n.º 19
0
int32_t
PTextViewGetSelection(void *pobject, void *in, void *out, void *extraData)
{
	if (!pobject || !in || !out)
		return B_ERROR;

	PView *parent = static_cast<PView*>(pobject);
	if (!parent)
		return B_BAD_TYPE;
	
	BTextView *backend = (BTextView*)parent->GetView();


	PArgs *outArgs = static_cast<PArgs*>(out);

	if (backend->Window())
		backend->Window()->Lock();

	int32 outValue1;
	int32 outValue2;

	backend->GetSelection(&outValue1, &outValue2);

	if (backend->Window())
		backend->Window()->Unlock();

	outArgs->MakeEmpty();
	outArgs->AddInt32("start", outValue1);
	outArgs->AddInt32("end", outValue2);

	return B_OK;
}
Ejemplo n.º 20
0
int32_t
PTextViewDisallowChars(void *pobject, void *in, void *out, void *extraData)
{
	if (!pobject || !in || !out)
		return B_ERROR;
	
	PView *parent = static_cast<PView*>(pobject);
	if (!parent)
		return B_BAD_TYPE;
	
	BTextView *backend = (BTextView*)parent->GetView();
	
	PArgs *inArgs = static_cast<PArgs*>(in);
	BString string;
	if (inArgs->FindString("chars", &string) != B_OK)
		return B_ERROR;
	
	if (backend->Window())
		backend->Window()->Lock();
	
	for (int32 i = 0; i < string.CountChars(); i++)
	{
		char c = string.ByteAt(i);
		if (c)
			backend->DisallowChar(c);
	}
	
	if (backend->Window())
		backend->Window()->Unlock();
	
	return B_OK;
}
Ejemplo n.º 21
0
int32_t
PTextViewInsert(void *pobject, void *in, void *out, void *extraData)
{
	if (!pobject || !in || !out)
		return B_ERROR;

	PView *parent = static_cast<PView*>(pobject);
	if (!parent)
		return B_BAD_TYPE;
	
	BTextView *backend = (BTextView*)parent->GetView();


	PArgs *inArgs = static_cast<PArgs*>(in);

	BString text;
	if (inArgs->FindString("text", &text) != B_OK)
		return B_ERROR;

	int32 length;
	if (inArgs->FindInt32("length", &length) != B_OK)
		return B_ERROR;

	if (backend->Window())
		backend->Window()->Lock();


	backend->Insert(text.String(), length);

	if (backend->Window())
		backend->Window()->Unlock();

	return B_OK;
}
Ejemplo n.º 22
0
void
PersonView::MessageReceived(BMessage* msg)
{
	switch (msg->what) {
		case M_SAVE:
			Save();
			break;

		case M_REVERT:
			if (fPictureView)
				fPictureView->Revert();

			if (fAddrView)
				fAddrView->Reload();

			for (int32 i = fControls.CountItems() - 1; i >= 0; i--)
				fControls.ItemAt(i)->Reload();
			break;

		case M_SELECT:
			for (int32 i = fControls.CountItems() - 1; i >= 0; i--) {
				BTextView* text = fControls.ItemAt(i)->TextView();
				if (text->IsFocus()) {
					text->Select(0, text->TextLength());
					break;
				}
			}
			break;

		case M_GROUP_MENU:
		{
			/*const char* name = NULL;
			if (msg->FindString("group", &name) == B_OK)
				SetAttribute(fCategoryAttribute, name, false);*/
			break;
		}

	}
}
Ejemplo n.º 23
0
void
DevicesApplication::ShowAbout()
{
	BAlert* alert = new BAlert("about", "Devices\n"
		"\twritten by Pieter Panman\n"
		"\n"
		"\tBased on listdev by Jérôme Duval\n"
		"\tand the previous Devices preference\n"
		"\tby Jérôme Duval and Sikosis\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, 7, &font);

	alert->Go();
}
Ejemplo n.º 24
0
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);
}
Ejemplo n.º 25
0
void
DataTranslationsWindow::_ShowInfoAlert(int32 id)
{
	const char* name = NULL;
	const char* info = NULL;
	BPath path;
	int32 version = 0;
	_GetTranslatorInfo(id, name, info, version, path);

	BString message;
	// Convert the version number into a readable format
	snprintf(message.LockBuffer(2048), 2048,
		B_TRANSLATE("Name: %s \nVersion: %ld.%ld.%ld\n\n"
			"Info:\n%s\n\nPath:\n%s\n"),
		name, B_TRANSLATION_MAJOR_VERSION(version),
		B_TRANSLATION_MINOR_VERSION(version),
		B_TRANSLATION_REVISION_VERSION(version), info, path.Path());
	message.UnlockBuffer();

	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);

	const char* labels[] = { B_TRANSLATE("Name:"), B_TRANSLATE("Version:"),
		B_TRANSLATE("Info:"), B_TRANSLATE("Path:"), NULL };
	for (int32 i = 0; labels[i]; i++) {
		int32 index = message.FindFirst(labels[i]);
		view->SetFontAndColor(index, index + strlen(labels[i]), &font);
	}

	alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
	alert->Go();
}
Ejemplo n.º 26
0
void
ExpanderApp::AboutRequested()
{
	BString appName = B_TRANSLATE("Expander");
	int nameLength = appName.CountChars();
	BAlert* alert = new BAlert("about",
		appName.Append(B_TRANSLATE("\n\twritten by Jérôme Duval\n"
			"\tCopyright 2004-2006, Haiku Inc.\n\noriginal Be version by \n"
			"Dominic, Hiroshi, Peter, Pavel and Robert\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, nameLength, &font);

	alert->Go();
}
Ejemplo n.º 27
0
void
NetworkStatusView::_AboutRequested()
{
	BString about = B_TRANSLATE(
		"NetworkStatus\n\twritten by %1 and Hugo Santos\n\t%2, Haiku, Inc.\n"
		);
	about.ReplaceFirst("%1", "Axel Dörfler");
		// Append a new developer here
	about.ReplaceFirst("%2", "Copyright 2007-2010");
		// Append a new year here
	BAlert* alert = new BAlert("about", about, 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, 13, &font);

	alert->Go();
}
Ejemplo n.º 28
0
void
App::AboutRequested()
{
	BAlert* alert = new BAlert("about",
		B_TRANSLATE("QuickLaunch v1.0\n"
		"\twritten by Humdinger\n"
		"\tCopyright 2010-2015\n\n"
		"QuickLaunch quickly starts any installed application. "
		"Just enter the first few letters of its name and choose "
		"from a list of all found programs.\n\n"
		"Please let me know of any bugs you find or features you "
		"miss. Contact info is in the ReadMe, see menu item 'Help'."),
		B_TRANSLATE("Thank you"));

	BTextView* view = alert->TextView();
	BFont font;
	view->SetStylable(true);
	view->GetFont(&font);
	font.SetSize(font.Size() + 4);
	font.SetFace(B_BOLD_FACE);
	view->SetFontAndColor(0, 11, &font);
	alert->Go();
}
Ejemplo n.º 29
0
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();
}
Ejemplo n.º 30
0
void
NetworkStatusView::_ShowConfiguration(BMessage* message)
{
	const char* name;
	if (message->FindString("interface", &name) != B_OK)
		return;

	BNetworkInterface networkInterface(name);
	if (!networkInterface.Exists())
		return;

	BNetworkInterfaceAddress address;
	networkInterface.GetAddressAt(0, address);
		// TODO: We should get all addresses,
		// not just the first one.
	BString text(B_TRANSLATE("%ifaceName information:\n"));
	text.ReplaceFirst("%ifaceName", name);

	size_t boldLength = text.Length();

	text << "\n" << B_TRANSLATE("Address") << ": " << address.Address().ToString();
	text << "\n" << B_TRANSLATE("Broadcast") << ": " << address.Broadcast().ToString();
	text << "\n" << B_TRANSLATE("Netmask") << ": " << address.Mask().ToString();

	BAlert* alert = new BAlert(name, text.String(), B_TRANSLATE("OK"));
	alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
	BTextView* view = alert->TextView();
	BFont font;

	view->SetStylable(true);
	view->GetFont(&font);
	font.SetFace(B_BOLD_FACE);
	view->SetFontAndColor(0, boldLength, &font);

	alert->Go(NULL);
}