haiku/headers/os/locale/LocaleRoster.h

83 lines
1.8 KiB
C
Raw Normal View History

* Changed BLocaleRoster::GetLanguage() to a signature that makes more sense, and looks more like the rest of the API. * Also, it will now return an appropriate error code if the language couldn't be allocated (anything else than B_OK is an improvement :-)). * Several changes in BLanguage: - GetName() now gets a BString reference, also - it now returns the name in its own language, ie. for German this would always be "deutsch", no matter the current language settings, and finally, - it now empties the string it gets before adding the name. - added GetTranslatedName() that behaves like the previous version. - added const where it made sense (ie. almost everywhere). - Code() now returns the code of the language only. - ID() now returns the full ID of this language, ie. including country, variant, and keywords if any. - added Country(), and Variant(). - renamed IsCountry() to IsCountrySpecific(). - added IsVariant(). * Cleaned up Language.h, minor cleanup in LocaleRoster.cpp. * Removed the whole move item logic from LanguageListView; while this was not only spaghetti code, it doesn't make much sense in the first place. * Instead of removing stuff from the left, and even worse, moving all countries for a language even if only one had been dragged, we now only mark the items that are already in the preferred list, and only those. * Fixed various mixups of FullList*() vs. *() methods that could lead to things like bug #5896. * Pressing the delete key in the preferred list view will now remove the language. * Moved LocaleWindow specific message constants to LocaleWindow.cpp; Locale.h is supposed to contain application wide constants. * The drop logic is now in LocaleWindow. * We now make sure that each base language can only be in the list once. * Lots of cleanup, even though I mostly replaced spaghettie code with different looking spaghettie code - still, I think things have slightly improved. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36727 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-07 21:38:40 +04:00
/*
* Copyright 2003-2010, Haiku. All rights reserved.
* Distributed under the terms of the MIT license.
*/
#ifndef _LOCALE_ROSTER_H_
#define _LOCALE_ROSTER_H_
#include <String.h>
class BBitmap;
class BCatalog;
class BCollator;
class BCountry;
class BLanguage;
class BLocale;
class BMessage;
class BTimeZone;
enum {
B_LOCALE_CHANGED = '_LCC',
};
class BLocaleRoster {
public:
BLocaleRoster();
~BLocaleRoster();
status_t GetDefaultTimeZone(BTimeZone* timezone) const;
status_t GetLanguage(const char* languageCode,
BLanguage** _language) const;
status_t GetPreferredLanguages(BMessage* message) const;
status_t GetAvailableLanguages(BMessage* message) const;
status_t GetAvailableCountries(
BMessage* timeZones) const;
status_t GetAvailableTimeZones(
BMessage* timeZones) const;
status_t GetAvailableTimeZonesForCountry(
BMessage* message,
const char* countryCode) const;
status_t GetFlagIconForCountry(BBitmap* flagIcon,
const char* countryCode);
status_t GetInstalledCatalogs(BMessage* message,
const char* sigPattern = NULL,
const char* langPattern = NULL,
int32 fingerprint = 0) const;
// the message contains...
status_t Refresh();
// Refresh the internal data from the
// settings file(s)
BCatalog* GetCatalog();
// Get the catalog for the calling image
// (that needs to link with liblocalestub.a)
static const char* kCatLangAttr;
static const char* kCatSigAttr;
static const char* kCatFingerprintAttr;
static const char* kEmbeddedCatAttr;
static int32 kEmbeddedCatResId;
private:
static BCatalog* _GetCatalog(BCatalog* catalog,
vint32* catalogInitStatus);
};
extern BLocaleRoster* be_locale_roster;
#endif // _LOCALE_ROSTER_H_