ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

#include <ThemeEngine.h>

Collaboration diagram for GUI::ThemeEngine:

List of all members.

Classes

struct  Renderer
struct  ThemeDescriptor

Public Types

enum  TextAlignVertical { kTextAlignVInvalid, kTextAlignVBottom, kTextAlignVCenter, kTextAlignVTop }
 

Vertical alignment of the text.

More...
enum  WidgetBackground {
  kWidgetBackgroundNo, kWidgetBackgroundPlain, kWidgetBackgroundBorder, kWidgetBackgroundBorderSmall,
  kWidgetBackgroundEditText, kWidgetBackgroundSlider
}
 

Widget background type.

More...
enum  DialogBackground {
  kDialogBackgroundMain, kDialogBackgroundSpecial, kDialogBackgroundPlain, kDialogBackgroundTooltip,
  kDialogBackgroundDefault, kDialogBackgroundNone
}
 

Dialog background type.

More...
enum  State { kStateDisabled, kStateEnabled, kStateHighlight, kStatePressed }
 

State of the widget to be drawn.

More...
enum  TextInversionState { kTextInversionNone, kTextInversion, kTextInversionFocus }
 

Text inversion state of the text to be draw.

More...
enum  ScrollbarState {
  kScrollbarStateNo, kScrollbarStateUp, kScrollbarStateDown, kScrollbarStateSlider,
  kScrollbarStateSinglePage
}
enum  FontStyle {
  kFontStyleBold = 0, kFontStyleNormal = 1, kFontStyleItalic = 2, kFontStyleFixedNormal = 3,
  kFontStyleFixedBold = 4, kFontStyleFixedItalic = 5, kFontStyleTooltip = 6, kFontStyleConsole = 7,
  kFontStyleMax
}
 

Font style selector.

More...
enum  FontColor { kFontColorNormal = 0, kFontColorAlternate = 1, kFontColorMax }
 

Font color selector.

More...
enum  ShadingStyle { kShadingNone, kShadingDim, kShadingLuminance }
 

Function used to process areas other than the current dialog.

More...
enum  AutoScaleMode { kAutoScaleNone = 0, kAutoScaleStretch = 1, kAutoScaleFit = 2, kAutoScaleNinePatch = 3 }
 

AlphaBitmap scale mode selector.

More...
enum  GraphicsMode { kGfxDisabled = 0, kGfxStandard, kGfxAntialias }
 

Graphics mode enumeration.

More...
typedef State WidgetStateInfo

Public Member Functions

 ThemeEngine (Common::String id, GraphicsMode mode)
 Default constructor.
 ~ThemeEngine ()
 Default destructor.
bool init ()
void clearAll ()
void refresh ()
void enable ()
void showCursor ()
void hideCursor ()
void disable ()
const Graphics::PixelFormat getPixelFormat () const
 Query the set up pixel format.
void applyScreenShading (ShadingStyle shading)
 Draw full screen shading with the supplied style.
void drawToBackbuffer ()
 Sets the active drawing surface to the back buffer.
void drawToScreen ()
 Sets the active drawing surface to the screen.
void updateScreen ()
 The updateScreen() method is called every frame.
void copyBackBufferToScreen ()
 Copy the entire backbuffer surface to the screen surface.
Common::Rect swapClipRect (const Common::Rect &newRect)
 Set the clipping rect to be used by the widget drawing methods defined below.
void addDirtyRect (Common::Rect r)
 Actual implementation of a dirty rect handling.
DrawData parseDrawDataId (const Common::String &name) const
 Returns the DrawData enumeration value that represents the given string in the DrawDataDefaults enumeration.
TextData getTextData (DrawData ddId) const
TextColor getTextColor (DrawData ddId) const
void addDrawStep (const Common::String &drawDataId, const Graphics::DrawStep &step)
 Interface for ThemeParser class: Parsed DrawSteps are added via this function.
bool addDrawData (const Common::String &data, bool cached)
 Interface for the ThemeParser class: Parsed DrawData sets are added via this function.
bool addFont (TextData textId, const Common::String &file, const Common::String &scalableFile, const int pointsize)
 Interface for the ThemeParser class: Loads a font to use on the GUI from the given filename.
bool addTextColor (TextColor colorId, int r, int g, int b)
 Interface for the ThemeParser class: adds a text color value.
bool addBitmap (const Common::String &filename)
 Interface for the ThemeParser class: Loads a bitmap file to use on the GUI.
bool addAlphaBitmap (const Common::String &filename)
 Interface for the ThemeParser class: Loads a bitmap with transparency file to use on the GUI.
bool addTextData (const Common::String &drawDataId, TextData textId, TextColor id, Graphics::TextAlign alignH, TextAlignVertical alignV)
 Adds a new TextStep from the ThemeParser.
ThemeEvalgetEvaluator ()
Graphics::VectorRendererrenderer ()
bool supportsImages () const
bool ownCursor () const
Graphics::SurfacegetBitmap (const Common::String &name)
Graphics::TransparentSurfacegetAlphaBitmap (const Common::String &name)
const Graphics::SurfacegetImageSurface (const Common::String &name) const
const
Graphics::TransparentSurface
getAImageSurface (const Common::String &name) const
bool createCursor (const Common::String &filename, int hotspotX, int hotspotY)
 Interface for the Theme Parser: Creates a new cursor by loading the given bitmap and sets it as the active cursor.
void restoreBackground (Common::Rect r)
 Wrapper for restoring data from the Back Buffer to the screen.
const Common::StringgetThemeName () const
const Common::StringgetThemeId () const
int getGraphicsMode () const
FONT MANAGEMENT METHODS

TextData fontStyleToData (FontStyle font) const
const Graphics::FontgetFont (FontStyle font=kFontStyleBold) const
int getFontHeight (FontStyle font=kFontStyleBold) const
int getStringWidth (const Common::String &str, FontStyle font=kFontStyleBold) const
int getCharWidth (byte c, FontStyle font=kFontStyleBold) const
int getKerningOffset (byte left, byte right, FontStyle font=kFontStyleBold) const
WIDGET DRAWING METHODS

void drawWidgetBackground (const Common::Rect &r, uint16 hints, WidgetBackground background=kWidgetBackgroundPlain)
void drawButton (const Common::Rect &r, const Common::String &str, WidgetStateInfo state=kStateEnabled, uint16 hints=0)
void drawSurface (const Common::Rect &r, const Graphics::Surface &surface, bool themeTrans=false)
void drawSlider (const Common::Rect &r, int width, WidgetStateInfo state=kStateEnabled)
void drawCheckbox (const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state=kStateEnabled)
void drawRadiobutton (const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state=kStateEnabled)
void drawTab (const Common::Rect &r, int tabHeight, const Common::Array< int > &tabWidths, const Common::Array< Common::String > &tabs, int active)
void drawScrollbar (const Common::Rect &r, int sliderY, int sliderHeight, ScrollbarState scrollState)
void drawPopUpWidget (const Common::Rect &r, const Common::String &sel, int deltax, WidgetStateInfo state=kStateEnabled)
void drawCaret (const Common::Rect &r, bool erase)
void drawLineSeparator (const Common::Rect &r)
void drawDialogBackground (const Common::Rect &r, DialogBackground type)
void drawText (const Common::Rect &r, const Common::String &str, WidgetStateInfo state=kStateEnabled, Graphics::TextAlign align=Graphics::kTextAlignCenter, TextInversionState inverted=kTextInversionNone, int deltax=0, bool useEllipsis=true, FontStyle font=kFontStyleBold, FontColor color=kFontColorNormal, bool restore=true, const Common::Rect &drawableTextArea=Common::Rect(0, 0, 0, 0))
void drawChar (const Common::Rect &r, byte ch, const Graphics::Font *font, FontColor color=kFontColorNormal)

Static Public Member Functions

static GraphicsMode findMode (const Common::String &cfg)
static const char * findModeConfigName (GraphicsMode mode)
static void listUsableThemes (Common::List< ThemeDescriptor > &list)
 Lists all theme files useable.

Static Public Attributes

static const char *const kImageLogo = "logo.bmp"
 ScummVM logo used in the launcher.
static const char *const kImageLogoSmall = "logo_small.bmp"
 ScummVM logo used in the GMM.
static const char *const kImageSearch = "search.bmp"
 Search tool image used in the launcher.
static const char *const kImageEraser = "eraser.bmp"
 Clear input image used in the launcher.
static const char *const kImageDelButton = "delbtn.bmp"
 Delete characters in the predictive dialog.
static const char *const kImageList = "list.bmp"
 List image used in save/load chooser selection.
static const char *const kImageGrid = "grid.bmp"
 Grid image used in save/load chooser selection.
static const char *const kImageStopButton = "stopbtn.bmp"
 Stop recording button in recorder onscreen dialog.
static const char *const kImageEditButton = "editbtn.bmp"
 Edit recording metadata in recorder onscreen dialog.
static const char *const kImageSwitchModeButton = "switchbtn.bmp"
 Switch mode button in recorder onscreen dialog.
static const char *const kImageFastReplayButton = "fastreplay.bmp"
 Fast playback mode button in recorder onscreen dialog.
static const char *const kImageStopSmallButton = "stopbtn_small.bmp"
 Stop recording button in recorder onscreen dialog (for 320xY).
static const char *const kImageEditSmallButton = "editbtn_small.bmp"
 Edit recording metadata in recorder onscreen dialog (for 320xY).
static const char *const kImageSwitchModeSmallButton = "switchbtn_small.bmp"
 Switch mode button in recorder onscreen dialog (for 320xY).
static const char *const kImageFastReplaySmallButton = "fastreplay_small.bmp"
 Fast playback mode button in recorder onscreen dialog (for 320xY).
static const char *const kImageDropboxLogo = "dropbox.bmp"
 Dropbox logo used in the StorageWizardDialog.
static const char *const kImageOneDriveLogo = "onedrive.bmp"
 OneDrive logo used in the StorageWizardDialog.
static const char *const kImageGoogleDriveLogo = "googledrive.bmp"
 Google Drive logo used in the StorageWizardDialog.
static const char *const kImageBoxLogo = "box.bmp"
 Box logo used in the StorageWizardDialog.
static const int kDirtyRectangleThreshold = 1
 Constant value to expand dirty rectangles, to make sure they are fully copied.
static const Renderer _rendererModes []
static const uint _rendererModesSize = ARRAYSIZE(ThemeEngine::_rendererModes)
static const GraphicsMode _defaultRendererMode

Protected Types

enum  { MAX_CURS_COLORS = 255 }
typedef Common::HashMap
< Common::String,
Graphics::Surface * > 
ImagesMap
typedef Common::HashMap
< Common::String,
Graphics::TransparentSurface * > 
AImagesMap

Protected Member Functions

bool ready () const
 Returns if the Theme is ready to draw stuff on screen.
void loadTheme (const Common::String &themeid)
 Load the them from the file with the specified name.
void setGraphicsMode (GraphicsMode mode)
 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.
bool loadThemeXML (const Common::String &themeId)
 Loads the given theme into the ThemeEngine.
bool loadDefaultXML ()
 Loads the default theme file (the embedded XML file found in ThemeDefaultXML.cpp).
void unloadTheme ()
 Unloads the currently loaded theme so another one can be loaded.
const Graphics::FontloadScalableFont (const Common::String &filename, const Common::String &charset, const int pointsize, Common::String &name)
const Graphics::FontloadFont (const Common::String &filename, Common::String &name)
Common::String genCacheFilename (const Common::String &filename) const
const Graphics::FontloadFont (const Common::String &filename, const Common::String &scalableFilename, const Common::String &charset, const int pointsize, const bool makeLocalizedFont)
void updateDirtyScreen ()
 Dirty Screen handling function.
void drawDD (DrawData type, const Common::Rect &r, uint32 dynamic=0, bool forceRestore=false)
 Draws a GUI element according to a DrawData descriptor.
void drawDDText (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, const Common::Rect &drawableTextArea=Common::Rect(0, 0, 0, 0))
void drawBitmap (const Graphics::Surface *bitmap, const Common::Rect &clippingRect, bool alpha)
void debugWidgetPosition (const char *name, const Common::Rect &r)
 DEBUG: Draws a white square and writes some text next to it.

Protected Attributes

OSystem_system
Graphics::VectorRenderer_vectorRenderer
 Global system object.
GUI::ThemeParser_parser
 XML Parser, does the Theme parsing instead of the default parser.
GUI::ThemeEval_themeEval
 Theme getEvaluator (changed from GUI::Eval to add functionality).
Graphics::TransparentSurface _screen
 Main screen surface.
Graphics::TransparentSurface _backBuffer
 Backbuffer surface.
DrawLayer _layerToDraw
 Filter the submitted DrawData descriptors according to their layer attribute.
int _bytesPerPixel
 Bytes per pixel of the Active Drawing Surface (i.e.
GraphicsMode _graphicsMode
 Current graphics mode.
const Graphics::Font_font
 Font info.
WidgetDrawData_widgets [kDrawDataMAX]
 Array of all the DrawData elements than can be drawn to the screen.
TextDrawData_texts [kTextDataMAX]
 Array of all the text fonts that can be drawn.
TextColorData_textColors [kTextColorMAX]
 Array of all font colors available.
ImagesMap _bitmaps
AImagesMap _abitmaps
Graphics::PixelFormat _overlayFormat
Graphics::PixelFormat _cursorFormat
Common::List< Common::Rect_dirtyScreen
 List of all the dirty screens that must be blitted to the overlay.
bool _initOk
 Class and renderer properly initialized.
bool _themeOk
 Theme data successfully loaded.
bool _enabled
 Whether the Theme is currently shown on the overlay.
Common::String _themeName
 Name of the currently loaded theme.
Common::String _themeId
Common::String _themeFile
Common::Archive_themeArchive
Common::SearchSet _themeFiles
bool _useCursor
int _cursorHotspotX
int _cursorHotspotY
byte_cursor
uint _cursorWidth
uint _cursorHeight
byte _cursorPal [3 *MAX_CURS_COLORS]
byte _cursorPalSize
Common::Rect _clip

Static Private Member Functions

static bool themeConfigUsable (const Common::FSNode &node, Common::String &themeName)
static bool themeConfigUsable (const Common::ArchiveMember &member, Common::String &themeName)
static bool themeConfigParseHeader (Common::String header, Common::String &themeName)
static Common::String getThemeFile (const Common::String &id)
static Common::String getThemeId (const Common::String &filename)
static void listUsableThemes (const Common::FSNode &node, Common::List< ThemeDescriptor > &list, int depth=-1)
static void listUsableThemes (Common::Archive &archive, Common::List< ThemeDescriptor > &list)

Friends

class GUI::Dialog
class GUI::GuiObject

Detailed Description

Definition at line 153 of file ThemeEngine.h.


Member Typedef Documentation

Definition at line 198 of file ThemeEngine.h.


Member Enumeration Documentation

anonymous enum [protected]
Enumerator:
MAX_CURS_COLORS 

Definition at line 737 of file ThemeEngine.h.

AlphaBitmap scale mode selector.

Enumerator:
kAutoScaleNone 

Use image dimensions.

kAutoScaleStretch 

Stretch image to full widget size.

kAutoScaleFit 

Scale image to widget size but keep aspect ratio.

kAutoScaleNinePatch 

9-patch image

Definition at line 243 of file ThemeEngine.h.

Dialog background type.

Enumerator:
kDialogBackgroundMain 
kDialogBackgroundSpecial 
kDialogBackgroundPlain 
kDialogBackgroundTooltip 
kDialogBackgroundDefault 
kDialogBackgroundNone 

Definition at line 181 of file ThemeEngine.h.

Font color selector.

Enumerator:
kFontColorNormal 

The default color of the theme.

kFontColorAlternate 

Alternative font color.

kFontColorMax 

Definition at line 229 of file ThemeEngine.h.

Font style selector.

Enumerator:
kFontStyleBold 

A bold font. This is also the default font.

kFontStyleNormal 

A normal font.

kFontStyleItalic 

Italic styled font.

kFontStyleFixedNormal 

Fixed size font.

kFontStyleFixedBold 

Fixed size bold font.

kFontStyleFixedItalic 

Fixed size italic font.

kFontStyleTooltip 

Tiny console font.

kFontStyleConsole 

Debug console font.

kFontStyleMax 

Definition at line 216 of file ThemeEngine.h.

Graphics mode enumeration.

Each item represents a set of BPP and Renderer modes for a given surface.

Enumerator:
kGfxDisabled 

No GFX.

kGfxStandard 

Standard (aliased) renderer.

kGfxAntialias 

Optimized AA renderer.

Definition at line 276 of file ThemeEngine.h.

Enumerator:
kScrollbarStateNo 
kScrollbarStateUp 
kScrollbarStateDown 
kScrollbarStateSlider 
kScrollbarStateSinglePage 

Definition at line 207 of file ThemeEngine.h.

Function used to process areas other than the current dialog.

Enumerator:
kShadingNone 

No special post processing.

kShadingDim 

Dimming unused areas.

kShadingLuminance 

Converting colors to luminance for unused areas.

Definition at line 236 of file ThemeEngine.h.

State of the widget to be drawn.

Enumerator:
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.

kStatePressed 

Indicates that the widget is pressed, currently works for buttons.

Definition at line 191 of file ThemeEngine.h.

Vertical alignment of the text.

Enumerator:
kTextAlignVInvalid 
kTextAlignVBottom 
kTextAlignVCenter 
kTextAlignVTop 

Definition at line 163 of file ThemeEngine.h.

Text inversion state of the text to be draw.

Enumerator:
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.

Definition at line 201 of file ThemeEngine.h.

Widget background type.

Enumerator:
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.

Definition at line 171 of file ThemeEngine.h.


Constructor & Destructor Documentation

GUI::ThemeEngine::ThemeEngine ( Common::String  id,
GraphicsMode  mode 
)

Default constructor.

Definition at line 172 of file ThemeEngine.cpp.

GUI::ThemeEngine::~ThemeEngine (  ) 

Default destructor.

Definition at line 218 of file ThemeEngine.cpp.


Member Function Documentation

bool GUI::ThemeEngine::addAlphaBitmap ( const Common::String filename  ) 

Interface for the ThemeParser class: Loads a bitmap with transparency file to use on the GUI.

The filename is also used as its identifier.

Parameters:
filename Name of the bitmap file.

Definition at line 630 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::addBitmap ( const Common::String filename  ) 

Interface for the ThemeParser class: Loads a bitmap file to use on the GUI.

The filename is also used as its identifier.

Parameters:
filename Name of the bitmap file.

Definition at line 572 of file ThemeEngine.cpp.

void GUI::ThemeEngine::addDirtyRect ( Common::Rect  r  ) 

Actual implementation of a dirty rect handling.

Dirty rectangles are queued on a list, merged and optimized when possible and are later used for the actual drawing.

Parameters:
r Area of the dirty rect.

Definition at line 1300 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::addDrawData ( const Common::String data,
bool  cached 
)

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.

Parameters:
data The representing DrawData name, as found on Theme Description XML files.
cached Whether this DD set will be cached beforehand.

Definition at line 674 of file ThemeEngine.cpp.

void GUI::ThemeEngine::addDrawStep ( const Common::String drawDataId,
const Graphics::DrawStep step 
)

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.

Parameters:
drawDataId The representing DrawData name, as found on Theme Description XML files.
step The actual DrawStep struct to be added.

Definition at line 485 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::addFont ( TextData  textId,
const Common::String file,
const Common::String scalableFile,
const int  pointsize 
)

Interface for the ThemeParser class: Loads a font to use on the GUI from the given filename.

Parameters:
textId Identifier name for the font.
file Filename of the non-scalable font version.
scalableFile Filename of the scalable version. (Optional)
pointsize Point size for the scalable font. (Optional)

Definition at line 506 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::addTextColor ( TextColor  colorId,
int  r,
int  g,
int  b 
)

Interface for the ThemeParser class: adds a text color value.

Parameters:
colorId Identifier for the color type.
r,g,b Color of the font.

Definition at line 556 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::addTextData ( const Common::String drawDataId,
TextData  textId,
TextColor  id,
Graphics::TextAlign  alignH,
TextAlignVertical  alignV 
)

Adds a new TextStep from the ThemeParser.

This will be deprecated/removed once the new Font API is in place. FIXME: Is that so ???

Definition at line 492 of file ThemeEngine.cpp.

void GUI::ThemeEngine::applyScreenShading ( ShadingStyle  shading  ) 

Draw full screen shading with the supplied style.

This is used to dim the inactive dialogs so the active one stands out.

Definition at line 1340 of file ThemeEngine.cpp.

void GUI::ThemeEngine::clearAll (  ) 

Definition at line 350 of file ThemeEngine.cpp.

void GUI::ThemeEngine::copyBackBufferToScreen (  ) 

Copy the entire backbuffer surface to the screen surface.

Definition at line 1286 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::createCursor ( const Common::String filename,
int  hotspotX,
int  hotspotY 
)

Interface for the Theme Parser: Creates a new cursor by loading the given bitmap and sets it as the active cursor.

Parameters:
filename File name of the bitmap to load.
hotspotX X Coordinate of the bitmap which does the cursor click.
hotspotY Y Coordinate of the bitmap which does the cursor click.

Definition at line 1347 of file ThemeEngine.cpp.

void GUI::ThemeEngine::debugWidgetPosition ( const char *  name,
const Common::Rect r 
) [protected]

DEBUG: Draws a white square and writes some text next to it.

Definition at line 1275 of file ThemeEngine.cpp.

void GUI::ThemeEngine::disable (  ) 

Definition at line 403 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawBitmap ( const Graphics::Surface bitmap,
const Common::Rect clippingRect,
bool  alpha 
) [protected]

Definition at line 909 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawButton ( const Common::Rect r,
const Common::String str,
WidgetStateInfo  state = kStateEnabled,
uint16  hints = 0 
)

Definition at line 929 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawCaret ( const Common::Rect r,
bool  erase 
)

Definition at line 1085 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawChar ( const Common::Rect r,
byte  ch,
const Graphics::Font font,
FontColor  color = kFontColorNormal 
)

Definition at line 1259 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawCheckbox ( const Common::Rect r,
const Common::String str,
bool  checked,
WidgetStateInfo  state = kStateEnabled 
)

Definition at line 956 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawDD ( DrawData  type,
const Common::Rect r,
uint32  dynamic = 0,
bool  forceRestore = false 
) [protected]

Draws a GUI element according to a DrawData descriptor.

Only calls with a DrawData layer attribute matching the active layer are actually drawn to the active surface.

These functions are called from all the Widget drawing methods.

Definition at line 843 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawDDText ( 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,
const Common::Rect drawableTextArea = Common::Rect(0, 0, 0, 0) 
) [protected]

Definition at line 879 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawDialogBackground ( const Common::Rect r,
DialogBackground  type 
)

Definition at line 1055 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawLineSeparator ( const Common::Rect r  ) 

Definition at line 949 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawPopUpWidget ( const Common::Rect r,
const Common::String sel,
int  deltax,
WidgetStateInfo  state = kStateEnabled 
)

Definition at line 1095 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawRadiobutton ( const Common::Rect r,
const Common::String str,
bool  checked,
WidgetStateInfo  state = kStateEnabled 
)

Definition at line 983 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawScrollbar ( const Common::Rect r,
int  sliderY,
int  sliderHeight,
ScrollbarState  scrollState 
)

Definition at line 1030 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawSlider ( const Common::Rect r,
int  width,
WidgetStateInfo  state = kStateEnabled 
)

Definition at line 1010 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawSurface ( const Common::Rect r,
const Graphics::Surface surface,
bool  themeTrans = false 
)

Definition at line 1117 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawTab ( const Common::Rect r,
int  tabHeight,
const Common::Array< int > &  tabWidths,
const Common::Array< Common::String > &  tabs,
int  active 
)

Definition at line 1147 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawText ( const Common::Rect r,
const Common::String str,
WidgetStateInfo  state = kStateEnabled,
Graphics::TextAlign  align = Graphics::kTextAlignCenter,
TextInversionState  inverted = kTextInversionNone,
int  deltax = 0,
bool  useEllipsis = true,
FontStyle  font = kFontStyleBold,
FontColor  color = kFontColorNormal,
bool  restore = true,
const Common::Rect drawableTextArea = Common::Rect(0, 0, 0, 0) 
)

Definition at line 1184 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawToBackbuffer (  ) 

Sets the active drawing surface to the back buffer.

All drawing from this point on will be done on that surface. The back buffer surface needs to be copied to the screen surface in order to become visible.

Definition at line 1887 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawToScreen (  ) 

Sets the active drawing surface to the screen.

All drawing from this point on will be done on that surface.

Definition at line 1891 of file ThemeEngine.cpp.

void GUI::ThemeEngine::drawWidgetBackground ( const Common::Rect r,
uint16  hints,
WidgetBackground  background = kWidgetBackgroundPlain 
)

Definition at line 1124 of file ThemeEngine.cpp.

void GUI::ThemeEngine::enable (  ) 

Definition at line 392 of file ThemeEngine.cpp.

ThemeEngine::GraphicsMode GUI::ThemeEngine::findMode ( const Common::String cfg  )  [static]

Definition at line 272 of file ThemeEngine.cpp.

const char * GUI::ThemeEngine::findModeConfigName ( GraphicsMode  mode  )  [static]

Definition at line 281 of file ThemeEngine.cpp.

TextData GUI::ThemeEngine::fontStyleToData ( FontStyle  font  )  const [inline]

Definition at line 361 of file ThemeEngine.h.

Common::String GUI::ThemeEngine::genCacheFilename ( const Common::String filename  )  const [protected]

Definition at line 1570 of file ThemeEngine.cpp.

const Graphics::TransparentSurface* GUI::ThemeEngine::getAImageSurface ( const Common::String name  )  const [inline]

Definition at line 567 of file ThemeEngine.h.

Graphics::TransparentSurface* GUI::ThemeEngine::getAlphaBitmap ( const Common::String name  )  [inline]

Definition at line 559 of file ThemeEngine.h.

Graphics::Surface* GUI::ThemeEngine::getBitmap ( const Common::String name  )  [inline]

Definition at line 555 of file ThemeEngine.h.

int GUI::ThemeEngine::getCharWidth ( byte  c,
FontStyle  font = kFontStyleBold 
) const

Definition at line 1447 of file ThemeEngine.cpp.

ThemeEval* GUI::ThemeEngine::getEvaluator (  )  [inline]

Definition at line 549 of file ThemeEngine.h.

const Graphics::Font * GUI::ThemeEngine::getFont ( FontStyle  font = kFontStyleBold  )  const

Definition at line 1435 of file ThemeEngine.cpp.

int GUI::ThemeEngine::getFontHeight ( FontStyle  font = kFontStyleBold  )  const

Definition at line 1439 of file ThemeEngine.cpp.

int GUI::ThemeEngine::getGraphicsMode (  )  const [inline]

Definition at line 591 of file ThemeEngine.h.

const Graphics::Surface* GUI::ThemeEngine::getImageSurface ( const Common::String name  )  const [inline]

Definition at line 563 of file ThemeEngine.h.

int GUI::ThemeEngine::getKerningOffset ( byte  left,
byte  right,
FontStyle  font = kFontStyleBold 
) const

Definition at line 1451 of file ThemeEngine.cpp.

const Graphics::PixelFormat GUI::ThemeEngine::getPixelFormat (  )  const [inline]

Query the set up pixel format.

Definition at line 321 of file ThemeEngine.h.

int GUI::ThemeEngine::getStringWidth ( const Common::String str,
FontStyle  font = kFontStyleBold 
) const

Definition at line 1443 of file ThemeEngine.cpp.

TextColor GUI::ThemeEngine::getTextColor ( DrawData  ddId  )  const

Definition at line 1459 of file ThemeEngine.cpp.

TextData GUI::ThemeEngine::getTextData ( DrawData  ddId  )  const

Definition at line 1455 of file ThemeEngine.cpp.

Common::String GUI::ThemeEngine::getThemeFile ( const Common::String id  )  [static, private]

Definition at line 1802 of file ThemeEngine.cpp.

const Common::String& GUI::ThemeEngine::getThemeId (  )  const [inline]

Definition at line 590 of file ThemeEngine.h.

Common::String GUI::ThemeEngine::getThemeId ( const Common::String filename  )  [static, private]

Definition at line 1838 of file ThemeEngine.cpp.

const Common::String& GUI::ThemeEngine::getThemeName (  )  const [inline]

Definition at line 589 of file ThemeEngine.h.

void GUI::ThemeEngine::hideCursor (  ) 

Definition at line 1880 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::init (  ) 

Definition at line 297 of file ThemeEngine.cpp.

void GUI::ThemeEngine::listUsableThemes ( Common::List< ThemeDescriptor > &  list  )  [static]

Lists all theme files useable.

Definition at line 1687 of file ThemeEngine.cpp.

void GUI::ThemeEngine::listUsableThemes ( const Common::FSNode node,
Common::List< ThemeDescriptor > &  list,
int  depth = -1 
) [static, private]

Definition at line 1744 of file ThemeEngine.cpp.

void GUI::ThemeEngine::listUsableThemes ( Common::Archive archive,
Common::List< ThemeDescriptor > &  list 
) [static, private]

Definition at line 1718 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::loadDefaultXML (  )  [protected]

Loads the default theme file (the embedded XML file found in ThemeDefaultXML.cpp).

Called only when no other themes are available.

ResidualVM - Unused "<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'>" "<widget name='grModePopupDesc' " "type='OptionsLabel' " "/>" "<widget name='grModePopup' " "type='PopUp' " "/>" "</layout>" "<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'>" "<widget name='grRenderPopupDesc' " "type='OptionsLabel' " "/>" "<widget name='grRenderPopup' " "type='PopUp' " "/>" "</layout>" "<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'>" "<widget name='grStretchModePopupDesc' " "type='OptionsLabel' " "/>" "<widget name='grStretchModePopup' " "type='PopUp' " "/>" "</layout>"

ResidualVM - Unused "<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'>" "<widget name='grModePopupDesc' " "type='OptionsLabel' " "/>" "<widget name='grModePopup' " "type='PopUp' " "/>" "</layout>" "<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'>" "<widget name='grRenderPopupDesc' " "type='OptionsLabel' " "/>" "<widget name='grRenderPopup' " "type='PopUp' " "/>" "</layout>" "<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'>" "<widget name='grStretchModePopupDesc' " "type='OptionsLabel' " "/>" "<widget name='grStretchModePopup' " "type='PopUp' " "/>" "</layout>"

Definition at line 743 of file ThemeEngine.cpp.

const Graphics::Font * GUI::ThemeEngine::loadFont ( const Common::String filename,
Common::String name 
) [protected]

Definition at line 1511 of file ThemeEngine.cpp.

const Graphics::Font * GUI::ThemeEngine::loadFont ( const Common::String filename,
const Common::String scalableFilename,
const Common::String charset,
const int  pointsize,
const bool  makeLocalizedFont 
) [protected]

Definition at line 1546 of file ThemeEngine.cpp.

const Graphics::Font * GUI::ThemeEngine::loadScalableFont ( const Common::String filename,
const Common::String charset,
const int  pointsize,
Common::String name 
) [protected]

Definition at line 1475 of file ThemeEngine.cpp.

void GUI::ThemeEngine::loadTheme ( const Common::String themeid  )  [protected]

Load the them from the file with the specified name.

Definition at line 694 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::loadThemeXML ( const Common::String themeId  )  [protected]

Loads the given theme into the ThemeEngine.

Parameters:
themeId Theme identifier.
Returns:
true if the theme was successfully loaded.

Definition at line 784 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::ownCursor (  )  const [inline]

Definition at line 553 of file ThemeEngine.h.

DrawData GUI::ThemeEngine::parseDrawDataId ( const Common::String name  )  const

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.
Parameters:
name The representing name, as found on Theme Description XML files.
See also:
kDrawDataDefaults[]

Definition at line 1463 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::ready (  )  const [inline, 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.

Definition at line 535 of file ThemeEngine.h.

void GUI::ThemeEngine::refresh (  ) 

Definition at line 357 of file ThemeEngine.cpp.

Graphics::VectorRenderer* GUI::ThemeEngine::renderer (  )  [inline]

Definition at line 550 of file ThemeEngine.h.

void GUI::ThemeEngine::restoreBackground ( Common::Rect  r  ) 

Wrapper for restoring data from the Back Buffer to the screen.

The actual processing is done in the VectorRenderer.

Parameters:
r Area to restore.

Definition at line 468 of file ThemeEngine.cpp.

void GUI::ThemeEngine::setGraphicsMode ( GraphicsMode  mode  )  [protected]

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.

Definition at line 415 of file ThemeEngine.cpp.

void GUI::ThemeEngine::showCursor (  ) 

Definition at line 1872 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::supportsImages (  )  const [inline]

Definition at line 552 of file ThemeEngine.h.

Common::Rect GUI::ThemeEngine::swapClipRect ( const Common::Rect newRect  ) 

Set the clipping rect to be used by the widget drawing methods defined below.

Widgets are not drawn outside of the clipping rect. Widgets that overlap the clipping rect are drawn partially.

Parameters:
newRect The new clipping rect
Returns:
The previous clipping rect

Definition at line 1895 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::themeConfigParseHeader ( Common::String  header,
Common::String themeName 
) [static, private]

Definition at line 1591 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::themeConfigUsable ( const Common::FSNode node,
Common::String themeName 
) [static, private]

Definition at line 1642 of file ThemeEngine.cpp.

bool GUI::ThemeEngine::themeConfigUsable ( const Common::ArchiveMember member,
Common::String themeName 
) [static, private]

Definition at line 1620 of file ThemeEngine.cpp.

void GUI::ThemeEngine::unloadTheme (  )  [protected]

Unloads the currently loaded theme so another one can be loaded.

Definition at line 720 of file ThemeEngine.cpp.

void GUI::ThemeEngine::updateDirtyScreen (  )  [protected]

Dirty Screen handling function.

Draws all the dirty rectangles in the list to the overlay.

Definition at line 1328 of file ThemeEngine.cpp.

void GUI::ThemeEngine::updateScreen (  ) 

The updateScreen() method is called every frame.

It copies dirty rectangles in the Screen surface to the overlay.

Definition at line 1290 of file ThemeEngine.cpp.


Friends And Related Function Documentation

friend class GUI::Dialog [friend]

Definition at line 158 of file ThemeEngine.h.

friend class GUI::GuiObject [friend]

Definition at line 159 of file ThemeEngine.h.


Member Data Documentation

Definition at line 716 of file ThemeEngine.h.

Backbuffer surface.

Stores previous states of the screen to blit back

Definition at line 684 of file ThemeEngine.h.

Definition at line 715 of file ThemeEngine.h.

Bytes per pixel of the Active Drawing Surface (i.e.

the screen)

Definition at line 695 of file ThemeEngine.h.

Definition at line 745 of file ThemeEngine.h.

Definition at line 740 of file ThemeEngine.h.

Definition at line 741 of file ThemeEngine.h.

Definition at line 736 of file ThemeEngine.h.

Definition at line 736 of file ThemeEngine.h.

byte GUI::ThemeEngine::_cursorPal[3 *MAX_CURS_COLORS] [protected]

Definition at line 742 of file ThemeEngine.h.

Definition at line 743 of file ThemeEngine.h.

Definition at line 741 of file ThemeEngine.h.

List of all the dirty screens that must be blitted to the overlay.

Definition at line 723 of file ThemeEngine.h.

bool GUI::ThemeEngine::_enabled [protected]

Whether the Theme is currently shown on the overlay.

Definition at line 727 of file ThemeEngine.h.

Font info.

Definition at line 701 of file ThemeEngine.h.

Current graphics mode.

Definition at line 698 of file ThemeEngine.h.

bool GUI::ThemeEngine::_initOk [protected]

Class and renderer properly initialized.

Definition at line 725 of file ThemeEngine.h.

Filter the submitted DrawData descriptors according to their layer attribute.

This is used to selectively draw the background or foreground layer of the dialogs.

Definition at line 692 of file ThemeEngine.h.

XML Parser, does the Theme parsing instead of the default parser.

Definition at line 675 of file ThemeEngine.h.

Initial value:
 {
    { _s("Disabled GFX"), _sc("Disabled GFX", "lowres"), "none", kGfxDisabled },
    { _s("Standard renderer"), _s("Standard"), "normal", kGfxStandard },

    { _s("Antialiased renderer"), _s("Antialiased"), "antialias", kGfxAntialias }

}

Definition at line 292 of file ThemeEngine.h.

Definition at line 293 of file ThemeEngine.h.

Main screen surface.

This is blitted straight into the overlay.

Definition at line 681 of file ThemeEngine.h.

Definition at line 669 of file ThemeEngine.h.

TextColorData* GUI::ThemeEngine::_textColors[kTextColorMAX] [protected]

Array of all font colors available.

Definition at line 713 of file ThemeEngine.h.

TextDrawData* GUI::ThemeEngine::_texts[kTextDataMAX] [protected]

Array of all the text fonts that can be drawn.

Definition at line 710 of file ThemeEngine.h.

Definition at line 732 of file ThemeEngine.h.

Theme getEvaluator (changed from GUI::Eval to add functionality).

Definition at line 678 of file ThemeEngine.h.

Definition at line 731 of file ThemeEngine.h.

Definition at line 733 of file ThemeEngine.h.

Definition at line 730 of file ThemeEngine.h.

Name of the currently loaded theme.

Definition at line 729 of file ThemeEngine.h.

bool GUI::ThemeEngine::_themeOk [protected]

Theme data successfully loaded.

Definition at line 726 of file ThemeEngine.h.

bool GUI::ThemeEngine::_useCursor [protected]

Definition at line 735 of file ThemeEngine.h.

Global system object.

Vector Renderer object, does the actual drawing on screen

Definition at line 672 of file ThemeEngine.h.

WidgetDrawData* GUI::ThemeEngine::_widgets[kDrawDataMAX] [protected]

Array of all the DrawData elements than can be drawn to the screen.

Must be full so the renderer can work.

Definition at line 707 of file ThemeEngine.h.

Constant value to expand dirty rectangles, to make sure they are fully copied.

Definition at line 283 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageBoxLogo = "box.bmp" [static]

Box logo used in the StorageWizardDialog.

Definition at line 269 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageDelButton = "delbtn.bmp" [static]

Delete characters in the predictive dialog.

Definition at line 255 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageDropboxLogo = "dropbox.bmp" [static]

Dropbox logo used in the StorageWizardDialog.

Definition at line 266 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageEditButton = "editbtn.bmp" [static]

Edit recording metadata in recorder onscreen dialog.

Definition at line 259 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageEditSmallButton = "editbtn_small.bmp" [static]

Edit recording metadata in recorder onscreen dialog (for 320xY).

Definition at line 263 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageEraser = "eraser.bmp" [static]

Clear input image used in the launcher.

Definition at line 254 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageFastReplayButton = "fastreplay.bmp" [static]

Fast playback mode button in recorder onscreen dialog.

Definition at line 261 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageFastReplaySmallButton = "fastreplay_small.bmp" [static]

Fast playback mode button in recorder onscreen dialog (for 320xY).

Definition at line 265 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageGoogleDriveLogo = "googledrive.bmp" [static]

Google Drive logo used in the StorageWizardDialog.

Definition at line 268 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageGrid = "grid.bmp" [static]

Grid image used in save/load chooser selection.

Definition at line 257 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageList = "list.bmp" [static]

List image used in save/load chooser selection.

Definition at line 256 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageLogo = "logo.bmp" [static]

ScummVM logo used in the launcher.

Definition at line 251 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageLogoSmall = "logo_small.bmp" [static]

ScummVM logo used in the GMM.

Definition at line 252 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageOneDriveLogo = "onedrive.bmp" [static]

OneDrive logo used in the StorageWizardDialog.

Definition at line 267 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageSearch = "search.bmp" [static]

Search tool image used in the launcher.

Definition at line 253 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageStopButton = "stopbtn.bmp" [static]

Stop recording button in recorder onscreen dialog.

Definition at line 258 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageStopSmallButton = "stopbtn_small.bmp" [static]

Stop recording button in recorder onscreen dialog (for 320xY).

Definition at line 262 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageSwitchModeButton = "switchbtn.bmp" [static]

Switch mode button in recorder onscreen dialog.

Definition at line 260 of file ThemeEngine.h.

const char *const GUI::ThemeEngine::kImageSwitchModeSmallButton = "switchbtn_small.bmp" [static]

Switch mode button in recorder onscreen dialog (for 320xY).

Definition at line 264 of file ThemeEngine.h.


The documentation for this class was generated from the following files:


Generated on Sat Nov 9 2019 05:02:16 for ResidualVM by doxygen 1.7.1
curved edge   curved edge