Introducing BAboutMenuItem.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40956 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jonas Sundström
2011-03-15 01:04:41 +00:00
parent 21b9693bd2
commit 12d8a9f85b
3 changed files with 61 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
/*
* Copyright 2011 Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef B_ABOUT_MENU_ITEM_H
#define B_ABOUT_MENU_ITEM_H
#include <MenuItem.h>
class BAboutMenuItem : public BMenuItem {
public:
BAboutMenuItem(const char* appName);
};
#endif // B_ABOUT_MENU_ITEM_H
+42
View File
@@ -0,0 +1,42 @@
/*
* Copyright 2007-2011 Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ryan Leavengood, [email protected]
* Jonas Sundström, [email protected]
*/
#include <AboutMenuItem.h>
#include <Catalog.h>
#include <LocaleBackend.h>
#include <String.h>
using BPrivate::gLocaleBackend;
using BPrivate::LocaleBackend;
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "AboutMenuItem"
BAboutMenuItem::BAboutMenuItem(const char* appName)
:
BMenuItem("", new BMessage(B_ABOUT_REQUESTED))
{
// we need to translate some strings, and in order to do so, we need
// to use the LocaleBackend to reach liblocale.so
if (gLocaleBackend == NULL)
LocaleBackend::LoadBackend();
const char* string = B_TRANSLATE_MARK("About %app%" B_UTF8_ELLIPSIS);
if (gLocaleBackend) {
string = gLocaleBackend->GetString(string, "AboutMenuItem");
}
BString label = string;
label.ReplaceFirst("%app%", appName);
SetLabel(label.String());
}
+1
View File
@@ -13,6 +13,7 @@ UsePrivateSystemHeaders ;
UsePrivateHeaders kernel libroot ;
StaticLibrary libshared.a :
AboutMenuItem.cpp
AboutWindow.cpp
CalendarView.cpp
ColorQuantizer.cpp