2007-01-17 15:04:02 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2002-2007, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _TRANSLATION_UTILS_H
|
2002-07-09 16:24:59 +04:00
|
|
|
#define _TRANSLATION_UTILS_H
|
|
|
|
|
2007-01-17 15:04:02 +03:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <TranslationDefs.h>
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
|
|
class BBitmap;
|
2007-10-16 00:13:55 +04:00
|
|
|
class BFile;
|
2002-07-09 16:24:59 +04:00
|
|
|
class BMenu;
|
2007-10-16 00:13:55 +04:00
|
|
|
class BMessage;
|
|
|
|
class BPositionIO;
|
|
|
|
class BTextView;
|
|
|
|
class BTranslatorRoster;
|
|
|
|
struct entry_ref;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-01-17 15:04:02 +03:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
class BTranslationUtils {
|
2007-01-17 15:04:02 +03:00
|
|
|
private:
|
2007-01-17 12:10:16 +03:00
|
|
|
BTranslationUtils();
|
|
|
|
~BTranslationUtils();
|
|
|
|
BTranslationUtils(const BTranslationUtils &);
|
|
|
|
BTranslationUtils & operator=(const BTranslationUtils &);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-01-17 12:10:16 +03:00
|
|
|
public:
|
|
|
|
// bitmap functions
|
|
|
|
static BBitmap *GetBitmap(const char *name, BTranslatorRoster *roster = NULL);
|
|
|
|
static BBitmap *GetBitmap(uint32 type, int32 id,
|
|
|
|
BTranslatorRoster *roster = NULL);
|
|
|
|
static BBitmap *GetBitmap(uint32 type, const char *name,
|
|
|
|
BTranslatorRoster *roster = NULL);
|
|
|
|
static BBitmap *GetBitmapFile(const char *name,
|
|
|
|
BTranslatorRoster *roster = NULL);
|
|
|
|
static BBitmap *GetBitmap(const entry_ref *ref,
|
|
|
|
BTranslatorRoster *roster = NULL);
|
|
|
|
static BBitmap *GetBitmap(BPositionIO *stream,
|
|
|
|
BTranslatorRoster *roster = NULL);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-01-17 12:10:16 +03:00
|
|
|
// text functions
|
2007-01-17 15:04:02 +03:00
|
|
|
static status_t GetStyledText(BPositionIO* fromStream, BTextView* intoView,
|
2007-01-17 12:10:16 +03:00
|
|
|
BTranslatorRoster *roster = NULL);
|
2007-01-17 15:04:02 +03:00
|
|
|
static status_t GetStyledText(BPositionIO* fromStream, BTextView* intoView,
|
|
|
|
const char* encoding, BTranslatorRoster* roster = NULL);
|
2007-01-17 12:10:16 +03:00
|
|
|
static status_t PutStyledText(BTextView *fromView, BPositionIO *intoStream,
|
|
|
|
BTranslatorRoster *roster = NULL);
|
|
|
|
static status_t WriteStyledEditFile(BTextView *fromView, BFile *intoFile);
|
|
|
|
static status_t WriteStyledEditFile(BTextView *fromView, BFile *intoFile,
|
|
|
|
const char* encoding);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-01-17 12:10:16 +03:00
|
|
|
// misc. functions
|
|
|
|
static BMessage *GetDefaultSettings(translator_id forTranslator,
|
|
|
|
BTranslatorRoster *roster = NULL);
|
|
|
|
static BMessage *GetDefaultSettings(const char *translatorName,
|
|
|
|
int32 translatorVersion);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2007-01-17 12:10:16 +03:00
|
|
|
enum {
|
|
|
|
B_TRANSLATION_MENU = 'BTMN'
|
|
|
|
};
|
|
|
|
static status_t AddTranslationItems(BMenu *intoMenu, uint32 fromType,
|
2007-01-17 15:04:02 +03:00
|
|
|
const BMessage *model = NULL, // default B_TRANSLATION_MENU
|
|
|
|
const char *translatorIdName = NULL, // default "be:translator"
|
|
|
|
const char *translatorTypeName = NULL, // default "be:type"
|
2007-01-17 12:10:16 +03:00
|
|
|
BTranslatorRoster *roster = NULL);
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _TRANSLATION_UTILS_H */
|
|
|
|
|