aboutsummaryrefslogtreecommitdiff
path: root/gui/theme.h
diff options
context:
space:
mode:
authorJohannes Schickel2006-04-14 02:16:55 +0000
committerJohannes Schickel2006-04-14 02:16:55 +0000
commit96cf7028b98cd12e2278b37aee43b3d669214abb (patch)
treec9ea75045b671229d8ac4e2656d8475ac5909471 /gui/theme.h
parent1470dadb1de3250dfceeaa246604ca0f26889bbf (diff)
downloadscummvm-rg350-96cf7028b98cd12e2278b37aee43b3d669214abb.tar.gz
scummvm-rg350-96cf7028b98cd12e2278b37aee43b3d669214abb.tar.bz2
scummvm-rg350-96cf7028b98cd12e2278b37aee43b3d669214abb.zip
- implements .bdf font loader based on convbdf (sure could have some clean up)
- adds three different font styles to the themes (normal, bold (default one), italic) - implements code for specifing the font files in the theme config ('fontfile_normal','fontfile_bold' and 'fontfile_italic' in the 'extra' section) - changes EditTextWidget to use the normal font (has some minor aligment problems with the caret now, though) - extends the FontManager (new functions: getFontByName, assignFontToName, removeFontName) - adds the font style constans to the builtin constants for the evaluator) svn-id: r21868
Diffstat (limited to 'gui/theme.h')
-rw-r--r--gui/theme.h46
1 files changed, 29 insertions, 17 deletions
diff --git a/gui/theme.h b/gui/theme.h
index 9c3bcf95d4..734ff3c37a 100644
--- a/gui/theme.h
+++ b/gui/theme.h
@@ -94,6 +94,13 @@ public:
kScrollbarStateSinglePage
};
+ enum kFontStyle {
+ kFontStyleBold = 0, // standard font
+ kFontStyleNormal = 1,
+ kFontStyleItalic = 2,
+ kFontStyleMax
+ };
+
virtual bool init() = 0;
virtual void deinit() = 0;
@@ -114,13 +121,13 @@ public:
virtual const Common::ConfigFile &getConfigFile() { return _configFile; }
- virtual const Graphics::Font *getFont() const = 0;
- virtual int getFontHeight() const = 0;
- virtual int getStringWidth(const Common::String &str) const = 0;
- virtual int getCharWidth(byte c) const = 0;
+ virtual const Graphics::Font *getFont(kFontStyle font = kFontStyleBold) const = 0;
+ virtual int getFontHeight(kFontStyle font = kFontStyleBold) const = 0;
+ virtual int getStringWidth(const Common::String &str, kFontStyle font = kFontStyleBold) const = 0;
+ virtual int getCharWidth(byte c, kFontStyle font = kFontStyleBold) const = 0;
virtual void drawDialogBackground(const Common::Rect &r, uint16 hints, kState state = kStateEnabled) = 0;
- virtual void drawText(const Common::Rect &r, const Common::String &str, kState state = kStateEnabled, kTextAlign align = kTextAlignCenter, bool inverted = false, int deltax = 0, bool useEllipsis = true) = 0;
+ virtual void drawText(const Common::Rect &r, const Common::String &str, kState state = kStateEnabled, kTextAlign align = kTextAlignCenter, bool inverted = false, int deltax = 0, bool useEllipsis = true, kFontStyle font = kFontStyleBold) = 0;
// this should ONLY be used by the debugger until we get a nicer solution
virtual void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, kState state = kStateEnabled) = 0;
@@ -211,13 +218,13 @@ public:
typedef Common::String String;
- const Graphics::Font *getFont() const { return _font; }
- int getFontHeight() const { if (_initOk) return _font->getFontHeight(); return 0; }
- int getStringWidth(const String &str) const { if (_initOk) return _font->getStringWidth(str); return 0; }
- int getCharWidth(byte c) const { if (_initOk) return _font->getCharWidth(c); return 0; }
+ const Graphics::Font *getFont(kFontStyle font) const { return _font; }
+ int getFontHeight(kFontStyle font = kFontStyleBold) const { if (_initOk) return _font->getFontHeight(); return 0; }
+ int getStringWidth(const String &str, kFontStyle font) const { if (_initOk) return _font->getStringWidth(str); return 0; }
+ int getCharWidth(byte c, kFontStyle font) const { if (_initOk) return _font->getCharWidth(c); return 0; }
void drawDialogBackground(const Common::Rect &r, uint16 hints, kState state);
- void drawText(const Common::Rect &r, const String &str, kState state, kTextAlign align, bool inverted, int deltax, bool useEllipsis);
+ void drawText(const Common::Rect &r, const String &str, kState state, kTextAlign align, bool inverted, int deltax, bool useEllipsis, kFontStyle font);
void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, kState state);
void drawWidgetBackground(const Common::Rect &r, uint16 hints, kWidgetBackground background, kState state);
@@ -284,13 +291,13 @@ public:
void setDrawArea(const Common::Rect &r);
void resetDrawArea();
- const Graphics::Font *getFont() const { return _font; }
- int getFontHeight() const { if (_font) return _font->getFontHeight(); return 0; }
- int getStringWidth(const String &str) const { if (_font) return _font->getStringWidth(str); return 0; }
- int getCharWidth(byte c) const { if (_font) return _font->getCharWidth(c); return 0; }
+ const Graphics::Font *getFont(kFontStyle font = kFontStyleBold) const { return _fonts[font]; }
+ int getFontHeight(kFontStyle font = kFontStyleBold) const { if (_fonts[font]) return _fonts[font]->getFontHeight(); return 0; }
+ int getStringWidth(const String &str, kFontStyle font = kFontStyleBold) const { if (_fonts[font]) return _fonts[font]->getStringWidth(str); return 0; }
+ int getCharWidth(byte c, kFontStyle font = kFontStyleBold) const { if (_fonts[font]) return _fonts[font]->getCharWidth(c); return 0; }
void drawDialogBackground(const Common::Rect &r, uint16 hints, kState state);
- void drawText(const Common::Rect &r, const String &str, kState state, kTextAlign align, bool inverted, int deltax, bool useEllipsis);
+ void drawText(const Common::Rect &r, const String &str, kState state, kTextAlign align, bool inverted, int deltax, bool useEllipsis, kFontStyle font);
void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, kState state);
void drawWidgetBackground(const Common::Rect &r, uint16 hints, kWidgetBackground background, kState state);
@@ -338,9 +345,11 @@ private:
Graphics::Surface _screen;
Common::Rect _shadowDrawArea;
+ Common::String _stylefile;
+
bool _initOk;
bool _forceRedraw;
-
+
int _lastUsedBitMask;
void resetupGuiRenderer();
void setupColors();
@@ -352,7 +361,10 @@ private:
Graphics::Surface screen;
} *_dialog;
- const Graphics::Font *_font;
+ void setupFonts();
+ void deleteFonts();
+ const Graphics::Font *loadFont(const char *filename);
+ const Graphics::Font *_fonts[kFontStyleMax];
public:
enum kImageHandles {