aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorJohannes Schickel2006-10-25 21:49:33 +0000
committerJohannes Schickel2006-10-25 21:49:33 +0000
commit77e40457a89409e12e4cea864d17d6f1da77116f (patch)
tree8fe1977927de954fada6189152417105ea606f8a /gui
parent6e16df7891474cc305850c7e4ea29f037a44dddd (diff)
downloadscummvm-rg350-77e40457a89409e12e4cea864d17d6f1da77116f.tar.gz
scummvm-rg350-77e40457a89409e12e4cea864d17d6f1da77116f.tar.bz2
scummvm-rg350-77e40457a89409e12e4cea864d17d6f1da77116f.zip
- Fix crash if theme_logo.visible is set to true in a classic theme config file
svn-id: r24513
Diffstat (limited to 'gui')
-rw-r--r--gui/launcher.cpp12
-rw-r--r--gui/theme.h12
2 files changed, 14 insertions, 10 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 0bf0cee2de..fe102dd676 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -474,12 +474,10 @@ LauncherDialog::LauncherDialog()
#ifndef DISABLE_FANCY_THEMES
_logo = 0;
- if (g_gui.evaluator()->getVar("launcher_logo.visible") == 1) {
+ if (g_gui.evaluator()->getVar("launcher_logo.visible") == 1 && g_gui.theme()->supportsImages()) {
_logo = new GraphicsWidget(this, "launcher_logo");
_logo->useThemeTransparency(true);
- ThemeModern *th = (ThemeModern *)g_gui.theme();
-
- _logo->setGfx(th->getImageSurface(th->kThemeLogo));
+ _logo->setGfx(g_gui.theme()->getImageSurface(Theme::kImageLogo));
new StaticTextWidget(this, "launcher_version", gScummVMVersionDate);
} else
@@ -866,7 +864,7 @@ void LauncherDialog::updateButtons() {
void LauncherDialog::reflowLayout() {
#ifndef DISABLE_FANCY_THEMES
- if (g_gui.evaluator()->getVar("launcher_logo.visible") == 1) {
+ if (g_gui.evaluator()->getVar("launcher_logo.visible") == 1 && g_gui.theme()->supportsImages()) {
StaticTextWidget *ver = (StaticTextWidget*)findWidget("launcher_version");
if (ver) {
ver->setAlign((Graphics::TextAlignment)g_gui.evaluator()->getVar("launcher_version.align"));
@@ -876,9 +874,7 @@ void LauncherDialog::reflowLayout() {
if (!_logo)
_logo = new GraphicsWidget(this, "launcher_logo");
_logo->useThemeTransparency(true);
- ThemeModern *th = (ThemeModern *)g_gui.theme();
-
- _logo->setGfx(th->getImageSurface(th->kThemeLogo));
+ _logo->setGfx(g_gui.theme()->getImageSurface(Theme::kImageLogo));
} else {
StaticTextWidget *ver = (StaticTextWidget*)findWidget("launcher_version");
if (ver) {
diff --git a/gui/theme.h b/gui/theme.h
index 2ac5f2c94d..237404435d 100644
--- a/gui/theme.h
+++ b/gui/theme.h
@@ -218,6 +218,14 @@ public:
const String &getStylefileName() const { return _stylefile; }
const String &getThemeName() const { return _stylename; }
+
+ virtual bool supportsImages() const { return false; }
+
+ enum kThemeImages {
+ kImageLogo = 0
+ };
+
+ virtual const Graphics::Surface *getImageSurface(const kThemeImages n) const { return 0; }
protected:
bool loadConfigFile(const String &file);
void getColorFromConfig(const String &name, OverlayColor &col);
@@ -377,7 +385,6 @@ public:
void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, State state, TextAlign align);
void drawCaret(const Common::Rect &r, bool erase, State state);
void drawLineSeparator(const Common::Rect &r, State state);
- const Graphics::Surface *getImageSurface(int n) { return _images[n]; }
void restoreBackground(Common::Rect r, bool special = false);
bool addDirtyRect(Common::Rect r, bool backup = false, bool special = false);
@@ -385,6 +392,8 @@ public:
int getTabSpacing() const;
int getTabPadding() const;
+ bool supportsImages() const { return true; }
+ const Graphics::Surface *getImageSurface(const kThemeImages n) const { return n == kImageLogo ? _images[kThemeLogo] : 0; }
private:
void colorFade(const Common::Rect &r, OverlayColor start, OverlayColor end, uint factor = 1);
void drawRect(const Common::Rect &r, const Graphics::Surface *corner, const Graphics::Surface *top,
@@ -443,7 +452,6 @@ private:
private:
void processExtraValues();
-public:
enum ImageHandles {
kDialogBkgdCorner = 0,
kDialogBkgdTop = 1,