diff options
Diffstat (limited to 'gui/ThemeEngine.h')
-rw-r--r-- | gui/ThemeEngine.h | 110 |
1 files changed, 36 insertions, 74 deletions
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 5675f0c5d7..984ac0f083 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -376,75 +376,56 @@ public: //@} + /** + * 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. + * + * @param newRect The new clipping rect + * @return The previous clipping rect + */ + Common::Rect swapClipRect(const Common::Rect &newRect); /** @name WIDGET DRAWING METHODS */ //@{ - void drawWidgetBackground(const Common::Rect &r, uint16 hints, - WidgetBackground background = kWidgetBackgroundPlain, WidgetStateInfo state = kStateEnabled); - void drawWidgetBackgroundClip(const Common::Rect &r, const Common::Rect &clippingArea, uint16 hints, - WidgetBackground background = kWidgetBackgroundPlain, WidgetStateInfo state = kStateEnabled); - - void drawButton(const Common::Rect &r, const Common::String &str, - WidgetStateInfo state = kStateEnabled, uint16 hints = 0); - void drawButtonClip(const Common::Rect &r, const Common::Rect &clippingRect, const Common::String &str, - WidgetStateInfo state = kStateEnabled, uint16 hints = 0); + void drawWidgetBackground(const Common::Rect &r, uint16 hints, WidgetBackground background = kWidgetBackgroundPlain); - void drawSurface(const Common::Rect &r, const Graphics::Surface &surface, - WidgetStateInfo state = kStateEnabled, int alpha = 255, bool themeTrans = false); - void drawSurfaceClip(const Common::Rect &r, const Common::Rect &clippingRect, const Graphics::Surface &surface, - WidgetStateInfo state = kStateEnabled, int alpha = 255, bool themeTrans = false); + void drawButton(const Common::Rect &r, const Common::String &str, WidgetStateInfo state = kStateEnabled, + uint16 hints = 0); - void drawASurface(const Common::Rect &r, Graphics::TransparentSurface &surface, AutoScaleMode autoscale, int alpha); + 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 drawSliderClip(const Common::Rect &r, const Common::Rect &clippingRect, int width, - WidgetStateInfo state = kStateEnabled); + 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 drawCheckboxClip(const Common::Rect &r, const Common::Rect &clippingRect, const Common::String &str, - bool checked, 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 drawRadiobuttonClip(const Common::Rect &r, const Common::Rect &clippingRect, 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, int tabWidth, - const Common::Array<Common::String> &tabs, int active, uint16 hints, - int titleVPad, WidgetStateInfo state = kStateEnabled); - void drawTabClip(const Common::Rect &r, const Common::Rect &clippingRect, int tabHeight, const Common::Array<int> &tabWidths, - const Common::Array<Common::String> &tabs, int active, uint16 hints, - int titleVPad, 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, WidgetStateInfo state = kStateEnabled); - void drawScrollbarClip(const Common::Rect &r, const Common::Rect &clippingRect, int sliderY, int sliderHeight, - ScrollbarState scrollState, WidgetStateInfo state = kStateEnabled); + 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, Graphics::TextAlign align = Graphics::kTextAlignLeft); - void drawPopUpWidgetClip(const Common::Rect &r, const Common::Rect &clippingArea, const Common::String &sel, - int deltax, WidgetStateInfo state = kStateEnabled, Graphics::TextAlign align = Graphics::kTextAlignLeft); + void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, + WidgetStateInfo state = kStateEnabled); - void drawCaret(const Common::Rect &r, bool erase, - WidgetStateInfo state = kStateEnabled); - void drawCaretClip(const Common::Rect &r, const Common::Rect &clip, bool erase, - WidgetStateInfo state = kStateEnabled); + void drawCaret(const Common::Rect &r, bool erase); - void drawLineSeparator(const Common::Rect &r, WidgetStateInfo state = kStateEnabled); - void drawLineSeparatorClip(const Common::Rect &r, const Common::Rect &clippingArea, WidgetStateInfo state = kStateEnabled); + void drawLineSeparator(const Common::Rect &r); - void drawDialogBackground(const Common::Rect &r, DialogBackground type, WidgetStateInfo state = kStateEnabled); - void drawDialogBackgroundClip(const Common::Rect &r, const Common::Rect &clip, DialogBackground type, WidgetStateInfo state = kStateEnabled); + 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 drawTextClip(const Common::Rect &r, const Common::Rect &clippingArea, 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 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, WidgetStateInfo state = kStateEnabled, FontColor color = kFontColorNormal); - void drawCharClip(const Common::Rect &r, const Common::Rect &clippingArea, byte ch, const Graphics::Font *font, WidgetStateInfo state = kStateEnabled, FontColor color = kFontColorNormal); + void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, FontColor color = kFontColorNormal); //@} @@ -606,15 +587,6 @@ public: int getGraphicsMode() const { return _graphicsMode; } protected: - /** - * 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) - */ - template<typename PixelType> void screenInit(bool backBuffer = true); /** * Loads the given theme into the ThemeEngine. @@ -657,21 +629,11 @@ protected: * These functions are called from all the Widget drawing methods. */ void drawDD(DrawData type, const Common::Rect &r, uint32 dynamic = 0, bool forceRestore = false); - void drawDDClip(DrawData type, const Common::Rect &r, const Common::Rect &clippingRect, uint32 dynamic = 0, - bool forceRestore = false); 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 drawDDTextClip(TextData type, TextColor color, const Common::Rect &r, const Common::Rect &clippingRect, - 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 &r, bool alpha); - void drawBitmapClip(const Graphics::Surface *bitmap, const Common::Rect &clippingRect, const Common::Rect &r, - bool alpha); - void drawABitmap(Graphics::TransparentSurface *bitmap, const Common::Rect &r, AutoScaleMode autoscale, int alpha); + void drawBitmap(const Graphics::Surface *bitmap, const Common::Rect &clippingRect, bool alpha); /** * DEBUG: Draws a white square and writes some text next to it. @@ -732,7 +694,6 @@ protected: GraphicsMode _graphicsMode; /** Font info. */ - Common::String _fontName; const Graphics::Font *_font; /** @@ -773,10 +734,11 @@ protected: MAX_CURS_COLORS = 255 }; byte *_cursor; - bool _needPaletteUpdates; uint _cursorWidth, _cursorHeight; byte _cursorPal[3 * MAX_CURS_COLORS]; byte _cursorPalSize; + + Common::Rect _clip; }; } // End of namespace GUI. |