2006-01-27 15:43:23 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2006 The ScummVM project
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
2006-02-11 10:08:56 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2006-01-27 15:43:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GUI_THEME_H
|
|
|
|
#define GUI_THEME_H
|
|
|
|
|
|
|
|
#include "common/stdafx.h"
|
|
|
|
#include "common/system.h"
|
|
|
|
#include "common/rect.h"
|
|
|
|
#include "common/str.h"
|
2006-04-10 17:32:04 +00:00
|
|
|
#include "common/file.h"
|
2006-01-27 15:43:23 +00:00
|
|
|
#include "common/config-file.h"
|
|
|
|
|
|
|
|
#include "graphics/surface.h"
|
|
|
|
#include "graphics/fontman.h"
|
|
|
|
|
2006-03-08 01:42:02 +00:00
|
|
|
#include "gui/widget.h"
|
2006-03-07 03:31:31 +00:00
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
namespace GUI {
|
|
|
|
|
2006-03-24 14:15:45 +00:00
|
|
|
class Eval;
|
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
// Hints to the theme engine that the widget is used in a non-standard way.
|
|
|
|
|
|
|
|
enum {
|
|
|
|
// Indicates that this is the first time the widget is drawn.
|
|
|
|
THEME_HINT_FIRST_DRAW = 1 << 0,
|
|
|
|
|
|
|
|
// Indicates that the widget will be redrawn often, e.g. list widgets.
|
|
|
|
// It may therefore be a good idea to save the background so that it
|
|
|
|
// can be redrawn quickly.
|
2006-01-28 23:03:39 +00:00
|
|
|
THEME_HINT_SAVE_BACKGROUND = 1 << 1,
|
|
|
|
|
|
|
|
// Indicates that this is the launcher dialog (maybe delete this in the future)
|
|
|
|
THEME_HINT_MAIN_DIALOG = 1 << 2,
|
|
|
|
|
|
|
|
// Indicates special colorfade
|
2006-02-01 15:11:39 +00:00
|
|
|
THEME_HINT_SPECIAL_COLOR = 1 << 3,
|
|
|
|
|
|
|
|
// Indictaes that a shadows should be drawn around the background
|
|
|
|
THEME_HINT_USE_SHADOW = 1 << 4
|
2006-01-27 15:43:23 +00:00
|
|
|
};
|
|
|
|
|
2006-03-07 03:31:31 +00:00
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
class Theme {
|
2006-03-09 22:40:21 +00:00
|
|
|
typedef Common::String String;
|
2006-01-27 15:43:23 +00:00
|
|
|
public:
|
2006-03-24 14:15:45 +00:00
|
|
|
Theme();
|
2006-03-07 03:31:31 +00:00
|
|
|
|
2006-03-24 14:15:45 +00:00
|
|
|
virtual ~Theme();
|
2006-01-27 15:43:23 +00:00
|
|
|
|
|
|
|
enum kTextAlign {
|
|
|
|
kTextAlignLeft,
|
|
|
|
kTextAlignCenter,
|
|
|
|
kTextAlignRight
|
|
|
|
};
|
|
|
|
|
|
|
|
enum kWidgetBackground {
|
|
|
|
kWidgetBackgroundNo,
|
|
|
|
kWidgetBackgroundPlain,
|
|
|
|
kWidgetBackgroundBorder,
|
|
|
|
kWidgetBackgroundBorderSmall
|
|
|
|
};
|
|
|
|
|
|
|
|
enum kState {
|
|
|
|
kStateDisabled,
|
|
|
|
kStateEnabled,
|
|
|
|
kStateHighlight
|
|
|
|
};
|
|
|
|
|
|
|
|
enum kScrollbarState {
|
|
|
|
kScrollbarStateNo,
|
|
|
|
kScrollbarStateUp,
|
|
|
|
kScrollbarStateDown,
|
|
|
|
kScrollbarStateSlider,
|
|
|
|
kScrollbarStateSinglePage
|
|
|
|
};
|
|
|
|
|
2006-04-14 02:16:55 +00:00
|
|
|
enum kFontStyle {
|
|
|
|
kFontStyleBold = 0, // standard font
|
|
|
|
kFontStyleNormal = 1,
|
|
|
|
kFontStyleItalic = 2,
|
|
|
|
kFontStyleMax
|
|
|
|
};
|
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
virtual bool init() = 0;
|
|
|
|
virtual void deinit() = 0;
|
|
|
|
|
|
|
|
virtual void refresh() = 0;
|
|
|
|
|
2006-04-19 03:17:00 +00:00
|
|
|
virtual bool ownCursor() { return false; }
|
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
virtual void enable() = 0;
|
|
|
|
virtual void disable() = 0;
|
|
|
|
|
2006-04-02 00:56:21 +00:00
|
|
|
virtual void openDialog(bool topDialog) = 0;
|
2006-01-27 15:43:23 +00:00
|
|
|
virtual void closeDialog() = 0;
|
|
|
|
|
|
|
|
virtual void clearAll() = 0;
|
|
|
|
virtual void drawAll() = 0;
|
|
|
|
|
|
|
|
virtual void setDrawArea(const Common::Rect &r) { _drawArea = r; }
|
|
|
|
// resets the draw area to the screen size
|
|
|
|
virtual void resetDrawArea() = 0;
|
|
|
|
|
|
|
|
virtual const Common::ConfigFile &getConfigFile() { return _configFile; }
|
|
|
|
|
2006-04-14 02:16:55 +00:00
|
|
|
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;
|
2006-01-27 15:43:23 +00:00
|
|
|
|
2006-01-28 23:03:39 +00:00
|
|
|
virtual void drawDialogBackground(const Common::Rect &r, uint16 hints, kState state = kStateEnabled) = 0;
|
2006-04-14 02:16:55 +00:00
|
|
|
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;
|
2006-01-27 15:43:23 +00:00
|
|
|
// 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;
|
|
|
|
|
|
|
|
virtual void drawWidgetBackground(const Common::Rect &r, uint16 hints, kWidgetBackground background = kWidgetBackgroundPlain, kState state = kStateEnabled) = 0;
|
|
|
|
virtual void drawButton(const Common::Rect &r, const Common::String &str, kState state = kStateEnabled) = 0;
|
2006-03-14 02:19:38 +00:00
|
|
|
virtual void drawSurface(const Common::Rect &r, const Graphics::Surface &surface, kState state = kStateEnabled, bool transparency = false) = 0;
|
2006-01-27 15:43:23 +00:00
|
|
|
virtual void drawSlider(const Common::Rect &r, int width, kState state = kStateEnabled) = 0;
|
|
|
|
virtual void drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked, kState state = kStateEnabled) = 0;
|
2006-02-13 18:00:04 +00:00
|
|
|
virtual void drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<Common::String> &tabs, int active, uint16 hints, kState state = kStateEnabled) = 0;
|
2006-01-27 15:43:23 +00:00
|
|
|
virtual void drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, kScrollbarState, kState state = kStateEnabled) = 0;
|
2006-04-18 18:40:33 +00:00
|
|
|
virtual void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, kState state = kStateEnabled, kTextAlign align = kTextAlignLeft) = 0;
|
2006-01-27 15:43:23 +00:00
|
|
|
virtual void drawCaret(const Common::Rect &r, bool erase, kState state = kStateEnabled) = 0;
|
|
|
|
virtual void drawLineSeparator(const Common::Rect &r, kState state = kStateEnabled) = 0;
|
|
|
|
|
|
|
|
Graphics::TextAlignment convertAligment(kTextAlign align) const {
|
|
|
|
switch (align) {
|
|
|
|
case kTextAlignLeft:
|
|
|
|
return Graphics::kTextAlignLeft;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kTextAlignRight:
|
|
|
|
return Graphics::kTextAlignRight;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
return Graphics::kTextAlignCenter;
|
|
|
|
};
|
|
|
|
|
|
|
|
kTextAlign convertAligment(Graphics::TextAlignment align) const {
|
|
|
|
switch (align) {
|
|
|
|
case Graphics::kTextAlignLeft:
|
|
|
|
return kTextAlignLeft;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Graphics::kTextAlignRight:
|
|
|
|
return kTextAlignRight;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return kTextAlignCenter;
|
|
|
|
}
|
|
|
|
|
2006-03-07 19:02:42 +00:00
|
|
|
void processResSection(Common::ConfigFile &config, String name, bool skipDefs = false, const String prefix = "");
|
2006-03-08 01:42:02 +00:00
|
|
|
void processSingleLine(const String §ion, const String prefix, const String name, const String str);
|
2006-03-07 05:39:52 +00:00
|
|
|
void setSpecialAlias(const String alias, const String &name);
|
2006-03-07 03:31:31 +00:00
|
|
|
|
|
|
|
bool isThemeLoadingRequired();
|
|
|
|
void loadTheme(Common::ConfigFile &config, bool reset = true);
|
|
|
|
|
2006-03-07 05:39:52 +00:00
|
|
|
Eval *_evaluator;
|
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
protected:
|
|
|
|
Common::Rect _drawArea;
|
|
|
|
Common::ConfigFile _configFile;
|
2006-03-07 03:31:31 +00:00
|
|
|
Common::ConfigFile _defaultConfig;
|
|
|
|
|
|
|
|
private:
|
|
|
|
static const char *_defaultConfigINI;
|
|
|
|
int _loadedThemeX, _loadedThemeY;
|
2006-01-27 15:43:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define OLDGUI_TRANSPARENCY
|
|
|
|
|
|
|
|
class ThemeClassic : public Theme {
|
|
|
|
public:
|
|
|
|
ThemeClassic(OSystem *system);
|
|
|
|
virtual ~ThemeClassic();
|
|
|
|
|
|
|
|
bool init();
|
|
|
|
void deinit();
|
|
|
|
|
|
|
|
void refresh();
|
|
|
|
|
|
|
|
void enable();
|
|
|
|
void disable();
|
|
|
|
|
2006-04-02 00:56:21 +00:00
|
|
|
void openDialog(bool topDialog);
|
2006-01-27 15:43:23 +00:00
|
|
|
void closeDialog();
|
|
|
|
|
|
|
|
void clearAll();
|
|
|
|
void drawAll();
|
|
|
|
|
|
|
|
void resetDrawArea();
|
|
|
|
|
2006-03-07 03:31:31 +00:00
|
|
|
|
|
|
|
typedef Common::String String;
|
|
|
|
|
2006-04-14 02:16:55 +00:00
|
|
|
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; }
|
2006-01-27 15:43:23 +00:00
|
|
|
|
2006-01-28 23:03:39 +00:00
|
|
|
void drawDialogBackground(const Common::Rect &r, uint16 hints, kState state);
|
2006-04-14 02:16:55 +00:00
|
|
|
void drawText(const Common::Rect &r, const String &str, kState state, kTextAlign align, bool inverted, int deltax, bool useEllipsis, kFontStyle font);
|
2006-01-27 15:43:23 +00:00
|
|
|
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);
|
2006-03-07 03:31:31 +00:00
|
|
|
void drawButton(const Common::Rect &r, const String &str, kState state);
|
2006-03-14 02:19:38 +00:00
|
|
|
void drawSurface(const Common::Rect &r, const Graphics::Surface &surface, kState state, bool transparency);
|
2006-01-27 15:43:23 +00:00
|
|
|
void drawSlider(const Common::Rect &r, int width, kState state);
|
2006-03-07 03:31:31 +00:00
|
|
|
void drawCheckbox(const Common::Rect &r, const String &str, bool checked, kState state);
|
|
|
|
void drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<String> &tabs, int active, uint16 hints, kState state);
|
2006-01-27 15:43:23 +00:00
|
|
|
void drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, kScrollbarState, kState state);
|
2006-04-18 18:40:33 +00:00
|
|
|
void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, kState state, kTextAlign align);
|
2006-01-27 15:43:23 +00:00
|
|
|
void drawCaret(const Common::Rect &r, bool erase, kState state);
|
|
|
|
void drawLineSeparator(const Common::Rect &r, kState state);
|
|
|
|
private:
|
|
|
|
void restoreBackground(Common::Rect r);
|
2006-01-31 20:19:47 +00:00
|
|
|
bool addDirtyRect(Common::Rect r, bool save = false);
|
2006-01-27 15:43:23 +00:00
|
|
|
|
2006-02-13 18:00:04 +00:00
|
|
|
void box(int x, int y, int width, int height, OverlayColor colorA, OverlayColor colorB, bool skipLastRow = false);
|
2006-01-27 15:43:23 +00:00
|
|
|
void box(int x, int y, int width, int height);
|
|
|
|
|
|
|
|
OverlayColor getColor(kState state);
|
|
|
|
|
|
|
|
OSystem *_system;
|
|
|
|
Graphics::Surface _screen;
|
|
|
|
|
|
|
|
#ifdef OLDGUI_TRANSPARENCY
|
|
|
|
struct DialogState {
|
|
|
|
Graphics::Surface screen;
|
|
|
|
} *_dialog;
|
|
|
|
|
|
|
|
void blendScreenToDialog();
|
|
|
|
#endif
|
|
|
|
|
2006-04-11 16:28:00 +00:00
|
|
|
bool _forceRedraw;
|
2006-01-27 15:43:23 +00:00
|
|
|
bool _initOk;
|
2006-04-19 06:22:15 +00:00
|
|
|
bool _enabled;
|
2006-01-27 15:43:23 +00:00
|
|
|
|
|
|
|
const Graphics::Font *_font;
|
|
|
|
OverlayColor _color, _shadowcolor;
|
|
|
|
OverlayColor _bgcolor;
|
|
|
|
OverlayColor _textcolor;
|
|
|
|
OverlayColor _textcolorhi;
|
|
|
|
};
|
|
|
|
|
2006-03-04 18:34:28 +00:00
|
|
|
#ifndef DISABLE_FANCY_THEMES
|
2006-03-07 03:31:31 +00:00
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
class ThemeNew : public Theme {
|
2006-03-09 22:40:21 +00:00
|
|
|
typedef Common::String String;
|
2006-01-27 15:43:23 +00:00
|
|
|
public:
|
2006-03-07 03:31:31 +00:00
|
|
|
ThemeNew(OSystem *system, String stylefile);
|
2006-01-27 15:43:23 +00:00
|
|
|
virtual ~ThemeNew();
|
|
|
|
|
|
|
|
bool init();
|
|
|
|
void deinit();
|
|
|
|
|
|
|
|
void refresh();
|
|
|
|
|
2006-04-19 03:17:00 +00:00
|
|
|
bool ownCursor() { return true; }
|
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
void enable();
|
|
|
|
void disable();
|
2006-04-02 00:56:21 +00:00
|
|
|
|
|
|
|
void openDialog(bool topDialog);
|
2006-01-27 15:43:23 +00:00
|
|
|
void closeDialog();
|
|
|
|
|
|
|
|
void clearAll();
|
|
|
|
void drawAll();
|
|
|
|
|
2006-02-01 15:11:39 +00:00
|
|
|
void setDrawArea(const Common::Rect &r);
|
2006-01-27 15:43:23 +00:00
|
|
|
void resetDrawArea();
|
|
|
|
|
2006-04-14 02:16:55 +00:00
|
|
|
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; }
|
2006-01-27 15:43:23 +00:00
|
|
|
|
2006-01-28 23:03:39 +00:00
|
|
|
void drawDialogBackground(const Common::Rect &r, uint16 hints, kState state);
|
2006-04-14 02:16:55 +00:00
|
|
|
void drawText(const Common::Rect &r, const String &str, kState state, kTextAlign align, bool inverted, int deltax, bool useEllipsis, kFontStyle font);
|
2006-01-27 15:43:23 +00:00
|
|
|
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);
|
2006-03-07 03:31:31 +00:00
|
|
|
void drawButton(const Common::Rect &r, const String &str, kState state);
|
2006-03-14 02:19:38 +00:00
|
|
|
void drawSurface(const Common::Rect &r, const Graphics::Surface &surface, kState state, bool transparency);
|
2006-01-27 15:43:23 +00:00
|
|
|
void drawSlider(const Common::Rect &r, int width, kState state);
|
2006-03-07 03:31:31 +00:00
|
|
|
void drawCheckbox(const Common::Rect &r, const String &str, bool checked, kState state);
|
|
|
|
void drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<String> &tabs, int active, uint16 hints, kState state);
|
2006-01-27 15:43:23 +00:00
|
|
|
void drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, kScrollbarState, kState state);
|
2006-04-18 18:40:33 +00:00
|
|
|
void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, kState state, kTextAlign align);
|
2006-01-27 15:43:23 +00:00
|
|
|
void drawCaret(const Common::Rect &r, bool erase, kState state);
|
|
|
|
void drawLineSeparator(const Common::Rect &r, kState state);
|
2006-04-11 14:16:15 +00:00
|
|
|
const Graphics::Surface *getImageSurface(int n) { return _images[n]; }
|
2006-03-14 02:19:38 +00:00
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
private:
|
2006-02-01 15:11:39 +00:00
|
|
|
bool addDirtyRect(Common::Rect r, bool backup = false, bool special = false);
|
2006-01-27 15:43:23 +00:00
|
|
|
|
2006-01-31 19:35:33 +00:00
|
|
|
void colorFade(const Common::Rect &r, OverlayColor start, OverlayColor end, uint factor = 1);
|
2006-03-04 21:25:11 +00:00
|
|
|
void drawRect(const Common::Rect &r, const Graphics::Surface *corner, const Graphics::Surface *top,
|
|
|
|
const Graphics::Surface *left, const Graphics::Surface *fill, int alpha, bool skipLastRow = false);
|
2006-01-27 15:43:23 +00:00
|
|
|
void drawRectMasked(const Common::Rect &r, const Graphics::Surface *corner, const Graphics::Surface *top,
|
|
|
|
const Graphics::Surface *left, const Graphics::Surface *fill, int alpha,
|
2006-01-31 19:35:33 +00:00
|
|
|
OverlayColor start, OverlayColor end, uint factor = 1, bool skipLastRow = false);
|
2006-01-27 15:43:23 +00:00
|
|
|
void drawSurface(const Common::Rect &r, const Graphics::Surface *surf, bool upDown, bool leftRight, int alpha);
|
|
|
|
void drawSurfaceMasked(const Common::Rect &r, const Graphics::Surface *surf, bool upDown, bool leftRight, int alpha,
|
|
|
|
OverlayColor start, OverlayColor end, uint factor = 1);
|
|
|
|
|
2006-03-04 20:45:59 +00:00
|
|
|
enum kShadowStyles {
|
|
|
|
kShadowFull = 0,
|
|
|
|
kShadowSmall = 1,
|
|
|
|
kShadowButton = 2,
|
|
|
|
kShadowSlider = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
Common::Rect shadowRect(const Common::Rect &r, uint32 shadowStyle);
|
|
|
|
void drawShadow(const Common::Rect &r, const Graphics::Surface *corner, const Graphics::Surface *top,
|
2006-04-13 22:47:22 +00:00
|
|
|
const Graphics::Surface *left, const Graphics::Surface *fill, uint32 shadowStyle, bool skipLastRow = false);
|
2006-03-04 20:45:59 +00:00
|
|
|
void drawShadowRect(const Common::Rect &r, const Common::Rect &area, const Graphics::Surface *corner,
|
|
|
|
const Graphics::Surface *top, const Graphics::Surface *left, const Graphics::Surface *fill,
|
|
|
|
int alpha, bool skipLastRow = false);
|
|
|
|
|
2006-02-01 15:11:39 +00:00
|
|
|
int _shadowLeftWidth, _shadowRightWidth;
|
|
|
|
int _shadowTopHeight, _shadowBottomHeight;
|
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
OSystem *_system;
|
|
|
|
Graphics::Surface _screen;
|
2006-02-01 15:11:39 +00:00
|
|
|
Common::Rect _shadowDrawArea;
|
2006-01-27 15:43:23 +00:00
|
|
|
|
2006-04-14 02:16:55 +00:00
|
|
|
Common::String _stylefile;
|
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
bool _initOk;
|
|
|
|
bool _forceRedraw;
|
2006-04-19 06:22:15 +00:00
|
|
|
bool _enabled;
|
2006-04-14 02:16:55 +00:00
|
|
|
|
2006-01-31 21:31:31 +00:00
|
|
|
int _lastUsedBitMask;
|
|
|
|
void resetupGuiRenderer();
|
|
|
|
void setupColors();
|
2006-01-27 15:43:23 +00:00
|
|
|
|
2006-02-01 15:11:39 +00:00
|
|
|
void restoreBackground(Common::Rect r, bool special = false);
|
2006-01-27 15:43:23 +00:00
|
|
|
OverlayColor getColor(kState state);
|
|
|
|
|
|
|
|
struct DialogState {
|
|
|
|
Graphics::Surface screen;
|
|
|
|
} *_dialog;
|
|
|
|
|
2006-04-14 02:16:55 +00:00
|
|
|
void setupFonts();
|
|
|
|
void deleteFonts();
|
|
|
|
const Graphics::Font *loadFont(const char *filename);
|
2006-04-16 19:54:39 +00:00
|
|
|
Common::String genCacheFilename(const char *filename);
|
2006-04-14 02:16:55 +00:00
|
|
|
const Graphics::Font *_fonts[kFontStyleMax];
|
2006-01-27 15:43:23 +00:00
|
|
|
|
2006-03-14 02:19:38 +00:00
|
|
|
public:
|
2006-01-27 15:43:23 +00:00
|
|
|
enum kImageHandles {
|
|
|
|
kDialogBkgdCorner = 0,
|
|
|
|
kDialogBkgdTop = 1,
|
|
|
|
kDialogBkgdLeft = 2,
|
|
|
|
kDialogBkgd = 3,
|
2006-01-31 19:35:33 +00:00
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
kWidgetBkgdCorner = 4,
|
|
|
|
kWidgetBkgdTop = 5,
|
|
|
|
kWidgetBkgdLeft = 6,
|
|
|
|
kWidgetBkgd = 7,
|
2006-01-31 19:35:33 +00:00
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
kCheckboxEmpty = 8,
|
|
|
|
kCheckboxChecked = 9,
|
2006-01-31 19:35:33 +00:00
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
kWidgetArrow = 10,
|
2006-01-31 19:35:33 +00:00
|
|
|
|
|
|
|
kTabBkgdCorner = 11,
|
|
|
|
kTabBkgdTop = 12,
|
|
|
|
kTabBkgdLeft = 13,
|
|
|
|
kTabBkgd = 14,
|
|
|
|
|
|
|
|
kSliderBkgdCorner = 15,
|
|
|
|
kSliderBkgdTop = 16,
|
|
|
|
kSliderBkgdLeft = 17,
|
|
|
|
kSliderBkgd = 18,
|
|
|
|
|
|
|
|
kSliderCorner = 19,
|
|
|
|
kSliderTop = 20,
|
|
|
|
kSliderLeft = 21,
|
|
|
|
kSlider = 22,
|
|
|
|
|
|
|
|
kScrollbarBkgdCorner = 23,
|
|
|
|
kScrollbarBkgdTop = 24,
|
|
|
|
kScrollbarBkgdLeft = 25,
|
|
|
|
kScrollbarBkgd = 26,
|
|
|
|
|
|
|
|
kScrollbarCorner = 27,
|
|
|
|
kScrollbarTop = 28,
|
|
|
|
kScrollbarLeft = 29,
|
|
|
|
kScrollbar = 30,
|
|
|
|
|
|
|
|
kButtonBkgdCorner = 31,
|
|
|
|
kButtonBkgdTop = 32,
|
|
|
|
kButtonBkgdLeft = 33,
|
|
|
|
kButtonBkgd = 34,
|
|
|
|
|
|
|
|
kWidgetSmallBkgdCorner = 35,
|
|
|
|
kWidgetSmallBkgdTop = 36,
|
|
|
|
kWidgetSmallBkgdLeft = 37,
|
|
|
|
kWidgetSmallBkgd = 38,
|
2006-03-14 02:19:38 +00:00
|
|
|
|
|
|
|
kThemeLogo = 39,
|
2006-04-18 18:40:33 +00:00
|
|
|
|
|
|
|
kPopUpWidgetBkgdCorner = 40,
|
|
|
|
kPopUpWidgetBkgdTop = 41,
|
|
|
|
kPopUpWidgetBkgdLeft = 42,
|
|
|
|
kPopUpWidgetBkgd = 43,
|
2006-04-19 03:17:00 +00:00
|
|
|
|
|
|
|
kGUICursor = 44,
|
2006-01-31 19:35:33 +00:00
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
kImageHandlesMax
|
|
|
|
};
|
|
|
|
|
2006-04-02 00:56:21 +00:00
|
|
|
private:
|
|
|
|
int _dimPercentValue;
|
2006-04-13 22:20:50 +00:00
|
|
|
typedef OverlayColor (ThemeNew::*InactiveDialogCallback)(OverlayColor col);
|
2006-04-02 00:56:21 +00:00
|
|
|
InactiveDialogCallback _dialogShadingCallback;
|
|
|
|
|
|
|
|
// cache means input is 16 bpp mode
|
2006-04-13 22:20:50 +00:00
|
|
|
OverlayColor calcLuminance(OverlayColor col);
|
|
|
|
OverlayColor calcDimColor(OverlayColor col);
|
2006-04-02 00:56:21 +00:00
|
|
|
|
2006-04-19 03:17:00 +00:00
|
|
|
void setUpCursor();
|
|
|
|
void createCursor();
|
|
|
|
int _cursorHotspotX, _cursorHotspotY;
|
|
|
|
#define MAX_CURS_COLORS 255
|
|
|
|
byte *_cursor;
|
2006-04-19 06:00:34 +00:00
|
|
|
bool _needPaletteUpdates;
|
2006-04-19 03:17:00 +00:00
|
|
|
uint _cursorWidth, _cursorHeight;
|
|
|
|
byte _cursorPal[4*MAX_CURS_COLORS];
|
|
|
|
byte _backUpCols[4*MAX_CURS_COLORS];
|
|
|
|
|
2006-03-14 02:19:38 +00:00
|
|
|
private:
|
2006-03-07 03:31:31 +00:00
|
|
|
const String *_imageHandles;
|
2006-01-27 15:43:23 +00:00
|
|
|
const Graphics::Surface **_images;
|
|
|
|
|
|
|
|
enum kColorHandles {
|
|
|
|
kMainDialogStart = 0,
|
|
|
|
kMainDialogEnd = 1,
|
|
|
|
|
|
|
|
kDialogStart = 2,
|
|
|
|
kDialogEnd = 3,
|
|
|
|
|
|
|
|
kColorStateDisabled = 4,
|
|
|
|
kColorStateHighlight = 5,
|
|
|
|
kColorStateEnabled = 6,
|
|
|
|
kColorTransparency = 7,
|
|
|
|
|
|
|
|
kTextInvertedBackground = 8,
|
|
|
|
kTextInvertedColor = 9,
|
|
|
|
|
|
|
|
kWidgetBackgroundStart = 10,
|
|
|
|
kWidgetBackgroundEnd = 11,
|
|
|
|
kWidgetBackgroundSmallStart = 12,
|
|
|
|
kWidgetBackgroundSmallEnd = 13,
|
|
|
|
|
|
|
|
kButtonBackgroundStart = 14,
|
|
|
|
kButtonBackgroundEnd = 15,
|
|
|
|
kButtonTextEnabled = 16,
|
|
|
|
kButtonTextDisabled = 17,
|
|
|
|
kButtonTextHighlight = 18,
|
|
|
|
|
|
|
|
kSliderBackgroundStart = 19,
|
|
|
|
kSliderBackgroundEnd = 20,
|
|
|
|
kSliderStart = 21,
|
|
|
|
kSliderEnd = 22,
|
|
|
|
|
|
|
|
kTabBackgroundStart = 23,
|
|
|
|
kTabBackgroundEnd = 24,
|
|
|
|
|
|
|
|
kScrollbarBackgroundStart = 25,
|
|
|
|
kScrollbarBackgroundEnd = 26,
|
|
|
|
kScrollbarButtonStart = 27,
|
|
|
|
kScrollbarButtonEnd = 28,
|
|
|
|
kScrollbarSliderStart = 29,
|
|
|
|
kScrollbarSliderEnd = 30,
|
|
|
|
|
|
|
|
kCaretColor = 31,
|
|
|
|
|
2006-02-01 15:11:39 +00:00
|
|
|
kSliderHighStart = 32,
|
|
|
|
kSliderHighEnd = 33,
|
|
|
|
|
|
|
|
kButtonBackgroundHighlightStart = 34,
|
|
|
|
kButtonBackgroundHighlightEnd = 35,
|
|
|
|
|
|
|
|
kScrollbarButtonHighlightStart = 36,
|
|
|
|
kScrollbarButtonHighlightEnd = 37,
|
|
|
|
kScrollbarSliderHighlightStart = 38,
|
|
|
|
kScrollbarSliderHighlightEnd = 39,
|
2006-04-18 18:40:33 +00:00
|
|
|
|
|
|
|
kPopUpWidgetStart = 40,
|
|
|
|
kPopUpWidgetEnd = 41,
|
|
|
|
kPopUpWidgetHighlightStart = 42,
|
|
|
|
kPopUpWidgetHighlightEnd = 43,
|
2006-02-01 15:11:39 +00:00
|
|
|
|
2006-01-27 15:43:23 +00:00
|
|
|
kColorHandlesMax
|
|
|
|
};
|
|
|
|
|
|
|
|
OverlayColor _colors[kColorHandlesMax];
|
2006-01-31 19:35:33 +00:00
|
|
|
|
|
|
|
enum kGradientFactors {
|
|
|
|
kMainDialogFactor = 0,
|
|
|
|
kDialogFactor = 1,
|
|
|
|
kDialogSpecialFactor = 2,
|
|
|
|
|
|
|
|
kWidgetSmallFactor = 3,
|
|
|
|
kWidgetFactor = 4,
|
|
|
|
|
|
|
|
kButtonFactor = 5,
|
|
|
|
|
|
|
|
kSliderFactor = 6,
|
|
|
|
kSliderBackground = 7,
|
|
|
|
|
|
|
|
kTabFactor = 7,
|
|
|
|
|
|
|
|
kScrollbarFactor = 8,
|
|
|
|
kScrollbarBkgdFactor = 9,
|
2006-04-18 18:40:33 +00:00
|
|
|
|
|
|
|
kPopUpWidgetFactor = 10,
|
2006-01-31 19:35:33 +00:00
|
|
|
|
|
|
|
kMaxGradientFactors
|
|
|
|
};
|
|
|
|
|
|
|
|
uint _gradientFactors[kMaxGradientFactors];
|
2006-01-27 15:43:23 +00:00
|
|
|
};
|
2006-03-09 22:40:21 +00:00
|
|
|
#endif // DISABLE_FANCY_THEMES
|
2006-01-27 15:43:23 +00:00
|
|
|
} // end of namespace GUI
|
|
|
|
|
|
|
|
#endif // GUI_THEME_H
|