GUI: ThemeEngine.cpp/.h formatting fixes.
This commit is contained in:
parent
407b9c9b2e
commit
28e6859a69
2 changed files with 205 additions and 203 deletions
|
@ -69,18 +69,18 @@ struct WidgetDrawData {
|
|||
|
||||
/** Extra space that the widget occupies when it's drawn.
|
||||
E.g. when taking into account rounded corners, drop shadows, etc
|
||||
Used when restoring the widget background */
|
||||
Used when restoring the widget background */
|
||||
uint16 _backgroundOffset;
|
||||
|
||||
bool _buffer;
|
||||
|
||||
|
||||
/**
|
||||
* Calculates the background threshold offset of a given DrawData item.
|
||||
* After fully loading all DrawSteps of a DrawData item, this function must be
|
||||
* called in order to calculate if such draw steps would be drawn outside of
|
||||
* the actual widget drawing zone (e.g. shadows). If this is the case, a constant
|
||||
* value will be added when restoring the background of the widget.
|
||||
* Calculates the background threshold offset of a given DrawData item.
|
||||
* After fully loading all DrawSteps of a DrawData item, this function must be
|
||||
* called in order to calculate if such draw steps would be drawn outside of
|
||||
* the actual widget drawing zone (e.g. shadows). If this is the case, a constant
|
||||
* value will be added when restoring the background of the widget.
|
||||
*/
|
||||
void calcBackgroundOffset();
|
||||
};
|
||||
|
@ -114,8 +114,8 @@ protected:
|
|||
class ThemeItemTextData : public ThemeItem {
|
||||
public:
|
||||
ThemeItemTextData(ThemeEngine *engine, const TextDrawData *data, const TextColorData *color, const Common::Rect &area, const Common::String &text,
|
||||
Graphics::TextAlign alignH, GUI::ThemeEngine::TextAlignVertical alignV,
|
||||
bool ellipsis, bool restoreBg, int deltaX) :
|
||||
Graphics::TextAlign alignH, GUI::ThemeEngine::TextAlignVertical alignV,
|
||||
bool ellipsis, bool restoreBg, int deltaX) :
|
||||
ThemeItem(engine, area), _data(data), _color(color), _text(text), _alignH(alignH), _alignV(alignV),
|
||||
_ellipsis(ellipsis), _restoreBg(restoreBg), _deltax(deltaX) {}
|
||||
|
||||
|
@ -147,71 +147,71 @@ protected:
|
|||
|
||||
|
||||
/**********************************************************
|
||||
* Data definitions for theme engine elements
|
||||
* Data definitions for theme engine elements
|
||||
*********************************************************/
|
||||
struct DrawDataInfo {
|
||||
DrawData id; ///< The actual ID of the DrawData item.
|
||||
const char *name; ///< The name of the DrawData item as it appears in the Theme Description files
|
||||
bool buffer; ///< Sets whether this item is buffered on the backbuffer or drawn directly to the screen.
|
||||
DrawData parent; ///< Parent DrawData item, for items that overlay. E.g. kButtonIdle -> kButtonHover
|
||||
DrawData id; ///< The actual ID of the DrawData item.
|
||||
const char *name; ///< The name of the DrawData item as it appears in the Theme Description files
|
||||
bool buffer; ///< Sets whether this item is buffered on the backbuffer or drawn directly to the screen.
|
||||
DrawData parent; ///< Parent DrawData item, for items that overlay. E.g. kButtonIdle -> kButtonHover
|
||||
};
|
||||
|
||||
/**
|
||||
* Default values for each DrawData item.
|
||||
*/
|
||||
static const DrawDataInfo kDrawDataDefaults[] = {
|
||||
{kDDMainDialogBackground, "mainmenu_bg", true, kDDNone},
|
||||
{kDDSpecialColorBackground, "special_bg", true, kDDNone},
|
||||
{kDDPlainColorBackground, "plain_bg", true, kDDNone},
|
||||
{kDDTooltipBackground, "tooltip_bg", true, kDDNone},
|
||||
{kDDDefaultBackground, "default_bg", true, kDDNone},
|
||||
{kDDTextSelectionBackground, "text_selection", false, kDDNone},
|
||||
{kDDTextSelectionFocusBackground, "text_selection_focus", false, kDDNone},
|
||||
{kDDMainDialogBackground, "mainmenu_bg", true, kDDNone},
|
||||
{kDDSpecialColorBackground, "special_bg", true, kDDNone},
|
||||
{kDDPlainColorBackground, "plain_bg", true, kDDNone},
|
||||
{kDDTooltipBackground, "tooltip_bg", true, kDDNone},
|
||||
{kDDDefaultBackground, "default_bg", true, kDDNone},
|
||||
{kDDTextSelectionBackground, "text_selection", false, kDDNone},
|
||||
{kDDTextSelectionFocusBackground, "text_selection_focus", false, kDDNone},
|
||||
|
||||
{kDDWidgetBackgroundDefault, "widget_default", true, kDDNone},
|
||||
{kDDWidgetBackgroundSmall, "widget_small", true, kDDNone},
|
||||
{kDDWidgetBackgroundEditText, "widget_textedit", true, kDDNone},
|
||||
{kDDWidgetBackgroundSlider, "widget_slider", true, kDDNone},
|
||||
{kDDWidgetBackgroundDefault, "widget_default", true, kDDNone},
|
||||
{kDDWidgetBackgroundSmall, "widget_small", true, kDDNone},
|
||||
{kDDWidgetBackgroundEditText, "widget_textedit", true, kDDNone},
|
||||
{kDDWidgetBackgroundSlider, "widget_slider", true, kDDNone},
|
||||
|
||||
{kDDButtonIdle, "button_idle", true, kDDWidgetBackgroundSlider},
|
||||
{kDDButtonHover, "button_hover", false, kDDButtonIdle},
|
||||
{kDDButtonDisabled, "button_disabled", true, kDDNone},
|
||||
{kDDButtonIdle, "button_idle", true, kDDWidgetBackgroundSlider},
|
||||
{kDDButtonHover, "button_hover", false, kDDButtonIdle},
|
||||
{kDDButtonDisabled, "button_disabled", true, kDDNone},
|
||||
|
||||
{kDDSliderFull, "slider_full", false, kDDNone},
|
||||
{kDDSliderHover, "slider_hover", false, kDDNone},
|
||||
{kDDSliderDisabled, "slider_disabled", false, kDDNone},
|
||||
{kDDSliderFull, "slider_full", false, kDDNone},
|
||||
{kDDSliderHover, "slider_hover", false, kDDNone},
|
||||
{kDDSliderDisabled, "slider_disabled", false, kDDNone},
|
||||
|
||||
{kDDCheckboxDefault, "checkbox_default", true, kDDNone},
|
||||
{kDDCheckboxDisabled, "checkbox_disabled", true, kDDNone},
|
||||
{kDDCheckboxSelected, "checkbox_selected", false, kDDCheckboxDefault},
|
||||
{kDDCheckboxDefault, "checkbox_default", true, kDDNone},
|
||||
{kDDCheckboxDisabled, "checkbox_disabled", true, kDDNone},
|
||||
{kDDCheckboxSelected, "checkbox_selected", false, kDDCheckboxDefault},
|
||||
|
||||
{kDDRadiobuttonDefault, "radiobutton_default", true, kDDNone},
|
||||
{kDDRadiobuttonDisabled, "radiobutton_disabled", true, kDDNone},
|
||||
{kDDRadiobuttonSelected, "radiobutton_selected", false, kDDRadiobuttonDefault},
|
||||
{kDDRadiobuttonDefault, "radiobutton_default", true, kDDNone},
|
||||
{kDDRadiobuttonDisabled, "radiobutton_disabled", true, kDDNone},
|
||||
{kDDRadiobuttonSelected, "radiobutton_selected", false, kDDRadiobuttonDefault},
|
||||
|
||||
{kDDTabActive, "tab_active", false, kDDTabInactive},
|
||||
{kDDTabInactive, "tab_inactive", true, kDDNone},
|
||||
{kDDTabBackground, "tab_background", true, kDDNone},
|
||||
{kDDTabActive, "tab_active", false, kDDTabInactive},
|
||||
{kDDTabInactive, "tab_inactive", true, kDDNone},
|
||||
{kDDTabBackground, "tab_background", true, kDDNone},
|
||||
|
||||
{kDDScrollbarBase, "scrollbar_base", true, kDDNone},
|
||||
{kDDScrollbarBase, "scrollbar_base", true, kDDNone},
|
||||
|
||||
{kDDScrollbarButtonIdle, "scrollbar_button_idle", true, kDDNone},
|
||||
{kDDScrollbarButtonHover, "scrollbar_button_hover", false, kDDScrollbarButtonIdle},
|
||||
{kDDScrollbarButtonIdle, "scrollbar_button_idle", true, kDDNone},
|
||||
{kDDScrollbarButtonHover, "scrollbar_button_hover", false, kDDScrollbarButtonIdle},
|
||||
|
||||
{kDDScrollbarHandleIdle, "scrollbar_handle_idle", false, kDDNone},
|
||||
{kDDScrollbarHandleHover, "scrollbar_handle_hover", false, kDDScrollbarBase},
|
||||
{kDDScrollbarHandleIdle, "scrollbar_handle_idle", false, kDDNone},
|
||||
{kDDScrollbarHandleHover, "scrollbar_handle_hover", false, kDDScrollbarBase},
|
||||
|
||||
{kDDPopUpIdle, "popup_idle", true, kDDNone},
|
||||
{kDDPopUpHover, "popup_hover", false, kDDPopUpIdle},
|
||||
{kDDPopUpDisabled, "popup_disabled", true, kDDNone},
|
||||
{kDDPopUpIdle, "popup_idle", true, kDDNone},
|
||||
{kDDPopUpHover, "popup_hover", false, kDDPopUpIdle},
|
||||
{kDDPopUpDisabled, "popup_disabled", true, kDDNone},
|
||||
|
||||
{kDDCaret, "caret", false, kDDNone},
|
||||
{kDDSeparator, "separator", true, kDDNone},
|
||||
{kDDCaret, "caret", false, kDDNone},
|
||||
{kDDSeparator, "separator", true, kDDNone},
|
||||
};
|
||||
|
||||
|
||||
/**********************************************************
|
||||
* ThemeItem functions for drawing queues.
|
||||
* ThemeItem functions for drawing queues.
|
||||
*********************************************************/
|
||||
void ThemeItemDrawData::drawSelf(bool draw, bool restore) {
|
||||
|
||||
|
@ -259,7 +259,7 @@ void ThemeItemBitmap::drawSelf(bool draw, bool restore) {
|
|||
|
||||
|
||||
/**********************************************************
|
||||
* ThemeEngine class
|
||||
* ThemeEngine class
|
||||
*********************************************************/
|
||||
ThemeEngine::ThemeEngine(Common::String id, GraphicsMode mode) :
|
||||
_system(0), _vectorRenderer(0),
|
||||
|
@ -326,7 +326,7 @@ ThemeEngine::~ThemeEngine() {
|
|||
|
||||
|
||||
/**********************************************************
|
||||
* Rendering mode management
|
||||
* Rendering mode management
|
||||
*********************************************************/
|
||||
const ThemeEngine::Renderer ThemeEngine::_rendererModes[] = {
|
||||
{ _s("Disabled GFX"), _sc("Disabled GFX", "lowres"), "none", kGfxDisabled },
|
||||
|
@ -368,7 +368,7 @@ const char *ThemeEngine::findModeConfigName(GraphicsMode mode) {
|
|||
|
||||
|
||||
/**********************************************************
|
||||
* Theme setup/initialization
|
||||
* Theme setup/initialization
|
||||
*********************************************************/
|
||||
bool ThemeEngine::init() {
|
||||
// reset everything and reload the graphics
|
||||
|
@ -512,7 +512,7 @@ void ThemeEngine::setGraphicsMode(GraphicsMode mode) {
|
|||
void WidgetDrawData::calcBackgroundOffset() {
|
||||
uint maxShadow = 0;
|
||||
for (Common::List<Graphics::DrawStep>::const_iterator step = _steps.begin();
|
||||
step != _steps.end(); ++step) {
|
||||
step != _steps.end(); ++step) {
|
||||
if ((step->autoWidth || step->autoHeight) && step->shadow > maxShadow)
|
||||
maxShadow = step->shadow;
|
||||
|
||||
|
@ -531,7 +531,7 @@ void ThemeEngine::restoreBackground(Common::Rect r) {
|
|||
|
||||
|
||||
/**********************************************************
|
||||
* Theme elements management
|
||||
* Theme elements management
|
||||
*********************************************************/
|
||||
void ThemeEngine::addDrawStep(const Common::String &drawDataId, const Graphics::DrawStep &step) {
|
||||
DrawData id = parseDrawDataId(drawDataId);
|
||||
|
@ -659,7 +659,7 @@ bool ThemeEngine::addDrawData(const Common::String &data, bool cached) {
|
|||
|
||||
|
||||
/**********************************************************
|
||||
* Theme XML loading
|
||||
* Theme XML loading
|
||||
*********************************************************/
|
||||
void ThemeEngine::loadTheme(const Common::String &themeId) {
|
||||
unloadTheme();
|
||||
|
@ -717,9 +717,9 @@ bool ThemeEngine::loadDefaultXML() {
|
|||
#ifndef DISABLE_GUI_BUILTIN_THEME
|
||||
const char *defaultXML =
|
||||
#include "themes/default.inc"
|
||||
;
|
||||
;
|
||||
|
||||
if (!_parser->loadBuffer((const byte*)defaultXML, strlen(defaultXML)))
|
||||
if (!_parser->loadBuffer((const byte *)defaultXML, strlen(defaultXML)))
|
||||
return false;
|
||||
|
||||
_themeName = "ScummVM Classic Theme (Builtin Version)";
|
||||
|
@ -793,7 +793,7 @@ bool ThemeEngine::loadThemeXML(const Common::String &themeId) {
|
|||
|
||||
|
||||
/**********************************************************
|
||||
* Drawing Queue management
|
||||
* Drawing Queue management
|
||||
*********************************************************/
|
||||
void ThemeEngine::queueDD(DrawData type, const Common::Rect &r, uint32 dynamic, bool restore) {
|
||||
if (_widgets[type] == 0)
|
||||
|
@ -820,7 +820,7 @@ void ThemeEngine::queueDD(DrawData type, const Common::Rect &r, uint32 dynamic,
|
|||
}
|
||||
|
||||
void ThemeEngine::queueDDText(TextData type, TextColor color, const Common::Rect &r, const Common::String &text, bool restoreBg,
|
||||
bool ellipsis, Graphics::TextAlign alignH, TextAlignVertical alignV, int deltax) {
|
||||
bool ellipsis, Graphics::TextAlign alignH, TextAlignVertical alignV, int deltax) {
|
||||
|
||||
if (_texts[type] == 0)
|
||||
return;
|
||||
|
@ -856,7 +856,7 @@ void ThemeEngine::queueBitmap(const Graphics::Surface *bitmap, const Common::Rec
|
|||
|
||||
|
||||
/**********************************************************
|
||||
* Widget drawing functions
|
||||
* Widget drawing functions
|
||||
*********************************************************/
|
||||
void ThemeEngine::drawButton(const Common::Rect &r, const Common::String &str, WidgetStateInfo state, uint16 hints) {
|
||||
if (!ready())
|
||||
|
@ -1088,7 +1088,7 @@ void ThemeEngine::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, co
|
|||
}
|
||||
|
||||
if (active >= 0 &&
|
||||
(r.left + active * tabWidth < r.right) && (r.left + (active + 1) * tabWidth < r.right)) {
|
||||
(r.left + active * tabWidth < r.right) && (r.left + (active + 1) * tabWidth < r.right)) {
|
||||
Common::Rect tabRect(r.left + active * tabWidth, r.top, r.left + (active + 1) * tabWidth, r.top + tabHeight);
|
||||
const uint16 tabLeft = active * tabWidth;
|
||||
const uint16 tabRight = MAX(r.right - tabRect.right, 0);
|
||||
|
@ -1191,25 +1191,25 @@ void ThemeEngine::debugWidgetPosition(const char *name, const Common::Rect &r) {
|
|||
}
|
||||
|
||||
/**********************************************************
|
||||
* Screen/overlay management
|
||||
* Screen/overlay management
|
||||
*********************************************************/
|
||||
void ThemeEngine::updateScreen(bool render) {
|
||||
if (!_bufferQueue.empty()) {
|
||||
_vectorRenderer->setSurface(&_backBuffer);
|
||||
|
||||
for (Common::List<ThemeItem*>::iterator q = _bufferQueue.begin(); q != _bufferQueue.end(); ++q) {
|
||||
for (Common::List<ThemeItem *>::iterator q = _bufferQueue.begin(); q != _bufferQueue.end(); ++q) {
|
||||
(*q)->drawSelf(true, false);
|
||||
delete *q;
|
||||
}
|
||||
|
||||
_vectorRenderer->setSurface(&_screen);
|
||||
memcpy(_screen.getBasePtr(0,0), _backBuffer.getBasePtr(0,0), _screen.pitch * _screen.h);
|
||||
memcpy(_screen.getBasePtr(0, 0), _backBuffer.getBasePtr(0, 0), _screen.pitch * _screen.h);
|
||||
_bufferQueue.clear();
|
||||
}
|
||||
|
||||
if (!_screenQueue.empty()) {
|
||||
_vectorRenderer->disableShadows();
|
||||
for (Common::List<ThemeItem*>::iterator q = _screenQueue.begin(); q != _screenQueue.end(); ++q) {
|
||||
for (Common::List<ThemeItem *>::iterator q = _screenQueue.begin(); q != _screenQueue.end(); ++q) {
|
||||
(*q)->drawSelf(true, false);
|
||||
delete *q;
|
||||
}
|
||||
|
@ -1232,7 +1232,7 @@ void ThemeEngine::addDirtyRect(Common::Rect r) {
|
|||
|
||||
// Check if the new rectangle is contained within another in the list
|
||||
Common::List<Common::Rect>::iterator it;
|
||||
for (it = _dirtyScreen.begin(); it != _dirtyScreen.end(); ) {
|
||||
for (it = _dirtyScreen.begin(); it != _dirtyScreen.end();) {
|
||||
// If we find a rectangle which fully contains the new one,
|
||||
// we can abort the search.
|
||||
if (it->contains(r))
|
||||
|
@ -1271,7 +1271,7 @@ void ThemeEngine::openDialog(bool doBuffer, ShadingStyle style) {
|
|||
addDirtyRect(Common::Rect(0, 0, _screen.w, _screen.h));
|
||||
}
|
||||
|
||||
memcpy(_backBuffer.getBasePtr(0,0), _screen.getBasePtr(0,0), _screen.pitch * _screen.h);
|
||||
memcpy(_backBuffer.getBasePtr(0, 0), _screen.getBasePtr(0, 0), _screen.pitch * _screen.h);
|
||||
_vectorRenderer->setSurface(&_screen);
|
||||
}
|
||||
|
||||
|
@ -1310,8 +1310,8 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int
|
|||
// Now, scan the bitmap. We have to convert it from 16 bit color mode
|
||||
// to 8 bit mode, and have to create a suitable palette on the fly.
|
||||
uint colorsFound = 0;
|
||||
Common::HashMap<int, int> colorToIndex;
|
||||
const OverlayColor *src = (const OverlayColor*)cursor->pixels;
|
||||
Common::HashMap<int, int> colorToIndex;
|
||||
const OverlayColor *src = (const OverlayColor *)cursor->pixels;
|
||||
for (uint y = 0; y < _cursorHeight; ++y) {
|
||||
for (uint x = 0; x < _cursorWidth; ++x) {
|
||||
byte r, g, b;
|
||||
|
@ -1353,7 +1353,7 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int
|
|||
|
||||
|
||||
/**********************************************************
|
||||
* Legacy GUI::Theme support functions
|
||||
* Legacy GUI::Theme support functions
|
||||
*********************************************************/
|
||||
|
||||
const Graphics::Font *ThemeEngine::getFont(FontStyle font) const {
|
||||
|
@ -1389,7 +1389,7 @@ DrawData ThemeEngine::parseDrawDataId(const Common::String &name) const {
|
|||
}
|
||||
|
||||
/**********************************************************
|
||||
* External data loading
|
||||
* External data loading
|
||||
*********************************************************/
|
||||
|
||||
const Graphics::Font *ThemeEngine::loadFontFromArchive(const Common::String &filename) {
|
||||
|
@ -1498,7 +1498,7 @@ Common::String ThemeEngine::genLocalizedFontFilename(const Common::String &filen
|
|||
|
||||
|
||||
/**********************************************************
|
||||
* Static Theme XML functions
|
||||
* Static Theme XML functions
|
||||
*********************************************************/
|
||||
|
||||
bool ThemeEngine::themeConfigParseHeader(Common::String header, Common::String &themeName) {
|
||||
|
@ -1584,7 +1584,9 @@ struct TDComparator {
|
|||
const Common::String _id;
|
||||
TDComparator(const Common::String &id) : _id(id) {}
|
||||
|
||||
bool operator()(const ThemeEngine::ThemeDescriptor &r) { return _id == r.id; }
|
||||
bool operator()(const ThemeEngine::ThemeDescriptor &r) {
|
||||
return _id == r.id;
|
||||
}
|
||||
};
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
@ -1626,7 +1628,7 @@ void ThemeEngine::listUsableThemes(Common::Archive &archive, Common::List<ThemeD
|
|||
Common::ArchiveMemberList fileList;
|
||||
archive.listMatchingMembers(fileList, "*.zip");
|
||||
for (Common::ArchiveMemberList::iterator i = fileList.begin();
|
||||
i != fileList.end(); ++i) {
|
||||
i != fileList.end(); ++i) {
|
||||
td.name.clear();
|
||||
if (themeConfigUsable(**i, td.name)) {
|
||||
td.filename = (*i)->getName();
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.3"
|
||||
|
||||
namespace Graphics {
|
||||
struct DrawStep;
|
||||
class VectorRenderer;
|
||||
struct DrawStep;
|
||||
class VectorRenderer;
|
||||
}
|
||||
|
||||
namespace GUI {
|
||||
|
@ -53,9 +53,9 @@ class ThemeItem;
|
|||
class ThemeParser;
|
||||
|
||||
/**
|
||||
* DrawData sets enumeration.
|
||||
* Each DD set corresponds to the actual looks
|
||||
* of a widget in a given state.
|
||||
* DrawData sets enumeration.
|
||||
* Each DD set corresponds to the actual looks
|
||||
* of a widget in a given state.
|
||||
*/
|
||||
enum DrawData {
|
||||
kDDMainDialogBackground,
|
||||
|
@ -134,7 +134,7 @@ enum TextColor {
|
|||
|
||||
class ThemeEngine {
|
||||
protected:
|
||||
typedef Common::HashMap<Common::String, Graphics::Surface*> ImagesMap;
|
||||
typedef Common::HashMap<Common::String, Graphics::Surface *> ImagesMap;
|
||||
|
||||
friend class GUI::Dialog;
|
||||
friend class GUI::GuiObject;
|
||||
|
@ -150,12 +150,12 @@ public:
|
|||
|
||||
/// Widget background type
|
||||
enum WidgetBackground {
|
||||
kWidgetBackgroundNo, ///< No background at all
|
||||
kWidgetBackgroundPlain, ///< Simple background, this may not include borders
|
||||
kWidgetBackgroundBorder, ///< Same as kWidgetBackgroundPlain just with a border
|
||||
kWidgetBackgroundBorderSmall, ///< Same as kWidgetBackgroundPlain just with a small border
|
||||
kWidgetBackgroundEditText, ///< Background used for edit text fields
|
||||
kWidgetBackgroundSlider ///< Background used for sliders
|
||||
kWidgetBackgroundNo, ///< No background at all
|
||||
kWidgetBackgroundPlain, ///< Simple background, this may not include borders
|
||||
kWidgetBackgroundBorder, ///< Same as kWidgetBackgroundPlain just with a border
|
||||
kWidgetBackgroundBorderSmall, ///< Same as kWidgetBackgroundPlain just with a small border
|
||||
kWidgetBackgroundEditText, ///< Background used for edit text fields
|
||||
kWidgetBackgroundSlider ///< Background used for sliders
|
||||
};
|
||||
|
||||
/// Dialog background type
|
||||
|
@ -169,18 +169,18 @@ public:
|
|||
|
||||
/// State of the widget to be drawn
|
||||
enum State {
|
||||
kStateDisabled, ///< Indicates that the widget is disabled, that does NOT include that it is invisible
|
||||
kStateEnabled, ///< Indicates that the widget is enabled
|
||||
kStateHighlight ///< Indicates that the widget is highlighted by the user
|
||||
kStateDisabled, ///< Indicates that the widget is disabled, that does NOT include that it is invisible
|
||||
kStateEnabled, ///< Indicates that the widget is enabled
|
||||
kStateHighlight ///< Indicates that the widget is highlighted by the user
|
||||
};
|
||||
|
||||
typedef State WidgetStateInfo;
|
||||
|
||||
/// Text inversion state of the text to be draw
|
||||
enum TextInversionState {
|
||||
kTextInversionNone, ///< Indicates that the text should not be drawn inverted
|
||||
kTextInversion, ///< Indicates that the text should be drawn inverted, but not focused
|
||||
kTextInversionFocus ///< Indicates that the text should be drawn inverted, and focused
|
||||
kTextInversionNone, ///< Indicates that the text should not be drawn inverted
|
||||
kTextInversion, ///< Indicates that the text should be drawn inverted, but not focused
|
||||
kTextInversionFocus ///< Indicates that the text should be drawn inverted, and focused
|
||||
};
|
||||
|
||||
enum ScrollbarState {
|
||||
|
@ -193,34 +193,34 @@ public:
|
|||
|
||||
/// Font style selector
|
||||
enum FontStyle {
|
||||
kFontStyleBold = 0, ///< A bold font. This is also the default font.
|
||||
kFontStyleNormal = 1, ///< A normal font.
|
||||
kFontStyleItalic = 2, ///< Italic styled font.
|
||||
kFontStyleFixedNormal = 3, ///< Fixed size font.
|
||||
kFontStyleFixedBold = 4, ///< Fixed size bold font.
|
||||
kFontStyleFixedItalic = 5, ///< Fixed size italic font.
|
||||
kFontStyleTooltip = 6, ///< Tiny console font
|
||||
kFontStyleBold = 0, ///< A bold font. This is also the default font.
|
||||
kFontStyleNormal = 1, ///< A normal font.
|
||||
kFontStyleItalic = 2, ///< Italic styled font.
|
||||
kFontStyleFixedNormal = 3, ///< Fixed size font.
|
||||
kFontStyleFixedBold = 4, ///< Fixed size bold font.
|
||||
kFontStyleFixedItalic = 5, ///< Fixed size italic font.
|
||||
kFontStyleTooltip = 6, ///< Tiny console font
|
||||
kFontStyleMax
|
||||
};
|
||||
|
||||
/// Font color selector
|
||||
enum FontColor {
|
||||
kFontColorNormal = 0, ///< The default color of the theme
|
||||
kFontColorAlternate = 1, ///< Alternative font color
|
||||
kFontColorNormal = 0, ///< The default color of the theme
|
||||
kFontColorAlternate = 1, ///< Alternative font color
|
||||
kFontColorMax
|
||||
};
|
||||
|
||||
/// Function used to process areas other than the current dialog
|
||||
enum ShadingStyle {
|
||||
kShadingNone, ///< No special post processing
|
||||
kShadingDim, ///< Dimming unused areas
|
||||
kShadingLuminance ///< Converting colors to luminance for unused areas
|
||||
kShadingNone, ///< No special post processing
|
||||
kShadingDim, ///< Dimming unused areas
|
||||
kShadingLuminance ///< Converting colors to luminance for unused areas
|
||||
};
|
||||
|
||||
// Special image ids for images used in the GUI
|
||||
static const char * const kImageLogo; ///< ScummVM logo used in the launcher
|
||||
static const char * const kImageLogoSmall; ///< ScummVM logo used in the GMM
|
||||
static const char * const kImageSearch; ///< Search tool image used in the launcher
|
||||
static const char *const kImageLogo; ///< ScummVM logo used in the launcher
|
||||
static const char *const kImageLogoSmall; ///< ScummVM logo used in the GMM
|
||||
static const char *const kImageSearch; ///< Search tool image used in the launcher
|
||||
|
||||
/**
|
||||
* Graphics mode enumeration.
|
||||
|
@ -228,9 +228,9 @@ public:
|
|||
* surface.
|
||||
*/
|
||||
enum GraphicsMode {
|
||||
kGfxDisabled = 0, ///< No GFX
|
||||
kGfxStandard16bit, ///< 2BPP with the standard (aliased) renderer.
|
||||
kGfxAntialias16bit ///< 2BPP with the optimized AA renderer.
|
||||
kGfxDisabled = 0, ///< No GFX
|
||||
kGfxStandard16bit, ///< 2BPP with the standard (aliased) renderer.
|
||||
kGfxAntialias16bit ///< 2BPP with the optimized AA renderer.
|
||||
};
|
||||
|
||||
/** Constant value to expand dirty rectangles, to make sure they are fully copied */
|
||||
|
@ -265,20 +265,20 @@ public:
|
|||
void disable();
|
||||
|
||||
/**
|
||||
* Implementation of the GUI::Theme API. Called when a
|
||||
* new dialog is opened. Note that the boolean parameter
|
||||
* meaning has been changed.
|
||||
* Implementation of the GUI::Theme API. Called when a
|
||||
* new dialog is opened. Note that the boolean parameter
|
||||
* meaning has been changed.
|
||||
*
|
||||
* @param enableBuffering If set to true, buffering is enabled for
|
||||
* drawing this dialog, and will continue enabled
|
||||
* until disabled.
|
||||
* drawing this dialog, and will continue enabled
|
||||
* until disabled.
|
||||
*/
|
||||
void openDialog(bool enableBuffering, ShadingStyle shading = kShadingNone);
|
||||
|
||||
/**
|
||||
* The updateScreen() method is called every frame.
|
||||
* It processes all the drawing queues and then copies dirty rects
|
||||
* in the current Screen surface to the overlay.
|
||||
* The updateScreen() method is called every frame.
|
||||
* It processes all the drawing queues and then copies dirty rects
|
||||
* in the current Screen surface to the overlay.
|
||||
*/
|
||||
void updateScreen(bool render = true);
|
||||
|
||||
|
@ -309,35 +309,35 @@ public:
|
|||
//@{
|
||||
|
||||
void drawWidgetBackground(const Common::Rect &r, uint16 hints,
|
||||
WidgetBackground background = kWidgetBackgroundPlain, WidgetStateInfo state = kStateEnabled);
|
||||
WidgetBackground background = kWidgetBackgroundPlain, WidgetStateInfo state = kStateEnabled);
|
||||
|
||||
void drawButton(const Common::Rect &r, const Common::String &str,
|
||||
WidgetStateInfo state = kStateEnabled, uint16 hints = 0);
|
||||
WidgetStateInfo state = kStateEnabled, uint16 hints = 0);
|
||||
|
||||
void drawSurface(const Common::Rect &r, const Graphics::Surface &surface,
|
||||
WidgetStateInfo state = kStateEnabled, int alpha = 256, bool themeTrans = false);
|
||||
WidgetStateInfo state = kStateEnabled, int alpha = 256, bool themeTrans = false);
|
||||
|
||||
void drawSlider(const Common::Rect &r, int width,
|
||||
WidgetStateInfo state = kStateEnabled);
|
||||
WidgetStateInfo state = kStateEnabled);
|
||||
|
||||
void drawCheckbox(const Common::Rect &r, const Common::String &str,
|
||||
bool checked, WidgetStateInfo state = kStateEnabled);
|
||||
bool checked, WidgetStateInfo state = kStateEnabled);
|
||||
|
||||
void drawRadiobutton(const Common::Rect &r, const Common::String &str,
|
||||
bool checked, WidgetStateInfo state = kStateEnabled);
|
||||
bool checked, WidgetStateInfo state = kStateEnabled);
|
||||
|
||||
void drawTab(const Common::Rect &r, int tabHeight, int tabWidth,
|
||||
const Common::Array<Common::String> &tabs, int active, uint16 hints,
|
||||
int titleVPad, WidgetStateInfo state = kStateEnabled);
|
||||
const Common::Array<Common::String> &tabs, int active, uint16 hints,
|
||||
int titleVPad, WidgetStateInfo state = kStateEnabled);
|
||||
|
||||
void drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight,
|
||||
ScrollbarState, WidgetStateInfo state = kStateEnabled);
|
||||
ScrollbarState, WidgetStateInfo state = kStateEnabled);
|
||||
|
||||
void drawPopUpWidget(const Common::Rect &r, const Common::String &sel,
|
||||
int deltax, WidgetStateInfo state = kStateEnabled, Graphics::TextAlign align = Graphics::kTextAlignLeft);
|
||||
int deltax, WidgetStateInfo state = kStateEnabled, Graphics::TextAlign align = Graphics::kTextAlignLeft);
|
||||
|
||||
void drawCaret(const Common::Rect &r, bool erase,
|
||||
WidgetStateInfo state = kStateEnabled);
|
||||
WidgetStateInfo state = kStateEnabled);
|
||||
|
||||
void drawLineSeparator(const Common::Rect &r, WidgetStateInfo state = kStateEnabled);
|
||||
|
||||
|
@ -362,13 +362,13 @@ public:
|
|||
|
||||
|
||||
/**
|
||||
* Returns the DrawData enumeration value that represents the given string
|
||||
* in the DrawDataDefaults enumeration.
|
||||
* It's slow, but called sparsely.
|
||||
* Returns the DrawData enumeration value that represents the given string
|
||||
* in the DrawDataDefaults enumeration.
|
||||
* It's slow, but called sparsely.
|
||||
*
|
||||
* @returns The drawdata enum value, or -1 if not found.
|
||||
* @param name The representing name, as found on Theme Description XML files.
|
||||
* @see kDrawDataDefaults[]
|
||||
* @returns The drawdata enum value, or -1 if not found.
|
||||
* @param name The representing name, as found on Theme Description XML files.
|
||||
* @see kDrawDataDefaults[]
|
||||
*/
|
||||
DrawData parseDrawDataId(const Common::String &name) const;
|
||||
|
||||
|
@ -377,34 +377,34 @@ public:
|
|||
|
||||
|
||||
/**
|
||||
* Interface for ThemeParser class: Parsed DrawSteps are added via this function.
|
||||
* There is no return type because DrawSteps can always be added, unless something
|
||||
* goes horribly wrong.
|
||||
* The specified step will be added to the Steps list of the given DrawData id.
|
||||
* Interface for ThemeParser class: Parsed DrawSteps are added via this function.
|
||||
* There is no return type because DrawSteps can always be added, unless something
|
||||
* goes horribly wrong.
|
||||
* The specified step will be added to the Steps list of the given DrawData id.
|
||||
*
|
||||
* @param drawDataId The representing DrawData name, as found on Theme Description XML files.
|
||||
* @param step The actual DrawStep struct to be added.
|
||||
* @param drawDataId The representing DrawData name, as found on Theme Description XML files.
|
||||
* @param step The actual DrawStep struct to be added.
|
||||
*/
|
||||
void addDrawStep(const Common::String &drawDataId, const Graphics::DrawStep &step);
|
||||
|
||||
/**
|
||||
* Interface for the ThemeParser class: Parsed DrawData sets are added via this function.
|
||||
* The goal of the function is to initialize each DrawData set before their DrawSteps can
|
||||
* be added, hence this must be called for each DD set before addDrawStep() can be called
|
||||
* for that given set.
|
||||
* Interface for the ThemeParser class: Parsed DrawData sets are added via this function.
|
||||
* The goal of the function is to initialize each DrawData set before their DrawSteps can
|
||||
* be added, hence this must be called for each DD set before addDrawStep() can be called
|
||||
* for that given set.
|
||||
*
|
||||
* @param data The representing DrawData name, as found on Theme Description XML files.
|
||||
* @param cached Whether this DD set will be cached beforehand.
|
||||
* @param data The representing DrawData name, as found on Theme Description XML files.
|
||||
* @param cached Whether this DD set will be cached beforehand.
|
||||
*/
|
||||
bool addDrawData(const Common::String &data, bool cached);
|
||||
|
||||
|
||||
/**
|
||||
* Interface for the ThemeParser class: Loads a font to use on the GUI from the given
|
||||
* filename.
|
||||
* Interface for the ThemeParser class: Loads a font to use on the GUI from the given
|
||||
* filename.
|
||||
*
|
||||
* @param fontName Identifier name for the font.
|
||||
* @param file Name of the font file.
|
||||
* @param fontName Identifier name for the font.
|
||||
* @param file Name of the font file.
|
||||
*/
|
||||
bool addFont(TextData textId, const Common::String &file);
|
||||
|
||||
|
@ -418,25 +418,25 @@ public:
|
|||
|
||||
|
||||
/**
|
||||
* Interface for the ThemeParser class: Loads a bitmap file to use on the GUI.
|
||||
* The filename is also used as its identifier.
|
||||
* Interface for the ThemeParser class: Loads a bitmap file to use on the GUI.
|
||||
* The filename is also used as its identifier.
|
||||
*
|
||||
* @param filename Name of the bitmap file.
|
||||
* @param filename Name of the bitmap file.
|
||||
*/
|
||||
bool addBitmap(const Common::String &filename);
|
||||
|
||||
/**
|
||||
* Adds a new TextStep from the ThemeParser. This will be deprecated/removed once the
|
||||
* new Font API is in place. FIXME: Is that so ???
|
||||
* Adds a new TextStep from the ThemeParser. This will be deprecated/removed once the
|
||||
* new Font API is in place. FIXME: Is that so ???
|
||||
*/
|
||||
bool addTextData(const Common::String &drawDataId, TextData textId, TextColor id, Graphics::TextAlign alignH, TextAlignVertical alignV);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Returns if the Theme is ready to draw stuff on screen.
|
||||
* Must be called instead of just checking _initOk, because
|
||||
* this checks if the renderer is initialized AND if the theme
|
||||
* is loaded.
|
||||
* Returns if the Theme is ready to draw stuff on screen.
|
||||
* Must be called instead of just checking _initOk, because
|
||||
* this checks if the renderer is initialized AND if the theme
|
||||
* is loaded.
|
||||
*/
|
||||
bool ready() const {
|
||||
return _initOk && _themeOk;
|
||||
|
@ -446,15 +446,15 @@ protected:
|
|||
void loadTheme(const Common::String &themeid);
|
||||
|
||||
/**
|
||||
* Changes the active graphics mode of the GUI; may be used to either
|
||||
* initialize the GUI or to change the mode while the GUI is already running.
|
||||
* Changes the active graphics mode of the GUI; may be used to either
|
||||
* initialize the GUI or to change the mode while the GUI is already running.
|
||||
*/
|
||||
void setGraphicsMode(GraphicsMode mode);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Finishes buffering: widgets from then on will be drawn straight on the screen
|
||||
* without drawing queues.
|
||||
* Finishes buffering: widgets from then on will be drawn straight on the screen
|
||||
* without drawing queues.
|
||||
*/
|
||||
inline void finishBuffering() { _buffering = false; }
|
||||
inline void startBuffering() { _buffering = true; }
|
||||
|
@ -474,21 +474,21 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Interface for the Theme Parser: Creates a new cursor by loading the given
|
||||
* bitmap and sets it as the active cursor.
|
||||
* Interface for the Theme Parser: Creates a new cursor by loading the given
|
||||
* bitmap and sets it as the active cursor.
|
||||
*
|
||||
* @param filename File name of the bitmap to load.
|
||||
* @param hotspotX X Coordinate of the bitmap which does the cursor click.
|
||||
* @param hotspotY Y Coordinate of the bitmap which does the cursor click.
|
||||
* @param scale Scale at which the bitmap is supposed to be used.
|
||||
* @param filename File name of the bitmap to load.
|
||||
* @param hotspotX X Coordinate of the bitmap which does the cursor click.
|
||||
* @param hotspotY Y Coordinate of the bitmap which does the cursor click.
|
||||
* @param scale Scale at which the bitmap is supposed to be used.
|
||||
*/
|
||||
bool createCursor(const Common::String &filename, int hotspotX, int hotspotY, int scale);
|
||||
|
||||
/**
|
||||
* Wrapper for restoring data from the Back Buffer to the screen.
|
||||
* The actual processing is done in the VectorRenderer.
|
||||
* Wrapper for restoring data from the Back Buffer to the screen.
|
||||
* The actual processing is done in the VectorRenderer.
|
||||
*
|
||||
* @param r Area to restore.
|
||||
* @param r Area to restore.
|
||||
*/
|
||||
void restoreBackground(Common::Rect r);
|
||||
|
||||
|
@ -498,33 +498,33 @@ public:
|
|||
|
||||
protected:
|
||||
/**
|
||||
* Initializes the drawing screen surfaces, _screen and _backBuffer.
|
||||
* If the surfaces already exist, they are cleared and re-initialized.
|
||||
* Initializes the drawing screen surfaces, _screen and _backBuffer.
|
||||
* If the surfaces already exist, they are cleared and re-initialized.
|
||||
*
|
||||
* @param backBuffer Sets whether the _backBuffer surface should be initialized.
|
||||
* @template PixelType C type which specifies the size of each pixel.
|
||||
* Defaults to uint16 (2 BPP for the surfaces)
|
||||
* @param backBuffer Sets whether the _backBuffer surface should be initialized.
|
||||
* @template PixelType C type which specifies the size of each pixel.
|
||||
* Defaults to uint16 (2 BPP for the surfaces)
|
||||
*/
|
||||
template<typename PixelType> void screenInit(bool backBuffer = true);
|
||||
|
||||
/**
|
||||
* Loads the given theme into the ThemeEngine.
|
||||
* Loads the given theme into the ThemeEngine.
|
||||
*
|
||||
* @param themeId Theme identifier.
|
||||
* @returns true if the theme was successfully loaded.
|
||||
* @param themeId Theme identifier.
|
||||
* @returns true if the theme was successfully loaded.
|
||||
*/
|
||||
bool loadThemeXML(const Common::String &themeId);
|
||||
|
||||
/**
|
||||
* Loads the default theme file (the embedded XML file found
|
||||
* in ThemeDefaultXML.cpp).
|
||||
* Called only when no other themes are available.
|
||||
* Loads the default theme file (the embedded XML file found
|
||||
* in ThemeDefaultXML.cpp).
|
||||
* Called only when no other themes are available.
|
||||
*/
|
||||
bool loadDefaultXML();
|
||||
|
||||
/**
|
||||
* Unloads the currently loaded theme so another one can
|
||||
* be loaded.
|
||||
* Unloads the currently loaded theme so another one can
|
||||
* be loaded.
|
||||
*/
|
||||
void unloadTheme();
|
||||
|
||||
|
@ -535,31 +535,31 @@ protected:
|
|||
Common::String genLocalizedFontFilename(const Common::String &filename) const;
|
||||
|
||||
/**
|
||||
* Actual Dirty Screen handling function.
|
||||
* Handles all the dirty squares in the list, merges and optimizes
|
||||
* them when possible and draws them to the screen.
|
||||
* Called from updateScreen()
|
||||
* Actual Dirty Screen handling function.
|
||||
* Handles all the dirty squares in the list, merges and optimizes
|
||||
* them when possible and draws them to the screen.
|
||||
* Called from updateScreen()
|
||||
*/
|
||||
void renderDirtyScreen();
|
||||
|
||||
/**
|
||||
* Generates a DrawQueue item and enqueues it so it's drawn to the screen
|
||||
* when the drawing queue is processed.
|
||||
* Generates a DrawQueue item and enqueues it so it's drawn to the screen
|
||||
* when the drawing queue is processed.
|
||||
*
|
||||
* If Buffering is enabled, the DrawQueue item will be automatically placed
|
||||
* on its corresponding queue.
|
||||
* If Buffering is disabled, the DrawQueue item will be processed immediately
|
||||
* and drawn to the screen.
|
||||
* If Buffering is enabled, the DrawQueue item will be automatically placed
|
||||
* on its corresponding queue.
|
||||
* If Buffering is disabled, the DrawQueue item will be processed immediately
|
||||
* and drawn to the screen.
|
||||
*
|
||||
* This function is called from all the Widget Drawing methods.
|
||||
* This function is called from all the Widget Drawing methods.
|
||||
*/
|
||||
void queueDD(DrawData type, const Common::Rect &r, uint32 dynamic = 0, bool restore = false);
|
||||
void queueDDText(TextData type, TextColor color, const Common::Rect &r, const Common::String &text, bool restoreBg,
|
||||
bool elipsis, Graphics::TextAlign alignH = Graphics::kTextAlignLeft, TextAlignVertical alignV = kTextAlignVTop, int deltax = 0);
|
||||
bool elipsis, Graphics::TextAlign alignH = Graphics::kTextAlignLeft, TextAlignVertical alignV = kTextAlignVTop, int deltax = 0);
|
||||
void queueBitmap(const Graphics::Surface *bitmap, const Common::Rect &r, bool alpha);
|
||||
|
||||
/**
|
||||
* DEBUG: Draws a white square and writes some text next to it.
|
||||
* DEBUG: Draws a white square and writes some text next to it.
|
||||
*/
|
||||
void debugWidgetPosition(const char *name, const Common::Rect &r);
|
||||
|
||||
|
@ -603,7 +603,7 @@ protected:
|
|||
Graphics::Surface _backBuffer;
|
||||
|
||||
/** Sets whether the current drawing is being buffered (stored for later
|
||||
processing) or drawn directly to the screen. */
|
||||
processing) or drawn directly to the screen. */
|
||||
bool _buffering;
|
||||
|
||||
/** Bytes per pixel of the Active Drawing Surface (i.e. the screen) */
|
||||
|
@ -643,7 +643,7 @@ protected:
|
|||
/** Queue with all the drawing that must be done to the screen */
|
||||
Common::List<ThemeItem *> _screenQueue;
|
||||
|
||||
bool _initOk; ///< Class and renderer properly initialized
|
||||
bool _initOk; ///< Class and renderer properly initialized
|
||||
bool _themeOk; ///< Theme data successfully loaded.
|
||||
bool _enabled; ///< Whether the Theme is currently shown on the overlay
|
||||
|
||||
|
@ -661,7 +661,7 @@ protected:
|
|||
byte *_cursor;
|
||||
bool _needPaletteUpdates;
|
||||
uint _cursorWidth, _cursorHeight;
|
||||
byte _cursorPal[3*MAX_CURS_COLORS];
|
||||
byte _cursorPal[3 * MAX_CURS_COLORS];
|
||||
byte _cursorPalSize;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue