22 #ifndef GUI_THEME_ENGINE_H 23 #define GUI_THEME_ENGINE_H 25 #include "common/scummsys.h" 26 #include "common/fs.h" 27 #include "common/hash-str.h" 28 #include "common/hashmap.h" 29 #include "common/language.h" 30 #include "common/list.h" 31 #include "common/str.h" 32 #include "common/rect.h" 34 #include "graphics/managed_surface.h" 35 #include "graphics/font.h" 36 #include "graphics/pixelformat.h" 39 #define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.9.20" 50 struct WidgetDrawData;
63 kDDMainDialogBackground,
64 kDDSpecialColorBackground,
65 kDDPlainColorBackground,
68 kDDTextSelectionBackground,
69 kDDTextSelectionFocusBackground,
70 kDDThumbnailBackground,
73 kDDWidgetBackgroundDefault,
74 kDDWidgetBackgroundSmall,
75 kDDWidgetBackgroundEditText,
76 kDDWidgetBackgroundSlider,
83 kDDDropDownButtonIdle,
84 kDDDropDownButtonHoverLeft,
85 kDDDropDownButtonHoverRight,
86 kDDDropDownButtonDisabled,
87 kDDDropDownButtonPressedLeft,
88 kDDDropDownButtonPressedRight,
90 kDDDropDownButtonIdleRTL,
91 kDDDropDownButtonHoverLeftRTL,
92 kDDDropDownButtonHoverRightRTL,
93 kDDDropDownButtonDisabledRTL,
94 kDDDropDownButtonPressedLeftRTL,
95 kDDDropDownButtonPressedRightRTL,
104 kDDCheckboxDisabledSelected,
106 kDDRadiobuttonDefault,
107 kDDRadiobuttonDisabled,
108 kDDRadiobuttonSelected,
115 kDDScrollbarButtonIdle,
116 kDDScrollbarButtonHover,
117 kDDScrollbarHandleIdle,
118 kDDScrollbarHandleHover,
142 kDrawLayerBackground,
149 kTextDataDefault = 0,
159 kTextColorNormal = 0,
160 kTextColorNormalInverted,
161 kTextColorNormalHover,
162 kTextColorNormalDisabled,
163 kTextColorAlternative,
164 kTextColorAlternativeInverted,
165 kTextColorAlternativeHover,
166 kTextColorAlternativeDisabled,
168 kTextColorOverrideInverted,
169 kTextColorOverrideHover,
170 kTextColorOverrideDisabled,
172 kTextColorButtonHover,
173 kTextColorButtonDisabled,
184 storeFileNames(textId, filename, scalableFile, ps);
188 assert(textId < kTextDataMAX);
189 _fontFilesStd[textId] = filename;
190 _fontFilesScalable[textId] = scalableFile;
191 _fontSize[textId] = ps;
195 return (
Common::find(_langs.begin(), _langs.end(), l) != _langs.end());
198 Common::String file(TextData textId)
const {
return _fontFilesStd[textId]; }
199 Common::String sclFile(TextData textId)
const {
return _fontFilesScalable[textId]; }
200 int fntSize(TextData textId)
const {
return _fontSize[textId]; }
206 int _fontSize[kTextDataMAX];
240 kDialogBackgroundMain,
241 kDialogBackgroundSpecial,
242 kDialogBackgroundPlain,
243 kDialogBackgroundTooltip,
244 kDialogBackgroundDefault,
245 kDialogBackgroundNone
265 enum ScrollbarState {
269 kScrollbarStateSlider,
270 kScrollbarStateSinglePage
276 kFontStyleNormal = 1,
277 kFontStyleItalic = 2,
278 kFontStyleFixedNormal = 3,
279 kFontStyleFixedBold = 4,
280 kFontStyleFixedItalic = 5,
281 kFontStyleTooltip = 6,
282 kFontStyleConsole = 7,
283 kFontStyleLangExtra = 8,
289 kFontColorFormatting = -1,
290 kFontColorNormal = 0,
291 kFontColorAlternate = 1,
292 kFontColorOverride = 2,
306 kAutoScaleStretch = 1,
308 kAutoScaleNinePatch = 3
341 static const int kDirtyRectangleThreshold = 1;
345 const char *shortname;
350 static const Renderer _rendererModes[];
351 static const uint _rendererModesSize;
356 static const char *findModeConfigName(
GraphicsMode mode);
364 void setBaseResolution(
int w,
int h,
float s);
396 void drawToBackbuffer();
414 void copyBackBufferToScreen();
420 TextData fontStyleToData(
FontStyle font)
const {
421 if (font == kFontStyleNormal)
422 return kTextDataNormalFont;
423 if (font == kFontStyleTooltip)
424 return kTextDataTooltip;
425 if (font == kFontStyleConsole)
426 return kTextDataConsole;
427 if (font == kFontStyleLangExtra)
428 return kTextDataExtraLang;
429 return kTextDataDefault;
434 int getFontHeight(
FontStyle font = kFontStyleBold)
const;
438 int getCharWidth(uint32 c,
FontStyle font = kFontStyleBold)
const;
440 int getKerningOffset(uint32 left, uint32 right,
FontStyle font = kFontStyleBold)
const;
459 void disableClipRect();
470 WidgetStateInfo buttonState,
bool inButton,
bool inDropdown,
bool rtl =
false);
474 void drawSlider(
const Common::Rect &r,
int width, WidgetStateInfo state = kStateEnabled,
bool rtl =
false);
477 WidgetStateInfo state = kStateEnabled,
bool override =
false,
bool rtl =
false);
480 WidgetStateInfo state = kStateEnabled,
bool rtl =
false);
486 void drawScrollbar(
const Common::Rect &r,
int sliderY,
int sliderHeight, ScrollbarState scrollState);
489 WidgetStateInfo state = kStateEnabled,
bool rtl =
false);
499 TextInversionState inverted = kTextInversionNone,
int deltax = 0,
bool useEllipsis =
true,
500 FontStyle font = kFontStyleBold,
FontColor color = kFontColorNormal,
bool restore =
true,
505 void drawFoldIndicator(
const Common::Rect &r,
bool expanded);
532 TextData getTextData(DrawData ddId)
const;
533 TextColor getTextColor(DrawData ddId)
const;
596 bool addTextColor(TextColor colorId,
int r,
int g,
int b);
623 return _initOk && _themeOk;
636 inline ThemeEval *getEvaluator() {
return _themeEval; }
639 inline bool supportsImages()
const {
return true; }
640 inline bool ownCursor()
const {
return _useCursor; }
643 return _bitmaps.contains(name) ? _bitmaps[name] : 0;
654 bool createCursor(
const Common::String &filename,
int hotspotX,
int hotspotY);
666 int getGraphicsMode()
const {
return _graphicsMode; }
683 bool loadDefaultXML();
694 void unloadExtraFont();
705 void updateDirtyScreen();
715 void drawDD(DrawData type,
const Common::Rect &r, uint32 dynamic = 0,
bool forceRestore =
false);
724 void debugWidgetPosition(
const char *name,
const Common::Rect &r);
779 int16 _baseWidth, _baseHeight;
781 bool _needScaleRefresh =
false;
790 WidgetDrawData *_widgets[kDrawDataMAX];
793 TextDrawData *_texts[kTextDataMAX];
821 int _cursorHotspotX, _cursorHotspotY;
822 uint32 _cursorTransparent;
824 uint _cursorWidth, _cursorHeight;
827 MAX_CURS_COLORS = 255
829 byte _cursorPal[3 * MAX_CURS_COLORS];
Definition: managed_surface.h:51
Center the text.
Definition: font.h:52
bool _enabled
Whether the Theme is currently shown on the overlay.
Definition: ThemeEngine.h:812
Indicates that the text should not be drawn inverted.
Definition: ThemeEngine.h:260
Definition: VectorRenderer.h:51
FontColor
Font color selector.
Definition: ThemeEngine.h:288
TextAlign
Definition: font.h:48
ShadingStyle
Function used to process areas other than the current dialog.
Definition: ThemeEngine.h:297
static const char *const kImageSearch
Search tool image used in the launcher.
Definition: ThemeEngine.h:314
bool ready() const
Definition: ThemeEngine.h:622
AutoScaleMode
AlphaBitmap scale mode selector.
Definition: ThemeEngine.h:304
Dimming unused areas.
Definition: ThemeEngine.h:299
Definition: ThemeEngine.h:727
No background at all.
Definition: ThemeEngine.h:227
Background used for thumbnails.
Definition: ThemeEngine.h:233
TextAlignVertical
Vertical alignment of the text.
Definition: ThemeEngine.h:218
In find(In first, In last, const T &v)
Definition: algorithm.h:225
Align the text to the left.
Definition: font.h:51
Standard (aliased) renderer.
Definition: ThemeEngine.h:336
WidgetBackground
Widget background type.
Definition: ThemeEngine.h:226
GUI::ThemeEval * _themeEval
Definition: ThemeEngine.h:757
bool _themeOk
Theme data successfully loaded.
Definition: ThemeEngine.h:811
Common::Array< LangExtraFont > _langExtraFonts
Definition: ThemeEngine.h:801
Same as kWidgetBackgroundPlain just with a border.
Definition: ThemeEngine.h:229
static const char *const kImageStopButton
Stop recording button in recorder onscreen dialog.
Definition: ThemeEngine.h:320
Common::String _themeName
Name of the currently loaded theme.
Definition: ThemeEngine.h:814
Definition: VectorRenderer.h:139
Definition: ThemeEval.h:37
static const char *const kImageLogoSmall
ScummVM logo used in the GMM.
Definition: ThemeEngine.h:313
Definition: archive.h:141
bool _initOk
Class and renderer properly initialized.
Definition: ThemeEngine.h:810
static const char *const kImageEditSmallButton
Edit recording metadata in recorder onscreen dialog (for 320xY)
Definition: ThemeEngine.h:325
TextInversionState
Text inversion state of the text to be draw.
Definition: ThemeEngine.h:259
Default Background used for grid items.
Definition: ThemeEngine.h:234
GUI::ThemeParser * _parser
Definition: ThemeEngine.h:754
Indicates that the text should be drawn inverted, but not focused.
Definition: ThemeEngine.h:261
Background used for sliders.
Definition: ThemeEngine.h:232
static const char *const kImageGroup
Select Group image used in the launcher.
Definition: ThemeEngine.h:315
Definition: archive.h:312
Common::List< Common::Rect > _dirtyScreen
Definition: ThemeEngine.h:808
static const char *const kImageDelButton
Delete characters in the predictive dialog.
Definition: ThemeEngine.h:317
const Graphics::Font * _font
Definition: ThemeEngine.h:784
DialogBackground
Dialog background type.
Definition: ThemeEngine.h:239
Definition: formatinfo.h:28
FontStyle
Font style selector.
Definition: ThemeEngine.h:274
Indicates that the widget is enabled.
Definition: ThemeEngine.h:251
DrawLayer _layerToDraw
Definition: ThemeEngine.h:771
Graphics::ManagedSurface _screen
Definition: ThemeEngine.h:760
static const char *const kImageSwitchModeButton
Switch mode button in recorder onscreen dialog.
Definition: ThemeEngine.h:322
Definition: ThemeEngine.h:209
Definition: ThemeEngine.h:343
static const char *const kImageStopSmallButton
Stop recording button in recorder onscreen dialog (for 320xY)
Definition: ThemeEngine.h:324
Indicates that the widget is highlighted by the user.
Definition: ThemeEngine.h:252
Definition: ThemeParser.h:32
Same as kWidgetBackgroundPlain just with a small border.
Definition: ThemeEngine.h:230
static const char *const kImageFastReplayButton
Fast playback mode button in recorder onscreen dialog.
Definition: ThemeEngine.h:323
State
State of the widget to be drawn.
Definition: ThemeEngine.h:249
GraphicsMode _graphicsMode
Definition: ThemeEngine.h:777
int _bytesPerPixel
Definition: ThemeEngine.h:774
Background used for edit text fields.
Definition: ThemeEngine.h:231
const Graphics::PixelFormat getPixelFormat() const
Definition: ThemeEngine.h:380
static const char *const kImageLogo
ScummVM logo used in the launcher.
Definition: ThemeEngine.h:312
Graphics::ManagedSurface _backBuffer
Definition: ThemeEngine.h:763
Indicates that the widget is disabled, that does NOT include that it is invisible.
Definition: ThemeEngine.h:250
No special post processing.
Definition: ThemeEngine.h:298
static const char *const kImageSwitchModeSmallButton
Switch mode button in recorder onscreen dialog (for 320xY)
Definition: ThemeEngine.h:326
Simple background, this may not include borders.
Definition: ThemeEngine.h:228
Definition: ThemeEngine.h:177
static const char *const kImageEditButton
Edit recording metadata in recorder onscreen dialog.
Definition: ThemeEngine.h:321
static const char *const kImageGrid
Grid image used in save/load chooser selection.
Definition: ThemeEngine.h:319
static const char *const kImageList
List image used in save/load chooser selection.
Definition: ThemeEngine.h:318
GraphicsMode
Definition: ThemeEngine.h:334
Graphics::VectorRenderer * _vectorRenderer
Definition: ThemeEngine.h:751
static const char *const kImageEraser
Clear input image used in the launcher.
Definition: ThemeEngine.h:316
static const char *const kImageFastReplaySmallButton
Fast playback mode button in recorder onscreen dialog (for 320xY)
Definition: ThemeEngine.h:327
Language
Definition: language.h:45