From cde42202d69e178da73c698065deca54b24054fd Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 15 Feb 2014 18:07:17 +0300 Subject: move exguichan files into gui/base/ --- src/gui/widgets/dropshortcutcontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/widgets/dropshortcutcontainer.cpp') diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 73547b770..857eed024 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -36,7 +36,7 @@ #include "resources/image.h" -#include +#include "gui/base/font.hpp" #include "debug.h" -- cgit v1.2.3-70-g09d2 From 29f929794c7519b049de0be3af635f05d7e83be6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 15 Feb 2014 20:31:52 +0300 Subject: move some methods from base/graphics into render/graphics. Remove base/graphcs. --- src/CMakeLists.txt | 2 - src/Makefile.am | 3 - src/being/being.cpp | 8 +- src/gui/base/basiccontainer.cpp | 3 +- src/gui/base/font.hpp | 4 +- src/gui/base/graphics.cpp | 179 ------------------ src/gui/base/graphics.hpp | 294 ----------------------------- src/gui/base/gui.cpp | 3 +- src/gui/base/gui.hpp | 3 +- src/gui/base/widget.cpp | 3 +- src/gui/base/widget.hpp | 3 +- src/gui/base/widgets/button.cpp | 3 +- src/gui/base/widgets/button.hpp | 3 +- src/gui/base/widgets/checkbox.cpp | 3 +- src/gui/base/widgets/container.cpp | 3 +- src/gui/base/widgets/container.hpp | 3 +- src/gui/base/widgets/label.cpp | 3 +- src/gui/base/widgets/label.hpp | 3 +- src/gui/base/widgets/listbox.cpp | 3 +- src/gui/base/widgets/radiobutton.cpp | 3 +- src/gui/base/widgets/scrollarea.cpp | 3 +- src/gui/base/widgets/slider.cpp | 3 +- src/gui/base/widgets/textbox.cpp | 3 +- src/gui/base/widgets/textfield.cpp | 3 +- src/gui/base/widgets/window.cpp | 3 +- src/gui/sdlfont.cpp | 2 +- src/gui/sdlfont.h | 2 +- src/gui/viewport.cpp | 10 +- src/gui/viewport.h | 2 +- src/gui/widgets/avatarlistbox.cpp | 2 +- src/gui/widgets/avatarlistbox.h | 2 +- src/gui/widgets/browserbox.cpp | 13 +- src/gui/widgets/browserbox.h | 2 +- src/gui/widgets/button.cpp | 8 +- src/gui/widgets/button.h | 2 +- src/gui/widgets/checkbox.cpp | 4 +- src/gui/widgets/checkbox.h | 4 +- src/gui/widgets/colorpage.cpp | 2 +- src/gui/widgets/colorpage.h | 2 +- src/gui/widgets/desktop.cpp | 2 +- src/gui/widgets/desktop.h | 2 +- src/gui/widgets/dropdown.cpp | 6 +- src/gui/widgets/dropdown.h | 6 +- src/gui/widgets/dropshortcutcontainer.cpp | 2 +- src/gui/widgets/dropshortcutcontainer.h | 2 +- src/gui/widgets/emotepage.cpp | 2 +- src/gui/widgets/emotepage.h | 2 +- src/gui/widgets/emoteshortcutcontainer.cpp | 2 +- src/gui/widgets/emoteshortcutcontainer.h | 2 +- src/gui/widgets/extendedlistbox.cpp | 5 +- src/gui/widgets/extendedlistbox.h | 2 +- src/gui/widgets/guitable.cpp | 5 +- src/gui/widgets/guitable.h | 2 +- src/gui/widgets/icon.cpp | 2 +- src/gui/widgets/icon.h | 2 +- src/gui/widgets/itemcontainer.cpp | 2 +- src/gui/widgets/itemcontainer.h | 2 +- src/gui/widgets/itemshortcutcontainer.cpp | 2 +- src/gui/widgets/itemshortcutcontainer.h | 2 +- src/gui/widgets/label.cpp | 2 +- src/gui/widgets/label.h | 2 +- src/gui/widgets/listbox.cpp | 5 +- src/gui/widgets/listbox.h | 2 +- src/gui/widgets/passwordfield.cpp | 2 +- src/gui/widgets/passwordfield.h | 2 +- src/gui/widgets/playerbox.cpp | 4 +- src/gui/widgets/playerbox.h | 4 +- src/gui/widgets/popup.cpp | 2 +- src/gui/widgets/popup.h | 2 +- src/gui/widgets/progressbar.cpp | 2 +- src/gui/widgets/progressbar.h | 2 +- src/gui/widgets/progressindicator.cpp | 2 +- src/gui/widgets/progressindicator.h | 2 +- src/gui/widgets/radiobutton.cpp | 4 +- src/gui/widgets/radiobutton.h | 4 +- src/gui/widgets/scrollarea.cpp | 26 +-- src/gui/widgets/scrollarea.h | 26 +-- src/gui/widgets/shoplistbox.cpp | 2 +- src/gui/widgets/shoplistbox.h | 2 +- src/gui/widgets/shortcutcontainer.h | 2 +- src/gui/widgets/slider.cpp | 2 +- src/gui/widgets/slider.h | 2 +- src/gui/widgets/sliderlist.cpp | 2 +- src/gui/widgets/sliderlist.h | 2 +- src/gui/widgets/spellshortcutcontainer.cpp | 2 +- src/gui/widgets/spellshortcutcontainer.h | 2 +- src/gui/widgets/tabbedarea.cpp | 2 +- src/gui/widgets/tabbedarea.h | 2 +- src/gui/widgets/tabs/tab.cpp | 2 +- src/gui/widgets/tabs/tab.h | 2 +- src/gui/widgets/textbox.cpp | 2 +- src/gui/widgets/textbox.h | 2 +- src/gui/widgets/textfield.cpp | 12 +- src/gui/widgets/textfield.h | 6 +- src/gui/widgets/textpreview.cpp | 2 +- src/gui/widgets/textpreview.h | 2 +- src/gui/widgets/window.cpp | 12 +- src/gui/widgets/window.h | 4 +- src/gui/widgets/windowcontainer.cpp | 2 +- src/gui/widgets/windowcontainer.h | 2 +- src/gui/windowmenu.cpp | 2 +- src/gui/windowmenu.h | 2 +- src/gui/windows/buydialog.cpp | 2 +- src/gui/windows/chatwindow.cpp | 2 +- src/gui/windows/chatwindow.h | 2 +- src/gui/windows/connectiondialog.cpp | 2 +- src/gui/windows/connectiondialog.h | 2 +- src/gui/windows/debugwindow.cpp | 2 +- src/gui/windows/debugwindow.h | 2 +- src/gui/windows/equipmentwindow.cpp | 2 +- src/gui/windows/equipmentwindow.h | 2 +- src/gui/windows/minimap.cpp | 2 +- src/gui/windows/minimap.h | 2 +- src/gui/windows/ministatuswindow.cpp | 2 +- src/gui/windows/ministatuswindow.h | 2 +- src/gui/windows/outfitwindow.cpp | 6 +- src/gui/windows/outfitwindow.h | 2 +- src/gui/windows/selldialog.cpp | 2 +- src/gui/windows/serverdialog.cpp | 2 +- src/gui/windows/skilldialog.cpp | 2 +- src/render/graphics.cpp | 124 +++++++++++- src/render/graphics.h | 163 ++++++++++++++-- src/render/mobileopenglgraphics.cpp | 4 +- src/render/normalopenglgraphics.cpp | 4 +- src/render/nullopenglgraphics.cpp | 4 +- src/render/safeopenglgraphics.cpp | 4 +- src/render/sdl2graphics.cpp | 47 ++++- src/render/sdl2graphics.h | 43 +++++ src/render/sdl2softwaregraphics.cpp | 4 +- src/render/sdlgraphics.cpp | 4 +- src/text.cpp | 10 +- src/text.h | 9 +- 132 files changed, 589 insertions(+), 700 deletions(-) delete mode 100644 src/gui/base/graphics.cpp delete mode 100644 src/gui/base/graphics.hpp (limited to 'src/gui/widgets/dropshortcutcontainer.cpp') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 79280485c..65570ee7b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -780,7 +780,6 @@ SET(SRCS gui/base/focushandler.hpp gui/base/focuslistener.hpp gui/base/font.hpp - gui/base/graphics.hpp gui/base/gui.hpp gui/base/input.hpp gui/base/inputevent.hpp @@ -817,7 +816,6 @@ SET(SRCS gui/base/exception.cpp gui/base/focushandler.cpp gui/base/font.cpp - gui/base/graphics.cpp gui/base/gui.cpp gui/base/inputevent.cpp gui/base/key.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 028041582..7fe7a5e2e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,7 +32,6 @@ dyecmd_SOURCES = gui/base/actionevent.cpp \ gui/base/event.cpp \ gui/base/exception.cpp \ gui/base/font.cpp \ - gui/base/graphics.cpp \ gui/base/rectangle.cpp \ gui/base/widget.cpp \ gui/base/actionevent.hpp \ @@ -41,7 +40,6 @@ dyecmd_SOURCES = gui/base/actionevent.cpp \ gui/base/event.hpp \ gui/base/exception.hpp \ gui/base/font.hpp \ - gui/base/graphics.hpp \ gui/base/rectangle.hpp \ gui/base/widget.hpp @@ -206,7 +204,6 @@ manaplus_SOURCES += gui/base/actionevent.hpp \ gui/base/exception.cpp \ gui/base/focushandler.cpp \ gui/base/font.cpp \ - gui/base/graphics.cpp \ gui/base/gui.cpp \ gui/base/inputevent.cpp \ gui/base/key.cpp \ diff --git a/src/being/being.cpp b/src/being/being.cpp index dfb335f9b..8b2ece2b7 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -519,7 +519,7 @@ void Being::setSpeech(const std::string &text, const std::string &channel, mText = new Text(mSpeech, getPixelX(), getPixelY() - getHeight(), - gcn::Graphics::CENTER, + Graphics::CENTER, &userPalette->getColor(UserPalette::PARTICLE), true); } @@ -1856,7 +1856,7 @@ void Being::drawSpeech(const int offsetX, const int offsetY) if (!mText && userPalette) { mText = new Text(mSpeech, getPixelX(), getPixelY() - getHeight(), - gcn::Graphics::CENTER, &Theme::getThemeColor( + Graphics::CENTER, &Theme::getThemeColor( Theme::BUBBLE_TEXT), true); } } @@ -2019,12 +2019,12 @@ void Being::showName() mDispName = new FlashText(displayName, getPixelX() + mInfo->getNameOffsetX(), getPixelY() + mInfo->getNameOffsetY(), - gcn::Graphics::CENTER, mNameColor, font); + Graphics::CENTER, mNameColor, font); } else { mDispName = new FlashText(displayName, getPixelX(), getPixelY(), - gcn::Graphics::CENTER, mNameColor, font); + Graphics::CENTER, mNameColor, font); } updateCoords(); diff --git a/src/gui/base/basiccontainer.cpp b/src/gui/base/basiccontainer.cpp index 45bb1e231..7a937fb42 100644 --- a/src/gui/base/basiccontainer.cpp +++ b/src/gui/base/basiccontainer.cpp @@ -71,9 +71,10 @@ #include "gui/base/exception.hpp" #include "gui/base/focushandler.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/mouseinput.hpp" +#include "render/graphics.h" + #include "debug.h" namespace gcn diff --git a/src/gui/base/font.hpp b/src/gui/base/font.hpp index 8e8ad18c9..075af4136 100644 --- a/src/gui/base/font.hpp +++ b/src/gui/base/font.hpp @@ -68,10 +68,10 @@ #include "localconsts.h" +class Graphics; + namespace gcn { - class Graphics; - /** * Interface for a font. * diff --git a/src/gui/base/graphics.cpp b/src/gui/base/graphics.cpp deleted file mode 100644 index fd76a1e6f..000000000 --- a/src/gui/base/graphics.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * For comments regarding functions please see the header file. - */ - -#include "gui/base/graphics.hpp" - -#include "gui/base/exception.hpp" -#include "gui/base/font.hpp" -#include "resources/image.h" - -#include "debug.h" - -namespace gcn -{ - - Graphics::Graphics() : - mClipStack(), - mFont(nullptr) - { - } - - bool Graphics::pushClipArea(Rectangle area) - { - // Ignore area with a negate width or height - // by simple pushing an empty clip area - // to the stack. - if (area.width < 0 || area.height < 0) - { - ClipRectangle carea; - mClipStack.push(carea); - return true; - } - - if (mClipStack.empty()) - { - ClipRectangle carea; - carea.x = area.x; - carea.y = area.y; - carea.width = area.width; - carea.height = area.height; - carea.xOffset = area.x; - carea.yOffset = area.y; - mClipStack.push(carea); - return true; - } - - const ClipRectangle &top = mClipStack.top(); - ClipRectangle carea; - carea = area; - carea.xOffset = top.xOffset + carea.x; - carea.yOffset = top.yOffset + carea.y; - carea.x += top.xOffset; - carea.y += top.yOffset; - - // Clamp the pushed clip rectangle. - if (carea.x < top.x) - carea.x = top.x; - - if (carea.y < top.y) - carea.y = top.y; - - if (carea.x + carea.width > top.x + top.width) - { - carea.width = top.x + top.width - carea.x; - - if (carea.width < 0) - carea.width = 0; - } - - if (carea.y + carea.height > top.y + top.height) - { - carea.height = top.y + top.height - carea.y; - - if (carea.height < 0) - carea.height = 0; - } - - const bool result = carea.isIntersecting(top); - - mClipStack.push(carea); - - return result; - } - - void Graphics::popClipArea() - { - if (mClipStack.empty()) - throw GCN_EXCEPTION("Tried to pop clip area from empty stack."); - - mClipStack.pop(); - } - - const ClipRectangle& Graphics::getCurrentClipArea() - { - if (mClipStack.empty()) - throw GCN_EXCEPTION("The clip area stack is empty."); - - return mClipStack.top(); - } - - void Graphics::drawImage(const Image* image A_UNUSED, - int dstX A_UNUSED, int dstY A_UNUSED) - { - } - -/* - void Graphics::setFont(Font* font) - { - } - - void Graphics::drawText(const std::string& text, int x, int y, - Alignment alignment) - { - } -*/ -} // namespace gcn diff --git a/src/gui/base/graphics.hpp b/src/gui/base/graphics.hpp deleted file mode 100644 index d3128c8ae..000000000 --- a/src/gui/base/graphics.hpp +++ /dev/null @@ -1,294 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GCN_GRAPHICS_HPP -#define GCN_GRAPHICS_HPP - -#include -#include - -#include "gui/base/cliprectangle.hpp" - -namespace gcn -{ - class Color; - class Font; - class Image; - - /** - * Abstract class for providing drawing primitve functions. - * It contains all vital functions for drawing. - * - * Guichan contains implementations of Graphics for common - * libraries like the Allegro library, the HGE library, - * the OpenGL library, the OpenLayer library, and the SDL library. - * To make Guichan usable with other libraries, a Graphics class - * must be implemented. - * - * In Graphics you can set clip areas to limit drawing to certain - * areas of the screen. Clip areas are put on a stack, which - * means that you can push smaller and smaller clip areas onto the - * stack. All coordinates will be relative to the top most clip area. - * In most cases you won't have to worry about the clip areas, - * unless you want to implement some really complex widget. - * Pushing and poping of clip areas are handled automatically by - * container widgets when their child widgets are drawn. - * - * IMPORTANT: Remember to pop each clip area that you pushed on the stack - * after you are done with it. - * - * If you feel that Graphics is to restrictive for your needs, - * there is no one stopping you from using your own code for drawing - * in widgets. You could for instance use pure SDL in the drawing of - * widgets bypassing Graphics. This might however hurt portability of - * your application. - * - * If you implement a Graphics class not present in Guichan we would - * be very happy to add it to Guichan. - * - * @see AllegroGraphics, HGEGraphics, OpenLayerGraphics, OpenGLGraphics, - * SDLGraphics, Image - * @since 0.1.0 - */ - class Graphics - { - public: - /** - * Alignments for text drawing. - */ - enum Alignment - { - LEFT = 0, - CENTER, - RIGHT - }; - - /** - * Constructor. - */ - Graphics(); - - A_DELETE_COPY(Graphics) - - /** - * Destructor. - */ - virtual ~Graphics() - { } - - /** - * Initializes drawing. Called by the Gui when Gui::draw() is called. - * It is needed by some implementations of Graphics to perform - * preparations before drawing. An example of such an implementation - * is the OpenGLGraphics. - * - * NOTE: You will never need to call this function yourself, unless - * you use a Graphics object outside of Guichan. - * - * @see _endDraw, Gui::draw - */ - virtual void _beginDraw() - { } - - /** - * Deinitializes drawing. Called by the Gui when a Gui::draw() is done. - * done. It should reset any state changes made by _beginDraw(). - * - * NOTE: You will never need to call this function yourself, unless - * you use a Graphics object outside of Guichan. - * - * @see _beginDraw, Gui::draw - */ - virtual void _endDraw() - { } - - /** - * Pushes a clip area onto the stack. The x and y coordinates in the - * rectangle is relative to the last pushed clip area. - * If the new area falls outside the current clip area, it will be - * clipped as necessary. - * - * If a clip area is outside of the top clip area a clip area with - * zero width and height will be pushed. - * - * @param area The clip area to be pushed onto the stack. - * @return False if the the new area lays outside the current clip - * area. - */ - virtual bool pushClipArea(Rectangle area); - - /** - * Removes the top most clip area from the stack. - * - * @throws Exception if the stack is empty. - */ - virtual void popClipArea(); - - /** - * Gets the current clip area. Usefull if you want to do drawing - * bypassing Graphics. - * - * @return The current clip area. - */ - virtual const ClipRectangle& getCurrentClipArea(); - - /** - * Draws a part of an image. - * - * NOTE: Width and height arguments will not scale the image but - * specifies the size of the part to be drawn. If you want - * to draw the whole image there is a simplified version of - * this function. - * - * EXAMPLE: @code drawImage(myImage, 10, 10, 20, 20, 40, 40); @endcode - * Will draw a rectangular piece of myImage starting at - * coordinate (10, 10) in myImage, with width and height 40. - * The piece will be drawn with it's top left corner at - * coordinate (20, 20). - * - * @param image The image to draw. - * @param srcX The source image x coordinate. - * @param srcY The source image y coordinate. - * @param dstX The destination x coordinate. - * @param dstY The destination y coordinate. - * @param width The width of the piece. - * @param height The height of the piece. - */ - virtual void drawImage(const Image* image, - int srcX, - int srcY, - int dstX, - int dstY, - int width, - int height) = 0; - /** - * Draws an image. A simplified version of the other drawImage. - * It will draw a whole image at the coordinate you specify. - * It is equivalent to calling: - * @code drawImage(myImage, 0, 0, dstX, dstY, image->getWidth(), \ - image->getHeight()); @endcode - */ - virtual void drawImage(const Image* image, int dstX, int dstY); - - /** - * Draws a single point/pixel. - * - * @param x The x coordinate. - * @param y The y coordinate. - */ - virtual void drawPoint(int x, int y) = 0; - - /** - * Ddraws a line. - * - * @param x1 The first x coordinate. - * @param y1 The first y coordinate. - * @param x2 The second x coordinate. - * @param y2 The second y coordinate. - */ - virtual void drawLine(int x1, int y1, int x2, int y2) = 0; - - /** - * Draws a simple, non-filled, rectangle with a one pixel width. - * - * @param rectangle The rectangle to draw. - */ - virtual void drawRectangle(const Rectangle& rectangle) = 0; - - /** - * Draws a filled rectangle. - * - * @param rectangle The filled rectangle to draw. - */ - virtual void fillRectangle(const Rectangle& rectangle) = 0; - - /** - * Sets the color to use when drawing. - * - * @param color A color. - * @see getColor - */ - virtual void setColor(const Color& color) = 0; - - /** - * Gets the color to use when drawing. - * - * @return The color used when drawing. - * @see setColor - */ - virtual const Color& getColor() const = 0; - - protected: - /** - * Holds the clip area stack. - */ - std::stack mClipStack; - - /** - * Holds the current font. - */ - Font* mFont; - }; -} // namespace gcn - -#endif // end GCN_GRAPHICS_HPP diff --git a/src/gui/base/gui.cpp b/src/gui/base/gui.cpp index e4827f716..73d6ff380 100644 --- a/src/gui/base/gui.cpp +++ b/src/gui/base/gui.cpp @@ -70,7 +70,6 @@ #include "gui/base/basiccontainer.hpp" #include "gui/base/exception.hpp" #include "gui/base/focushandler.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/input.hpp" #include "gui/base/keyinput.hpp" #include "gui/base/keylistener.hpp" @@ -78,6 +77,8 @@ #include "gui/base/mouselistener.hpp" #include "gui/base/widget.hpp" +#include "render/graphics.h" + #include "debug.h" namespace gcn diff --git a/src/gui/base/gui.hpp b/src/gui/base/gui.hpp index b1daba0fc..28a231101 100644 --- a/src/gui/base/gui.hpp +++ b/src/gui/base/gui.hpp @@ -71,10 +71,11 @@ #include "gui/base/mouseevent.hpp" #include "gui/base/mouseinput.hpp" +class Graphics; + namespace gcn { class FocusHandler; - class Graphics; class Input; class KeyListener; class Widget; diff --git a/src/gui/base/widget.cpp b/src/gui/base/widget.cpp index 2e8719446..eeb5849c7 100644 --- a/src/gui/base/widget.cpp +++ b/src/gui/base/widget.cpp @@ -74,13 +74,14 @@ #include "gui/base/event.hpp" #include "gui/base/exception.hpp" #include "gui/base/focushandler.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/keyinput.hpp" #include "gui/base/keylistener.hpp" #include "gui/base/mouseinput.hpp" #include "gui/base/mouselistener.hpp" #include "gui/base/widgetlistener.hpp" +#include "render/graphics.h" + #include "debug.h" namespace gcn diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp index 847e340e1..b6a81261e 100644 --- a/src/gui/base/widget.hpp +++ b/src/gui/base/widget.hpp @@ -73,6 +73,8 @@ #include "localconsts.h" +class Graphics; + namespace gcn { class ActionListener; @@ -81,7 +83,6 @@ namespace gcn class FocusHandler; class FocusListener; class Font; - class Graphics; class KeyInput; class KeyListener; class MouseInput; diff --git a/src/gui/base/widgets/button.cpp b/src/gui/base/widgets/button.cpp index a52bf2d78..3e699670a 100644 --- a/src/gui/base/widgets/button.cpp +++ b/src/gui/base/widgets/button.cpp @@ -69,11 +69,12 @@ #include "gui/base/exception.hpp" #include "gui/base/font.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/key.hpp" #include "gui/base/mouseevent.hpp" #include "gui/base/mouseinput.hpp" +#include "render/graphics.h" + #include "debug.h" namespace gcn diff --git a/src/gui/base/widgets/button.hpp b/src/gui/base/widgets/button.hpp index 4ae08eb16..cd41a1b02 100644 --- a/src/gui/base/widgets/button.hpp +++ b/src/gui/base/widgets/button.hpp @@ -67,12 +67,13 @@ #include #include "gui/base/focuslistener.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/keylistener.hpp" #include "gui/base/mouseevent.hpp" #include "gui/base/mouselistener.hpp" #include "gui/base/widget.hpp" +#include "render/graphics.h" + namespace gcn { /** diff --git a/src/gui/base/widgets/checkbox.cpp b/src/gui/base/widgets/checkbox.cpp index 908b4f509..615808a85 100644 --- a/src/gui/base/widgets/checkbox.cpp +++ b/src/gui/base/widgets/checkbox.cpp @@ -68,10 +68,11 @@ #include "gui/base/widgets/checkbox.hpp" #include "gui/base/font.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/key.hpp" #include "gui/base/mouseinput.hpp" +#include "render/graphics.h" + #include "debug.h" namespace gcn diff --git a/src/gui/base/widgets/container.cpp b/src/gui/base/widgets/container.cpp index 1e6de018b..d72f2a682 100644 --- a/src/gui/base/widgets/container.cpp +++ b/src/gui/base/widgets/container.cpp @@ -68,7 +68,8 @@ #include "gui/base/widgets/container.hpp" #include "gui/base/exception.hpp" -#include "gui/base/graphics.hpp" + +#include "render/graphics.h" #include "debug.h" diff --git a/src/gui/base/widgets/container.hpp b/src/gui/base/widgets/container.hpp index a5cbdb31b..bffe6e884 100644 --- a/src/gui/base/widgets/container.hpp +++ b/src/gui/base/widgets/container.hpp @@ -67,7 +67,8 @@ #include #include "gui/base/basiccontainer.hpp" -#include "gui/base/graphics.hpp" + +#include "render/graphics.h" namespace gcn { diff --git a/src/gui/base/widgets/label.cpp b/src/gui/base/widgets/label.cpp index 42fcd78f4..f4576d908 100644 --- a/src/gui/base/widgets/label.cpp +++ b/src/gui/base/widgets/label.cpp @@ -69,7 +69,8 @@ #include "gui/base/exception.hpp" #include "gui/base/font.hpp" -#include "gui/base/graphics.hpp" + +#include "render/graphics.h" #include "debug.h" diff --git a/src/gui/base/widgets/label.hpp b/src/gui/base/widgets/label.hpp index f1ef30b89..90a395f7b 100644 --- a/src/gui/base/widgets/label.hpp +++ b/src/gui/base/widgets/label.hpp @@ -66,9 +66,10 @@ #include -#include "gui/base/graphics.hpp" #include "gui/base/widget.hpp" +#include "render/graphics.h" + namespace gcn { /** diff --git a/src/gui/base/widgets/listbox.cpp b/src/gui/base/widgets/listbox.cpp index b97bf47d4..dcf443c77 100644 --- a/src/gui/base/widgets/listbox.cpp +++ b/src/gui/base/widgets/listbox.cpp @@ -69,12 +69,13 @@ #include "gui/base/basiccontainer.hpp" #include "gui/base/font.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/key.hpp" #include "gui/base/listmodel.hpp" #include "gui/base/mouseinput.hpp" #include "gui/base/selectionlistener.hpp" +#include "render/graphics.h" + #include "debug.h" namespace gcn diff --git a/src/gui/base/widgets/radiobutton.cpp b/src/gui/base/widgets/radiobutton.cpp index bfd5b1ff8..1e1da2622 100644 --- a/src/gui/base/widgets/radiobutton.cpp +++ b/src/gui/base/widgets/radiobutton.cpp @@ -68,10 +68,11 @@ #include "gui/base/widgets/radiobutton.hpp" #include "gui/base/font.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/key.hpp" #include "gui/base/mouseinput.hpp" +#include "render/graphics.h" + #include "debug.h" namespace gcn diff --git a/src/gui/base/widgets/scrollarea.cpp b/src/gui/base/widgets/scrollarea.cpp index e3dcfc61c..308cee473 100644 --- a/src/gui/base/widgets/scrollarea.cpp +++ b/src/gui/base/widgets/scrollarea.cpp @@ -68,7 +68,8 @@ #include "gui/base/widgets/scrollarea.hpp" #include "gui/base/exception.hpp" -#include "gui/base/graphics.hpp" + +#include "render/graphics.h" #include "debug.h" diff --git a/src/gui/base/widgets/slider.cpp b/src/gui/base/widgets/slider.cpp index a1a106303..e9ab36e86 100644 --- a/src/gui/base/widgets/slider.cpp +++ b/src/gui/base/widgets/slider.cpp @@ -67,10 +67,11 @@ #include "gui/base/widgets/slider.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/key.hpp" #include "gui/base/mouseinput.hpp" +#include "render/graphics.h" + #include "debug.h" namespace gcn diff --git a/src/gui/base/widgets/textbox.cpp b/src/gui/base/widgets/textbox.cpp index 2e9ca0563..411fc7dd5 100644 --- a/src/gui/base/widgets/textbox.cpp +++ b/src/gui/base/widgets/textbox.cpp @@ -69,10 +69,11 @@ #include "gui/base/basiccontainer.hpp" #include "gui/base/font.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/key.hpp" #include "gui/base/mouseinput.hpp" +#include "render/graphics.h" + #include "debug.h" namespace gcn diff --git a/src/gui/base/widgets/textfield.cpp b/src/gui/base/widgets/textfield.cpp index 586e49663..3349ebccb 100644 --- a/src/gui/base/widgets/textfield.cpp +++ b/src/gui/base/widgets/textfield.cpp @@ -68,10 +68,11 @@ #include "gui/base/widgets/textfield.hpp" #include "gui/base/font.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/key.hpp" #include "gui/base/mouseinput.hpp" +#include "render/graphics.h" + #include "debug.h" namespace gcn diff --git a/src/gui/base/widgets/window.cpp b/src/gui/base/widgets/window.cpp index c7a108ab8..6373bcb63 100644 --- a/src/gui/base/widgets/window.cpp +++ b/src/gui/base/widgets/window.cpp @@ -69,9 +69,10 @@ #include "gui/base/exception.hpp" #include "gui/base/font.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/mouseinput.hpp" +#include "render/graphics.h" + #include "debug.h" namespace gcn diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp index 8246cea94..bed4a9f31 100644 --- a/src/gui/sdlfont.cpp +++ b/src/gui/sdlfont.cpp @@ -444,7 +444,7 @@ void SDLFont::clear() mCache[f].clear(); } -void SDLFont::drawString(gcn::Graphics *const graphics, +void SDLFont::drawString(Graphics *const graphics, const std::string &text, const int x, const int y) { diff --git a/src/gui/sdlfont.h b/src/gui/sdlfont.h index 79ee0fbfb..1cb6f5c99 100644 --- a/src/gui/sdlfont.h +++ b/src/gui/sdlfont.h @@ -131,7 +131,7 @@ class SDLFont final : public gcn::Font /** * @see Font::drawString */ - void drawString(gcn::Graphics *const graphics, + void drawString(Graphics *const graphics, const std::string &text, const int x, const int y) override final; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 9982840de..2a91d1991 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -114,22 +114,20 @@ void Viewport::setMap(Map *const map) mMap = map; } -void Viewport::draw(gcn::Graphics *gcnGraphics) +void Viewport::draw(Graphics *graphics) { BLOCK_START("Viewport::draw 1") static int lastTick = tick_time; if (!mMap || !player_node) { - gcnGraphics->setColor(gcn::Color(64, 64, 64)); - gcnGraphics->fillRectangle( + graphics->setColor(gcn::Color(64, 64, 64)); + graphics->fillRectangle( gcn::Rectangle(0, 0, getWidth(), getHeight())); BLOCK_END("Viewport::draw 1") return; } - Graphics *const graphics = static_cast(gcnGraphics); - // Avoid freaking out when tick_time overflows if (tick_time < lastTick) lastTick = tick_time; @@ -260,7 +258,7 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) miniStatusWindow->drawIcons(graphics); // Draw contained widgets - WindowContainer::draw(gcnGraphics); + WindowContainer::draw(graphics); BLOCK_END("Viewport::draw 1") } diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 848a1ae8c..7e18d8395 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -83,7 +83,7 @@ class Viewport final : public WindowContainer, /** * Draws the viewport. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Implements player to keep following mouse. diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 4a477b802..e6f03493f 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -90,7 +90,7 @@ AvatarListBox::~AvatarListBox() } } -void AvatarListBox::draw(gcn::Graphics *gcnGraphics) +void AvatarListBox::draw(Graphics *gcnGraphics) { BLOCK_START("AvatarListBox::draw") if (!mListModel || !player_node) diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h index 99c1132b2..46e5c8dea 100644 --- a/src/gui/widgets/avatarlistbox.h +++ b/src/gui/widgets/avatarlistbox.h @@ -53,7 +53,7 @@ public: /** * Draws the list box. */ - void draw(gcn::Graphics *gcnGraphics) override final; + void draw(Graphics *gcnGraphics) override final; void mousePressed(gcn::MouseEvent &event) override final; diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index d7ce9ab12..e0fbf3d17 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -37,10 +37,11 @@ #include "utils/stringutils.h" #include "utils/timer.h" -#include "gui/base/graphics.hpp" #include "gui/base/font.hpp" #include "gui/base/cliprectangle.hpp" +#include "render/graphics.h" + #include #include "debug.h" @@ -446,13 +447,15 @@ void BrowserBox::mouseMoved(gcn::MouseEvent &event) ? static_cast(i - mLinks.begin()) : -1; } -void BrowserBox::draw(gcn::Graphics *graphics) +void BrowserBox::draw(Graphics *graphics) { BLOCK_START("BrowserBox::draw") - const gcn::ClipRectangle &cr = graphics->getCurrentClipArea(); + const gcn::ClipRectangle *const cr = graphics->getCurrentClipArea(); + if (!cr) + return; Graphics *const graphics2 = static_cast(graphics); - mYStart = cr.y - cr.yOffset; - const int yEnd = mYStart + cr.height; + mYStart = cr->y - cr->yOffset; + const int yEnd = mYStart + cr->height; if (mYStart < 0) mYStart = 0; diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index deefd886a..85ce9b96b 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -165,7 +165,7 @@ class BrowserBox final : public gcn::Widget, /** * Draws the browser box. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; void updateHeight(); diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index faefd6f6c..8954ecf8e 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -350,7 +350,7 @@ void Button::updateAlpha() } } -void Button::draw(gcn::Graphics *graphics) +void Button::draw(Graphics *graphics) { BLOCK_START("Button::draw") int mode; @@ -437,7 +437,7 @@ void Button::draw(gcn::Graphics *graphics) switch (mAlignment) { default: - case gcn::Graphics::LEFT: + case Graphics::LEFT: { if (mImages) { @@ -450,7 +450,7 @@ void Button::draw(gcn::Graphics *graphics) } break; } - case gcn::Graphics::CENTER: + case Graphics::CENTER: { const int width1 = font->getWidth(mCaption); if (mImages) @@ -465,7 +465,7 @@ void Button::draw(gcn::Graphics *graphics) } break; } - case gcn::Graphics::RIGHT: + case Graphics::RIGHT: { const int width1 = font->getWidth(mCaption); textX = width - width1 - padding; diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index aeec63b82..949993a48 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -102,7 +102,7 @@ class Button final : public gcn::Button, /** * Draws the button. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Update the alpha value to the button components. diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index fa227f5ca..e72296516 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -94,7 +94,7 @@ CheckBox::~CheckBox() } } -void CheckBox::draw(gcn::Graphics *const graphics) +void CheckBox::draw(Graphics *const graphics) { BLOCK_START("CheckBox::draw") drawBox(graphics); @@ -129,7 +129,7 @@ void CheckBox::updateAlpha() } } -void CheckBox::drawBox(gcn::Graphics *const graphics) +void CheckBox::drawBox(Graphics *const graphics) { if (!mSkin || !mDrawBox) return; diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h index d0864d0d5..a49c38d47 100644 --- a/src/gui/widgets/checkbox.h +++ b/src/gui/widgets/checkbox.h @@ -59,7 +59,7 @@ class CheckBox final : public gcn::CheckBox, /** * Draws the caption, then calls drawBox to draw the check box. */ - void draw(gcn::Graphics *const graphics) override final; + void draw(Graphics *const graphics) override final; /** * Update the alpha value to the checkbox components. @@ -69,7 +69,7 @@ class CheckBox final : public gcn::CheckBox, /** * Draws the check box, not the caption. */ - void drawBox(gcn::Graphics *const graphics); + void drawBox(Graphics *const graphics); /** * Called when the mouse enteres the widget area. diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp index 9730f7006..1d85874df 100644 --- a/src/gui/widgets/colorpage.cpp +++ b/src/gui/widgets/colorpage.cpp @@ -47,7 +47,7 @@ ColorPage::~ColorPage() { } -void ColorPage::draw(gcn::Graphics *graphics) +void ColorPage::draw(Graphics *graphics) { BLOCK_START("ColorPage::draw") diff --git a/src/gui/widgets/colorpage.h b/src/gui/widgets/colorpage.h index c1c90eddf..84a3011a9 100644 --- a/src/gui/widgets/colorpage.h +++ b/src/gui/widgets/colorpage.h @@ -36,7 +36,7 @@ class ColorPage final : public ListBox ~ColorPage(); - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; void resetAction(); diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 32c8a4988..4a4a73b53 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -103,7 +103,7 @@ void Desktop::widgetResized(const gcn::Event &event A_UNUSED) setBestFittingWallpaper(); } -void Desktop::draw(gcn::Graphics *graphics) +void Desktop::draw(Graphics *graphics) { BLOCK_START("Desktop::draw") Graphics *const g = static_cast(graphics); diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h index 88034fbbc..6982ce525 100644 --- a/src/gui/widgets/desktop.h +++ b/src/gui/widgets/desktop.h @@ -61,7 +61,7 @@ class Desktop final : public Container, private gcn::WidgetListener void widgetResized(const gcn::Event &event) override final; - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; void postInit(); diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 3669d3eab..354c88423 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -214,7 +214,7 @@ void DropDown::updateAlpha() } } -void DropDown::draw(gcn::Graphics* graphics) +void DropDown::draw(Graphics* graphics) { BLOCK_START("DropDown::draw") int h; @@ -286,7 +286,7 @@ void DropDown::draw(gcn::Graphics* graphics) BLOCK_END("DropDown::draw") } -void DropDown::drawFrame(gcn::Graphics *graphics) +void DropDown::drawFrame(Graphics *graphics) { BLOCK_START("DropDown::drawFrame") const int bs2 = getFrameSize(); @@ -296,7 +296,7 @@ void DropDown::drawFrame(gcn::Graphics *graphics) BLOCK_END("DropDown::drawFrame") } -void DropDown::drawButton(gcn::Graphics *graphics) +void DropDown::drawButton(Graphics *graphics) { const int height = mDroppedDown ? mFoldedUpHeight : mDimension.height; diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index da2eb64f9..af566fb69 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -82,9 +82,9 @@ class DropDown final : public gcn::ActionListener, */ void updateAlpha(); - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; - void drawFrame(gcn::Graphics *graphics) override final; + void drawFrame(Graphics *graphics) override final; // Inherited from KeyListener @@ -142,7 +142,7 @@ class DropDown final : public gcn::ActionListener, * * @param graphics a Graphics object to draw with. */ - void drawButton(gcn::Graphics *graphics); + void drawButton(Graphics *graphics); PopupList *mPopup; gcn::Color mShadowColor; diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 857eed024..892a74638 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -94,7 +94,7 @@ void DropShortcutContainer::setWidget2(const Widget2 *const widget) mUnEquipedColor2 = getThemeColor(Theme::ITEM_NOT_EQUIPPED_OUTLINE); } -void DropShortcutContainer::draw(gcn::Graphics *graphics) +void DropShortcutContainer::draw(Graphics *graphics) { if (!dropShortcut) return; diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h index b5a144cba..6b7a9f151 100644 --- a/src/gui/widgets/dropshortcutcontainer.h +++ b/src/gui/widgets/dropshortcutcontainer.h @@ -50,7 +50,7 @@ class DropShortcutContainer final : public ShortcutContainer /** * Draws the items. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Handles mouse when dragged. diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index f2f84ed56..869ae5d08 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -59,7 +59,7 @@ EmotePage::~EmotePage() mVertexes = nullptr; } -void EmotePage::draw(gcn::Graphics *graphics) +void EmotePage::draw(Graphics *graphics) { BLOCK_START("EmotePage::draw") diff --git a/src/gui/widgets/emotepage.h b/src/gui/widgets/emotepage.h index 1603bab5e..9cd2867aa 100644 --- a/src/gui/widgets/emotepage.h +++ b/src/gui/widgets/emotepage.h @@ -41,7 +41,7 @@ class EmotePage final : public gcn::Widget, ~EmotePage(); - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; void mousePressed(gcn::MouseEvent &mouseEvent) override final; diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 8d83ffeae..bdb5c3163 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -99,7 +99,7 @@ void EmoteShortcutContainer::setWidget2(const Widget2 *const widget) mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE); } -void EmoteShortcutContainer::draw(gcn::Graphics *graphics) +void EmoteShortcutContainer::draw(Graphics *graphics) { if (!emoteShortcut) return; diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index 2c99aaf87..62999207e 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -53,7 +53,7 @@ class EmoteShortcutContainer final : public ShortcutContainer /** * Draws the items. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Handles mouse when dragged. diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index 6aaf85bbe..66065295c 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -23,9 +23,10 @@ #include "gui/widgets/extendedlistmodel.h" #include "gui/base/font.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/listmodel.hpp" +#include "render/graphics.h" + #include "debug.h" ExtendedListBox::ExtendedListBox(const Widget2 *const widget, @@ -47,7 +48,7 @@ ExtendedListBox::~ExtendedListBox() { } -void ExtendedListBox::draw(gcn::Graphics *graphics) +void ExtendedListBox::draw(Graphics *graphics) { if (!mListModel) return; diff --git a/src/gui/widgets/extendedlistbox.h b/src/gui/widgets/extendedlistbox.h index 30e7a32fb..9fa14fa9e 100644 --- a/src/gui/widgets/extendedlistbox.h +++ b/src/gui/widgets/extendedlistbox.h @@ -59,7 +59,7 @@ class ExtendedListBox final : public ListBox /** * Draws the list box. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; void adjustSize() override; diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 9630f5c17..6928b11d8 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -30,9 +30,10 @@ #include "utils/dtor.h" #include "gui/base/actionlistener.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/key.hpp" +#include "render/graphics.h" + #include "debug.h" float GuiTable::mAlpha = 1.0; @@ -293,7 +294,7 @@ void GuiTable::installActionListeners() } // -- widget ops -void GuiTable::draw(gcn::Graphics* graphics) +void GuiTable::draw(Graphics* graphics) { if (!mModel || !getRowHeight()) return; diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index e91482078..2154d0889 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -113,7 +113,7 @@ public: } // Inherited from Widget - void draw(gcn::Graphics* graphics) override final; + void draw(Graphics* graphics) override final; gcn::Widget *getWidgetAt(int x, int y) override final A_WARN_UNUSED; diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index 4fb511c85..e9b7cd525 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -67,7 +67,7 @@ void Icon::setImage(Image *const image) } } -void Icon::draw(gcn::Graphics *g) +void Icon::draw(Graphics *g) { BLOCK_START("Icon::draw") if (mImage) diff --git a/src/gui/widgets/icon.h b/src/gui/widgets/icon.h index 98cb83b61..a39cec517 100644 --- a/src/gui/widgets/icon.h +++ b/src/gui/widgets/icon.h @@ -68,7 +68,7 @@ class Icon final : public gcn::Widget, /** * Draws the Icon. */ - void draw(gcn::Graphics *g) override final; + void draw(Graphics *g) override final; private: Image *mImage; diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 0361c54e7..eedbc1bd0 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -245,7 +245,7 @@ void ItemContainer::logic() BLOCK_END("ItemContainer::logic") } -void ItemContainer::draw(gcn::Graphics *graphics) +void ItemContainer::draw(Graphics *graphics) { if (!mInventory || !mShowMatrix) return; diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index c7ca851d9..cfacb05c6 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -85,7 +85,7 @@ class ItemContainer final : public gcn::Widget, /** * Draws the items. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; // KeyListener void keyPressed(gcn::KeyEvent &event) override final; diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 1334afae7..78b9c0e62 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -112,7 +112,7 @@ void ItemShortcutContainer::setWidget2(const Widget2 *const widget) mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE); } -void ItemShortcutContainer::draw(gcn::Graphics *graphics) +void ItemShortcutContainer::draw(Graphics *graphics) { BLOCK_START("ItemShortcutContainer::draw") const ItemShortcut *const selShortcut = itemShortcut[mNumber]; diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h index f9ec24589..c2dbe93a3 100644 --- a/src/gui/widgets/itemshortcutcontainer.h +++ b/src/gui/widgets/itemshortcutcontainer.h @@ -51,7 +51,7 @@ class ItemShortcutContainer final : public ShortcutContainer /** * Draws the items. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Handles mouse when dragged. diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 767830f5d..89ba17cd6 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -76,7 +76,7 @@ void Label::init() mPadding = 0; } -void Label::draw(gcn::Graphics* graphics) +void Label::draw(Graphics* graphics) { BLOCK_START("Label::draw") int textX; diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h index 2fc2393fb..0b96b87e4 100644 --- a/src/gui/widgets/label.h +++ b/src/gui/widgets/label.h @@ -59,7 +59,7 @@ class Label final : public gcn::Label, public Widget2 /** * Draws the label. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; void adjustSize(); diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 767067801..0a7956476 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -31,9 +31,10 @@ #include "gui/base/focushandler.hpp" #include "gui/base/font.hpp" -#include "gui/base/graphics.hpp" #include "gui/base/listmodel.hpp" +#include "render/graphics.h" + #include "debug.h" float ListBox::mAlpha = 1.0; @@ -98,7 +99,7 @@ void ListBox::updateAlpha() mAlpha = alpha; } -void ListBox::draw(gcn::Graphics *graphics) +void ListBox::draw(Graphics *graphics) { if (!mListModel) return; diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 784193fdf..459aea2e3 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -58,7 +58,7 @@ class ListBox : public gcn::ListBox, /** * Draws the list box. */ - void draw(gcn::Graphics *graphics) override; + void draw(Graphics *graphics) override; /** * Update the alpha value to the graphic components. diff --git a/src/gui/widgets/passwordfield.cpp b/src/gui/widgets/passwordfield.cpp index b2ee6ccad..1b562b7f0 100644 --- a/src/gui/widgets/passwordfield.cpp +++ b/src/gui/widgets/passwordfield.cpp @@ -31,7 +31,7 @@ PasswordField::PasswordField(const Widget2 *const widget, { } -void PasswordField::draw(gcn::Graphics *graphics) +void PasswordField::draw(Graphics *graphics) { BLOCK_START("PasswordField::draw") // std::string uses cow, thus cheap copy diff --git a/src/gui/widgets/passwordfield.h b/src/gui/widgets/passwordfield.h index 322d71b8b..f72350763 100644 --- a/src/gui/widgets/passwordfield.h +++ b/src/gui/widgets/passwordfield.h @@ -44,7 +44,7 @@ class PasswordField final : public TextField /** * Draws the password field. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; protected: int mPasswordChar; diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 6fda932bf..260f80099 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -107,7 +107,7 @@ void PlayerBox::init(std::string name, std::string selectedName) } } -void PlayerBox::draw(gcn::Graphics *graphics) +void PlayerBox::draw(Graphics *graphics) { BLOCK_START("PlayerBox::draw") if (mBeing) @@ -130,7 +130,7 @@ void PlayerBox::draw(gcn::Graphics *graphics) BLOCK_END("PlayerBox::draw") } -void PlayerBox::drawFrame(gcn::Graphics *graphics) +void PlayerBox::drawFrame(Graphics *graphics) { BLOCK_START("PlayerBox::drawFrame") if (mDrawBackground) diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h index b78c8c3f1..9671715b0 100644 --- a/src/gui/widgets/playerbox.h +++ b/src/gui/widgets/playerbox.h @@ -71,12 +71,12 @@ class PlayerBox final : public Widget2, /** * Draws the scroll area. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Draws the background and border of the scroll area. */ - void drawFrame(gcn::Graphics *graphics) override final; + void drawFrame(Graphics *graphics) override final; Being *getBeing() A_WARN_UNUSED { return mBeing; } diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index c0de328e7..56d5d0d0c 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -94,7 +94,7 @@ void Popup::setWindowContainer(WindowContainer *const wc) windowContainer = wc; } -void Popup::draw(gcn::Graphics *graphics) +void Popup::draw(Graphics *graphics) { BLOCK_START("Popup::draw") Graphics *const g = static_cast(graphics); diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index 7e7001891..f0fd1b932 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -75,7 +75,7 @@ class Popup : public Container, public gcn::MouseListener, /** * Draws the popup. */ - void draw(gcn::Graphics *graphics) override; + void draw(Graphics *graphics) override; /** * Sets the size of this popup. diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 61ecc9080..28c87f4ec 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -146,7 +146,7 @@ void ProgressBar::updateAlpha() mAlpha = alpha; } -void ProgressBar::draw(gcn::Graphics *graphics) +void ProgressBar::draw(Graphics *graphics) { BLOCK_START("ProgressBar::draw") updateAlpha(); diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index ca32fc165..022d86ab3 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -70,7 +70,7 @@ class ProgressBar final : public gcn::Widget, /** * Draws the progress bar. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Sets the current progress. diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index d89ff7f2a..358518132 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -65,7 +65,7 @@ void ProgressIndicator::logic() BLOCK_END("ProgressIndicator::logic") } -void ProgressIndicator::draw(gcn::Graphics *graphics) +void ProgressIndicator::draw(Graphics *graphics) { BLOCK_START("ProgressIndicator::draw") if (mIndicator) diff --git a/src/gui/widgets/progressindicator.h b/src/gui/widgets/progressindicator.h index fc9ab5b5f..8dd33bf4d 100644 --- a/src/gui/widgets/progressindicator.h +++ b/src/gui/widgets/progressindicator.h @@ -46,7 +46,7 @@ class ProgressIndicator final : public gcn::Widget, void logic() override final; - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; private: SimpleAnimation *mIndicator; diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index a81afa037..4a47a4b4e 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -110,7 +110,7 @@ void RadioButton::updateAlpha() } } -void RadioButton::drawBox(gcn::Graphics* graphics) +void RadioButton::drawBox(Graphics* graphics) { if (!mSkin) return; @@ -154,7 +154,7 @@ void RadioButton::drawBox(gcn::Graphics* graphics) } } -void RadioButton::draw(gcn::Graphics* graphics) +void RadioButton::draw(Graphics* graphics) { BLOCK_START("RadioButton::draw") drawBox(graphics); diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h index dca2d1167..ff6f5aafd 100644 --- a/src/gui/widgets/radiobutton.h +++ b/src/gui/widgets/radiobutton.h @@ -56,13 +56,13 @@ class RadioButton final : public gcn::RadioButton, /** * Draws the radiobutton, not the caption. */ - void drawBox(gcn::Graphics* graphics) override final; + void drawBox(Graphics* graphics) override final; /** * Implementation of the draw methods. * Thus, avoiding the rhomb around the radio button. */ - void draw(gcn::Graphics* graphics) override final; + void draw(Graphics* graphics) override final; /** * Called when the mouse enteres the widget area. diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index a260142a1..89e75f4d7 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -248,7 +248,7 @@ void ScrollArea::updateAlpha() } } -void ScrollArea::draw(gcn::Graphics *graphics) +void ScrollArea::draw(Graphics *graphics) { BLOCK_START("ScrollArea::draw") if (mVBarVisible || mHBarVisible) @@ -329,7 +329,7 @@ void ScrollArea::draw(gcn::Graphics *graphics) BLOCK_END("ScrollArea::draw") } -void ScrollArea::updateCalcFlag(gcn::Graphics *const graphics) +void ScrollArea::updateCalcFlag(Graphics *const graphics) { if (!mRedraw) { @@ -356,7 +356,7 @@ void ScrollArea::updateCalcFlag(gcn::Graphics *const graphics) } } -void ScrollArea::drawFrame(gcn::Graphics *graphics) +void ScrollArea::drawFrame(Graphics *graphics) { BLOCK_START("ScrollArea::drawFrame") if (mOpaque) @@ -392,7 +392,7 @@ void ScrollArea::setOpaque(bool opaque) setFrameSize(mOpaque ? 2 : 0); } -void ScrollArea::drawButton(gcn::Graphics *const graphics, +void ScrollArea::drawButton(Graphics *const graphics, const BUTTON_DIR dir) { int state = 0; @@ -430,7 +430,7 @@ void ScrollArea::drawButton(gcn::Graphics *const graphics, } } -void ScrollArea::calcButton(gcn::Graphics *const graphics, +void ScrollArea::calcButton(Graphics *const graphics, const BUTTON_DIR dir) { int state = 0; @@ -468,7 +468,7 @@ void ScrollArea::calcButton(gcn::Graphics *const graphics, } } -void ScrollArea::drawVBar(gcn::Graphics *const graphics) +void ScrollArea::drawVBar(Graphics *const graphics) { const gcn::Rectangle &dim = getVerticalBarDimension(); Graphics *const g = static_cast(graphics); @@ -491,7 +491,7 @@ void ScrollArea::drawVBar(gcn::Graphics *const graphics) } } -void ScrollArea::calcVBar(gcn::Graphics *const graphics) +void ScrollArea::calcVBar(Graphics *const graphics) { const gcn::Rectangle &dim = getVerticalBarDimension(); Graphics *const g = static_cast(graphics); @@ -514,7 +514,7 @@ void ScrollArea::calcVBar(gcn::Graphics *const graphics) } } -void ScrollArea::drawHBar(gcn::Graphics *const graphics) +void ScrollArea::drawHBar(Graphics *const graphics) { const gcn::Rectangle &dim = getHorizontalBarDimension(); Graphics *const g = static_cast(graphics); @@ -539,7 +539,7 @@ void ScrollArea::drawHBar(gcn::Graphics *const graphics) } } -void ScrollArea::calcHBar(gcn::Graphics *const graphics) +void ScrollArea::calcHBar(Graphics *const graphics) { const gcn::Rectangle &dim = getHorizontalBarDimension(); Graphics *const g = static_cast(graphics); @@ -564,7 +564,7 @@ void ScrollArea::calcHBar(gcn::Graphics *const graphics) } } -void ScrollArea::drawVMarker(gcn::Graphics *const graphics) +void ScrollArea::drawVMarker(Graphics *const graphics) { const gcn::Rectangle &dim = getVerticalMarkerDimension(); @@ -580,7 +580,7 @@ void ScrollArea::drawVMarker(gcn::Graphics *const graphics) } } -void ScrollArea::calcVMarker(gcn::Graphics *const graphics) +void ScrollArea::calcVMarker(Graphics *const graphics) { const gcn::Rectangle &dim = getVerticalMarkerDimension(); @@ -596,7 +596,7 @@ void ScrollArea::calcVMarker(gcn::Graphics *const graphics) } } -void ScrollArea::drawHMarker(gcn::Graphics *const graphics) +void ScrollArea::drawHMarker(Graphics *const graphics) { const gcn::Rectangle dim = getHorizontalMarkerDimension(); @@ -612,7 +612,7 @@ void ScrollArea::drawHMarker(gcn::Graphics *const graphics) } } -void ScrollArea::calcHMarker(gcn::Graphics *const graphics) +void ScrollArea::calcHMarker(Graphics *const graphics) { const gcn::Rectangle dim = getHorizontalMarkerDimension(); diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index 58bd73107..fe60399df 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -84,12 +84,12 @@ class ScrollArea final : public gcn::ScrollArea, /** * Draws the scroll area. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Draws the background and border of the scroll area. */ - void drawFrame(gcn::Graphics *graphics) override final; + void drawFrame(Graphics *graphics) override final; /** * Sets whether the widget should draw its background or not. @@ -158,19 +158,19 @@ class ScrollArea final : public gcn::ScrollArea, */ void init(std::string skinName); - void drawButton(gcn::Graphics *const graphics, const BUTTON_DIR dir); - void calcButton(gcn::Graphics *const graphics, const BUTTON_DIR dir); - void drawVBar(gcn::Graphics *const graphics) override final; - void drawHBar(gcn::Graphics *const graphics) override final; - void drawVMarker(gcn::Graphics *const graphics) override final; - void drawHMarker(gcn::Graphics *const graphics) override final; + void drawButton(Graphics *const graphics, const BUTTON_DIR dir); + void calcButton(Graphics *const graphics, const BUTTON_DIR dir); + void drawVBar(Graphics *const graphics) override final; + void drawHBar(Graphics *const graphics) override final; + void drawVMarker(Graphics *const graphics) override final; + void drawHMarker(Graphics *const graphics) override final; - void calcVBar(gcn::Graphics *const graphics); - void calcHBar(gcn::Graphics *const graphics); - void calcVMarker(gcn::Graphics *const graphics); - void calcHMarker(gcn::Graphics *const graphics); + void calcVBar(Graphics *const graphics); + void calcHBar(Graphics *const graphics); + void calcVMarker(Graphics *const graphics); + void calcHMarker(Graphics *const graphics); - void updateCalcFlag(gcn::Graphics *const graphics); + void updateCalcFlag(Graphics *const graphics); static int instances; static float mAlpha; diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 4a7fda039..644023c43 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -82,7 +82,7 @@ void ShopListBox::setPlayersMoney(const int money) mPlayerMoney = money; } -void ShopListBox::draw(gcn::Graphics *gcnGraphics) +void ShopListBox::draw(Graphics *gcnGraphics) { BLOCK_START("ShopListBox::draw") if (!mListModel || !mShopItems) diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index 095d187eb..509af8393 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -56,7 +56,7 @@ class ShopListBox final : public ListBox /** * Draws the list box. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * gives information about the current player's money diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index 88e27320a..4d4ff2389 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -53,7 +53,7 @@ class ShortcutContainer : public gcn::Widget, /** * Draws the shortcuts */ - virtual void draw(gcn::Graphics *graphics) override = 0; + virtual void draw(Graphics *graphics) override = 0; /** * Invoked when a widget changes its size. This is used to determine diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 750b58528..1427bb6eb 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -118,7 +118,7 @@ void Slider::updateAlpha() } } -void Slider::draw(gcn::Graphics *graphics) +void Slider::draw(Graphics *graphics) { BLOCK_START("Slider::draw") if (!buttons[0].grid[HSTART] || !buttons[1].grid[HSTART] diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h index d5d4a30fe..c59e0c47f 100644 --- a/src/gui/widgets/slider.h +++ b/src/gui/widgets/slider.h @@ -65,7 +65,7 @@ class Slider final : public gcn::Slider, /** * Draws the slider. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Called when the mouse enteres the widget area. diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index 4416a00b7..b75f65820 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -103,7 +103,7 @@ void SliderList::resize() updateLabel(); } -void SliderList::draw(gcn::Graphics *graphics) +void SliderList::draw(Graphics *graphics) { BLOCK_START("SliderList::draw") const int width = mDimension.width; diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h index 016a60290..e0f63517b 100644 --- a/src/gui/widgets/sliderlist.h +++ b/src/gui/widgets/sliderlist.h @@ -55,7 +55,7 @@ class SliderList final : public Container, void resize(); - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; void action(const gcn::ActionEvent &event) override final; diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index e59b9fbdb..7c59676b9 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -90,7 +90,7 @@ void SpellShortcutContainer::setWidget2(const Widget2 *const widget) mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE); } -void SpellShortcutContainer::draw(gcn::Graphics *graphics) +void SpellShortcutContainer::draw(Graphics *graphics) { if (!spellShortcut) return; diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index 37e7b5660..3115e47fe 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -50,7 +50,7 @@ class SpellShortcutContainer final : public ShortcutContainer /** * Draws the items. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Handles mouse when dragged. diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 8cb8fd78a..2a212ce75 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -139,7 +139,7 @@ Tab *TabbedArea::getTab(const std::string &name) const return nullptr; } -void TabbedArea::draw(gcn::Graphics *graphics) +void TabbedArea::draw(Graphics *graphics) { BLOCK_START("TabbedArea::draw") if (mTabs.empty()) diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 7a023903f..dede91767 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -60,7 +60,7 @@ class TabbedArea final : public Widget2, /** * Draw the tabbed area. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Return how many tabs have been created. diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index 4f1703d31..d0561cadf 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -153,7 +153,7 @@ void Tab::updateAlpha() } } -void Tab::draw(gcn::Graphics *graphics) +void Tab::draw(Graphics *graphics) { BLOCK_START("Tab::draw") int mode = TAB_STANDARD; diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h index fa9846ab4..66f7521d9 100644 --- a/src/gui/widgets/tabs/tab.h +++ b/src/gui/widgets/tabs/tab.h @@ -68,7 +68,7 @@ class Tab : public gcn::BasicContainer, /** * Draw the tabbed area. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Set the normal color for the tab's text. diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 3f56ecfcf..8aaca4211 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -350,7 +350,7 @@ void TextBox::keyPressed(gcn::KeyEvent& keyEvent) keyEvent.consume(); } -void TextBox::draw(gcn::Graphics* graphics) +void TextBox::draw(Graphics* graphics) { BLOCK_START("TextBox::draw") if (mOpaque) diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h index 797707716..d8841cfeb 100644 --- a/src/gui/widgets/textbox.h +++ b/src/gui/widgets/textbox.h @@ -62,7 +62,7 @@ class TextBox final : public gcn::TextBox, void keyPressed(gcn::KeyEvent& keyEvent) override final; - void draw(gcn::Graphics* graphics) override final; + void draw(Graphics* graphics) override final; void setForegroundColor(const gcn::Color &color); diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index b655de830..b1d188f22 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -137,7 +137,7 @@ void TextField::updateAlpha() } } -void TextField::draw(gcn::Graphics *graphics) +void TextField::draw(Graphics *graphics) { BLOCK_START("TextField::draw") updateAlpha(); @@ -155,7 +155,7 @@ void TextField::draw(gcn::Graphics *graphics) BLOCK_END("TextField::draw") } -void TextField::drawFrame(gcn::Graphics *graphics) +void TextField::drawFrame(Graphics *graphics) { BLOCK_START("TextField::drawFrame") const int bs = 2 * mFrameSize; @@ -661,12 +661,14 @@ void TextField::handleCopy() const sendBuffer(text); } -void TextField::drawCaret(gcn::Graphics* graphics, int x) +void TextField::drawCaret(Graphics* graphics, int x) { - const gcn::Rectangle &clipArea = graphics->getCurrentClipArea(); + const gcn::Rectangle *const clipArea = graphics->getCurrentClipArea(); + if (!clipArea) + return; graphics->setColor(*mCaretColor); - graphics->drawLine(x + mPadding, clipArea.height - mPadding, + graphics->drawLine(x + mPadding, clipArea->height - mPadding, x + mPadding, mPadding); } diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index d8ab2c830..d3d1ff0eb 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -60,7 +60,7 @@ class TextField : public gcn::TextField, /** * Draws the text field. */ - virtual void draw(gcn::Graphics *graphics) override; + virtual void draw(Graphics *graphics) override; /** * Update the alpha value to the graphic components. @@ -70,7 +70,7 @@ class TextField : public gcn::TextField, /** * Draws the background and border. */ - void drawFrame(gcn::Graphics *graphics) override final; + void drawFrame(Graphics *graphics) override final; /** * Determine whether the field should be numeric or not @@ -142,7 +142,7 @@ class TextField : public gcn::TextField, void caretDeleteWord(); protected: - void drawCaret(gcn::Graphics* graphics, int x) override final; + void drawCaret(Graphics* graphics, int x) override final; void fixScroll(); diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 8d473dd46..5cfb2abb5 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -79,7 +79,7 @@ TextPreview::~TextPreview() } } -void TextPreview::draw(gcn::Graphics* graphics) +void TextPreview::draw(Graphics* graphics) { BLOCK_START("TextPreview::draw") if (client->getGuiAlpha() != mAlpha) diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h index bfb361a9b..f529e470c 100644 --- a/src/gui/widgets/textpreview.h +++ b/src/gui/widgets/textpreview.h @@ -102,7 +102,7 @@ class TextPreview final : public gcn::Widget, * * @param graphics graphics to draw into */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Set opacity for this widget (whether or not to show the background diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index c78582a91..26ca0a29f 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -74,7 +74,7 @@ Window::Window(const std::string &caption, const bool modal, mVertexes(new ImageCollection), mCaptionOffsetX(7), mCaptionOffsetY(5), - mCaptionAlign(gcn::Graphics::LEFT), + mCaptionAlign(Graphics::LEFT), mTitlePadding(4), mGripPadding(2), mResizeHandles(-1), @@ -123,12 +123,12 @@ Window::Window(const std::string &caption, const bool modal, mCaptionOffsetY = getOption("captionoffsety"); if (!mCaptionOffsetY) mCaptionOffsetY = 5; - mCaptionAlign = static_cast( + mCaptionAlign = static_cast( getOption("captionalign")); - if (mCaptionAlign < gcn::Graphics::LEFT - || mCaptionAlign > gcn::Graphics::RIGHT) + if (mCaptionAlign < Graphics::LEFT + || mCaptionAlign > Graphics::RIGHT) { - mCaptionAlign = gcn::Graphics::LEFT; + mCaptionAlign = Graphics::LEFT; } setTitleBarHeight(getOption("titlebarHeight")); if (!mTitleBarHeight) @@ -203,7 +203,7 @@ void Window::setWindowContainer(WindowContainer *const wc) windowContainer = wc; } -void Window::draw(gcn::Graphics *graphics) +void Window::draw(Graphics *graphics) { if (!mSkin) return; diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 29fd589a5..68ce1a293 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -80,7 +80,7 @@ class Window : public gcn::Window, /** * Draws the window. */ - void draw(gcn::Graphics *graphics) override; + void draw(Graphics *graphics) override; /** * Sets the size of this window. @@ -501,7 +501,7 @@ class Window : public gcn::Window, ImageCollection *mVertexes; int mCaptionOffsetX; int mCaptionOffsetY; - gcn::Graphics::Alignment mCaptionAlign; + Graphics::Alignment mCaptionAlign; int mTitlePadding; int mGripPadding; int mResizeHandles; diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp index d23f29bad..5adde3cae 100644 --- a/src/gui/widgets/windowcontainer.cpp +++ b/src/gui/widgets/windowcontainer.cpp @@ -79,7 +79,7 @@ void WindowContainer::moveWidgetAfter(gcn::Widget *const after, } #ifdef USE_PROFILER -void WindowContainer::draw(gcn::Graphics* graphics) +void WindowContainer::draw(Graphics* graphics) { BLOCK_START("WindowContainer::draw") Container::draw(graphics); diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h index 2ee4ea37d..d940a4e91 100644 --- a/src/gui/widgets/windowcontainer.h +++ b/src/gui/widgets/windowcontainer.h @@ -57,7 +57,7 @@ class WindowContainer : public Container gcn::Widget *const widget); #ifdef USE_PROFILER - void draw(gcn::Graphics* graphics); + void draw(Graphics* graphics); #endif private: diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index a094b5b08..127d3657d 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -419,7 +419,7 @@ void WindowMenu::saveButtons() const config.deleteKey("windowmenu" + toString(f)); } -void WindowMenu::drawChildren(gcn::Graphics* graphics) +void WindowMenu::drawChildren(Graphics* graphics) { if (mHaveMouse || !mAutoHide || (mAutoHide == 1 && mainGraphics && (mSmallWindow || mainGraphics->mWidth > 800))) diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h index a87f655d8..bf8298b75 100644 --- a/src/gui/windowmenu.h +++ b/src/gui/windowmenu.h @@ -118,7 +118,7 @@ class WindowMenu final : public Container, #endif protected: - void drawChildren(gcn::Graphics* graphics) override final; + void drawChildren(Graphics* graphics) override final; private: inline void addButton(const char *const text, diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index cfefa8159..ccddc76cd 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -247,7 +247,7 @@ void BuyDialog::init() mSlider = new Slider(1.0); mQuantityLabel = new Label(this, strprintf( "%d / %d", mAmountItems, mMaxItems)); - mQuantityLabel->setAlignment(gcn::Graphics::CENTER); + mQuantityLabel->setAlignment(Graphics::CENTER); // TRANSLATORS: buy dialog label mMoneyLabel = new Label(this, strprintf( _("Price: %s / Total: %s"), "", "")); diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index a21efbe52..5bff2ee4b 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1902,7 +1902,7 @@ void ChatWindow::mouseExited(gcn::MouseEvent& mouseEvent) Window::mouseExited(mouseEvent); } -void ChatWindow::draw(gcn::Graphics* graphics) +void ChatWindow::draw(Graphics* graphics) { BLOCK_START("ChatWindow::draw") if (!mAutoHide || mHaveMouse) diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index 742c79876..d20f68ecc 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -280,7 +280,7 @@ class ChatWindow final : public Window, void mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) override final; - void draw(gcn::Graphics* graphics) override final; + void draw(Graphics* graphics) override final; void updateVisibility(); diff --git a/src/gui/windows/connectiondialog.cpp b/src/gui/windows/connectiondialog.cpp index 6d01dcaae..b0ffc25cd 100644 --- a/src/gui/windows/connectiondialog.cpp +++ b/src/gui/windows/connectiondialog.cpp @@ -66,7 +66,7 @@ void ConnectionDialog::action(const gcn::ActionEvent &) client->setState(mCancelState); } -void ConnectionDialog::draw(gcn::Graphics *graphics) +void ConnectionDialog::draw(Graphics *graphics) { BLOCK_START("ConnectionDialog::draw") // Don't draw the window background, only draw the children diff --git a/src/gui/windows/connectiondialog.h b/src/gui/windows/connectiondialog.h index dd3c84e5e..773522839 100644 --- a/src/gui/windows/connectiondialog.h +++ b/src/gui/windows/connectiondialog.h @@ -57,7 +57,7 @@ class ConnectionDialog final : public Window, private gcn::ActionListener */ void action(const gcn::ActionEvent &) override; - void draw(gcn::Graphics *graphics) override; + void draw(Graphics *graphics) override; private: State mCancelState; diff --git a/src/gui/windows/debugwindow.cpp b/src/gui/windows/debugwindow.cpp index 30d202054..4f57b9798 100644 --- a/src/gui/windows/debugwindow.cpp +++ b/src/gui/windows/debugwindow.cpp @@ -129,7 +129,7 @@ void DebugWindow::slowLogic() BLOCK_END("DebugWindow::slowLogic") } -void DebugWindow::draw(gcn::Graphics *g) +void DebugWindow::draw(Graphics *g) { BLOCK_START("DebugWindow::draw") Window::draw(g); diff --git a/src/gui/windows/debugwindow.h b/src/gui/windows/debugwindow.h index 13e73c29e..83d6676da 100644 --- a/src/gui/windows/debugwindow.h +++ b/src/gui/windows/debugwindow.h @@ -147,7 +147,7 @@ class DebugWindow final : public Window */ void slowLogic(); - void draw(gcn::Graphics *g) override final; + void draw(Graphics *g) override final; void setPing(int pingTime); diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index c796c8433..e7bf02aa9 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -156,7 +156,7 @@ EquipmentWindow::~EquipmentWindow() mVertexes = nullptr; } -void EquipmentWindow::draw(gcn::Graphics *graphics) +void EquipmentWindow::draw(Graphics *graphics) { BLOCK_START("EquipmentWindow::draw") // Draw window graphics diff --git a/src/gui/windows/equipmentwindow.h b/src/gui/windows/equipmentwindow.h index 4b6ae8b4c..1ce8611a7 100644 --- a/src/gui/windows/equipmentwindow.h +++ b/src/gui/windows/equipmentwindow.h @@ -81,7 +81,7 @@ class EquipmentWindow final : public Window, public gcn::ActionListener /** * Draws the equipment window. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; void action(const gcn::ActionEvent &event) override final; diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 02be64a13..181055053 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -233,7 +233,7 @@ void Minimap::toggle() mShow = isWindowVisible(); } -void Minimap::draw(gcn::Graphics *graphics) +void Minimap::draw(Graphics *graphics) { BLOCK_START("Minimap::draw") Window::draw(graphics); diff --git a/src/gui/windows/minimap.h b/src/gui/windows/minimap.h index 90c08db0f..661412c57 100644 --- a/src/gui/windows/minimap.h +++ b/src/gui/windows/minimap.h @@ -60,7 +60,7 @@ class Minimap final : public Window, public ConfigListener /** * Draws the minimap. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; void mouseMoved(gcn::MouseEvent &event) override final; diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index b5832c7b7..3513bb2ff 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -308,7 +308,7 @@ void MiniStatusWindow::logic() BLOCK_END("MiniStatusWindow::logic") } -void MiniStatusWindow::draw(gcn::Graphics *graphics) +void MiniStatusWindow::draw(Graphics *graphics) { BLOCK_START("MiniStatusWindow::draw") drawChildren(graphics); diff --git a/src/gui/windows/ministatuswindow.h b/src/gui/windows/ministatuswindow.h index 2a5903eca..7748f51d1 100644 --- a/src/gui/windows/ministatuswindow.h +++ b/src/gui/windows/ministatuswindow.h @@ -68,7 +68,7 @@ class MiniStatusWindow final : public Popup, void logic() override final; - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; void mouseMoved(gcn::MouseEvent &mouseEvent) override final; diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index d686056ac..677337b70 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -91,8 +91,8 @@ OutfitWindow::OutfitWindow(): setMinWidth(145); setMinHeight(220); - mCurrentLabel->setAlignment(gcn::Graphics::CENTER); - mKeyLabel->setAlignment(gcn::Graphics::CENTER); + mCurrentLabel->setAlignment(Graphics::CENTER); + mKeyLabel->setAlignment(Graphics::CENTER); mUnequipCheck->setActionEventId("unequip"); mUnequipCheck->addActionListener(this); @@ -310,7 +310,7 @@ void OutfitWindow::copyOutfit(const int src, const int dst) save(); } -void OutfitWindow::draw(gcn::Graphics *graphics) +void OutfitWindow::draw(Graphics *graphics) { BLOCK_START("OutfitWindow::draw") Window::draw(graphics); diff --git a/src/gui/windows/outfitwindow.h b/src/gui/windows/outfitwindow.h index 6d54889e6..01e72aefc 100644 --- a/src/gui/windows/outfitwindow.h +++ b/src/gui/windows/outfitwindow.h @@ -52,7 +52,7 @@ class OutfitWindow final : public Window, void action(const gcn::ActionEvent &event) override final; - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; void mousePressed(gcn::MouseEvent &event) override final; diff --git a/src/gui/windows/selldialog.cpp b/src/gui/windows/selldialog.cpp index 15389a9c3..a4ff29f78 100644 --- a/src/gui/windows/selldialog.cpp +++ b/src/gui/windows/selldialog.cpp @@ -94,7 +94,7 @@ void SellDialog::init() mQuantityLabel = new Label(this, strprintf( "%d / %d", mAmountItems, mMaxItems)); - mQuantityLabel->setAlignment(gcn::Graphics::CENTER); + mQuantityLabel->setAlignment(Graphics::CENTER); // TRANSLATORS: sell dialog label mMoneyLabel = new Label(this, strprintf(_("Price: %s / Total: %s"), "", "")); diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index dec80b50a..82a264ac7 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -157,7 +157,7 @@ public: mHighlightColor = getThemeColor(Theme::HIGHLIGHT); } - void draw(gcn::Graphics *graphics) override final + void draw(Graphics *graphics) override final { if (!mListModel) return; diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index c4505b37c..674848725 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -100,7 +100,7 @@ class SkillListBox final : public ListBox return static_cast(mListModel)->getSkillAt(selected); } - void draw(gcn::Graphics *gcnGraphics) override + void draw(Graphics *gcnGraphics) override { if (!mListModel) return; diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp index 7e3687006..653b4d4c0 100644 --- a/src/render/graphics.cpp +++ b/src/render/graphics.cpp @@ -20,6 +20,49 @@ * along with this program. If not, see . */ +/* _______ __ __ __ ______ __ __ _______ __ __ + * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ + * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / + * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / + * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / + * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / + * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ + * + * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson + * + * + * Per Larsson a.k.a finalman + * Olof Naessén a.k.a jansem/yakslem + * + * Visit: http://guichan.sourceforge.net + * + * License: (BSD) + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Guichan nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #include "render/graphics.h" #include "main.h" @@ -48,11 +91,11 @@ Graphics *mainGraphics = nullptr; Graphics::Graphics() : - gcn::Graphics(), mWidth(0), mHeight(0), mActualWidth(0), mActualHeight(0), + mClipStack(), mWindow(nullptr), #ifdef USE_SDL2 mRenderer(nullptr), @@ -503,3 +546,82 @@ void Graphics::setWindowSize(const int width A_UNUSED, SDL_SetWindowSize(mWindow, width, height); #endif } + +bool Graphics::pushClipArea(gcn::Rectangle area) +{ + // Ignore area with a negate width or height + // by simple pushing an empty clip area + // to the stack. + if (area.width < 0 || area.height < 0) + { + gcn::ClipRectangle carea; + mClipStack.push(carea); + return true; + } + + if (mClipStack.empty()) + { + gcn::ClipRectangle carea; + carea.x = area.x; + carea.y = area.y; + carea.width = area.width; + carea.height = area.height; + carea.xOffset = area.x; + carea.yOffset = area.y; + mClipStack.push(carea); + return true; + } + + const gcn::ClipRectangle &top = mClipStack.top(); + gcn::ClipRectangle carea; + carea = area; + carea.xOffset = top.xOffset + carea.x; + carea.yOffset = top.yOffset + carea.y; + carea.x += top.xOffset; + carea.y += top.yOffset; + + // Clamp the pushed clip rectangle. + if (carea.x < top.x) + carea.x = top.x; + + if (carea.y < top.y) + carea.y = top.y; + + if (carea.x + carea.width > top.x + top.width) + { + carea.width = top.x + top.width - carea.x; + + if (carea.width < 0) + carea.width = 0; + } + + if (carea.y + carea.height > top.y + top.height) + { + carea.height = top.y + top.height - carea.y; + + if (carea.height < 0) + carea.height = 0; + } + + const bool result = carea.isIntersecting(top); + + mClipStack.push(carea); + + return result; +} + +void Graphics::popClipArea() +{ + if (mClipStack.empty()) + return; + + mClipStack.pop(); +} + +const gcn::ClipRectangle *Graphics::getCurrentClipArea() const +{ + if (mClipStack.empty()) + return nullptr; + + return &mClipStack.top(); +} diff --git a/src/render/graphics.h b/src/render/graphics.h index 93d46b475..53eb4af12 100644 --- a/src/render/graphics.h +++ b/src/render/graphics.h @@ -20,6 +20,49 @@ * along with this program. If not, see . */ +/* _______ __ __ __ ______ __ __ _______ __ __ + * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ + * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / + * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / + * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / + * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / + * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ + * + * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson + * + * + * Per Larsson a.k.a finalman + * Olof Naessén a.k.a jansem/yakslem + * + * Visit: http://guichan.sourceforge.net + * + * License: (BSD) + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Guichan nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #ifndef RENDER_GRAPHICS_H #define RENDER_GRAPHICS_H @@ -29,13 +72,15 @@ #include "render/renderers.h" +#include "gui/base/cliprectangle.hpp" #include "gui/base/color.hpp" -#include "gui/base/graphics.hpp" #ifdef USE_SDL2 #include #endif +#include + #include "localconsts.h" class Image; @@ -94,7 +139,7 @@ class ImageRect final /** * A central point of control for graphics. */ -class Graphics : public gcn::Graphics +class Graphics { public: A_DELETE_COPY(Graphics) @@ -104,6 +149,16 @@ class Graphics : public gcn::Graphics */ virtual ~Graphics(); + /** + * Alignments for text drawing. + */ + enum Alignment + { + LEFT = 0, + CENTER, + RIGHT + }; + void setWindow(SDL_Window *const window, const int width, const int height) { @@ -145,14 +200,6 @@ class Graphics : public gcn::Graphics */ virtual bool resizeScreen(const int width, const int height); - // override unused abstract function - void drawImage(const gcn::Image* image A_UNUSED, - int srcX A_UNUSED, int srcY A_UNUSED, - int dstX A_UNUSED, int dstY A_UNUSED, - int width A_UNUSED, int height A_UNUSED) override final - { - } - /** * Draws a resclaled version of the image */ @@ -211,8 +258,7 @@ class Graphics : public gcn::Graphics const int w, const int h, const ImageRect &imgRect) = 0; - virtual void fillRectangle(const gcn::Rectangle& rectangle) - override = 0; + virtual void fillRectangle(const gcn::Rectangle& rectangle) = 0; /** * Updates the screen. This is done by either copying the buffer to the @@ -246,9 +292,6 @@ class Graphics : public gcn::Graphics const int x2, const int y2, const int width, const int height); - const gcn::Font *getFont() const A_WARN_UNUSED - { return mFont; } - gcn::ClipRectangle &getTopClip() A_WARN_UNUSED { return mClipStack.top(); } @@ -288,7 +331,7 @@ class Graphics : public gcn::Graphics virtual void initArrays() { } - void setColor(const gcn::Color &color) override + virtual void setColor(const gcn::Color &color) { mColor = color; mColor2 = color; @@ -305,7 +348,7 @@ class Graphics : public gcn::Graphics mAlpha = (color.a != 255); } - const gcn::Color &getColor() const override + const gcn::Color &getColor() const { return mColor; } const gcn::Color &getColor2() const @@ -353,6 +396,87 @@ class Graphics : public gcn::Graphics void setScale(int scale); + /** + * Pushes a clip area onto the stack. The x and y coordinates in the + * rectangle is relative to the last pushed clip area. + * If the new area falls outside the current clip area, it will be + * clipped as necessary. + * + * If a clip area is outside of the top clip area a clip area with + * zero width and height will be pushed. + * + * @param area The clip area to be pushed onto the stack. + * @return False if the the new area lays outside the current clip + * area. + */ + virtual bool pushClipArea(gcn::Rectangle area); + + /** + * Removes the top most clip area from the stack. + * + * @throws Exception if the stack is empty. + */ + virtual void popClipArea(); + + /** + * Ddraws a line. + * + * @param x1 The first x coordinate. + * @param y1 The first y coordinate. + * @param x2 The second x coordinate. + * @param y2 The second y coordinate. + */ + virtual void drawLine(int x1, int y1, int x2, int y2) = 0; + + /** + * Draws a simple, non-filled, rectangle with a one pixel width. + * + * @param rectangle The rectangle to draw. + */ + virtual void drawRectangle(const gcn::Rectangle &rectangle) = 0; + + /** + * Gets the current clip area. Usefull if you want to do drawing + * bypassing Graphics. + * + * @return The current clip area. + */ + virtual const gcn::ClipRectangle *getCurrentClipArea() const; + + /** + * Draws a single point/pixel. + * + * @param x The x coordinate. + * @param y The y coordinate. + */ + virtual void drawPoint(int x, int y) = 0; + + /** + * Initializes drawing. Called by the Gui when Gui::draw() is called. + * It is needed by some implementations of Graphics to perform + * preparations before drawing. An example of such an implementation + * is the OpenGLGraphics. + * + * NOTE: You will never need to call this function yourself, unless + * you use a Graphics object outside of Guichan. + * + * @see _endDraw, Gui::draw + */ + virtual void _beginDraw() + { } + + /** + * Deinitializes drawing. Called by the Gui when a Gui::draw() is done. + * done. It should reset any state changes made by _beginDraw(). + * + * NOTE: You will never need to call this function yourself, unless + * you use a Graphics object outside of Guichan. + * + * @see _beginDraw, Gui::draw + */ + virtual void _endDraw() + { } + int mWidth; int mHeight; int mActualWidth; @@ -382,6 +506,11 @@ class Graphics : public gcn::Graphics bool videoInfo(); + /** + * Holds the clip area stack. + */ + std::stack mClipStack; + SDL_Window *mWindow; #ifdef USE_SDL2 diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp index 82bf04dc8..252dc0766 100644 --- a/src/render/mobileopenglgraphics.cpp +++ b/src/render/mobileopenglgraphics.cpp @@ -963,7 +963,7 @@ bool MobileOpenGLGraphics::pushClipArea(gcn::Rectangle area) transY = -clipArea.yOffset; } - const bool result = gcn::Graphics::pushClipArea(area); + const bool result = Graphics::pushClipArea(area); const gcn::ClipRectangle &clipArea = mClipStack.top(); transX += clipArea.xOffset; @@ -990,7 +990,7 @@ void MobileOpenGLGraphics::popClipArea() int transX = -clipArea1.xOffset; int transY = -clipArea1.yOffset; - gcn::Graphics::popClipArea(); + Graphics::popClipArea(); if (mClipStack.empty()) return; diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp index e8e1a2116..aea3f5d24 100644 --- a/src/render/normalopenglgraphics.cpp +++ b/src/render/normalopenglgraphics.cpp @@ -1223,7 +1223,7 @@ bool NormalOpenGLGraphics::pushClipArea(gcn::Rectangle area) transY = -clipArea.yOffset; } - const bool result = gcn::Graphics::pushClipArea(area); + const bool result = Graphics::pushClipArea(area); const gcn::ClipRectangle &clipArea = mClipStack.top(); transX += clipArea.xOffset; @@ -1251,7 +1251,7 @@ void NormalOpenGLGraphics::popClipArea() int transX = -clipArea1.xOffset; int transY = -clipArea1.yOffset; - gcn::Graphics::popClipArea(); + Graphics::popClipArea(); if (mClipStack.empty()) return; diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp index 3ea1e4182..d1c6ed0a6 100644 --- a/src/render/nullopenglgraphics.cpp +++ b/src/render/nullopenglgraphics.cpp @@ -947,7 +947,7 @@ bool NullOpenGLGraphics::pushClipArea(gcn::Rectangle area) transY = -clipArea.yOffset; } - const bool result = gcn::Graphics::pushClipArea(area); + const bool result = Graphics::pushClipArea(area); const gcn::ClipRectangle &clipArea = mClipStack.top(); transX += clipArea.xOffset; @@ -958,7 +958,7 @@ bool NullOpenGLGraphics::pushClipArea(gcn::Rectangle area) void NullOpenGLGraphics::popClipArea() { - gcn::Graphics::popClipArea(); + Graphics::popClipArea(); if (mClipStack.empty()) return; diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp index bf9334655..c27db4f47 100644 --- a/src/render/safeopenglgraphics.cpp +++ b/src/render/safeopenglgraphics.cpp @@ -535,7 +535,7 @@ bool SafeOpenGLGraphics::pushClipArea(gcn::Rectangle area) transY = -clipArea.yOffset; } - const bool result = gcn::Graphics::pushClipArea(area); + const bool result = Graphics::pushClipArea(area); const gcn::ClipRectangle &clipArea = mClipStack.top(); @@ -551,7 +551,7 @@ bool SafeOpenGLGraphics::pushClipArea(gcn::Rectangle area) void SafeOpenGLGraphics::popClipArea() { - gcn::Graphics::popClipArea(); + Graphics::popClipArea(); if (mClipStack.empty()) return; diff --git a/src/render/sdl2graphics.cpp b/src/render/sdl2graphics.cpp index 285b2dac2..46d8360b6 100644 --- a/src/render/sdl2graphics.cpp +++ b/src/render/sdl2graphics.cpp @@ -20,6 +20,49 @@ * along with this program. If not, see . */ +/* _______ __ __ __ ______ __ __ _______ __ __ + * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ + * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / + * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / + * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / + * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / + * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ + * + * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson + * + * + * Per Larsson a.k.a finalman + * Olof Naessén a.k.a jansem/yakslem + * + * Visit: http://guichan.sourceforge.net + * + * License: (BSD) + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Guichan nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #ifdef USE_SDL2 #include "render/sdl2graphics.h" @@ -621,7 +664,7 @@ void SDLGraphics::_endDraw() bool SDLGraphics::pushClipArea(gcn::Rectangle area) { - const bool result = gcn::Graphics::pushClipArea(area); + const bool result = Graphics::pushClipArea(area); const gcn::ClipRectangle &carea = mClipStack.top(); const SDL_Rect rect = @@ -637,7 +680,7 @@ bool SDLGraphics::pushClipArea(gcn::Rectangle area) void SDLGraphics::popClipArea() { - gcn::Graphics::popClipArea(); + Graphics::popClipArea(); if (mClipStack.empty()) return; diff --git a/src/render/sdl2graphics.h b/src/render/sdl2graphics.h index c4e0d74a7..1e581dc39 100644 --- a/src/render/sdl2graphics.h +++ b/src/render/sdl2graphics.h @@ -20,6 +20,49 @@ * along with this program. If not, see . */ +/* _______ __ __ __ ______ __ __ _______ __ __ + * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ + * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / + * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / + * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / + * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / + * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ + * + * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson + * + * + * Per Larsson a.k.a finalman + * Olof Naessén a.k.a jansem/yakslem + * + * Visit: http://guichan.sourceforge.net + * + * License: (BSD) + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Guichan nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #ifndef RENDER_SDL2GRAPHICS_H #define RENDER_SDL2GRAPHICS_H diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp index c158844ae..e78a87c7e 100644 --- a/src/render/sdl2softwaregraphics.cpp +++ b/src/render/sdl2softwaregraphics.cpp @@ -1126,7 +1126,7 @@ void SDL2SoftwareGraphics::_endDraw() bool SDL2SoftwareGraphics::pushClipArea(gcn::Rectangle area) { - const bool result = gcn::Graphics::pushClipArea(area); + const bool result = Graphics::pushClipArea(area); const gcn::ClipRectangle &carea = mClipStack.top(); const SDL_Rect rect = @@ -1142,7 +1142,7 @@ bool SDL2SoftwareGraphics::pushClipArea(gcn::Rectangle area) void SDL2SoftwareGraphics::popClipArea() { - gcn::Graphics::popClipArea(); + Graphics::popClipArea(); if (mClipStack.empty()) return; diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index 9e950c12f..2226be0da 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -1122,7 +1122,7 @@ void SDLGraphics::_endDraw() bool SDLGraphics::pushClipArea(gcn::Rectangle area) { - const bool result = gcn::Graphics::pushClipArea(area); + const bool result = Graphics::pushClipArea(area); const gcn::ClipRectangle &carea = mClipStack.top(); const SDL_Rect rect = { @@ -1138,7 +1138,7 @@ bool SDLGraphics::pushClipArea(gcn::Rectangle area) void SDLGraphics::popClipArea() { - gcn::Graphics::popClipArea(); + Graphics::popClipArea(); if (mClipStack.empty()) return; diff --git a/src/text.cpp b/src/text.cpp index fdd538d72..a1ffea08c 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -40,7 +40,7 @@ int Text::mInstances = 0; ImageRect Text::mBubble; Text::Text(const std::string &text, const int x, const int y, - const gcn::Graphics::Alignment alignment, + const Graphics::Alignment alignment, const gcn::Color *const color, const bool isSpeech, gcn::Font *const font) : mFont(font ? font : (gui ? gui->getFont() : nullptr)), @@ -78,13 +78,13 @@ Text::Text(const std::string &text, const int x, const int y, switch (alignment) { - case gcn::Graphics::LEFT: + case Graphics::LEFT: mXOffset = 0; break; - case gcn::Graphics::CENTER: + case Graphics::CENTER: mXOffset = mWidth / 2; break; - case gcn::Graphics::RIGHT: + case Graphics::RIGHT: mXOffset = mWidth; break; default: @@ -151,7 +151,7 @@ void Text::draw(Graphics *const graphics, const int xOff, const int yOff) } FlashText::FlashText(const std::string &text, const int x, const int y, - const gcn::Graphics::Alignment alignment, + const Graphics::Alignment alignment, const gcn::Color *const color, gcn::Font *const font) : Text(text, x, y, alignment, color, false, font), mTime(0) diff --git a/src/text.h b/src/text.h index ed980e588..b21ca51a7 100644 --- a/src/text.h +++ b/src/text.h @@ -30,6 +30,11 @@ #include "localconsts.h" +namespace gcn +{ + class Font; +} + class Text { friend class TextManager; @@ -39,7 +44,7 @@ class Text * Constructor creates a text object to display on the screen. */ Text(const std::string &text, const int x, const int y, - const gcn::Graphics::Alignment alignment, + const Graphics::Alignment alignment, const gcn::Color *const color, const bool isSpeech = false, gcn::Font *const font = nullptr); @@ -90,7 +95,7 @@ class FlashText final : public Text { public: FlashText(const std::string &text, const int x, const int y, - const gcn::Graphics::Alignment alignment, + const Graphics::Alignment alignment, const gcn::Color *const color, gcn::Font *const font = nullptr); -- cgit v1.2.3-70-g09d2 From ca9fac131283ed536971799bef0d1fff4ef8adc1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 15 Feb 2014 22:21:02 +0300 Subject: Remove useless graphics casts. --- src/gui/gui.cpp | 9 +- src/gui/widgets/avatarlistbox.cpp | 4 +- src/gui/widgets/browserbox.cpp | 5 +- src/gui/widgets/button.cpp | 40 ++++---- src/gui/widgets/checkbox.cpp | 9 +- src/gui/widgets/colorpage.cpp | 7 +- src/gui/widgets/desktop.cpp | 17 ++-- src/gui/widgets/dropdown.cpp | 16 ++-- src/gui/widgets/dropshortcutcontainer.cpp | 11 +-- src/gui/widgets/emotepage.cpp | 7 +- src/gui/widgets/emoteshortcutcontainer.cpp | 10 +- src/gui/widgets/extendedlistbox.cpp | 15 +-- src/gui/widgets/icon.cpp | 3 +- src/gui/widgets/itemcontainer.cpp | 17 ++-- src/gui/widgets/itemshortcutcontainer.cpp | 28 +++--- src/gui/widgets/label.cpp | 3 +- src/gui/widgets/listbox.cpp | 9 +- src/gui/widgets/playerbox.cpp | 12 +-- src/gui/widgets/popup.cpp | 9 +- src/gui/widgets/progressbar.cpp | 2 +- src/gui/widgets/progressindicator.cpp | 2 +- src/gui/widgets/radiobutton.cpp | 9 +- src/gui/widgets/scrollarea.cpp | 145 +++++++++++++++++------------ src/gui/widgets/shoplistbox.cpp | 3 +- src/gui/widgets/slider.cpp | 50 ++++++---- src/gui/widgets/spellshortcutcontainer.cpp | 11 +-- src/gui/widgets/tabs/tab.cpp | 25 ++--- src/gui/widgets/textbox.cpp | 3 +- src/gui/widgets/textfield.cpp | 10 +- src/gui/widgets/textpreview.cpp | 17 ++-- src/gui/widgets/window.cpp | 48 ++++++---- src/gui/windows/debugwindow.cpp | 3 +- src/gui/windows/equipmentwindow.cpp | 30 +++--- src/gui/windows/minimap.cpp | 8 +- src/gui/windows/outfitwindow.cpp | 5 +- src/gui/windows/serverdialog.cpp | 9 +- src/gui/windows/skilldialog.cpp | 4 +- src/text.cpp | 8 +- 38 files changed, 328 insertions(+), 295 deletions(-) (limited to 'src/gui/widgets/dropshortcutcontainer.cpp') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 00a3da25e..4da397a73 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -499,13 +499,12 @@ void Gui::draw() if ((client->getMouseFocused() || button & SDL_BUTTON(1)) && mMouseCursors && mCustomCursor && mMouseCursorAlpha > 0.0F) { - Graphics *g2 = static_cast(mGraphics); const Image *const image = dragDrop.getItemImage(); if (image) { const int posX = mouseX - (image->mBounds.w / 2); const int posY = mouseY - (image->mBounds.h / 2); - g2->drawImage2(image, posX, posY); + mGraphics->drawImage2(image, posX, posY); } if (mGuiFont) { @@ -514,8 +513,8 @@ void Gui::draw() { const int posX = mouseX - mGuiFont->getWidth(str) / 2; const int posY = mouseY + (image ? image->mBounds.h / 2 : 0); - g2->setColorAll(mForegroundColor, mForegroundColor2); - mGuiFont->drawString(g2, str, posX, posY); + mGraphics->setColorAll(mForegroundColor, mForegroundColor2); + mGuiFont->drawString(mGraphics, str, posX, posY); } } @@ -523,7 +522,7 @@ void Gui::draw() if (mouseCursor) { mouseCursor->setAlpha(mMouseCursorAlpha); - g2->drawImage2(mouseCursor, mouseX - 15, mouseY - 17); + mGraphics->drawImage2(mouseCursor, mouseX - 15, mouseY - 17); } } diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index e6f03493f..9a1aa40ab 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -90,7 +90,7 @@ AvatarListBox::~AvatarListBox() } } -void AvatarListBox::draw(Graphics *gcnGraphics) +void AvatarListBox::draw(Graphics *graphics) { BLOCK_START("AvatarListBox::draw") if (!mListModel || !player_node) @@ -102,10 +102,8 @@ void AvatarListBox::draw(Graphics *gcnGraphics) AvatarListModel *const model = static_cast( mListModel); updateAlpha(); - Graphics *const graphics = static_cast(gcnGraphics); gcn::Font *const font = getFont(); - const int fontHeight = getFont()->getHeight(); const gcn::Widget *const parent = mParent; const std::string name = player_node->getName(); diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index e0fbf3d17..024dde9c8 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -453,7 +453,6 @@ void BrowserBox::draw(Graphics *graphics) const gcn::ClipRectangle *const cr = graphics->getCurrentClipArea(); if (!cr) return; - Graphics *const graphics2 = static_cast(graphics); mYStart = cr->y - cr->yOffset; const int yEnd = mYStart + cr->height; if (mYStart < 0) @@ -503,7 +502,7 @@ void BrowserBox::draw(Graphics *graphics) break; if (!part.mType) { - graphics2->setColorAll(part.mColor, part.mColor2); + graphics->setColorAll(part.mColor, part.mColor2); if (part.mBold) boldFont->drawString(graphics, part.mText, part.mX, part.mY); else @@ -511,7 +510,7 @@ void BrowserBox::draw(Graphics *graphics) } else if (part.mImage) { - graphics2->drawImage2(part.mImage, part.mX, part.mY); + graphics->drawImage2(part.mImage, part.mX, part.mY); } } diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 8954ecf8e..6d326116d 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -373,8 +373,6 @@ void Button::draw(Graphics *graphics) updateAlpha(); - Graphics *const g2 = static_cast(graphics); - bool recalc = false; if (mRedraw) { @@ -384,7 +382,7 @@ void Button::draw(Graphics *graphics) { // because we don't know where parent windows was moved, // need recalc vertexes - gcn::ClipRectangle &rect = g2->getTopClip(); + gcn::ClipRectangle &rect = graphics->getTopClip(); if (rect.xOffset != mXOffset || rect.yOffset != mYOffset) { recalc = true; @@ -396,7 +394,7 @@ void Button::draw(Graphics *graphics) recalc = true; mMode = mode; } - else if (g2->getRedraw()) + else if (graphics->getRedraw()) { recalc = true; } @@ -408,16 +406,16 @@ void Button::draw(Graphics *graphics) switch (mode) { case BUTTON_DISABLED: - g2->setColorAll(mDisabledColor, mDisabledColor2); + graphics->setColorAll(mDisabledColor, mDisabledColor2); break; case BUTTON_PRESSED: - g2->setColorAll(mPressedColor, mPressedColor2); + graphics->setColorAll(mPressedColor, mPressedColor2); break; case BUTTON_HIGHLIGHTED: - g2->setColorAll(mHighlightedColor, mHighlightedColor2); + graphics->setColorAll(mHighlightedColor, mHighlightedColor2); break; default: - g2->setColorAll(mEnabledColor, mEnabledColor2); + graphics->setColorAll(mEnabledColor, mEnabledColor2); break; } @@ -481,39 +479,39 @@ void Button::draw(Graphics *graphics) mRedraw = false; mMode = mode; mVertexes2->clear(); - g2->calcWindow(mVertexes2, 0, 0, width, height, + graphics->calcWindow(mVertexes2, + 0, 0, + width, height, skin->getBorder()); if (mImages) { if (isPressed()) { - g2->calcTileCollection(mVertexes2, mImages[mode], + graphics->calcTileCollection(mVertexes2, + mImages[mode], imageX + 1, imageY + 1); } else { - g2->calcTileCollection(mVertexes2, - mImages[mode], imageX, imageY); + graphics->calcTileCollection(mVertexes2, + mImages[mode], + imageX, imageY); } } } - g2->drawTileCollection(mVertexes2); + graphics->drawTileCollection(mVertexes2); } else { - g2->drawImageRect(0, 0, width, height, skin->getBorder()); + graphics->drawImageRect(0, 0, width, height, skin->getBorder()); if (mImages) { if (isPressed()) - { - g2->drawImage2(mImages[mode], imageX + 1, imageY + 1); - } + graphics->drawImage2(mImages[mode], imageX + 1, imageY + 1); else - { - g2->drawImage2(mImages[mode], imageX, imageY); - } + graphics->drawImage2(mImages[mode], imageX, imageY); } } @@ -522,7 +520,7 @@ void Button::draw(Graphics *graphics) textX ++; textY ++; } - font->drawString(g2, mCaption, textX, textY); + font->drawString(graphics, mCaption, textX, textY); BLOCK_END("Button::draw") } diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index e72296516..2f11dc2ce 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -100,9 +100,7 @@ void CheckBox::draw(Graphics *const graphics) drawBox(graphics); gcn::Font *const font = getFont(); - static_cast(graphics)->setColorAll( - mForegroundColor, mForegroundColor2); - + graphics->setColorAll(mForegroundColor, mForegroundColor2); font->drawString(graphics, mCaption, mPadding + mImageSize + mSpacing, mPadding); BLOCK_END("CheckBox::draw") @@ -167,8 +165,9 @@ void CheckBox::drawBox(Graphics *const graphics) if (box) { - static_cast(graphics)->drawImage2( - box, mImagePadding, (getHeight() - mImageSize) / 2); + graphics->drawImage2(box, + mImagePadding, + (getHeight() - mImageSize) / 2); } } diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp index 1d85874df..a9cf4f71e 100644 --- a/src/gui/widgets/colorpage.cpp +++ b/src/gui/widgets/colorpage.cpp @@ -53,7 +53,6 @@ void ColorPage::draw(Graphics *graphics) const ColorModel *const model = static_cast( mListModel); - Graphics *const g = static_cast(graphics); mHighlightColor.a = static_cast(mAlpha * 255.0F); graphics->setColor(mHighlightColor); @@ -70,20 +69,20 @@ void ColorPage::draw(Graphics *graphics) mDimension.width - 2 * mPadding, rowHeight)); const ColorPair *const colors = model->getColorAt(mSelected); - g->setColorAll(*colors->color1, *colors->color2); + graphics->setColorAll(*colors->color1, *colors->color2); const std::string str = mListModel->getElementAt(mSelected); font->drawString(graphics, str, (width - font->getWidth(str)) / 2, mSelected * rowHeight + mPadding); } - g->setColorAll(mForegroundColor, mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); const int sz = mListModel->getNumberOfElements(); for (int i = 0, y = mPadding; i < sz; ++i, y += rowHeight) { if (i != mSelected) { const ColorPair *const colors = model->getColorAt(i); - g->setColorAll(*colors->color1, *colors->color2); + graphics->setColorAll(*colors->color1, *colors->color2); const std::string str = mListModel->getElementAt(i); font->drawString(graphics, str, (width - font->getWidth(str)) / 2, y); diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 4a4a73b53..b46fe3289 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -106,7 +106,6 @@ void Desktop::widgetResized(const gcn::Event &event A_UNUSED) void Desktop::draw(Graphics *graphics) { BLOCK_START("Desktop::draw") - Graphics *const g = static_cast(graphics); const gcn::Rectangle &rect = mDimension; const int width = rect.width; @@ -118,30 +117,30 @@ void Desktop::draw(Graphics *graphics) if (width > wallpWidth || height > wallpHeight) { - g->setColor(mBackgroundGrayColor); - g->fillRectangle(gcn::Rectangle(0, 0, width, height)); + graphics->setColor(mBackgroundGrayColor); + graphics->fillRectangle(gcn::Rectangle(0, 0, width, height)); } if (imageHelper->useOpenGL() == RENDER_SOFTWARE) { - g->drawImage2(mWallpaper, + graphics->drawImage2(mWallpaper, (width - wallpWidth) / 2, (height - wallpHeight) / 2); } else { - g->drawRescaledImage(mWallpaper, 0, 0, width, height); + graphics->drawRescaledImage(mWallpaper, 0, 0, width, height); } } else { - g->setColor(mBackgroundGrayColor); - g->fillRectangle(gcn::Rectangle(0, 0, width, height)); + graphics->setColor(mBackgroundGrayColor); + graphics->fillRectangle(gcn::Rectangle(0, 0, width, height)); } // Draw a thin border under the application version... - g->setColor(mBackgroundColor); - g->fillRectangle(gcn::Rectangle(mVersionLabel->getDimension())); + graphics->setColor(mBackgroundColor); + graphics->fillRectangle(gcn::Rectangle(mVersionLabel->getDimension())); Container::draw(graphics); BLOCK_END("Desktop::draw") diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 354c88423..7aa53e83f 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -235,8 +235,7 @@ void DropDown::draw(Graphics* graphics) if (model && mPopup->getSelected() >= 0) { gcn::Font *const font = getFont(); - static_cast(graphics)->setColorAll( - mForegroundColor, mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); if (mExtended) { const int sel = mPopup->getSelected(); @@ -250,9 +249,9 @@ void DropDown::draw(Graphics* graphics) } else { - static_cast(graphics)->drawImage2( - image, mImagePadding, (mDimension.height - - image->getHeight()) / 2 + mPadding); + graphics->drawImage2(image, + mImagePadding, + (mDimension.height - image->getHeight()) / 2 + mPadding); font->drawString(graphics, model->getElementAt(sel), image->getWidth() + mImagePadding + mSpacing, mPadding); } @@ -291,8 +290,9 @@ void DropDown::drawFrame(Graphics *graphics) BLOCK_START("DropDown::drawFrame") const int bs2 = getFrameSize(); const gcn::Rectangle &rect = mDimension; - static_cast(graphics)->drawImageRect( - 0, 0, rect.width + bs2, rect.height + bs2, skinRect); + graphics->drawImageRect(0, 0, + rect.width + bs2, rect.height + bs2, + skinRect); BLOCK_END("DropDown::drawFrame") } @@ -303,7 +303,7 @@ void DropDown::drawButton(Graphics *graphics) Image *image = buttons[mDroppedDown][mPushed]; if (image) { - static_cast(graphics)->drawImage2(image, + graphics->drawImage2(image, mDimension.width - image->getWidth() - mImagePadding, (height - image->getHeight()) / 2); } diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 892a74638..9b37682fe 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -107,8 +107,7 @@ void DropShortcutContainer::draw(Graphics *graphics) mBackgroundImg->setAlpha(mAlpha); } - Graphics *const g = static_cast(graphics); - drawBackground(g); + drawBackground(graphics); const Inventory *const inv = PlayerInfo::getInventory(); if (!inv) @@ -144,12 +143,12 @@ void DropShortcutContainer::draw(Graphics *graphics) caption = "Eq."; image->setAlpha(1.0F); - g->drawImage2(image, itemX, itemY); + graphics->drawImage2(image, itemX, itemY); if (item->isEquipped()) - g->setColorAll(mEquipedColor, mEquipedColor2); + graphics->setColorAll(mEquipedColor, mEquipedColor2); else - g->setColorAll(mUnEquipedColor, mUnEquipedColor2); - font->drawString(g, caption, + graphics->setColorAll(mUnEquipedColor, mUnEquipedColor2); + font->drawString(graphics, caption, itemX + (mBoxWidth - font->getWidth(caption)) / 2, itemY + mBoxHeight - 14); } diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index 869ae5d08..6101c20ae 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -68,7 +68,6 @@ void EmotePage::draw(Graphics *graphics) const std::vector &images = mEmotes->getImages(); - Graphics *const g = static_cast(graphics); const unsigned int width = mDimension.width; unsigned int x = 0; unsigned int y = 0; @@ -84,7 +83,7 @@ void EmotePage::draw(Graphics *graphics) const Image *const image = *it; if (image) { - g->calcTileCollection(mVertexes, image, x, y); + graphics->calcTileCollection(mVertexes, image, x, y); x += emoteWidth; if (x + emoteWidth > width) { @@ -94,7 +93,7 @@ void EmotePage::draw(Graphics *graphics) } } } - g->drawTileCollection(mVertexes); + graphics->drawTileCollection(mVertexes); } else { @@ -103,7 +102,7 @@ void EmotePage::draw(Graphics *graphics) const Image *const image = *it; if (image) { - g->drawImage2(image, x, y); + graphics->drawImage2(image, x, y); x += emoteWidth; if (x + emoteWidth > width) { diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index bdb5c3163..dc25d9e5c 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -112,11 +112,10 @@ void EmoteShortcutContainer::draw(Graphics *graphics) mAlpha = client->getGuiAlpha(); } - Graphics *const g = static_cast(graphics); gcn::Font *const font = getFont(); - drawBackground(g); + drawBackground(graphics); - g->setColorAll(mForegroundColor, mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); for (unsigned i = 0; i < mMaxItems; i++) { const int emoteX = (i % mGridWidth) * mBoxWidth; @@ -126,7 +125,7 @@ void EmoteShortcutContainer::draw(Graphics *graphics) const std::string key = inputManager.getKeyValueString( Input::KEY_EMOTE_1 + i); - font->drawString(g, key, emoteX + 2, emoteY + 2); + font->drawString(graphics, key, emoteX + 2, emoteY + 2); } unsigned sz = static_cast(mEmoteImg.size()); if (sz > mMaxItems) @@ -139,7 +138,8 @@ void EmoteShortcutContainer::draw(Graphics *graphics) const AnimatedSprite *const sprite = emoteImg->sprite; if (sprite) { - sprite->draw(g, (i % mGridWidth) * mBoxWidth + 2, + sprite->draw(graphics, + (i % mGridWidth) * mBoxWidth + 2, (i / mGridWidth) * mBoxHeight + 10); } } diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index 66065295c..f06e89e55 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -56,7 +56,6 @@ void ExtendedListBox::draw(Graphics *graphics) BLOCK_START("ExtendedListBox::draw") ExtendedListModel *const model = static_cast( mListModel); - Graphics *const g = static_cast(graphics); updateAlpha(); gcn::Font *const font = getFont(); @@ -147,13 +146,14 @@ void ExtendedListBox::draw(Graphics *graphics) const Image *const image = model->getImageAt(row1); if (image) { - g->drawImage2(image, mImagePadding, item.y + (height - - image->getHeight()) / 2 + mPadding); + graphics->drawImage2(image, + mImagePadding, + item.y + (height - image->getHeight()) / 2 + mPadding); } } } - g->setColorAll(mForegroundColor, mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); for (int f = 0; f < itemsSz; ++f) { @@ -181,13 +181,14 @@ void ExtendedListBox::draw(Graphics *graphics) const Image *const image = model->getImageAt(row1); if (image) { - g->drawImage2(image, mImagePadding, item.y + (height - - image->getHeight()) / 2 + mPadding); + graphics->drawImage2(image, + mImagePadding, + item.y + (height - image->getHeight()) / 2 + mPadding); } } } - g->setColorAll(mForegroundSelectedColor, mForegroundSelectedColor2); + graphics->setColorAll(mForegroundSelectedColor, mForegroundSelectedColor2); for (int f = 0; f < selSz; ++f) { diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index e9b7cd525..66313d397 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -67,12 +67,11 @@ void Icon::setImage(Image *const image) } } -void Icon::draw(Graphics *g) +void Icon::draw(Graphics *graphics) { BLOCK_START("Icon::draw") if (mImage) { - Graphics *const graphics = static_cast(g); graphics->drawImage2(mImage, (mDimension.width - mImage->mBounds.w) / 2, (mDimension.height - mImage->mBounds.h) / 2); diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index eedbc1bd0..0913dcae3 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -251,7 +251,6 @@ void ItemContainer::draw(Graphics *graphics) return; BLOCK_START("ItemContainer::draw") - Graphics *const g = static_cast(graphics); gcn::Font *const font = getFont(); for (int j = 0; j < mGridRows; j++) @@ -278,16 +277,18 @@ void ItemContainer::draw(Graphics *graphics) if (mShowMatrix[itemIndex] == mSelectedIndex) { if (mSelImg) - g->drawImage2(mSelImg, itemX, itemY); + graphics->drawImage2(mSelImg, itemX, itemY); } image->setAlpha(1.0F); // ensure the image if fully drawn... - g->drawImage2(image, itemX + mPaddingItemX, + graphics->drawImage2(image, + itemX + mPaddingItemX, itemY + mPaddingItemY); if (mProtectedImg && PlayerInfo::isItemProtected( item->getId())) { - g->drawImage2(mProtectedImg, - itemX + mPaddingItemX, itemY + mPaddingItemY); + graphics->drawImage2(mProtectedImg, + itemX + mPaddingItemX, + itemY + mPaddingItemY); } } } @@ -324,11 +325,11 @@ void ItemContainer::draw(Graphics *graphics) } if (item->isEquipped()) - g->setColorAll(mEquipedColor, mEquipedColor2); + graphics->setColorAll(mEquipedColor, mEquipedColor2); else - g->setColorAll(mUnEquipedColor, mUnEquipedColor2); + graphics->setColorAll(mUnEquipedColor, mUnEquipedColor2); - font->drawString(g, caption, + font->drawString(graphics, caption, itemX + (mBoxWidth - font->getWidth(caption)) / 2, itemY + mEquippedTextPadding); } diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 78b9c0e62..2438050d9 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -129,9 +129,8 @@ void ItemShortcutContainer::draw(Graphics *graphics) mAlpha = client->getGuiAlpha(); } - Graphics *const g = static_cast(graphics); gcn::Font *const font = getFont(); - drawBackground(g); + drawBackground(graphics); const Inventory *const inv = PlayerInfo::getInventory(); if (!inv) @@ -149,8 +148,8 @@ void ItemShortcutContainer::draw(Graphics *graphics) // Draw item keyboard shortcut. const std::string key = inputManager.getKeyValueString( Input::KEY_SHORTCUT_1 + i); - g->setColorAll(mForegroundColor, mForegroundColor); - font->drawString(g, key, itemX + 2, itemY + 2); + graphics->setColorAll(mForegroundColor, mForegroundColor); + font->drawString(graphics, key, itemX + 2, itemY + 2); const int itemId = selShortcut->getItem(i); const unsigned char itemColor = selShortcut->getItemColor(i); @@ -175,12 +174,17 @@ void ItemShortcutContainer::draw(Graphics *graphics) caption = "Eq."; image->setAlpha(1.0F); - g->drawImage2(image, itemX, itemY); + graphics->drawImage2(image, itemX, itemY); if (item->isEquipped()) - g->setColorAll(mEquipedColor, mEquipedColor2); + { + graphics->setColorAll(mEquipedColor, mEquipedColor2); + } else - g->setColorAll(mUnEquipedColor, mUnEquipedColor2); - font->drawString(g, caption, + { + graphics->setColorAll(mUnEquipedColor, + mUnEquipedColor2); + } + font->drawString(graphics, caption, itemX + (mBoxWidth - font->getWidth(caption)) / 2, itemY + mBoxHeight - 14); } @@ -199,11 +203,11 @@ void ItemShortcutContainer::draw(Graphics *graphics) if (image) { image->setAlpha(1.0F); - g->drawImage2(image, itemX, itemY); + graphics->drawImage2(image, itemX, itemY); } } - font->drawString(g, spell->getSymbol(), + font->drawString(graphics, spell->getSymbol(), itemX + 2, itemY + mBoxHeight / 2); } } @@ -218,10 +222,10 @@ void ItemShortcutContainer::draw(Graphics *graphics) if (image) { image->setAlpha(1.0F); - g->drawImage2(image, itemX, itemY); + graphics->drawImage2(image, itemX, itemY); } - font->drawString(g, skill->data->shortName, itemX + 2, + font->drawString(graphics, skill->data->shortName, itemX + 2, itemY + mBoxHeight / 2); } } diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 89ba17cd6..b2b709052 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -101,8 +101,7 @@ void Label::draw(Graphics* graphics) break; } - static_cast(graphics)->setColorAll( - mForegroundColor, mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); font->drawString(graphics, mCaption, textX, textY); BLOCK_END("Label::draw") } diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 0a7956476..e71907f37 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -106,7 +106,6 @@ void ListBox::draw(Graphics *graphics) BLOCK_START("ListBox::draw") updateAlpha(); - Graphics *const g = static_cast(graphics); mHighlightColor.a = static_cast(mAlpha * 255.0F); graphics->setColor(mHighlightColor); @@ -123,7 +122,7 @@ void ListBox::draw(Graphics *graphics) rowHeight * mSelected + mPadding, mDimension.width - 2 * mPadding, rowHeight)); - g->setColorAll(mForegroundSelectedColor, + graphics->setColorAll(mForegroundSelectedColor, mForegroundSelectedColor2); const std::string str = mListModel->getElementAt(mSelected); font->drawString(graphics, str, @@ -131,7 +130,7 @@ void ListBox::draw(Graphics *graphics) mSelected * rowHeight + mPadding + mItemPadding); } // Draw the list elements - g->setColorAll(mForegroundColor, mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); const int sz = mListModel->getNumberOfElements(); for (int i = 0, y = mPadding + mItemPadding; i < sz; ++i, y += rowHeight) @@ -153,14 +152,14 @@ void ListBox::draw(Graphics *graphics) rowHeight * mSelected + mPadding, mDimension.width - 2 * mPadding, rowHeight)); - g->setColorAll(mForegroundSelectedColor, + graphics->setColorAll(mForegroundSelectedColor, mForegroundSelectedColor2); const std::string str = mListModel->getElementAt(mSelected); font->drawString(graphics, str, mPadding, mSelected * rowHeight + mPadding + mItemPadding); } // Draw the list elements - g->setColorAll(mForegroundColor, mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); const int sz = mListModel->getNumberOfElements(); for (int i = 0, y = mPadding + mItemPadding; i < sz; ++i, y += rowHeight) diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 260f80099..0639fe1b0 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -115,7 +115,7 @@ void PlayerBox::draw(Graphics *graphics) const int bs = mFrameSize; const int x = mDimension.width / 2 + bs + mOffsetX; const int y = mDimension.height - bs + mOffsetY; - mBeing->drawSpriteAt(static_cast(graphics), x, y); + mBeing->drawSpriteAt(graphics, x, y); } if (client->getGuiAlpha() != mAlpha) @@ -140,15 +140,9 @@ void PlayerBox::drawFrame(Graphics *graphics) const int h = mDimension.height + bs; if (!mSelected) - { - static_cast(graphics)->drawImageRect( - 0, 0, w, h, mBackground); - } + graphics->drawImageRect(0, 0, w, h, mBackground); else - { - static_cast(graphics)->drawImageRect( - 0, 0, w, h, mSelectedBackground); - } + graphics->drawImageRect(0, 0, w, h, mSelectedBackground); } BLOCK_END("PlayerBox::drawFrame") } diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 56d5d0d0c..c1319737e 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -97,7 +97,6 @@ void Popup::setWindowContainer(WindowContainer *const wc) void Popup::draw(Graphics *graphics) { BLOCK_START("Popup::draw") - Graphics *const g = static_cast(graphics); if (mSkin) { @@ -107,16 +106,18 @@ void Popup::draw(Graphics *graphics) { mRedraw = false; mVertexes->clear(); - g->calcWindow(mVertexes, 0, 0, + graphics->calcWindow(mVertexes, + 0, 0, mDimension.width, mDimension.height, mSkin->getBorder()); } - g->drawTileCollection(mVertexes); + graphics->drawTileCollection(mVertexes); } else { - g->drawImageRect(0, 0, mDimension.width, mDimension.height, + graphics->drawImageRect(0, 0, + mDimension.width, mDimension.height, mSkin->getBorder()); } } diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 28c87f4ec..242b6ba6e 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -151,7 +151,7 @@ void ProgressBar::draw(Graphics *graphics) BLOCK_START("ProgressBar::draw") updateAlpha(); mBackgroundColor.a = static_cast(mAlpha * 255); - render(static_cast(graphics)); + render(graphics); BLOCK_END("ProgressBar::draw") } diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index 358518132..b3f5b0e54 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -73,7 +73,7 @@ void ProgressIndicator::draw(Graphics *graphics) // Draw the indicator centered on the widget const int x = (mDimension.width - 32) / 2; const int y = (mDimension.height - 32) / 2; - mIndicator->draw(static_cast(graphics), x, y); + mIndicator->draw(graphics, x, y); } BLOCK_END("ProgressIndicator::draw") } diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index 4a47a4b4e..092841dcf 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -149,8 +149,9 @@ void RadioButton::drawBox(Graphics* graphics) if (box) { - static_cast(graphics)->drawImage2( - box, mImagePadding, (getHeight() - mImageSize) / 2); + graphics->drawImage2(box, + mImagePadding, + (getHeight() - mImageSize) / 2); } } @@ -160,9 +161,7 @@ void RadioButton::draw(Graphics* graphics) drawBox(graphics); gcn::Font *const font = getFont(); - static_cast(graphics)->setColorAll( - mForegroundColor, mForegroundColor2); - + graphics->setColorAll(mForegroundColor, mForegroundColor2); font->drawString(graphics, mCaption, mPadding + mImageSize + mSpacing, mPadding); BLOCK_END("RadioButton::draw") diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 89e75f4d7..26add84c1 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -282,8 +282,7 @@ void ScrollArea::draw(Graphics *graphics) calcHMarker(graphics); } } - static_cast(graphics)->drawTileCollection( - mVertexes); + graphics->drawTileCollection(mVertexes); } else { @@ -315,11 +314,10 @@ void ScrollArea::draw(Graphics *graphics) if (mRedraw) { - Graphics *g = static_cast(graphics); - const bool redraw = g->getRedraw(); - g->setRedraw(true); + const bool redraw = graphics->getRedraw(); + graphics->setRedraw(true); drawChildren(graphics); - g->setRedraw(redraw); + graphics->setRedraw(redraw); } else { @@ -335,8 +333,7 @@ void ScrollArea::updateCalcFlag(Graphics *const graphics) { // because we don't know where parent windows was moved, // need recalc vertexes - const gcn::ClipRectangle &rect = static_cast( - graphics)->getTopClip(); + const gcn::ClipRectangle &rect = graphics->getTopClip(); if (rect.xOffset != mXOffset || rect.yOffset != mYOffset) { mRedraw = true; @@ -349,7 +346,7 @@ void ScrollArea::updateCalcFlag(Graphics *const graphics) mDrawWidth = rect.width; mDrawHeight = rect.height; } - else if (static_cast(graphics)->getRedraw()) + else if (graphics->getRedraw()) { mRedraw = true; } @@ -372,15 +369,18 @@ void ScrollArea::drawFrame(Graphics *graphics) if (mRedraw) { mVertexes2->clear(); - static_cast(graphics)->calcWindow( - mVertexes2, 0, 0, w, h, background); + graphics->calcWindow(mVertexes2, + 0, 0, + w, h, + background); } - static_cast(graphics)->drawTileCollection(mVertexes2); + graphics->drawTileCollection(mVertexes2); } else { - static_cast(graphics)->drawImageRect( - 0, 0, w, h, background); + graphics->drawImageRect(0, 0, + w, h, + background); } } BLOCK_END("ScrollArea::drawFrame") @@ -424,10 +424,7 @@ void ScrollArea::drawButton(Graphics *const graphics, } if (buttons[dir][state]) - { - static_cast(graphics)->drawImage2( - buttons[dir][state], dim.x, dim.y); - } + graphics->drawImage2(buttons[dir][state], dim.x, dim.y); } void ScrollArea::calcButton(Graphics *const graphics, @@ -471,21 +468,21 @@ void ScrollArea::calcButton(Graphics *const graphics, void ScrollArea::drawVBar(Graphics *const graphics) { const gcn::Rectangle &dim = getVerticalBarDimension(); - Graphics *const g = static_cast(graphics); if (vBackground.grid[4]) { - g->drawPattern(vBackground.grid[4], + graphics->drawPattern(vBackground.grid[4], dim.x, dim.y, dim.width, dim.height); } if (vBackground.grid[1]) { - g->drawPattern(vBackground.grid[1], - dim.x, dim.y, dim.width, vBackground.grid[1]->getHeight()); + graphics->drawPattern(vBackground.grid[1], + dim.x, dim.y, + dim.width, vBackground.grid[1]->getHeight()); } if (vBackground.grid[7]) { - g->drawPattern(vBackground.grid[7], + graphics->drawPattern(vBackground.grid[7], dim.x, dim.height - vBackground.grid[7]->getHeight() + dim.y, dim.width, vBackground.grid[7]->getHeight()); } @@ -494,21 +491,25 @@ void ScrollArea::drawVBar(Graphics *const graphics) void ScrollArea::calcVBar(Graphics *const graphics) { const gcn::Rectangle &dim = getVerticalBarDimension(); - Graphics *const g = static_cast(graphics); if (vBackground.grid[4]) { - g->calcPattern(mVertexes, vBackground.grid[4], - dim.x, dim.y, dim.width, dim.height); + graphics->calcPattern(mVertexes, + vBackground.grid[4], + dim.x, dim.y, + dim.width, dim.height); } if (vBackground.grid[1]) { - g->calcPattern(mVertexes, vBackground.grid[1], - dim.x, dim.y, dim.width, vBackground.grid[1]->getHeight()); + graphics->calcPattern(mVertexes, + vBackground.grid[1], + dim.x, dim.y, + dim.width, vBackground.grid[1]->getHeight()); } if (vBackground.grid[7]) { - g->calcPattern(mVertexes, vBackground.grid[7], + graphics->calcPattern(mVertexes, + vBackground.grid[7], dim.x, dim.height - vBackground.grid[7]->getHeight() + dim.y, dim.width, vBackground.grid[7]->getHeight()); } @@ -517,50 +518,59 @@ void ScrollArea::calcVBar(Graphics *const graphics) void ScrollArea::drawHBar(Graphics *const graphics) { const gcn::Rectangle &dim = getHorizontalBarDimension(); - Graphics *const g = static_cast(graphics); if (hBackground.grid[4]) { - g->drawPattern(hBackground.grid[4], - dim.x, dim.y, dim.width, dim.height); + graphics->drawPattern(hBackground.grid[4], + dim.x, dim.y, + dim.width, dim.height); } if (hBackground.grid[3]) { - g->drawPattern(hBackground.grid[3], - dim.x, dim.y, hBackground.grid[3]->getWidth(), dim.height); + graphics->drawPattern(hBackground.grid[3], + dim.x, dim.y, + hBackground.grid[3]->getWidth(), dim.height); } if (hBackground.grid[5]) { - g->drawPattern(hBackground.grid[5], - dim.x + dim.width - hBackground.grid[5]->getWidth(), dim.y, - hBackground.grid[5]->getWidth(), dim.height); + graphics->drawPattern(hBackground.grid[5], + dim.x + dim.width - hBackground.grid[5]->getWidth(), + dim.y, + hBackground.grid[5]->getWidth(), + dim.height); } } void ScrollArea::calcHBar(Graphics *const graphics) { const gcn::Rectangle &dim = getHorizontalBarDimension(); - Graphics *const g = static_cast(graphics); if (hBackground.grid[4]) { - g->calcPattern(mVertexes, hBackground.grid[4], - dim.x, dim.y, dim.width, dim.height); + graphics->calcPattern(mVertexes, + hBackground.grid[4], + dim.x, dim.y, + dim.width, dim.height); } if (hBackground.grid[3]) { - g->calcPattern(mVertexes, hBackground.grid[3], - dim.x, dim.y, hBackground.grid[3]->getWidth(), dim.height); + graphics->calcPattern(mVertexes, + hBackground.grid[3], + dim.x, dim.y, + hBackground.grid[3]->getWidth(), dim.height); } if (hBackground.grid[5]) { - g->calcPattern(mVertexes, hBackground.grid[5], - dim.x + dim.width - hBackground.grid[5]->getWidth(), dim.y, - hBackground.grid[5]->getWidth(), dim.height); + graphics->calcPattern(mVertexes, + hBackground.grid[5], + dim.x + dim.width - hBackground.grid[5]->getWidth(), + dim.y, + hBackground.grid[5]->getWidth(), + dim.height); } } @@ -570,13 +580,15 @@ void ScrollArea::drawVMarker(Graphics *const graphics) if ((mHasMouse) && (mX > (mDimension.width - mScrollbarWidth))) { - static_cast(graphics)-> - drawImageRect(dim.x, dim.y, dim.width, dim.height, vMarkerHi); + graphics->drawImageRect(dim.x, dim.y, + dim.width, dim.height, + vMarkerHi); } else { - static_cast(graphics)-> - drawImageRect(dim.x, dim.y, dim.width, dim.height, vMarker); + graphics->drawImageRect(dim.x, dim.y, + dim.width, dim.height, + vMarker); } } @@ -586,13 +598,17 @@ void ScrollArea::calcVMarker(Graphics *const graphics) if ((mHasMouse) && (mX > (mDimension.width - mScrollbarWidth))) { - static_cast(graphics)->calcWindow( - mVertexes, dim.x, dim.y, dim.width, dim.height, vMarkerHi); + graphics->calcWindow(mVertexes, + dim.x, dim.y, + dim.width, dim.height, + vMarkerHi); } else { - static_cast(graphics)->calcWindow( - mVertexes, dim.x, dim.y, dim.width, dim.height, vMarker); + graphics->calcWindow(mVertexes, + dim.x, dim.y, + dim.width, dim.height, + vMarker); } } @@ -602,13 +618,16 @@ void ScrollArea::drawHMarker(Graphics *const graphics) if ((mHasMouse) && (mY > (mDimension.height - mScrollbarWidth))) { - static_cast(graphics)-> - drawImageRect(dim.x, dim.y, dim.width, dim.height, vMarkerHi); + graphics->drawImageRect(dim.x, dim.y, + dim.width, dim.height, + vMarkerHi); } else { - static_cast(graphics)-> - drawImageRect(dim.x, dim.y, dim.width, dim.height, vMarker); + graphics->drawImageRect( + dim.x, dim.y, + dim.width, dim.height, + vMarker); } } @@ -618,13 +637,17 @@ void ScrollArea::calcHMarker(Graphics *const graphics) if ((mHasMouse) && (mY > (mDimension.height - mScrollbarWidth))) { - static_cast(graphics)->calcWindow( - mVertexes, dim.x, dim.y, dim.width, dim.height, vMarkerHi); + graphics->calcWindow(mVertexes, + dim.x, dim.y, + dim.width, dim.height, + vMarkerHi); } else { - static_cast(graphics)->calcWindow( - mVertexes, dim.x, dim.y, dim.width, dim.height, vMarker); + graphics->calcWindow(mVertexes, + dim.x, dim.y, + dim.width, dim.height, + vMarker); } } diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 644023c43..8f45abeb3 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -82,7 +82,7 @@ void ShopListBox::setPlayersMoney(const int money) mPlayerMoney = money; } -void ShopListBox::draw(Graphics *gcnGraphics) +void ShopListBox::draw(Graphics *graphics) { BLOCK_START("ShopListBox::draw") if (!mListModel || !mShopItems) @@ -95,7 +95,6 @@ void ShopListBox::draw(Graphics *gcnGraphics) mAlpha = client->getGuiAlpha(); const int alpha = static_cast(mAlpha * 255.0F); - Graphics *graphics = static_cast(gcnGraphics); gcn::Font *const font = getFont(); const int sz = mListModel->getNumberOfElements(); diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 1427bb6eb..8eb27824d 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -133,19 +133,18 @@ void Slider::draw(Graphics *graphics) int x = 0; const int y = mHasMouse ? (h - buttons[1].grid[HSTART]->getHeight()) / 2 : (h - buttons[0].grid[HSTART]->getHeight()) / 2; - Graphics *const g = static_cast(graphics); updateAlpha(); if (isBatchDrawRenders(openGLMode)) { - if (mRedraw || g->getRedraw()) + if (mRedraw || graphics->getRedraw()) { mRedraw = false; mVertexes->clear(); if (!mHasMouse) { - g->calcTileCollection(mVertexes, + graphics->calcTileCollection(mVertexes, buttons[0].grid[HSTART], x, y); const int width = buttons[0].grid[HSTART]->getWidth(); @@ -155,24 +154,31 @@ void Slider::draw(Graphics *graphics) if (buttons[0].grid[HMID]) { const Image *const hMid = buttons[0].grid[HMID]; - g->calcPattern(mVertexes, hMid, x, y, + graphics->calcPattern(mVertexes, + hMid, + x, y, w, hMid->getHeight()); } x += w; - g->calcTileCollection(mVertexes, buttons[0].grid[HEND], x, y); + graphics->calcTileCollection(mVertexes, + buttons[0].grid[HEND], + x, y); const Image *const img = buttons[0].grid[HGRIP]; if (img) { - g->calcTileCollection(mVertexes, img, getMarkerPosition(), + graphics->calcTileCollection(mVertexes, + img, + getMarkerPosition(), (mDimension.height - img->getHeight()) / 2); } } else { - g->calcTileCollection(mVertexes, - buttons[1].grid[HSTART], x, y); + graphics->calcTileCollection(mVertexes, + buttons[1].grid[HSTART], + x, y); const int width = buttons[1].grid[HSTART]->getWidth(); w -= width; @@ -183,32 +189,36 @@ void Slider::draw(Graphics *graphics) if (buttons[1].grid[HMID]) { const Image *const hMid = buttons[1].grid[HMID]; - g->calcPattern(mVertexes, hMid, x, y, + graphics->calcPattern(mVertexes, + hMid, + x, y, w, hMid->getHeight()); } x += w; if (buttons[1].grid[HEND]) { - g->calcTileCollection(mVertexes, + graphics->calcTileCollection(mVertexes, buttons[1].grid[HEND], x, y); } const Image *const img = buttons[1].grid[HGRIP]; if (img) { - g->calcTileCollection(mVertexes, img, getMarkerPosition(), + graphics->calcTileCollection(mVertexes, + img, + getMarkerPosition(), (mDimension.height - img->getHeight()) / 2); } } } - g->drawTileCollection(mVertexes); + graphics->drawTileCollection(mVertexes); } else { if (!mHasMouse) { - g->drawImage2(buttons[0].grid[HSTART], x, y); + graphics->drawImage2(buttons[0].grid[HSTART], x, y); const int width = buttons[0].grid[HSTART]->getWidth(); w -= width + buttons[0].grid[HEND]->getWidth(); x += width; @@ -216,22 +226,22 @@ void Slider::draw(Graphics *graphics) if (buttons[0].grid[HMID]) { const Image *const hMid = buttons[0].grid[HMID]; - g->drawPattern(hMid, x, y, w, hMid->getHeight()); + graphics->drawPattern(hMid, x, y, w, hMid->getHeight()); } x += w; - g->drawImage2(buttons[0].grid[HEND], x, y); + graphics->drawImage2(buttons[0].grid[HEND], x, y); const Image *const img = buttons[0].grid[HGRIP]; if (img) { - g->drawImage2(img, getMarkerPosition(), + graphics->drawImage2(img, getMarkerPosition(), (mDimension.height - img->getHeight()) / 2); } } else { - g->drawImage2(buttons[1].grid[HSTART], x, y); + graphics->drawImage2(buttons[1].grid[HSTART], x, y); const int width = buttons[1].grid[HSTART]->getWidth(); w -= width; @@ -242,17 +252,17 @@ void Slider::draw(Graphics *graphics) if (buttons[1].grid[HMID]) { const Image *const hMid = buttons[1].grid[HMID]; - g->drawPattern(hMid, x, y, w, hMid->getHeight()); + graphics->drawPattern(hMid, x, y, w, hMid->getHeight()); } x += w; if (buttons[1].grid[HEND]) - g->drawImage2(buttons[1].grid[HEND], x, y); + graphics->drawImage2(buttons[1].grid[HEND], x, y); const Image *const img = buttons[1].grid[HGRIP]; if (img) { - g->drawImage2(img, getMarkerPosition(), + graphics->drawImage2(img, getMarkerPosition(), (mDimension.height - img->getHeight()) / 2); } } diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 7c59676b9..696b0fbb4 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -103,12 +103,11 @@ void SpellShortcutContainer::draw(Graphics *graphics) mBackgroundImg->setAlpha(mAlpha); } - Graphics *const g = static_cast(graphics); gcn::Font *const font = getFont(); const int selectedId = spellShortcut->getSelectedItem(); - g->setColorAll(mForegroundColor, mForegroundColor2); - drawBackground(g); + graphics->setColorAll(mForegroundColor, mForegroundColor2); + drawBackground(graphics); for (unsigned i = 0; i < mMaxItems; i++) { @@ -118,7 +117,7 @@ void SpellShortcutContainer::draw(Graphics *graphics) const int itemId = getItemByIndex(i); if (selectedId >= 0 && itemId == selectedId) { - g->drawRectangle(gcn::Rectangle(itemX + 1, itemY + 1, + graphics->drawRectangle(gcn::Rectangle(itemX + 1, itemY + 1, mBoxWidth - 1, mBoxHeight - 1)); } @@ -135,11 +134,11 @@ void SpellShortcutContainer::draw(Graphics *graphics) if (image) { image->setAlpha(1.0F); - g->drawImage2(image, itemX, itemY); + graphics->drawImage2(image, itemX, itemY); } } - font->drawString(g, spell->getSymbol(), + font->drawString(graphics, spell->getSymbol(), itemX + 2, itemY + mBoxHeight / 2); } } diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index d0561cadf..bba1ef7b6 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -204,19 +204,19 @@ void Tab::draw(Graphics *graphics) updateAlpha(); - Graphics *const g = static_cast(graphics); - // draw tab if (isBatchDrawRenders(openGLMode)) { const ImageRect &rect = skin->getBorder(); - if (mRedraw || mode != mMode || g->getRedraw()) + if (mRedraw || mode != mMode || graphics->getRedraw()) { mMode = mode; mRedraw = false; mVertexes->clear(); - g->calcWindow(mVertexes, 0, 0, - mDimension.width, mDimension.height, rect); + graphics->calcWindow(mVertexes, + 0, 0, + mDimension.width, mDimension.height, + rect); if (mImage) { @@ -224,25 +224,28 @@ void Tab::draw(Graphics *graphics) if (skin1) { const int padding = skin1->getPadding(); - g->calcTileCollection(mVertexes, mImage, - padding, padding); + graphics->calcTileCollection(mVertexes, + mImage, + padding, + padding); } } } - g->drawTileCollection(mVertexes); + graphics->drawTileCollection(mVertexes); } else { - g->drawImageRect(0, 0, - mDimension.width, mDimension.height, skin->getBorder()); + graphics->drawImageRect(0, 0, + mDimension.width, mDimension.height, + skin->getBorder()); if (mImage) { const Skin *const skin1 = tabImg[TAB_STANDARD]; if (skin1) { const int padding = skin1->getPadding(); - g->drawImage2(mImage, padding, padding); + graphics->drawImage2(mImage, padding, padding); } } } diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 8aaca4211..6bd301b32 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -367,8 +367,7 @@ void TextBox::draw(Graphics* graphics) mCaretRow * font->getHeight()); } - static_cast(graphics)->setColorAll( - mForegroundColor, mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); const int fontHeight = font->getHeight(); for (size_t i = 0, sz = mTextRows.size(); i < sz; i++) diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index b1d188f22..fdcd84089 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -149,8 +149,7 @@ void TextField::draw(Graphics *graphics) font->getWidth(mText.substr(0, mCaretPosition)) - mXScroll); } - static_cast(graphics)->setColorAll( - mForegroundColor, mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); font->drawString(graphics, mText, mPadding - mXScroll, mPadding); BLOCK_END("TextField::draw") } @@ -159,8 +158,11 @@ void TextField::drawFrame(Graphics *graphics) { BLOCK_START("TextField::drawFrame") const int bs = 2 * mFrameSize; - static_cast(graphics)->drawImageRect(0, 0, - mDimension.width + bs, mDimension.height + bs, skin); + graphics->drawImageRect(0, + 0, + mDimension.width + bs, + mDimension.height + bs, + skin); BLOCK_END("TextField::drawFrame") } diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 5cfb2abb5..5ef553b3c 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -84,18 +84,17 @@ void TextPreview::draw(Graphics* graphics) BLOCK_START("TextPreview::draw") if (client->getGuiAlpha() != mAlpha) mAlpha = client->getGuiAlpha(); - Graphics *const g = static_cast(graphics); const int intAlpha = static_cast(mAlpha * 255.0F); const int alpha = mTextAlpha ? intAlpha : 255; if (mOpaque) { - g->setColor(gcn::Color(static_cast(mBGColor->r), + graphics->setColor(gcn::Color(static_cast(mBGColor->r), static_cast(mBGColor->g), static_cast(mBGColor->b), static_cast(mAlpha * 255.0F))); - g->fillRectangle(gcn::Rectangle(0, 0, + graphics->fillRectangle(gcn::Rectangle(0, 0, mDimension.width, mDimension.height)); } @@ -108,20 +107,20 @@ void TextPreview::draw(Graphics* graphics) + 2 * ((mOutline || mShadow) ? 1 :0); const int y = font->getHeight() + 1 + 2 * ((mOutline || mShadow) ? 1 : 0); - g->setColor(gcn::Color(static_cast(mTextBGColor->r), + graphics->setColor(gcn::Color(static_cast(mTextBGColor->r), static_cast(mTextBGColor->g), static_cast(mTextBGColor->b), intAlpha)); - g->fillRectangle(gcn::Rectangle(mPadding, mPadding, x, y)); + graphics->fillRectangle(gcn::Rectangle(mPadding, mPadding, x, y)); } } - g->setColorAll(gcn::Color(mTextColor->r, mTextColor->g, mTextColor->b, - alpha), gcn::Color(mTextColor2->r, mTextColor2->g, mTextColor2->b, - alpha)); + graphics->setColorAll(gcn::Color(mTextColor->r, + mTextColor->g, mTextColor->b, alpha), + gcn::Color(mTextColor2->r, mTextColor2->g, mTextColor2->b, alpha)); if (mOutline && mTextColor != mTextColor2) - g->setColor2(Theme::getThemeColor(Theme::OUTLINE)); + graphics->setColor2(Theme::getThemeColor(Theme::OUTLINE)); mFont->drawString(graphics, mText, mPadding + 1, mPadding + 1); BLOCK_END("TextPreview::draw") diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 26ca0a29f..54ec3c859 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -209,7 +209,6 @@ void Window::draw(Graphics *graphics) return; BLOCK_START("Window::draw") - Graphics *const g = static_cast(graphics); bool update = false; if (isBatchDrawRenders(openGLMode)) @@ -225,8 +224,11 @@ void Window::draw(Graphics *graphics) mRedraw = false; update = true; mVertexes->clear(); - g->calcWindow(mVertexes, 0, 0, mDimension.width, - mDimension.height, mSkin->getBorder()); + graphics->calcWindow(mVertexes, + 0, 0, + mDimension.width, + mDimension.height, + mSkin->getBorder()); // Draw Close Button if (mCloseWindowButton) @@ -235,8 +237,10 @@ void Window::draw(Graphics *graphics) mResizeHandles == CLOSE); if (button) { - g->calcTileCollection(mVertexes, button, - mCloseRect.x, mCloseRect.y); + graphics->calcTileCollection(mVertexes, + button, + mCloseRect.x, + mCloseRect.y); } } // Draw Sticky Button @@ -245,27 +249,33 @@ void Window::draw(Graphics *graphics) const Image *const button = mSkin->getStickyImage(mSticky); if (button) { - g->calcTileCollection(mVertexes, button, - mStickyRect.x, mStickyRect.y); + graphics->calcTileCollection(mVertexes, + button, + mStickyRect.x, + mStickyRect.y); } } if (mGrip) { - g->calcTileCollection(mVertexes, mGrip, - mGripRect.x, mGripRect.y); + graphics->calcTileCollection(mVertexes, + mGrip, + mGripRect.x, + mGripRect.y); } } else { mLastRedraw = false; } - g->drawTileCollection(mVertexes); + graphics->drawTileCollection(mVertexes); } else { - g->drawImageRect(0, 0, mDimension.width, - mDimension.height, mSkin->getBorder()); + graphics->drawImageRect(0, 0, + mDimension.width, + mDimension.height, + mSkin->getBorder()); // Draw Close Button if (mCloseWindowButton) @@ -273,24 +283,24 @@ void Window::draw(Graphics *graphics) const Image *const button = mSkin->getCloseImage( mResizeHandles == CLOSE); if (button) - g->drawImage2(button, mCloseRect.x, mCloseRect.y); + graphics->drawImage2(button, mCloseRect.x, mCloseRect.y); } // Draw Sticky Button if (mStickyButton) { const Image *const button = mSkin->getStickyImage(mSticky); if (button) - g->drawImage2(button, mStickyRect.x, mStickyRect.y); + graphics->drawImage2(button, mStickyRect.x, mStickyRect.y); } if (mGrip) - g->drawImage2(mGrip, mGripRect.x, mGripRect.y); + graphics->drawImage2(mGrip, mGripRect.x, mGripRect.y); } // Draw title if (mShowTitle) { - g->setColorAll(mForegroundColor, mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); int x; switch (mCaptionAlign) { @@ -305,14 +315,14 @@ void Window::draw(Graphics *graphics) x = mCaptionOffsetX - mCaptionFont->getWidth(mCaption); break; } - mCaptionFont->drawString(g, mCaption, x, mCaptionOffsetY); + mCaptionFont->drawString(graphics, mCaption, x, mCaptionOffsetY); } if (update) { - g->setRedraw(update); + graphics->setRedraw(update); drawChildren(graphics); - g->setRedraw(false); + graphics->setRedraw(false); } else { diff --git a/src/gui/windows/debugwindow.cpp b/src/gui/windows/debugwindow.cpp index 4f57b9798..7cc074086 100644 --- a/src/gui/windows/debugwindow.cpp +++ b/src/gui/windows/debugwindow.cpp @@ -139,8 +139,7 @@ void DebugWindow::draw(Graphics *g) const Being *const target = player_node->getTarget(); if (target) { - Graphics *const g2 = static_cast(g); - target->draw(g2, -target->getPixelX() + mapTileSize / 2 + target->draw(g, -target->getPixelX() + mapTileSize / 2 + mDimension.width / 2, -target->getPixelY() + mapTileSize + mDimension.height / 2); } diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index e7bf02aa9..327cabe6a 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -161,7 +161,6 @@ void EquipmentWindow::draw(Graphics *graphics) BLOCK_START("EquipmentWindow::draw") // Draw window graphics Window::draw(graphics); - Graphics *const g = static_cast(graphics); int i = 0; gcn::Font *const font = getFont(); @@ -179,17 +178,19 @@ void EquipmentWindow::draw(Graphics *graphics) continue; if (i == mSelected) { - g->calcTileCollection(mVertexes, - mSlotHighlightedBackground, box->x, box->y); + graphics->calcTileCollection(mVertexes, + mSlotHighlightedBackground, + box->x, box->y); } else { - g->calcTileCollection(mVertexes, mSlotBackground, + graphics->calcTileCollection(mVertexes, + mSlotBackground, box->x, box->y); } } } - g->drawTileCollection(mVertexes); + graphics->drawTileCollection(mVertexes); } else { @@ -200,9 +201,14 @@ void EquipmentWindow::draw(Graphics *graphics) if (!box) continue; if (i == mSelected) - g->drawImage2(mSlotHighlightedBackground, box->x, box->y); + { + graphics->drawImage2(mSlotHighlightedBackground, + box->x, box->y); + } else - g->drawImage2(mSlotBackground, box->x, box->y); + { + graphics->drawImage2(mSlotBackground, box->x, box->y); + } } } @@ -228,13 +234,14 @@ void EquipmentWindow::draw(Graphics *graphics) { image->setAlpha(1.0F); // Ensure the image is drawn // with maximum opacity - g->drawImage2(image, box->x + mItemPadding, + graphics->drawImage2(image, box->x + mItemPadding, box->y + mItemPadding); if (i == EQUIP_PROJECTILE_SLOT) { - g->setColorAll(mLabelsColor, mLabelsColor2); + graphics->setColorAll(mLabelsColor, mLabelsColor2); const std::string str = toString(item->getQuantity()); - font->drawString(g, str, + font->drawString(graphics, + str, box->x + (mBoxSize - font->getWidth(str)) / 2, box->y - fontHeight); } @@ -242,7 +249,8 @@ void EquipmentWindow::draw(Graphics *graphics) } else if (box->image) { - g->drawImage2(box->image, box->x + mItemPadding, + graphics->drawImage2(box->image, + box->x + mItemPadding, box->y + mItemPadding); } } diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 181055053..691506753 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -244,8 +244,6 @@ void Minimap::draw(Graphics *graphics) return; } - Graphics *const graph = static_cast(graphics); - const gcn::Rectangle a = getChildrenArea(); graphics->pushClipArea(a); @@ -286,7 +284,7 @@ void Minimap::draw(Graphics *graphics) mMapOriginY = 0; } - graph->drawImage2(mMapImage, mMapOriginX, mMapOriginY); + graphics->drawImage2(mMapImage, mMapOriginX, mMapOriginY); } const ActorSprites &actors = actorManager->getAll(); @@ -401,8 +399,8 @@ void Minimap::draw(Graphics *graphics) const Vector &pos = player_node->getPosition(); - const int gw = graph->getWidth(); - const int gh = graph->getHeight(); + const int gw = graphics->getWidth(); + const int gh = graphics->getHeight(); int x = static_cast((pos.x - (gw / 2) + viewport->getCameraRelativeX()) * mWidthProportion) / 32 + mMapOriginX; diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index 677337b70..3729841bc 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -314,7 +314,6 @@ void OutfitWindow::draw(Graphics *graphics) { BLOCK_START("OutfitWindow::draw") Window::draw(graphics); - Graphics *const g = static_cast(graphics); if (mCurrentOutfit < 0 || mCurrentOutfit >= static_cast(OUTFITS_COUNT)) @@ -348,7 +347,7 @@ void OutfitWindow::draw(Graphics *graphics) const Image *const image = item->getImage(); if (image) { - g->drawImage2(image, itemX, itemY); + graphics->drawImage2(image, itemX, itemY); foundItem = true; } } @@ -359,7 +358,7 @@ void OutfitWindow::draw(Graphics *graphics) mItemColors[mCurrentOutfit][i]); if (image) { - g->drawImage2(image, itemX, itemY); + graphics->drawImage2(image, itemX, itemY); image->decRef(); } } diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 82a264ac7..b7e21556c 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -164,12 +164,11 @@ public: ServersListModel *const model = static_cast( mListModel); - Graphics *const g = static_cast(graphics); updateAlpha(); mHighlightColor.a = static_cast(mAlpha * 255.0F); - g->setColor(mHighlightColor); + graphics->setColor(mHighlightColor); const int height = getRowHeight(); mNotSupportedColor.a = static_cast(mAlpha * 255.0F); @@ -196,12 +195,12 @@ public: if (mSelected == i) { - g->setColorAll(mForegroundSelectedColor, + graphics->setColorAll(mForegroundSelectedColor, mForegroundSelectedColor2); } else { - g->setColorAll(mForegroundColor, mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); } int top; @@ -224,7 +223,7 @@ public: if (info.version.first > 0) { - g->setColorAll(mNotSupportedColor, mNotSupportedColor2); + graphics->setColorAll(mNotSupportedColor, mNotSupportedColor2); font2->drawString(graphics, info.version.second, width - info.version.first - mPadding, top); } diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 674848725..7e823b742 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -100,15 +100,13 @@ class SkillListBox final : public ListBox return static_cast(mListModel)->getSkillAt(selected); } - void draw(Graphics *gcnGraphics) override + void draw(Graphics *graphics) override { if (!mListModel) return; SkillModel *const model = static_cast(mListModel); updateAlpha(); - Graphics *const graphics = static_cast( - gcnGraphics); mHighlightColor.a = static_cast(mAlpha * 255.0F); graphics->setColor(mHighlightColor); diff --git a/src/text.cpp b/src/text.cpp index a1ffea08c..943d31f67 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -137,9 +137,11 @@ void Text::draw(Graphics *const graphics, const int xOff, const int yOff) BLOCK_START("Text::draw") if (mIsSpeech) { - static_cast(graphics)->drawImageRect( - mX - xOff - 5, mY - yOff - 5, mWidth + 10, mHeight + 10, - mBubble); + graphics->drawImageRect(mX - xOff - 5, + mY - yOff - 5, + mWidth + 10, + mHeight + 10, + mBubble); } graphics->setColor(*mColor); -- cgit v1.2.3-70-g09d2 From 3ae82048ca8636ce03e71bdd4c11f60594cfc698 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Feb 2014 12:47:15 +0300 Subject: move event into events directory. --- src/CMakeLists.txt | 3 +- src/Makefile.am | 6 +- src/events/actionevent.h | 6 +- src/events/event.h | 117 +++++++++++++++++++++++++++++ src/gui/base/event.cpp | 87 --------------------- src/gui/base/event.hpp | 113 ---------------------------- src/gui/base/focushandler.hpp | 2 +- src/gui/base/inputevent.hpp | 2 +- src/gui/base/selectionevent.hpp | 2 +- src/gui/base/widget.cpp | 2 +- src/gui/focushandler.cpp | 2 +- src/gui/focushandler.h | 2 +- src/gui/gui.cpp | 2 +- src/gui/gui.h | 2 +- src/gui/widgets/button.cpp | 4 +- src/gui/widgets/button.h | 4 +- src/gui/widgets/characterdisplay.cpp | 2 +- src/gui/widgets/characterdisplay.h | 2 +- src/gui/widgets/desktop.cpp | 2 +- src/gui/widgets/desktop.h | 2 +- src/gui/widgets/dropshortcutcontainer.cpp | 2 +- src/gui/widgets/dropshortcutcontainer.h | 2 +- src/gui/widgets/emotepage.cpp | 4 +- src/gui/widgets/emotepage.h | 4 +- src/gui/widgets/emoteshortcutcontainer.cpp | 2 +- src/gui/widgets/emoteshortcutcontainer.h | 2 +- src/gui/widgets/flowcontainer.cpp | 4 +- src/gui/widgets/flowcontainer.h | 2 +- src/gui/widgets/horizontcontainer.cpp | 2 +- src/gui/widgets/horizontcontainer.h | 2 +- src/gui/widgets/itemcontainer.cpp | 2 +- src/gui/widgets/itemcontainer.h | 2 +- src/gui/widgets/itemshortcutcontainer.cpp | 2 +- src/gui/widgets/itemshortcutcontainer.h | 2 +- src/gui/widgets/layouthelper.cpp | 2 +- src/gui/widgets/layouthelper.h | 2 +- src/gui/widgets/popup.cpp | 4 +- src/gui/widgets/popup.h | 4 +- src/gui/widgets/popuplist.cpp | 6 +- src/gui/widgets/popuplist.h | 6 +- src/gui/widgets/progressbar.cpp | 4 +- src/gui/widgets/progressbar.h | 4 +- src/gui/widgets/scrollarea.cpp | 4 +- src/gui/widgets/scrollarea.h | 4 +- src/gui/widgets/shortcutcontainer.cpp | 4 +- src/gui/widgets/shortcutcontainer.h | 4 +- src/gui/widgets/spellshortcutcontainer.cpp | 2 +- src/gui/widgets/spellshortcutcontainer.h | 2 +- src/gui/widgets/tabbedarea.cpp | 8 +- src/gui/widgets/tabbedarea.h | 4 +- src/gui/widgets/tabs/setuptabscroll.cpp | 2 +- src/gui/widgets/tabs/setuptabscroll.h | 2 +- src/gui/widgets/tabs/tab.cpp | 4 +- src/gui/widgets/tabs/tab.h | 4 +- src/gui/widgets/textfield.cpp | 4 +- src/gui/widgets/textfield.h | 4 +- src/gui/widgets/vertcontainer.cpp | 2 +- src/gui/widgets/vertcontainer.h | 2 +- src/gui/widgets/widgetgroup.cpp | 2 +- src/gui/widgets/widgetgroup.h | 2 +- src/gui/widgets/window.cpp | 8 +- src/gui/widgets/window.h | 6 +- src/gui/windows/charselectdialog.cpp | 2 +- src/gui/windows/charselectdialog.h | 2 +- src/gui/windows/chatwindow.cpp | 4 +- src/gui/windows/chatwindow.h | 2 +- src/gui/windows/debugwindow.cpp | 2 +- src/gui/windows/debugwindow.h | 2 +- src/gui/windows/didyouknowwindow.cpp | 2 +- src/gui/windows/emotewindow.cpp | 4 +- src/gui/windows/emotewindow.h | 4 +- src/gui/windows/helpwindow.cpp | 2 +- src/gui/windows/inventorywindow.cpp | 6 +- src/gui/windows/inventorywindow.h | 4 +- src/gui/windows/setupwindow.cpp | 4 +- src/gui/windows/setupwindow.h | 2 +- src/gui/windows/shortcutwindow.cpp | 4 +- src/gui/windows/shortcutwindow.h | 4 +- src/gui/windows/skilldialog.cpp | 2 +- src/gui/windows/skilldialog.h | 2 +- src/gui/windows/socialwindow.cpp | 4 +- src/gui/windows/socialwindow.h | 2 +- src/gui/windows/whoisonline.cpp | 4 +- src/gui/windows/whoisonline.h | 2 +- src/listeners/deathlistener.h | 4 +- src/listeners/focuslistener.h | 6 +- src/listeners/widgetlistener.h | 10 +-- 87 files changed, 252 insertions(+), 338 deletions(-) create mode 100644 src/events/event.h delete mode 100644 src/gui/base/event.cpp delete mode 100644 src/gui/base/event.hpp (limited to 'src/gui/widgets/dropshortcutcontainer.cpp') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 99d36e1ec..2a79f5839 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -775,7 +775,7 @@ SET(SRCS gui/base/cliprectangle.hpp gui/base/color.hpp listeners/deathlistener.h - gui/base/event.hpp + events/event.h gui/base/exception.hpp gui/base/focushandler.hpp listeners/focuslistener.h @@ -811,7 +811,6 @@ SET(SRCS gui/base/basiccontainer.cpp gui/base/cliprectangle.cpp gui/base/color.cpp - gui/base/event.cpp gui/base/exception.cpp gui/base/focushandler.cpp gui/base/font.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 21c2fc0e9..8a731c17f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,7 +28,6 @@ endif dyecmd_CXXFLAGS = dyecmd_SOURCES = gui/base/cliprectangle.cpp \ gui/base/color.cpp \ - gui/base/event.cpp \ gui/base/exception.cpp \ gui/base/font.cpp \ gui/base/rectangle.cpp \ @@ -36,7 +35,7 @@ dyecmd_SOURCES = gui/base/cliprectangle.cpp \ events/actionevent.h \ gui/base/cliprectangle.hpp \ gui/base/color.hpp \ - gui/base/event.hpp \ + events/event.h \ gui/base/exception.hpp \ gui/base/font.hpp \ gui/base/rectangle.hpp \ @@ -161,7 +160,7 @@ manaplus_SOURCES += events/actionevent.h \ gui/base/cliprectangle.hpp \ gui/base/color.hpp \ listeners/deathlistener.h \ - gui/base/event.hpp \ + events/event.h \ gui/base/exception.hpp \ gui/base/focushandler.hpp \ listeners/focuslistener.h \ @@ -198,7 +197,6 @@ manaplus_SOURCES += events/actionevent.h \ gui/base/basiccontainer.cpp \ gui/base/cliprectangle.cpp \ gui/base/color.cpp \ - gui/base/event.cpp \ gui/base/exception.cpp \ gui/base/focushandler.cpp \ gui/base/font.cpp \ diff --git a/src/events/actionevent.h b/src/events/actionevent.h index 77f945693..70ed0f398 100644 --- a/src/events/actionevent.h +++ b/src/events/actionevent.h @@ -64,7 +64,7 @@ #ifndef EVENTS_ACTIONEVENT_HPP #define EVENTS_ACTIONEVENT_HPP -#include "gui/base/event.hpp" +#include "events/event.h" #include @@ -97,7 +97,7 @@ namespace GCN * @author Olof Naessén * @since 0.6.0 */ -class ActionEvent final : public gcn::Event +class ActionEvent final : public Event { public: /** @@ -107,7 +107,7 @@ class ActionEvent final : public gcn::Event * @param id An identifier of the event. */ ActionEvent(gcn::Widget *const source, const std::string &id) : - gcn::Event(source), + Event(source), mId(id) { } diff --git a/src/events/event.h b/src/events/event.h new file mode 100644 index 000000000..d62dd672b --- /dev/null +++ b/src/events/event.h @@ -0,0 +1,117 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* _______ __ __ __ ______ __ __ _______ __ __ + * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ + * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / + * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / + * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / + * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / + * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ + * + * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson + * + * + * Per Larsson a.k.a finalman + * Olof Naessén a.k.a jansem/yakslem + * + * Visit: http://guichan.sourceforge.net + * + * License: (BSD) + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Guichan nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef EVENTS_EVENT_HPP +#define EVENTS_EVENT_HPP + +#include "localconsts.h" + +namespace gcn +{ + class Widget; +} + +/** + * Base class for all events. All events in Guichan should + * inherit from this class. + * + * @author Olof Naessén + * @since 0.6.0 + */ +class Event +{ + public: + /** + * Constructor. + * + * @param source The source widget of the event. + */ + explicit Event(gcn::Widget *const source) : + mSource(source) + { } + + A_DELETE_COPY(Event) + + /** + * Destructor. + */ + virtual ~Event() + { } + + /** + * Gets the source widget of the event. The function + * is used to tell which widget fired an event. + * + * @return The source widget of the event. + */ + gcn::Widget* getSource() const A_WARN_UNUSED + { return mSource; } + + protected: + /** + * Holds the source widget of the event. + */ + gcn::Widget* mSource; +}; + +#endif // EVENTS_EVENT_HPP diff --git a/src/gui/base/event.cpp b/src/gui/base/event.cpp deleted file mode 100644 index 359b780bf..000000000 --- a/src/gui/base/event.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * For comments regarding functions please see the header file. - */ - -#include "gui/base/event.hpp" - -#include "debug.h" - -namespace gcn -{ - Event::Event(Widget *const source) : - mSource(source) - { - } - - Event::~Event() - { - } - - Widget* Event::getSource() const - { - return mSource; - } -} // namespace gcn diff --git a/src/gui/base/event.hpp b/src/gui/base/event.hpp deleted file mode 100644 index 2a1f4ca4b..000000000 --- a/src/gui/base/event.hpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GCN_EVENT_HPP -#define GCN_EVENT_HPP - -#include "localconsts.h" - -namespace gcn -{ - class Widget; - - /** - * Base class for all events. All events in Guichan should - * inherit from this class. - * - * @author Olof Naessén - * @since 0.6.0 - */ - class Event - { - public: - /** - * Constructor. - * - * @param source The source widget of the event. - */ - explicit Event(Widget *const source); - - A_DELETE_COPY(Event) - - /** - * Destructor. - */ - virtual ~Event(); - - /** - * Gets the source widget of the event. The function - * is used to tell which widget fired an event. - * - * @return The source widget of the event. - */ - Widget* getSource() const A_WARN_UNUSED; - - protected: - /** - * Holds the source widget of the event. - */ - Widget* mSource; - }; -} // namespace gcn - -#endif // end GCN_EVENT_HPP diff --git a/src/gui/base/focushandler.hpp b/src/gui/base/focushandler.hpp index aab3f2464..a5c1b14a1 100644 --- a/src/gui/base/focushandler.hpp +++ b/src/gui/base/focushandler.hpp @@ -66,7 +66,7 @@ #include -#include "gui/base/event.hpp" +#include "events/event.h" namespace gcn { diff --git a/src/gui/base/inputevent.hpp b/src/gui/base/inputevent.hpp index 166edf038..fab68e2a4 100644 --- a/src/gui/base/inputevent.hpp +++ b/src/gui/base/inputevent.hpp @@ -64,7 +64,7 @@ #ifndef GCN_INPUTEVENT_HPP #define GCN_INPUTEVENT_HPP -#include "gui/base/event.hpp" +#include "events/event.h" namespace gcn { diff --git a/src/gui/base/selectionevent.hpp b/src/gui/base/selectionevent.hpp index 543b3a9ad..5d05f015c 100644 --- a/src/gui/base/selectionevent.hpp +++ b/src/gui/base/selectionevent.hpp @@ -64,7 +64,7 @@ #ifndef GCN_SELECTIONEVENT_HPP #define GCN_SELECTIONEVENT_HPP -#include "gui/base/event.hpp" +#include "events/event.h" #include "localconsts.h" diff --git a/src/gui/base/widget.cpp b/src/gui/base/widget.cpp index de133ac09..6083fb35a 100644 --- a/src/gui/base/widget.cpp +++ b/src/gui/base/widget.cpp @@ -70,7 +70,7 @@ #include "events/actionevent.h" #include "gui/base/basiccontainer.hpp" -#include "gui/base/event.hpp" +#include "events/event.h" #include "gui/base/exception.hpp" #include "gui/base/focushandler.hpp" #include "gui/base/keyinput.hpp" diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp index cd780e12d..04cb3f555 100644 --- a/src/gui/focushandler.cpp +++ b/src/gui/focushandler.cpp @@ -103,7 +103,7 @@ void FocusHandler::checkForWindow() const } } -void FocusHandler::distributeFocusGainedEvent(const gcn::Event &focusEvent) +void FocusHandler::distributeFocusGainedEvent(const Event &focusEvent) { if (gui) gui->distributeGlobalFocusGainedEvent(focusEvent); diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h index b051fe300..0e07625b7 100644 --- a/src/gui/focushandler.h +++ b/src/gui/focushandler.h @@ -71,7 +71,7 @@ class FocusHandler final : public gcn::FocusHandler void tabPrevious() override final; - void distributeFocusGainedEvent(const gcn::Event &focusEvent) + void distributeFocusGainedEvent(const Event &focusEvent) override final; private: diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index bced937c7..5d72c9dcb 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -920,7 +920,7 @@ void Gui::removeGlobalFocusListener(FocusListener* focusListener) mFocusListeners.remove(focusListener); } -void Gui::distributeGlobalFocusGainedEvent(const gcn::Event &focusEvent) +void Gui::distributeGlobalFocusGainedEvent(const Event &focusEvent) { for (FocusListenerIterator iter = mFocusListeners.begin(); iter != mFocusListeners.end(); diff --git a/src/gui/gui.h b/src/gui/gui.h index 544d9dd3d..1ec73e42f 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -156,7 +156,7 @@ class Gui final : public gcn::Gui void removeGlobalFocusListener(FocusListener* focusListener); - void distributeGlobalFocusGainedEvent(const gcn::Event &focusEvent); + void distributeGlobalFocusGainedEvent(const Event &focusEvent); void removeDragged(gcn::Widget *widget); diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index ee984a18a..5478d8164 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -546,12 +546,12 @@ void Button::mouseReleased(gcn::MouseEvent& mouseEvent) } } -void Button::widgetResized(const gcn::Event &event A_UNUSED) +void Button::widgetResized(const Event &event A_UNUSED) { mRedraw = true; } -void Button::widgetMoved(const gcn::Event &event A_UNUSED) +void Button::widgetMoved(const Event &event A_UNUSED) { mRedraw = true; } diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index 8f79755a8..7fd7e4a9a 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -132,9 +132,9 @@ class Button final : public gcn::Button, void setPressed(bool b) { mPressed = b; } - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; - void widgetMoved(const gcn::Event &event) override final; + void widgetMoved(const Event &event) override final; void loadImage(const std::string &imageName); diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp index 21de10412..3f4a672f0 100644 --- a/src/gui/widgets/characterdisplay.cpp +++ b/src/gui/widgets/characterdisplay.cpp @@ -110,7 +110,7 @@ void CharacterDisplay::update() distributeResizedEvent(); } -void CharacterDisplay::widgetHidden(const gcn::Event &event A_UNUSED) +void CharacterDisplay::widgetHidden(const Event &event A_UNUSED) { mPopup->setVisible(false); } diff --git a/src/gui/widgets/characterdisplay.h b/src/gui/widgets/characterdisplay.h index 940dbe5c6..84a288ab0 100644 --- a/src/gui/widgets/characterdisplay.h +++ b/src/gui/widgets/characterdisplay.h @@ -73,7 +73,7 @@ class CharacterDisplay final : public Container, void setSelect(bool b) { mPlayerBox->setSelected(b); } - void widgetHidden(const gcn::Event &event) override final; + void widgetHidden(const Event &event) override final; void mouseExited(gcn::MouseEvent &event) override final; diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 5874ee441..8e0496fea 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -98,7 +98,7 @@ void Desktop::reloadWallpaper() setBestFittingWallpaper(); } -void Desktop::widgetResized(const gcn::Event &event A_UNUSED) +void Desktop::widgetResized(const Event &event A_UNUSED) { setBestFittingWallpaper(); } diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h index 9e49ceb59..ad07b0ff8 100644 --- a/src/gui/widgets/desktop.h +++ b/src/gui/widgets/desktop.h @@ -60,7 +60,7 @@ class Desktop final : public Container, */ void reloadWallpaper(); - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; void draw(Graphics *graphics) override final; diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 9b37682fe..4b991bc34 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -308,7 +308,7 @@ void DropShortcutContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) mItemPopup->setVisible(false); } -void DropShortcutContainer::widgetHidden(const gcn::Event &event A_UNUSED) +void DropShortcutContainer::widgetHidden(const Event &event A_UNUSED) { if (mItemPopup) mItemPopup->setVisible(false); diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h index 6b7a9f151..26cbdffa7 100644 --- a/src/gui/widgets/dropshortcutcontainer.h +++ b/src/gui/widgets/dropshortcutcontainer.h @@ -67,7 +67,7 @@ class DropShortcutContainer final : public ShortcutContainer */ void mouseReleased(gcn::MouseEvent &event) override final; - void widgetHidden(const gcn::Event &event) override final; + void widgetHidden(const Event &event) override final; void mouseExited(gcn::MouseEvent &event) override final; diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index 091d699a7..e255afc30 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -139,12 +139,12 @@ void EmotePage::resetAction() mSelectedIndex = -1; } -void EmotePage::widgetResized(const gcn::Event &event A_UNUSED) +void EmotePage::widgetResized(const Event &event A_UNUSED) { mRedraw = true; } -void EmotePage::widgetMoved(const gcn::Event &event A_UNUSED) +void EmotePage::widgetMoved(const Event &event A_UNUSED) { mRedraw = true; } diff --git a/src/gui/widgets/emotepage.h b/src/gui/widgets/emotepage.h index afc950f79..cb6fd8711 100644 --- a/src/gui/widgets/emotepage.h +++ b/src/gui/widgets/emotepage.h @@ -48,9 +48,9 @@ class EmotePage final : public gcn::Widget, int getIndexFromGrid(const int x, const int y) const; - void widgetResized(const gcn::Event &event A_UNUSED) override final; + void widgetResized(const Event &event A_UNUSED) override final; - void widgetMoved(const gcn::Event &event A_UNUSED) override final; + void widgetMoved(const Event &event A_UNUSED) override final; void resetAction(); diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index dc25d9e5c..d00f01495 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -232,7 +232,7 @@ void EmoteShortcutContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) mEmotePopup->setVisible(false); } -void EmoteShortcutContainer::widgetHidden(const gcn::Event &event A_UNUSED) +void EmoteShortcutContainer::widgetHidden(const Event &event A_UNUSED) { if (mEmotePopup) mEmotePopup->setVisible(false); diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index 62999207e..37ebe0cf9 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -74,7 +74,7 @@ class EmoteShortcutContainer final : public ShortcutContainer void mouseExited(gcn::MouseEvent &event) override final; - void widgetHidden(const gcn::Event &event) override final; + void widgetHidden(const Event &event) override final; void setWidget2(const Widget2 *const widget) override final; diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp index bfcd704d3..1c5961140 100644 --- a/src/gui/widgets/flowcontainer.cpp +++ b/src/gui/widgets/flowcontainer.cpp @@ -39,7 +39,7 @@ FlowContainer::FlowContainer(const Widget2 *const widget, mBoxHeight = 1; } -void FlowContainer::widgetResized(const gcn::Event &event A_UNUSED) +void FlowContainer::widgetResized(const Event &event A_UNUSED) { if (getWidth() < mBoxWidth) { @@ -92,5 +92,5 @@ void FlowContainer::add(gcn::Widget *widget) Container::add(widget); widget->setSize(mBoxWidth, mBoxHeight); - widgetResized(gcn::Event(nullptr)); + widgetResized(Event(nullptr)); } diff --git a/src/gui/widgets/flowcontainer.h b/src/gui/widgets/flowcontainer.h index e2773d34c..a425e8465 100644 --- a/src/gui/widgets/flowcontainer.h +++ b/src/gui/widgets/flowcontainer.h @@ -55,7 +55,7 @@ class FlowContainer final : public Container, * Invoked when a widget changes its size. This is used to determine * the new height of the container. */ - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; int getBoxWidth() const A_WARN_UNUSED { return mBoxWidth; } diff --git a/src/gui/widgets/horizontcontainer.cpp b/src/gui/widgets/horizontcontainer.cpp index 77dff3232..b2fddfcae 100644 --- a/src/gui/widgets/horizontcontainer.cpp +++ b/src/gui/widgets/horizontcontainer.cpp @@ -58,6 +58,6 @@ void HorizontContainer::clear() mCount = 0; } -void HorizontContainer::widgetResized(const gcn::Event &event A_UNUSED) +void HorizontContainer::widgetResized(const Event &event A_UNUSED) { } diff --git a/src/gui/widgets/horizontcontainer.h b/src/gui/widgets/horizontcontainer.h index eb1f8c5aa..4f652df64 100644 --- a/src/gui/widgets/horizontcontainer.h +++ b/src/gui/widgets/horizontcontainer.h @@ -48,7 +48,7 @@ class HorizontContainer final : public Container, void clear() override; - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; protected: int mSpacing; diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 84934911c..2c9e9b731 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -618,7 +618,7 @@ void ItemContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) mItemPopup->setVisible(false); } -void ItemContainer::widgetResized(const gcn::Event &event A_UNUSED) +void ItemContainer::widgetResized(const Event &event A_UNUSED) { mGridColumns = std::max(1, mDimension.width / mBoxWidth); adjustHeight(); diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index 3d98d425b..ecb7b658e 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -96,7 +96,7 @@ class ItemContainer final : public gcn::Widget, void mouseExited(gcn::MouseEvent &event) override final; // WidgetListener - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; /** * Returns the selected item. diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 2438050d9..ef4d8ebfa 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -467,7 +467,7 @@ void ItemShortcutContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) mSpellPopup->setVisible(false); } -void ItemShortcutContainer::widgetHidden(const gcn::Event &event A_UNUSED) +void ItemShortcutContainer::widgetHidden(const Event &event A_UNUSED) { if (mItemPopup) mItemPopup->setVisible(false); diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h index c2dbe93a3..5efda0433 100644 --- a/src/gui/widgets/itemshortcutcontainer.h +++ b/src/gui/widgets/itemshortcutcontainer.h @@ -68,7 +68,7 @@ class ItemShortcutContainer final : public ShortcutContainer */ void mouseReleased(gcn::MouseEvent &event) override final; - void widgetHidden(const gcn::Event &event) override final; + void widgetHidden(const Event &event) override final; void mouseExited(gcn::MouseEvent &event) override final; diff --git a/src/gui/widgets/layouthelper.cpp b/src/gui/widgets/layouthelper.cpp index 460810adf..066cabaf8 100644 --- a/src/gui/widgets/layouthelper.cpp +++ b/src/gui/widgets/layouthelper.cpp @@ -61,7 +61,7 @@ void LayoutHelper::reflowLayout(int w, int h) mContainer->setSize(w, h); } -void LayoutHelper::widgetResized(const gcn::Event &event A_UNUSED) +void LayoutHelper::widgetResized(const Event &event A_UNUSED) { const gcn::Rectangle area = mContainer->getChildrenArea(); int w = area.width; diff --git a/src/gui/widgets/layouthelper.h b/src/gui/widgets/layouthelper.h index bdd923560..d5a94e656 100644 --- a/src/gui/widgets/layouthelper.h +++ b/src/gui/widgets/layouthelper.h @@ -78,7 +78,7 @@ class LayoutHelper final : public WidgetListener /** * Called whenever the managed container changes size. */ - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; private: Layout mLayout; /**< Layout handler */ diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 9d34beaa7..7036968ad 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -244,12 +244,12 @@ void Popup::hide() mRedraw = true; } -void Popup::widgetResized(const gcn::Event &event A_UNUSED) +void Popup::widgetResized(const Event &event A_UNUSED) { mRedraw = true; } -void Popup::widgetMoved(const gcn::Event &event A_UNUSED) +void Popup::widgetMoved(const Event &event A_UNUSED) { mRedraw = true; } diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index 25998e21d..e467783ef 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -164,9 +164,9 @@ class Popup : public Container, void hide(); - void widgetResized(const gcn::Event &event) override; + void widgetResized(const Event &event) override; - void widgetMoved(const gcn::Event &event) override final; + void widgetMoved(const Event &event) override final; bool isPopupVisible() const { return mVisible; } diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp index b8e4dabb4..37dd6b1ec 100644 --- a/src/gui/widgets/popuplist.cpp +++ b/src/gui/widgets/popuplist.cpp @@ -90,7 +90,7 @@ void PopupList::show(int x, int y) requestModalFocus(); } -void PopupList::widgetResized(const gcn::Event &event) +void PopupList::widgetResized(const Event &event) { Popup::widgetResized(event); adjustSize(); @@ -154,7 +154,7 @@ void PopupList::mouseReleased(gcn::MouseEvent& mouseEvent) releaseModalFocus(); } -void PopupList::focusGained(const gcn::Event& event) +void PopupList::focusGained(const Event& event) { const gcn::Widget *const source = event.getSource(); if (!mVisible || source == this || source == mListBox @@ -170,7 +170,7 @@ void PopupList::focusGained(const gcn::Event& event) releaseModalFocus(); } -void PopupList::focusLost(const gcn::Event& event A_UNUSED) +void PopupList::focusLost(const Event& event A_UNUSED) { if (mDropDown) mDropDown->updateSelection(); diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h index 454b5617c..31308fff8 100644 --- a/src/gui/widgets/popuplist.h +++ b/src/gui/widgets/popuplist.h @@ -49,7 +49,7 @@ class PopupList final : public Popup, void show(int x, int y); - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; void setSelected(int selected); @@ -62,9 +62,9 @@ class PopupList final : public Popup, void adjustSize(); - void focusGained(const gcn::Event& event A_UNUSED) override final; + void focusGained(const Event& event A_UNUSED) override final; - void focusLost(const gcn::Event& event A_UNUSED) override final; + void focusLost(const Event& event A_UNUSED) override final; void mousePressed(gcn::MouseEvent& mouseEvent) override final; diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 415962310..b120e4289 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -283,12 +283,12 @@ void ProgressBar::render(Graphics *graphics) } } -void ProgressBar::widgetResized(const gcn::Event &event A_UNUSED) +void ProgressBar::widgetResized(const Event &event A_UNUSED) { mRedraw = true; } -void ProgressBar::widgetMoved(const gcn::Event &event A_UNUSED) +void ProgressBar::widgetMoved(const Event &event A_UNUSED) { mRedraw = true; } diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index 2835a7ffc..86e314e16 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -132,9 +132,9 @@ class ProgressBar final : public gcn::Widget, */ void render(Graphics *graphics); - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; - void widgetMoved(const gcn::Event &event) override final; + void widgetMoved(const Event &event) override final; void setPadding(unsigned int padding) { mPadding = padding; } diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index e9e850b1c..73ff82be0 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -667,7 +667,7 @@ void ScrollArea::mouseExited(gcn::MouseEvent& event A_UNUSED) mHasMouse = false; } -void ScrollArea::widgetResized(const gcn::Event &event A_UNUSED) +void ScrollArea::widgetResized(const Event &event A_UNUSED) { mRedraw = true; const unsigned int frameSize = 2 * mFrameSize; @@ -679,7 +679,7 @@ void ScrollArea::widgetResized(const gcn::Event &event A_UNUSED) } } -void ScrollArea::widgetMoved(const gcn::Event& event A_UNUSED) +void ScrollArea::widgetMoved(const Event& event A_UNUSED) { mRedraw = true; } diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index 69f567b02..7bf7e811c 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -124,9 +124,9 @@ class ScrollArea final : public gcn::ScrollArea, void mouseDragged(gcn::MouseEvent &event) override final; - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; - void widgetMoved(const gcn::Event &event) override final; + void widgetMoved(const Event &event) override final; gcn::Rectangle getVerticalBarDimension() const; diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index 8b3507b8e..767a32974 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -53,7 +53,7 @@ ShortcutContainer::~ShortcutContainer() mVertexes = nullptr; } -void ShortcutContainer::widgetResized(const gcn::Event &event A_UNUSED) +void ShortcutContainer::widgetResized(const Event &event A_UNUSED) { mGridWidth = mDimension.width / mBoxWidth; @@ -116,7 +116,7 @@ void ShortcutContainer::drawBackground(Graphics *g) } } -void ShortcutContainer::widgetMoved(const gcn::Event& event A_UNUSED) +void ShortcutContainer::widgetMoved(const Event& event A_UNUSED) { mRedraw = true; } diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index 1db3e0482..2c237f513 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -59,9 +59,9 @@ class ShortcutContainer : public gcn::Widget, * Invoked when a widget changes its size. This is used to determine * the new height of the container. */ - virtual void widgetResized(const gcn::Event &event) override final; + virtual void widgetResized(const Event &event) override final; - virtual void widgetMoved(const gcn::Event& event) override final; + virtual void widgetMoved(const Event& event) override final; /** * Handles mouse when dragged. diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 696b0fbb4..ee76ee5dd 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -314,7 +314,7 @@ void SpellShortcutContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) mSpellPopup->setVisible(false); } -void SpellShortcutContainer::widgetHidden(const gcn::Event &event A_UNUSED) +void SpellShortcutContainer::widgetHidden(const Event &event A_UNUSED) { if (mSpellPopup) mSpellPopup->setVisible(false); diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index 3115e47fe..b5968dfe5 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -67,7 +67,7 @@ class SpellShortcutContainer final : public ShortcutContainer */ void mouseReleased(gcn::MouseEvent &event) override final; - void widgetHidden(const gcn::Event &event) override final; + void widgetHidden(const Event &event) override final; void mouseExited(gcn::MouseEvent &event) override final; diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 500e821f5..2fe4f1332 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -72,7 +72,7 @@ TabbedArea::TabbedArea(const Widget2 *const widget) : void TabbedArea::postInit() { - widgetResized(gcn::Event(nullptr)); + widgetResized(Event(nullptr)); } TabbedArea::~TabbedArea() @@ -365,7 +365,7 @@ void TabbedArea::setSelectedTab(Tab *const tab) if (newTab) newTab->setCurrent(); - widgetResized(gcn::Event(nullptr)); + widgetResized(Event(nullptr)); } int TabbedArea::getSelectedTabIndex() const @@ -392,7 +392,7 @@ void TabbedArea::setSelectedTabByName(const std::string &name) } } -void TabbedArea::widgetResized(const gcn::Event &event A_UNUSED) +void TabbedArea::widgetResized(const Event &event A_UNUSED) { adjustSize(); @@ -716,7 +716,7 @@ void TabbedArea::keyPressed(gcn::KeyEvent& keyEvent) } } -void TabbedArea::death(const gcn::Event &event) +void TabbedArea::death(const Event &event) { Tab *const tab = dynamic_cast(event.getSource()); diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index ec4c02ce5..d517c9a51 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -142,7 +142,7 @@ class TabbedArea final : public Widget2, void setSelectedTabByName(const std::string &name); - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; /* void moveLeft(Tab *tab); @@ -184,7 +184,7 @@ class TabbedArea final : public Widget2, void setDimension(const gcn::Rectangle &dimension); - void death(const gcn::Event &event); + void death(const Event &event); void setResizeHeight(bool b) { mResizeHeight = b; } diff --git a/src/gui/widgets/tabs/setuptabscroll.cpp b/src/gui/widgets/tabs/setuptabscroll.cpp index 659ef5824..9a37ced42 100644 --- a/src/gui/widgets/tabs/setuptabscroll.cpp +++ b/src/gui/widgets/tabs/setuptabscroll.cpp @@ -146,7 +146,7 @@ void SetupTabScroll::externalUnloaded() } } -void SetupTabScroll::widgetResized(const gcn::Event &event A_UNUSED) +void SetupTabScroll::widgetResized(const Event &event A_UNUSED) { mScroll->setWidth(getWidth() - 12); mScroll->setHeight(getHeight() - 12 - 12); diff --git a/src/gui/widgets/tabs/setuptabscroll.h b/src/gui/widgets/tabs/setuptabscroll.h index 779826e5a..f7aa628c9 100644 --- a/src/gui/widgets/tabs/setuptabscroll.h +++ b/src/gui/widgets/tabs/setuptabscroll.h @@ -63,7 +63,7 @@ class SetupTabScroll : public SetupTab int getPreferredFirstItemSize() const A_WARN_UNUSED { return mPreferredFirstItemSize; } - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; void reread(const std::string &name); diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index 398802eb0..db5ddf6b4 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -254,12 +254,12 @@ void Tab::draw(Graphics *graphics) BLOCK_END("Tab::draw") } -void Tab::widgetResized(const gcn::Event &event A_UNUSED) +void Tab::widgetResized(const Event &event A_UNUSED) { mRedraw = true; } -void Tab::widgetMoved(const gcn::Event &event A_UNUSED) +void Tab::widgetMoved(const Event &event A_UNUSED) { mRedraw = true; } diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h index ac10b7dc7..e979c71b8 100644 --- a/src/gui/widgets/tabs/tab.h +++ b/src/gui/widgets/tabs/tab.h @@ -130,9 +130,9 @@ class Tab : public gcn::BasicContainer, int getFlash() const A_WARN_UNUSED { return mFlash; } - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; - void widgetMoved(const gcn::Event &event) override final; + void widgetMoved(const Event &event) override final; void setLabelFont(gcn::Font *const font); diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 22e9d42dd..58facecb8 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -760,7 +760,7 @@ void TextField::mousePressed(gcn::MouseEvent &mouseEvent) } } -void TextField::focusGained(const gcn::Event &event A_UNUSED) +void TextField::focusGained(const Event &event A_UNUSED) { #ifdef ANDROID if (!client->isKeyboardVisible()) @@ -768,6 +768,6 @@ void TextField::focusGained(const gcn::Event &event A_UNUSED) #endif } -void TextField::focusLost(const gcn::Event &event A_UNUSED) +void TextField::focusLost(const Event &event A_UNUSED) { } diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index 4545e9ff9..42f76985c 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -124,9 +124,9 @@ class TextField : public gcn::TextField, void handleCopy() const; - void focusGained(const gcn::Event &event) override final; + void focusGained(const Event &event) override final; - void focusLost(const gcn::Event &event) override; + void focusLost(const Event &event) override; void moveCaretBack(); diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp index ed3d00219..e38ebb9af 100644 --- a/src/gui/widgets/vertcontainer.cpp +++ b/src/gui/widgets/vertcontainer.cpp @@ -79,7 +79,7 @@ void VertContainer::clear() mResizableWidgets.clear(); } -void VertContainer::widgetResized(const gcn::Event &event A_UNUSED) +void VertContainer::widgetResized(const Event &event A_UNUSED) { FOR_EACH (std::vector::const_iterator, it, mResizableWidgets) (*it)->setWidth(getWidth()); diff --git a/src/gui/widgets/vertcontainer.h b/src/gui/widgets/vertcontainer.h index 34fcf3d45..1d396efc9 100644 --- a/src/gui/widgets/vertcontainer.h +++ b/src/gui/widgets/vertcontainer.h @@ -52,7 +52,7 @@ class VertContainer final : public Container, void clear(); - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; private: std::vector mResizableWidgets; diff --git a/src/gui/widgets/widgetgroup.cpp b/src/gui/widgets/widgetgroup.cpp index 56da2d492..3957fab30 100644 --- a/src/gui/widgets/widgetgroup.cpp +++ b/src/gui/widgets/widgetgroup.cpp @@ -84,6 +84,6 @@ void WidgetGroup::clear() mCount = 0; } -void WidgetGroup::widgetResized(const gcn::Event &event A_UNUSED) +void WidgetGroup::widgetResized(const Event &event A_UNUSED) { } diff --git a/src/gui/widgets/widgetgroup.h b/src/gui/widgets/widgetgroup.h index 835738a6f..b26d88d15 100644 --- a/src/gui/widgets/widgetgroup.h +++ b/src/gui/widgets/widgetgroup.h @@ -47,7 +47,7 @@ class WidgetGroup : public Container, virtual void clear(); - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; virtual Widget *createWidget(const std::string &name) const A_WARN_UNUSED = 0; diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 1fc439abf..54c18bd52 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -490,7 +490,7 @@ void Window::setResizable(const bool r) } } -void Window::widgetResized(const gcn::Event &event A_UNUSED) +void Window::widgetResized(const Event &event A_UNUSED) { const gcn::Rectangle area = getChildrenArea(); @@ -554,12 +554,12 @@ void Window::widgetResized(const gcn::Event &event A_UNUSED) mRedraw = true; } -void Window::widgetMoved(const gcn::Event& event A_UNUSED) +void Window::widgetMoved(const Event& event A_UNUSED) { mRedraw = true; } -void Window::widgetHidden(const gcn::Event &event A_UNUSED) +void Window::widgetHidden(const Event &event A_UNUSED) { if (gui) gui->setCursorType(Cursor::CURSOR_POINTER); @@ -1085,7 +1085,7 @@ void Window::adjustSizeToScreen() if (mDimension.height > screenHeight) mDimension.height = screenHeight; if (oldWidth != mDimension.width || oldHeight != mDimension.height) - widgetResized(gcn::Event(this)); + widgetResized(Event(this)); } int Window::getResizeHandles(const gcn::MouseEvent &event) diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 5ff5abe2b..0c3b69880 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -114,14 +114,14 @@ class Window : public gcn::Window, /** * Called whenever the widget changes size. */ - virtual void widgetResized(const gcn::Event &event) override; + virtual void widgetResized(const Event &event) override; - virtual void widgetMoved(const gcn::Event& event) override; + virtual void widgetMoved(const Event& event) override; /** * Called whenever the widget is hidden. */ - virtual void widgetHidden(const gcn::Event &event) override; + virtual void widgetHidden(const Event &event) override; /** * Sets whether or not the window has a close button. diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 5d447c717..793315067 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -563,7 +563,7 @@ void CharSelectDialog::close() Window::close(); } -void CharSelectDialog::widgetResized(const gcn::Event &event) +void CharSelectDialog::widgetResized(const Event &event) { Window::widgetResized(event); if (mCharacterView) diff --git a/src/gui/windows/charselectdialog.h b/src/gui/windows/charselectdialog.h index 6c6759932..e2b9c1ba8 100644 --- a/src/gui/windows/charselectdialog.h +++ b/src/gui/windows/charselectdialog.h @@ -86,7 +86,7 @@ class CharSelectDialog final : public Window, void close() override final; - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; void updateState(); diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 28f58aaa9..40b4b9400 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -97,7 +97,7 @@ class ChatInput final : public TextField * Called if the chat input loses focus. It will set itself to * invisible as result. */ - void focusLost(const gcn::Event &event) + void focusLost(const Event &event) { TextField::focusLost(event); if (mFocusGaining || !config.getBoolValue("protectChatFocus")) @@ -441,7 +441,7 @@ void ChatWindow::adjustTabSize() mChatTabs->adjustSize(); } -void ChatWindow::widgetResized(const gcn::Event &event) +void ChatWindow::widgetResized(const Event &event) { Window::widgetResized(event); diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index e18eef7b2..f8458bd32 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -286,7 +286,7 @@ class ChatWindow final : public Window, void unHideWindow(); - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; void addGlobalMessage(const std::string &line); diff --git a/src/gui/windows/debugwindow.cpp b/src/gui/windows/debugwindow.cpp index 7cc074086..7e68aa6d8 100644 --- a/src/gui/windows/debugwindow.cpp +++ b/src/gui/windows/debugwindow.cpp @@ -147,7 +147,7 @@ void DebugWindow::draw(Graphics *g) BLOCK_END("DebugWindow::draw") } -void DebugWindow::widgetResized(const gcn::Event &event) +void DebugWindow::widgetResized(const Event &event) { Window::widgetResized(event); diff --git a/src/gui/windows/debugwindow.h b/src/gui/windows/debugwindow.h index 83d6676da..aa7bdfe6c 100644 --- a/src/gui/windows/debugwindow.h +++ b/src/gui/windows/debugwindow.h @@ -151,7 +151,7 @@ class DebugWindow final : public Window void setPing(int pingTime); - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; #ifdef USE_PROFILER void logicChildren(); diff --git a/src/gui/windows/didyouknowwindow.cpp b/src/gui/windows/didyouknowwindow.cpp index cb2fdec95..89b1eda26 100644 --- a/src/gui/windows/didyouknowwindow.cpp +++ b/src/gui/windows/didyouknowwindow.cpp @@ -99,7 +99,7 @@ DidYouKnowWindow::DidYouKnowWindow() : void DidYouKnowWindow::postInit() { - widgetResized(gcn::Event(nullptr)); + widgetResized(Event(nullptr)); } void DidYouKnowWindow::action(const ActionEvent &event) diff --git a/src/gui/windows/emotewindow.cpp b/src/gui/windows/emotewindow.cpp index 2d2fdbd26..5f3aa1bb1 100644 --- a/src/gui/windows/emotewindow.cpp +++ b/src/gui/windows/emotewindow.cpp @@ -214,7 +214,7 @@ void EmoteWindow::addListeners(ActionListener *const listener) mFontPage->addActionListener(listener); } -void EmoteWindow::widgetResized(const gcn::Event &event) +void EmoteWindow::widgetResized(const Event &event) { Window::widgetResized(event); const int pad2 = mPadding * 2; @@ -229,7 +229,7 @@ void EmoteWindow::widgetResized(const gcn::Event &event) mEmotePage->widgetResized(event); } -void EmoteWindow::widgetMoved(const gcn::Event &event) +void EmoteWindow::widgetMoved(const Event &event) { Window::widgetMoved(event); mEmotePage->widgetResized(event); diff --git a/src/gui/windows/emotewindow.h b/src/gui/windows/emotewindow.h index 2ddc64886..37a5c015f 100644 --- a/src/gui/windows/emotewindow.h +++ b/src/gui/windows/emotewindow.h @@ -61,9 +61,9 @@ class EmoteWindow final : public Window void addListeners(ActionListener *const listener); - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; - void widgetMoved(const gcn::Event &event) override final; + void widgetMoved(const Event &event) override final; private: TabbedArea *mTabs; diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index 53e82335e..9738378ea 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -87,7 +87,7 @@ HelpWindow::HelpWindow() : loadWindowState(); loadTags(); enableVisibleSound(true); - widgetResized(gcn::Event(nullptr)); + widgetResized(Event(nullptr)); } void HelpWindow::action(const ActionEvent &event) diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 509b085b5..2412b524b 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -295,7 +295,7 @@ void InventoryWindow::postInit() slotsChanged(mInventory); mItems->setSortType(mSortDropDown->getSelected()); - widgetResized(gcn::Event(nullptr)); + widgetResized(Event(nullptr)); if (!isMainInventory()) setVisible(true); } @@ -459,7 +459,7 @@ void InventoryWindow::unselectItem() mItems->selectNone(); } -void InventoryWindow::widgetHidden(const gcn::Event &event) +void InventoryWindow::widgetHidden(const Event &event) { Window::widgetHidden(event); mItems->hidePopup(); @@ -812,7 +812,7 @@ bool InventoryWindow::isAnyInputFocused() return false; } -void InventoryWindow::widgetResized(const gcn::Event &event) +void InventoryWindow::widgetResized(const Event &event) { Window::widgetResized(event); diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h index 4babbc264..cd5172c03 100644 --- a/src/gui/windows/inventorywindow.h +++ b/src/gui/windows/inventorywindow.h @@ -92,7 +92,7 @@ class InventoryWindow final : public Window, /** * Handles closing of the window */ - void widgetHidden(const gcn::Event &event) override final; + void widgetHidden(const Event &event) override final; /** * Handles the mouse clicks. @@ -145,7 +145,7 @@ class InventoryWindow final : public Window, bool isInputFocused() const A_WARN_UNUSED; - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; void mouseMoved(gcn::MouseEvent &event) override final; diff --git a/src/gui/windows/setupwindow.cpp b/src/gui/windows/setupwindow.cpp index 710702f5e..a996d776b 100644 --- a/src/gui/windows/setupwindow.cpp +++ b/src/gui/windows/setupwindow.cpp @@ -149,7 +149,7 @@ void SetupWindow::postInit() center(); - widgetResized(gcn::Event(nullptr)); + widgetResized(Event(nullptr)); setInGame(false); enableVisibleSound(true); } @@ -260,7 +260,7 @@ void SetupWindow::setVisible(bool visible) Window::setVisible(visible); } -void SetupWindow::widgetResized(const gcn::Event &event) +void SetupWindow::widgetResized(const Event &event) { Window::widgetResized(event); diff --git a/src/gui/windows/setupwindow.h b/src/gui/windows/setupwindow.h index 27e44b243..38b3eb206 100644 --- a/src/gui/windows/setupwindow.h +++ b/src/gui/windows/setupwindow.h @@ -71,7 +71,7 @@ class SetupWindow final : public Window, void setVisible(bool visible) override final; - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; private: void unloadModTab(); diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp index 96ec8c93c..7916ce8e4 100644 --- a/src/gui/windows/shortcutwindow.cpp +++ b/src/gui/windows/shortcutwindow.cpp @@ -176,7 +176,7 @@ int ShortcutWindow::getTabIndex() const return mTabs->getSelectedTabIndex(); } -void ShortcutWindow::widgetHidden(const gcn::Event &event) +void ShortcutWindow::widgetHidden(const Event &event) { if (mItems) mItems->widgetHidden(event); @@ -226,7 +226,7 @@ void ShortcutWindow::mouseDragged(gcn::MouseEvent &event) } } -void ShortcutWindow::widgetMoved(const gcn::Event& event) +void ShortcutWindow::widgetMoved(const Event& event) { Window::widgetMoved(event); if (mItems) diff --git a/src/gui/windows/shortcutwindow.h b/src/gui/windows/shortcutwindow.h index f4c417c94..707a0a1d7 100644 --- a/src/gui/windows/shortcutwindow.h +++ b/src/gui/windows/shortcutwindow.h @@ -60,9 +60,9 @@ class ShortcutWindow final : public Window int getTabIndex() const A_WARN_UNUSED; - void widgetHidden(const gcn::Event &event) override final; + void widgetHidden(const Event &event) override final; - void widgetMoved(const gcn::Event& event) override final; + void widgetMoved(const Event& event) override final; void mousePressed(gcn::MouseEvent &event) override final; diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 12c6e76d8..deeffb9a0 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -617,7 +617,7 @@ SkillInfo* SkillDialog::getSkillByItem(const int itemId) const return nullptr; } -void SkillDialog::widgetResized(const gcn::Event &event) +void SkillDialog::widgetResized(const Event &event) { Window::widgetResized(event); diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index 2bedef2b0..3bf64df9b 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -88,7 +88,7 @@ class SkillDialog final : public Window, bool hasSkills() const A_WARN_UNUSED { return !mSkills.empty(); } - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; void useItem(const int itemId) const; diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 72590ab60..4df0ab6f1 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -1336,7 +1336,7 @@ void SocialWindow::postInit() place(0, 1, mCountLabel); place(0, 2, mTabs, 4, 4); - widgetResized(gcn::Event(nullptr)); + widgetResized(Event(nullptr)); loadWindowState(); @@ -1863,7 +1863,7 @@ void SocialWindow::updateParty() } } -void SocialWindow::widgetResized(const gcn::Event &event) +void SocialWindow::widgetResized(const Event &event) { Window::widgetResized(event); if (mTabs) diff --git a/src/gui/windows/socialwindow.h b/src/gui/windows/socialwindow.h index 08497c5c8..fc93aed4f 100644 --- a/src/gui/windows/socialwindow.h +++ b/src/gui/windows/socialwindow.h @@ -123,7 +123,7 @@ public: void updatePickupFilter(); - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; void setCounter(const SocialTab *const tab, const std::string &str); diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index 0d65eff35..201a5e11e 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -133,7 +133,7 @@ void WhoIsOnline::postInit() download(); - widgetResized(gcn::Event(nullptr)); + widgetResized(Event(nullptr)); config.addListener("updateOnlineList", this); config.addListener("groupFriends", this); mGroupFriends = config.getBoolValue("groupFriends"); @@ -715,7 +715,7 @@ void WhoIsOnline::action(const ActionEvent &event) } } -void WhoIsOnline::widgetResized(const gcn::Event &event) +void WhoIsOnline::widgetResized(const Event &event) { Window::widgetResized(event); updateSize(); diff --git a/src/gui/windows/whoisonline.h b/src/gui/windows/whoisonline.h index af0d14f7b..99eeb1911 100644 --- a/src/gui/windows/whoisonline.h +++ b/src/gui/windows/whoisonline.h @@ -136,7 +136,7 @@ public: void action(const ActionEvent &event) override final; - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; const std::set &getOnlinePlayers() const A_WARN_UNUSED { return mOnlinePlayers; } diff --git a/src/listeners/deathlistener.h b/src/listeners/deathlistener.h index ad2eb5364..beefe1746 100644 --- a/src/listeners/deathlistener.h +++ b/src/listeners/deathlistener.h @@ -66,7 +66,7 @@ #include -#include "gui/base/event.hpp" +#include "events/event.h" /** * Interface for listening for death events from widgets. @@ -90,7 +90,7 @@ class DeathListener * * @param event The event of the death. */ - virtual void death(const gcn::Event &event) = 0; + virtual void death(const Event &event) = 0; protected: /** diff --git a/src/listeners/focuslistener.h b/src/listeners/focuslistener.h index 1a6dd3fb2..c910f833e 100644 --- a/src/listeners/focuslistener.h +++ b/src/listeners/focuslistener.h @@ -66,7 +66,7 @@ #include -#include "gui/base/event.hpp" +#include "events/event.h" #include "localconsts.h" @@ -91,7 +91,7 @@ class FocusListener * * @param event Discribes the event. */ - virtual void focusGained(const gcn::Event &event A_UNUSED) + virtual void focusGained(const Event &event A_UNUSED) { } /** @@ -99,7 +99,7 @@ class FocusListener * * @param event Discribes the event. */ - virtual void focusLost(const gcn::Event &event A_UNUSED) + virtual void focusLost(const Event &event A_UNUSED) { } protected: diff --git a/src/listeners/widgetlistener.h b/src/listeners/widgetlistener.h index d7d348cd0..16d9e1f15 100644 --- a/src/listeners/widgetlistener.h +++ b/src/listeners/widgetlistener.h @@ -66,7 +66,7 @@ #include -#include "gui/base/event.hpp" +#include "events/event.h" #include "localconsts.h" @@ -94,7 +94,7 @@ class WidgetListener * @param event Describes the event. * @since 0.8.0 */ - virtual void widgetResized(const gcn::Event &event A_UNUSED) + virtual void widgetResized(const Event &event A_UNUSED) { } /** @@ -103,7 +103,7 @@ class WidgetListener * @param event Describes the event. * @since 0.8.0 */ - virtual void widgetMoved(const gcn::Event &event A_UNUSED) + virtual void widgetMoved(const Event &event A_UNUSED) { } /** @@ -113,7 +113,7 @@ class WidgetListener * @param event Describes the event. * @since 0.8.0 */ - virtual void widgetHidden(const gcn::Event &event A_UNUSED) + virtual void widgetHidden(const Event &event A_UNUSED) { } /** @@ -123,7 +123,7 @@ class WidgetListener * @param event Describes the event. * @since 0.8.0 */ - virtual void widgetShown(const gcn::Event &event A_UNUSED) + virtual void widgetShown(const Event &event A_UNUSED) { } protected: -- cgit v1.2.3-70-g09d2 From 8406b00588070266ae8af2bf25776f2fa716af69 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Feb 2014 14:22:57 +0300 Subject: move mouseevent into events directory. --- src/CMakeLists.txt | 4 +- src/Makefile.am | 4 +- src/actionmanager.cpp | 2 +- src/gui/base/gui.hpp | 3 +- src/gui/base/mouseevent.cpp | 121 ---------------- src/gui/base/mouseevent.hpp | 217 ----------------------------- src/gui/base/widgets/button.cpp | 3 +- src/gui/base/widgets/button.hpp | 3 +- src/gui/gui.cpp | 23 +-- src/gui/popups/itempopup.cpp | 2 +- src/gui/popups/itempopup.h | 2 +- src/gui/popups/popupmenu.cpp | 2 +- src/gui/popups/popupmenu.h | 2 +- src/gui/popups/spellpopup.cpp | 2 +- src/gui/popups/spellpopup.h | 2 +- src/gui/popups/textpopup.cpp | 2 +- src/gui/popups/textpopup.h | 2 +- src/gui/viewport.cpp | 20 +-- src/gui/viewport.h | 8 +- src/gui/widgets/avatarlistbox.cpp | 10 +- src/gui/widgets/avatarlistbox.h | 4 +- src/gui/widgets/browserbox.cpp | 4 +- src/gui/widgets/browserbox.h | 4 +- src/gui/widgets/button.cpp | 4 +- src/gui/widgets/button.h | 2 +- src/gui/widgets/characterdisplay.cpp | 6 +- src/gui/widgets/characterdisplay.h | 6 +- src/gui/widgets/checkbox.cpp | 4 +- src/gui/widgets/checkbox.h | 4 +- src/gui/widgets/dropdown.cpp | 16 +-- src/gui/widgets/dropdown.h | 10 +- src/gui/widgets/dropshortcutcontainer.cpp | 18 +-- src/gui/widgets/dropshortcutcontainer.h | 10 +- src/gui/widgets/emotepage.cpp | 2 +- src/gui/widgets/emotepage.h | 2 +- src/gui/widgets/emoteshortcutcontainer.cpp | 12 +- src/gui/widgets/emoteshortcutcontainer.h | 10 +- src/gui/widgets/guitable.cpp | 12 +- src/gui/widgets/guitable.h | 8 +- src/gui/widgets/itemcontainer.cpp | 12 +- src/gui/widgets/itemcontainer.h | 10 +- src/gui/widgets/itemlinkhandler.cpp | 3 +- src/gui/widgets/itemlinkhandler.h | 2 +- src/gui/widgets/itemshortcutcontainer.cpp | 18 +-- src/gui/widgets/itemshortcutcontainer.h | 10 +- src/gui/widgets/linkhandler.h | 2 +- src/gui/widgets/listbox.cpp | 16 +-- src/gui/widgets/listbox.h | 12 +- src/gui/widgets/mouseevent.h | 48 ------- src/gui/widgets/playerbox.cpp | 4 +- src/gui/widgets/playerbox.h | 2 +- src/gui/widgets/popup.cpp | 2 +- src/gui/widgets/popup.h | 2 +- src/gui/widgets/popuplist.cpp | 4 +- src/gui/widgets/popuplist.h | 4 +- src/gui/widgets/radiobutton.cpp | 4 +- src/gui/widgets/radiobutton.h | 4 +- src/gui/widgets/scrollarea.cpp | 16 +-- src/gui/widgets/scrollarea.h | 12 +- src/gui/widgets/shoplistbox.cpp | 8 +- src/gui/widgets/shoplistbox.h | 6 +- src/gui/widgets/shortcutcontainer.h | 6 +- src/gui/widgets/slider.cpp | 14 +- src/gui/widgets/slider.h | 12 +- src/gui/widgets/sliderlist.cpp | 4 +- src/gui/widgets/sliderlist.h | 4 +- src/gui/widgets/spellshortcutcontainer.cpp | 22 +-- src/gui/widgets/spellshortcutcontainer.h | 10 +- src/gui/widgets/tabbedarea.cpp | 4 +- src/gui/widgets/tabbedarea.h | 2 +- src/gui/widgets/tabs/tab.cpp | 4 +- src/gui/widgets/tabs/tab.h | 4 +- src/gui/widgets/textfield.cpp | 4 +- src/gui/widgets/textfield.h | 2 +- src/gui/widgets/window.cpp | 22 +-- src/gui/widgets/window.h | 18 +-- src/gui/windowmenu.cpp | 8 +- src/gui/windowmenu.h | 6 +- src/gui/windows/chatwindow.cpp | 14 +- src/gui/windows/chatwindow.h | 10 +- src/gui/windows/didyouknowwindow.cpp | 2 +- src/gui/windows/didyouknowwindow.h | 2 +- src/gui/windows/equipmentwindow.cpp | 12 +- src/gui/windows/equipmentwindow.h | 8 +- src/gui/windows/helpwindow.cpp | 2 +- src/gui/windows/helpwindow.h | 2 +- src/gui/windows/inventorywindow.cpp | 18 +-- src/gui/windows/inventorywindow.h | 6 +- src/gui/windows/itemamountwindow.cpp | 4 +- src/gui/windows/itemamountwindow.h | 4 +- src/gui/windows/minimap.cpp | 10 +- src/gui/windows/minimap.h | 6 +- src/gui/windows/ministatuswindow.cpp | 8 +- src/gui/windows/ministatuswindow.h | 6 +- src/gui/windows/npcdialog.cpp | 4 +- src/gui/windows/npcdialog.h | 2 +- src/gui/windows/outfitwindow.cpp | 12 +- src/gui/windows/outfitwindow.h | 6 +- src/gui/windows/serverdialog.cpp | 2 +- src/gui/windows/serverdialog.h | 2 +- src/gui/windows/shortcutwindow.cpp | 6 +- src/gui/windows/shortcutwindow.h | 4 +- src/gui/windows/skilldialog.cpp | 16 +-- src/gui/windows/socialwindow.cpp | 2 +- src/gui/windows/updaterwindow.cpp | 2 +- src/gui/windows/updaterwindow.h | 2 +- src/gui/windows/whoisonline.cpp | 6 +- src/gui/windows/whoisonline.h | 2 +- src/listeners/mouselistener.h | 20 +-- 109 files changed, 367 insertions(+), 754 deletions(-) delete mode 100644 src/gui/base/mouseevent.cpp delete mode 100644 src/gui/base/mouseevent.hpp delete mode 100644 src/gui/widgets/mouseevent.h (limited to 'src/gui/widgets/dropshortcutcontainer.cpp') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1714b01c5..e3bf7ae5c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -176,7 +176,6 @@ SET(SRCS gui/widgets/linkhandler.h gui/widgets/listbox.cpp gui/widgets/listbox.h - gui/widgets/mouseevent.h gui/widgets/namesmodel.cpp gui/widgets/namesmodel.h gui/widgets/passwordfield.cpp @@ -786,7 +785,7 @@ SET(SRCS gui/base/keyinput.hpp listeners/keylistener.h gui/base/listmodel.hpp - gui/base/mouseevent.hpp + events/mouseevent.h gui/base/mouseinput.hpp listeners/mouselistener.h gui/base/rectangle.hpp @@ -815,7 +814,6 @@ SET(SRCS gui/base/gui.cpp gui/base/key.cpp gui/base/keyinput.cpp - gui/base/mouseevent.cpp gui/base/mouseinput.cpp gui/base/rectangle.cpp gui/base/selectionevent.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 268344f2d..3b199ba44 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -174,7 +174,7 @@ manaplus_SOURCES += events/actionevent.h \ gui/base/keyinput.hpp \ listeners/keylistener.h \ gui/base/listmodel.hpp \ - gui/base/mouseevent.hpp \ + events/mouseevent.h \ gui/base/mouseinput.hpp \ listeners/mouselistener.h \ gui/base/rectangle.hpp \ @@ -203,7 +203,6 @@ manaplus_SOURCES += events/actionevent.h \ gui/base/gui.cpp \ gui/base/key.cpp \ gui/base/keyinput.cpp \ - gui/base/mouseevent.cpp \ gui/base/mouseinput.cpp \ gui/base/rectangle.cpp \ gui/base/selectionevent.cpp \ @@ -293,7 +292,6 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ gui/widgets/linkhandler.h \ gui/widgets/listbox.cpp \ gui/widgets/listbox.h \ - gui/widgets/mouseevent.h \ gui/widgets/namesmodel.cpp \ gui/widgets/namesmodel.h \ gui/widgets/passwordfield.cpp \ diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp index 4b6d80981..5b02e4aba 100644 --- a/src/actionmanager.cpp +++ b/src/actionmanager.cpp @@ -219,7 +219,7 @@ impHandler0(mouseClick) int mouseX, mouseY; Gui::getMouseState(&mouseX, &mouseY); - guiInput->simulateMouseClick(mouseX, mouseY, gcn::MouseEvent::RIGHT); + guiInput->simulateMouseClick(mouseX, mouseY, MouseEvent::RIGHT); return true; } diff --git a/src/gui/base/gui.hpp b/src/gui/base/gui.hpp index 5198b066a..b853a4210 100644 --- a/src/gui/base/gui.hpp +++ b/src/gui/base/gui.hpp @@ -68,7 +68,8 @@ #include #include "events/keyevent.h" -#include "gui/base/mouseevent.hpp" +#include "events/mouseevent.h" + #include "gui/base/mouseinput.hpp" class Graphics; diff --git a/src/gui/base/mouseevent.cpp b/src/gui/base/mouseevent.cpp deleted file mode 100644 index 9577059cc..000000000 --- a/src/gui/base/mouseevent.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * For comments regarding functions please see the header file. - */ - -#include "gui/base/mouseevent.hpp" - -#include "debug.h" - -namespace gcn -{ - MouseEvent::MouseEvent(Widget *const source, - const bool shiftPressed, - const bool controlPressed, - const bool altPressed, - const bool metaPressed, - const unsigned int type, - const unsigned int button, - const int x, - const int y, - const int clickCount) : - InputGuiEvent(source, - shiftPressed, - controlPressed, - altPressed, - metaPressed), - mType(type), - mButton(button), - mX(x), - mY(y), - mClickCount(clickCount) - { - } - - unsigned int MouseEvent::getButton() const - { - return mButton; - } - - int MouseEvent::getX() const - { - return mX; - } - - int MouseEvent::getY() const - { - return mY; - } - - int MouseEvent::getClickCount() const - { - return mClickCount; - } - - unsigned int MouseEvent::getType() const - { - return mType; - } -} // namespace gcn diff --git a/src/gui/base/mouseevent.hpp b/src/gui/base/mouseevent.hpp deleted file mode 100644 index 2853d01bf..000000000 --- a/src/gui/base/mouseevent.hpp +++ /dev/null @@ -1,217 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GCN_MOUSEEVENT_HPP -#define GCN_MOUSEEVENT_HPP - -#include "events/inputguievent.h" - -namespace gcn -{ - class Gui; - class Widget; - - /** - * Represents a mouse event. - * - * @author Olof Naessén - * @since 0.6.0 - */ - class MouseEvent: public InputGuiEvent - { - public: - /** - * Constructor. - * - * @param source The source widget of the mouse event. - * @param shiftPressed True if shift is pressed, false otherwise. - * @param controlPressed True if control is pressed, false otherwise. - * @param altPressed True if alt is pressed, false otherwise. - * @param metaPressed True if meta is pressed, false otherwise. - * @param type The type of the mouse event. - * @param button The button of the mouse event. - * @param x The x coordinate of the event relative to the source widget. - * @param y The y coordinate of the event relative the source widget. - * @param clickCount The number of clicks generated with the same button. - * It's set to zero if another button is used. - */ - MouseEvent(Widget *const source, - const bool shiftPressed, - const bool controlPressed, - const bool altPressed, - const bool metaPressed, - const unsigned int type, - const unsigned int button, - const int x, - const int y, - const int clickCount); - - /** - * Gets the button of the mouse event. - * - * @return The button of the mouse event. - */ - unsigned int getButton() const A_WARN_UNUSED; - - /** - * Gets the x coordinate of the mouse event. - * The coordinate relative to widget the mouse listener - * receiving the events have registered to. - * - * @return The x coordinate of the mouse event. - * @see Widget::addMouseListener, Widget::removeMouseListener - */ - int getX() const A_WARN_UNUSED; - - /** - * Gets the y coordinate of the mouse event. - * The coordinate relative to widget the mouse listener - * receiving the events have registered to. - * - * @return The y coordinate of the mouse event. - * @see Widget::addMouseListener, Widget::removeMouseListener - */ - int getY() const A_WARN_UNUSED; - - /** - * Gets the number of clicks generated with the same button. - * It's set to zero if another button is used. - * - * @return The number of clicks generated with the same button. - */ - int getClickCount() const A_WARN_UNUSED; - - /** - * Gets the type of the event. - * - * @return The type of the event. - */ - unsigned int getType() const A_WARN_UNUSED; - - /** - * Mouse event types. - */ - enum - { - MOVED = 0, - PRESSED, - RELEASED, - WHEEL_MOVED_DOWN, - WHEEL_MOVED_UP, - CLICKED, - ENTERED, - EXITED, - DRAGGED - }; - - /** - * Mouse button types. - */ - enum - { - EMPTY = 0, - LEFT, - RIGHT, - MIDDLE - }; - - protected: - /** - * Holds the type of the mouse event. - */ - unsigned int mType; - - /** - * Holds the button of the mouse event. - */ - unsigned int mButton; - - /** - * Holds the x-coordinate of the mouse event. - */ - int mX; - - /** - * Holds the y-coordinate of the mouse event. - */ - int mY; - - /** - * The number of clicks generated with the same button. - * It's set to zero if another button is used. - */ - int mClickCount; - - /** - * Gui is a friend of this class in order to be able to manipulate - * the protected member variables of this class and at the same time - * keep the MouseEvent class as const as possible. Gui needs to - * update the x och y coordinates for the coordinates to be relative - * to widget the mouse listener receiving the events have registered - * to. - */ - friend class Gui; - }; -} // namespace gcn - -#endif // GCN_MOUSEEVENT_HPP diff --git a/src/gui/base/widgets/button.cpp b/src/gui/base/widgets/button.cpp index 7f1aea668..8cf49da4b 100644 --- a/src/gui/base/widgets/button.cpp +++ b/src/gui/base/widgets/button.cpp @@ -70,9 +70,10 @@ #include "gui/base/exception.hpp" #include "gui/base/font.hpp" #include "gui/base/key.hpp" -#include "gui/base/mouseevent.hpp" #include "gui/base/mouseinput.hpp" +#include "events/mouseevent.h" + #include "render/graphics.h" #include "debug.h" diff --git a/src/gui/base/widgets/button.hpp b/src/gui/base/widgets/button.hpp index c81fec14f..6fee7f3b3 100644 --- a/src/gui/base/widgets/button.hpp +++ b/src/gui/base/widgets/button.hpp @@ -70,7 +70,8 @@ #include "listeners/keylistener.h" #include "listeners/mouselistener.h" -#include "gui/base/mouseevent.hpp" +#include "events/mouseevent.h" + #include "gui/base/widget.hpp" #include "render/graphics.h" diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 7708183e5..649e547d7 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -31,7 +31,8 @@ #include "gui/theme.h" #include "gui/viewport.h" -#include "gui/widgets/mouseevent.h" +#include "events/mouseevent.h" + #include "gui/widgets/window.h" #include "client.h" @@ -708,32 +709,32 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button, { switch (mouseEvent.getType()) { - case gcn::MouseEvent::ENTERED: + case MouseEvent::ENTERED: (*it)->mouseEntered(mouseEvent); break; - case gcn::MouseEvent::EXITED: + case MouseEvent::EXITED: (*it)->mouseExited(mouseEvent); break; - case gcn::MouseEvent::MOVED: + case MouseEvent::MOVED: (*it)->mouseMoved(mouseEvent); break; - case gcn::MouseEvent::PRESSED: + case MouseEvent::PRESSED: (*it)->mousePressed(mouseEvent); break; - case gcn::MouseEvent::RELEASED: + case MouseEvent::RELEASED: case 100: // manual hack for release on target after drag (*it)->mouseReleased(mouseEvent); break; - case gcn::MouseEvent::WHEEL_MOVED_UP: + case MouseEvent::WHEEL_MOVED_UP: (*it)->mouseWheelMovedUp(mouseEvent); break; - case gcn::MouseEvent::WHEEL_MOVED_DOWN: + case MouseEvent::WHEEL_MOVED_DOWN: (*it)->mouseWheelMovedDown(mouseEvent); break; - case gcn::MouseEvent::DRAGGED: + case MouseEvent::DRAGGED: (*it)->mouseDragged(mouseEvent); break; - case gcn::MouseEvent::CLICKED: + case MouseEvent::CLICKED: (*it)->mouseClicked(mouseEvent); break; default: @@ -749,7 +750,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button, widget = parent; parent = swap->getParent(); - if (type == gcn::MouseEvent::RELEASED) + if (type == MouseEvent::RELEASED) dragDrop.clear(); // If a non modal focused widget has been reach diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp index 07c950706..f7939b666 100644 --- a/src/gui/popups/itempopup.cpp +++ b/src/gui/popups/itempopup.cpp @@ -265,7 +265,7 @@ void ItemPopup::setLabelColor(Label *label, const ItemType type) const } #undef caseSetColor -void ItemPopup::mouseMoved(gcn::MouseEvent &event) +void ItemPopup::mouseMoved(MouseEvent &event) { Popup::mouseMoved(event); diff --git a/src/gui/popups/itempopup.h b/src/gui/popups/itempopup.h index ac4683938..714e0305c 100644 --- a/src/gui/popups/itempopup.h +++ b/src/gui/popups/itempopup.h @@ -60,7 +60,7 @@ class ItemPopup final : public Popup void setItem(const Item *const item, const bool showImage = false); - void mouseMoved(gcn::MouseEvent &mouseEvent) override final; + void mouseMoved(MouseEvent &mouseEvent) override final; private: Label *mItemName; diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 197a9f716..45551d165 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -839,7 +839,7 @@ void PopupMenu::showChangePos(const int x, const int y) } void PopupMenu::handleLink(const std::string &link, - gcn::MouseEvent *event A_UNUSED) + MouseEvent *event A_UNUSED) { Being *being = nullptr; if (actorManager) diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index 235c809ba..1ebb0dd89 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -187,7 +187,7 @@ class PopupMenu final : public Popup, public LinkHandler * Handles link action. */ void handleLink(const std::string &link, - gcn::MouseEvent *event A_UNUSED) override final; + MouseEvent *event A_UNUSED) override final; void clear(); diff --git a/src/gui/popups/spellpopup.cpp b/src/gui/popups/spellpopup.cpp index df25739f2..cc55fef57 100644 --- a/src/gui/popups/spellpopup.cpp +++ b/src/gui/popups/spellpopup.cpp @@ -109,7 +109,7 @@ void SpellPopup::view(const int x, const int y) requestMoveToTop(); } -void SpellPopup::mouseMoved(gcn::MouseEvent &event) +void SpellPopup::mouseMoved(MouseEvent &event) { Popup::mouseMoved(event); diff --git a/src/gui/popups/spellpopup.h b/src/gui/popups/spellpopup.h index c8123a4ce..152dfb306 100644 --- a/src/gui/popups/spellpopup.h +++ b/src/gui/popups/spellpopup.h @@ -60,7 +60,7 @@ class SpellPopup final : public Popup */ void view(const int x, const int y); - void mouseMoved(gcn::MouseEvent &mouseEvent) override final; + void mouseMoved(MouseEvent &mouseEvent) override final; private: Label *mItemName; diff --git a/src/gui/popups/textpopup.cpp b/src/gui/popups/textpopup.cpp index 14f31f84f..245bf58b0 100644 --- a/src/gui/popups/textpopup.cpp +++ b/src/gui/popups/textpopup.cpp @@ -100,7 +100,7 @@ void TextPopup::show(const int x, const int y, const std::string &str1, requestMoveToTop(); } -void TextPopup::mouseMoved(gcn::MouseEvent &event) +void TextPopup::mouseMoved(MouseEvent &event) { Popup::mouseMoved(event); diff --git a/src/gui/popups/textpopup.h b/src/gui/popups/textpopup.h index 131921b7b..eb29cba61 100644 --- a/src/gui/popups/textpopup.h +++ b/src/gui/popups/textpopup.h @@ -72,7 +72,7 @@ class TextPopup final : public Popup void show(const int x, const int y, const std::string &str1, const std::string &str2, const std::string &str3); - void mouseMoved(gcn::MouseEvent &mouseEvent) override final; + void mouseMoved(MouseEvent &mouseEvent) override final; private: Label *mText[TEXTPOPUPCOUNT]; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index b3cafa104..c3da988b7 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -280,13 +280,13 @@ void Viewport::_followMouse() if (mPlayerFollowMouse && (button & SDL_BUTTON(1))) { // We create a mouse event and send it to mouseDragged. - gcn::MouseEvent mouseEvent(nullptr, + MouseEvent mouseEvent(nullptr, 0, false, false, false, - gcn::MouseEvent::DRAGGED, - gcn::MouseEvent::LEFT, + MouseEvent::DRAGGED, + MouseEvent::LEFT, mMouseX, mMouseY, 0); @@ -385,7 +385,7 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path, #endif } -void Viewport::mousePressed(gcn::MouseEvent &event) +void Viewport::mousePressed(MouseEvent &event) { if (event.getSource() != this) return; @@ -406,7 +406,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) const int pixelY = eventY + mPixelViewY; // Right click might open a popup - if (eventButton == gcn::MouseEvent::RIGHT) + if (eventButton == MouseEvent::RIGHT) { mPlayerFollowMouse = false; if (mHoverBeing) @@ -460,7 +460,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) } // Left click can cause different actions - if (eventButton == gcn::MouseEvent::LEFT) + if (eventButton == MouseEvent::LEFT) { // Interact with some being if (mHoverBeing) @@ -532,7 +532,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) _followMouse(); } } - else if (eventButton == gcn::MouseEvent::MIDDLE) + else if (eventButton == MouseEvent::MIDDLE) { mPlayerFollowMouse = false; validateSpeed(); @@ -548,7 +548,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) } } -void Viewport::mouseDragged(gcn::MouseEvent &event) +void Viewport::mouseDragged(MouseEvent &event) { if (!mMap || !player_node) return; @@ -685,7 +685,7 @@ void Viewport::mouseDragged(gcn::MouseEvent &event) } } -void Viewport::mouseReleased(gcn::MouseEvent &event A_UNUSED) +void Viewport::mouseReleased(MouseEvent &event A_UNUSED) { mPlayerFollowMouse = false; // Only useful for eAthena but doesn't hurt under ManaServ @@ -838,7 +838,7 @@ void Viewport::optionChanged(const std::string &name) mMouseDirectionMove = config.getBoolValue("mouseDirectionMove"); } -void Viewport::mouseMoved(gcn::MouseEvent &event A_UNUSED) +void Viewport::mouseMoved(MouseEvent &event A_UNUSED) { // Check if we are on the map if (!mMap || !player_node || !actorManager) diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 6fd062c35..2b297de37 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -103,22 +103,22 @@ class Viewport final : public WindowContainer, /** * Handles mouse press on map. */ - void mousePressed(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; /** * Handles mouse move on map */ - void mouseDragged(gcn::MouseEvent &event) override final; + void mouseDragged(MouseEvent &event) override final; /** * Handles mouse button release on map. */ - void mouseReleased(gcn::MouseEvent &event) override final; + void mouseReleased(MouseEvent &event) override final; /** * Handles mouse move on map. */ - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; /** * Shows a popup for an item. diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 9a1aa40ab..8e4d9e483 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -310,7 +310,7 @@ void AvatarListBox::draw(Graphics *graphics) BLOCK_END("AvatarListBox::draw") } -void AvatarListBox::mousePressed(gcn::MouseEvent &event) +void AvatarListBox::mousePressed(MouseEvent &event) { if (!actorManager || !player_node || !viewport || !getFont()->getHeight()) @@ -334,7 +334,7 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event) return; const unsigned int eventButton = event.getButton(); - if (eventButton == gcn::MouseEvent::LEFT) + if (eventButton == MouseEvent::LEFT) { if (ava->getType() == AVATAR_PLAYER) { @@ -348,7 +348,7 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event) player_node->navigateTo(ava->getX(), ava->getY()); } } - else if (eventButton == gcn::MouseEvent::RIGHT) + else if (eventButton == MouseEvent::RIGHT) { switch (ava->getType()) { @@ -407,7 +407,7 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event) } } } - else if (eventButton == gcn::MouseEvent::MIDDLE) + else if (eventButton == MouseEvent::MIDDLE) { if (ava->getType() == AVATAR_PLAYER && chatWindow) { @@ -419,7 +419,7 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event) } } -void AvatarListBox::mouseReleased(gcn::MouseEvent &event A_UNUSED) +void AvatarListBox::mouseReleased(MouseEvent &event A_UNUSED) { } diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h index ec384368c..d0449231b 100644 --- a/src/gui/widgets/avatarlistbox.h +++ b/src/gui/widgets/avatarlistbox.h @@ -55,9 +55,9 @@ public: */ void draw(Graphics *gcnGraphics) override final; - void mousePressed(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; - void mouseReleased(gcn::MouseEvent &event A_UNUSED) override final; + void mouseReleased(MouseEvent &event A_UNUSED) override final; void optionChanged(const std::string &value) override final; diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index cfbc0ec41..c158171c0 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -423,7 +423,7 @@ struct MouseOverLink int mX, mY; }; -void BrowserBox::mousePressed(gcn::MouseEvent &event) +void BrowserBox::mousePressed(MouseEvent &event) { if (!mLinkHandler) return; @@ -438,7 +438,7 @@ void BrowserBox::mousePressed(gcn::MouseEvent &event) } } -void BrowserBox::mouseMoved(gcn::MouseEvent &event) +void BrowserBox::mouseMoved(MouseEvent &event) { const LinkIterator i = std::find_if(mLinks.begin(), mLinks.end(), MouseOverLink(event.getX(), event.getY())); diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index fa3b90963..f1c1aa1f6 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -158,9 +158,9 @@ class BrowserBox final : public gcn::Widget, /** * Handles mouse actions. */ - void mousePressed(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; /** * Draws the browser box. diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index fecf551b2..8bc3d7540 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -525,9 +525,9 @@ void Button::draw(Graphics *graphics) BLOCK_END("Button::draw") } -void Button::mouseReleased(gcn::MouseEvent& mouseEvent) +void Button::mouseReleased(MouseEvent& mouseEvent) { - if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) + if (mouseEvent.getButton() == MouseEvent::LEFT) { if (mStick) mPressed = !mPressed; diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index 5dc89ea4d..a9722f6a2 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -109,7 +109,7 @@ class Button final : public gcn::Button, */ static void updateAlpha(); - void mouseReleased(gcn::MouseEvent& mouseEvent) override final; + void mouseReleased(MouseEvent& mouseEvent) override final; void setDescription(std::string text) { mDescription = text; } diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp index 3f4a672f0..bdd740874 100644 --- a/src/gui/widgets/characterdisplay.cpp +++ b/src/gui/widgets/characterdisplay.cpp @@ -115,12 +115,12 @@ void CharacterDisplay::widgetHidden(const Event &event A_UNUSED) mPopup->setVisible(false); } -void CharacterDisplay::mouseExited(gcn::MouseEvent &event A_UNUSED) +void CharacterDisplay::mouseExited(MouseEvent &event A_UNUSED) { mPopup->setVisible(false); } -void CharacterDisplay::mouseMoved(gcn::MouseEvent &event A_UNUSED) +void CharacterDisplay::mouseMoved(MouseEvent &event A_UNUSED) { if (!gui) return; @@ -142,7 +142,7 @@ void CharacterDisplay::mouseMoved(gcn::MouseEvent &event A_UNUSED) } } -void CharacterDisplay::mousePressed(gcn::MouseEvent &event) +void CharacterDisplay::mousePressed(MouseEvent &event) { if (event.getClickCount() == 2) distributeActionEvent(); diff --git a/src/gui/widgets/characterdisplay.h b/src/gui/widgets/characterdisplay.h index 84a288ab0..8571363c3 100644 --- a/src/gui/widgets/characterdisplay.h +++ b/src/gui/widgets/characterdisplay.h @@ -75,11 +75,11 @@ class CharacterDisplay final : public Container, void widgetHidden(const Event &event) override final; - void mouseExited(gcn::MouseEvent &event) override final; + void mouseExited(MouseEvent &event) override final; - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; - void mousePressed(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; private: void update(); diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index 20310c4bc..9b67b0359 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -172,12 +172,12 @@ void CheckBox::drawBox(Graphics *const graphics) } } -void CheckBox::mouseEntered(gcn::MouseEvent& event A_UNUSED) +void CheckBox::mouseEntered(MouseEvent& event A_UNUSED) { mHasMouse = true; } -void CheckBox::mouseExited(gcn::MouseEvent& event A_UNUSED) +void CheckBox::mouseExited(MouseEvent& event A_UNUSED) { mHasMouse = false; } diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h index 2d1502552..3b0830cee 100644 --- a/src/gui/widgets/checkbox.h +++ b/src/gui/widgets/checkbox.h @@ -74,12 +74,12 @@ class CheckBox final : public gcn::CheckBox, /** * Called when the mouse enteres the widget area. */ - void mouseEntered(gcn::MouseEvent& event) override final; + void mouseEntered(MouseEvent& event) override final; /** * Called when the mouse leaves the widget area. */ - void mouseExited(gcn::MouseEvent& event) override final; + void mouseExited(MouseEvent& event) override final; void keyPressed(KeyEvent& keyEvent) override final; diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 9e3bca2fa..aca82cef4 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -357,10 +357,10 @@ void DropDown::hideDrop(bool event) mPopup->setVisible(false); } -void DropDown::mousePressed(gcn::MouseEvent& mouseEvent) +void DropDown::mousePressed(MouseEvent& mouseEvent) { // If we have a mouse press on the widget. - if (mouseEvent.getButton() == gcn::MouseEvent::LEFT + if (mouseEvent.getButton() == MouseEvent::LEFT && !mDroppedDown && mouseEvent.getSource() == this) { mPushed = true; @@ -374,7 +374,7 @@ void DropDown::mousePressed(gcn::MouseEvent& mouseEvent) } } -void DropDown::mouseReleased(gcn::MouseEvent &mouseEvent) +void DropDown::mouseReleased(MouseEvent &mouseEvent) { if (mIsDragged) mPushed = false; @@ -385,12 +385,12 @@ void DropDown::mouseReleased(gcn::MouseEvent &mouseEvent) // Released outside of widget. Can happen when we have modal // input focus. if ((0 > y || y >= mDimension.height || x < 0 || x >= mDimension.width) - && button == gcn::MouseEvent::LEFT) + && button == MouseEvent::LEFT) { if (mIsDragged) foldUp(); } - else if (button == gcn::MouseEvent::LEFT) + else if (button == MouseEvent::LEFT) { mPushed = false; } @@ -398,19 +398,19 @@ void DropDown::mouseReleased(gcn::MouseEvent &mouseEvent) mIsDragged = false; } -void DropDown::mouseDragged(gcn::MouseEvent &mouseEvent) +void DropDown::mouseDragged(MouseEvent &mouseEvent) { mIsDragged = true; mouseEvent.consume(); } -void DropDown::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) +void DropDown::mouseWheelMovedUp(MouseEvent& mouseEvent) { setSelected(getSelected() - 1); mouseEvent.consume(); } -void DropDown::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) +void DropDown::mouseWheelMovedDown(MouseEvent& mouseEvent) { setSelected(getSelected() + 1); mouseEvent.consume(); diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 58942bdb5..dd38a1730 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -93,15 +93,15 @@ class DropDown final : public ActionListener, // Inherited from MouseListener - void mousePressed(gcn::MouseEvent& mouseEvent) override final; + void mousePressed(MouseEvent& mouseEvent) override final; - void mouseReleased(gcn::MouseEvent& mouseEvent) override final; + void mouseReleased(MouseEvent& mouseEvent) override final; - void mouseDragged(gcn::MouseEvent& mouseEvent) override final; + void mouseDragged(MouseEvent& mouseEvent) override final; - void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) override final; + void mouseWheelMovedUp(MouseEvent& mouseEvent) override final; - void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) override final; + void mouseWheelMovedDown(MouseEvent& mouseEvent) override final; void setSelectedString(const std::string &str); diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 4b991bc34..693245c2f 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -157,12 +157,12 @@ void DropShortcutContainer::draw(Graphics *graphics) BLOCK_END("DropShortcutContainer::draw") } -void DropShortcutContainer::mouseDragged(gcn::MouseEvent &event) +void DropShortcutContainer::mouseDragged(MouseEvent &event) { if (!dropShortcut) return; - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { if (dragDrop.isEmpty() && mItemClicked) { @@ -196,7 +196,7 @@ void DropShortcutContainer::mouseDragged(gcn::MouseEvent &event) } } -void DropShortcutContainer::mousePressed(gcn::MouseEvent &event) +void DropShortcutContainer::mousePressed(MouseEvent &event) { if (!dropShortcut || !inventoryWindow) return; @@ -207,7 +207,7 @@ void DropShortcutContainer::mousePressed(gcn::MouseEvent &event) return; const int eventButton = event.getButton(); - if (eventButton == gcn::MouseEvent::LEFT) + if (eventButton == MouseEvent::LEFT) { if (dropShortcut->getItem(index) > 0) { @@ -223,7 +223,7 @@ void DropShortcutContainer::mousePressed(gcn::MouseEvent &event) } } } - else if (eventButton == gcn::MouseEvent::RIGHT) + else if (eventButton == MouseEvent::RIGHT) { const Inventory *const inv = PlayerInfo::getInventory(); if (!inv) @@ -237,12 +237,12 @@ void DropShortcutContainer::mousePressed(gcn::MouseEvent &event) } } -void DropShortcutContainer::mouseReleased(gcn::MouseEvent &event) +void DropShortcutContainer::mouseReleased(MouseEvent &event) { if (!dropShortcut) return; - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { if (dropShortcut->isItemSelected()) dropShortcut->setItemSelected(-1); @@ -269,7 +269,7 @@ void DropShortcutContainer::mouseReleased(gcn::MouseEvent &event) } // Show ItemTooltip -void DropShortcutContainer::mouseMoved(gcn::MouseEvent &event) +void DropShortcutContainer::mouseMoved(MouseEvent &event) { if (!dropShortcut) return; @@ -302,7 +302,7 @@ void DropShortcutContainer::mouseMoved(gcn::MouseEvent &event) } } -void DropShortcutContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) +void DropShortcutContainer::mouseExited(MouseEvent &event A_UNUSED) { if (mItemPopup) mItemPopup->setVisible(false); diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h index 26cbdffa7..9880f526d 100644 --- a/src/gui/widgets/dropshortcutcontainer.h +++ b/src/gui/widgets/dropshortcutcontainer.h @@ -55,23 +55,23 @@ class DropShortcutContainer final : public ShortcutContainer /** * Handles mouse when dragged. */ - void mouseDragged(gcn::MouseEvent &event) override final; + void mouseDragged(MouseEvent &event) override final; /** * Handles mouse when pressed. */ - void mousePressed(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; /** * Handles mouse release. */ - void mouseReleased(gcn::MouseEvent &event) override final; + void mouseReleased(MouseEvent &event) override final; void widgetHidden(const Event &event) override final; - void mouseExited(gcn::MouseEvent &event) override final; + void mouseExited(MouseEvent &event) override final; - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; void setWidget2(const Widget2 *const widget) override final; diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index e255afc30..6456913a9 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -116,7 +116,7 @@ void EmotePage::draw(Graphics *graphics) BLOCK_END("EmotePage::draw") } -void EmotePage::mousePressed(gcn::MouseEvent &mouseEvent) +void EmotePage::mousePressed(MouseEvent &mouseEvent) { mSelectedIndex = getIndexFromGrid(mouseEvent.getX(), mouseEvent.getY()); distributeActionEvent(); diff --git a/src/gui/widgets/emotepage.h b/src/gui/widgets/emotepage.h index cb6fd8711..74f93e8d3 100644 --- a/src/gui/widgets/emotepage.h +++ b/src/gui/widgets/emotepage.h @@ -44,7 +44,7 @@ class EmotePage final : public gcn::Widget, void draw(Graphics *graphics) override final; - void mousePressed(gcn::MouseEvent &mouseEvent) override final; + void mousePressed(MouseEvent &mouseEvent) override final; int getIndexFromGrid(const int x, const int y) const; diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index d00f01495..38c76060b 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -148,11 +148,11 @@ void EmoteShortcutContainer::draw(Graphics *graphics) BLOCK_END("EmoteShortcutContainer::draw") } -void EmoteShortcutContainer::mouseDragged(gcn::MouseEvent &event A_UNUSED) +void EmoteShortcutContainer::mouseDragged(MouseEvent &event A_UNUSED) { } -void EmoteShortcutContainer::mousePressed(gcn::MouseEvent &event) +void EmoteShortcutContainer::mousePressed(MouseEvent &event) { if (!emoteShortcut) return; @@ -174,12 +174,12 @@ void EmoteShortcutContainer::mousePressed(gcn::MouseEvent &event) } } -void EmoteShortcutContainer::mouseReleased(gcn::MouseEvent &event) +void EmoteShortcutContainer::mouseReleased(MouseEvent &event) { if (!emoteShortcut) return; - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { const int index = getIndexFromGrid(event.getX(), event.getY()); @@ -206,7 +206,7 @@ void EmoteShortcutContainer::mouseReleased(gcn::MouseEvent &event) } } -void EmoteShortcutContainer::mouseMoved(gcn::MouseEvent &event) +void EmoteShortcutContainer::mouseMoved(MouseEvent &event) { if (!emoteShortcut || !mEmotePopup) return; @@ -226,7 +226,7 @@ void EmoteShortcutContainer::mouseMoved(gcn::MouseEvent &event) } } -void EmoteShortcutContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) +void EmoteShortcutContainer::mouseExited(MouseEvent &event A_UNUSED) { if (mEmotePopup) mEmotePopup->setVisible(false); diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index 37ebe0cf9..ed6b4c8b3 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -58,21 +58,21 @@ class EmoteShortcutContainer final : public ShortcutContainer /** * Handles mouse when dragged. */ - void mouseDragged(gcn::MouseEvent &event) override final; + void mouseDragged(MouseEvent &event) override final; /** * Handles mouse when pressed. */ - void mousePressed(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; /** * Handles mouse release. */ - void mouseReleased(gcn::MouseEvent &event) override final; + void mouseReleased(MouseEvent &event) override final; - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; - void mouseExited(gcn::MouseEvent &event) override final; + void mouseExited(MouseEvent &event) override final; void widgetHidden(const Event &event) override final; diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index bca93e7c2..5873ef4ce 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -463,12 +463,12 @@ void GuiTable::keyPressed(KeyEvent& keyEvent) } // -- MouseListener notifications -void GuiTable::mousePressed(gcn::MouseEvent& mouseEvent) +void GuiTable::mousePressed(MouseEvent& mouseEvent) { if (!mModel || !mSelectable) return; - if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) + if (mouseEvent.getButton() == MouseEvent::LEFT) { const int row = getRowForY(mouseEvent.getY()); const int column = getColumnForX(mouseEvent.getX()); @@ -484,7 +484,7 @@ void GuiTable::mousePressed(gcn::MouseEvent& mouseEvent) } } -void GuiTable::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) +void GuiTable::mouseWheelMovedUp(MouseEvent& mouseEvent) { if (isFocused()) { @@ -495,7 +495,7 @@ void GuiTable::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) } } -void GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) +void GuiTable::mouseWheelMovedDown(MouseEvent& mouseEvent) { if (isFocused()) { @@ -504,9 +504,9 @@ void GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) } } -void GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent) +void GuiTable::mouseDragged(MouseEvent& mouseEvent) { - if (mouseEvent.getButton() != gcn::MouseEvent::LEFT) + if (mouseEvent.getButton() != MouseEvent::LEFT) return; // Make table selection update on drag diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index 766f7a3de..da367dd94 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -146,13 +146,13 @@ public: { return mOpaque; } // Inherited from MouseListener - void mousePressed(gcn::MouseEvent& mouseEvent) override final; + void mousePressed(MouseEvent& mouseEvent) override final; - void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) override final; + void mouseWheelMovedUp(MouseEvent& mouseEvent) override final; - void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) override final; + void mouseWheelMovedDown(MouseEvent& mouseEvent) override final; - void mouseDragged(gcn::MouseEvent& mouseEvent) override final; + void mouseDragged(MouseEvent& mouseEvent) override final; // Constraints inherited from TableModelListener void modelUpdated(const bool completed) override final; diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index b2fa6a47e..27a00798e 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -394,7 +394,7 @@ void ItemContainer::keyReleased(KeyEvent &event A_UNUSED) { } -void ItemContainer::mousePressed(gcn::MouseEvent &event) +void ItemContainer::mousePressed(MouseEvent &event) { if (!mInventory) return; @@ -402,7 +402,7 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event) const int button = event.getButton(); mClicks = event.getClickCount(); - if (button == gcn::MouseEvent::LEFT || button == gcn::MouseEvent::RIGHT) + if (button == MouseEvent::LEFT || button == MouseEvent::RIGHT) { const int index = getSlotIndex(event.getX(), event.getY()); if (index == Inventory::NO_SLOT_INDEX) @@ -468,13 +468,13 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event) } } -void ItemContainer::mouseDragged(gcn::MouseEvent &event A_UNUSED) +void ItemContainer::mouseDragged(MouseEvent &event A_UNUSED) { if (mSelectionStatus != SEL_NONE) mSelectionStatus = SEL_DRAGGING; } -void ItemContainer::mouseReleased(gcn::MouseEvent &event) +void ItemContainer::mouseReleased(MouseEvent &event) { if (mClicks == 2) return; @@ -594,7 +594,7 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event) } } -void ItemContainer::mouseMoved(gcn::MouseEvent &event) +void ItemContainer::mouseMoved(MouseEvent &event) { if (!mInventory) return; @@ -613,7 +613,7 @@ void ItemContainer::mouseMoved(gcn::MouseEvent &event) } } -void ItemContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) +void ItemContainer::mouseExited(MouseEvent &event A_UNUSED) { mItemPopup->setVisible(false); } diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index bc1bee695..4f530320d 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -89,11 +89,11 @@ class ItemContainer final : public gcn::Widget, void keyReleased(KeyEvent &event) override final; // MouseListener - void mousePressed(gcn::MouseEvent &event) override final; - void mouseDragged(gcn::MouseEvent &event) override final; - void mouseReleased(gcn::MouseEvent &event) override final; - void mouseMoved(gcn::MouseEvent &event) override final; - void mouseExited(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; + void mouseDragged(MouseEvent &event) override final; + void mouseReleased(MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; + void mouseExited(MouseEvent &event) override final; // WidgetListener void widgetResized(const Event &event) override final; diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index 108444bb0..deb3b4451 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -75,8 +75,7 @@ ItemLinkHandler::~ItemLinkHandler() mItemPopup = nullptr; } -void ItemLinkHandler::handleLink(const std::string &link, - gcn::MouseEvent *event) +void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event) { if (strStartWith(link, "http://") || strStartWith(link, "https://")) { diff --git a/src/gui/widgets/itemlinkhandler.h b/src/gui/widgets/itemlinkhandler.h index 4e55a8f72..39e811721 100644 --- a/src/gui/widgets/itemlinkhandler.h +++ b/src/gui/widgets/itemlinkhandler.h @@ -39,7 +39,7 @@ class ItemLinkHandler final : public LinkHandler ~ItemLinkHandler(); void handleLink(const std::string &link, - gcn::MouseEvent *event) override final; + MouseEvent *event) override final; private: ItemPopup *mItemPopup; diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index ef4d8ebfa..984803a99 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -233,13 +233,13 @@ void ItemShortcutContainer::draw(Graphics *graphics) BLOCK_END("ItemShortcutContainer::draw") } -void ItemShortcutContainer::mouseDragged(gcn::MouseEvent &event) +void ItemShortcutContainer::mouseDragged(MouseEvent &event) { ItemShortcut *const selShortcut = itemShortcut[mNumber]; if (!selShortcut) return; - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { if (dragDrop.isEmpty() && mItemClicked) { @@ -321,7 +321,7 @@ void ItemShortcutContainer::mouseDragged(gcn::MouseEvent &event) } } -void ItemShortcutContainer::mousePressed(gcn::MouseEvent &event) +void ItemShortcutContainer::mousePressed(MouseEvent &event) { ItemShortcut *const selShortcut = itemShortcut[mNumber]; if (!selShortcut) @@ -332,7 +332,7 @@ void ItemShortcutContainer::mousePressed(gcn::MouseEvent &event) if (index == -1) return; - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { // Stores the selected item if theirs one. if (selShortcut->isItemSelected() && inventoryWindow && @@ -350,7 +350,7 @@ void ItemShortcutContainer::mousePressed(gcn::MouseEvent &event) mItemClicked = true; } } - else if (event.getButton() == gcn::MouseEvent::RIGHT) + else if (event.getButton() == MouseEvent::RIGHT) { if (viewport && selShortcut) { @@ -360,13 +360,13 @@ void ItemShortcutContainer::mousePressed(gcn::MouseEvent &event) } } -void ItemShortcutContainer::mouseReleased(gcn::MouseEvent &event) +void ItemShortcutContainer::mouseReleased(MouseEvent &event) { ItemShortcut *const selShortcut = itemShortcut[mNumber]; if (!selShortcut) return; - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { if (selShortcut->isItemSelected()) selShortcut->setItemSelected(-1); @@ -402,7 +402,7 @@ void ItemShortcutContainer::mouseReleased(gcn::MouseEvent &event) } } -void ItemShortcutContainer::mouseMoved(gcn::MouseEvent &event) +void ItemShortcutContainer::mouseMoved(MouseEvent &event) { const ItemShortcut *const selShortcut = itemShortcut[mNumber]; if (!selShortcut) @@ -459,7 +459,7 @@ void ItemShortcutContainer::mouseMoved(gcn::MouseEvent &event) } // Hide ItemTooltip -void ItemShortcutContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) +void ItemShortcutContainer::mouseExited(MouseEvent &event A_UNUSED) { if (mItemPopup) mItemPopup->setVisible(false); diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h index 5efda0433..f01c2779c 100644 --- a/src/gui/widgets/itemshortcutcontainer.h +++ b/src/gui/widgets/itemshortcutcontainer.h @@ -56,23 +56,23 @@ class ItemShortcutContainer final : public ShortcutContainer /** * Handles mouse when dragged. */ - void mouseDragged(gcn::MouseEvent &event) override final; + void mouseDragged(MouseEvent &event) override final; /** * Handles mouse when pressed. */ - void mousePressed(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; /** * Handles mouse release. */ - void mouseReleased(gcn::MouseEvent &event) override final; + void mouseReleased(MouseEvent &event) override final; void widgetHidden(const Event &event) override final; - void mouseExited(gcn::MouseEvent &event) override final; + void mouseExited(MouseEvent &event) override final; - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; void setWidget2(const Widget2 *const widget); diff --git a/src/gui/widgets/linkhandler.h b/src/gui/widgets/linkhandler.h index 2f3a6e53f..b373162a3 100644 --- a/src/gui/widgets/linkhandler.h +++ b/src/gui/widgets/linkhandler.h @@ -38,7 +38,7 @@ class LinkHandler { } virtual void handleLink(const std::string &link, - gcn::MouseEvent *event) = 0; + MouseEvent *event) = 0; }; #endif // GUI_WIDGETS_LINKHANDLER_H diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 1e97b6e8a..52ff775be 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -214,20 +214,20 @@ void ListBox::keyPressed(KeyEvent &keyEvent) // Don't do anything on scrollwheel. ScrollArea will deal with that. -void ListBox::mouseWheelMovedUp(gcn::MouseEvent &mouseEvent A_UNUSED) +void ListBox::mouseWheelMovedUp(MouseEvent &mouseEvent A_UNUSED) { } -void ListBox::mouseWheelMovedDown(gcn::MouseEvent &mouseEvent A_UNUSED) +void ListBox::mouseWheelMovedDown(MouseEvent &mouseEvent A_UNUSED) { } -void ListBox::mousePressed(gcn::MouseEvent &event) +void ListBox::mousePressed(MouseEvent &event) { mPressedIndex = getSelectionByMouse(event.getY()); } -void ListBox::mouseReleased(gcn::MouseEvent &event) +void ListBox::mouseReleased(MouseEvent &event) { if (mPressedIndex != getSelectionByMouse(event.getY())) return; @@ -262,18 +262,18 @@ void ListBox::mouseReleased(gcn::MouseEvent &event) mPressedIndex = -2; } -void ListBox::mouseReleased1(const gcn::MouseEvent &mouseEvent) +void ListBox::mouseReleased1(const MouseEvent &mouseEvent) { - if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) + if (mouseEvent.getButton() == MouseEvent::LEFT) { setSelected(std::max(0, getSelectionByMouse(mouseEvent.getY()))); distributeActionEvent(); } } -void ListBox::mouseDragged(gcn::MouseEvent &event) +void ListBox::mouseDragged(MouseEvent &event) { - if (event.getButton() != gcn::MouseEvent::LEFT || getRowHeight() == 0) + if (event.getButton() != MouseEvent::LEFT || getRowHeight() == 0) return; // Make list selection update on drag, but guard against negative y diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 883814456..adf266f7e 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -71,17 +71,17 @@ class ListBox : public gcn::ListBox, // Inherited from MouseListener - void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) override final; + void mouseWheelMovedUp(MouseEvent& mouseEvent) override final; - void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) override final; + void mouseWheelMovedDown(MouseEvent& mouseEvent) override final; - void mousePressed(gcn::MouseEvent &event) override; + void mousePressed(MouseEvent &event) override; - void mouseReleased(gcn::MouseEvent &event) override; + void mouseReleased(MouseEvent &event) override; - void mouseReleased1(const gcn::MouseEvent &event); + void mouseReleased1(const MouseEvent &event); - void mouseDragged(gcn::MouseEvent &event) override; + void mouseDragged(MouseEvent &event) override; void refocus(); diff --git a/src/gui/widgets/mouseevent.h b/src/gui/widgets/mouseevent.h deleted file mode 100644 index d98a70130..000000000 --- a/src/gui/widgets/mouseevent.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef GUI_WIDGETS_MOUSEEVENT_H -#define GUI_WIDGETS_MOUSEEVENT_H - -#include "gui/base/mouseevent.hpp" -#include "gui/base/widget.hpp" - -class MouseEvent final : public gcn::MouseEvent -{ - public: - MouseEvent(gcn::Widget* source, bool shiftPressed, - bool controlPressed, bool altPressed, - bool metaPressed, unsigned int type, unsigned int button, - int x, int y, int clickCount) : - gcn::MouseEvent(source, shiftPressed, controlPressed, - altPressed, metaPressed, type, button, x, y, - clickCount) - { - } - - void setX(int n) - { mX = n; } - - void setY(int n) - { mY = n; } -}; - -#endif // GUI_WIDGETS_MOUSEEVENT_H diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 0639fe1b0..3bcb8476e 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -147,10 +147,10 @@ void PlayerBox::drawFrame(Graphics *graphics) BLOCK_END("PlayerBox::drawFrame") } -void PlayerBox::mouseReleased(gcn::MouseEvent& event) +void PlayerBox::mouseReleased(MouseEvent& event) { ScrollArea::mouseReleased(event); - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { if (!mActionEventId.empty()) distributeActionEvent(); diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h index 9671715b0..30d79ff2f 100644 --- a/src/gui/widgets/playerbox.h +++ b/src/gui/widgets/playerbox.h @@ -84,7 +84,7 @@ class PlayerBox final : public Widget2, void setSelected(bool b) { mSelected = b; } - void mouseReleased(gcn::MouseEvent& event) override final; + void mouseReleased(MouseEvent& event) override final; private: Being *mBeing; diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 7036968ad..a61ba5275 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -231,7 +231,7 @@ void Popup::position(const int x, const int y) mRedraw = true; } -void Popup::mouseMoved(gcn::MouseEvent &event A_UNUSED) +void Popup::mouseMoved(MouseEvent &event A_UNUSED) { if (viewport) viewport->hideBeingPopup(); diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index e467783ef..d64bc4b3f 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -88,7 +88,7 @@ class Popup : public Container, */ void setLocationRelativeTo(const gcn::Widget *const widget); - void mouseMoved(gcn::MouseEvent &event) override; + void mouseMoved(MouseEvent &event) override; /** * Sets the minimum width of the popup. diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp index 37dd6b1ec..62bc2f448 100644 --- a/src/gui/widgets/popuplist.cpp +++ b/src/gui/widgets/popuplist.cpp @@ -129,13 +129,13 @@ void PopupList::adjustSize() mListBox->setWidth(width); } -void PopupList::mousePressed(gcn::MouseEvent& mouseEvent) +void PopupList::mousePressed(MouseEvent& mouseEvent) { mPressedIndex = mListBox->getSelectionByMouse( mouseEvent.getY() + mPadding); } -void PopupList::mouseReleased(gcn::MouseEvent& mouseEvent) +void PopupList::mouseReleased(MouseEvent& mouseEvent) { if (mPressedIndex != mListBox->getSelectionByMouse( mouseEvent.getY() + mPadding)) diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h index 31308fff8..45f52d3b3 100644 --- a/src/gui/widgets/popuplist.h +++ b/src/gui/widgets/popuplist.h @@ -66,9 +66,9 @@ class PopupList final : public Popup, void focusLost(const Event& event A_UNUSED) override final; - void mousePressed(gcn::MouseEvent& mouseEvent) override final; + void mousePressed(MouseEvent& mouseEvent) override final; - void mouseReleased(gcn::MouseEvent& mouseEvent) override final; + void mouseReleased(MouseEvent& mouseEvent) override final; private: gcn::ListModel *mListModel; diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index afcd98d67..2fec7a9f6 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -168,12 +168,12 @@ void RadioButton::draw(Graphics* graphics) BLOCK_END("RadioButton::draw") } -void RadioButton::mouseEntered(gcn::MouseEvent& event A_UNUSED) +void RadioButton::mouseEntered(MouseEvent& event A_UNUSED) { mHasMouse = true; } -void RadioButton::mouseExited(gcn::MouseEvent& event A_UNUSED) +void RadioButton::mouseExited(MouseEvent& event A_UNUSED) { mHasMouse = false; } diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h index 9802fb5fd..6c33447c4 100644 --- a/src/gui/widgets/radiobutton.h +++ b/src/gui/widgets/radiobutton.h @@ -67,12 +67,12 @@ class RadioButton final : public gcn::RadioButton, /** * Called when the mouse enteres the widget area. */ - void mouseEntered(gcn::MouseEvent& event) override final; + void mouseEntered(MouseEvent& event) override final; /** * Called when the mouse leaves the widget area. */ - void mouseExited(gcn::MouseEvent& event) override final; + void mouseExited(MouseEvent& event) override final; void keyPressed(KeyEvent& keyEvent) override final; diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 73ff82be0..0ee2c3357 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -651,18 +651,18 @@ void ScrollArea::calcHMarker(Graphics *const graphics) } } -void ScrollArea::mouseMoved(gcn::MouseEvent& event) +void ScrollArea::mouseMoved(MouseEvent& event) { mX = event.getX(); mY = event.getY(); } -void ScrollArea::mouseEntered(gcn::MouseEvent& event A_UNUSED) +void ScrollArea::mouseEntered(MouseEvent& event A_UNUSED) { mHasMouse = true; } -void ScrollArea::mouseExited(gcn::MouseEvent& event A_UNUSED) +void ScrollArea::mouseExited(MouseEvent& event A_UNUSED) { mHasMouse = false; } @@ -684,7 +684,7 @@ void ScrollArea::widgetMoved(const Event& event A_UNUSED) mRedraw = true; } -void ScrollArea::mousePressed(gcn::MouseEvent& event) +void ScrollArea::mousePressed(MouseEvent& event) { const int x = event.getX(); const int y = event.getY(); @@ -754,16 +754,16 @@ void ScrollArea::mousePressed(gcn::MouseEvent& event) } } - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { mClickX = event.getX(); mClickY = event.getY(); } } -void ScrollArea::mouseReleased(gcn::MouseEvent& event) +void ScrollArea::mouseReleased(MouseEvent& event) { - if (event.getButton() == gcn::MouseEvent::LEFT && mClickX && mClickY) + if (event.getButton() == MouseEvent::LEFT && mClickX && mClickY) { if (!event.isConsumed()) { @@ -822,7 +822,7 @@ void ScrollArea::mouseReleased(gcn::MouseEvent& event) mRedraw = true; } -void ScrollArea::mouseDragged(gcn::MouseEvent &event) +void ScrollArea::mouseDragged(MouseEvent &event) { if (mIsVerticalMarkerDragged) { diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index 7bf7e811c..3f6195271 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -106,23 +106,23 @@ class ScrollArea final : public gcn::ScrollArea, /** * Called when the mouse moves in the widget area. */ - void mouseMoved(gcn::MouseEvent& event) override final; + void mouseMoved(MouseEvent& event) override final; /** * Called when the mouse enteres the widget area. */ - void mouseEntered(gcn::MouseEvent& event) override final; + void mouseEntered(MouseEvent& event) override final; /** * Called when the mouse leaves the widget area. */ - void mouseExited(gcn::MouseEvent& event) override final; + void mouseExited(MouseEvent& event) override final; - void mousePressed(gcn::MouseEvent& event) override final; + void mousePressed(MouseEvent& event) override final; - void mouseReleased(gcn::MouseEvent& event) override final; + void mouseReleased(MouseEvent& event) override final; - void mouseDragged(gcn::MouseEvent &event) override final; + void mouseDragged(MouseEvent &event) override final; void widgetResized(const Event &event) override final; diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 8f45abeb3..f364aaf46 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -189,7 +189,7 @@ void ShopListBox::setPriceCheck(const bool check) mPriceCheck = check; } -void ShopListBox::mouseMoved(gcn::MouseEvent &event) +void ShopListBox::mouseMoved(MouseEvent &event) { if (!mItemPopup || !mRowHeight) return; @@ -221,10 +221,10 @@ void ShopListBox::mouseMoved(gcn::MouseEvent &event) } } -void ShopListBox::mouseReleased(gcn::MouseEvent& mouseEvent) +void ShopListBox::mouseReleased(MouseEvent& mouseEvent) { ListBox::mouseReleased(mouseEvent); - if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT) + if (mouseEvent.getButton() == MouseEvent::RIGHT) { setSelected(std::max(0, getSelectionByMouse(mouseEvent.getY()))); @@ -236,7 +236,7 @@ void ShopListBox::mouseReleased(gcn::MouseEvent& mouseEvent) } } -void ShopListBox::mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) +void ShopListBox::mouseExited(MouseEvent& mouseEvent A_UNUSED) { if (!mItemPopup) return; diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index 509af8393..1cf628cca 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -74,11 +74,11 @@ class ShopListBox final : public ListBox */ void setPriceCheck(const bool check); - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; - void mouseReleased(gcn::MouseEvent& mouseEvent) override final; + void mouseReleased(MouseEvent& mouseEvent) override final; - void mouseExited(gcn::MouseEvent& mouseEvent) override final; + void mouseExited(MouseEvent& mouseEvent) override final; void setProtectItems(bool p) { mProtectItems = p; } diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index 2c237f513..e7ec2ff62 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -66,21 +66,21 @@ class ShortcutContainer : public gcn::Widget, /** * Handles mouse when dragged. */ - virtual void mouseDragged(gcn::MouseEvent &event A_UNUSED) override + virtual void mouseDragged(MouseEvent &event A_UNUSED) override { } /** * Handles mouse when pressed. */ - virtual void mousePressed(gcn::MouseEvent &event A_UNUSED) override + virtual void mousePressed(MouseEvent &event A_UNUSED) override { } /** * Handles mouse release. */ - virtual void mouseReleased(gcn::MouseEvent &event A_UNUSED) override + virtual void mouseReleased(MouseEvent &event A_UNUSED) override { } diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 8cc454c10..02ebc2ccb 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -272,21 +272,21 @@ void Slider::draw(Graphics *graphics) BLOCK_END("Slider::draw") } -void Slider::mouseEntered(gcn::MouseEvent& event A_UNUSED) +void Slider::mouseEntered(MouseEvent& event A_UNUSED) { mHasMouse = true; mRedraw = true; } -void Slider::mouseExited(gcn::MouseEvent& event A_UNUSED) +void Slider::mouseExited(MouseEvent& event A_UNUSED) { mHasMouse = false; mRedraw = true; } -void Slider::mousePressed(gcn::MouseEvent &mouseEvent) +void Slider::mousePressed(MouseEvent &mouseEvent) { - if (mouseEvent.getButton() == gcn::MouseEvent::LEFT + if (mouseEvent.getButton() == MouseEvent::LEFT && mouseEvent.getX() >= 0 && mouseEvent.getX() <= getWidth() && mouseEvent.getY() >= 0 @@ -307,7 +307,7 @@ void Slider::mousePressed(gcn::MouseEvent &mouseEvent) } } -void Slider::mouseDragged(gcn::MouseEvent &mouseEvent) +void Slider::mouseDragged(MouseEvent &mouseEvent) { if (getOrientation() == HORIZONTAL) { @@ -325,7 +325,7 @@ void Slider::mouseDragged(gcn::MouseEvent &mouseEvent) mouseEvent.consume(); } -void Slider::mouseWheelMovedUp(gcn::MouseEvent &mouseEvent) +void Slider::mouseWheelMovedUp(MouseEvent &mouseEvent) { setValue2(getValue() + getStepLength()); distributeActionEvent(); @@ -333,7 +333,7 @@ void Slider::mouseWheelMovedUp(gcn::MouseEvent &mouseEvent) mouseEvent.consume(); } -void Slider::mouseWheelMovedDown(gcn::MouseEvent &mouseEvent) +void Slider::mouseWheelMovedDown(MouseEvent &mouseEvent) { setValue2(getValue() - getStepLength()); distributeActionEvent(); diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h index 38c149560..2d4853539 100644 --- a/src/gui/widgets/slider.h +++ b/src/gui/widgets/slider.h @@ -70,20 +70,20 @@ class Slider final : public gcn::Slider, /** * Called when the mouse enteres the widget area. */ - void mouseEntered(gcn::MouseEvent& event) override final; + void mouseEntered(MouseEvent& event) override final; /** * Called when the mouse leaves the widget area. */ - void mouseExited(gcn::MouseEvent& event) override final; + void mouseExited(MouseEvent& event) override final; - void mousePressed(gcn::MouseEvent &mouseEvent) override final; + void mousePressed(MouseEvent &mouseEvent) override final; - void mouseDragged(gcn::MouseEvent &mouseEvent) override final; + void mouseDragged(MouseEvent &mouseEvent) override final; - void mouseWheelMovedUp(gcn::MouseEvent &mouseEvent) override final; + void mouseWheelMovedUp(MouseEvent &mouseEvent) override final; - void mouseWheelMovedDown(gcn::MouseEvent &mouseEvent) override final; + void mouseWheelMovedDown(MouseEvent &mouseEvent) override final; void keyPressed(KeyEvent& keyEvent) override final; diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index eee012120..988db85dd 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -80,13 +80,13 @@ void SliderList::updateAlpha() Button::updateAlpha(); } -void SliderList::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) +void SliderList::mouseWheelMovedUp(MouseEvent& mouseEvent) { setSelected(mSelectedIndex - 1); mouseEvent.consume(); } -void SliderList::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) +void SliderList::mouseWheelMovedDown(MouseEvent& mouseEvent) { setSelected(mSelectedIndex + 1); mouseEvent.consume(); diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h index 952b6c337..785ada74b 100644 --- a/src/gui/widgets/sliderlist.h +++ b/src/gui/widgets/sliderlist.h @@ -50,9 +50,9 @@ class SliderList final : public Container, void updateAlpha(); - void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) override final; + void mouseWheelMovedUp(MouseEvent& mouseEvent) override final; - void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) override final; + void mouseWheelMovedDown(MouseEvent& mouseEvent) override final; void resize(); diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index ee76ee5dd..511360b91 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -146,9 +146,9 @@ void SpellShortcutContainer::draw(Graphics *graphics) BLOCK_END("SpellShortcutContainer::draw") } -void SpellShortcutContainer::mouseDragged(gcn::MouseEvent &event) +void SpellShortcutContainer::mouseDragged(MouseEvent &event) { - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { if (dragDrop.isEmpty() && mSpellClicked) { @@ -177,7 +177,7 @@ void SpellShortcutContainer::mouseDragged(gcn::MouseEvent &event) } } -void SpellShortcutContainer::mousePressed(gcn::MouseEvent &event) +void SpellShortcutContainer::mousePressed(MouseEvent &event) { const int index = getIndexFromGrid(event.getX(), event.getY()); @@ -185,16 +185,16 @@ void SpellShortcutContainer::mousePressed(gcn::MouseEvent &event) return; const unsigned int eventButton = event.getButton(); - if (eventButton == gcn::MouseEvent::LEFT) + if (eventButton == MouseEvent::LEFT) { const int itemId = getItemByIndex(index); if (itemId > 0) mSpellClicked = true; } - else if (eventButton == gcn::MouseEvent::RIGHT) + else if (eventButton == MouseEvent::RIGHT) { } - else if (eventButton == gcn::MouseEvent::MIDDLE) + else if (eventButton == MouseEvent::MIDDLE) { if (!spellShortcut || !spellManager) return; @@ -204,7 +204,7 @@ void SpellShortcutContainer::mousePressed(gcn::MouseEvent &event) } } -void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event) +void SpellShortcutContainer::mouseReleased(MouseEvent &event) { if (!spellShortcut || !spellManager) return; @@ -220,7 +220,7 @@ void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event) const int itemId = getItemByIndex(index); const unsigned int eventButton = event.getButton(); - if (eventButton == gcn::MouseEvent::LEFT) + if (eventButton == MouseEvent::LEFT) { mSpellClicked = false; @@ -272,7 +272,7 @@ void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event) } } } - else if (eventButton == gcn::MouseEvent::RIGHT) + else if (eventButton == MouseEvent::RIGHT) { TextCommand *spell = nullptr; if (itemId >= 0) @@ -284,7 +284,7 @@ void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event) } // Show ItemTooltip -void SpellShortcutContainer::mouseMoved(gcn::MouseEvent &event) +void SpellShortcutContainer::mouseMoved(MouseEvent &event) { if (!mSpellPopup || !spellShortcut || !spellManager) return; @@ -308,7 +308,7 @@ void SpellShortcutContainer::mouseMoved(gcn::MouseEvent &event) } } -void SpellShortcutContainer::mouseExited(gcn::MouseEvent &event A_UNUSED) +void SpellShortcutContainer::mouseExited(MouseEvent &event A_UNUSED) { if (mSpellPopup) mSpellPopup->setVisible(false); diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index b5968dfe5..d8f5d22b4 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -55,23 +55,23 @@ class SpellShortcutContainer final : public ShortcutContainer /** * Handles mouse when dragged. */ - void mouseDragged(gcn::MouseEvent &event) override final; + void mouseDragged(MouseEvent &event) override final; /** * Handles mouse when pressed. */ - void mousePressed(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; /** * Handles mouse release. */ - void mouseReleased(gcn::MouseEvent &event) override final; + void mouseReleased(MouseEvent &event) override final; void widgetHidden(const Event &event) override final; - void mouseExited(gcn::MouseEvent &event) override final; + void mouseExited(MouseEvent &event) override final; - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; void setWidget2(const Widget2 *const widget) override final; diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 6a5febea6..83df191d1 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -324,12 +324,12 @@ void TabbedArea::logic() BLOCK_END("TabbedArea::logic") } -void TabbedArea::mousePressed(gcn::MouseEvent &mouseEvent) +void TabbedArea::mousePressed(MouseEvent &mouseEvent) { if (mouseEvent.isConsumed()) return; - if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) + if (mouseEvent.getButton() == MouseEvent::LEFT) { gcn::Widget *const widget = mTabContainer->getWidgetAt( mouseEvent.getX(), mouseEvent.getY()); diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index de470e89d..2fb894f6f 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -155,7 +155,7 @@ class TabbedArea final : public Widget2, // Inherited from MouseListener - void mousePressed(gcn::MouseEvent &mouseEvent) override final; + void mousePressed(MouseEvent &mouseEvent) override final; void enableScrollButtons(const bool enable); diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index db5ddf6b4..a85b7927b 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -327,12 +327,12 @@ const std::string &Tab::getCaption() const return mLabel->getCaption(); } -void Tab::mouseEntered(gcn::MouseEvent& mouseEvent A_UNUSED) +void Tab::mouseEntered(MouseEvent& mouseEvent A_UNUSED) { mHasMouse = true; } -void Tab::mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) +void Tab::mouseExited(MouseEvent& mouseEvent A_UNUSED) { mHasMouse = false; } diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h index e979c71b8..d22c6bea5 100644 --- a/src/gui/widgets/tabs/tab.h +++ b/src/gui/widgets/tabs/tab.h @@ -149,9 +149,9 @@ class Tab : public gcn::BasicContainer, const std::string &getCaption() const A_WARN_UNUSED; - void mouseEntered(gcn::MouseEvent &mouseEvent) override final; + void mouseEntered(MouseEvent &mouseEvent) override final; - void mouseExited(gcn::MouseEvent &mouseEvent) override final; + void mouseExited(MouseEvent &mouseEvent) override final; void setImage(Image *const image); diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index aa554b30f..0d01df51d 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -726,13 +726,13 @@ void TextField::fontChanged() fixScroll(); } -void TextField::mousePressed(gcn::MouseEvent &mouseEvent) +void TextField::mousePressed(MouseEvent &mouseEvent) { #ifdef ANDROID if (!client->isKeyboardVisible()) inputManager.executeAction(Input::KEY_SHOW_KEYBOARD); #endif - if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT) + if (mouseEvent.getButton() == MouseEvent::RIGHT) { if (viewport) { diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index 71285bd64..ed08de2fa 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -118,7 +118,7 @@ class TextField : public gcn::TextField, void setCaretPosition(unsigned int position); - void mousePressed(gcn::MouseEvent &mouseEvent) override final; + void mousePressed(MouseEvent &mouseEvent) override final; void handlePaste(); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 54c18bd52..e9e1ed71e 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -631,7 +631,7 @@ void Window::setVisible(const bool visible, const bool forceSticky) soundManager.playGuiSound(SOUND_SHOW_WINDOW); if (gui) { - gcn::MouseEvent *const event = reinterpret_cast( + MouseEvent *const event = reinterpret_cast( gui->createMouseEvent(this)); if (event) { @@ -658,12 +658,12 @@ void Window::scheduleDelete() windowContainer->scheduleDelete(this); } -void Window::mousePressed(gcn::MouseEvent &event) +void Window::mousePressed(MouseEvent &event) { // Let Guichan move window to top and figure out title bar drag gcn::Window::mousePressed(event); - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { const int x = event.getX(); const int y = event.getY(); @@ -701,7 +701,7 @@ void Window::close() setVisible(false); } -void Window::mouseReleased(gcn::MouseEvent &event A_UNUSED) +void Window::mouseReleased(MouseEvent &event A_UNUSED) { if (mGrip && mouseResize) { @@ -714,18 +714,18 @@ void Window::mouseReleased(gcn::MouseEvent &event A_UNUSED) mMoved = false; } -void Window::mouseEntered(gcn::MouseEvent &event) +void Window::mouseEntered(MouseEvent &event) { updateResizeHandler(event); } -void Window::mouseExited(gcn::MouseEvent &event A_UNUSED) +void Window::mouseExited(MouseEvent &event A_UNUSED) { if (mGrip && !mouseResize && gui) gui->setCursorType(Cursor::CURSOR_POINTER); } -void Window::updateResizeHandler(gcn::MouseEvent &event) +void Window::updateResizeHandler(MouseEvent &event) { if (!gui) return; @@ -760,7 +760,7 @@ void Window::updateResizeHandler(gcn::MouseEvent &event) } } -void Window::mouseMoved(gcn::MouseEvent &event) +void Window::mouseMoved(MouseEvent &event) { updateResizeHandler(event); if (viewport) @@ -772,7 +772,7 @@ bool Window::canMove() const return !mStickyButtonLock || !mSticky; } -void Window::mouseDragged(gcn::MouseEvent &event) +void Window::mouseDragged(MouseEvent &event) { if (canMove()) { @@ -1088,7 +1088,7 @@ void Window::adjustSizeToScreen() widgetResized(Event(this)); } -int Window::getResizeHandles(const gcn::MouseEvent &event) +int Window::getResizeHandles(const MouseEvent &event) { if (event.getX() < 0 || event.getY() < 0) return 0; @@ -1125,7 +1125,7 @@ int Window::getResizeHandles(const gcn::MouseEvent &event) return resizeHandles; } -bool Window::isResizeAllowed(const gcn::MouseEvent &event) const +bool Window::isResizeAllowed(const MouseEvent &event) const { const int y = event.getY(); diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 0c3b69880..a5b6be83c 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -257,35 +257,35 @@ class Window : public gcn::Window, /** * Starts window resizing when appropriate. */ - void mousePressed(gcn::MouseEvent &event) override; + void mousePressed(MouseEvent &event) override; /** * Implements window resizing and makes sure the window is not * dragged/resized outside of the screen. */ - void mouseDragged(gcn::MouseEvent &event) override; + void mouseDragged(MouseEvent &event) override; /** * Implements custom cursor image changing context, based on mouse * relative position. */ - void mouseMoved(gcn::MouseEvent &event) override; + void mouseMoved(MouseEvent &event) override; /** * When the mouse button has been let go, this ensures that the mouse * custom cursor is restored back to it's standard image. */ - void mouseReleased(gcn::MouseEvent &event) override; + void mouseReleased(MouseEvent &event) override; /** * When the mouse leaves the window this ensures that the custom cursor * is restored back to it's standard image. */ - void mouseExited(gcn::MouseEvent &event) override; + void mouseExited(MouseEvent &event) override; - void mouseEntered(gcn::MouseEvent &event) override; + void mouseEntered(MouseEvent &event) override; - void updateResizeHandler(gcn::MouseEvent &event); + void updateResizeHandler(MouseEvent &event); /** * Sets the name of the window. This is not the window title. @@ -410,7 +410,7 @@ class Window : public gcn::Window, gcn::Rectangle getWindowArea() const A_WARN_UNUSED; - bool isResizeAllowed(const gcn::MouseEvent &event) const A_WARN_UNUSED; + bool isResizeAllowed(const MouseEvent &event) const A_WARN_UNUSED; void setCaptionFont(gcn::Font *font) { mCaptionFont = font; } @@ -474,7 +474,7 @@ class Window : public gcn::Window, * * @see ResizeHandles */ - int getResizeHandles(const gcn::MouseEvent &event) A_WARN_UNUSED; + int getResizeHandles(const MouseEvent &event) A_WARN_UNUSED; Image *mGrip; /**< Resize grip */ Window *mParent; /**< The parent window */ diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index e04eb210f..4417f18a6 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -248,12 +248,12 @@ void WindowMenu::addButton(const char *const text, mButtonTexts.push_back(new ButtonText(description, key)); } -void WindowMenu::mousePressed(gcn::MouseEvent &event) +void WindowMenu::mousePressed(MouseEvent &event) { if (!viewport) return; - if (!mSmallWindow && event.getButton() == gcn::MouseEvent::RIGHT) + if (!mSmallWindow && event.getButton() == MouseEvent::RIGHT) { Button *const btn = dynamic_cast(event.getSource()); if (!btn) @@ -266,7 +266,7 @@ void WindowMenu::mousePressed(gcn::MouseEvent &event) } } -void WindowMenu::mouseMoved(gcn::MouseEvent &event) +void WindowMenu::mouseMoved(MouseEvent &event) { mHaveMouse = true; @@ -305,7 +305,7 @@ void WindowMenu::mouseMoved(gcn::MouseEvent &event) } } -void WindowMenu::mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) +void WindowMenu::mouseExited(MouseEvent& mouseEvent A_UNUSED) { mHaveMouse = false; if (!mTextPopup) diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h index 9375eb15d..1f2d8adb2 100644 --- a/src/gui/windowmenu.h +++ b/src/gui/windowmenu.h @@ -90,11 +90,11 @@ class WindowMenu final : public Container, void action(const ActionEvent &event) override final; - void mousePressed(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; - void mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) override final; + void mouseExited(MouseEvent& mouseEvent A_UNUSED) override final; std::map &getButtonNames() A_WARN_UNUSED { return mButtonNames; } diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 1e71c50ae..cbff544fc 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -771,12 +771,12 @@ void ChatWindow::scroll(const int amount) const tab->scroll(amount); } -void ChatWindow::mousePressed(gcn::MouseEvent &event) +void ChatWindow::mousePressed(MouseEvent &event) { if (event.isConsumed()) return; - if (event.getButton() == gcn::MouseEvent::RIGHT) + if (event.getButton() == MouseEvent::RIGHT) { if (viewport) { @@ -805,7 +805,7 @@ void ChatWindow::mousePressed(gcn::MouseEvent &event) if (event.isConsumed()) return; - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { const ChatTab *const tab = getFocused(); if (tab) @@ -816,7 +816,7 @@ void ChatWindow::mousePressed(gcn::MouseEvent &event) mDragOffsetY = event.getY(); } -void ChatWindow::mouseDragged(gcn::MouseEvent &event) +void ChatWindow::mouseDragged(MouseEvent &event) { Window::mouseDragged(event); @@ -1885,19 +1885,19 @@ void ChatWindow::optionChanged(const std::string &name) parseGlobalsFilter(); } -void ChatWindow::mouseMoved(gcn::MouseEvent &event) +void ChatWindow::mouseMoved(MouseEvent &event) { mHaveMouse = true; Window::mouseMoved(event); } -void ChatWindow::mouseEntered(gcn::MouseEvent& mouseEvent) +void ChatWindow::mouseEntered(MouseEvent& mouseEvent) { mHaveMouse = true; Window::mouseEntered(mouseEvent); } -void ChatWindow::mouseExited(gcn::MouseEvent& mouseEvent) +void ChatWindow::mouseExited(MouseEvent& mouseEvent) { updateVisibility(); Window::mouseExited(mouseEvent); diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index e664e63ce..2ec4e6bec 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -186,12 +186,12 @@ class ChatWindow final : public Window, /** * Handles mouse when dragged. */ - void mouseDragged(gcn::MouseEvent &event) override final; + void mouseDragged(MouseEvent &event) override final; /** * Handles mouse when pressed. */ - void mousePressed(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; void processEvent(const Channels channel, const DepricatedEvent &event) override final; @@ -274,11 +274,11 @@ class ChatWindow final : public Window, void optionChanged(const std::string &name) override final; - void mouseEntered(gcn::MouseEvent& mouseEvent) override final; + void mouseEntered(MouseEvent& mouseEvent) override final; - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; - void mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) override final; + void mouseExited(MouseEvent& mouseEvent A_UNUSED) override final; void draw(Graphics* graphics) override final; diff --git a/src/gui/windows/didyouknowwindow.cpp b/src/gui/windows/didyouknowwindow.cpp index 89b1eda26..9b3ba857c 100644 --- a/src/gui/windows/didyouknowwindow.cpp +++ b/src/gui/windows/didyouknowwindow.cpp @@ -129,7 +129,7 @@ void DidYouKnowWindow::action(const ActionEvent &event) } void DidYouKnowWindow::handleLink(const std::string &link, - gcn::MouseEvent *event A_UNUSED) + MouseEvent *event A_UNUSED) { if (strStartWith(link, "http://") || strStartWith(link, "https://")) openBrowser(link); diff --git a/src/gui/windows/didyouknowwindow.h b/src/gui/windows/didyouknowwindow.h index 4f88b3f1c..fd539e360 100644 --- a/src/gui/windows/didyouknowwindow.h +++ b/src/gui/windows/didyouknowwindow.h @@ -59,7 +59,7 @@ class DidYouKnowWindow final : public Window, * Handles link action. */ void handleLink(const std::string &link, - gcn::MouseEvent *event) override final; + MouseEvent *event) override final; void loadData(int num = 0); diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 68ef56826..5caf30df1 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -291,7 +291,7 @@ Item *EquipmentWindow::getItem(const int x, const int y) const return nullptr; } -void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent) +void EquipmentWindow::mousePressed(MouseEvent& mouseEvent) { if (!mEquipment) { @@ -302,7 +302,7 @@ void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent) const int x = mouseEvent.getX(); const int y = mouseEvent.getY(); - if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) + if (mouseEvent.getButton() == MouseEvent::LEFT) { if (mForing) { @@ -337,7 +337,7 @@ void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent) return; } } - else if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT) + else if (mouseEvent.getButton() == MouseEvent::RIGHT) { if (Item *const item = getItem(x, y)) { @@ -362,7 +362,7 @@ void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent) Window::mousePressed(mouseEvent); } -void EquipmentWindow::mouseReleased(gcn::MouseEvent &mouseEvent) +void EquipmentWindow::mouseReleased(MouseEvent &mouseEvent) { Window::mouseReleased(mouseEvent); const DragDropSource src = dragDrop.getSource(); @@ -417,7 +417,7 @@ void EquipmentWindow::mouseReleased(gcn::MouseEvent &mouseEvent) } // Show ItemTooltip -void EquipmentWindow::mouseMoved(gcn::MouseEvent &event) +void EquipmentWindow::mouseMoved(MouseEvent &event) { Window::mouseMoved(event); @@ -441,7 +441,7 @@ void EquipmentWindow::mouseMoved(gcn::MouseEvent &event) } // Hide ItemTooltip -void EquipmentWindow::mouseExited(gcn::MouseEvent &event A_UNUSED) +void EquipmentWindow::mouseExited(MouseEvent &event A_UNUSED) { if (mItemPopup) mItemPopup->setVisible(false); diff --git a/src/gui/windows/equipmentwindow.h b/src/gui/windows/equipmentwindow.h index bade666ad..c9ca12bbd 100644 --- a/src/gui/windows/equipmentwindow.h +++ b/src/gui/windows/equipmentwindow.h @@ -86,7 +86,7 @@ class EquipmentWindow final : public Window, void action(const ActionEvent &event) override final; - void mousePressed(gcn::MouseEvent& mouseEvent) override final; + void mousePressed(MouseEvent& mouseEvent) override final; const Item* getEquipment(const int i) const A_WARN_UNUSED { return mEquipment ? mEquipment->getEquipment(i) : nullptr; } @@ -97,11 +97,11 @@ class EquipmentWindow final : public Window, void resetBeing(const Being *const being); - void mouseExited(gcn::MouseEvent &event) override final; + void mouseExited(MouseEvent &event) override final; - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; - void mouseReleased(gcn::MouseEvent &event) override final; + void mouseReleased(MouseEvent &event) override final; void recalcSize(); diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index 9738378ea..95bea6e00 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -104,7 +104,7 @@ void HelpWindow::action(const ActionEvent &event) } void HelpWindow::handleLink(const std::string &link, - gcn::MouseEvent *event A_UNUSED) + MouseEvent *event A_UNUSED) { if (!strStartWith(link, "http://") && !strStartWith(link, "https://")) { diff --git a/src/gui/windows/helpwindow.h b/src/gui/windows/helpwindow.h index d8b873408..4290c99f9 100644 --- a/src/gui/windows/helpwindow.h +++ b/src/gui/windows/helpwindow.h @@ -65,7 +65,7 @@ class HelpWindow final : public Window, * Handles link action. */ void handleLink(const std::string &link, - gcn::MouseEvent *event A_UNUSED) override final; + MouseEvent *event A_UNUSED) override final; /** * Loads help in the dialog. diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index a1eb83e7a..09368e2ad 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -466,7 +466,7 @@ void InventoryWindow::widgetHidden(const Event &event) mItems->hidePopup(); } -void InventoryWindow::mouseClicked(gcn::MouseEvent &event) +void InventoryWindow::mouseClicked(MouseEvent &event) { Window::mouseClicked(event); @@ -482,7 +482,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event) && inputManager.isActionActive(static_cast( Input::KEY_STOP_ATTACK))); - if (!mod && !mod2 && event.getButton() == gcn::MouseEvent::RIGHT) + if (!mod && !mod2 && event.getButton() == MouseEvent::RIGHT) { Item *const item = mItems->getSelectedItem(); @@ -502,8 +502,8 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event) if (!mInventory) return; - if (event.getButton() == gcn::MouseEvent::LEFT - || event.getButton() == gcn::MouseEvent::RIGHT) + if (event.getButton() == MouseEvent::LEFT + || event.getButton() == MouseEvent::RIGHT) { Item *const item = mItems->getSelectedItem(); @@ -514,7 +514,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event) { if (mInventory->isMainInventory()) { - if (event.getButton() == gcn::MouseEvent::RIGHT) + if (event.getButton() == MouseEvent::RIGHT) { ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, inventoryWindow, item); @@ -528,7 +528,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event) } else { - if (event.getButton() == gcn::MouseEvent::RIGHT) + if (event.getButton() == MouseEvent::RIGHT) { ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove, inventoryWindow, item); @@ -545,7 +545,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event) { if (PlayerInfo::isItemProtected(item->getId())) return; - if (event.getButton() == gcn::MouseEvent::RIGHT) + if (event.getButton() == MouseEvent::RIGHT) { ItemAmountWindow::showWindow(ItemAmountWindow::TradeAdd, tradeWindow, item); @@ -589,7 +589,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event) } } -void InventoryWindow::mouseMoved(gcn::MouseEvent &event) +void InventoryWindow::mouseMoved(MouseEvent &event) { Window::mouseMoved(event); const gcn::Widget *const src = event.getSource(); @@ -608,7 +608,7 @@ void InventoryWindow::mouseMoved(gcn::MouseEvent &event) } } -void InventoryWindow::mouseExited(gcn::MouseEvent &event A_UNUSED) +void InventoryWindow::mouseExited(MouseEvent &event A_UNUSED) { mTextPopup->hide(); } diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h index 03f64b562..96d9d04fb 100644 --- a/src/gui/windows/inventorywindow.h +++ b/src/gui/windows/inventorywindow.h @@ -97,7 +97,7 @@ class InventoryWindow final : public Window, /** * Handles the mouse clicks. */ - void mouseClicked(gcn::MouseEvent &event) override final; + void mouseClicked(MouseEvent &event) override final; /** * Handles the key presses. @@ -147,9 +147,9 @@ class InventoryWindow final : public Window, void widgetResized(const Event &event) override final; - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; - void mouseExited(gcn::MouseEvent &event) override final; + void mouseExited(MouseEvent &event) override final; void setVisible(bool visible) override final; diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index 2158c4dd9..6b7d10173 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -313,7 +313,7 @@ ItemAmountWindow::~ItemAmountWindow() } // Show ItemTooltip -void ItemAmountWindow::mouseMoved(gcn::MouseEvent &event) +void ItemAmountWindow::mouseMoved(MouseEvent &event) { Window::mouseMoved(event); @@ -328,7 +328,7 @@ void ItemAmountWindow::mouseMoved(gcn::MouseEvent &event) } // Hide ItemTooltip -void ItemAmountWindow::mouseExited(gcn::MouseEvent &event A_UNUSED) +void ItemAmountWindow::mouseExited(MouseEvent &event A_UNUSED) { if (mItemPopup) mItemPopup->setVisible(false); diff --git a/src/gui/windows/itemamountwindow.h b/src/gui/windows/itemamountwindow.h index 76d53eeeb..cf721ee30 100644 --- a/src/gui/windows/itemamountwindow.h +++ b/src/gui/windows/itemamountwindow.h @@ -73,9 +73,9 @@ class ItemAmountWindow final : public Window, void resetAmount(); // MouseListener - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; - void mouseExited(gcn::MouseEvent &event) override final; + void mouseExited(MouseEvent &event) override final; /** * Schedules the Item Amount window for deletion. diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 691506753..0f0938e20 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -434,14 +434,14 @@ void Minimap::draw(Graphics *graphics) BLOCK_END("Minimap::draw") } -void Minimap::mouseReleased(gcn::MouseEvent &event) +void Minimap::mouseReleased(MouseEvent &event) { Window::mouseReleased(event); if (!player_node || !viewport) return; - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { int x = event.getX(); int y = event.getY(); @@ -449,7 +449,7 @@ void Minimap::mouseReleased(gcn::MouseEvent &event) player_node->navigateTo(x, y); } - else if (event.getButton() == gcn::MouseEvent::RIGHT) + else if (event.getButton() == MouseEvent::RIGHT) { int x = event.getX(); int y = event.getY(); @@ -458,7 +458,7 @@ void Minimap::mouseReleased(gcn::MouseEvent &event) } } -void Minimap::mouseMoved(gcn::MouseEvent &event) +void Minimap::mouseMoved(MouseEvent &event) { Window::mouseMoved(event); const int x = event.getX(); @@ -467,7 +467,7 @@ void Minimap::mouseMoved(gcn::MouseEvent &event) mTextPopup->show(x + rect.x, y + rect.y, mCaption); } -void Minimap::mouseExited(gcn::MouseEvent &event) +void Minimap::mouseExited(MouseEvent &event) { Window::mouseExited(event); mTextPopup->hide(); diff --git a/src/gui/windows/minimap.h b/src/gui/windows/minimap.h index 661412c57..d99aea13d 100644 --- a/src/gui/windows/minimap.h +++ b/src/gui/windows/minimap.h @@ -62,11 +62,11 @@ class Minimap final : public Window, public ConfigListener */ void draw(Graphics *graphics) override final; - void mouseMoved(gcn::MouseEvent &event) override final; + void mouseMoved(MouseEvent &event) override final; - void mouseReleased(gcn::MouseEvent &event) override final; + void mouseReleased(MouseEvent &event) override final; - void mouseExited(gcn::MouseEvent &event) override final; + void mouseExited(MouseEvent &event) override final; void screenToMap(int &x, int &y); diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 3513bb2ff..b8f2fd7ea 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -315,7 +315,7 @@ void MiniStatusWindow::draw(Graphics *graphics) BLOCK_END("MiniStatusWindow::draw") } -void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event) +void MiniStatusWindow::mouseMoved(MouseEvent &event) { Popup::mouseMoved(event); @@ -433,12 +433,12 @@ void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event) } } -void MiniStatusWindow::mousePressed(gcn::MouseEvent &event) +void MiniStatusWindow::mousePressed(MouseEvent &event) { if (!viewport) return; - if (event.getButton() == gcn::MouseEvent::RIGHT) + if (event.getButton() == MouseEvent::RIGHT) { const ProgressBar *const bar = dynamic_cast( event.getSource()); @@ -452,7 +452,7 @@ void MiniStatusWindow::mousePressed(gcn::MouseEvent &event) } } -void MiniStatusWindow::mouseExited(gcn::MouseEvent &event) +void MiniStatusWindow::mouseExited(MouseEvent &event) { Popup::mouseExited(event); diff --git a/src/gui/windows/ministatuswindow.h b/src/gui/windows/ministatuswindow.h index 5fccae02e..bb1991c19 100644 --- a/src/gui/windows/ministatuswindow.h +++ b/src/gui/windows/ministatuswindow.h @@ -71,11 +71,11 @@ class MiniStatusWindow final : public Popup, void draw(Graphics *graphics) override final; - void mouseMoved(gcn::MouseEvent &mouseEvent) override final; + void mouseMoved(MouseEvent &mouseEvent) override final; - void mousePressed(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; - void mouseExited(gcn::MouseEvent &event) override final; + void mouseExited(MouseEvent &event) override final; void showBar(const std::string &name, const bool visible); diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 4ee8f3b29..a883406e7 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -965,10 +965,10 @@ void NpcDialog::clearDialogs() mNpcDialogs.clear(); } -void NpcDialog::mousePressed(gcn::MouseEvent &event) +void NpcDialog::mousePressed(MouseEvent &event) { Window::mousePressed(event); - if (event.getButton() == gcn::MouseEvent::RIGHT + if (event.getButton() == MouseEvent::RIGHT && event.getSource() == mTextBox) { if (viewport) diff --git a/src/gui/windows/npcdialog.h b/src/gui/windows/npcdialog.h index 1fdd4a444..b7b036659 100644 --- a/src/gui/windows/npcdialog.h +++ b/src/gui/windows/npcdialog.h @@ -210,7 +210,7 @@ class NpcDialog final : public Window, void clearRows(); - void mousePressed(gcn::MouseEvent &event); + void mousePressed(MouseEvent &event); int isCloseState() const { return mActionState == NPC_ACTION_CLOSE; } diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index 6fbb34390..d1413cc0a 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -366,9 +366,9 @@ void OutfitWindow::draw(Graphics *graphics) BLOCK_END("OutfitWindow::draw") } -void OutfitWindow::mouseDragged(gcn::MouseEvent &event) +void OutfitWindow::mouseDragged(MouseEvent &event) { - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { if (dragDrop.isEmpty() && mItemClicked) { @@ -409,12 +409,12 @@ void OutfitWindow::mouseDragged(gcn::MouseEvent &event) Window::mouseDragged(event); } -void OutfitWindow::mousePressed(gcn::MouseEvent &event) +void OutfitWindow::mousePressed(MouseEvent &event) { const int index = getIndexFromGrid(event.getX(), event.getY()); if (index == -1) { - if (event.getButton() == gcn::MouseEvent::RIGHT && viewport) + if (event.getButton() == MouseEvent::RIGHT && viewport) { viewport->showOutfitsPopup(); event.consume(); @@ -446,9 +446,9 @@ void OutfitWindow::mousePressed(gcn::MouseEvent &event) Window::mousePressed(event); } -void OutfitWindow::mouseReleased(gcn::MouseEvent &event) +void OutfitWindow::mouseReleased(MouseEvent &event) { - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { if (mCurrentOutfit < 0 || mCurrentOutfit >= static_cast(OUTFITS_COUNT)) diff --git a/src/gui/windows/outfitwindow.h b/src/gui/windows/outfitwindow.h index f27852a8c..909b84a41 100644 --- a/src/gui/windows/outfitwindow.h +++ b/src/gui/windows/outfitwindow.h @@ -54,11 +54,11 @@ class OutfitWindow final : public Window, void draw(Graphics *graphics) override final; - void mousePressed(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; - void mouseDragged(gcn::MouseEvent &event) override final; + void mouseDragged(MouseEvent &event) override final; - void mouseReleased(gcn::MouseEvent &event) override final; + void mouseReleased(MouseEvent &event) override final; void load(const bool oldConfig = false); diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index c4bd7c79f..4ad0e8360 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -506,7 +506,7 @@ void ServerDialog::valueChanged(const gcn::SelectionEvent &) mDeleteButton->setEnabled(true); } -void ServerDialog::mouseClicked(gcn::MouseEvent &mouseEvent) +void ServerDialog::mouseClicked(MouseEvent &mouseEvent) { if (mouseEvent.getClickCount() == 2 && mouseEvent.getSource() == mServersList) diff --git a/src/gui/windows/serverdialog.h b/src/gui/windows/serverdialog.h index d14360b88..41ef8bcf1 100644 --- a/src/gui/windows/serverdialog.h +++ b/src/gui/windows/serverdialog.h @@ -125,7 +125,7 @@ class ServerDialog final : public Window, */ void valueChanged(const gcn::SelectionEvent &event) override final; - void mouseClicked(gcn::MouseEvent &mouseEvent) override final; + void mouseClicked(MouseEvent &mouseEvent) override final; void logic() override final; diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp index 7916ce8e4..50bc6fcd1 100644 --- a/src/gui/windows/shortcutwindow.cpp +++ b/src/gui/windows/shortcutwindow.cpp @@ -195,21 +195,21 @@ void ShortcutWindow::widgetHidden(const Event &event) } } -void ShortcutWindow::mousePressed(gcn::MouseEvent &event) +void ShortcutWindow::mousePressed(MouseEvent &event) { Window::mousePressed(event); if (event.isConsumed()) return; - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { mDragOffsetX = event.getX(); mDragOffsetY = event.getY(); } } -void ShortcutWindow::mouseDragged(gcn::MouseEvent &event) +void ShortcutWindow::mouseDragged(MouseEvent &event) { Window::mouseDragged(event); diff --git a/src/gui/windows/shortcutwindow.h b/src/gui/windows/shortcutwindow.h index 707a0a1d7..5e36e68d7 100644 --- a/src/gui/windows/shortcutwindow.h +++ b/src/gui/windows/shortcutwindow.h @@ -64,9 +64,9 @@ class ShortcutWindow final : public Window void widgetMoved(const Event& event) override final; - void mousePressed(gcn::MouseEvent &event) override final; + void mousePressed(MouseEvent &event) override final; - void mouseDragged(gcn::MouseEvent &event) override final; + void mouseDragged(MouseEvent &event) override final; void nextTab(); diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index deeffb9a0..8ec8486e3 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -157,7 +157,7 @@ class SkillListBox final : public ListBox unsigned int getRowHeight() const override { return mRowHeight; } - const SkillInfo *getSkillByEvent(const gcn::MouseEvent &event) const + const SkillInfo *getSkillByEvent(const MouseEvent &event) const { const int y = (event.getY() + mPadding) / getRowHeight(); if (!mModel || y >= mModel->getNumberOfElements()) @@ -168,7 +168,7 @@ class SkillListBox final : public ListBox return skill; } - void mouseMoved(gcn::MouseEvent &event) override + void mouseMoved(MouseEvent &event) override { ListBox::mouseMoved(event); if (!viewport || !dragDrop.isEmpty()) @@ -182,9 +182,9 @@ class SkillListBox final : public ListBox skill->data->dispName, skill->data->description); } - void mouseDragged(gcn::MouseEvent &event) + void mouseDragged(MouseEvent &event) { - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { if (dragDrop.isEmpty()) { @@ -206,10 +206,10 @@ class SkillListBox final : public ListBox } } - void mousePressed(gcn::MouseEvent &event) + void mousePressed(MouseEvent &event) { ListBox::mousePressed(event); - if (event.getButton() == gcn::MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { const SkillInfo *const skill = getSkillByEvent(event); if (!skill) @@ -218,12 +218,12 @@ class SkillListBox final : public ListBox } } - void mouseReleased(gcn::MouseEvent &event) + void mouseReleased(MouseEvent &event) { ListBox::mouseReleased(event); } - void mouseExited(gcn::MouseEvent &event A_UNUSED) override + void mouseExited(MouseEvent &event A_UNUSED) override { mPopup->hide(); } diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 4df0ab6f1..704bf0ca6 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -1242,7 +1242,7 @@ public: A_DELETE_COPY(CreatePopup) void handleLink(const std::string &link, - gcn::MouseEvent *event A_UNUSED) override final + MouseEvent *event A_UNUSED) override final { if (link == "guild" && socialWindow) { diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 109858a07..8e31939ff 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -971,7 +971,7 @@ unsigned long UpdaterWindow::getFileHash(const std::string &filePath) } void UpdaterWindow::handleLink(const std::string &link, - gcn::MouseEvent *event A_UNUSED) + MouseEvent *event A_UNUSED) { if (strStartWith(link, "http://") || strStartWith(link, "https://")) openBrowser(link); diff --git a/src/gui/windows/updaterwindow.h b/src/gui/windows/updaterwindow.h index ffd5b3103..79d764752 100644 --- a/src/gui/windows/updaterwindow.h +++ b/src/gui/windows/updaterwindow.h @@ -126,7 +126,7 @@ class UpdaterWindow final : public Window, void logic() override final; void handleLink(const std::string &link, - gcn::MouseEvent *event A_UNUSED) override final; + MouseEvent *event A_UNUSED) override final; void loadFile(std::string file); diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index 201a5e11e..1af21866d 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -159,9 +159,9 @@ WhoIsOnline::~WhoIsOnline() mOnlineNicks.clear(); } -void WhoIsOnline::handleLink(const std::string& link, gcn::MouseEvent *event) +void WhoIsOnline::handleLink(const std::string& link, MouseEvent *event) { - if (!event || event->getButton() == gcn::MouseEvent::LEFT) + if (!event || event->getButton() == MouseEvent::LEFT) { if (chatWindow) { @@ -177,7 +177,7 @@ void WhoIsOnline::handleLink(const std::string& link, gcn::MouseEvent *event) } } } - else if (event->getButton() == gcn::MouseEvent::RIGHT) + else if (event->getButton() == MouseEvent::RIGHT) { if (player_node && link == player_node->getName()) return; diff --git a/src/gui/windows/whoisonline.h b/src/gui/windows/whoisonline.h index 99eeb1911..bc04c8066 100644 --- a/src/gui/windows/whoisonline.h +++ b/src/gui/windows/whoisonline.h @@ -128,7 +128,7 @@ public: void loadList(std::vector &list); void handleLink(const std::string& link, - gcn::MouseEvent *event) override final; + MouseEvent *event) override final; void logic() override final; diff --git a/src/listeners/mouselistener.h b/src/listeners/mouselistener.h index e95d2ca01..d294e4dd6 100644 --- a/src/listeners/mouselistener.h +++ b/src/listeners/mouselistener.h @@ -64,7 +64,7 @@ #ifndef GCN_MOUSELISTENER_HPP #define GCN_MOUSELISTENER_HPP -#include "gui/base/mouseevent.hpp" +#include "events/mouseevent.h" #include "localconsts.h" @@ -89,7 +89,7 @@ class MouseListener * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseEntered(gcn::MouseEvent &mouseEvent A_UNUSED) + virtual void mouseEntered(MouseEvent &mouseEvent A_UNUSED) { } @@ -99,7 +99,7 @@ class MouseListener * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseExited(gcn::MouseEvent &mouseEvent A_UNUSED) + virtual void mouseExited(MouseEvent &mouseEvent A_UNUSED) { } @@ -112,7 +112,7 @@ class MouseListener * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mousePressed(gcn::MouseEvent &mouseEvent A_UNUSED) + virtual void mousePressed(MouseEvent &mouseEvent A_UNUSED) { } @@ -122,7 +122,7 @@ class MouseListener * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseReleased(gcn::MouseEvent &mouseEvent A_UNUSED) + virtual void mouseReleased(MouseEvent &mouseEvent A_UNUSED) { } @@ -133,7 +133,7 @@ class MouseListener * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseClicked(gcn::MouseEvent &mouseEvent A_UNUSED) + virtual void mouseClicked(MouseEvent &mouseEvent A_UNUSED) { } @@ -143,7 +143,7 @@ class MouseListener * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseWheelMovedUp(gcn::MouseEvent &mouseEvent A_UNUSED) + virtual void mouseWheelMovedUp(MouseEvent &mouseEvent A_UNUSED) { } @@ -153,7 +153,7 @@ class MouseListener * @param mousEvent Describes the event. * @since 0.6.0 */ - virtual void mouseWheelMovedDown(gcn::MouseEvent &mouseEvent A_UNUSED) + virtual void mouseWheelMovedDown(MouseEvent &mouseEvent A_UNUSED) { } @@ -164,7 +164,7 @@ class MouseListener * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseMoved(gcn::MouseEvent &mouseEvent A_UNUSED) + virtual void mouseMoved(MouseEvent &mouseEvent A_UNUSED) { } @@ -175,7 +175,7 @@ class MouseListener * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseDragged(gcn::MouseEvent &mouseEvent A_UNUSED) + virtual void mouseDragged(MouseEvent &mouseEvent A_UNUSED) { } -- cgit v1.2.3-70-g09d2 From 6e6c5b2ba399e0ed364ada843c4c759ee54de219 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Feb 2014 22:17:22 +0300 Subject: combine font classes in one. --- src/CMakeLists.txt | 6 +- src/Makefile.am | 8 +- src/being/being.cpp | 8 +- src/being/localplayer.cpp | 2 +- src/commands.cpp | 4 +- src/flooritem.cpp | 4 +- src/gui/base/font.cpp | 87 ----- src/gui/base/font.hpp | 133 ------- src/gui/base/widget.hpp | 2 +- src/gui/base/widgets/button.cpp | 3 +- src/gui/base/widgets/checkbox.cpp | 3 +- src/gui/base/widgets/label.cpp | 2 +- src/gui/base/widgets/listbox.cpp | 4 +- src/gui/base/widgets/radiobutton.cpp | 3 +- src/gui/base/widgets/textbox.cpp | 3 +- src/gui/base/widgets/textfield.cpp | 3 +- src/gui/base/widgets/window.cpp | 3 +- src/gui/gui.cpp | 16 +- src/gui/gui.h | 24 +- src/gui/popups/beingpopup.cpp | 4 +- src/gui/popups/itempopup.cpp | 4 +- src/gui/popups/speechbubble.cpp | 4 +- src/gui/popups/spellpopup.cpp | 2 +- src/gui/popups/statuspopup.cpp | 2 +- src/gui/popups/textpopup.cpp | 2 +- src/gui/sdlfont.cpp | 603 ----------------------------- src/gui/sdlfont.h | 168 -------- src/gui/viewport.cpp | 4 +- src/gui/widgets/avatarlistbox.cpp | 6 +- src/gui/widgets/browserbox.cpp | 9 +- src/gui/widgets/button.cpp | 6 +- src/gui/widgets/checkbox.cpp | 4 +- src/gui/widgets/colorpage.cpp | 6 +- src/gui/widgets/dropdown.cpp | 4 +- src/gui/widgets/dropshortcutcontainer.cpp | 4 +- src/gui/widgets/emoteshortcutcontainer.cpp | 5 +- src/gui/widgets/extendedlistbox.cpp | 5 +- src/gui/widgets/itemcontainer.cpp | 4 +- src/gui/widgets/itemshortcutcontainer.cpp | 5 +- src/gui/widgets/label.cpp | 8 +- src/gui/widgets/listbox.cpp | 6 +- src/gui/widgets/progressbar.cpp | 6 +- src/gui/widgets/radiobutton.cpp | 6 +- src/gui/widgets/setupitem.cpp | 6 +- src/gui/widgets/shoplistbox.cpp | 4 +- src/gui/widgets/sliderlist.cpp | 5 +- src/gui/widgets/spellshortcutcontainer.cpp | 5 +- src/gui/widgets/tabs/setup_colors.cpp | 4 +- src/gui/widgets/tabs/setup_input.cpp | 2 +- src/gui/widgets/tabs/tab.cpp | 2 +- src/gui/widgets/tabs/tab.h | 2 +- src/gui/widgets/textbox.cpp | 6 +- src/gui/widgets/textfield.cpp | 6 +- src/gui/widgets/textpreview.cpp | 9 +- src/gui/widgets/textpreview.h | 4 +- src/gui/widgets/window.cpp | 4 +- src/gui/widgets/window.h | 4 +- src/gui/windows/chatwindow.cpp | 2 +- src/gui/windows/confirmdialog.cpp | 2 +- src/gui/windows/didyouknowwindow.cpp | 2 +- src/gui/windows/equipmentwindow.cpp | 5 +- src/gui/windows/helpwindow.cpp | 2 +- src/gui/windows/inventorywindow.cpp | 4 +- src/gui/windows/npcdialog.cpp | 6 +- src/gui/windows/okdialog.cpp | 2 +- src/gui/windows/questswindow.cpp | 2 +- src/gui/windows/serverdialog.cpp | 10 +- src/gui/windows/skilldialog.cpp | 5 +- src/gui/windows/textdialog.cpp | 4 +- src/gui/windows/tradewindow.cpp | 6 +- src/maplayer.cpp | 4 +- src/particle/particle.cpp | 4 +- src/particle/particle.h | 7 +- src/particle/textparticle.cpp | 4 +- src/particle/textparticle.h | 4 +- src/text.cpp | 8 +- src/text.h | 11 +- src/touchmanager.cpp | 4 +- 78 files changed, 167 insertions(+), 1189 deletions(-) delete mode 100644 src/gui/base/font.cpp delete mode 100644 src/gui/base/font.hpp delete mode 100644 src/gui/sdlfont.cpp delete mode 100644 src/gui/sdlfont.h (limited to 'src/gui/widgets/dropshortcutcontainer.cpp') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 41f99a646..ed80c00cb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -364,8 +364,8 @@ SET(SRCS gui/widgets/tabs/setup_visual.cpp gui/widgets/tabs/setup_visual.h gui/setupactiondata.h - gui/sdlfont.cpp - gui/sdlfont.h + gui/font.cpp + gui/font.h gui/windows/shopwindow.cpp gui/windows/shopwindow.h gui/windows/shortcutwindow.cpp @@ -774,7 +774,6 @@ SET(SRCS events/event.h gui/base/focushandler.hpp listeners/focuslistener.h - gui/base/font.hpp gui/base/gui.hpp gui/base/input.hpp events/inputguievent.h @@ -807,7 +806,6 @@ SET(SRCS gui/base/cliprectangle.cpp gui/base/color.cpp gui/base/focushandler.cpp - gui/base/font.cpp gui/base/gui.cpp gui/base/key.cpp gui/base/keyinput.cpp diff --git a/src/Makefile.am b/src/Makefile.am index c60b782a7..09579cc29 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,14 +28,12 @@ endif dyecmd_CXXFLAGS = dyecmd_SOURCES = gui/base/cliprectangle.cpp \ gui/base/color.cpp \ - gui/base/font.cpp \ gui/base/rectangle.cpp \ gui/base/widget.cpp \ events/actionevent.h \ gui/base/cliprectangle.hpp \ gui/base/color.hpp \ events/event.h \ - gui/base/font.hpp \ gui/base/rectangle.hpp \ gui/base/widget.hpp @@ -161,7 +159,6 @@ manaplus_SOURCES += events/actionevent.h \ events/event.h \ gui/base/focushandler.hpp \ listeners/focuslistener.h \ - gui/base/font.hpp \ render/graphics.h \ gui/base/gui.hpp \ gui/base/input.hpp \ @@ -195,7 +192,6 @@ manaplus_SOURCES += events/actionevent.h \ gui/base/cliprectangle.cpp \ gui/base/color.cpp \ gui/base/focushandler.cpp \ - gui/base/font.cpp \ gui/base/gui.cpp \ gui/base/key.cpp \ gui/base/keyinput.cpp \ @@ -473,8 +469,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ gui/widgets/tabs/setup_visual.cpp \ gui/widgets/tabs/setup_visual.h \ gui/setupactiondata.h \ - gui/sdlfont.cpp \ - gui/sdlfont.h \ + gui/font.cpp \ + gui/font.h \ gui/windows/shopwindow.cpp \ gui/windows/shopwindow.h \ gui/windows/shortcutwindow.cpp \ diff --git a/src/being/being.cpp b/src/being/being.cpp index 8b2ece2b7..1fcccb0cf 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -39,7 +39,7 @@ #include "particle/particle.h" #include "particle/particleinfo.h" -#include "gui/sdlfont.h" +#include "gui/font.h" #include "gui/popups/speechbubble.h" @@ -537,7 +537,7 @@ void Being::takeDamage(Being *const attacker, const int amount, if (!userPalette || !attacker) return; - gcn::Font *font = nullptr; + Font *font = nullptr; // TRANSLATORS: hit or miss message in attacks const std::string damage = amount ? toString(amount) : type == FLEE ? _("dodge") : _("miss"); @@ -2003,7 +2003,7 @@ void Being::showName() displayName.append(", ").append(toString(getDamageTaken())); } - gcn::Font *font = nullptr; + Font *font = nullptr; if (player_node && player_node->getTarget() == this && mType != MONSTER) { @@ -2519,7 +2519,7 @@ void Being::drawSpriteAt(Graphics *const graphics, if (mDrawHotKeys && !mName.empty()) { - gcn::Font *const font = gui->getFont(); + Font *const font = gui->getFont(); if (font) { graphics->setColor(userPalette->getColor(UserPalette::BEING)); diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index ea8218ee4..0e57eabfe 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -42,8 +42,8 @@ #include "input/keyboardconfig.h" +#include "gui/font.h" #include "gui/gui.h" -#include "gui/sdlfont.h" #include "gui/viewport.h" #include "gui/windows/chatwindow.h" diff --git a/src/commands.cpp b/src/commands.cpp index 04cd84166..93e07b0f8 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1024,7 +1024,7 @@ impHandler0(cacheInfo) return; /* - SDLFont *const font = dynamic_cast(chatWindow->getFont()); + Font *const font = chatWindow->getFont(); if (!font) return; @@ -1361,7 +1361,7 @@ impHandler0(uploadLog) impHandler0(testsdlfont) { #if defined USE_OPENGL && defined DEBUG_SDLFONT - SDLFont *font = new SDLFont("fonts/dejavusans.ttf", 18); + Font *font = new Font("fonts/dejavusans.ttf", 18); timespec time1; timespec time2; NullOpenGLGraphics *nullGraphics = new NullOpenGLGraphics; diff --git a/src/flooritem.cpp b/src/flooritem.cpp index bf8b54f0b..2592e6feb 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -26,8 +26,8 @@ #include "render/graphics.h" +#include "gui/font.h" #include "gui/gui.h" -#include "gui/sdlfont.h" #include "gui/userpalette.h" #include "resources/iteminfo.h" @@ -109,7 +109,7 @@ void FloorItem::draw(Graphics *const graphics, BLOCK_START("FloorItem::draw") const int x = mX * mMap->getTileWidth() + offsetX; const int y = mY * mMap->getTileHeight() + offsetY; - gcn::Font *font = nullptr; + Font *font = nullptr; if (mHighlight) { diff --git a/src/gui/base/font.cpp b/src/gui/base/font.cpp deleted file mode 100644 index ccb2f7022..000000000 --- a/src/gui/base/font.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * For comments regarding functions please see the header file. - */ - -#include "gui/base/font.hpp" - -#include - -#include "debug.h" - -namespace gcn -{ - int Font::getStringIndexAt(const std::string& text, const int x) const - { - const size_t sz = text.size(); - for (size_t i = 0; i < sz; ++i) - { - if (getWidth(text.substr(0, i)) > x) - return i; - } - - return static_cast(sz); - } -} // namespace gcn diff --git a/src/gui/base/font.hpp b/src/gui/base/font.hpp deleted file mode 100644 index 075af4136..000000000 --- a/src/gui/base/font.hpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GCN_FONT_HPP -#define GCN_FONT_HPP - -#include - -#include "localconsts.h" - -class Graphics; - -namespace gcn -{ - /** - * Interface for a font. - * - * @see ImageFont - */ - class Font - { - public: - /** - * Destructor. - */ - virtual ~Font() - { } - - /** - * Gets the width of a string. The width of a string is not necesserily - * the sum of all the widths of it's glyphs. - * - * @param text The string to return the width of. - * @return The width of a string. - */ - virtual int getWidth(const std::string& text) const A_WARN_UNUSED = 0; - - /** - * Gets the height of the glyphs in the font. - * - * @return The height of the glyphs int the font. - */ - virtual int getHeight() const A_WARN_UNUSED = 0; - - /** - * Gets a string index in a string providing an x coordinate. - * Used to retrive a string index (for a character in a - * string) at a certain x position. It is especially useful - * when a mouse clicks in a TextField and you want to know which - * character was clicked. - * - * @return A string index in a string providing an x coordinate. - */ - virtual int getStringIndexAt(const std::string& text, - const int x) const A_WARN_UNUSED; - - /** - * Draws a string. - * - * NOTE: You normally won't use this function to draw text since - * Graphics contains better functions for drawing text. - * - * @param graphics A Graphics object to use for drawing. - * @param text The string to draw. - * @param x The x coordinate where to draw the string. - * @param y The y coordinate where to draw the string. - */ - virtual void drawString(Graphics* graphics, const std::string& text, - int x, int y) = 0; - }; -} // namespace gcn - -#endif // end GCN_FONT_HPP diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp index ce32b14f3..a459ab4f2 100644 --- a/src/gui/base/widget.hpp +++ b/src/gui/base/widget.hpp @@ -76,6 +76,7 @@ class ActionListener; class DeathListener; class FocusListener; +class Font; class Graphics; class KeyListener; class MouseListener; @@ -85,7 +86,6 @@ namespace gcn { class BasicContainer; class FocusHandler; - class Font; class KeyInput; class MouseInput; diff --git a/src/gui/base/widgets/button.cpp b/src/gui/base/widgets/button.cpp index 1276b82b2..9b7473293 100644 --- a/src/gui/base/widgets/button.cpp +++ b/src/gui/base/widgets/button.cpp @@ -67,7 +67,8 @@ #include "gui/base/widgets/button.hpp" -#include "gui/base/font.hpp" +#include "gui/font.h" + #include "gui/base/key.hpp" #include "gui/base/mouseinput.hpp" diff --git a/src/gui/base/widgets/checkbox.cpp b/src/gui/base/widgets/checkbox.cpp index 5f2477b4d..0a3171fe8 100644 --- a/src/gui/base/widgets/checkbox.cpp +++ b/src/gui/base/widgets/checkbox.cpp @@ -67,7 +67,8 @@ #include "gui/base/widgets/checkbox.hpp" -#include "gui/base/font.hpp" +#include "gui/font.h" + #include "gui/base/key.hpp" #include "gui/base/mouseinput.hpp" diff --git a/src/gui/base/widgets/label.cpp b/src/gui/base/widgets/label.cpp index c23666eac..cbee2ac4c 100644 --- a/src/gui/base/widgets/label.cpp +++ b/src/gui/base/widgets/label.cpp @@ -67,7 +67,7 @@ #include "gui/base/widgets/label.hpp" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "render/graphics.h" diff --git a/src/gui/base/widgets/listbox.cpp b/src/gui/base/widgets/listbox.cpp index 7f46b4b10..6c6472636 100644 --- a/src/gui/base/widgets/listbox.cpp +++ b/src/gui/base/widgets/listbox.cpp @@ -67,11 +67,13 @@ #include "gui/base/widgets/listbox.hpp" +#include "gui/font.h" + #include "gui/base/basiccontainer.hpp" -#include "gui/base/font.hpp" #include "gui/base/key.hpp" #include "gui/base/listmodel.hpp" #include "gui/base/mouseinput.hpp" + #include "listeners/selectionlistener.h" #include "render/graphics.h" diff --git a/src/gui/base/widgets/radiobutton.cpp b/src/gui/base/widgets/radiobutton.cpp index e42773de1..f0430c7a2 100644 --- a/src/gui/base/widgets/radiobutton.cpp +++ b/src/gui/base/widgets/radiobutton.cpp @@ -67,7 +67,8 @@ #include "gui/base/widgets/radiobutton.hpp" -#include "gui/base/font.hpp" +#include "gui/font.h" + #include "gui/base/key.hpp" #include "gui/base/mouseinput.hpp" diff --git a/src/gui/base/widgets/textbox.cpp b/src/gui/base/widgets/textbox.cpp index 06d0e6379..e994804d8 100644 --- a/src/gui/base/widgets/textbox.cpp +++ b/src/gui/base/widgets/textbox.cpp @@ -67,8 +67,9 @@ #include "gui/base/widgets/textbox.hpp" +#include "gui/font.h" + #include "gui/base/basiccontainer.hpp" -#include "gui/base/font.hpp" #include "gui/base/key.hpp" #include "gui/base/mouseinput.hpp" diff --git a/src/gui/base/widgets/textfield.cpp b/src/gui/base/widgets/textfield.cpp index df1b844d4..1514d3afb 100644 --- a/src/gui/base/widgets/textfield.cpp +++ b/src/gui/base/widgets/textfield.cpp @@ -67,7 +67,8 @@ #include "gui/base/widgets/textfield.hpp" -#include "gui/base/font.hpp" +#include "gui/font.h" + #include "gui/base/key.hpp" #include "gui/base/mouseinput.hpp" diff --git a/src/gui/base/widgets/window.cpp b/src/gui/base/widgets/window.cpp index 9207fe449..fbd42aff2 100644 --- a/src/gui/base/widgets/window.cpp +++ b/src/gui/base/widgets/window.cpp @@ -67,7 +67,8 @@ #include "gui/base/widgets/window.hpp" -#include "gui/base/font.hpp" +#include "gui/font.h" + #include "gui/base/mouseinput.hpp" #include "render/graphics.h" diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 08794d478..f549727a4 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -25,8 +25,8 @@ #include "gui/gui.h" #include "gui/focushandler.h" +#include "gui/font.h" #include "gui/palette.h" -#include "gui/sdlfont.h" #include "gui/sdlinput.h" #include "gui/theme.h" #include "gui/viewport.h" @@ -60,7 +60,7 @@ Gui *gui = nullptr; SDLInput *guiInput = nullptr; // Bolded font -SDLFont *boldFont = nullptr; +Font *boldFont = nullptr; class GuiConfigListener final : public ConfigListener { @@ -160,7 +160,7 @@ void Gui::postInit(Graphics *const graphics) if (fontFile.empty()) fontFile = branding.getStringValue("font"); - mGuiFont = new SDLFont(fontFile, fontSize); + mGuiFont = new Font(fontFile, fontSize); // Set particle font fontFile = config.getValue("particleFont", ""); @@ -179,28 +179,28 @@ void Gui::postInit(Graphics *const graphics) if (fontFile.empty()) fontFile = branding.getStringValue("particleFont"); - mInfoParticleFont = new SDLFont(fontFile, fontSize, TTF_STYLE_BOLD); + mInfoParticleFont = new Font(fontFile, fontSize, TTF_STYLE_BOLD); // Set bold font fontFile = config.getValue("boldFont", ""); if (fontFile.empty()) fontFile = branding.getStringValue("boldFont"); - boldFont = new SDLFont(fontFile, fontSize); + boldFont = new Font(fontFile, fontSize); // Set help font fontFile = config.getValue("helpFont", ""); if (fontFile.empty()) fontFile = branding.getStringValue("helpFont"); - mHelpFont = new SDLFont(fontFile, fontSize); + mHelpFont = new Font(fontFile, fontSize); // Set secure font fontFile = config.getValue("secureFont", ""); if (fontFile.empty()) fontFile = branding.getStringValue("secureFont"); - mSecureFont = new SDLFont(fontFile, fontSize); + mSecureFont = new Font(fontFile, fontSize); // Set npc font const int npcFontSize = config.getIntValue("npcfontSize"); @@ -220,7 +220,7 @@ void Gui::postInit(Graphics *const graphics) if (fontFile.empty()) fontFile = branding.getStringValue("npcFont"); - mNpcFont = new SDLFont(fontFile, npcFontSize); + mNpcFont = new Font(fontFile, npcFontSize); gcn::Widget::setGlobalFont(mGuiFont); diff --git a/src/gui/gui.h b/src/gui/gui.h index 1ec73e42f..1660fcfbf 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -35,7 +35,7 @@ class GuiConfigListener; class ImageSet; class MouseEvent; class MouseInput; -class SDLFont; +class Font; class SDLInput; class Window; @@ -96,32 +96,32 @@ class Gui final : public gcn::Gui /** * Return game font. */ - SDLFont *getFont() const A_WARN_UNUSED + Font *getFont() const A_WARN_UNUSED { return mGuiFont; } /** * Return help font. */ - SDLFont *getHelpFont() const A_WARN_UNUSED + Font *getHelpFont() const A_WARN_UNUSED { return mHelpFont; } /** * Return secure font. */ - SDLFont *getSecureFont() const A_WARN_UNUSED + Font *getSecureFont() const A_WARN_UNUSED { return mSecureFont; } /** * Return npc font. */ - SDLFont *getNpcFont() const A_WARN_UNUSED + Font *getNpcFont() const A_WARN_UNUSED { return mNpcFont; } /** * Return the Font used for "Info Particles", i.e. ones showing, what * you picked up, etc. */ - SDLFont *getInfoParticleFont() const A_WARN_UNUSED + Font *getInfoParticleFont() const A_WARN_UNUSED { return mInfoParticleFont; } /** @@ -183,11 +183,11 @@ class Gui final : public gcn::Gui private: GuiConfigListener *mConfigListener; - SDLFont *mGuiFont; /**< The global GUI font */ - SDLFont *mInfoParticleFont; /**< Font for Info Particles */ - SDLFont *mHelpFont; /**< Font for Help Window */ - SDLFont *mSecureFont; /**< Font for secure labels */ - SDLFont *mNpcFont; /**< Font for npc text */ + Font *mGuiFont; /**< The global GUI font */ + Font *mInfoParticleFont; /**< Font for Info Particles */ + Font *mHelpFont; /**< Font for Help Window */ + Font *mSecureFont; /**< Font for secure labels */ + Font *mNpcFont; /**< Font for npc text */ ImageSet *mMouseCursors; /**< Mouse cursor images */ float mMouseCursorAlpha; int mMouseInactivityTimer; @@ -212,6 +212,6 @@ extern SDLInput *guiInput; /**< GUI input */ /** * Bolded text font */ -extern SDLFont *boldFont; +extern Font *boldFont; #endif // GUI_GUI_H diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp index 623b19d00..32aa11454 100644 --- a/src/gui/popups/beingpopup.cpp +++ b/src/gui/popups/beingpopup.cpp @@ -24,15 +24,13 @@ #include "being/being.h" #include "being/playerrelations.h" -#include "gui/sdlfont.h" +#include "gui/font.h" #include "gui/widgets/label.h" #include "utils/gettext.h" #include "utils/stringutils.h" -#include "gui/base/font.hpp" - #include "debug.h" BeingPopup::BeingPopup() : diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp index f7939b666..d6ea5a48a 100644 --- a/src/gui/popups/itempopup.cpp +++ b/src/gui/popups/itempopup.cpp @@ -27,7 +27,7 @@ #include "item.h" #include "units.h" -#include "gui/sdlfont.h" +#include "gui/font.h" #include "gui/widgets/icon.h" #include "gui/widgets/label.h" @@ -38,8 +38,6 @@ #include "resources/image.h" #include "resources/resourcemanager.h" -#include "gui/base/font.hpp" - #include "debug.h" extern int serverVersion; diff --git a/src/gui/popups/speechbubble.cpp b/src/gui/popups/speechbubble.cpp index dd8f9ada9..c74f3f5e6 100644 --- a/src/gui/popups/speechbubble.cpp +++ b/src/gui/popups/speechbubble.cpp @@ -23,15 +23,13 @@ #include "gui/popups/speechbubble.h" -#include "gui/sdlfont.h" +#include "gui/font.h" #include "gui/viewport.h" #include "gui/widgets/browserbox.h" #include "gui/widgets/label.h" #include "gui/widgets/textbox.h" -#include "gui/base/font.hpp" - #include "debug.h" SpeechBubble::SpeechBubble() : diff --git a/src/gui/popups/spellpopup.cpp b/src/gui/popups/spellpopup.cpp index cc55fef57..141879da4 100644 --- a/src/gui/popups/spellpopup.cpp +++ b/src/gui/popups/spellpopup.cpp @@ -23,7 +23,7 @@ #include "gui/popups/spellpopup.h" -#include "gui/sdlfont.h" +#include "gui/font.h" #include "gui/widgets/label.h" diff --git a/src/gui/popups/statuspopup.cpp b/src/gui/popups/statuspopup.cpp index 2332e20a9..7dd3c3634 100644 --- a/src/gui/popups/statuspopup.cpp +++ b/src/gui/popups/statuspopup.cpp @@ -33,7 +33,7 @@ #include "utils/stringutils.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "debug.h" diff --git a/src/gui/popups/textpopup.cpp b/src/gui/popups/textpopup.cpp index 245bf58b0..0ae53ac1f 100644 --- a/src/gui/popups/textpopup.cpp +++ b/src/gui/popups/textpopup.cpp @@ -25,7 +25,7 @@ #include "gui/widgets/label.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "debug.h" diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp deleted file mode 100644 index 95a3df390..000000000 --- a/src/gui/sdlfont.cpp +++ /dev/null @@ -1,603 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2009 Aethyra Development Team - * Copyright (C) 2011-2014 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "gui/sdlfont.h" - -#include "logger.h" -#include "main.h" - -#include "render/sdlgraphics.h" - -#include "resources/image.h" -#include "resources/imagehelper.h" -#include "resources/resourcemanager.h" -#include "resources/surfaceimagehelper.h" - -#include "utils/paths.h" -#include "utils/physfsrwops.h" -#include "utils/sdlcheckutils.h" -#include "utils/stringutils.h" -#include "utils/timer.h" - -#include "debug.h" - -const unsigned int CACHE_SIZE = 256; -const unsigned int CACHE_SIZE_SMALL1 = 2; -const unsigned int CACHE_SIZE_SMALL2 = 50; -const unsigned int CACHE_SIZE_SMALL3 = 170; -const unsigned int CLEAN_TIME = 7; -const int OUTLINE_SIZE = 1; - -bool SDLFont::mSoftMode(false); - -char *strBuf = nullptr; - -#ifdef UNITTESTS -int sdlTextChunkCnt = 0; -#endif - -SDLTextChunkSmall::SDLTextChunkSmall(const std::string &text0, - const gcn::Color &color0, - const gcn::Color &color1) : - text(text0), - color(color0), - color2(color1) -{ -} - -SDLTextChunkSmall::SDLTextChunkSmall(const SDLTextChunkSmall &old) : - text(old.text), - color(old.color), - color2(old.color2) -{ -} - -bool SDLTextChunkSmall::operator==(const SDLTextChunkSmall &chunk) const -{ - return (chunk.text == text && chunk.color == color - && chunk.color2 == color2); -} - -bool SDLTextChunkSmall::operator<(const SDLTextChunkSmall &chunk) const -{ - if (chunk.text != text) - return chunk.text > text; - - const gcn::Color &c = chunk.color; - if (c.r != color.r) - return c.r > color.r; - if (c.g != color.g) - return c.g > color.g; - if (c.b != color.b) - return c.b > color.b; - - const gcn::Color &c2 = chunk.color2; - if (c2.r != color2.r) - return c2.r > color2.r; - if (c2.g != color2.g) - return c2.g > color2.g; - if (c2.b != color2.b) - return c2.b > color2.b; - - if (c.a != color.a && SDLFont::mSoftMode) - return c.a > color.a; - - return false; -} - -SDLTextChunk::SDLTextChunk(const std::string &text0, const gcn::Color &color0, - const gcn::Color &color1) : - img(nullptr), - text(text0), - color(color0), - color2(color1), - prev(nullptr), - next(nullptr) -{ -#ifdef UNITTESTS - sdlTextChunkCnt ++; -#endif -} - -SDLTextChunk::~SDLTextChunk() -{ - delete img; - img = nullptr; -#ifdef UNITTESTS - sdlTextChunkCnt --; -#endif -} - -bool SDLTextChunk::operator==(const SDLTextChunk &chunk) const -{ - return (chunk.text == text && chunk.color == color - && chunk.color2 == color2); -} - -void SDLTextChunk::generate(TTF_Font *const font, const float alpha) -{ - BLOCK_START("SDLTextChunk::generate") - SDL_Color sdlCol; - sdlCol.b = static_cast(color.b); - sdlCol.r = static_cast(color.r); - sdlCol.g = static_cast(color.g); -#ifdef USE_SDL2 - sdlCol.a = 255; -#else - sdlCol.unused = 0; -#endif - - getSafeUtf8String(text, strBuf); - - SDL_Surface *surface = MTTF_RenderUTF8_Blended( - font, strBuf, sdlCol); - - if (!surface) - { - img = nullptr; - BLOCK_END("SDLTextChunk::generate") - return; - } - - const int width = surface->w; - const int height = surface->h; - - if (color.r != color2.r || color.g != color2.g - || color.b != color2.b) - { // outlining - SDL_Color sdlCol2; - SDL_Surface *const background = imageHelper->create32BitSurface( - width, height); - if (!background) - { - img = nullptr; - MSDL_FreeSurface(surface); - BLOCK_END("SDLTextChunk::generate") - return; - } - sdlCol2.b = static_cast(color2.b); - sdlCol2.r = static_cast(color2.r); - sdlCol2.g = static_cast(color2.g); -#ifdef USE_SDL2 - sdlCol2.a = 255; -#else - sdlCol2.unused = 0; -#endif - SDL_Surface *const surface2 = MTTF_RenderUTF8_Blended( - font, strBuf, sdlCol2); - if (!surface2) - { - img = nullptr; - MSDL_FreeSurface(surface); - BLOCK_END("SDLTextChunk::generate") - return; - } - SDL_Rect rect = - { - OUTLINE_SIZE, - 0, - static_cast(surface->w), - static_cast(surface->h) - }; - SurfaceImageHelper::combineSurface(surface2, nullptr, - background, &rect); - rect.x = -OUTLINE_SIZE; - SurfaceImageHelper::combineSurface(surface2, nullptr, - background, &rect); - rect.x = 0; - rect.y = -OUTLINE_SIZE; - SurfaceImageHelper::combineSurface(surface2, nullptr, - background, &rect); - rect.y = OUTLINE_SIZE; - SurfaceImageHelper::combineSurface(surface2, nullptr, - background, &rect); - rect.x = 0; - rect.y = 0; - SurfaceImageHelper::combineSurface(surface, nullptr, - background, &rect); - MSDL_FreeSurface(surface); - MSDL_FreeSurface(surface2); - surface = background; - } - img = imageHelper->createTextSurface( - surface, width, height, alpha); - MSDL_FreeSurface(surface); - - BLOCK_END("SDLTextChunk::generate") -} - - -TextChunkList::TextChunkList() : - start(nullptr), - end(nullptr), - size(0), - search(), - searchWidth() -{ -} - -void TextChunkList::insertFirst(SDLTextChunk *const item) -{ - SDLTextChunk *const oldFirst = start; - if (start) - start->prev = item; - item->prev = nullptr; - if (oldFirst) - item->next = oldFirst; - else - end = item; - start = item; - size ++; - search[SDLTextChunkSmall(item->text, item->color, item->color2)] = item; - searchWidth[item->text] = item; -} - -void TextChunkList::moveToFirst(SDLTextChunk *item) -{ - if (item == start) - return; - - SDLTextChunk *oldPrev = item->prev; - if (oldPrev) - oldPrev->next = item->next; - SDLTextChunk *oldNext = item->next; - if (oldNext) - oldNext->prev = item->prev; - else - end = oldPrev; - SDLTextChunk *const oldFirst = start; - if (start) - start->prev = item; - item->prev = nullptr; - item->next = oldFirst; - start = item; -} - -void TextChunkList::removeBack() -{ - SDLTextChunk *oldEnd = end; - if (oldEnd) - { - end = oldEnd->prev; - if (end) - end->next = nullptr; - else - start = nullptr; - search.erase(SDLTextChunkSmall(oldEnd->text, - oldEnd->color, oldEnd->color2)); - searchWidth.erase(oldEnd->text); - delete oldEnd; - size --; - } -} - -void TextChunkList::removeBack(int n) -{ - SDLTextChunk *item = end; - while (n && item) - { - n --; - SDLTextChunk *oldEnd = item; - item = item->prev; - search.erase(SDLTextChunkSmall(oldEnd->text, - oldEnd->color, oldEnd->color2)); - searchWidth.erase(oldEnd->text); - delete oldEnd; - size --; - } - if (item) - { - item->next = nullptr; - end = item; - } - else - { - start = nullptr; - end = nullptr; - } -} - -void TextChunkList::clear() -{ - search.clear(); - searchWidth.clear(); - SDLTextChunk *item = start; - while (item) - { - SDLTextChunk *item2 = item->next; - delete item; - item = item2; - } - start = nullptr; - end = nullptr; - size = 0; -} - -static int fontCounter; - -SDLFont::SDLFont(std::string filename, - const int size, - const int style) : - mFont(nullptr), - mCreateCounter(0), - mDeleteCounter(0), - mCleanTime(cur_time + CLEAN_TIME) -{ - if (fontCounter == 0) - { - mSoftMode = imageHelper->useOpenGL() == RENDER_SOFTWARE; - if (TTF_Init() == -1) - { - logger->error("Unable to initialize SDL_ttf: " + - std::string(TTF_GetError())); - } - } - - if (!fontCounter) - { - strBuf = new char[65535]; - memset(strBuf, 0, 65535); - } - - ++fontCounter; - - fixDirSeparators(filename); - mFont = openFont(filename.c_str(), size); - - if (!mFont) - { - logger->log("Error finding font " + filename); - std::string backFile("fonts/dejavusans.ttf"); - mFont = openFont(fixDirSeparators(backFile).c_str(), size); - if (!mFont) - { - logger->error("SDLSDLFont::SDLSDLFont: " + - std::string(TTF_GetError())); - } - } - - TTF_SetFontStyle(mFont, style); -} - -SDLFont::~SDLFont() -{ - TTF_CloseFont(mFont); - mFont = nullptr; - --fontCounter; - clear(); - - if (fontCounter == 0) - { - TTF_Quit(); - delete []strBuf; - } -} - -TTF_Font *SDLFont::openFont(const char *const name, const int size) -{ -// disabled for now because some systems like gentoo cant use it -// #ifdef USE_SDL2 -// SDL_RWops *const rw = MPHYSFSRWOPS_openRead(name); -// if (!rw) -// return nullptr; -// return TTF_OpenFontIndexRW(rw, 1, size, 0); -// #else - return TTF_OpenFontIndex(ResourceManager::getPath(name).c_str(), - size, 0); -// #endif -} - -void SDLFont::loadFont(std::string filename, - const int size, - const int style) -{ - if (fontCounter == 0 && TTF_Init() == -1) - { - logger->log("Unable to initialize SDL_ttf: " + - std::string(TTF_GetError())); - return; - } - - fixDirSeparators(filename); - TTF_Font *const font = openFont(filename.c_str(), size); - - if (!font) - { - logger->log("SDLSDLFont::SDLSDLFont: " + - std::string(TTF_GetError())); - return; - } - - if (mFont) - TTF_CloseFont(mFont); - - mFont = font; - TTF_SetFontStyle(mFont, style); - clear(); -} - -void SDLFont::clear() -{ - for (size_t f = 0; f < CACHES_NUMBER; f ++) - mCache[f].clear(); -} - -void SDLFont::drawString(Graphics *const graphics, - const std::string &text, - const int x, const int y) -{ - BLOCK_START("SDLFont::drawString") - if (text.empty()) - { - BLOCK_END("SDLFont::drawString") - return; - } - - Graphics *const g = dynamic_cast(graphics); - if (!g) - return; - - gcn::Color col = g->getColor(); - const gcn::Color &col2 = g->getColor2(); - const float alpha = static_cast(col.a) / 255.0F; - - /* The alpha value is ignored at string generation so avoid caching the - * same text with different alpha values. - */ - col.a = 255; - - const unsigned char chr = text[0]; - TextChunkList *const cache = &mCache[chr]; - - std::map &search = cache->search; - std::map::iterator i - = search.find(SDLTextChunkSmall(text, col, col2)); - if (i != search.end()) - { - SDLTextChunk *const chunk2 = (*i).second; - cache->moveToFirst(chunk2); - Image *const image = chunk2->img; - if (image) - { - image->setAlpha(alpha); - g->drawImage2(image, x, y); - } - } - else - { - if (cache->size >= CACHE_SIZE) - { -#ifdef DEBUG_FONT_COUNTERS - mDeleteCounter ++; -#endif - cache->removeBack(); - } -#ifdef DEBUG_FONT_COUNTERS - mCreateCounter ++; -#endif - SDLTextChunk *chunk2 = new SDLTextChunk(text, col, col2); - - chunk2->generate(mFont, alpha); - cache->insertFirst(chunk2); - - const Image *const image = chunk2->img; - if (image) - g->drawImage2(image, x, y); - } - BLOCK_END("SDLFont::drawString") -} - -void SDLFont::slowLogic(const int rnd) -{ - BLOCK_START("SDLFont::slowLogic") - if (!mCleanTime) - { - mCleanTime = cur_time + CLEAN_TIME + rnd; - } - else if (mCleanTime < cur_time) - { - doClean(); - mCleanTime = cur_time + CLEAN_TIME + rnd; - } - BLOCK_END("SDLFont::slowLogic") -} - -int SDLFont::getWidth(const std::string &text) const -{ - if (text.empty()) - return 0; - - const unsigned char chr = text[0]; - TextChunkList *const cache = &mCache[chr]; - - std::map &search = cache->searchWidth; - std::map::iterator i = search.find(text); - if (i != search.end()) - { - SDLTextChunk *const chunk = (*i).second; - cache->moveToFirst(chunk); - const Image *const image = chunk->img; - if (image) - return image->getWidth(); - else - return 0; - } - - // if string was not drawed - int w, h; - getSafeUtf8String(text, strBuf); - TTF_SizeUTF8(mFont, strBuf, &w, &h); - return w; -} - -int SDLFont::getHeight() const -{ - return TTF_FontHeight(mFont); -} - -void SDLFont::doClean() -{ - for (unsigned int f = 0; f < CACHES_NUMBER; f ++) - { - TextChunkList *const cache = &mCache[f]; - const size_t size = cache->size; -#ifdef DEBUG_FONT_COUNTERS - logger->log("ptr: %d, size: %d", f, size); -#endif - if (size > CACHE_SIZE_SMALL3) - { -#ifdef DEBUG_FONT_COUNTERS - mDeleteCounter += 100; -#endif - cache->removeBack(100); -#ifdef DEBUG_FONT_COUNTERS - logger->log("delete3"); -#endif - } - else if (size > CACHE_SIZE_SMALL2) - { -#ifdef DEBUG_FONT_COUNTERS - mDeleteCounter += 20; -#endif - cache->removeBack(20); -#ifdef DEBUG_FONT_COUNTERS - logger->log("delete2"); -#endif - } - else if (size > CACHE_SIZE_SMALL1) - { -#ifdef DEBUG_FONT_COUNTERS - mDeleteCounter ++; -#endif - cache->removeBack(); -#ifdef DEBUG_FONT_COUNTERS - logger->log("delete1"); -#endif - } - } -} - -const TextChunkList *SDLFont::getCache() const -{ - return mCache; -} diff --git a/src/gui/sdlfont.h b/src/gui/sdlfont.h deleted file mode 100644 index 1cb6f5c99..000000000 --- a/src/gui/sdlfont.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2014 The ManaPlus Developers - * Copyright (C) 2009 Aethyra Development Team - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef GUI_SDLFONT_H -#define GUI_SDLFONT_H - -#include "gui/base/color.hpp" -#include "gui/base/font.hpp" - -#include - -#include -#include - -#include "localconsts.h" - -class Image; - -const unsigned int CACHES_NUMBER = 256; - -class SDLTextChunkSmall -{ - public: - SDLTextChunkSmall(const std::string &text0, const gcn::Color &color0, - const gcn::Color &color1); - - SDLTextChunkSmall(const SDLTextChunkSmall &old); - - bool operator==(const SDLTextChunkSmall &chunk) const; - bool operator<(const SDLTextChunkSmall &chunk) const; - - std::string text; - gcn::Color color; - gcn::Color color2; -}; - -class SDLTextChunk final -{ - public: - SDLTextChunk(const std::string &text0, const gcn::Color &color0, - const gcn::Color &color1); - - A_DELETE_COPY(SDLTextChunk) - - ~SDLTextChunk(); - - bool operator==(const SDLTextChunk &chunk) const; - - void generate(TTF_Font *const font, const float alpha); - - Image *img; - std::string text; - gcn::Color color; - gcn::Color color2; - SDLTextChunk *prev; - SDLTextChunk *next; -}; - - -class TextChunkList final -{ - public: - TextChunkList(); - - A_DELETE_COPY(TextChunkList) - - void insertFirst(SDLTextChunk *const item); - - void moveToFirst(SDLTextChunk *item); - - void removeBack(); - - void removeBack(int n); - - void clear(); - - SDLTextChunk *start; - SDLTextChunk *end; - uint32_t size; - std::map search; - std::map searchWidth; -}; - -/** - * A wrapper around SDL_ttf for allowing the use of TrueType fonts. - * - * NOTE: This class initializes SDL_ttf as necessary. - */ -class SDLFont final : public gcn::Font -{ - public: - SDLFont(std::string filename, - const int size, - const int style = 0); - - A_DELETE_COPY(SDLFont) - - ~SDLFont(); - - void loadFont(std::string filename, - const int size, - const int style = 0); - - int getWidth(const std::string &text) const override - final A_WARN_UNUSED; - - int getHeight() const override final A_WARN_UNUSED; - - const TextChunkList *getCache() const A_WARN_UNUSED; - - /** - * @see Font::drawString - */ - void drawString(Graphics *const graphics, - const std::string &text, - const int x, const int y) override final; - - void clear(); - - void doClean(); - - void slowLogic(const int rnd); - - int getCreateCounter() const A_WARN_UNUSED - { return mCreateCounter; } - - int getDeleteCounter() const A_WARN_UNUSED - { return mDeleteCounter; } - - static bool mSoftMode; - - private: - static TTF_Font *openFont(const char *const name, const int size); - - TTF_Font *mFont; - unsigned mCreateCounter; - unsigned mDeleteCounter; - - // Word surfaces cache - int mCleanTime; - mutable TextChunkList mCache[CACHES_NUMBER]; -}; - -#ifdef UNITTESTS -extern int sdlTextChunkCnt; -#endif - -#endif // GUI_SDLFONT_H diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index c3da988b7..ee64736eb 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -42,7 +42,7 @@ #include "gui/windows/ministatuswindow.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "debug.h" @@ -341,7 +341,7 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path, const gcn::Color &color) const { graphics->setColor(color); - gcn::Font *const font = getFont(); + Font *const font = getFont(); #ifdef MANASERV_SUPPORT if (Net::getNetworkType() != ServerInfo::MANASERV) diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 8e4d9e483..298ab657a 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -28,16 +28,14 @@ #include "being/localplayer.h" +#include "gui/font.h" #include "gui/gui.h" -#include "gui/sdlfont.h" #include "gui/viewport.h" #include "gui/windows/chatwindow.h" #include "resources/image.h" -#include "gui/base/font.hpp" - #include "debug.h" int AvatarListBox::instances = 0; @@ -103,7 +101,7 @@ void AvatarListBox::draw(Graphics *graphics) mListModel); updateAlpha(); - gcn::Font *const font = getFont(); + Font *const font = getFont(); const int fontHeight = getFont()->getHeight(); const gcn::Widget *const parent = mParent; const std::string name = player_node->getName(); diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index c158171c0..60b67dc24 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -25,8 +25,8 @@ #include "input/inputmanager.h" +#include "gui/font.h" #include "gui/gui.h" -#include "gui/sdlfont.h" #include "gui/widgets/linkhandler.h" @@ -37,7 +37,6 @@ #include "utils/stringutils.h" #include "utils/timer.h" -#include "gui/base/font.hpp" #include "gui/base/cliprectangle.hpp" #include "render/graphics.h" @@ -175,7 +174,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) std::string tmp = row; std::string newRow; size_t idx1; - const gcn::Font *const font = getFont(); + const Font *const font = getFont(); int linksCount = 0; if (getWidth() < 0) @@ -491,7 +490,7 @@ void BrowserBox::draw(Graphics *graphics) } } - gcn::Font *const font = getFont(); + Font *const font = getFont(); FOR_EACH (LinePartCIter, i, mLineParts) { @@ -530,7 +529,7 @@ int BrowserBox::calcHeight() if (maxWidth < 0) return 1; - const gcn::Font *const font = getFont(); + const Font *const font = getFont(); const int fontHeight = font->getHeight() + 2 * mItemPadding; const int fontWidthMinus = font->getWidth("-"); const char *const hyphen = "~"; diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 8bc3d7540..5d27af68a 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -31,7 +31,7 @@ #include "resources/imageset.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "debug.h" @@ -426,7 +426,7 @@ void Button::draw(Graphics *graphics) const gcn::Rectangle &rect = mDimension; const int width = rect.width; const int height = rect.height; - gcn::Font *const font = getFont(); + Font *const font = getFont(); int textY = height / 2 - font->getHeight() / 2; if (mImages) imageY = height / 2 - mImageHeight / 2; @@ -559,7 +559,7 @@ void Button::widgetMoved(const Event &event A_UNUSED) void Button::adjustSize() { - const gcn::Font *const font = getFont(); + const Font *const font = getFont(); const Skin *const skin = button[BUTTON_STANDARD]; if (!skin) return; diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index 9b67b0359..0772c0d4f 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -30,7 +30,7 @@ #include "resources/image.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "debug.h" @@ -100,7 +100,7 @@ void CheckBox::draw(Graphics *const graphics) BLOCK_START("CheckBox::draw") drawBox(graphics); - gcn::Font *const font = getFont(); + Font *const font = getFont(); graphics->setColorAll(mForegroundColor, mForegroundColor2); font->drawString(graphics, mCaption, mPadding + mImageSize + mSpacing, mPadding); diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp index a9cf4f71e..6803fbe3c 100644 --- a/src/gui/widgets/colorpage.cpp +++ b/src/gui/widgets/colorpage.cpp @@ -22,7 +22,7 @@ #include "gui/widgets/colormodel.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "debug.h" @@ -33,7 +33,7 @@ ColorPage::ColorPage(const Widget2 *const widget, { mItemPadding = mSkin ? mSkin->getOption("itemPadding") : 1; mRowHeight = 13; - const gcn::Font *const font = getFont(); + const Font *const font = getFont(); if (font) mRowHeight = font->getHeight() + 2 * mItemPadding; if (mListModel) @@ -57,7 +57,7 @@ void ColorPage::draw(Graphics *graphics) mHighlightColor.a = static_cast(mAlpha * 255.0F); graphics->setColor(mHighlightColor); updateAlpha(); - gcn::Font *const font = getFont(); + Font *const font = getFont(); const int rowHeight = getRowHeight(); const int width = mDimension.width; diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 225ea11bb..42fa89b30 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -33,7 +33,7 @@ #include "resources/image.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include @@ -235,7 +235,7 @@ void DropDown::draw(Graphics* graphics) gcn::ListModel *const model = mPopup->getListModel(); if (model && mPopup->getSelected() >= 0) { - gcn::Font *const font = getFont(); + Font *const font = getFont(); graphics->setColorAll(mForegroundColor, mForegroundColor2); if (mExtended) { diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 693245c2f..bca1f1e12 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -36,7 +36,7 @@ #include "resources/image.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "debug.h" @@ -116,7 +116,7 @@ void DropShortcutContainer::draw(Graphics *graphics) return; } - gcn::Font *const font = getFont(); + Font *const font = getFont(); for (unsigned i = 0; i < mMaxItems; i++) { diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 38c76060b..f5d1c19f0 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -27,14 +27,13 @@ #include "input/inputmanager.h" +#include "gui/font.h" #include "gui/viewport.h" #include "gui/popups/textpopup.h" #include "resources/image.h" -#include "gui/base/font.hpp" - #include "debug.h" static const int MAX_ITEMS = 48; @@ -112,7 +111,7 @@ void EmoteShortcutContainer::draw(Graphics *graphics) mAlpha = client->getGuiAlpha(); } - gcn::Font *const font = getFont(); + Font *const font = getFont(); drawBackground(graphics); graphics->setColorAll(mForegroundColor, mForegroundColor2); diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index f06e89e55..1fcbabd2b 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -22,7 +22,8 @@ #include "gui/widgets/extendedlistmodel.h" -#include "gui/base/font.hpp" +#include "gui/font.h" + #include "gui/base/listmodel.hpp" #include "render/graphics.h" @@ -58,7 +59,7 @@ void ExtendedListBox::draw(Graphics *graphics) mListModel); updateAlpha(); - gcn::Font *const font = getFont(); + Font *const font = getFont(); const int height = mRowHeight; const int pad2 = 2 + mPadding; diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 4608534b1..b0f887fa2 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -46,7 +46,7 @@ #include "resources/image.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "listeners/selectionlistener.h" #include @@ -251,7 +251,7 @@ void ItemContainer::draw(Graphics *graphics) return; BLOCK_START("ItemContainer::draw") - gcn::Font *const font = getFont(); + Font *const font = getFont(); for (int j = 0; j < mGridRows; j++) { diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 984803a99..2496beaa6 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -33,6 +33,7 @@ #include "input/inputmanager.h" +#include "gui/font.h" #include "gui/viewport.h" #include "gui/popups/itempopup.h" @@ -45,8 +46,6 @@ #include "resources/image.h" -#include "gui/base/font.hpp" - #include "debug.h" ItemShortcutContainer::ItemShortcutContainer(const unsigned number) : @@ -129,7 +128,7 @@ void ItemShortcutContainer::draw(Graphics *graphics) mAlpha = client->getGuiAlpha(); } - gcn::Font *const font = getFont(); + Font *const font = getFont(); drawBackground(graphics); const Inventory *const inv = PlayerInfo::getInventory(); diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index b2b709052..6cc94cc3d 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -21,7 +21,7 @@ #include "gui/widgets/label.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "debug.h" @@ -82,7 +82,7 @@ void Label::draw(Graphics* graphics) int textX; const gcn::Rectangle &rect = mDimension; const int textY = rect.height / 2 - getFont()->getHeight() / 2; - gcn::Font *const font = getFont(); + Font *const font = getFont(); switch (mAlignment) { @@ -108,7 +108,7 @@ void Label::draw(Graphics* graphics) void Label::adjustSize() { - const gcn::Font *const font = getFont(); + const Font *const font = getFont(); const int pad2 = 2 * mPadding; setWidth(font->getWidth(mCaption) + pad2); setHeight(font->getHeight() + pad2); @@ -129,7 +129,7 @@ void Label::setForegroundColorAll(const gcn::Color &color1, void Label::resizeTo(const int maxSize, const int minSize) { - const gcn::Font *const font = getFont(); + const Font *const font = getFont(); const int pad2 = 2 * mPadding; setHeight(font->getHeight() + pad2); diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 52ff775be..537c7283c 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -28,10 +28,10 @@ #include "input/keydata.h" +#include "gui/font.h" #include "gui/gui.h" #include "gui/base/focushandler.hpp" -#include "gui/base/font.hpp" #include "gui/base/listmodel.hpp" #include "render/graphics.h" @@ -70,7 +70,7 @@ ListBox::ListBox(const Widget2 *const widget, mItemPadding = mSkin->getOption("itemPadding"); } - const gcn::Font *const font = getFont(); + const Font *const font = getFont(); if (font) mRowHeight = font->getHeight() + 2 * mItemPadding; else @@ -110,7 +110,7 @@ void ListBox::draw(Graphics *graphics) mHighlightColor.a = static_cast(mAlpha * 255.0F); graphics->setColor(mHighlightColor); - gcn::Font *const font = getFont(); + Font *const font = getFont(); const int rowHeight = getRowHeight(); const int width = mDimension.width; diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index b120e4289..a1f597da8 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -25,10 +25,8 @@ #include "client.h" #include "graphicsvertexes.h" +#include "gui/font.h" #include "gui/gui.h" -#include "gui/sdlfont.h" - -#include "gui/base/font.hpp" #include "debug.h" @@ -271,7 +269,7 @@ void ProgressBar::render(Graphics *graphics) { const gcn::Color oldColor = graphics->getColor(); - gcn::Font *const font = gui->getFont(); + Font *const font = gui->getFont(); const int textX = mDimension.width / 2; const int textY = (mDimension.height - font->getHeight()) / 2; diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index 2fec7a9f6..984d84d76 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -30,7 +30,7 @@ #include "resources/image.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "debug.h" @@ -161,7 +161,7 @@ void RadioButton::draw(Graphics* graphics) BLOCK_START("RadioButton::draw") drawBox(graphics); - gcn::Font *const font = getFont(); + Font *const font = getFont(); graphics->setColorAll(mForegroundColor, mForegroundColor2); font->drawString(graphics, mCaption, mPadding + mImageSize + mSpacing, mPadding); @@ -191,7 +191,7 @@ void RadioButton::keyPressed(KeyEvent& keyEvent) void RadioButton::adjustSize() { - gcn::Font *const font = getFont(); + Font *const font = getFont(); setHeight(font->getHeight() + 2 * mPadding); setWidth(mImagePadding + mImageSize + mSpacing + font->getWidth(mCaption) + mPadding); diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 8b6cca5a7..aeeb8e4bc 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -24,7 +24,7 @@ #include "main.h" #include "soundmanager.h" -#include "gui/sdlfont.h" +#include "gui/font.h" #include "gui/windows/editdialog.h" @@ -41,8 +41,6 @@ #include "utils/gettext.h" #include "utils/mathutils.h" -#include "gui/base/font.hpp" - #include "debug.h" SetupItem::SetupItem(const std::string &restrict text, @@ -918,7 +916,7 @@ int SetupItemSlider2::getMaxWidth() int maxWidth = 0; SetupItemNamesConstIter it = mValues->begin(); const SetupItemNamesConstIter it_end = mValues->end(); - const gcn::Font *const font = gui->getFont(); + const Font *const font = gui->getFont(); while (it != it_end) { diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index f364aaf46..85ff90261 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -27,6 +27,7 @@ #include "being/playerinfo.h" +#include "gui/font.h" #include "gui/viewport.h" #include "gui/popups/itempopup.h" @@ -35,7 +36,6 @@ #include "resources/image.h" -#include "gui/base/font.hpp" #include "gui/base/listmodel.hpp" #include "debug.h" @@ -95,7 +95,7 @@ void ShopListBox::draw(Graphics *graphics) mAlpha = client->getGuiAlpha(); const int alpha = static_cast(mAlpha * 255.0F); - gcn::Font *const font = getFont(); + Font *const font = getFont(); const int sz = mListModel->getNumberOfElements(); const int fontHeigh = getFont()->getHeight(); diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index 988db85dd..93a6934ba 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -20,13 +20,12 @@ #include "gui/widgets/sliderlist.h" +#include "gui/font.h" #include "gui/gui.h" #include "gui/widgets/button.h" #include "gui/widgets/label.h" -#include "gui/base/font.hpp" - #include "debug.h" static const int buttonWidth = 27; @@ -209,7 +208,7 @@ int SliderList::getMaxLabelWidth() const return 1; int maxWidth = 0; - const gcn::Font *const font = getFont(); + const Font *const font = getFont(); const int num = mListModel->getNumberOfElements(); for (int f = 0; f < num; f ++) diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 511360b91..e8d34c9d8 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -27,6 +27,7 @@ #include "itemshortcut.h" #include "spellshortcut.h" +#include "gui/font.h" #include "gui/viewport.h" #include "gui/popups/spellpopup.h" @@ -36,8 +37,6 @@ #include "resources/image.h" -#include "gui/base/font.hpp" - #include "debug.h" SpellShortcutContainer::SpellShortcutContainer(const unsigned number) : @@ -103,7 +102,7 @@ void SpellShortcutContainer::draw(Graphics *graphics) mBackgroundImg->setAlpha(mAlpha); } - gcn::Font *const font = getFont(); + Font *const font = getFont(); const int selectedId = spellShortcut->getSelectedItem(); graphics->setColorAll(mForegroundColor, mForegroundColor2); diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index 1a2bdfeae..d29c56c85 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -21,7 +21,7 @@ #include "gui/widgets/tabs/setup_colors.h" -#include "gui/sdlfont.h" +#include "gui/font.h" #include "gui/userpalette.h" #include "gui/widgets/browserbox.h" @@ -101,7 +101,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : // TRANSLATORS: color type std::string longText = _("Static"); - const gcn::Font *const font = getFont(); + const Font *const font = getFont(); if (getFont()->getWidth(_("Pulse")) > font->getWidth(longText)) { // TRANSLATORS: color type diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index ba02eb5a2..22bea9a75 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -125,7 +125,7 @@ Setup_Input::Setup_Input(const Widget2 *const widget) : mKeyListModel->setSize(mActionDataSize[0]); refreshKeys(); if (gui) - mKeyList->setFont(reinterpret_cast(gui->getHelpFont())); + mKeyList->setFont(gui->getHelpFont()); mKeyList->addActionListener(this); mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index a85b7927b..a097d28e2 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -264,7 +264,7 @@ void Tab::widgetMoved(const Event &event A_UNUSED) mRedraw = true; } -void Tab::setLabelFont(gcn::Font *const font) +void Tab::setLabelFont(Font *const font) { if (!mLabel) return; diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h index d22c6bea5..655fba7ea 100644 --- a/src/gui/widgets/tabs/tab.h +++ b/src/gui/widgets/tabs/tab.h @@ -134,7 +134,7 @@ class Tab : public gcn::BasicContainer, void widgetMoved(const Event &event) override final; - void setLabelFont(gcn::Font *const font); + void setLabelFont(Font *const font); Label *getLabel() const A_WARN_UNUSED { return mLabel; } diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index ecdc0e4d0..5f74fa1f8 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -26,7 +26,7 @@ #include "input/keydata.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include @@ -88,7 +88,7 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension) text.substr(lastNewlinePos, newlinePos - lastNewlinePos); size_t lastSpacePos = 0; xpos = 0; - const gcn::Font *const font = getFont(); + const Font *const font = getFont(); const int spaceWidth = font->getWidth(" "); size_t sz = line.size(); @@ -360,7 +360,7 @@ void TextBox::draw(Graphics* graphics) graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight())); } - gcn::Font *const font = getFont(); + Font *const font = getFont(); if (isFocused() && isEditable()) { drawCaret(graphics, font->getWidth( diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 0d01df51d..4dd2f1c7b 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -28,8 +28,8 @@ #include "events/keyevent.h" +#include "gui/font.h" #include "gui/sdlinput.h" - #include "gui/viewport.h" #include "gui/popups/popupmenu.h" @@ -39,8 +39,6 @@ #include "utils/copynpaste.h" #include "utils/timer.h" -#include "gui/base/font.hpp" - #undef DELETE // Win32 compatibility hack #include "debug.h" @@ -142,7 +140,7 @@ void TextField::draw(Graphics *graphics) BLOCK_START("TextField::draw") updateAlpha(); - gcn::Font *const font = getFont(); + Font *const font = getFont(); if (isFocused()) { drawCaret(graphics, diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 5ef553b3c..2caf2e44c 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -24,8 +24,8 @@ #include "client.h" +#include "gui/font.h" #include "gui/gui.h" -#include "gui/sdlfont.h" #include "debug.h" @@ -100,12 +100,11 @@ void TextPreview::draw(Graphics* graphics) if (mTextBGColor) { - const SDLFont *const font = dynamic_cast(mFont); - if (font) + if (mFont) { - const int x = font->getWidth(mText) + 1 + const int x = mFont->getWidth(mText) + 1 + 2 * ((mOutline || mShadow) ? 1 :0); - const int y = font->getHeight() + 1 + const int y = mFont->getHeight() + 1 + 2 * ((mOutline || mShadow) ? 1 : 0); graphics->setColor(gcn::Color(static_cast(mTextBGColor->r), static_cast(mTextBGColor->g), diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h index f529e470c..cb524a974 100644 --- a/src/gui/widgets/textpreview.h +++ b/src/gui/widgets/textpreview.h @@ -78,7 +78,7 @@ class TextPreview final : public gcn::Widget, * * @param font the font to use. */ - inline void setFont(gcn::Font *const font) + inline void setFont(Font *const font) { mFont = font; } /** @@ -123,7 +123,7 @@ class TextPreview final : public gcn::Widget, void adjustSize(); private: - gcn::Font *mFont; + Font *mFont; std::string mText; const gcn::Color *mTextColor; const gcn::Color *mTextColor2; diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index c250e79a1..e2f24a0f2 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -29,6 +29,7 @@ #include "soundconsts.h" #include "soundmanager.h" +#include "gui/font.h" #include "gui/gui.h" #include "gui/viewport.h" @@ -38,7 +39,6 @@ #include "resources/image.h" #include "gui/base/focushandler.hpp" -#include "gui/base/font.hpp" #include "debug.h" @@ -110,7 +110,7 @@ Window::Window(const std::string &caption, const bool modal, { setPadding(mSkin->getPadding()); if (getOptionBool("titlebarBold")) - mCaptionFont = reinterpret_cast(boldFont); + mCaptionFont = boldFont; mTitlePadding = mSkin->getTitlePadding(); mGripPadding = getOption("resizePadding"); mCaptionOffsetX = getOption("captionoffsetx"); diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index a5b6be83c..c6b2ca2cb 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -412,7 +412,7 @@ class Window : public gcn::Window, bool isResizeAllowed(const MouseEvent &event) const A_WARN_UNUSED; - void setCaptionFont(gcn::Font *font) + void setCaptionFont(Font *font) { mCaptionFont = font; } void enableVisibleSound(bool b) @@ -506,7 +506,7 @@ class Window : public gcn::Window, int mGripPadding; int mResizeHandles; int mOldResizeHandles; - gcn::Font *mCaptionFont; + Font *mCaptionFont; bool mShowTitle; /**< Window has a title bar */ bool mModal; /**< Window is modal */ bool mCloseWindowButton; /**< Window has a close button */ diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index cbff544fc..e49c78803 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -39,7 +39,7 @@ #include "input/inputmanager.h" -#include "gui/sdlfont.h" +#include "gui/font.h" #include "gui/sdlinput.h" #include "gui/viewport.h" diff --git a/src/gui/windows/confirmdialog.cpp b/src/gui/windows/confirmdialog.cpp index 499538388..6eb21622d 100644 --- a/src/gui/windows/confirmdialog.cpp +++ b/src/gui/windows/confirmdialog.cpp @@ -29,7 +29,7 @@ #include "utils/gettext.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "debug.h" diff --git a/src/gui/windows/didyouknowwindow.cpp b/src/gui/windows/didyouknowwindow.cpp index 9b3ba857c..58e6d9c24 100644 --- a/src/gui/windows/didyouknowwindow.cpp +++ b/src/gui/windows/didyouknowwindow.cpp @@ -24,7 +24,7 @@ #include "configuration.h" -#include "gui/sdlfont.h" +#include "gui/font.h" #include "gui/windows/setupwindow.h" diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 5caf30df1..6f2bb3b3d 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -32,6 +32,7 @@ #include "being/localplayer.h" #include "being/playerinfo.h" +#include "gui/font.h" #include "gui/viewport.h" #include "gui/popups/itempopup.h" @@ -46,8 +47,6 @@ #include "utils/dtor.h" #include "utils/gettext.h" -#include "gui/base/font.hpp" - #include "debug.h" static const int BOX_COUNT = 13; @@ -163,7 +162,7 @@ void EquipmentWindow::draw(Graphics *graphics) Window::draw(graphics); int i = 0; - gcn::Font *const font = getFont(); + Font *const font = getFont(); const int fontHeight = font->getHeight(); if (isBatchDrawRenders(openGLMode)) diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index 95bea6e00..0b31a410b 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -24,7 +24,7 @@ #include "configuration.h" -#include "gui/sdlfont.h" +#include "gui/font.h" #include "gui/windows/didyouknowwindow.h" #include "gui/windows/setupwindow.h" diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 3eb10e0e8..c95c2c54e 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -32,6 +32,7 @@ #include "input/inputmanager.h" +#include "gui/font.h" #include "gui/viewport.h" #include "gui/popups/textpopup.h" @@ -43,7 +44,6 @@ #include "gui/windows/shopwindow.h" #include "gui/windows/tradewindow.h" - #include "gui/widgets/button.h" #include "gui/widgets/dropdown.h" #include "gui/widgets/itemcontainer.h" @@ -58,8 +58,6 @@ #include "utils/gettext.h" -#include "gui/base/font.hpp" - #include #include "debug.h" diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index a883406e7..d1823d5cf 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -32,8 +32,8 @@ #include "being/being.h" +#include "gui/font.h" #include "gui/gui.h" -#include "gui/sdlfont.h" #include "gui/viewport.h" #include "gui/windows/inventorywindow.h" @@ -59,8 +59,6 @@ #include "utils/copynpaste.h" #include "utils/gettext.h" -#include "gui/base/font.hpp" - #include "debug.h" // TRANSLATORS: npc dialog button @@ -170,7 +168,7 @@ NpcDialog::NpcDialog(const int npcId) : mTextField->setVisible(true); mIntField->setVisible(true); - const gcn::Font *const fnt = mButton->getFont(); + const Font *const fnt = mButton->getFont(); int width = std::max(fnt->getWidth(CAPTION_WAITING), fnt->getWidth(CAPTION_NEXT)); width = std::max(width, fnt->getWidth(CAPTION_CLOSE)); diff --git a/src/gui/windows/okdialog.cpp b/src/gui/windows/okdialog.cpp index b9f26da20..3d734b7ad 100644 --- a/src/gui/windows/okdialog.cpp +++ b/src/gui/windows/okdialog.cpp @@ -30,7 +30,7 @@ #include "utils/gettext.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "debug.h" diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index 681949145..2e8c5dcc8 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -26,7 +26,7 @@ #include "being/localplayer.h" -#include "gui/sdlfont.h" +#include "gui/font.h" #include "gui/widgets/browserbox.h" #include "gui/widgets/button.h" diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index ce5c3c815..fb2f5258b 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -31,7 +31,7 @@ #include "input/keydata.h" -#include "gui/sdlfont.h" +#include "gui/font.h" #include "gui/windows/editserverdialog.h" #include "gui/windows/logindialog.h" @@ -45,8 +45,6 @@ #include "utils/gettext.h" #include "utils/langs.h" -#include "gui/base/font.hpp" - #include #include "debug.h" @@ -182,8 +180,8 @@ public: height)); } - gcn::Font *const font1 = boldFont; - gcn::Font *const font2 = getFont(); + Font *const font1 = boldFont; + Font *const font2 = getFont(); const int fontHeight = font1->getHeight(); const int pad1 = fontHeight + mPadding; const int pad2 = height / 4 + mPadding; @@ -644,7 +642,7 @@ void ServerDialog::loadServers(const bool addNew) version = strprintf(_("requires v%s"), version.c_str()); } - const gcn::Font *const font = gui->getFont(); + const Font *const font = gui->getFont(); for_each_xml_child_node(subNode, serverNode) { diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 8ec8486e3..413f73226 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -29,6 +29,7 @@ #include "being/localplayer.h" +#include "gui/font.h" #include "gui/viewport.h" #include "gui/popups/textpopup.h" @@ -53,8 +54,6 @@ #include "resources/beingcommon.h" -#include "gui/base/font.hpp" - #include "debug.h" class SkillListBox final : public ListBox @@ -121,7 +120,7 @@ class SkillListBox final : public ListBox // Draw the list elements graphics->setColorAll(mTextColor, mTextColor2); - gcn::Font *const font = getFont(); + Font *const font = getFont(); const int space = font->getHeight() + mSpacing; const int width2 = getWidth() - mPadding; for (int i = 0, y = 1; diff --git a/src/gui/windows/textdialog.cpp b/src/gui/windows/textdialog.cpp index c4ff71eb7..9b7bb3eb1 100644 --- a/src/gui/windows/textdialog.cpp +++ b/src/gui/windows/textdialog.cpp @@ -30,7 +30,7 @@ #include "utils/gettext.h" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "debug.h" @@ -68,7 +68,7 @@ TextDialog::TextDialog(const std::string &restrict title, place(2, 2, mOkButton); place(3, 2, cancelButton); - const gcn::Font *const font = getFont(); + const Font *const font = getFont(); if (font) { int width = font->getWidth(title); diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index 1793fc2fb..d94b78c34 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -31,7 +31,7 @@ #include "being/playerinfo.h" #include "being/playerrelations.h" -#include "gui/sdlfont.h" +#include "gui/font.h" #include "gui/windows/inventorywindow.h" #include "gui/windows/itemamountwindow.h" @@ -51,8 +51,6 @@ #include "utils/gettext.h" -#include "gui/base/font.hpp" - #include "debug.h" // TRANSLATORS: trade window button @@ -102,7 +100,7 @@ TradeWindow::TradeWindow(): if (setupWindow) setupWindow->registerWindowForReset(this); - const gcn::Font *const fnt = mOkButton->getFont(); + const Font *const fnt = mOkButton->getFont(); int width = std::max(fnt->getWidth(CAPTION_PROPOSE), fnt->getWidth(CAPTION_CONFIRMED)); width = std::max(width, fnt->getWidth(CAPTION_ACCEPT)); diff --git a/src/maplayer.cpp b/src/maplayer.cpp index 3da8ba7d9..86a431cdf 100644 --- a/src/maplayer.cpp +++ b/src/maplayer.cpp @@ -35,8 +35,8 @@ #include "resources/resourcemanager.h" +#include "gui/font.h" #include "gui/gui.h" -#include "gui/sdlfont.h" #include "utils/dtor.h" @@ -823,7 +823,7 @@ void MapItem::draw(Graphics *const graphics, const int x, const int y, } if (!mName.empty() && mType != PORTAL && mType != EMPTY) { - gcn::Font *const font = gui->getFont(); + Font *const font = gui->getFont(); if (font) { graphics->setColor(userPalette->getColor(UserPalette::BEING)); diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index a9cc9993f..83ec97521 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -415,7 +415,7 @@ Particle *Particle::addEffect(const std::string &particleEffectFile, Particle *Particle::addTextSplashEffect(const std::string &text, const int x, const int y, const gcn::Color *const color, - gcn::Font *const font, + Font *const font, const bool outline) { Particle *const newParticle = new TextParticle(text, color, font, outline); @@ -439,7 +439,7 @@ Particle *Particle::addTextSplashEffect(const std::string &text, Particle *Particle::addTextRiseFadeOutEffect(const std::string &text, const int x, const int y, const gcn::Color *const color, - gcn::Font *const font, + Font *const font, const bool outline) { Particle *const newParticle = new TextParticle(text, color, font, outline); diff --git a/src/particle/particle.h b/src/particle/particle.h index f75803772..f69770513 100644 --- a/src/particle/particle.h +++ b/src/particle/particle.h @@ -36,9 +36,10 @@ class ParticleEmitter; namespace gcn { class Color; - class Font; } +class Font; + typedef std::list Particles; typedef Particles::iterator ParticleIterator; typedef Particles::const_iterator ParticleConstIterator; @@ -136,7 +137,7 @@ class Particle : public Actor Particle *addTextSplashEffect(const std::string &text, const int x, const int y, const gcn::Color *const color, - gcn::Font *const font, + Font *const font, const bool outline = false); /** @@ -145,7 +146,7 @@ class Particle : public Actor Particle *addTextRiseFadeOutEffect(const std::string &text, const int x, const int y, const gcn::Color *const color, - gcn::Font *const font, + Font *const font, const bool outline = false); /** diff --git a/src/particle/textparticle.cpp b/src/particle/textparticle.cpp index bf72baf25..1ac6ac6c2 100644 --- a/src/particle/textparticle.cpp +++ b/src/particle/textparticle.cpp @@ -27,13 +27,13 @@ #include "gui/theme.h" #include "gui/base/color.hpp" -#include "gui/base/font.hpp" +#include "gui/font.h" #include "debug.h" TextParticle::TextParticle(const std::string &text, const gcn::Color *const color, - gcn::Font *const font, const bool outline) : + Font *const font, const bool outline) : Particle(), mText(text), mTextFont(font), diff --git a/src/particle/textparticle.h b/src/particle/textparticle.h index eb8a160e1..0d598508d 100644 --- a/src/particle/textparticle.h +++ b/src/particle/textparticle.h @@ -33,7 +33,7 @@ class TextParticle final : public Particle */ TextParticle(const std::string &text, const gcn::Color *const color, - gcn::Font *const font, const bool outline = false); + Font *const font, const bool outline = false); A_DELETE_COPY(TextParticle) @@ -53,7 +53,7 @@ class TextParticle final : public Particle private: std::string mText; /**< Text of the particle. */ - gcn::Font *mTextFont; /**< Font used for drawing the text. */ + Font *mTextFont; /**< Font used for drawing the text. */ const gcn::Color *mColor; /**< Color used for drawing the text. */ int mTextWidth; bool mOutline; /**< Make the text better readable */ diff --git a/src/text.cpp b/src/text.cpp index 943d31f67..dfc127598 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -26,14 +26,12 @@ #include "configuration.h" #include "textmanager.h" +#include "gui/font.h" #include "gui/gui.h" -#include "gui/sdlfont.h" #include "gui/theme.h" #include "resources/image.h" -#include "gui/base/font.hpp" - #include "debug.h" int Text::mInstances = 0; @@ -42,7 +40,7 @@ ImageRect Text::mBubble; Text::Text(const std::string &text, const int x, const int y, const Graphics::Alignment alignment, const gcn::Color *const color, const bool isSpeech, - gcn::Font *const font) : + Font *const font) : mFont(font ? font : (gui ? gui->getFont() : nullptr)), mX(x), mY(y), @@ -154,7 +152,7 @@ void Text::draw(Graphics *const graphics, const int xOff, const int yOff) FlashText::FlashText(const std::string &text, const int x, const int y, const Graphics::Alignment alignment, - const gcn::Color *const color, gcn::Font *const font) : + const gcn::Color *const color, Font *const font) : Text(text, x, y, alignment, color, false, font), mTime(0) { diff --git a/src/text.h b/src/text.h index b21ca51a7..cade9db18 100644 --- a/src/text.h +++ b/src/text.h @@ -30,10 +30,7 @@ #include "localconsts.h" -namespace gcn -{ - class Font; -} +class Font; class Text { @@ -46,7 +43,7 @@ class Text Text(const std::string &text, const int x, const int y, const Graphics::Alignment alignment, const gcn::Color *const color, const bool isSpeech = false, - gcn::Font *const font = nullptr); + Font *const font = nullptr); A_DELETE_COPY(Text) @@ -75,7 +72,7 @@ class Text const int xOff, const int yOff); private: - gcn::Font *mFont; /**< The font of the text */ + Font *mFont; /**< The font of the text */ int mX; /**< Actual x-value of left of text written. */ int mY; /**< Actual y-value of top of text written. */ int mWidth; /**< The width of the text. */ @@ -97,7 +94,7 @@ class FlashText final : public Text FlashText(const std::string &text, const int x, const int y, const Graphics::Alignment alignment, const gcn::Color *const color, - gcn::Font *const font = nullptr); + Font *const font = nullptr); A_DELETE_COPY(FlashText) diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp index b7b926383..8c4c8b0db 100644 --- a/src/touchmanager.cpp +++ b/src/touchmanager.cpp @@ -25,8 +25,8 @@ #include "mouseinput.h" #include "touchactions.h" +#include "gui/font.h" #include "gui/gui.h" -#include "gui/sdlfont.h" #include "input/inputmanager.h" @@ -239,7 +239,7 @@ void TouchManager::draw() if (!gui) return; - SDLFont *const font = boldFont; + Font *const font = boldFont; mainGraphics->setColorAll(Theme::getThemeColor(Theme::TEXT), Theme::getThemeColor(Theme::TEXT_OUTLINE)); FOR_EACH (TouchItemVectorCIter, it, mObjects) -- cgit v1.2.3-70-g09d2 From 14a0a04b2bb3928f7429fd748dd40e1843fca571 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 18 Feb 2014 00:45:23 +0300 Subject: Remove default constructor from Widget2. --- src/game.cpp | 11 +++++++---- src/gui/widgets/dropshortcutcontainer.cpp | 4 ++-- src/gui/widgets/dropshortcutcontainer.h | 2 +- src/gui/widgets/emoteshortcutcontainer.cpp | 4 ++-- src/gui/widgets/emoteshortcutcontainer.h | 2 +- src/gui/widgets/itemshortcutcontainer.cpp | 5 +++-- src/gui/widgets/itemshortcutcontainer.h | 3 ++- src/gui/widgets/playerbox.cpp | 10 +++++++--- src/gui/widgets/playerbox.h | 7 +++++-- src/gui/widgets/progressindicator.cpp | 4 ++-- src/gui/widgets/progressindicator.h | 2 +- src/gui/widgets/scrollarea.cpp | 10 ++++++++-- src/gui/widgets/scrollarea.h | 6 ++++-- src/gui/widgets/setupitem.cpp | 8 ++++---- src/gui/widgets/shortcutcontainer.cpp | 4 ++-- src/gui/widgets/shortcutcontainer.h | 2 +- src/gui/widgets/slider.cpp | 11 +++++++---- src/gui/widgets/slider.h | 7 +++++-- src/gui/widgets/spellshortcutcontainer.cpp | 5 +++-- src/gui/widgets/spellshortcutcontainer.h | 3 ++- src/gui/widgets/tabs/setup_colors.cpp | 10 +++++----- src/gui/widgets/tabs/setup_video.cpp | 4 ++-- src/gui/widgets/widget2.h | 6 ------ src/gui/widgets/window.cpp | 2 +- src/gui/windows/buydialog.cpp | 2 +- src/gui/windows/charcreatedialog.cpp | 4 ++-- src/gui/windows/connectiondialog.cpp | 2 +- src/gui/windows/emotewindow.cpp | 4 ++-- src/gui/windows/equipmentwindow.cpp | 3 ++- src/gui/windows/itemamountwindow.cpp | 4 ++-- src/gui/windows/selldialog.cpp | 2 +- 31 files changed, 88 insertions(+), 65 deletions(-) (limited to 'src/gui/widgets/dropshortcutcontainer.cpp') diff --git a/src/game.cpp b/src/game.cpp index 26807b8b6..e0957b57d 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -236,7 +236,7 @@ static void createGuiWindows() for (unsigned f = 0; f < SHORTCUT_TABS; f ++) { itemShortcutWindow->addTab(toString(f + 1), - new ItemShortcutContainer(f)); + new ItemShortcutContainer(nullptr, f)); } if (config.getBoolValue("showDidYouKnow")) { @@ -245,20 +245,23 @@ static void createGuiWindows() } emoteShortcutWindow = new ShortcutWindow("EmoteShortcut", - new EmoteShortcutContainer, "emotes.xml", 130, 480); + new EmoteShortcutContainer(nullptr), + "emotes.xml", + 130, 480); outfitWindow = new OutfitWindow(); #ifdef MANASERV_SUPPORT specialsWindow = new SpecialsWindow(); #endif dropShortcutWindow = new ShortcutWindow("DropShortcut", - new DropShortcutContainer, "drops.xml"); + new DropShortcutContainer(nullptr), + "drops.xml"); spellShortcutWindow = new ShortcutWindow("SpellShortcut", "spells.xml", 265, 328); for (unsigned f = 0; f < SPELL_SHORTCUT_TABS; f ++) { spellShortcutWindow->addTab(toString(f + 1), - new SpellShortcutContainer(f)); + new SpellShortcutContainer(nullptr, f)); } botCheckerWindow = new BotCheckerWindow; diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index bca1f1e12..fcb0f8ea1 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -40,8 +40,8 @@ #include "debug.h" -DropShortcutContainer::DropShortcutContainer(): - ShortcutContainer(), +DropShortcutContainer::DropShortcutContainer(Widget2 *const widget): + ShortcutContainer(widget), mItemClicked(false), mItemPopup(new ItemPopup), mEquipedColor(getThemeColor(Theme::ITEM_EQUIPPED)), diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h index 9880f526d..dbaac1d9c 100644 --- a/src/gui/widgets/dropshortcutcontainer.h +++ b/src/gui/widgets/dropshortcutcontainer.h @@ -38,7 +38,7 @@ class DropShortcutContainer final : public ShortcutContainer /** * Constructor. Initializes the graphic. */ - DropShortcutContainer(); + DropShortcutContainer(Widget2 *const widget); A_DELETE_COPY(DropShortcutContainer) diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index f5d1c19f0..47c45c2dd 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -38,8 +38,8 @@ static const int MAX_ITEMS = 48; -EmoteShortcutContainer::EmoteShortcutContainer(): - ShortcutContainer(), +EmoteShortcutContainer::EmoteShortcutContainer(Widget2 *const widget) : + ShortcutContainer(widget), mEmoteImg(), mEmotePopup(new TextPopup), mEmoteClicked(false), diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index ed6b4c8b3..ec0e98675 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -41,7 +41,7 @@ class EmoteShortcutContainer final : public ShortcutContainer /** * Constructor. Initializes the graphic. */ - EmoteShortcutContainer(); + EmoteShortcutContainer(Widget2 *const widget); A_DELETE_COPY(EmoteShortcutContainer) diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 2496beaa6..83c8820ae 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -48,8 +48,9 @@ #include "debug.h" -ItemShortcutContainer::ItemShortcutContainer(const unsigned number) : - ShortcutContainer(), +ItemShortcutContainer::ItemShortcutContainer(Widget2 *const widget, + const unsigned number) : + ShortcutContainer(widget), mItemClicked(false), mNumber(number), mItemPopup(new ItemPopup), diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h index f01c2779c..dd95851a6 100644 --- a/src/gui/widgets/itemshortcutcontainer.h +++ b/src/gui/widgets/itemshortcutcontainer.h @@ -39,7 +39,8 @@ class ItemShortcutContainer final : public ShortcutContainer /** * Constructor. Initializes the graphic. */ - explicit ItemShortcutContainer(const unsigned number); + ItemShortcutContainer(Widget2 *const widget, + const unsigned number); A_DELETE_COPY(ItemShortcutContainer) diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 3bcb8476e..97fd4a713 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -30,9 +30,11 @@ #include "debug.h" -PlayerBox::PlayerBox(Being *const being, const std::string &skin, +PlayerBox::PlayerBox(Widget2 *const widget, + Being *const being, + const std::string &skin, const std::string &selectedSkin) : - Widget2(), + Widget2(widget), ScrollArea(), mBeing(being), mAlpha(1.0), @@ -48,8 +50,10 @@ PlayerBox::PlayerBox(Being *const being, const std::string &skin, init(skin, selectedSkin); } -PlayerBox::PlayerBox(const std::string &skin, +PlayerBox::PlayerBox(Widget2 *const widget, + const std::string &skin, const std::string &selectedSkin) : + Widget2(widget), ScrollArea(), mBeing(nullptr), mAlpha(1.0), diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h index 30d79ff2f..3669a23a9 100644 --- a/src/gui/widgets/playerbox.h +++ b/src/gui/widgets/playerbox.h @@ -45,10 +45,13 @@ class PlayerBox final : public Widget2, * Constructor. Takes the initial player character that this box should * display, which defaults to NULL. */ - explicit PlayerBox(Being *const being, const std::string &skin = "", + explicit PlayerBox(Widget2 *const widget, + Being *const being, + const std::string &skin = "", const std::string &selectedSkin = ""); - explicit PlayerBox(const std::string &skin = "", + explicit PlayerBox(Widget2 *const widget, + const std::string &skin = "", const std::string &selectedSkin = ""); A_DELETE_COPY(PlayerBox) diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index b3f5b0e54..198094b6d 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -28,9 +28,9 @@ #include "debug.h" -ProgressIndicator::ProgressIndicator() : +ProgressIndicator::ProgressIndicator(Widget2 *const widget) : gcn::Widget(), - Widget2(), + Widget2(widget), mIndicator(nullptr) { ImageSet *const images = Theme::getImageSetFromTheme( diff --git a/src/gui/widgets/progressindicator.h b/src/gui/widgets/progressindicator.h index 8dd33bf4d..7357931e9 100644 --- a/src/gui/widgets/progressindicator.h +++ b/src/gui/widgets/progressindicator.h @@ -38,7 +38,7 @@ class ProgressIndicator final : public gcn::Widget, public Widget2 { public: - ProgressIndicator(); + ProgressIndicator(Widget2 *const widget); A_DELETE_COPY(ProgressIndicator) diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 0ee2c3357..708949f9c 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -45,8 +45,11 @@ static std::string const buttonFiles[2] = "scrollbuttons_pressed.xml" }; -ScrollArea::ScrollArea(const bool opaque, const std::string &skin) : +ScrollArea::ScrollArea(Widget2 *const widget, + const bool opaque, + const std::string &skin) : gcn::ScrollArea(), + Widget2(widget), WidgetListener(), mX(0), mY(0), @@ -66,9 +69,12 @@ ScrollArea::ScrollArea(const bool opaque, const std::string &skin) : init(skin); } -ScrollArea::ScrollArea(gcn::Widget *const widget, const bool opaque, +ScrollArea::ScrollArea(Widget2 *const widget2, + gcn::Widget *const widget, + const bool opaque, const std::string &skin) : gcn::ScrollArea(widget), + Widget2(widget2), WidgetListener(), mX(0), mY(0), diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index 3f6195271..bc25baa27 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -52,7 +52,8 @@ class ScrollArea final : public gcn::ScrollArea, * Constructor that takes no content. Needed for use with the DropDown * class. */ - explicit ScrollArea(const bool opaque = true, + explicit ScrollArea(Widget2 *const widget, + const bool opaque = true, const std::string &skin = ""); /** @@ -60,7 +61,8 @@ class ScrollArea final : public gcn::ScrollArea, * * @param content the initial content to show in the scroll area */ - explicit ScrollArea(gcn::Widget *const widget, + explicit ScrollArea(Widget2 *const widget2, + gcn::Widget *const widget, const bool opaque = true, const std::string &skin = ""); diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index aeeb8e4bc..649388d04 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -50,7 +50,7 @@ SetupItem::SetupItem(const std::string &restrict text, const std::string &restrict eventName, const bool mainConfig) : ActionListener(), - Widget2(), + Widget2(parent), mText(text), mDescription(description), mKeyName(keyName), @@ -74,7 +74,7 @@ SetupItem::SetupItem(const std::string &restrict text, const std::string &restrict def, const bool mainConfig) : ActionListener(), - Widget2(), + Widget2(parent), mText(text), mDescription(description), mKeyName(keyName), @@ -762,7 +762,7 @@ void SetupItemSlider::createControls() mHorizont = new HorizontContainer(this, 32, 2); mLabel = new Label(this, mText); - mSlider = new Slider(mMin, mMax); + mSlider = new Slider(this, mMin, mMax); mSlider->setActionEventId(mEventName); mSlider->addActionListener(mParent); mSlider->setValue2(atof(mValue.c_str())); @@ -886,7 +886,7 @@ void SetupItemSlider2::createControls() mLabel = new Label(this, mText); mLabel2 = new Label(this, ""); mLabel2->setWidth(width); - mSlider = new Slider(mMin, mMax); + mSlider = new Slider(this, mMin, mMax); mSlider->setActionEventId(mEventName); mSlider->addActionListener(mParent); mSlider->setValue2(atof(mValue.c_str())); diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index 767a32974..866dde6f1 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -28,9 +28,9 @@ float ShortcutContainer::mAlpha = 1.0; -ShortcutContainer::ShortcutContainer() : +ShortcutContainer::ShortcutContainer(Widget2 *const widget) : gcn::Widget(), - Widget2(), + Widget2(widget), WidgetListener(), MouseListener(), mBackgroundImg(nullptr), diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index e7ec2ff62..8df401775 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -102,7 +102,7 @@ class ShortcutContainer : public gcn::Widget, /** * Constructor. Initializes the shortcut container. */ - explicit ShortcutContainer(); + explicit ShortcutContainer(Widget2 *const widget); /** * Gets the index from the grid provided the point is in an item box. diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 02ebc2ccb..c5988ff54 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -43,9 +43,10 @@ static std::string const data[2] = "slider_highlighted.xml" }; -Slider::Slider(const double scaleEnd) : +Slider::Slider(Widget2 *const widget, + const double scaleEnd) : gcn::Slider(scaleEnd), - Widget2(), + Widget2(widget), mVertexes(new ImageCollection), mHasMouse(false), mRedraw(true) @@ -53,9 +54,11 @@ Slider::Slider(const double scaleEnd) : init(); } -Slider::Slider(const double scaleStart, const double scaleEnd) : +Slider::Slider(Widget2 *const widget, + const double scaleStart, + const double scaleEnd) : gcn::Slider(scaleStart, scaleEnd), - Widget2(), + Widget2(widget), mVertexes(new ImageCollection), mHasMouse(false), mRedraw(true) diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h index 2d4853539..27b03976d 100644 --- a/src/gui/widgets/slider.h +++ b/src/gui/widgets/slider.h @@ -43,12 +43,15 @@ class Slider final : public gcn::Slider, /** * Constructor with scale start equal to 0. */ - explicit Slider(const double scaleEnd = 1.0); + explicit Slider(Widget2 *const widget, + const double scaleEnd = 1.0); /** * Constructor. */ - Slider(const double scaleStart, const double scaleEnd); + Slider(Widget2 *const widget, + const double scaleStart, + const double scaleEnd); A_DELETE_COPY(Slider) diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index e8d34c9d8..5441c4d8a 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -39,8 +39,9 @@ #include "debug.h" -SpellShortcutContainer::SpellShortcutContainer(const unsigned number) : - ShortcutContainer(), +SpellShortcutContainer::SpellShortcutContainer(Widget2 *const widget, + const unsigned number) : + ShortcutContainer(widget), mSpellPopup(new SpellPopup), mNumber(number), mSpellClicked(false) diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index d8f5d22b4..afff6dcf9 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -38,7 +38,8 @@ class SpellShortcutContainer final : public ShortcutContainer /** * Constructor. Initializes the graphic. */ - explicit SpellShortcutContainer(const unsigned number); + explicit SpellShortcutContainer(Widget2 *const widget, + const unsigned number); A_DELETE_COPY(SpellShortcutContainer) diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index d29c56c85..8ea9d5fbb 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -58,23 +58,23 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : mSelected(-1), // TRANSLATORS: colors tab. label. mGradTypeLabel(new Label(this, _("Type:"))), - mGradTypeSlider(new Slider(0, 3)), + mGradTypeSlider(new Slider(this, 0, 3)), mGradTypeText(new Label(this)), // TRANSLATORS: colors tab. label. mGradDelayLabel(new Label(this, _("Delay:"))), - mGradDelaySlider(new Slider(20, 100)), + mGradDelaySlider(new Slider(this, 20, 100)), mGradDelayText(new TextField(this)), // TRANSLATORS: colors tab. label. mRedLabel(new Label(this, _("Red:"))), - mRedSlider(new Slider(0, 255)), + mRedSlider(new Slider(this, 0, 255)), mRedText(new TextField(this)), // TRANSLATORS: colors tab. label. mGreenLabel(new Label(this, _("Green:"))), - mGreenSlider(new Slider(0, 255)), + mGreenSlider(new Slider(this, 0, 255)), mGreenText(new TextField(this)), // TRANSLATORS: colors tab. label. mBlueLabel(new Label(this, _("Blue:"))), - mBlueSlider(new Slider(0, 255)), + mBlueSlider(new Slider(this, 0, 255)), mBlueText(new TextField(this)) { mColorBox->postInit(); diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index 589b08e5e..be00937f2 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -191,9 +191,9 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : mOpenGLDropDown(new DropDown(widget, mOpenGLListModel)), // TRANSLATORS: video settings checkbox mFpsCheckBox(new CheckBox(this, _("FPS limit:"))), - mFpsSlider(new Slider(2, 160)), + mFpsSlider(new Slider(this, 2, 160)), mFpsLabel(new Label(this)), - mAltFpsSlider(new Slider(2, 160)), + mAltFpsSlider(new Slider(this, 2, 160)), // TRANSLATORS: video settings label mAltFpsLabel(new Label(this, _("Alt FPS limit: "))), #if !defined(ANDROID) && !defined(__APPLE__) diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index f6e94556a..a57ccbb41 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -78,12 +78,6 @@ class Widget2 } protected: - Widget2() : - mPaletteOffset(0), - mForegroundColor2() - { - } - explicit Widget2(const Widget2 *const widget) : mPaletteOffset(widget ? widget->mPaletteOffset : 0), mForegroundColor2() diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 2ea86f9df..82c2d91f8 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -49,7 +49,7 @@ int Window::mouseResize = 0; Window::Window(const std::string &caption, const bool modal, Window *const parent, std::string skin) : gcn::Window(caption), - Widget2(), + Widget2(nullptr), WidgetListener(), mSkin(nullptr), mDefaultX(0), diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index 19a46b9b8..4d2acfac9 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -244,7 +244,7 @@ void BuyDialog::init() getOptionBool("showbackground"), "buy_background.xml"); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - mSlider = new Slider(1.0); + mSlider = new Slider(this, 1.0); mQuantityLabel = new Label(this, strprintf( "%d / %d", mAmountItems, mMaxItems)); mQuantityLabel->setAlignment(Graphics::CENTER); diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index a3fdcde3a..d6b572d40 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -124,7 +124,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, mMaxLook(CharDB::getMaxLook()), mPlayer(new Being(0, ActorSprite::PLAYER, static_cast(mRace), nullptr)), - mPlayerBox(new PlayerBox(mPlayer, "charcreate_playerbox.xml", + mPlayerBox(new PlayerBox(this, mPlayer, "charcreate_playerbox.xml", "charcreate_selectedplayerbox.xml")), mHairStyle(0), mHairColor(0), @@ -528,7 +528,7 @@ void CharCreateDialog::setAttributes(const StringVect &labels, mAttributeLabel[i]->adjustSize(); add(mAttributeLabel[i]); - mAttributeSlider[i] = new Slider(min, max); + mAttributeSlider[i] = new Slider(this, min, max); mAttributeSlider[i]->setDimension(gcn::Rectangle(140, y + i * 24, 150, 12)); mAttributeSlider[i]->setActionEventId("statslider"); diff --git a/src/gui/windows/connectiondialog.cpp b/src/gui/windows/connectiondialog.cpp index 0d0633ff8..1a7c23187 100644 --- a/src/gui/windows/connectiondialog.cpp +++ b/src/gui/windows/connectiondialog.cpp @@ -41,7 +41,7 @@ ConnectionDialog::ConnectionDialog(const std::string &text, setMovable(false); setMinWidth(0); - ProgressIndicator *const progressIndicator = new ProgressIndicator; + ProgressIndicator *const progressIndicator = new ProgressIndicator(this); Label *const label = new Label(this, text); Button *const cancelButton = new Button( // TRANSLATORS: connection dialog button diff --git a/src/gui/windows/emotewindow.cpp b/src/gui/windows/emotewindow.cpp index 5f3aa1bb1..d94344090 100644 --- a/src/gui/windows/emotewindow.cpp +++ b/src/gui/windows/emotewindow.cpp @@ -51,10 +51,10 @@ EmoteWindow::EmoteWindow() : mEmotePage(new EmotePage(this)), mColorModel(ColorModel::createDefault(this)), mColorPage(new ColorPage(this, mColorModel, "colorpage.xml")), - mScrollColorPage(new ScrollArea(mColorPage, false, "emotepage.xml")), + mScrollColorPage(new ScrollArea(this, mColorPage, false, "emotepage.xml")), mFontModel(new NamesModel), mFontPage(new ListBox(this, mFontModel, "")), - mScrollFontPage(new ScrollArea(mFontPage, false, "fontpage.xml")), + mScrollFontPage(new ScrollArea(this, mFontPage, false, "fontpage.xml")), mImageSet(Theme::getImageSetFromThemeXml("emotetabs.xml", "", 17, 16)) { mTabs->postInit(); diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 6f2bb3b3d..01f74c50d 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -59,7 +59,8 @@ EquipmentWindow::EquipmentWindow(Equipment *const equipment, ActionListener(), mEquipment(equipment), mItemPopup(new ItemPopup), - mPlayerBox(new PlayerBox("equipment_playerbox.xml", + mPlayerBox(new PlayerBox(this, + "equipment_playerbox.xml", "equipment_selectedplayerbox.xml")), // TRANSLATORS: equipment window button mUnequip(new Button(this, _("Unequip"), "unequip", this)), diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index 6b7d10173..8e981ae96 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -148,7 +148,7 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent, mMax(maxRange), mUsage(usage), mItemPopup(new ItemPopup), - mItemAmountSlide(new Slider(1.0, mMax)), + mItemAmountSlide(new Slider(this, 1.0, mMax)), mItemPriceSlide(nullptr), mItemDropDown(nullptr), mItemsModal(nullptr), @@ -182,7 +182,7 @@ ItemAmountWindow::ItemAmountWindow(const Usage usage, Window *const parent, mItemPriceTextField->setWidth(35); mItemPriceTextField->addKeyListener(this); - mItemPriceSlide = new Slider(1.0, 10000000); + mItemPriceSlide = new Slider(this, 1.0, 10000000); mItemPriceSlide->setHeight(10); mItemPriceSlide->setActionEventId("slidePrice"); mItemPriceSlide->addActionListener(this); diff --git a/src/gui/windows/selldialog.cpp b/src/gui/windows/selldialog.cpp index aad3619ba..b79d18dcf 100644 --- a/src/gui/windows/selldialog.cpp +++ b/src/gui/windows/selldialog.cpp @@ -90,7 +90,7 @@ void SellDialog::init() getOptionBool("showbackground"), "sell_background.xml"); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - mSlider = new Slider(1.0); + mSlider = new Slider(this, 1.0); mQuantityLabel = new Label(this, strprintf( "%d / %d", mAmountItems, mMaxItems)); -- cgit v1.2.3-70-g09d2 From eed93efa8aa8539b47f225b4abafe6d59bebe67d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 23 Feb 2014 20:17:46 +0300 Subject: Rename drawImage2 methods into drawImage. --- src/animatedsprite.cpp | 2 +- src/being/compoundsprite.cpp | 4 ++-- src/gui/font.cpp | 4 ++-- src/gui/gui.cpp | 4 ++-- src/gui/widgets/avatarlistbox.cpp | 2 +- src/gui/widgets/browserbox.cpp | 2 +- src/gui/widgets/button.cpp | 4 ++-- src/gui/widgets/checkbox.cpp | 2 +- src/gui/widgets/desktop.cpp | 2 +- src/gui/widgets/dropdown.cpp | 4 ++-- src/gui/widgets/dropshortcutcontainer.cpp | 2 +- src/gui/widgets/emotepage.cpp | 2 +- src/gui/widgets/extendedlistbox.cpp | 4 ++-- src/gui/widgets/icon.cpp | 2 +- src/gui/widgets/itemcontainer.cpp | 6 +++--- src/gui/widgets/itemshortcutcontainer.cpp | 6 +++--- src/gui/widgets/radiobutton.cpp | 2 +- src/gui/widgets/scrollarea.cpp | 2 +- src/gui/widgets/shoplistbox.cpp | 2 +- src/gui/widgets/shortcutcontainer.cpp | 2 +- src/gui/widgets/slider.cpp | 12 ++++++------ src/gui/widgets/spellshortcutcontainer.cpp | 2 +- src/gui/widgets/tabs/tab.cpp | 2 +- src/gui/widgets/window.cpp | 6 +++--- src/gui/windows/equipmentwindow.cpp | 8 ++++---- src/gui/windows/minimap.cpp | 2 +- src/gui/windows/outfitwindow.cpp | 4 ++-- src/gui/windows/skilldialog.cpp | 2 +- src/imagesprite.cpp | 2 +- src/maplayer.cpp | 6 +++--- src/particle/imageparticle.cpp | 2 +- src/render/graphics.h | 4 ++-- src/render/mobileopenglgraphics.cpp | 4 ++-- src/render/normalopenglgraphics.cpp | 4 ++-- src/render/nullopenglgraphics.cpp | 4 ++-- src/render/openglgraphicsdef.hpp | 4 ++-- src/render/safeopenglgraphics.cpp | 4 ++-- src/render/sdl2graphics.cpp | 4 ++-- src/render/sdl2graphics.h | 4 ++-- src/render/sdl2softwaregraphics.cpp | 4 ++-- src/render/sdl2softwaregraphics.h | 4 ++-- src/render/sdlgraphics.cpp | 4 ++-- src/render/sdlgraphics.h | 4 ++-- src/render/surfacegraphics.cpp | 4 ++-- src/render/surfacegraphics.h | 4 ++-- src/resources/atlasmanager.cpp | 2 +- src/simpleanimation.cpp | 5 +++-- src/test/testlauncher.cpp | 12 ++++++------ src/touchmanager.cpp | 2 +- 49 files changed, 93 insertions(+), 92 deletions(-) (limited to 'src/gui/widgets/dropshortcutcontainer.cpp') diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index 93f8c6009..97424fbfb 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -294,7 +294,7 @@ void AnimatedSprite::draw(Graphics *const graphics, if (image->getAlpha() != mAlpha) image->setAlpha(mAlpha); - graphics->drawImage2(image, + graphics->drawImage(image, posX + mFrame->offsetX, posY + mFrame->offsetY); } diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp index 27e48caa7..ea4a2067f 100644 --- a/src/being/compoundsprite.cpp +++ b/src/being/compoundsprite.cpp @@ -123,12 +123,12 @@ void CompoundSprite::draw(Graphics *const graphics, if (mAlpha == 1.0F && mImage) { - graphics->drawImage2(mImage, posX + mOffsetX, posY + mOffsetY); + graphics->drawImage(mImage, posX + mOffsetX, posY + mOffsetY); } else if (mAlpha && mAlphaImage) { mAlphaImage->setAlpha(mAlpha); - graphics->drawImage2(mAlphaImage, + graphics->drawImage(mAlphaImage, posX + mOffsetX, posY + mOffsetY); } else diff --git a/src/gui/font.cpp b/src/gui/font.cpp index e1d793ce1..8c022f99d 100644 --- a/src/gui/font.cpp +++ b/src/gui/font.cpp @@ -522,7 +522,7 @@ void Font::drawString(Graphics *const graphics, if (image) { image->setAlpha(alpha); - g->drawImage2(image, x, y); + g->drawImage(image, x, y); } } else @@ -544,7 +544,7 @@ void Font::drawString(Graphics *const graphics, const Image *const image = chunk2->img; if (image) - g->drawImage2(image, x, y); + g->drawImage(image, x, y); } BLOCK_END("Font::drawString") } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 07aca0c81..5914e43d9 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -451,7 +451,7 @@ void Gui::draw() { const int posX = mouseX - (image->mBounds.w / 2); const int posY = mouseY - (image->mBounds.h / 2); - mGraphics->drawImage2(image, posX, posY); + mGraphics->drawImage(image, posX, posY); } if (mGuiFont) { @@ -469,7 +469,7 @@ void Gui::draw() if (mouseCursor) { mouseCursor->setAlpha(mMouseCursorAlpha); - mGraphics->drawImage2(mouseCursor, mouseX - 15, mouseY - 17); + mGraphics->drawImage(mouseCursor, mouseX - 15, mouseY - 17); } } diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index cf01517c6..46a78d99e 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -135,7 +135,7 @@ void AvatarListBox::draw(Graphics *graphics) } else { - graphics->drawImage2(icon, mImagePadding, y + mPadding); + graphics->drawImage(icon, mImagePadding, y + mPadding); } } } diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index cfc26da0e..c36a607f4 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -508,7 +508,7 @@ void BrowserBox::draw(Graphics *graphics) } else if (part.mImage) { - graphics->drawImage2(part.mImage, part.mX, part.mY); + graphics->drawImage(part.mImage, part.mX, part.mY); } } diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 90c1706b5..2642a67a3 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -507,9 +507,9 @@ void Button::draw(Graphics *graphics) if (mImages) { if (isPressed()) - graphics->drawImage2(mImages[mode], imageX + 1, imageY + 1); + graphics->drawImage(mImages[mode], imageX + 1, imageY + 1); else - graphics->drawImage2(mImages[mode], imageX, imageY); + graphics->drawImage(mImages[mode], imageX, imageY); } } diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index 63e32a0f9..9fb63b2e8 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -167,7 +167,7 @@ void CheckBox::drawBox(Graphics *const graphics) if (box) { - graphics->drawImage2(box, + graphics->drawImage(box, mImagePadding, (getHeight() - mImageSize) / 2); } diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index a296fb49d..5dca7578c 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -123,7 +123,7 @@ void Desktop::draw(Graphics *graphics) if (imageHelper->useOpenGL() == RENDER_SOFTWARE) { - graphics->drawImage2(mWallpaper, + graphics->drawImage(mWallpaper, (width - wallpWidth) / 2, (height - wallpHeight) / 2); } diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 763cf47a5..982b2cf0d 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -251,7 +251,7 @@ void DropDown::draw(Graphics* graphics) } else { - graphics->drawImage2(image, + graphics->drawImage(image, mImagePadding, (mDimension.height - image->getHeight()) / 2 + mPadding); font->drawString(graphics, model->getElementAt(sel), @@ -305,7 +305,7 @@ void DropDown::drawButton(Graphics *graphics) Image *image = buttons[mDroppedDown][mPushed]; if (image) { - graphics->drawImage2(image, + graphics->drawImage(image, mDimension.width - image->getWidth() - mImagePadding, (height - image->getHeight()) / 2); } diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index fcb0f8ea1..c8e4bc2d9 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -143,7 +143,7 @@ void DropShortcutContainer::draw(Graphics *graphics) caption = "Eq."; image->setAlpha(1.0F); - graphics->drawImage2(image, itemX, itemY); + graphics->drawImage(image, itemX, itemY); if (item->isEquipped()) graphics->setColorAll(mEquipedColor, mEquipedColor2); else diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index 2aff81955..139082815 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -101,7 +101,7 @@ void EmotePage::draw(Graphics *graphics) const Image *const image = *it; if (image) { - graphics->drawImage2(image, x, y); + graphics->drawImage(image, x, y); x += emoteWidth; if (x + emoteWidth > width) { diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index 13fb70f28..15a52ee82 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -147,7 +147,7 @@ void ExtendedListBox::draw(Graphics *graphics) const Image *const image = model->getImageAt(row1); if (image) { - graphics->drawImage2(image, + graphics->drawImage(image, mImagePadding, item.y + (height - image->getHeight()) / 2 + mPadding); } @@ -182,7 +182,7 @@ void ExtendedListBox::draw(Graphics *graphics) const Image *const image = model->getImageAt(row1); if (image) { - graphics->drawImage2(image, + graphics->drawImage(image, mImagePadding, item.y + (height - image->getHeight()) / 2 + mPadding); } diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index 53be9ef91..9a86fc9bf 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -74,7 +74,7 @@ void Icon::draw(Graphics *graphics) BLOCK_START("Icon::draw") if (mImage) { - graphics->drawImage2(mImage, + graphics->drawImage(mImage, (mDimension.width - mImage->mBounds.w) / 2, (mDimension.height - mImage->mBounds.h) / 2); } diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 0ea3adef1..fe666e6f7 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -276,16 +276,16 @@ void ItemContainer::draw(Graphics *graphics) if (mShowMatrix[itemIndex] == mSelectedIndex) { if (mSelImg) - graphics->drawImage2(mSelImg, itemX, itemY); + graphics->drawImage(mSelImg, itemX, itemY); } image->setAlpha(1.0F); // ensure the image if fully drawn... - graphics->drawImage2(image, + graphics->drawImage(image, itemX + mPaddingItemX, itemY + mPaddingItemY); if (mProtectedImg && PlayerInfo::isItemProtected( item->getId())) { - graphics->drawImage2(mProtectedImg, + graphics->drawImage(mProtectedImg, itemX + mPaddingItemX, itemY + mPaddingItemY); } diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 83c8820ae..b9dc3bec8 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -174,7 +174,7 @@ void ItemShortcutContainer::draw(Graphics *graphics) caption = "Eq."; image->setAlpha(1.0F); - graphics->drawImage2(image, itemX, itemY); + graphics->drawImage(image, itemX, itemY); if (item->isEquipped()) { graphics->setColorAll(mEquipedColor, mEquipedColor2); @@ -203,7 +203,7 @@ void ItemShortcutContainer::draw(Graphics *graphics) if (image) { image->setAlpha(1.0F); - graphics->drawImage2(image, itemX, itemY); + graphics->drawImage(image, itemX, itemY); } } @@ -222,7 +222,7 @@ void ItemShortcutContainer::draw(Graphics *graphics) if (image) { image->setAlpha(1.0F); - graphics->drawImage2(image, itemX, itemY); + graphics->drawImage(image, itemX, itemY); } font->drawString(graphics, skill->data->shortName, itemX + 2, diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index 7b5c5fa11..bb9ae46f9 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -150,7 +150,7 @@ void RadioButton::drawBox(Graphics* graphics) if (box) { - graphics->drawImage2(box, + graphics->drawImage(box, mImagePadding, (getHeight() - mImageSize) / 2); } diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 2ca851254..f28f45d78 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -409,7 +409,7 @@ void ScrollArea::drawButton(Graphics *const graphics, } if (buttons[dir][state]) - graphics->drawImage2(buttons[dir][state], dim.x, dim.y); + graphics->drawImage(buttons[dir][state], dim.x, dim.y); } void ScrollArea::calcButton(Graphics *const graphics, diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 36104241d..45d3022c8 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -154,7 +154,7 @@ void ShopListBox::draw(Graphics *graphics) if (icon) { icon->setAlpha(1.0F); - graphics->drawImage2(icon, mPadding, y + mPadding); + graphics->drawImage(icon, mPadding, y + mPadding); } } if (mSelected == i) diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index a7e166da3..b059098b5 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -110,7 +110,7 @@ void ShortcutContainer::drawBackground(Graphics *g) { for (unsigned i = 0; i < mMaxItems; i ++) { - g->drawImage2(mBackgroundImg, (i % mGridWidth) * mBoxWidth, + g->drawImage(mBackgroundImg, (i % mGridWidth) * mBoxWidth, (i / mGridWidth) * mBoxHeight); } } diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index c785f4016..7a9b38050 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -222,7 +222,7 @@ void Slider::draw(Graphics *graphics) { if (!mHasMouse) { - graphics->drawImage2(buttons[0].grid[HSTART], x, y); + graphics->drawImage(buttons[0].grid[HSTART], x, y); const int width = buttons[0].grid[HSTART]->getWidth(); w -= width + buttons[0].grid[HEND]->getWidth(); x += width; @@ -234,18 +234,18 @@ void Slider::draw(Graphics *graphics) } x += w; - graphics->drawImage2(buttons[0].grid[HEND], x, y); + graphics->drawImage(buttons[0].grid[HEND], x, y); const Image *const img = buttons[0].grid[HGRIP]; if (img) { - graphics->drawImage2(img, getMarkerPosition(), + graphics->drawImage(img, getMarkerPosition(), (mDimension.height - img->getHeight()) / 2); } } else { - graphics->drawImage2(buttons[1].grid[HSTART], x, y); + graphics->drawImage(buttons[1].grid[HSTART], x, y); const int width = buttons[1].grid[HSTART]->getWidth(); w -= width; @@ -261,12 +261,12 @@ void Slider::draw(Graphics *graphics) x += w; if (buttons[1].grid[HEND]) - graphics->drawImage2(buttons[1].grid[HEND], x, y); + graphics->drawImage(buttons[1].grid[HEND], x, y); const Image *const img = buttons[1].grid[HGRIP]; if (img) { - graphics->drawImage2(img, getMarkerPosition(), + graphics->drawImage(img, getMarkerPosition(), (mDimension.height - img->getHeight()) / 2); } } diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 239fc6797..f1d4d0cd1 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -133,7 +133,7 @@ void SpellShortcutContainer::draw(Graphics *graphics) if (image) { image->setAlpha(1.0F); - graphics->drawImage2(image, itemX, itemY); + graphics->drawImage(image, itemX, itemY); } } diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index 2d91129f2..96ae76787 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -291,7 +291,7 @@ void Tab::draw(Graphics *graphics) if (skin1) { const int padding = skin1->getPadding(); - graphics->drawImage2(mImage, padding, padding); + graphics->drawImage(mImage, padding, padding); } } } diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 3404bb573..9a43a305b 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -334,18 +334,18 @@ void Window::draw(Graphics *graphics) const Image *const button = mSkin->getCloseImage( mResizeHandles == CLOSE); if (button) - graphics->drawImage2(button, mCloseRect.x, mCloseRect.y); + graphics->drawImage(button, mCloseRect.x, mCloseRect.y); } // Draw Sticky Button if (mStickyButton) { const Image *const button = mSkin->getStickyImage(mSticky); if (button) - graphics->drawImage2(button, mStickyRect.x, mStickyRect.y); + graphics->drawImage(button, mStickyRect.x, mStickyRect.y); } if (mGrip) - graphics->drawImage2(mGrip, mGripRect.x, mGripRect.y); + graphics->drawImage(mGrip, mGripRect.x, mGripRect.y); } // Draw title diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index a50d0e9fa..ea7944f94 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -202,12 +202,12 @@ void EquipmentWindow::draw(Graphics *graphics) continue; if (i == mSelected) { - graphics->drawImage2(mSlotHighlightedBackground, + graphics->drawImage(mSlotHighlightedBackground, box->x, box->y); } else { - graphics->drawImage2(mSlotBackground, box->x, box->y); + graphics->drawImage(mSlotBackground, box->x, box->y); } } } @@ -234,7 +234,7 @@ void EquipmentWindow::draw(Graphics *graphics) { image->setAlpha(1.0F); // Ensure the image is drawn // with maximum opacity - graphics->drawImage2(image, box->x + mItemPadding, + graphics->drawImage(image, box->x + mItemPadding, box->y + mItemPadding); if (i == EQUIP_PROJECTILE_SLOT) { @@ -249,7 +249,7 @@ void EquipmentWindow::draw(Graphics *graphics) } else if (box->image) { - graphics->drawImage2(box->image, + graphics->drawImage(box->image, box->x + mItemPadding, box->y + mItemPadding); } diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index dd8a1d2b7..4c246aed4 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -284,7 +284,7 @@ void Minimap::draw(Graphics *graphics) mMapOriginY = 0; } - graphics->drawImage2(mMapImage, mMapOriginX, mMapOriginY); + graphics->drawImage(mMapImage, mMapOriginX, mMapOriginY); } const ActorSprites &actors = actorManager->getAll(); diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index acf681cf4..0f25b84a6 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -347,7 +347,7 @@ void OutfitWindow::draw(Graphics *graphics) const Image *const image = item->getImage(); if (image) { - graphics->drawImage2(image, itemX, itemY); + graphics->drawImage(image, itemX, itemY); foundItem = true; } } @@ -358,7 +358,7 @@ void OutfitWindow::draw(Graphics *graphics) mItemColors[mCurrentOutfit][i]); if (image) { - graphics->drawImage2(image, itemX, itemY); + graphics->drawImage(image, itemX, itemY); image->decRef(); } } diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index d39d7061b..1346c8e95 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -135,7 +135,7 @@ class SkillListBox final : public ListBox const SkillData *const data = e->data; const int yPad = y + mPadding; const std::string &description = data->description; - graphics->drawImage2(data->icon, mPadding, yPad); + graphics->drawImage(data->icon, mPadding, yPad); font->drawString(graphics, data->name, mTextPadding, yPad); if (!description.empty()) { diff --git a/src/imagesprite.cpp b/src/imagesprite.cpp index c40e49856..965c333bf 100644 --- a/src/imagesprite.cpp +++ b/src/imagesprite.cpp @@ -56,5 +56,5 @@ void ImageSprite::draw(Graphics *const graphics, return; mImage->setAlpha(mAlpha); - graphics->drawImage2(mImage, posX, posY); + graphics->drawImage(mImage, posX, posY); } diff --git a/src/maplayer.cpp b/src/maplayer.cpp index 93434aca9..5779190a9 100644 --- a/src/maplayer.cpp +++ b/src/maplayer.cpp @@ -140,7 +140,7 @@ void MapLayer::draw(Graphics *const graphics, if (!c) { - graphics->drawImage2(img, px, py); + graphics->drawImage(img, px, py); } else { @@ -456,7 +456,7 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY, if (!c) { - graphics->drawImage2(img, px, py); + graphics->drawImage(img, px, py); } else { @@ -798,7 +798,7 @@ void MapItem::draw(Graphics *const graphics, const int x, const int y, { BLOCK_START("MapItem::draw") if (mImage) - graphics->drawImage2(mImage, x, y); + graphics->drawImage(mImage, x, y); switch (mType) { diff --git a/src/particle/imageparticle.cpp b/src/particle/imageparticle.cpp index e41c072b4..92f458e41 100644 --- a/src/particle/imageparticle.cpp +++ b/src/particle/imageparticle.cpp @@ -103,6 +103,6 @@ void ImageParticle::draw(Graphics *const graphics, } mImage->setAlpha(alphafactor); - graphics->drawImage2(mImage, screenX, screenY); + graphics->drawImage(mImage, screenX, screenY); return; } diff --git a/src/render/graphics.h b/src/render/graphics.h index 35e2a3ba3..14784a408 100644 --- a/src/render/graphics.h +++ b/src/render/graphics.h @@ -377,8 +377,8 @@ class Graphics * @return true if the image was blitted properly * false otherwise. */ - virtual bool drawImage2(const Image *const image, - int dstX, int dstY) = 0; + virtual bool drawImage(const Image *const image, + int dstX, int dstY) = 0; virtual void drawImageCached(const Image *const image, int srcX, int srcY) = 0; diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp index a2f7909ff..b306cf021 100644 --- a/src/render/mobileopenglgraphics.cpp +++ b/src/render/mobileopenglgraphics.cpp @@ -219,7 +219,7 @@ static inline void drawRescaledQuad(const Image *const image, } } -bool MobileOpenGLGraphics::drawImage2(const Image *const image, +bool MobileOpenGLGraphics::drawImage(const Image *const image, int dstX, int dstY) { return drawImageInline(image, dstX, dstY); @@ -228,7 +228,7 @@ bool MobileOpenGLGraphics::drawImage2(const Image *const image, bool MobileOpenGLGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { - FUNC_BLOCK("Graphics::drawImage2", 1) + FUNC_BLOCK("Graphics::drawImage", 1) if (!image) return false; diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp index 67a18bde5..0a57c8341 100644 --- a/src/render/normalopenglgraphics.cpp +++ b/src/render/normalopenglgraphics.cpp @@ -286,7 +286,7 @@ static inline void drawRescaledQuad(const Image *const image, } } -bool NormalOpenGLGraphics::drawImage2(const Image *const image, +bool NormalOpenGLGraphics::drawImage(const Image *const image, int dstX, int dstY) { return drawImageInline(image, dstX, dstY); @@ -295,7 +295,7 @@ bool NormalOpenGLGraphics::drawImage2(const Image *const image, bool NormalOpenGLGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { - FUNC_BLOCK("Graphics::drawImage2", 1) + FUNC_BLOCK("Graphics::drawImage", 1) if (!image) return false; diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp index 6018247f9..8dd4ca91f 100644 --- a/src/render/nullopenglgraphics.cpp +++ b/src/render/nullopenglgraphics.cpp @@ -139,7 +139,7 @@ static inline void drawRescaledQuad(const Image *const image A_UNUSED, } } -bool NullOpenGLGraphics::drawImage2(const Image *const image, +bool NullOpenGLGraphics::drawImage(const Image *const image, int dstX, int dstY) { return drawImageInline(image, dstX, dstY); @@ -148,7 +148,7 @@ bool NullOpenGLGraphics::drawImage2(const Image *const image, bool NullOpenGLGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { - FUNC_BLOCK("Graphics::drawImage2", 1) + FUNC_BLOCK("Graphics::drawImage", 1) if (!image) return false; diff --git a/src/render/openglgraphicsdef.hpp b/src/render/openglgraphicsdef.hpp index a582d9043..d3fcebf81 100644 --- a/src/render/openglgraphicsdef.hpp +++ b/src/render/openglgraphicsdef.hpp @@ -130,8 +130,8 @@ void updateTextureFormat(); - bool drawImage2(const Image *const image, - int dstX, int dstY) override final; + bool drawImage(const Image *const image, + int dstX, int dstY) override final; void drawImageCached(const Image *const image, int x, int y) override final; diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp index c1c266464..342495a47 100644 --- a/src/render/safeopenglgraphics.cpp +++ b/src/render/safeopenglgraphics.cpp @@ -142,7 +142,7 @@ static inline void drawRescaledQuad(const Image *const image, } } -bool SafeOpenGLGraphics::drawImage2(const Image *const image, +bool SafeOpenGLGraphics::drawImage(const Image *const image, int dstX, int dstY) { return drawImageInline(image, dstX, dstY); @@ -151,7 +151,7 @@ bool SafeOpenGLGraphics::drawImage2(const Image *const image, bool SafeOpenGLGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { - FUNC_BLOCK("Graphics::drawImage2", 1) + FUNC_BLOCK("Graphics::drawImage", 1) if (!image) return false; diff --git a/src/render/sdl2graphics.cpp b/src/render/sdl2graphics.cpp index 053049cef..ac7d8debc 100644 --- a/src/render/sdl2graphics.cpp +++ b/src/render/sdl2graphics.cpp @@ -157,7 +157,7 @@ bool SDLGraphics::drawRescaledImage(const Image *const image, &srcRect, &dstRect) < 0); } -bool SDLGraphics::drawImage2(const Image *const image, +bool SDLGraphics::drawImage(const Image *const image, int dstX, int dstY) { return drawImageInline(image, dstX, dstY); @@ -166,7 +166,7 @@ bool SDLGraphics::drawImage2(const Image *const image, bool SDLGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { - FUNC_BLOCK("Graphics::drawImage2", 1) + FUNC_BLOCK("Graphics::drawImage", 1) // Check that preconditions for blitting are met. if (!mWindow || !image || !image->mTexture) return false; diff --git a/src/render/sdl2graphics.h b/src/render/sdl2graphics.h index cce15e270..6631e53f4 100644 --- a/src/render/sdl2graphics.h +++ b/src/render/sdl2graphics.h @@ -182,8 +182,8 @@ class SDLGraphics final : public Graphics void setRendererFlags(const uint32_t flags) { mRendererFlags = flags; } - bool drawImage2(const Image *const image, - int dstX, int dstY) override final; + bool drawImage(const Image *const image, + int dstX, int dstY) override final; void drawImageCached(const Image *const image, int x, int y) override final; diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp index 05b1fa2ef..016a9557e 100644 --- a/src/render/sdl2softwaregraphics.cpp +++ b/src/render/sdl2softwaregraphics.cpp @@ -109,7 +109,7 @@ bool SDL2SoftwareGraphics::drawRescaledImage(const Image *const image, return returnValue; } -bool SDL2SoftwareGraphics::drawImage2(const Image *const image, +bool SDL2SoftwareGraphics::drawImage(const Image *const image, int dstX, int dstY) { return drawImageInline(image, dstX, dstY); @@ -118,7 +118,7 @@ bool SDL2SoftwareGraphics::drawImage2(const Image *const image, bool SDL2SoftwareGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { - FUNC_BLOCK("Graphics::drawImage2", 1) + FUNC_BLOCK("Graphics::drawImage", 1) // Check that preconditions for blitting are met. if (!mSurface || !image || !image->mSDLSurface) return false; diff --git a/src/render/sdl2softwaregraphics.h b/src/render/sdl2softwaregraphics.h index 270536e11..1211de5eb 100644 --- a/src/render/sdl2softwaregraphics.h +++ b/src/render/sdl2softwaregraphics.h @@ -141,8 +141,8 @@ class SDL2SoftwareGraphics final : public Graphics bool resizeScreen(const int width, const int height) override final; - bool drawImage2(const Image *const image, - int dstX, int dstY) override final; + bool drawImage(const Image *const image, + int dstX, int dstY) override final; void drawImageCached(const Image *const image, int x, int y) override final; diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index 9694eb0fb..05c57a952 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -103,7 +103,7 @@ bool SDLGraphics::drawRescaledImage(const Image *const image, return returnValue; } -bool SDLGraphics::drawImage2(const Image *const image, +bool SDLGraphics::drawImage(const Image *const image, int dstX, int dstY) { return drawImageInline(image, dstX, dstY); @@ -112,7 +112,7 @@ bool SDLGraphics::drawImage2(const Image *const image, bool SDLGraphics::drawImageInline(const Image *const image, int dstX, int dstY) { - FUNC_BLOCK("Graphics::drawImage2", 1) + FUNC_BLOCK("Graphics::drawImage", 1) // Check that preconditions for blitting are met. if (!mWindow || !image || !image->mSDLSurface) return false; diff --git a/src/render/sdlgraphics.h b/src/render/sdlgraphics.h index f5ca099de..c8565f4be 100644 --- a/src/render/sdlgraphics.h +++ b/src/render/sdlgraphics.h @@ -136,8 +136,8 @@ class SDLGraphics final : public Graphics const bool resize, const bool noFrame) override final; - bool drawImage2(const Image *const image, - int dstX, int dstY) override final; + bool drawImage(const Image *const image, + int dstX, int dstY) override final; void drawImageCached(const Image *const image, int x, int y) override final; diff --git a/src/render/surfacegraphics.cpp b/src/render/surfacegraphics.cpp index 8834bb171..d9cb03136 100644 --- a/src/render/surfacegraphics.cpp +++ b/src/render/surfacegraphics.cpp @@ -42,10 +42,10 @@ SurfaceGraphics::~SurfaceGraphics() { } -bool SurfaceGraphics::drawImage2(const Image *const image, +bool SurfaceGraphics::drawImage(const Image *const image, int dstX, int dstY) { - FUNC_BLOCK("Graphics::drawImage2", 1) + FUNC_BLOCK("Graphics::drawImage", 1) // Check that preconditions for blitting are met. if (!mTarget || !image || !image->mSDLSurface) return false; diff --git a/src/render/surfacegraphics.h b/src/render/surfacegraphics.h index cadd19876..89de995ee 100644 --- a/src/render/surfacegraphics.h +++ b/src/render/surfacegraphics.h @@ -179,8 +179,8 @@ class SurfaceGraphics final : public Graphics const bool noFrame A_UNUSED) override final { return false; } - bool drawImage2(const Image *const image, - int dstX, int dstY) override final; + bool drawImage(const Image *const image, + int dstX, int dstY) override final; void drawImageCached(const Image *const image, int x, int y) override final; diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp index 71a6382dc..870de40a9 100644 --- a/src/resources/atlasmanager.cpp +++ b/src/resources/atlasmanager.cpp @@ -250,7 +250,7 @@ SDL_Surface *AtlasManager::createSDLAtlas(TextureAtlas *const atlas) #else SDL_SetAlpha(image->mSDLSurface, 0, SDL_ALPHA_OPAQUE); #endif - graphics->drawImage2(image, item->x, item->y); + graphics->drawImage(image, item->x, item->y); } } } diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp index 1409146df..075c98c06 100644 --- a/src/simpleanimation.cpp +++ b/src/simpleanimation.cpp @@ -78,8 +78,9 @@ void SimpleAnimation::draw(Graphics *const graphics, if (!mCurrentFrame || !mCurrentFrame->image) return; - graphics->drawImage2(mCurrentFrame->image, - posX + mCurrentFrame->offsetX, posY + mCurrentFrame->offsetY); + graphics->drawImage(mCurrentFrame->image, + posX + mCurrentFrame->offsetX, + posY + mCurrentFrame->offsetY); } void SimpleAnimation::reset() diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index a0e4f98dc..584bdb5cb 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -94,7 +94,7 @@ int TestLauncher::testBackend() const for (int f = 0; f < cnt; f ++) { - mainGraphics->drawImage2(img, cnt * 7, cnt * 5); + mainGraphics->drawImage(img, cnt * 7, cnt * 5); mainGraphics->updateScreen(); } @@ -152,11 +152,11 @@ int TestLauncher::testFps() { for (int y = 0; y < 600; y += 50) { - mainGraphics->drawImage2(img[idx], x, y); + mainGraphics->drawImage(img[idx], x, y); idx ++; if (idx > sz) idx = 0; - mainGraphics->drawImage2(img[idx], x, y); + mainGraphics->drawImage(img[idx], x, y); idx ++; if (idx > sz) idx = 0; @@ -211,9 +211,9 @@ int TestLauncher::testInternal() { for (int y = 0; y < 600; y += 25) { - mainGraphics->drawImage2(img[idx], x, y); - mainGraphics->drawImage2(img[idx], x + 1, y); - mainGraphics->drawImage2(img[idx], x, y + 5); + mainGraphics->drawImage(img[idx], x, y); + mainGraphics->drawImage(img[idx], x + 1, y); + mainGraphics->drawImage(img[idx], x, y + 5); idx ++; if (idx > 3) diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp index f560b8817..bb222c3e8 100644 --- a/src/touchmanager.cpp +++ b/src/touchmanager.cpp @@ -232,7 +232,7 @@ void TouchManager::draw() const Image *const icon = item->icon; if (icon) { - mainGraphics->drawImage2(icon, + mainGraphics->drawImage(icon, item->x + (item->width - icon->mBounds.w) / 2, item->y + (item->height - icon->mBounds.h) / 2); } -- cgit v1.2.3-70-g09d2