GUI: Fix compilation with LAYOUT_DEBUG_DIALOG enabled

This commit is contained in:
Eugene Sandulenko 2021-11-21 18:23:43 +01:00
parent f0f213ca6b
commit b9a2753c2c
No known key found for this signature in database
GPG key ID: 014D387312D34F08
3 changed files with 20 additions and 10 deletions

View file

@ -96,8 +96,17 @@ public:
Graphics::TextAlign getWidgetTextHAlign(const Common::String &widget);
#ifdef LAYOUT_DEBUG_DIALOG
void debugDraw(Graphics::Surface *screen, const Graphics::Font *font) {
void debugDraw(Graphics::ManagedSurface *screen, const Graphics::Font *font) {
if (_layouts.contains(LAYOUT_DEBUG_DIALOG)) {
_layouts[LAYOUT_DEBUG_DIALOG]->debugDraw(screen, font);
} else {
Common::String list;
for (auto l = _layouts.begin(); l != _layouts.end(); ++l)
list += " " + l->_key;
warning("debugDraw: Unknown layout %s\nList:%s", LAYOUT_DEBUG_DIALOG, list.c_str());
}
}
#endif

View file

@ -146,7 +146,7 @@ int16 ThemeLayoutStacked::getParentHeight() {
}
#ifdef LAYOUT_DEBUG_DIALOG
void ThemeLayout::debugDraw(Graphics::Surface *screen, const Graphics::Font *font) {
void ThemeLayout::debugDraw(Graphics::ManagedSurface *screen, const Graphics::Font *font) {
uint32 color = 0xFFFFFFFF;
font->drawString(screen, getName(), _x, _y, _w, color, Graphics::kTextAlignRight, 0, true);
screen->hLine(_x, _y, _x + _w, color);

View file

@ -27,6 +27,8 @@
#include "common/rect.h"
#include "graphics/font.h"
//#define LAYOUT_DEBUG_DIALOG "Dialog.Launcher"
#ifdef LAYOUT_DEBUG_DIALOG
namespace Graphics {
struct Surface;
@ -124,10 +126,9 @@ public:
Graphics::TextAlign getTextHAlign() { return _textHAlign; }
#ifdef LAYOUT_DEBUG_DIALOG
void debugDraw(Graphics::Surface *screen, const Graphics::Font *font);
virtual const char *getName() const = 0;
void debugDraw(Graphics::ManagedSurface *screen, const Graphics::Font *font);
#endif
virtual const char *getName() const { return "<override-me>"; }
protected:
ThemeLayout *_parent;
@ -159,7 +160,7 @@ public:
_y = _defaultY;
}
const char *getName() const { return _name.c_str(); }
virtual const char *getName() const override { return _name.c_str(); }
protected:
LayoutType getLayoutType() const override { return kLayoutMain; }
@ -192,7 +193,7 @@ public:
void reflowLayoutVertical(Widget *widgetChain);
#ifdef LAYOUT_DEBUG_DIALOG
const char *getName() const {
const char *getName() const override {
return (_type == kLayoutVertical)
? "Vertical Layout" : "Horizontal Layout";
}
@ -234,7 +235,7 @@ public:
void reflowLayout(Widget *widgetChain) override;
virtual const char *getName() const { return _name.c_str(); }
virtual const char *getName() const override { return _name.c_str(); }
protected:
LayoutType getLayoutType() const override { return kLayoutWidget; }
@ -300,7 +301,7 @@ public:
bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL) override { return false; }
void reflowLayout(Widget *widgetChain) override {}
#ifdef LAYOUT_DEBUG_DIALOG
const char *getName() const { return "SPACE"; }
const char *getName() const override { return "SPACE"; }
#endif
protected: