Chat-O-Matic/application/AboutWindow.cpp

62 lines
1.3 KiB
C++
Raw Normal View History

2010-05-12 13:57:19 -05:00
/*
2011-12-03 16:38:03 -06:00
* Copyright 2010-2011, Pier Luigi Fiorini. All rights reserved.
2010-05-12 13:57:19 -05:00
* Copyright 2007-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
* Ryan Leavengood, leavengood@gmail.com
*/
#include <Alert.h>
#include <Font.h>
#include <String.h>
#include <TextView.h>
#include "AboutWindow.h"
2010-05-12 13:57:19 -05:00
AboutWindow::AboutWindow(const char* appName, const char** holders,
2010-05-19 17:28:26 -05:00
const char** authors, const char* extraInfo)
2010-05-12 13:57:19 -05:00
{
fAppName = new BString(appName);
// Build the text to display
int32 i;
BString text(appName);
text << "\n\n";
for (i = 0; holders[i]; i++)
text << "Copyright " B_UTF8_COPYRIGHT " " << holders[i] << "\n";
text << "\nWritten by:\n";
for (int32 i = 0; authors[i]; i++)
text << " " << authors[i] << "\n";
// The extra information is optional
if (extraInfo != NULL)
text << "\n" << extraInfo << "\n";
fText = new BString(text);
}
AboutWindow::~AboutWindow()
{
delete fText;
delete fAppName;
}
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();
}