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/browserbox.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gui/widgets/browserbox.h') diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 09f06bc39..deefd886a 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -26,8 +26,8 @@ #include "gui/widgets/widget2.h" -#include -#include +#include "gui/base/mouselistener.hpp" +#include "gui/base/widget.hpp" #include #include -- 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/browserbox.h') 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 9093f12ebbfbdacb3df7a5f5fcdda422daa22754 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Feb 2014 00:12:40 +0300 Subject: move mouselistener from base into listeners. --- src/CMakeLists.txt | 2 +- src/Makefile.am | 2 +- src/gui/base/gui.cpp | 2 +- src/gui/base/mouselistener.hpp | 196 ---------------------------------- src/gui/base/widget.cpp | 2 +- src/gui/base/widget.hpp | 2 +- src/gui/base/widgets/button.cpp | 4 +- src/gui/base/widgets/button.hpp | 2 +- src/gui/base/widgets/checkbox.cpp | 4 +- src/gui/base/widgets/checkbox.hpp | 2 +- src/gui/base/widgets/listbox.cpp | 4 +- src/gui/base/widgets/listbox.hpp | 2 +- src/gui/base/widgets/radiobutton.cpp | 4 +- src/gui/base/widgets/radiobutton.hpp | 2 +- src/gui/base/widgets/scrollarea.cpp | 6 +- src/gui/base/widgets/scrollarea.hpp | 2 +- src/gui/base/widgets/slider.cpp | 4 +- src/gui/base/widgets/slider.hpp | 2 +- src/gui/base/widgets/textbox.cpp | 4 +- src/gui/base/widgets/textbox.hpp | 2 +- src/gui/base/widgets/textfield.cpp | 4 +- src/gui/base/widgets/textfield.hpp | 2 +- src/gui/base/widgets/window.cpp | 4 +- src/gui/base/widgets/window.hpp | 3 +- src/gui/gui.cpp | 4 +- src/gui/viewport.cpp | 2 +- src/gui/viewport.h | 4 +- src/gui/widgets/browserbox.cpp | 2 +- src/gui/widgets/browserbox.h | 4 +- src/gui/widgets/characterdisplay.cpp | 2 +- src/gui/widgets/characterdisplay.h | 2 +- src/gui/widgets/dropdown.cpp | 2 +- src/gui/widgets/dropdown.h | 4 +- src/gui/widgets/emotepage.cpp | 2 +- src/gui/widgets/emotepage.h | 7 +- src/gui/widgets/guitable.cpp | 2 +- src/gui/widgets/guitable.h | 4 +- src/gui/widgets/itemcontainer.cpp | 2 +- src/gui/widgets/itemcontainer.h | 4 +- src/gui/widgets/linkhandler.h | 2 +- src/gui/widgets/popup.cpp | 2 +- src/gui/widgets/popup.h | 5 +- src/gui/widgets/shortcutcontainer.cpp | 2 +- src/gui/widgets/shortcutcontainer.h | 4 +- src/gui/widgets/sliderlist.cpp | 2 +- src/gui/widgets/sliderlist.h | 4 +- src/gui/widgets/tabbedarea.cpp | 2 +- src/gui/widgets/tabbedarea.h | 4 +- src/gui/widgets/tabs/tab.cpp | 2 +- src/gui/widgets/tabs/tab.h | 5 +- src/gui/windowmenu.cpp | 2 +- src/gui/windowmenu.h | 2 +- src/listeners/mouselistener.h | 193 +++++++++++++++++++++++++++++++++ 53 files changed, 271 insertions(+), 270 deletions(-) delete mode 100644 src/gui/base/mouselistener.hpp create mode 100644 src/listeners/mouselistener.h (limited to 'src/gui/widgets/browserbox.h') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 324e65cac..edfdec695 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -790,7 +790,7 @@ SET(SRCS gui/base/listmodel.hpp gui/base/mouseevent.hpp gui/base/mouseinput.hpp - gui/base/mouselistener.hpp + listeners/mouselistener.h gui/base/rectangle.hpp gui/base/selectionevent.hpp gui/base/selectionlistener.hpp diff --git a/src/Makefile.am b/src/Makefile.am index da16e98d7..f6787bcff 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -178,7 +178,7 @@ manaplus_SOURCES += gui/base/actionevent.hpp \ gui/base/listmodel.hpp \ gui/base/mouseevent.hpp \ gui/base/mouseinput.hpp \ - gui/base/mouselistener.hpp \ + listeners/mouselistener.hpp \ gui/base/rectangle.hpp \ gui/base/selectionevent.hpp \ gui/base/selectionlistener.hpp \ diff --git a/src/gui/base/gui.cpp b/src/gui/base/gui.cpp index e85a17d97..f16048bbb 100644 --- a/src/gui/base/gui.cpp +++ b/src/gui/base/gui.cpp @@ -76,7 +76,7 @@ #include "gui/base/widget.hpp" #include "listeners/keylistener.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "render/graphics.h" diff --git a/src/gui/base/mouselistener.hpp b/src/gui/base/mouselistener.hpp deleted file mode 100644 index 32486e56f..000000000 --- a/src/gui/base/mouselistener.hpp +++ /dev/null @@ -1,196 +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_MOUSELISTENER_HPP -#define GCN_MOUSELISTENER_HPP - -#include "gui/base/mouseevent.hpp" - -#include "localconsts.h" - -namespace gcn -{ - /** - * Interface for listening for mouse events from widgets. - * - * @see Widget::addMouseListener, Widget::removeMouseListener - * @since 0.1.0 - */ - class MouseListener - { - public: - /** - * Destructor. - */ - virtual ~MouseListener() - { } - - /** - * Called when the mouse has entered into the widget area. - * - * @param mouseEvent Describes the event. - * @since 0.6.0 - */ - virtual void mouseEntered(MouseEvent& mouseEvent A_UNUSED) - { - } - - /** - * Called when the mouse has exited the widget area. - * - * @param mouseEvent Describes the event. - * @since 0.6.0 - */ - virtual void mouseExited(MouseEvent& mouseEvent A_UNUSED) - { - } - - /** - * Called when a mouse button has been pressed on the widget area. - * - * NOTE: A mouse press is NOT equal to a mouse click. - * Use mouseClickMessage to check for mouse clicks. - * - * @param mouseEvent Describes the event. - * @since 0.6.0 - */ - virtual void mousePressed(MouseEvent& mouseEvent A_UNUSED) - { - } - - /** - * Called when a mouse button has been released on the widget area. - * - * @param mouseEvent Describes the event. - * @since 0.6.0 - */ - virtual void mouseReleased(MouseEvent& mouseEvent A_UNUSED) - { - } - - /** - * Called when a mouse button is pressed and released (clicked) on - * the widget area. - * - * @param mouseEvent Describes the event. - * @since 0.6.0 - */ - virtual void mouseClicked(MouseEvent& mouseEvent A_UNUSED) - { - } - - /** - * Called when the mouse wheel has moved up on the widget area. - * - * @param mouseEvent Describes the event. - * @since 0.6.0 - */ - virtual void mouseWheelMovedUp(MouseEvent& mouseEvent A_UNUSED) - { - } - - /** - * Called when the mouse wheel has moved down on the widget area. - * - * @param mousEvent Describes the event. - * @since 0.6.0 - */ - virtual void mouseWheelMovedDown(MouseEvent& mouseEvent A_UNUSED) - { - } - - /** - * Called when the mouse has moved in the widget area and no mouse button - * has been pressed (i.e no widget is being dragged). - * - * @param mouseEvent Describes the event. - * @since 0.6.0 - */ - virtual void mouseMoved(MouseEvent& mouseEvent A_UNUSED) - { - } - - /** - * Called when the mouse has moved and the mouse has previously been - * pressed on the widget. - * - * @param mouseEvent Describes the event. - * @since 0.6.0 - */ - virtual void mouseDragged(MouseEvent& mouseEvent A_UNUSED) - { - } - - protected: - /** - * Constructor. - * - * You should not be able to make an instance of MouseListener, - * therefore its constructor is protected. - */ - MouseListener() - { } - }; -} // namespace gcn - -#endif // end GCN_MOUSELISTENER_HPP diff --git a/src/gui/base/widget.cpp b/src/gui/base/widget.cpp index c72a06e8b..b05a0d5b1 100644 --- a/src/gui/base/widget.cpp +++ b/src/gui/base/widget.cpp @@ -78,7 +78,7 @@ #include "listeners/deathlistener.h" #include "listeners/keylistener.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/widgetlistener.hpp" #include "render/graphics.h" diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp index 583ade076..af04714f6 100644 --- a/src/gui/base/widget.hpp +++ b/src/gui/base/widget.hpp @@ -78,6 +78,7 @@ class DeathListener; class FocusListener; class Graphics; class KeyListener; +class MouseListener; namespace gcn { @@ -86,7 +87,6 @@ namespace gcn class Font; class KeyInput; class MouseInput; - class MouseListener; class WidgetListener; /** diff --git a/src/gui/base/widgets/button.cpp b/src/gui/base/widgets/button.cpp index 4631ed80f..7f1aea668 100644 --- a/src/gui/base/widgets/button.cpp +++ b/src/gui/base/widgets/button.cpp @@ -81,7 +81,7 @@ namespace gcn { Button::Button() : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), FocusListener(), mCaption(), @@ -102,7 +102,7 @@ namespace gcn Button::Button(const std::string& caption) : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), FocusListener(), mCaption(caption), diff --git a/src/gui/base/widgets/button.hpp b/src/gui/base/widgets/button.hpp index 779a75aa5..c81fec14f 100644 --- a/src/gui/base/widgets/button.hpp +++ b/src/gui/base/widgets/button.hpp @@ -68,7 +68,7 @@ #include "listeners/focuslistener.h" #include "listeners/keylistener.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/mouseevent.hpp" #include "gui/base/widget.hpp" diff --git a/src/gui/base/widgets/checkbox.cpp b/src/gui/base/widgets/checkbox.cpp index ceb59a1eb..5f2477b4d 100644 --- a/src/gui/base/widgets/checkbox.cpp +++ b/src/gui/base/widgets/checkbox.cpp @@ -80,7 +80,7 @@ namespace gcn CheckBox::CheckBox() : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), mSelected(false), mCaption() @@ -92,7 +92,7 @@ namespace gcn CheckBox::CheckBox(const std::string &caption, bool selected) : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), mSelected(selected), mCaption() diff --git a/src/gui/base/widgets/checkbox.hpp b/src/gui/base/widgets/checkbox.hpp index 4904a022f..c03187bba 100644 --- a/src/gui/base/widgets/checkbox.hpp +++ b/src/gui/base/widgets/checkbox.hpp @@ -67,7 +67,7 @@ #include #include "listeners/keylistener.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/widget.hpp" diff --git a/src/gui/base/widgets/listbox.cpp b/src/gui/base/widgets/listbox.cpp index 771f22f64..3ae4caa91 100644 --- a/src/gui/base/widgets/listbox.cpp +++ b/src/gui/base/widgets/listbox.cpp @@ -82,7 +82,7 @@ namespace gcn { ListBox::ListBox() : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), mSelected(-1), mListModel(nullptr), @@ -98,7 +98,7 @@ namespace gcn ListBox::ListBox(ListModel *listModel) : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), mSelected(-1), mListModel(listModel), diff --git a/src/gui/base/widgets/listbox.hpp b/src/gui/base/widgets/listbox.hpp index 11983262f..793aba840 100644 --- a/src/gui/base/widgets/listbox.hpp +++ b/src/gui/base/widgets/listbox.hpp @@ -70,7 +70,7 @@ #include "gui/base/widget.hpp" #include "listeners/keylistener.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" namespace gcn { diff --git a/src/gui/base/widgets/radiobutton.cpp b/src/gui/base/widgets/radiobutton.cpp index f7145fd55..e42773de1 100644 --- a/src/gui/base/widgets/radiobutton.cpp +++ b/src/gui/base/widgets/radiobutton.cpp @@ -81,7 +81,7 @@ namespace gcn RadioButton::RadioButton() : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), mSelected(false), mCaption(), @@ -98,7 +98,7 @@ namespace gcn const std::string &group, bool selected) : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), mSelected(false), mCaption(), diff --git a/src/gui/base/widgets/radiobutton.hpp b/src/gui/base/widgets/radiobutton.hpp index 98b562676..8a9a8b585 100644 --- a/src/gui/base/widgets/radiobutton.hpp +++ b/src/gui/base/widgets/radiobutton.hpp @@ -68,7 +68,7 @@ #include #include "listeners/keylistener.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/widget.hpp" diff --git a/src/gui/base/widgets/scrollarea.cpp b/src/gui/base/widgets/scrollarea.cpp index 308cee473..ffcaffdb1 100644 --- a/src/gui/base/widgets/scrollarea.cpp +++ b/src/gui/base/widgets/scrollarea.cpp @@ -77,7 +77,7 @@ namespace gcn { ScrollArea::ScrollArea() : gcn::BasicContainer(), - gcn::MouseListener(), + MouseListener(), mVScroll(0), mHScroll(0), mScrollbarWidth(12), @@ -104,7 +104,7 @@ namespace gcn ScrollArea::ScrollArea(Widget *const content) : gcn::BasicContainer(), - gcn::MouseListener(), + MouseListener(), mVScroll(0), mHScroll(0), mScrollbarWidth(12), @@ -134,7 +134,7 @@ namespace gcn ScrollPolicy hPolicy, ScrollPolicy vPolicy) : gcn::BasicContainer(), - gcn::MouseListener(), + MouseListener(), mVScroll(0), mHScroll(0), mScrollbarWidth(12), diff --git a/src/gui/base/widgets/scrollarea.hpp b/src/gui/base/widgets/scrollarea.hpp index e75390ec0..1d4c0dd54 100644 --- a/src/gui/base/widgets/scrollarea.hpp +++ b/src/gui/base/widgets/scrollarea.hpp @@ -67,7 +67,7 @@ #include #include "gui/base/basiccontainer.hpp" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" namespace gcn { diff --git a/src/gui/base/widgets/slider.cpp b/src/gui/base/widgets/slider.cpp index 2a3fb8c24..91c054e7d 100644 --- a/src/gui/base/widgets/slider.cpp +++ b/src/gui/base/widgets/slider.cpp @@ -78,7 +78,7 @@ namespace gcn { Slider::Slider(const double scaleEnd) : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), mDragged(false), mValue(0), @@ -97,7 +97,7 @@ namespace gcn Slider::Slider(const double scaleStart, const double scaleEnd) : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), mDragged(false), mValue(scaleStart), diff --git a/src/gui/base/widgets/slider.hpp b/src/gui/base/widgets/slider.hpp index fa047a739..f77d3f5dd 100644 --- a/src/gui/base/widgets/slider.hpp +++ b/src/gui/base/widgets/slider.hpp @@ -65,7 +65,7 @@ #define GCN_SLIDER_HPP #include "listeners/keylistener.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/widget.hpp" diff --git a/src/gui/base/widgets/textbox.cpp b/src/gui/base/widgets/textbox.cpp index c146c4f08..06d0e6379 100644 --- a/src/gui/base/widgets/textbox.cpp +++ b/src/gui/base/widgets/textbox.cpp @@ -80,7 +80,7 @@ namespace gcn { TextBox::TextBox() : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), mTextRows(), mCaretColumn(0), @@ -98,7 +98,7 @@ namespace gcn TextBox::TextBox(const std::string& text) : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), mTextRows(), mCaretColumn(0), diff --git a/src/gui/base/widgets/textbox.hpp b/src/gui/base/widgets/textbox.hpp index 894616360..8fc788816 100644 --- a/src/gui/base/widgets/textbox.hpp +++ b/src/gui/base/widgets/textbox.hpp @@ -69,7 +69,7 @@ #include #include "listeners/keylistener.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/widget.hpp" diff --git a/src/gui/base/widgets/textfield.cpp b/src/gui/base/widgets/textfield.cpp index 178a012b7..df1b844d4 100644 --- a/src/gui/base/widgets/textfield.cpp +++ b/src/gui/base/widgets/textfield.cpp @@ -79,7 +79,7 @@ namespace gcn { TextField::TextField() : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), mText(), mCaretPosition(0), @@ -93,7 +93,7 @@ namespace gcn TextField::TextField(const std::string& text) : gcn::Widget(), - gcn::MouseListener(), + MouseListener(), KeyListener(), mText(text), mCaretPosition(0), diff --git a/src/gui/base/widgets/textfield.hpp b/src/gui/base/widgets/textfield.hpp index 56d60b7aa..099ed1356 100644 --- a/src/gui/base/widgets/textfield.hpp +++ b/src/gui/base/widgets/textfield.hpp @@ -65,7 +65,7 @@ #define GCN_TEXTFIELD_HPP #include "listeners/keylistener.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/widget.hpp" diff --git a/src/gui/base/widgets/window.cpp b/src/gui/base/widgets/window.cpp index 6373bcb63..02611f819 100644 --- a/src/gui/base/widgets/window.cpp +++ b/src/gui/base/widgets/window.cpp @@ -79,7 +79,7 @@ namespace gcn { Window::Window() : Container(), - gcn::MouseListener(), + MouseListener(), mCaption(), mAlignment(Graphics::CENTER), mPadding(2), @@ -96,7 +96,7 @@ namespace gcn Window::Window(const std::string& caption) : Container(), - gcn::MouseListener(), + MouseListener(), mCaption(caption), mAlignment(Graphics::CENTER), mPadding(2), diff --git a/src/gui/base/widgets/window.hpp b/src/gui/base/widgets/window.hpp index 9c7e6bcbf..030d57edc 100644 --- a/src/gui/base/widgets/window.hpp +++ b/src/gui/base/widgets/window.hpp @@ -66,7 +66,8 @@ #include -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" + #include "gui/base/widgets/container.hpp" namespace gcn diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index a398ca427..bced937c7 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -697,11 +697,11 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button, mouseEvent.setX(x - widgetX); mouseEvent.setY(y - widgetY); - std::list mouseListeners + std::list mouseListeners = widget->_getMouseListeners(); // Send the event to all mouse listeners of the widget. - for (std::list::const_iterator + for (std::list::const_iterator it = mouseListeners.begin(); it != mouseListeners.end(); ++ it) { diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 2a91d1991..b3cafa104 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -51,7 +51,7 @@ extern MiniStatusWindow *miniStatusWindow; Viewport::Viewport() : WindowContainer(nullptr), - gcn::MouseListener(), + MouseListener(), mMap(nullptr), mScrollRadius(config.getIntValue("ScrollRadius")), mScrollLaziness(config.getIntValue("ScrollLaziness")), diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 9adaa6c18..6fd062c35 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -29,7 +29,7 @@ #include "gui/widgets/windowcontainer.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" class ActorSprite; class Button; @@ -60,7 +60,7 @@ const int walkingMouseDelay = 500; * coordinates. */ class Viewport final : public WindowContainer, - public gcn::MouseListener, + public MouseListener, public ConfigListener { public: diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 024dde9c8..cfbc0ec41 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -55,7 +55,7 @@ BrowserBox::BrowserBox(const Widget2 *const widget, const std::string &skin) : gcn::Widget(), Widget2(widget), - gcn::MouseListener(), + MouseListener(), mTextRows(), mTextRowLinksCount(), mLineParts(), diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 85ce9b96b..fa3b90963 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -26,7 +26,7 @@ #include "gui/widgets/widget2.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/widget.hpp" #include @@ -104,7 +104,7 @@ class LinePart final */ class BrowserBox final : public gcn::Widget, public Widget2, - public gcn::MouseListener + public MouseListener { public: /** diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp index 5ae4e2f5b..54cb3b28d 100644 --- a/src/gui/widgets/characterdisplay.cpp +++ b/src/gui/widgets/characterdisplay.cpp @@ -40,7 +40,7 @@ CharacterDisplay::CharacterDisplay(const Widget2 *const widget, CharSelectDialog *const charSelectDialog) : Container(widget), - gcn::MouseListener(), + MouseListener(), gcn::WidgetListener(), mCharacter(nullptr), mPlayerBox(new PlayerBox(nullptr)), diff --git a/src/gui/widgets/characterdisplay.h b/src/gui/widgets/characterdisplay.h index ebb0d46da..0352a91a0 100644 --- a/src/gui/widgets/characterdisplay.h +++ b/src/gui/widgets/characterdisplay.h @@ -38,7 +38,7 @@ class Label; class TextPopup; class CharacterDisplay final : public Container, - public gcn::MouseListener, + public MouseListener, public gcn::WidgetListener { public: diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index e4e38aa90..efb3235a4 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -59,7 +59,7 @@ DropDown::DropDown(const Widget2 *const widget, ActionListener(), gcn::BasicContainer(), KeyListener(), - gcn::MouseListener(), + MouseListener(), FocusListener(), gcn::SelectionListener(), Widget2(widget), diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 525ce83e3..7d645a478 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -31,7 +31,7 @@ #include "listeners/actionlistener.h" #include "listeners/focuslistener.h" #include "listeners/keylistener.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/selectionlistener.hpp" #include "localconsts.h" @@ -53,7 +53,7 @@ class Skin; class DropDown final : public ActionListener, public gcn::BasicContainer, public KeyListener, - public gcn::MouseListener, + public MouseListener, public FocusListener, public gcn::SelectionListener, public Widget2 diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index 6101c20ae..c086cd463 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -36,7 +36,7 @@ namespace EmotePage::EmotePage(const Widget2 *const widget) : gcn::Widget(), Widget2(widget), - gcn::MouseListener(), + MouseListener(), gcn::WidgetListener(), mEmotes(ResourceManager::getInstance()->getImageSet( "graphics/sprites/chatemotes.png", emoteWidth, emoteHeight)), diff --git a/src/gui/widgets/emotepage.h b/src/gui/widgets/emotepage.h index 9cd2867aa..c773d9a66 100644 --- a/src/gui/widgets/emotepage.h +++ b/src/gui/widgets/emotepage.h @@ -23,15 +23,16 @@ #include "gui/widgets/widget2.h" -#include "gui/base/mouselistener.hpp" -#include "gui/base/widget.hpp" +#include "listeners/mouselistener.h" #include "gui/base/widgetlistener.hpp" +#include "gui/base/widget.hpp" + #include "localconsts.h" class EmotePage final : public gcn::Widget, public Widget2, - public gcn::MouseListener, + public MouseListener, public gcn::WidgetListener { public: diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index fff2416bf..3d987ed63 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -96,7 +96,7 @@ GuiTable::GuiTable(const Widget2 *const widget, TableModel *const initial_model, const bool opacity) : gcn::Widget(), Widget2(widget), - gcn::MouseListener(), + MouseListener(), KeyListener(), mModel(nullptr), mTopWidget(nullptr), diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index 8d551de2b..a751cac59 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -29,7 +29,7 @@ #include "gui/widgets/widget2.h" #include "listeners/keylistener.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/widget.hpp" @@ -48,7 +48,7 @@ class GuiTableActionListener; */ class GuiTable final : public gcn::Widget, public Widget2, - public gcn::MouseListener, + public MouseListener, public KeyListener, public TableModelListener { diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 4fa8a2705..40c87d272 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -161,7 +161,7 @@ ItemContainer::ItemContainer(const Widget2 *const widget, gcn::Widget(), Widget2(widget), KeyListener(), - gcn::MouseListener(), + MouseListener(), gcn::WidgetListener(), mInventory(inventory), mSelImg(Theme::getImageFromThemeXml("item_selection.xml", "")), diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index 7757fa65c..77d7e1c28 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -26,7 +26,7 @@ #include "gui/widgets/widget2.h" #include "listeners/keylistener.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/widgetlistener.hpp" #include "gui/base/widget.hpp" @@ -53,7 +53,7 @@ namespace gcn class ItemContainer final : public gcn::Widget, public Widget2, public KeyListener, - public gcn::MouseListener, + public MouseListener, public gcn::WidgetListener { public: diff --git a/src/gui/widgets/linkhandler.h b/src/gui/widgets/linkhandler.h index f79f1bf50..2f3a6e53f 100644 --- a/src/gui/widgets/linkhandler.h +++ b/src/gui/widgets/linkhandler.h @@ -25,7 +25,7 @@ #include -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" /** * A simple interface to windows that need to handle links from BrowserBox diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index c1319737e..a4908c23b 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -34,7 +34,7 @@ Popup::Popup(const std::string &name, std::string skin) : Container(nullptr), - gcn::MouseListener(), + MouseListener(), gcn::WidgetListener(), mPadding(3), mSkin(nullptr), diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index f0fd1b932..d09331136 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -26,7 +26,7 @@ #include "gui/widgets/container.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/widgetlistener.hpp" class ImageCollection; @@ -45,7 +45,8 @@ class WindowContainer; * * \ingroup GUI */ -class Popup : public Container, public gcn::MouseListener, +class Popup : public Container, + public MouseListener, public gcn::WidgetListener { public: diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index a3030b035..dcb7d1138 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -32,7 +32,7 @@ ShortcutContainer::ShortcutContainer() : gcn::Widget(), Widget2(), gcn::WidgetListener(), - gcn::MouseListener(), + MouseListener(), mBackgroundImg(nullptr), mMaxItems(0), mBoxWidth(1), diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index 4d4ff2389..1d734de6a 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -25,7 +25,7 @@ #include "gui/widgets/widget2.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/widget.hpp" #include "gui/base/widgetlistener.hpp" @@ -40,7 +40,7 @@ class ImageCollection; class ShortcutContainer : public gcn::Widget, public Widget2, public gcn::WidgetListener, - public gcn::MouseListener + public MouseListener { public: A_DELETE_COPY(ShortcutContainer) diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index 0ae0890dc..d70977ff3 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -37,7 +37,7 @@ SliderList::SliderList(const Widget2 *const widget, gcn::ListModel *const listModel) : Container(widget), ActionListener(), - gcn::MouseListener(), + MouseListener(), mLabel(new Label(this)), mListModel(listModel), mPrevEventId(), diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h index 3d86f8735..144fa0cf1 100644 --- a/src/gui/widgets/sliderlist.h +++ b/src/gui/widgets/sliderlist.h @@ -22,9 +22,9 @@ #define GUI_WIDGETS_SLIDERLIST_H #include "gui/base/listmodel.hpp" -#include "gui/base/mouselistener.hpp" #include "listeners/actionlistener.h" +#include "listeners/mouselistener.h" #include "gui/widgets/container.h" @@ -35,7 +35,7 @@ class Label; class SliderList final : public Container, public ActionListener, - public gcn::MouseListener + public MouseListener { public: SliderList(const Widget2 *const widget, diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 8841560e2..2c431c452 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -38,7 +38,7 @@ TabbedArea::TabbedArea(const Widget2 *const widget) : ActionListener(), gcn::BasicContainer(), KeyListener(), - gcn::MouseListener(), + MouseListener(), gcn::WidgetListener(), mSelectedTab(nullptr), mTabContainer(new gcn::Container()), diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 03a9f6868..b8b075ade 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -26,7 +26,7 @@ #include "gui/widgets/widget2.h" #include "listeners/keylistener.h" -#include "gui/base/mouselistener.hpp" +#include "listeners/mouselistener.h" #include "gui/base/widgetlistener.hpp" #include "gui/base/widgets/container.hpp" @@ -44,7 +44,7 @@ class TabbedArea final : public Widget2, public ActionListener, public gcn::BasicContainer, public KeyListener, - public gcn::MouseListener, + public MouseListener, public gcn::WidgetListener { public: diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index bba1ef7b6..877329cf8 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -46,7 +46,7 @@ Skin *Tab::tabImg[Tab::TAB_COUNT]; Tab::Tab(const Widget2 *const widget) : gcn::BasicContainer(), Widget2(widget), - gcn::MouseListener(), + MouseListener(), gcn::WidgetListener(), mLabel(new Label(this)), mTabbedArea(nullptr), diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h index 66f7521d9..a67025842 100644 --- a/src/gui/widgets/tabs/tab.h +++ b/src/gui/widgets/tabs/tab.h @@ -26,7 +26,8 @@ #include "gui/widgets/widget2.h" #include "gui/base/basiccontainer.hpp" -#include "gui/base/mouselistener.hpp" + +#include "listeners/mouselistener.h" #include "gui/base/widgetlistener.hpp" #include "localconsts.h" @@ -41,7 +42,7 @@ class TabbedArea; */ class Tab : public gcn::BasicContainer, public Widget2, - public gcn::MouseListener, + public MouseListener, public gcn::WidgetListener { public: diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 3ef3e73ce..aeef201e7 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -46,7 +46,7 @@ WindowMenu::WindowMenu(const Widget2 *const widget) : Container(widget), ActionListener(), gcn::SelectionListener(), - gcn::MouseListener(), + MouseListener(), mSkin(Theme::instance() ? Theme::instance()->load("windowmenu.xml", "") : nullptr), mPadding(mSkin ? mSkin->getPadding() : 1), diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h index d7e16e7fa..0b613fce9 100644 --- a/src/gui/windowmenu.h +++ b/src/gui/windowmenu.h @@ -79,7 +79,7 @@ class WindowMenu final : public Container, public ConfigListener, public ActionListener, public gcn::SelectionListener, - public gcn::MouseListener + public MouseListener { public: explicit WindowMenu(const Widget2 *const widget); diff --git a/src/listeners/mouselistener.h b/src/listeners/mouselistener.h new file mode 100644 index 000000000..e95d2ca01 --- /dev/null +++ b/src/listeners/mouselistener.h @@ -0,0 +1,193 @@ +/* + * 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_MOUSELISTENER_HPP +#define GCN_MOUSELISTENER_HPP + +#include "gui/base/mouseevent.hpp" + +#include "localconsts.h" + +/** + * Interface for listening for mouse events from widgets. + * + * @see Widget::addMouseListener, Widget::removeMouseListener + * @since 0.1.0 + */ +class MouseListener +{ + public: + /** + * Destructor. + */ + virtual ~MouseListener() + { } + + /** + * Called when the mouse has entered into the widget area. + * + * @param mouseEvent Describes the event. + * @since 0.6.0 + */ + virtual void mouseEntered(gcn::MouseEvent &mouseEvent A_UNUSED) + { + } + + /** + * Called when the mouse has exited the widget area. + * + * @param mouseEvent Describes the event. + * @since 0.6.0 + */ + virtual void mouseExited(gcn::MouseEvent &mouseEvent A_UNUSED) + { + } + + /** + * Called when a mouse button has been pressed on the widget area. + * + * NOTE: A mouse press is NOT equal to a mouse click. + * Use mouseClickMessage to check for mouse clicks. + * + * @param mouseEvent Describes the event. + * @since 0.6.0 + */ + virtual void mousePressed(gcn::MouseEvent &mouseEvent A_UNUSED) + { + } + + /** + * Called when a mouse button has been released on the widget area. + * + * @param mouseEvent Describes the event. + * @since 0.6.0 + */ + virtual void mouseReleased(gcn::MouseEvent &mouseEvent A_UNUSED) + { + } + + /** + * Called when a mouse button is pressed and released (clicked) on + * the widget area. + * + * @param mouseEvent Describes the event. + * @since 0.6.0 + */ + virtual void mouseClicked(gcn::MouseEvent &mouseEvent A_UNUSED) + { + } + + /** + * Called when the mouse wheel has moved up on the widget area. + * + * @param mouseEvent Describes the event. + * @since 0.6.0 + */ + virtual void mouseWheelMovedUp(gcn::MouseEvent &mouseEvent A_UNUSED) + { + } + + /** + * Called when the mouse wheel has moved down on the widget area. + * + * @param mousEvent Describes the event. + * @since 0.6.0 + */ + virtual void mouseWheelMovedDown(gcn::MouseEvent &mouseEvent A_UNUSED) + { + } + + /** + * Called when the mouse has moved in the widget area and no mouse button + * has been pressed (i.e no widget is being dragged). + * + * @param mouseEvent Describes the event. + * @since 0.6.0 + */ + virtual void mouseMoved(gcn::MouseEvent &mouseEvent A_UNUSED) + { + } + + /** + * Called when the mouse has moved and the mouse has previously been + * pressed on the widget. + * + * @param mouseEvent Describes the event. + * @since 0.6.0 + */ + virtual void mouseDragged(gcn::MouseEvent &mouseEvent A_UNUSED) + { + } + + protected: + /** + * Constructor. + * + * You should not be able to make an instance of MouseListener, + * therefore its constructor is protected. + */ + MouseListener() + { } +}; + +#endif // end GCN_MOUSELISTENER_HPP -- 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/browserbox.h') 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 f24b4360e73d45bc0830d2964c06e295890e5f18 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 18 Feb 2014 01:12:45 +0300 Subject: derive Widget from Widget2. --- src/gui/base/basiccontainer.hpp | 4 +++- src/gui/base/widget.cpp | 3 ++- src/gui/base/widget.hpp | 6 ++++-- src/gui/base/widgets/button.cpp | 9 +++++---- src/gui/base/widgets/button.hpp | 5 +++-- src/gui/base/widgets/checkbox.cpp | 10 ++++++---- src/gui/base/widgets/checkbox.hpp | 6 ++++-- src/gui/base/widgets/container.cpp | 4 ++-- src/gui/base/widgets/container.hpp | 2 +- src/gui/base/widgets/label.cpp | 9 +++++---- src/gui/base/widgets/label.hpp | 5 +++-- src/gui/base/widgets/listbox.cpp | 9 +++++---- src/gui/base/widgets/listbox.hpp | 5 +++-- src/gui/base/widgets/radiobutton.cpp | 9 +++++---- src/gui/base/widgets/radiobutton.hpp | 5 +++-- src/gui/base/widgets/scrollarea.cpp | 14 ++++++++------ src/gui/base/widgets/scrollarea.hpp | 8 +++++--- src/gui/base/widgets/slider.cpp | 11 +++++++---- src/gui/base/widgets/slider.hpp | 7 +++++-- src/gui/base/widgets/textbox.cpp | 9 +++++---- src/gui/base/widgets/textbox.hpp | 5 +++-- src/gui/base/widgets/textfield.cpp | 9 +++++---- src/gui/base/widgets/textfield.hpp | 5 +++-- src/gui/base/widgets/window.cpp | 9 +++++---- src/gui/base/widgets/window.hpp | 5 +++-- src/gui/popups/popupmenu.cpp | 2 +- src/gui/widgets/avatarlistbox.h | 6 ++++-- src/gui/widgets/browserbox.cpp | 3 +-- src/gui/widgets/browserbox.h | 1 - src/gui/widgets/button.cpp | 15 +++++---------- src/gui/widgets/button.h | 1 - src/gui/widgets/checkbox.cpp | 6 +++--- src/gui/widgets/checkbox.h | 3 +-- src/gui/widgets/container.cpp | 3 +-- src/gui/widgets/container.h | 3 +-- src/gui/widgets/dropdown.cpp | 3 +-- src/gui/widgets/dropdown.h | 3 +-- src/gui/widgets/emotepage.cpp | 3 +-- src/gui/widgets/emotepage.h | 1 - src/gui/widgets/flowcontainer.cpp | 3 ++- src/gui/widgets/flowcontainer.h | 3 ++- src/gui/widgets/guitable.cpp | 6 +++--- src/gui/widgets/guitable.h | 1 - src/gui/widgets/horizontcontainer.cpp | 3 ++- src/gui/widgets/horizontcontainer.h | 3 ++- src/gui/widgets/icon.cpp | 12 ++++++------ src/gui/widgets/icon.h | 9 +++++---- src/gui/widgets/inttextfield.cpp | 9 ++++++--- src/gui/widgets/inttextfield.h | 9 ++++++--- src/gui/widgets/itemcontainer.cpp | 3 +-- src/gui/widgets/itemcontainer.h | 1 - src/gui/widgets/label.cpp | 9 ++++----- src/gui/widgets/label.h | 5 +++-- src/gui/widgets/listbox.cpp | 3 +-- src/gui/widgets/listbox.h | 3 +-- src/gui/widgets/playerbox.cpp | 6 ++---- src/gui/widgets/playerbox.h | 3 +-- src/gui/widgets/popuplist.cpp | 2 +- src/gui/widgets/progressbar.cpp | 12 +++++++----- src/gui/widgets/progressbar.h | 10 ++++++---- src/gui/widgets/progressindicator.cpp | 3 +-- src/gui/widgets/progressindicator.h | 3 +-- src/gui/widgets/radiobutton.cpp | 3 +-- src/gui/widgets/radiobutton.h | 3 +-- src/gui/widgets/radiogroup.h | 3 ++- src/gui/widgets/scrollarea.cpp | 27 +-------------------------- src/gui/widgets/scrollarea.h | 17 ++++------------- src/gui/widgets/shortcutcontainer.cpp | 3 +-- src/gui/widgets/shortcutcontainer.h | 1 - src/gui/widgets/slider.cpp | 6 ++---- src/gui/widgets/slider.h | 3 +-- src/gui/widgets/tabbedarea.cpp | 7 +++---- src/gui/widgets/tabbedarea.h | 3 +-- src/gui/widgets/tabs/chattab.cpp | 5 +++-- src/gui/widgets/tabs/chattab.h | 3 ++- src/gui/widgets/tabs/guildchattab.h | 3 ++- src/gui/widgets/tabs/langtab.cpp | 3 ++- src/gui/widgets/tabs/langtab.h | 3 ++- src/gui/widgets/tabs/setup_colors.cpp | 5 +++-- src/gui/widgets/tabs/setup_input.cpp | 3 ++- src/gui/widgets/tabs/setup_relations.cpp | 2 +- src/gui/widgets/tabs/setup_video.cpp | 2 +- src/gui/widgets/tabs/setup_video.h | 3 ++- src/gui/widgets/tabs/setuptabscroll.cpp | 2 +- src/gui/widgets/tabs/tab.cpp | 3 +-- src/gui/widgets/tabs/tab.h | 1 - src/gui/widgets/tabs/whispertab.cpp | 3 ++- src/gui/widgets/tabs/whispertab.h | 3 ++- src/gui/widgets/tabstrip.cpp | 6 ++++-- src/gui/widgets/tabstrip.h | 6 ++++-- src/gui/widgets/textbox.cpp | 3 +-- src/gui/widgets/textbox.h | 3 +-- src/gui/widgets/textfield.cpp | 3 +-- src/gui/widgets/textfield.h | 3 +-- src/gui/widgets/textpreview.cpp | 3 +-- src/gui/widgets/textpreview.h | 6 +++--- src/gui/widgets/vertcontainer.cpp | 3 ++- src/gui/widgets/vertcontainer.h | 3 ++- src/gui/widgets/widgetgroup.cpp | 3 ++- src/gui/widgets/widgetgroup.h | 3 ++- src/gui/widgets/window.cpp | 3 +-- src/gui/widgets/window.h | 1 - src/gui/windows/botcheckerwindow.cpp | 2 +- src/gui/windows/buydialog.cpp | 2 +- src/gui/windows/didyouknowwindow.cpp | 2 +- src/gui/windows/helpwindow.cpp | 3 ++- src/gui/windows/inventorywindow.cpp | 4 ++-- src/gui/windows/npcdialog.cpp | 6 +++--- src/gui/windows/npcpostdialog.cpp | 2 +- src/gui/windows/questswindow.cpp | 4 ++-- src/gui/windows/selldialog.cpp | 2 +- src/gui/windows/serverdialog.cpp | 2 +- src/gui/windows/shopwindow.cpp | 4 ++-- src/gui/windows/shortcutwindow.cpp | 7 ++++--- src/gui/windows/skilldialog.cpp | 8 +++++--- src/gui/windows/socialwindow.cpp | 31 ++++++++++++++++++------------- src/gui/windows/statuswindow.cpp | 4 ++-- src/gui/windows/tradewindow.cpp | 5 +++-- src/gui/windows/updaterwindow.cpp | 3 ++- src/gui/windows/whoisonline.cpp | 2 +- src/gui/windows/worldselectdialog.cpp | 2 +- src/net/ea/gui/guildtab.h | 3 ++- src/net/ea/gui/partytab.h | 3 ++- 123 files changed, 311 insertions(+), 306 deletions(-) (limited to 'src/gui/widgets/browserbox.h') diff --git a/src/gui/base/basiccontainer.hpp b/src/gui/base/basiccontainer.hpp index 0fec2c0e7..cc3aee808 100644 --- a/src/gui/base/basiccontainer.hpp +++ b/src/gui/base/basiccontainer.hpp @@ -85,7 +85,9 @@ namespace gcn public DeathListener { public: - BasicContainer() : + BasicContainer(const Widget2 *const widget) : + Widget(widget), + DeathListener(), mWidgets() { } diff --git a/src/gui/base/widget.cpp b/src/gui/base/widget.cpp index 9e2912d39..f5994d1af 100644 --- a/src/gui/base/widget.cpp +++ b/src/gui/base/widget.cpp @@ -94,7 +94,8 @@ namespace gcn std::list Widget::mWidgets; std::set Widget::mWidgetsSet; - Widget::Widget() : + Widget::Widget(const Widget2 *const widget) : + Widget2(widget), mMouseListeners(), mKeyListeners(), mActionListeners(), diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp index 1c1c0ae14..013ead3b8 100644 --- a/src/gui/base/widget.hpp +++ b/src/gui/base/widget.hpp @@ -71,6 +71,8 @@ #include "gui/base/color.hpp" #include "gui/base/rectangle.hpp" +#include "gui/widgets/widget2.h" + #include "localconsts.h" class ActionListener; @@ -100,7 +102,7 @@ namespace gcn * @author Per Larsson. * @since 0.1.0 */ - class Widget + class Widget : public Widget2 { public: /** @@ -108,7 +110,7 @@ namespace gcn * focusable as default, therefore, widgets that are supposed to be * focusable should overide this default in their own constructor. */ - Widget(); + Widget(const Widget2 *const widget); A_DELETE_COPY(Widget) diff --git a/src/gui/base/widgets/button.cpp b/src/gui/base/widgets/button.cpp index 5867b9dc8..e4285cffd 100644 --- a/src/gui/base/widgets/button.cpp +++ b/src/gui/base/widgets/button.cpp @@ -80,8 +80,8 @@ namespace gcn { - Button::Button() : - gcn::Widget(), + Button::Button(const Widget2 *const widget) : + gcn::Widget(widget), MouseListener(), KeyListener(), FocusListener(), @@ -101,8 +101,9 @@ namespace gcn addFocusListener(this); } - Button::Button(const std::string& caption) : - gcn::Widget(), + Button::Button(const Widget2 *const widget, + const std::string& caption) : + gcn::Widget(widget), MouseListener(), KeyListener(), FocusListener(), diff --git a/src/gui/base/widgets/button.hpp b/src/gui/base/widgets/button.hpp index 6fee7f3b3..7fd5613bd 100644 --- a/src/gui/base/widgets/button.hpp +++ b/src/gui/base/widgets/button.hpp @@ -96,7 +96,7 @@ namespace gcn /** * Constructor. */ - Button(); + explicit Button(const Widget2 *const widget); /** * Constructor. The button will be automatically resized @@ -104,7 +104,8 @@ namespace gcn * * @param caption The caption of the button. */ - explicit Button(const std::string& caption); + Button(const Widget2 *const widget, + const std::string& caption); A_DELETE_COPY(Button) diff --git a/src/gui/base/widgets/checkbox.cpp b/src/gui/base/widgets/checkbox.cpp index 7cba5ac47..d75fb5cb0 100644 --- a/src/gui/base/widgets/checkbox.cpp +++ b/src/gui/base/widgets/checkbox.cpp @@ -79,8 +79,8 @@ namespace gcn { - CheckBox::CheckBox() : - gcn::Widget(), + CheckBox::CheckBox(const Widget2 *const widget) : + gcn::Widget(widget), MouseListener(), KeyListener(), mSelected(false), @@ -91,8 +91,10 @@ namespace gcn addKeyListener(this); } - CheckBox::CheckBox(const std::string &caption, bool selected) : - gcn::Widget(), + CheckBox::CheckBox(const Widget2 *const widget, + const std::string &caption, + bool selected) : + gcn::Widget(widget), MouseListener(), KeyListener(), mSelected(selected), diff --git a/src/gui/base/widgets/checkbox.hpp b/src/gui/base/widgets/checkbox.hpp index c03187bba..d87a6b206 100644 --- a/src/gui/base/widgets/checkbox.hpp +++ b/src/gui/base/widgets/checkbox.hpp @@ -90,7 +90,7 @@ namespace gcn /** * Contructor. */ - CheckBox(); + CheckBox(const Widget2 *const widget); /** * Constructor. The check box will be automatically resized @@ -99,7 +99,9 @@ namespace gcn * @param caption The caption of the check box. * @param marked True if the check box is selected, false otherwise. */ - CheckBox(const std::string &caption, bool selected = false); + CheckBox(const Widget2 *const widget, + const std::string &caption, + bool selected = false); A_DELETE_COPY(CheckBox) diff --git a/src/gui/base/widgets/container.cpp b/src/gui/base/widgets/container.cpp index 6026b920d..c79f8fcbc 100644 --- a/src/gui/base/widgets/container.cpp +++ b/src/gui/base/widgets/container.cpp @@ -75,8 +75,8 @@ namespace gcn { - Container::Container() : - BasicContainer(), + Container::Container(const Widget2 *const widget) : + BasicContainer(widget), mOpaque(true) { } diff --git a/src/gui/base/widgets/container.hpp b/src/gui/base/widgets/container.hpp index bffe6e884..ba3cff153 100644 --- a/src/gui/base/widgets/container.hpp +++ b/src/gui/base/widgets/container.hpp @@ -89,7 +89,7 @@ namespace gcn * * @see setOpaque, isOpaque */ - Container(); + Container(const Widget2 *const widget); /** * Destructor. diff --git a/src/gui/base/widgets/label.cpp b/src/gui/base/widgets/label.cpp index cbee2ac4c..84ba87d84 100644 --- a/src/gui/base/widgets/label.cpp +++ b/src/gui/base/widgets/label.cpp @@ -75,15 +75,16 @@ namespace gcn { - Label::Label() : - gcn::Widget(), + Label::Label(const Widget2 *const widget) : + gcn::Widget(widget), mCaption(), mAlignment(Graphics::LEFT) { } - Label::Label(const std::string& caption) : - gcn::Widget(), + Label::Label(const Widget2 *const widget, + const std::string& caption) : + gcn::Widget(widget), mCaption(caption), mAlignment(Graphics::LEFT) { diff --git a/src/gui/base/widgets/label.hpp b/src/gui/base/widgets/label.hpp index 90a395f7b..399e4202a 100644 --- a/src/gui/base/widgets/label.hpp +++ b/src/gui/base/widgets/label.hpp @@ -81,7 +81,7 @@ namespace gcn /** * Constructor. */ - Label(); + explicit Label(const Widget2 *const widget); /** * Constructor. The label will be automatically resized @@ -89,7 +89,8 @@ namespace gcn * * @param caption The caption of the label. */ - explicit Label(const std::string& caption); + Label(const Widget2 *const widget, + const std::string& caption); A_DELETE_COPY(Label) diff --git a/src/gui/base/widgets/listbox.cpp b/src/gui/base/widgets/listbox.cpp index ad1bf2535..0dd5c88f7 100644 --- a/src/gui/base/widgets/listbox.cpp +++ b/src/gui/base/widgets/listbox.cpp @@ -83,8 +83,8 @@ namespace gcn { - ListBox::ListBox() : - gcn::Widget(), + ListBox::ListBox(const Widget2 *const widget) : + gcn::Widget(widget), MouseListener(), KeyListener(), mSelected(-1), @@ -99,8 +99,9 @@ namespace gcn addKeyListener(this); } - ListBox::ListBox(ListModel *listModel) : - gcn::Widget(), + ListBox::ListBox(const Widget2 *const widget, + ListModel *listModel) : + gcn::Widget(widget), MouseListener(), KeyListener(), mSelected(-1), diff --git a/src/gui/base/widgets/listbox.hpp b/src/gui/base/widgets/listbox.hpp index 61c8486bb..ff2df395c 100644 --- a/src/gui/base/widgets/listbox.hpp +++ b/src/gui/base/widgets/listbox.hpp @@ -96,14 +96,15 @@ namespace gcn /** * Constructor. */ - ListBox(); + explicit ListBox(const Widget2 *const widget); /** * Constructor. * * @param listModel the list model to use. */ - explicit ListBox(ListModel *listModel); + ListBox(const Widget2 *const widget, + ListModel *listModel); A_DELETE_COPY(ListBox) diff --git a/src/gui/base/widgets/radiobutton.cpp b/src/gui/base/widgets/radiobutton.cpp index 4cd515bba..832c00bbe 100644 --- a/src/gui/base/widgets/radiobutton.cpp +++ b/src/gui/base/widgets/radiobutton.cpp @@ -80,8 +80,8 @@ namespace gcn { RadioButton::GroupMap RadioButton::mGroupMap; - RadioButton::RadioButton() : - gcn::Widget(), + RadioButton::RadioButton(const Widget2 *const widget) : + gcn::Widget(widget), MouseListener(), KeyListener(), mSelected(false), @@ -95,10 +95,11 @@ namespace gcn addKeyListener(this); } - RadioButton::RadioButton(const std::string &caption, + RadioButton::RadioButton(const Widget2 *const widget, + const std::string &caption, const std::string &group, bool selected) : - gcn::Widget(), + gcn::Widget(widget), MouseListener(), KeyListener(), mSelected(false), diff --git a/src/gui/base/widgets/radiobutton.hpp b/src/gui/base/widgets/radiobutton.hpp index 8a9a8b585..4d4403fac 100644 --- a/src/gui/base/widgets/radiobutton.hpp +++ b/src/gui/base/widgets/radiobutton.hpp @@ -93,7 +93,7 @@ namespace gcn /** * Constructor. */ - RadioButton(); + RadioButton(const Widget2 *const widget); /** * Constructor. The radio button will be automatically resized @@ -103,7 +103,8 @@ namespace gcn * @param group The group the radio button should belong to. * @param selected True if the radio button should be selected. */ - RadioButton(const std::string &caption, + RadioButton(const Widget2 *const widget, + const std::string &caption, const std::string &group, bool selected = false); diff --git a/src/gui/base/widgets/scrollarea.cpp b/src/gui/base/widgets/scrollarea.cpp index f76226bc5..68e1b72d3 100644 --- a/src/gui/base/widgets/scrollarea.cpp +++ b/src/gui/base/widgets/scrollarea.cpp @@ -74,8 +74,8 @@ namespace gcn { - ScrollArea::ScrollArea() : - gcn::BasicContainer(), + ScrollArea::ScrollArea(const Widget2 *const widget) : + gcn::BasicContainer(widget), MouseListener(), mVScroll(0), mHScroll(0), @@ -101,8 +101,9 @@ namespace gcn addMouseListener(this); } - ScrollArea::ScrollArea(Widget *const content) : - gcn::BasicContainer(), + ScrollArea::ScrollArea(const Widget2 *const widget, + Widget *const content) : + gcn::BasicContainer(widget), MouseListener(), mVScroll(0), mHScroll(0), @@ -129,10 +130,11 @@ namespace gcn addMouseListener(this); } - ScrollArea::ScrollArea(Widget *content, + ScrollArea::ScrollArea(const Widget2 *const widget, + Widget *content, ScrollPolicy hPolicy, ScrollPolicy vPolicy) : - gcn::BasicContainer(), + gcn::BasicContainer(widget), MouseListener(), mVScroll(0), mHScroll(0), diff --git a/src/gui/base/widgets/scrollarea.hpp b/src/gui/base/widgets/scrollarea.hpp index 1d4c0dd54..e2d8aada5 100644 --- a/src/gui/base/widgets/scrollarea.hpp +++ b/src/gui/base/widgets/scrollarea.hpp @@ -100,14 +100,15 @@ namespace gcn /** * Constructor. */ - ScrollArea(); + explicit ScrollArea(const Widget2 *const widget); /** * Constructor. * * @param content The content of the scroll area. */ - explicit ScrollArea(Widget *const content); + ScrollArea(const Widget2 *const widget, + Widget *const content); /** * Constructor. @@ -118,7 +119,8 @@ namespace gcn * @param vPolicy The policy for the vertical scrollbar. See enum with * policies. */ - ScrollArea(Widget *content, + ScrollArea(const Widget2 *const widget, + Widget *content, ScrollPolicy hPolicy, ScrollPolicy vPolicy); diff --git a/src/gui/base/widgets/slider.cpp b/src/gui/base/widgets/slider.cpp index 1245b6590..e995ff55a 100644 --- a/src/gui/base/widgets/slider.cpp +++ b/src/gui/base/widgets/slider.cpp @@ -76,8 +76,9 @@ namespace gcn { - Slider::Slider(const double scaleEnd) : - gcn::Widget(), + Slider::Slider(const Widget2 *const widget, + const double scaleEnd) : + gcn::Widget(widget), MouseListener(), KeyListener(), mDragged(false), @@ -95,8 +96,10 @@ namespace gcn addKeyListener(this); } - Slider::Slider(const double scaleStart, const double scaleEnd) : - gcn::Widget(), + Slider::Slider(const Widget2 *const widget, + const double scaleStart, + const double scaleEnd) : + gcn::Widget(widget), MouseListener(), KeyListener(), mDragged(false), diff --git a/src/gui/base/widgets/slider.hpp b/src/gui/base/widgets/slider.hpp index f77d3f5dd..f29ad5950 100644 --- a/src/gui/base/widgets/slider.hpp +++ b/src/gui/base/widgets/slider.hpp @@ -99,7 +99,8 @@ namespace gcn * * @param scaleEnd The end value of the slider scale. */ - explicit Slider(const double scaleEnd = 1.0); + explicit Slider(const Widget2 *const widget, + const double scaleEnd = 1.0); /** * Constructor. @@ -107,7 +108,9 @@ namespace gcn * @param scaleStart The start value of the slider scale. * @param scaleEnd The end value of the slider scale. */ - Slider(const double scaleStart, const double scaleEnd); + Slider(const Widget2 *const widget, + const double scaleStart, + const double scaleEnd); A_DELETE_COPY(Slider) diff --git a/src/gui/base/widgets/textbox.cpp b/src/gui/base/widgets/textbox.cpp index 292e35850..7a5b63a50 100644 --- a/src/gui/base/widgets/textbox.cpp +++ b/src/gui/base/widgets/textbox.cpp @@ -80,8 +80,8 @@ namespace gcn { - TextBox::TextBox() : - gcn::Widget(), + TextBox::TextBox(const Widget2 *const widget) : + gcn::Widget(widget), MouseListener(), KeyListener(), mTextRows(), @@ -98,8 +98,9 @@ namespace gcn adjustSize(); } - TextBox::TextBox(const std::string& text) : - gcn::Widget(), + TextBox::TextBox(const Widget2 *const widget, + const std::string& text) : + gcn::Widget(widget), MouseListener(), KeyListener(), mTextRows(), diff --git a/src/gui/base/widgets/textbox.hpp b/src/gui/base/widgets/textbox.hpp index 8fc788816..0c96096ec 100644 --- a/src/gui/base/widgets/textbox.hpp +++ b/src/gui/base/widgets/textbox.hpp @@ -87,14 +87,15 @@ namespace gcn /** * Constructor. */ - TextBox(); + explicit TextBox(const Widget2 *const widget); /** * Constructor. * * @param text The default text of the text box. */ - explicit TextBox(const std::string& text); + TextBox(const Widget2 *const widget, + const std::string& text); A_DELETE_COPY(TextBox) diff --git a/src/gui/base/widgets/textfield.cpp b/src/gui/base/widgets/textfield.cpp index f149e8667..6ca37c4af 100644 --- a/src/gui/base/widgets/textfield.cpp +++ b/src/gui/base/widgets/textfield.cpp @@ -78,8 +78,8 @@ namespace gcn { - TextField::TextField() : - gcn::Widget(), + TextField::TextField(const Widget2 *const widget) : + gcn::Widget(widget), MouseListener(), KeyListener(), mText(), @@ -92,8 +92,9 @@ namespace gcn addKeyListener(this); } - TextField::TextField(const std::string& text) : - gcn::Widget(), + TextField::TextField(const Widget2 *const widget, + const std::string& text) : + gcn::Widget(widget), MouseListener(), KeyListener(), mText(text), diff --git a/src/gui/base/widgets/textfield.hpp b/src/gui/base/widgets/textfield.hpp index 099ed1356..aa5f210c5 100644 --- a/src/gui/base/widgets/textfield.hpp +++ b/src/gui/base/widgets/textfield.hpp @@ -85,7 +85,7 @@ namespace gcn /** * Constructor. */ - TextField(); + explicit TextField(const Widget2 *const widget); /** * Constructor. The text field will be automatically resized @@ -93,7 +93,8 @@ namespace gcn * * @param text The default text of the text field. */ - explicit TextField(const std::string& text); + TextField(const Widget2 *const widget, + const std::string& text); A_DELETE_COPY(TextField) diff --git a/src/gui/base/widgets/window.cpp b/src/gui/base/widgets/window.cpp index 8d33c1dd5..0ead95bc1 100644 --- a/src/gui/base/widgets/window.cpp +++ b/src/gui/base/widgets/window.cpp @@ -77,8 +77,8 @@ namespace gcn { - Window::Window() : - Container(), + Window::Window(const Widget2 *const widget) : + Container(widget), MouseListener(), mCaption(), mAlignment(Graphics::CENTER), @@ -94,8 +94,9 @@ namespace gcn addMouseListener(this); } - Window::Window(const std::string& caption) : - Container(), + Window::Window(const Widget2 *const widget, + const std::string& caption) : + Container(widget), MouseListener(), mCaption(caption), mAlignment(Graphics::CENTER), diff --git a/src/gui/base/widgets/window.hpp b/src/gui/base/widgets/window.hpp index 030d57edc..e2772d850 100644 --- a/src/gui/base/widgets/window.hpp +++ b/src/gui/base/widgets/window.hpp @@ -82,7 +82,7 @@ namespace gcn /** * Constructor. */ - Window(); + explicit Window(const Widget2 *const widget); /** * Constructor. The window will be automatically resized in height @@ -90,7 +90,8 @@ namespace gcn * * @param caption the caption of the window. */ - explicit Window(const std::string& caption); + Window(const Widget2 *const widget, + const std::string& caption); A_DELETE_COPY(Window) diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 45551d165..450bd504f 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -118,7 +118,7 @@ PopupMenu::PopupMenu() : mPlayerListener.setNick(""); mPlayerListener.setDialog(nullptr); mPlayerListener.setType(static_cast(Being::UNKNOWN)); - mScrollArea = new ScrollArea(mBrowserBox, false); + mScrollArea = new ScrollArea(this, mBrowserBox, false); mScrollArea->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); } diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h index d0449231b..005ba7c72 100644 --- a/src/gui/widgets/avatarlistbox.h +++ b/src/gui/widgets/avatarlistbox.h @@ -41,10 +41,12 @@ public: { return getAvatarAt(i)->getName(); } }; -class AvatarListBox final : public ListBox, public ConfigListener +class AvatarListBox final : public ListBox, + public ConfigListener { public: - AvatarListBox(const Widget2 *const widget, AvatarListModel *const model); + AvatarListBox(const Widget2 *const widget, + AvatarListModel *const model); A_DELETE_COPY(AvatarListBox) diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 60b67dc24..cc83d2b83 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -52,8 +52,7 @@ BrowserBox::BrowserBox(const Widget2 *const widget, const unsigned int mode, const bool opaque, const std::string &skin) : - gcn::Widget(), - Widget2(widget), + gcn::Widget(widget), MouseListener(), mTextRows(), mTextRowLinksCount(), diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index f1c1aa1f6..23f221e63 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -103,7 +103,6 @@ class LinePart final * parent conteiner. */ class BrowserBox final : public gcn::Widget, - public Widget2, public MouseListener { public: diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 5d27af68a..a9b621d90 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -49,8 +49,7 @@ static std::string const data[Button::BUTTON_COUNT] = Skin *Button::button[BUTTON_COUNT]; Button::Button(const Widget2 *const widget) : - gcn::Button(), - Widget2(widget), + gcn::Button(widget), WidgetListener(), mDescription(), mVertexes2(new ImageCollection), @@ -83,8 +82,7 @@ Button::Button(const Widget2 *const widget, const std::string &restrict caption, const std::string &restrict actionEventId, ActionListener *const listener) : - gcn::Button(caption), - Widget2(widget), + gcn::Button(widget, caption), WidgetListener(), mDescription(), mVertexes2(new ImageCollection), @@ -123,8 +121,7 @@ Button::Button(const Widget2 *const widget, const int imageWidth, const int imageHeight, const std::string &restrict actionEventId, ActionListener *const listener) : - gcn::Button(caption), - Widget2(widget), + gcn::Button(widget, caption), WidgetListener(), mDescription(), mVertexes2(new ImageCollection), @@ -163,8 +160,7 @@ Button::Button(const Widget2 *const widget, const int imageWidth, const int imageHeight, const std::string &restrict actionEventId, ActionListener *const listener) : - gcn::Button(), - Widget2(widget), + gcn::Button(widget), WidgetListener(), mDescription(), mVertexes2(new ImageCollection), @@ -203,8 +199,7 @@ Button::Button(const Widget2 *const widget, const std::string &restrict imageName, const std::string &restrict actionEventId, ActionListener *const listener) : - gcn::Button(caption), - Widget2(widget), + gcn::Button(widget, caption), WidgetListener(), mDescription(), mVertexes2(new ImageCollection), diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index a9722f6a2..73c0d70eb 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -43,7 +43,6 @@ const std::string BUTTON_PLAY = "buttonplay.png"; * \ingroup GUI */ class Button final : public gcn::Button, - public Widget2, public WidgetListener { public: diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index 0772c0d4f..e500815c0 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -39,11 +39,11 @@ Skin *CheckBox::mSkin = nullptr; float CheckBox::mAlpha = 1.0; CheckBox::CheckBox(const Widget2 *const widget, - const std::string &restrict caption, const bool selected, + const std::string &restrict caption, + const bool selected, ActionListener *const listener, const std::string &restrict eventId) : - gcn::CheckBox(caption, selected), - Widget2(widget), + gcn::CheckBox(widget, caption, selected), mPadding(0), mImagePadding(0), mImageSize(9), diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h index 3b0830cee..e05ab29d3 100644 --- a/src/gui/widgets/checkbox.h +++ b/src/gui/widgets/checkbox.h @@ -36,8 +36,7 @@ class Skin; * * \ingroup GUI */ -class CheckBox final : public gcn::CheckBox, - public Widget2 +class CheckBox final : public gcn::CheckBox { public: /** diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp index e37bd5103..3c048d630 100644 --- a/src/gui/widgets/container.cpp +++ b/src/gui/widgets/container.cpp @@ -25,8 +25,7 @@ #include "debug.h" Container::Container(const Widget2 *const widget) : - gcn::Container(), - Widget2(widget) + gcn::Container(widget) { setOpaque(false); } diff --git a/src/gui/widgets/container.h b/src/gui/widgets/container.h index a83ec8d48..efddb1566 100644 --- a/src/gui/widgets/container.h +++ b/src/gui/widgets/container.h @@ -36,8 +36,7 @@ * * This container is also non-opaque by default. */ -class Container : public gcn::Container, - public Widget2 +class Container : public gcn::Container { public: explicit Container(const Widget2 *const widget); diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 42fa89b30..86170036c 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -58,12 +58,11 @@ DropDown::DropDown(const Widget2 *const widget, ActionListener *const listener, const std::string &eventId): ActionListener(), - gcn::BasicContainer(), + gcn::BasicContainer(widget), KeyListener(), MouseListener(), FocusListener(), SelectionListener(), - Widget2(widget), mPopup(new PopupList(this, listModel, extended, modal)), mShadowColor(getThemeColor(Theme::DROPDOWN_SHADOW)), mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 8f42bfc65..b638a2a05 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -55,8 +55,7 @@ class DropDown final : public ActionListener, public KeyListener, public MouseListener, public FocusListener, - public SelectionListener, - public Widget2 + public SelectionListener { public: /** diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index 6456913a9..1ebcb4841 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -34,8 +34,7 @@ namespace } // namespace EmotePage::EmotePage(const Widget2 *const widget) : - gcn::Widget(), - Widget2(widget), + gcn::Widget(widget), MouseListener(), WidgetListener(), mEmotes(ResourceManager::getInstance()->getImageSet( diff --git a/src/gui/widgets/emotepage.h b/src/gui/widgets/emotepage.h index 74f93e8d3..8eb1e5f7b 100644 --- a/src/gui/widgets/emotepage.h +++ b/src/gui/widgets/emotepage.h @@ -31,7 +31,6 @@ #include "localconsts.h" class EmotePage final : public gcn::Widget, - public Widget2, public MouseListener, public WidgetListener { diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp index 1c5961140..06fb731c4 100644 --- a/src/gui/widgets/flowcontainer.cpp +++ b/src/gui/widgets/flowcontainer.cpp @@ -24,7 +24,8 @@ #include "debug.h" FlowContainer::FlowContainer(const Widget2 *const widget, - const int boxWidth, const int boxHeight) : + const int boxWidth, + const int boxHeight) : Container(widget), WidgetListener(), mBoxWidth(boxWidth), diff --git a/src/gui/widgets/flowcontainer.h b/src/gui/widgets/flowcontainer.h index a425e8465..8e96204ae 100644 --- a/src/gui/widgets/flowcontainer.h +++ b/src/gui/widgets/flowcontainer.h @@ -41,7 +41,8 @@ class FlowContainer final : public Container, * Constructor. Initializes the shortcut container. */ FlowContainer(const Widget2 *const widget, - const int boxWidth, const int boxHeight); + const int boxWidth, + const int boxHeight); A_DELETE_COPY(FlowContainer) diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 1b1124cff..84bc19e0e 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -94,9 +94,9 @@ void GuiTableActionListener::action(const ActionEvent &actionEvent A_UNUSED) GuiTable::GuiTable(const Widget2 *const widget, - TableModel *const initial_model, const bool opacity) : - gcn::Widget(), - Widget2(widget), + TableModel *const initial_model, + const bool opacity) : + gcn::Widget(widget), MouseListener(), KeyListener(), mModel(nullptr), diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index ab7dc1a66..d68e222ac 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -47,7 +47,6 @@ class GuiTableActionListener; * \ingroup GUI */ class GuiTable final : public gcn::Widget, - public Widget2, public MouseListener, public KeyListener, public TableModelListener diff --git a/src/gui/widgets/horizontcontainer.cpp b/src/gui/widgets/horizontcontainer.cpp index b2fddfcae..5d0e14903 100644 --- a/src/gui/widgets/horizontcontainer.cpp +++ b/src/gui/widgets/horizontcontainer.cpp @@ -24,7 +24,8 @@ #include "debug.h" HorizontContainer::HorizontContainer(const Widget2 *const widget, - const int height, const int spacing) : + const int height, + const int spacing) : Container(widget), WidgetListener(), mSpacing(spacing), diff --git a/src/gui/widgets/horizontcontainer.h b/src/gui/widgets/horizontcontainer.h index 4f652df64..9a873272c 100644 --- a/src/gui/widgets/horizontcontainer.h +++ b/src/gui/widgets/horizontcontainer.h @@ -38,7 +38,8 @@ class HorizontContainer final : public Container, { public: HorizontContainer(const Widget2 *const widget, - const int height, const int spacing); + const int height, + const int spacing); A_DELETE_COPY(HorizontContainer) diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index 66313d397..73607c048 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -27,9 +27,9 @@ #include "debug.h" -Icon::Icon(const Widget2 *const widget, const std::string &file) : - gcn::Widget(), - Widget2(widget), +Icon::Icon(const Widget2 *const widget, + const std::string &file) : + gcn::Widget(widget), mImage(ResourceManager::getInstance()->getImage(file)) { if (mImage) @@ -39,9 +39,9 @@ Icon::Icon(const Widget2 *const widget, const std::string &file) : } } -Icon::Icon(const Widget2 *const widget, Image *const image) : - gcn::Widget(), - Widget2(widget), +Icon::Icon(const Widget2 *const widget, + Image *const image) : + gcn::Widget(widget), mImage(image) { if (mImage) diff --git a/src/gui/widgets/icon.h b/src/gui/widgets/icon.h index a39cec517..9dc4827ac 100644 --- a/src/gui/widgets/icon.h +++ b/src/gui/widgets/icon.h @@ -36,19 +36,20 @@ class Image; * * \ingroup GUI */ -class Icon final : public gcn::Widget, - public Widget2 +class Icon final : public gcn::Widget { public: /** * Constructor. */ - Icon(const Widget2 *const widget, const std::string &filename); + Icon(const Widget2 *const widget, + const std::string &filename); /** * Constructor, uses an existing Image. */ - Icon(const Widget2 *const widget, Image *const image); + Icon(const Widget2 *const widget, + Image *const image); A_DELETE_COPY(Icon) diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp index e693526f0..6d8eed228 100644 --- a/src/gui/widgets/inttextfield.cpp +++ b/src/gui/widgets/inttextfield.cpp @@ -33,9 +33,12 @@ #include "utils/stringutils.h" #include "debug.h" -IntTextField::IntTextField(const Widget2 *const widget, const int def, - const int min, const int max, - const bool enabled, const int width) : +IntTextField::IntTextField(const Widget2 *const widget, + const int def, + const int min, + const int max, + const bool enabled, + const int width) : TextField(widget, toString(def)), mMin(0), mMax(0), diff --git a/src/gui/widgets/inttextfield.h b/src/gui/widgets/inttextfield.h index 2e4e68083..91b076e30 100644 --- a/src/gui/widgets/inttextfield.h +++ b/src/gui/widgets/inttextfield.h @@ -34,9 +34,12 @@ class IntTextField final : public TextField /** * Constructor, sets default value. */ - explicit IntTextField(const Widget2 *const widget, const int def = 0, - const int min = 0, const int max = 0, - const bool enabled = true, const int width = 0); + explicit IntTextField(const Widget2 *const widget, + const int def = 0, + const int min = 0, + const int max = 0, + const bool enabled = true, + const int width = 0); A_DELETE_COPY(IntTextField) diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index b0f887fa2..85f020af4 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -158,8 +158,7 @@ namespace ItemContainer::ItemContainer(const Widget2 *const widget, Inventory *const inventory, const bool forceQuantity) : - gcn::Widget(), - Widget2(widget), + gcn::Widget(widget), KeyListener(), MouseListener(), WidgetListener(), diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index 4f530320d..76dd51ef7 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -47,7 +47,6 @@ class SelectionListener; * \ingroup GUI */ class ItemContainer final : public gcn::Widget, - public Widget2, public KeyListener, public MouseListener, public WidgetListener diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 6cc94cc3d..73e3bca64 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -29,16 +29,15 @@ Skin *Label::mSkin = nullptr; int Label::mInstances = 0; Label::Label(const Widget2 *const widget) : - gcn::Label(), - Widget2(widget), + gcn::Label(widget), mPadding(0) { init(); } -Label::Label(const Widget2 *const widget, const std::string &caption) : - gcn::Label(caption), - Widget2(widget), +Label::Label(const Widget2 *const widget, + const std::string &caption) : + gcn::Label(widget, caption), mPadding(0) { init(); diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h index 0b96b87e4..b6adf9fba 100644 --- a/src/gui/widgets/label.h +++ b/src/gui/widgets/label.h @@ -36,7 +36,7 @@ class Skin; * * \ingroup GUI */ -class Label final : public gcn::Label, public Widget2 +class Label final : public gcn::Label { public: /** @@ -48,7 +48,8 @@ class Label final : public gcn::Label, public Widget2 * Constructor. This version of the constructor sets the label with an * inintialization string. */ - Label(const Widget2 *const widget, const std::string &caption); + Label(const Widget2 *const widget, + const std::string &caption); A_DELETE_COPY(Label) diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index c2fa1a686..a57dc07cd 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -43,8 +43,7 @@ float ListBox::mAlpha = 1.0; ListBox::ListBox(const Widget2 *const widget, gcn::ListModel *const listModel, const std::string &skin) : - gcn::ListBox(listModel), - Widget2(widget), + gcn::ListBox(widget, listModel), mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), mForegroundSelectedColor(getThemeColor(Theme::LISTBOX_SELECTED)), mForegroundSelectedColor2(getThemeColor(Theme::LISTBOX_SELECTED_OUTLINE)), diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index adf266f7e..cd20ea50a 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -38,8 +38,7 @@ class Skin; * * \ingroup GUI */ -class ListBox : public gcn::ListBox, - public Widget2 +class ListBox : public gcn::ListBox { public: /** diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 97fd4a713..976a1c8f9 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -34,8 +34,7 @@ PlayerBox::PlayerBox(Widget2 *const widget, Being *const being, const std::string &skin, const std::string &selectedSkin) : - Widget2(widget), - ScrollArea(), + ScrollArea(widget), mBeing(being), mAlpha(1.0), mBackground(), @@ -53,8 +52,7 @@ PlayerBox::PlayerBox(Widget2 *const widget, PlayerBox::PlayerBox(Widget2 *const widget, const std::string &skin, const std::string &selectedSkin) : - Widget2(widget), - ScrollArea(), + ScrollArea(widget), mBeing(nullptr), mAlpha(1.0), mBackground(), diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h index 3669a23a9..d3fb4e5e3 100644 --- a/src/gui/widgets/playerbox.h +++ b/src/gui/widgets/playerbox.h @@ -37,8 +37,7 @@ class Skin; * * \ingroup GUI */ -class PlayerBox final : public Widget2, - public gcn::ScrollArea +class PlayerBox final : public gcn::ScrollArea { public: /** diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp index 62bc2f448..133cbd2ca 100644 --- a/src/gui/widgets/popuplist.cpp +++ b/src/gui/widgets/popuplist.cpp @@ -37,7 +37,7 @@ PopupList::PopupList(DropDown *const widget, mListBox(extended ? new ExtendedListBox( widget, listModel, "extendedlistbox.xml", 0) : new ListBox(widget, listModel, "popuplistbox.xml")), - mScrollArea(new ScrollArea(mListBox, false)), + mScrollArea(new ScrollArea(this, mListBox, false)), mDropDown(widget), mPressedIndex(-2), mModal(modal) diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index a1f597da8..b44b6a1a0 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -33,12 +33,14 @@ int ProgressBar::mInstances = 0; float ProgressBar::mAlpha = 1.0; -ProgressBar::ProgressBar(const Widget2 *const widget, float progress, - const int width, const int height, +ProgressBar::ProgressBar(const Widget2 *const widget, + float progress, + const int width, + const int height, const int backColor, - const std::string &skin, const std::string &skinFill): - gcn::Widget(), - Widget2(widget), + const std::string &skin, + const std::string &skinFill): + gcn::Widget(widget), WidgetListener(), mFillRect(), mSkin(nullptr), diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index 86e314e16..1d4d83687 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -42,17 +42,19 @@ class Skin; * \ingroup GUI */ class ProgressBar final : public gcn::Widget, - public Widget2, public WidgetListener { public: /** * Constructor, initializes the progress with the given value. */ - ProgressBar(const Widget2 *const widget, float progress, - const int width, const int height, + ProgressBar(const Widget2 *const widget, + float progress, + const int width, + const int height, const int backColor, - const std::string &skin, const std::string &skinFill); + const std::string &skin, + const std::string &skinFill); A_DELETE_COPY(ProgressBar) diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index 198094b6d..8d4cdd67c 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -29,8 +29,7 @@ #include "debug.h" ProgressIndicator::ProgressIndicator(Widget2 *const widget) : - gcn::Widget(), - Widget2(widget), + gcn::Widget(widget), mIndicator(nullptr) { ImageSet *const images = Theme::getImageSetFromTheme( diff --git a/src/gui/widgets/progressindicator.h b/src/gui/widgets/progressindicator.h index 7357931e9..08526c7c2 100644 --- a/src/gui/widgets/progressindicator.h +++ b/src/gui/widgets/progressindicator.h @@ -34,8 +34,7 @@ class SimpleAnimation; * A widget that indicates progress. Suitable to use instead of a progress bar * in cases where it is unknown how long something is going to take. */ -class ProgressIndicator final : public gcn::Widget, - public Widget2 +class ProgressIndicator final : public gcn::Widget { public: ProgressIndicator(Widget2 *const widget); diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index 984d84d76..d52295b57 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -42,8 +42,7 @@ RadioButton::RadioButton(const Widget2 *const widget, const std::string &restrict caption, const std::string &restrict group, const bool marked): - gcn::RadioButton(caption, group, marked), - Widget2(widget), + gcn::RadioButton(widget, caption, group, marked), mPadding(0), mImagePadding(0), mImageSize(9), diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h index 6c33447c4..faff6bc0e 100644 --- a/src/gui/widgets/radiobutton.h +++ b/src/gui/widgets/radiobutton.h @@ -34,8 +34,7 @@ class Skin; /** * Guichan based RadioButton with custom look */ -class RadioButton final : public gcn::RadioButton, - public Widget2 +class RadioButton final : public gcn::RadioButton { public: /** diff --git a/src/gui/widgets/radiogroup.h b/src/gui/widgets/radiogroup.h index 0fd1f2605..d0bf18532 100644 --- a/src/gui/widgets/radiogroup.h +++ b/src/gui/widgets/radiogroup.h @@ -29,7 +29,8 @@ class RadioGroup final : public WidgetGroup { public: RadioGroup(const Widget2 *const widget, - const std::string &group, const int height, + const std::string &group, + const int height, const int spacing); A_DELETE_COPY(RadioGroup) diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 708949f9c..6dd2be526 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -45,36 +45,11 @@ static std::string const buttonFiles[2] = "scrollbuttons_pressed.xml" }; -ScrollArea::ScrollArea(Widget2 *const widget, - const bool opaque, - const std::string &skin) : - gcn::ScrollArea(), - Widget2(widget), - WidgetListener(), - mX(0), - mY(0), - mClickX(0), - mClickY(0), - mVertexes(new ImageCollection), - mVertexes2(new ImageCollection), - mXOffset(0), - mYOffset(0), - mDrawWidth(0), - mDrawHeight(0), - mHasMouse(false), - mRedraw(true) -{ - mOpaque = opaque; - addWidgetListener(this); - init(skin); -} - ScrollArea::ScrollArea(Widget2 *const widget2, gcn::Widget *const widget, const bool opaque, const std::string &skin) : - gcn::ScrollArea(widget), - Widget2(widget2), + gcn::ScrollArea(widget2, widget), WidgetListener(), mX(0), mY(0), diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index bc25baa27..bc652e296 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -44,27 +44,18 @@ class ImageCollection; * \ingroup GUI */ class ScrollArea final : public gcn::ScrollArea, - public Widget2, public WidgetListener { public: - /** - * Constructor that takes no content. Needed for use with the DropDown - * class. - */ - explicit ScrollArea(Widget2 *const widget, - const bool opaque = true, - const std::string &skin = ""); - /** * Constructor. * * @param content the initial content to show in the scroll area */ - explicit ScrollArea(Widget2 *const widget2, - gcn::Widget *const widget, - const bool opaque = true, - const std::string &skin = ""); + ScrollArea(Widget2 *const widget2, + gcn::Widget *const widget, + const bool opaque = true, + const std::string &skin = ""); A_DELETE_COPY(ScrollArea) diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index 866dde6f1..5df0eafb0 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -29,8 +29,7 @@ float ShortcutContainer::mAlpha = 1.0; ShortcutContainer::ShortcutContainer(Widget2 *const widget) : - gcn::Widget(), - Widget2(widget), + gcn::Widget(widget), WidgetListener(), MouseListener(), mBackgroundImg(nullptr), diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index 8df401775..610cfef1f 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -38,7 +38,6 @@ class ImageCollection; * \ingroup GUI */ class ShortcutContainer : public gcn::Widget, - public Widget2, public WidgetListener, public MouseListener { diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index c5988ff54..0c9b74202 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -45,8 +45,7 @@ static std::string const data[2] = Slider::Slider(Widget2 *const widget, const double scaleEnd) : - gcn::Slider(scaleEnd), - Widget2(widget), + gcn::Slider(widget, scaleEnd), mVertexes(new ImageCollection), mHasMouse(false), mRedraw(true) @@ -57,8 +56,7 @@ Slider::Slider(Widget2 *const widget, Slider::Slider(Widget2 *const widget, const double scaleStart, const double scaleEnd) : - gcn::Slider(scaleStart, scaleEnd), - Widget2(widget), + gcn::Slider(widget, scaleStart, scaleEnd), mVertexes(new ImageCollection), mHasMouse(false), mRedraw(true) diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h index 27b03976d..d03799cae 100644 --- a/src/gui/widgets/slider.h +++ b/src/gui/widgets/slider.h @@ -36,8 +36,7 @@ class ImageCollection; * * \ingroup GUI */ -class Slider final : public gcn::Slider, - public Widget2 +class Slider final : public gcn::Slider { public: /** diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 0527486ad..af5892845 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -78,15 +78,14 @@ #include "debug.h" TabbedArea::TabbedArea(const Widget2 *const widget) : - Widget2(widget), ActionListener(), - gcn::BasicContainer(), + gcn::BasicContainer(widget), KeyListener(), MouseListener(), WidgetListener(), mSelectedTab(nullptr), - mTabContainer(new gcn::Container()), - mWidgetContainer(new gcn::Container()), + mTabContainer(new gcn::Container(widget)), + mWidgetContainer(new gcn::Container(widget)), mTabsToDelete(), mTabs(), mTabsWidth(0), diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 7ac24165b..1d0794c5c 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -83,8 +83,7 @@ class Tab; /** * A tabbed area, the same as the guichan tabbed area in 0.8, but extended */ -class TabbedArea final : public Widget2, - public ActionListener, +class TabbedArea final : public ActionListener, public gcn::BasicContainer, public KeyListener, public MouseListener, diff --git a/src/gui/widgets/tabs/chattab.cpp b/src/gui/widgets/tabs/chattab.cpp index 331101209..283f1927e 100644 --- a/src/gui/widgets/tabs/chattab.cpp +++ b/src/gui/widgets/tabs/chattab.cpp @@ -50,12 +50,13 @@ static const unsigned int MAX_WORD_SIZE = 50; -ChatTab::ChatTab(const Widget2 *const widget, const std::string &name, +ChatTab::ChatTab(const Widget2 *const widget, + const std::string &name, const std::string &channel) : Tab(widget), mTextOutput(new BrowserBox(this, BrowserBox::AUTO_WRAP, true, "browserbox.xml")), - mScrollArea(new ScrollArea(mTextOutput, false)), + mScrollArea(new ScrollArea(this, mTextOutput, false)), mChannelName(channel), mAllowHightlight(true), mRemoveNames(false), diff --git a/src/gui/widgets/tabs/chattab.h b/src/gui/widgets/tabs/chattab.h index 651e69d6b..a46279483 100644 --- a/src/gui/widgets/tabs/chattab.h +++ b/src/gui/widgets/tabs/chattab.h @@ -58,7 +58,8 @@ class ChatTab : public Tab /** * Constructor. */ - ChatTab(const Widget2 *const widget, const std::string &name, + ChatTab(const Widget2 *const widget, + const std::string &name, const std::string &channel); A_DELETE_COPY(ChatTab) diff --git a/src/gui/widgets/tabs/guildchattab.h b/src/gui/widgets/tabs/guildchattab.h index fbfd3a032..cfcf901ca 100644 --- a/src/gui/widgets/tabs/guildchattab.h +++ b/src/gui/widgets/tabs/guildchattab.h @@ -28,7 +28,8 @@ /** * A tab for a guild chat channel. */ -class GuildChatTab final : public ChatTab, public ConfigListener +class GuildChatTab final : public ChatTab, + public ConfigListener { public: explicit GuildChatTab(const Widget2 *const widget); diff --git a/src/gui/widgets/tabs/langtab.cpp b/src/gui/widgets/tabs/langtab.cpp index fb6a5e12b..f5064be8c 100644 --- a/src/gui/widgets/tabs/langtab.cpp +++ b/src/gui/widgets/tabs/langtab.cpp @@ -26,7 +26,8 @@ #include "debug.h" -LangTab::LangTab(const Widget2 *const widget, const std::string &lang) : +LangTab::LangTab(const Widget2 *const widget, + const std::string &lang) : // TRANSLATORS: lang chat tab name ChatTab(widget, _("Lang"), lang + " ") { diff --git a/src/gui/widgets/tabs/langtab.h b/src/gui/widgets/tabs/langtab.h index 275b69399..e036e4dd8 100644 --- a/src/gui/widgets/tabs/langtab.h +++ b/src/gui/widgets/tabs/langtab.h @@ -26,7 +26,8 @@ class LangTab final : public ChatTab { public: - LangTab(const Widget2 *const widget, const std::string &lang); + LangTab(const Widget2 *const widget, + const std::string &lang); A_DELETE_COPY(LangTab) diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index 8ea9d5fbb..2aaad6301 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -49,11 +49,12 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : SetupTab(widget), SelectionListener(), mColorBox(new ListBox(this, userPalette, "")), - mScroll(new ScrollArea(mColorBox, true, "setup_colors_background.xml")), + mScroll(new ScrollArea(this, mColorBox, + true, "setup_colors_background.xml")), mPreview(new BrowserBox(this, BrowserBox::AUTO_WRAP, true, "browserbox.xml")), mTextPreview(new TextPreview(this, gettext(rawmsg))), - mPreviewBox(new ScrollArea(mPreview, true, + mPreviewBox(new ScrollArea(this, mPreview, true, "setup_colors_preview_background.xml")), mSelected(-1), // TRANSLATORS: colors tab. label. diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index 22bea9a75..72d05d966 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -103,7 +103,8 @@ Setup_Input::Setup_Input(const Widget2 *const widget) : // TRANSLATORS: button in input settings tab mResetKeysButton(new Button(this, _("Reset all keys"), "resetkeys", this)), mTabs(new TabStrip(this, config.getIntValue("fontSize") + 10)), - mScrollArea(new ScrollArea(mKeyList, true, "setup_input_background.xml")), + mScrollArea(new ScrollArea(this, mKeyList, + true, "setup_input_background.xml")), mKeySetting(false), mActionDataSize(new int [9]) { diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp index d23ac565c..35bd2094a 100644 --- a/src/gui/widgets/tabs/setup_relations.cpp +++ b/src/gui/widgets/tabs/setup_relations.cpp @@ -249,7 +249,7 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) : mPlayerTableModel(new PlayerTableModel(this)), mPlayerTable(new GuiTable(this, mPlayerTableModel)), mPlayerTitleTable(new GuiTable(this, mPlayerTableTitleModel)), - mPlayerScrollArea(new ScrollArea(mPlayerTable)), + mPlayerScrollArea(new ScrollArea(this, mPlayerTable)), // TRANSLATORS: relation dialog button mDefaultTrading(new CheckBox(this, _("Allow trading"), player_relations.getDefault() & PlayerRelation::TRADE)), diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index be00937f2..d2ef01378 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -224,7 +224,7 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : // TRANSLATORS: video settings tab name setName(_("Video")); - ScrollArea *const scrollArea = new ScrollArea(mModeList, + ScrollArea *const scrollArea = new ScrollArea(this, mModeList, true, "setup_video_background.xml"); scrollArea->setWidth(150); scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); diff --git a/src/gui/widgets/tabs/setup_video.h b/src/gui/widgets/tabs/setup_video.h index b385d0358..250fac0e0 100644 --- a/src/gui/widgets/tabs/setup_video.h +++ b/src/gui/widgets/tabs/setup_video.h @@ -37,7 +37,8 @@ class OpenGLListModel; class Slider; class TextDialog; -class Setup_Video final : public SetupTab, public KeyListener +class Setup_Video final : public SetupTab, + public KeyListener { public: explicit Setup_Video(const Widget2 *const widget); diff --git a/src/gui/widgets/tabs/setuptabscroll.cpp b/src/gui/widgets/tabs/setuptabscroll.cpp index 9a37ced42..9c185b2bb 100644 --- a/src/gui/widgets/tabs/setuptabscroll.cpp +++ b/src/gui/widgets/tabs/setuptabscroll.cpp @@ -29,7 +29,7 @@ SetupTabScroll::SetupTabScroll(const Widget2 *const widget) : SetupTab(widget), mContainer(new VertContainer(this, 25, false, 8)), - mScroll(new ScrollArea(mContainer, false)), + mScroll(new ScrollArea(this, mContainer, false)), mItems(), mAllItems(), mPreferredFirstItemSize(200) diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index 87bd8bde2..c1650e8a8 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -87,8 +87,7 @@ static std::string const data[Tab::TAB_COUNT] = Skin *Tab::tabImg[Tab::TAB_COUNT]; Tab::Tab(const Widget2 *const widget) : - gcn::BasicContainer(), - Widget2(widget), + gcn::BasicContainer(widget), MouseListener(), WidgetListener(), mLabel(new Label(this)), diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h index c186a0b4e..878663e36 100644 --- a/src/gui/widgets/tabs/tab.h +++ b/src/gui/widgets/tabs/tab.h @@ -84,7 +84,6 @@ class TabbedArea; * A tab, the same as the Guichan tab in 0.8, but extended */ class Tab : public gcn::BasicContainer, - public Widget2, public MouseListener, public WidgetListener { diff --git a/src/gui/widgets/tabs/whispertab.cpp b/src/gui/widgets/tabs/whispertab.cpp index ec02bb70f..023d94110 100644 --- a/src/gui/widgets/tabs/whispertab.cpp +++ b/src/gui/widgets/tabs/whispertab.cpp @@ -34,7 +34,8 @@ #include "debug.h" -WhisperTab::WhisperTab(const Widget2 *const widget, const std::string &nick) : +WhisperTab::WhisperTab(const Widget2 *const widget, + const std::string &nick) : ChatTab(widget, nick, ""), mNick(nick) { diff --git a/src/gui/widgets/tabs/whispertab.h b/src/gui/widgets/tabs/whispertab.h index 5dbb05a4e..84b55ae58 100644 --- a/src/gui/widgets/tabs/whispertab.h +++ b/src/gui/widgets/tabs/whispertab.h @@ -57,7 +57,8 @@ class WhisperTab final : public ChatTab * * @param nick the name of the player this tab is whispering to */ - WhisperTab(const Widget2 *const widget, const std::string &nick); + WhisperTab(const Widget2 *const widget, + const std::string &nick); ~WhisperTab(); diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp index ca31e393d..4a72d7ccd 100644 --- a/src/gui/widgets/tabstrip.cpp +++ b/src/gui/widgets/tabstrip.cpp @@ -25,14 +25,16 @@ #include "debug.h" TabStrip::TabStrip(const Widget2 *const widget, - const std::string &group, const int height, + const std::string &group, + const int height, const int spacing) : WidgetGroup(widget, group, height, spacing) { } TabStrip::TabStrip(const Widget2 *const widget, - const int height, const int spacing) : + const int height, + const int spacing) : WidgetGroup(widget, "", height, spacing) { } diff --git a/src/gui/widgets/tabstrip.h b/src/gui/widgets/tabstrip.h index 2e5ccfe34..57a178ff0 100644 --- a/src/gui/widgets/tabstrip.h +++ b/src/gui/widgets/tabstrip.h @@ -29,11 +29,13 @@ class TabStrip final : public WidgetGroup { public: TabStrip(const Widget2 *const widget, - const std::string &group, const int height, + const std::string &group, + const int height, const int spacing = 0); TabStrip(const Widget2 *const widget, - const int height, const int spacing = 0); + const int height, + const int spacing = 0); A_DELETE_COPY(TabStrip) diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 0ea05e585..729d40ead 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -33,8 +33,7 @@ #include "debug.h" TextBox::TextBox(const Widget2 *const widget) : - gcn::TextBox(), - Widget2(widget), + gcn::TextBox(widget), mMinWidth(getWidth()) { mForegroundColor = getThemeColor(Theme::TEXTBOX); diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h index 6b0429483..fe719faf8 100644 --- a/src/gui/widgets/textbox.h +++ b/src/gui/widgets/textbox.h @@ -36,8 +36,7 @@ * * \ingroup GUI */ -class TextBox final : public gcn::TextBox, - public Widget2 +class TextBox final : public gcn::TextBox { public: /** diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 4dd2f1c7b..eb1484449 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -54,9 +54,8 @@ TextField::TextField(const Widget2 *restrict const widget, ActionListener *restrict const listener, const std::string &restrict eventId, const bool sendAlwaysEvents): - gcn::TextField(text), + gcn::TextField(widget, text), FocusListener(), - Widget2(widget), mSendAlwaysEvents(sendAlwaysEvents), mCaretColor(&getThemeColor(Theme::CARET)), mPopupMenu(nullptr), diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index ed08de2fa..bfa721b7a 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -39,8 +39,7 @@ class PopupMenu; * \ingroup GUI */ class TextField : public gcn::TextField, - public FocusListener, - public Widget2 + public FocusListener { public: /** diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 2caf2e44c..1344c647a 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -35,8 +35,7 @@ Skin *TextPreview::mSkin = nullptr; TextPreview::TextPreview(const Widget2 *const widget, const std::string &text) : - gcn::Widget(), - Widget2(widget), + gcn::Widget(widget), mFont(gui->getFont()), mText(text), mTextColor(&getThemeColor(Theme::TEXT)), diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h index cb524a974..532175a82 100644 --- a/src/gui/widgets/textpreview.h +++ b/src/gui/widgets/textpreview.h @@ -32,11 +32,11 @@ /** * Preview widget for particle colors, etc. */ -class TextPreview final : public gcn::Widget, - public Widget2 +class TextPreview final : public gcn::Widget { public: - TextPreview(const Widget2 *const widget, const std::string &text); + TextPreview(const Widget2 *const widget, + const std::string &text); A_DELETE_COPY(TextPreview) diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp index e38ebb9af..9d596d620 100644 --- a/src/gui/widgets/vertcontainer.cpp +++ b/src/gui/widgets/vertcontainer.cpp @@ -24,7 +24,8 @@ #include "debug.h" VertContainer::VertContainer(const Widget2 *const widget, - const int verticalItemSize, const bool resizable, + const int verticalItemSize, + const bool resizable, const int leftSpacing) : Container(widget), WidgetListener(), diff --git a/src/gui/widgets/vertcontainer.h b/src/gui/widgets/vertcontainer.h index 1d396efc9..5fb212b48 100644 --- a/src/gui/widgets/vertcontainer.h +++ b/src/gui/widgets/vertcontainer.h @@ -40,7 +40,8 @@ class VertContainer final : public Container, { public: VertContainer(const Widget2 *const widget, - const int verticalItemSize, const bool resizable = true, + const int verticalItemSize, + const bool resizable = true, const int leftSpacing = 0); A_DELETE_COPY(VertContainer) diff --git a/src/gui/widgets/widgetgroup.cpp b/src/gui/widgets/widgetgroup.cpp index 3957fab30..4a0065ca8 100644 --- a/src/gui/widgets/widgetgroup.cpp +++ b/src/gui/widgets/widgetgroup.cpp @@ -23,7 +23,8 @@ #include "debug.h" WidgetGroup::WidgetGroup(const Widget2 *const widget, - const std::string &group, const int height, + const std::string &group, + const int height, const int spacing) : Container(widget), WidgetListener(), diff --git a/src/gui/widgets/widgetgroup.h b/src/gui/widgets/widgetgroup.h index b26d88d15..37523fcdc 100644 --- a/src/gui/widgets/widgetgroup.h +++ b/src/gui/widgets/widgetgroup.h @@ -54,7 +54,8 @@ class WidgetGroup : public Container, protected: WidgetGroup(const Widget2 *const widget, - const std::string &group, const int height, + const std::string &group, + const int height, const int spacing); int mSpacing; diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 82c2d91f8..d26580fc2 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -48,8 +48,7 @@ int Window::mouseResize = 0; Window::Window(const std::string &caption, const bool modal, Window *const parent, std::string skin) : - gcn::Window(caption), - Widget2(nullptr), + gcn::Window(nullptr, caption), WidgetListener(), mSkin(nullptr), mDefaultX(0), diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index c6b2ca2cb..64963be3e 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -47,7 +47,6 @@ class WindowContainer; * \ingroup GUI */ class Window : public gcn::Window, - public Widget2, private WidgetListener { public: diff --git a/src/gui/windows/botcheckerwindow.cpp b/src/gui/windows/botcheckerwindow.cpp index e04174962..ade95eba5 100644 --- a/src/gui/windows/botcheckerwindow.cpp +++ b/src/gui/windows/botcheckerwindow.cpp @@ -263,7 +263,7 @@ BotCheckerWindow::BotCheckerWindow(): ActionListener(), mTableModel(new UsersTableModel(this)), mTable(new GuiTable(this, mTableModel)), - playersScrollArea(new ScrollArea(mTable, true, + playersScrollArea(new ScrollArea(this, mTable, true, "bochecker_background.xml")), mPlayerTableTitleModel(new StaticTableModel(1, COLUMNS_NR)), mPlayerTitleTable(new GuiTable(this, mPlayerTableTitleModel)), diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index 4d2acfac9..cd593bf92 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -240,7 +240,7 @@ void BuyDialog::init() mShopItemList = new ShopListBox(this, mShopItems, mShopItems); mShopItemList->postInit(); - mScrollArea = new ScrollArea(mShopItemList, + mScrollArea = new ScrollArea(this, mShopItemList, getOptionBool("showbackground"), "buy_background.xml"); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); diff --git a/src/gui/windows/didyouknowwindow.cpp b/src/gui/windows/didyouknowwindow.cpp index 58e6d9c24..95d657772 100644 --- a/src/gui/windows/didyouknowwindow.cpp +++ b/src/gui/windows/didyouknowwindow.cpp @@ -51,7 +51,7 @@ DidYouKnowWindow::DidYouKnowWindow() : ActionListener(), mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, "browserbox.xml")), - mScrollArea(new ScrollArea(mBrowserBox, + mScrollArea(new ScrollArea(this, mBrowserBox, true, "didyouknow_background.xml")), // TRANSLATORS: did you know window button mButtonPrev(new Button(this, _("< Previous"), "prev", this)), diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index 0b31a410b..7457c7b1e 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -53,7 +53,8 @@ HelpWindow::HelpWindow() : mDYKButton(new Button(this, _("Did you know..."), "DYK", this)), mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, "browserbox.xml")), - mScrollArea(new ScrollArea(mBrowserBox, true, "help_background.xml")), + mScrollArea(new ScrollArea(this, mBrowserBox, + true, "help_background.xml")), mTagFileMap() { setMinWidth(300); diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index c95c2c54e..bc66f588c 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -182,8 +182,8 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): mItems->addSelectionListener(this); - gcn::ScrollArea *const invenScroll = new ScrollArea( - mItems, getOptionBool("showbackground"), "inventory_background.xml"); + gcn::ScrollArea *const invenScroll = new ScrollArea(this, mItems, + getOptionBool("showbackground"), "inventory_background.xml"); invenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); const int size = config.getIntValue("fontSize"); diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index d1823d5cf..a1b2109fb 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -84,12 +84,12 @@ NpcDialog::NpcDialog(const int npcId) : mDefaultString(), mTextBox(new BrowserBox(this, BrowserBox::AUTO_WRAP, true, "browserbox.xml")), - mScrollArea(new ScrollArea(mTextBox, + mScrollArea(new ScrollArea(this, mTextBox, getOptionBool("showtextbackground"), "npc_textbackground.xml")), mText(), mNewText(), mItemList(new ExtendedListBox(this, this, "extendedlistbox.xml")), - mListScrollArea(new ScrollArea(mItemList, + mListScrollArea(new ScrollArea(this, mItemList, getOptionBool("showlistbackground"), "npc_listbackground.xml")), mItems(), mImages(), @@ -111,7 +111,7 @@ NpcDialog::NpcDialog(const int npcId) : mResetButton(new Button(this, _("Reset"), "reset", this)), mInventory(new Inventory(Inventory::NPC, 1)), mItemContainer(new ItemContainer(this, mInventory)), - mItemScrollArea(new ScrollArea(mItemContainer, + mItemScrollArea(new ScrollArea(this, mItemContainer, getOptionBool("showitemsbackground"), "npc_listbackground.xml")), mInputState(NPC_INPUT_NONE), mActionState(NPC_ACTION_WAIT), diff --git a/src/gui/windows/npcpostdialog.cpp b/src/gui/windows/npcpostdialog.cpp index 587f94ab2..23c21da0c 100644 --- a/src/gui/windows/npcpostdialog.cpp +++ b/src/gui/windows/npcpostdialog.cpp @@ -74,7 +74,7 @@ void NpcPostDialog::postInit() mText->setEditable(true); // create scroll box for letter text - ScrollArea *const scrollArea = new ScrollArea(mText); + ScrollArea *const scrollArea = new ScrollArea(this, mText); scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); scrollArea->setDimension(gcn::Rectangle( 5, mSender->getHeight() + 5, diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index 2e8c5dcc8..1a8749899 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -126,11 +126,11 @@ QuestsWindow::QuestsWindow() : mQuestsModel(new QuestsModel), mQuestsListBox(new ExtendedListBox(this, mQuestsModel, "extendedlistbox.xml")), - mQuestScrollArea(new ScrollArea(mQuestsListBox, + mQuestScrollArea(new ScrollArea(this, mQuestsListBox, getOptionBool("showlistbackground"), "quests_list_background.xml")), mItemLinkHandler(new ItemLinkHandler), mText(new BrowserBox(this, BrowserBox::AUTO_WRAP, true, "browserbox.xml")), - mTextScrollArea(new ScrollArea(mText, + mTextScrollArea(new ScrollArea(this, mText, getOptionBool("showtextbackground"), "quests_text_background.xml")), // TRANSLATORS: quests window button mCloseButton(new Button(this, _("Close"), "close", this)), diff --git a/src/gui/windows/selldialog.cpp b/src/gui/windows/selldialog.cpp index b79d18dcf..dc932ca69 100644 --- a/src/gui/windows/selldialog.cpp +++ b/src/gui/windows/selldialog.cpp @@ -86,7 +86,7 @@ void SellDialog::init() mShopItemList = new ShopListBox(this, mShopItems, mShopItems); mShopItemList->postInit(); mShopItemList->setProtectItems(true); - mScrollArea = new ScrollArea(mShopItemList, + mScrollArea = new ScrollArea(this, mShopItemList, getOptionBool("showbackground"), "sell_background.xml"); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index fb2f5258b..6823c2649 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -292,7 +292,7 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo, mServersList->addMouseListener(this); - ScrollArea *const usedScroll = new ScrollArea(mServersList, + ScrollArea *const usedScroll = new ScrollArea(this, mServersList, getOptionBool("showbackground"), "server_background.xml"); usedScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index 9e55af797..706438f61 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -79,9 +79,9 @@ ShopWindow::ShopWindow(): mSellShopItems(new ShopItems), mBuyShopItemList(new ShopListBox(this, mBuyShopItems, mBuyShopItems)), mSellShopItemList(new ShopListBox(this, mSellShopItems, mSellShopItems)), - mBuyScrollArea(new ScrollArea(mBuyShopItemList, + mBuyScrollArea(new ScrollArea(this, mBuyShopItemList, getOptionBool("showbuybackground"), "shop_buy_background.xml")), - mSellScrollArea(new ScrollArea(mSellShopItemList, + mSellScrollArea(new ScrollArea(this, mSellShopItemList, getOptionBool("showsellbackground"), "shop_sell_background.xml")), // TRANSLATORS: shop window label mBuyLabel(new Label(this, _("Buy items"))), diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp index 50bc6fcd1..5b3c03e90 100644 --- a/src/gui/windows/shortcutwindow.cpp +++ b/src/gui/windows/shortcutwindow.cpp @@ -40,7 +40,8 @@ class ShortcutTab final : public Tab { public: ShortcutTab(const Widget2 *const widget, - std::string name, ShortcutContainer *const content) : + std::string name, + ShortcutContainer *const content) : Tab(widget), mContent(content) { @@ -58,7 +59,7 @@ ShortcutWindow::ShortcutWindow(const std::string &restrict title, int width, int height) : Window("Window", false, nullptr, skinFile), mItems(content), - mScrollArea(new ScrollArea(mItems, false)), + mScrollArea(new ScrollArea(this, mItems, false)), mTabs(nullptr), mPages() { @@ -160,7 +161,7 @@ ShortcutWindow::~ShortcutWindow() void ShortcutWindow::addTab(const std::string &name, ShortcutContainer *const content) { - ScrollArea *const scroll = new ScrollArea(content, false); + ScrollArea *const scroll = new ScrollArea(this, content, false); scroll->setPosition(SCROLL_PADDING, SCROLL_PADDING); scroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); content->setWidget2(this); diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 413f73226..9cc952ec6 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -59,7 +59,8 @@ class SkillListBox final : public ListBox { public: - SkillListBox(const Widget2 *const widget, SkillModel *const model) : + SkillListBox(const Widget2 *const widget, + SkillModel *const model) : ListBox(widget, model, "skilllistbox.xml"), mModel(model), mPopup(new TextPopup), @@ -241,7 +242,8 @@ class SkillTab final : public Tab { public: SkillTab(const Widget2 *const widget, - const std::string &name, SkillListBox *const listBox) : + const std::string &name, + SkillListBox *const listBox) : Tab(widget), mListBox(listBox) { @@ -541,7 +543,7 @@ void SkillDialog::loadXmlFile(const std::string &fileName) SkillListBox *const listbox = new SkillListBox(this, model); listbox->setActionEventId("sel"); listbox->addActionListener(this); - ScrollArea *const scroll = new ScrollArea(listbox, false); + ScrollArea *const scroll = new ScrollArea(this, listbox, false); scroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); scroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS); diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 704bf0ca6..52ddc9439 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -173,7 +173,8 @@ class SocialGuildTab final : public SocialTab, public ActionListener { public: SocialGuildTab(const Widget2 *const widget, - Guild *const guild, const bool showBackground) : + Guild *const guild, + const bool showBackground) : SocialTab(widget), ActionListener(), mGuild(guild) @@ -191,7 +192,7 @@ public: mList = new AvatarListBox(this, guild); mList->postInit(); - mScroll = new ScrollArea(mList, showBackground, + mScroll = new ScrollArea(this, mList, showBackground, "social_background.xml"); mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO); @@ -308,7 +309,8 @@ private: class SocialGuildTab2 final : public SocialTab, public ActionListener { public: - SocialGuildTab2(const Widget2 *const widget, Guild *const guild, + SocialGuildTab2(const Widget2 *const widget, + Guild *const guild, const bool showBackground) : SocialTab(widget), ActionListener() @@ -326,7 +328,7 @@ public: mList = new AvatarListBox(this, guild); mList->postInit(); - mScroll = new ScrollArea(mList, showBackground, + mScroll = new ScrollArea(this, mList, showBackground, "social_background.xml"); mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO); @@ -376,7 +378,8 @@ class SocialPartyTab final : public SocialTab, public ActionListener { public: SocialPartyTab(const Widget2 *const widget, - Party *const party, const bool showBackground) : + Party *const party, + const bool showBackground) : SocialTab(widget), ActionListener(), mParty(party) @@ -394,7 +397,7 @@ public: mList = new AvatarListBox(this, party); mList->postInit(); - mScroll = new ScrollArea(mList, showBackground, + mScroll = new ScrollArea(this, mList, showBackground, "social_background.xml"); mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO); @@ -538,13 +541,14 @@ class SocialPlayersTab final : public SocialTab { public: SocialPlayersTab(const Widget2 *const widget, - std::string name, const bool showBackground) : + std::string name, + const bool showBackground) : SocialTab(widget), mBeings(new BeingsListModal) { mList = new AvatarListBox(this, mBeings); mList->postInit(); - mScroll = new ScrollArea(mList, showBackground, + mScroll = new ScrollArea(this, mList, showBackground, "social_background.xml"); mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO); @@ -710,7 +714,7 @@ public: { mList = new AvatarListBox(this, mBeings); mList->postInit(); - mScroll = new ScrollArea(mList, showBackground, + mScroll = new ScrollArea(this, mList, showBackground, "social_background.xml"); mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO); @@ -1039,7 +1043,7 @@ public: { mList = new AvatarListBox(this, mBeings); mList->postInit(); - mScroll = new ScrollArea(mList, showBackground, + mScroll = new ScrollArea(this, mList, showBackground, "social_background.xml"); mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO); @@ -1086,7 +1090,7 @@ public: { mList = new AvatarListBox(this, mBeings); mList->postInit(); - mScroll = new ScrollArea(mList, showBackground, + mScroll = new ScrollArea(this, mList, showBackground, "social_background.xml"); mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO); @@ -1126,13 +1130,14 @@ class SocialFriendsTab final : public SocialTab { public: SocialFriendsTab(const Widget2 *const widget, - std::string name, const bool showBackground) : + std::string name, + const bool showBackground) : SocialTab(widget), mBeings(new BeingsListModal) { mList = new AvatarListBox(this, mBeings); mList->postInit(); - mScroll = new ScrollArea(mList, showBackground, + mScroll = new ScrollArea(this, mList, showBackground, "social_background.xml"); mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO); diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 1279961e6..05172c9b3 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -159,9 +159,9 @@ StatusWindow::StatusWindow() : mJobLabel(nullptr), mJobBar(nullptr), mAttrCont(new VertContainer(this, 32)), - mAttrScroll(new ScrollArea(mAttrCont, false)), + mAttrScroll(new ScrollArea(this, mAttrCont, false)), mDAttrCont(new VertContainer(this, 32)), - mDAttrScroll(new ScrollArea(mDAttrCont, false)), + mDAttrScroll(new ScrollArea(this, mDAttrCont, false)), mCharacterPointsLabel(new Label(this, "C")), mCorrectionPointsLabel(nullptr), // TRANSLATORS: status window button diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index d94b78c34..25d077d5d 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -110,13 +110,14 @@ TradeWindow::TradeWindow(): mMyItemContainer->addSelectionListener(this); - ScrollArea *const myScroll = new ScrollArea(mMyItemContainer, + ScrollArea *const myScroll = new ScrollArea(this, mMyItemContainer, true, "trade_background.xml"); myScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mPartnerItemContainer->addSelectionListener(this); - ScrollArea *const partnerScroll = new ScrollArea(mPartnerItemContainer, + ScrollArea *const partnerScroll = new ScrollArea(this, + mPartnerItemContainer, true, "trade_background.xml"); partnerScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 8e31939ff..e72308da7 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -190,7 +190,8 @@ UpdaterWindow::UpdaterWindow(const std::string &restrict updateHost, "updateprogressbar.xml", "updateprogressbar_fill.xml")), mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, "browserbox.xml")), - mScrollArea(new ScrollArea(mBrowserBox, true, "update_background.xml")), + mScrollArea(new ScrollArea(this, mBrowserBox, + true, "update_background.xml")), mUpdateServerPath(mUpdateHost) { setWindowName("UpdaterWindow"); diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index 1af21866d..76f12f795 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -87,7 +87,7 @@ WhoIsOnline::WhoIsOnline() : mCurlError(new char[CURL_ERROR_SIZE]), mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, "onlinebrowserbox.xml")), - mScrollArea(new ScrollArea(mBrowserBox, false)), + mScrollArea(new ScrollArea(this, mBrowserBox, false)), mUpdateTimer(0), mOnlinePlayers(), mOnlineNicks(), diff --git a/src/gui/windows/worldselectdialog.cpp b/src/gui/windows/worldselectdialog.cpp index 0d861b85c..3c7602a70 100644 --- a/src/gui/windows/worldselectdialog.cpp +++ b/src/gui/windows/worldselectdialog.cpp @@ -93,7 +93,7 @@ WorldSelectDialog::WorldSelectDialog(Worlds worlds): mChooseWorld(new Button(this, _("Choose World"), "world", this)) { mWorldList->postInit(); - ScrollArea *const worldsScroll = new ScrollArea(mWorldList, + ScrollArea *const worldsScroll = new ScrollArea(this, mWorldList, getOptionBool("showbackground"), "world_background.xml"); worldsScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); diff --git a/src/net/ea/gui/guildtab.h b/src/net/ea/gui/guildtab.h index 2b6a4bd1a..931b53397 100644 --- a/src/net/ea/gui/guildtab.h +++ b/src/net/ea/gui/guildtab.h @@ -31,7 +31,8 @@ namespace Ea /** * A tab for a guild chat channel. */ -class GuildTab : public ChatTab, public ConfigListener +class GuildTab : public ChatTab, + public ConfigListener { public: explicit GuildTab(const Widget2 *const widget); diff --git a/src/net/ea/gui/partytab.h b/src/net/ea/gui/partytab.h index d141452d0..6c61990dd 100644 --- a/src/net/ea/gui/partytab.h +++ b/src/net/ea/gui/partytab.h @@ -31,7 +31,8 @@ namespace Ea /** * A tab for a party chat channel. */ -class PartyTab : public ChatTab, public ConfigListener +class PartyTab : public ChatTab, + public ConfigListener { public: explicit PartyTab(const Widget2 *const widget); -- cgit v1.2.3-70-g09d2 From 26f9aad24bc50d4e9fd161d185df049c9e7a62cf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 19 Feb 2014 01:18:16 +0300 Subject: improve includes. --- src/actionmanager.cpp | 4 +--- src/being/actorsprite.cpp | 3 +++ src/being/being.cpp | 1 + src/being/being.h | 10 +++++++--- src/being/localplayer.cpp | 5 +++-- src/being/playerrelations.cpp | 2 ++ src/being/playerrelations.h | 3 +-- src/client.cpp | 3 ++- src/commandhandler.cpp | 2 ++ src/commandhandler.h | 5 +++-- src/configuration.cpp | 1 + src/defaults.cpp | 1 + src/defaults.h | 4 ++-- src/events/actionevent.h | 6 +++--- src/events/event.h | 6 +++--- src/events/inputguievent.h | 6 +++--- src/events/keyevent.h | 6 +++--- src/events/mouseevent.h | 6 +++--- src/events/selectionevent.h | 6 +++--- src/graphicsvertexes.h | 4 +++- src/gui/base/basiccontainer.cpp | 2 -- src/gui/base/basiccontainer.hpp | 3 +-- src/gui/base/gui.cpp | 5 ----- src/gui/base/gui.hpp | 1 - src/gui/base/rectangle.hpp | 3 +++ src/gui/base/widget.cpp | 7 ------- src/gui/base/widget.hpp | 4 +--- src/gui/base/widgets/button.cpp | 5 ----- src/gui/base/widgets/button.hpp | 2 -- src/gui/base/widgets/checkbox.cpp | 7 ------- src/gui/base/widgets/checkbox.hpp | 2 +- src/gui/base/widgets/container.hpp | 6 +----- src/gui/base/widgets/listbox.cpp | 8 -------- src/gui/base/widgets/radiobutton.cpp | 7 ------- src/gui/base/widgets/radiobutton.hpp | 2 +- src/gui/base/widgets/scrollarea.cpp | 3 --- src/gui/base/widgets/scrollarea.hpp | 2 -- src/gui/base/widgets/slider.cpp | 5 ----- src/gui/base/widgets/textbox.cpp | 5 ----- src/gui/base/widgets/textbox.hpp | 1 - src/gui/base/widgets/textfield.cpp | 5 ----- src/gui/base/widgets/window.cpp | 4 ---- src/gui/focushandler.cpp | 2 ++ src/gui/font.cpp | 1 - src/gui/gui.cpp | 2 ++ src/gui/gui.h | 3 +-- src/gui/popups/beingpopup.cpp | 1 + src/gui/popups/itempopup.cpp | 1 + src/gui/popups/itempopup.h | 1 + src/gui/popups/popupmenu.cpp | 2 ++ src/gui/popups/popupmenu.h | 1 + src/gui/popups/speechbubble.cpp | 2 +- src/gui/popups/spellpopup.cpp | 1 + src/gui/sdlinput.h | 7 +++---- src/gui/widgets/browserbox.h | 2 -- src/gui/widgets/button.cpp | 2 ++ src/gui/widgets/button.h | 2 -- src/gui/widgets/characterdisplay.cpp | 5 +++-- src/gui/widgets/characterdisplay.h | 8 +++++--- src/gui/widgets/characterviewnormal.cpp | 1 - src/gui/widgets/characterviewsmall.cpp | 2 ++ src/gui/widgets/characterviewsmall.h | 2 ++ src/gui/widgets/checkbox.cpp | 1 + src/gui/widgets/checkbox.h | 2 -- src/gui/widgets/container.cpp | 2 ++ src/gui/widgets/container.h | 2 -- src/gui/widgets/dropdown.cpp | 1 + src/gui/widgets/dropdown.h | 7 ++++++- src/gui/widgets/dropshortcutcontainer.h | 2 +- src/gui/widgets/emotepage.h | 2 -- src/gui/widgets/emoteshortcutcontainer.cpp | 2 ++ src/gui/widgets/emoteshortcutcontainer.h | 6 +++--- src/gui/widgets/guitable.cpp | 4 ++-- src/gui/widgets/icon.cpp | 2 ++ src/gui/widgets/icon.h | 2 -- src/gui/widgets/itemcontainer.h | 2 -- src/gui/widgets/label.cpp | 1 + src/gui/widgets/layout.cpp | 2 ++ src/gui/widgets/layout.h | 8 ++++++-- src/gui/widgets/layouthelper.cpp | 2 ++ src/gui/widgets/listbox.h | 2 -- src/gui/widgets/playerbox.cpp | 2 ++ src/gui/widgets/progressbar.h | 2 -- src/gui/widgets/progressindicator.cpp | 2 ++ src/gui/widgets/progressindicator.h | 4 +--- src/gui/widgets/radiobutton.cpp | 1 + src/gui/widgets/radiobutton.h | 2 -- src/gui/widgets/scrollarea.cpp | 4 ++++ src/gui/widgets/scrollarea.h | 2 -- src/gui/widgets/setupitem.cpp | 4 ++++ src/gui/widgets/setupitem.h | 8 ++++++-- src/gui/widgets/setuptouchitem.cpp | 2 ++ src/gui/widgets/shortcutcontainer.cpp | 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 | 7 +++++-- src/gui/widgets/spellshortcutcontainer.cpp | 1 - src/gui/widgets/tabbedarea.cpp | 2 ++ src/gui/widgets/tabbedarea.h | 2 -- src/gui/widgets/tabs/chattab.cpp | 1 + src/gui/widgets/tabs/setup_audio.h | 2 ++ src/gui/widgets/tabs/setup_colors.cpp | 1 + src/gui/widgets/tabs/setup_colors.h | 2 -- src/gui/widgets/tabs/setup_input.cpp | 1 + src/gui/widgets/tabs/setup_relations.h | 2 ++ src/gui/widgets/tabs/setup_theme.cpp | 2 ++ src/gui/widgets/tabs/setup_touch.cpp | 2 ++ src/gui/widgets/tabs/setup_touch.h | 5 ++++- src/gui/widgets/tabs/setup_visual.h | 2 ++ src/gui/widgets/tabs/tab.cpp | 4 ++++ src/gui/widgets/tabs/tab.h | 2 -- src/gui/widgets/textbox.cpp | 1 + src/gui/widgets/textbox.h | 2 -- src/gui/widgets/textfield.cpp | 2 +- src/gui/widgets/textpreview.h | 2 -- src/gui/widgets/widget2.h | 1 - src/gui/widgets/window.h | 2 -- src/gui/windowmenu.cpp | 2 ++ src/gui/windowmenu.h | 4 ++-- src/gui/windows/buydialog.h | 1 - src/gui/windows/charcreatedialog.cpp | 1 + src/gui/windows/charcreatedialog.h | 4 +++- src/gui/windows/charselectdialog.cpp | 1 + src/gui/windows/charselectdialog.h | 1 - src/gui/windows/chatwindow.cpp | 3 +-- src/gui/windows/didyouknowwindow.cpp | 5 +++-- src/gui/windows/helpwindow.cpp | 5 +++-- src/gui/windows/inventorywindow.cpp | 3 +++ src/gui/windows/inventorywindow.h | 1 - src/gui/windows/itemamountwindow.cpp | 2 ++ src/gui/windows/npcdialog.h | 1 - src/gui/windows/questswindow.cpp | 3 ++- src/gui/windows/serverdialog.cpp | 4 +++- src/gui/windows/serverdialog.h | 2 +- src/gui/windows/setupwindow.cpp | 1 + src/gui/windows/textcommandeditor.cpp | 2 ++ src/gui/windows/tradewindow.cpp | 1 + src/input/inputmanager.cpp | 4 ++-- src/input/key.h | 2 +- src/input/mouseinput.h | 6 +++--- src/input/multitouchmanager.h | 2 ++ src/listeners/actionlistener.h | 6 +++--- src/listeners/deathlistener.h | 6 +++--- src/listeners/focuslistener.h | 6 +++--- src/listeners/keylistener.h | 6 +++--- src/listeners/mouselistener.h | 6 +++--- src/listeners/playerrelationslistener.h | 6 +++--- src/listeners/selectionlistener.h | 6 +++--- src/listeners/widgetlistener.h | 6 +++--- src/logger.cpp | 3 ++- src/maplayer.cpp | 1 + src/net/ea/buysellhandler.cpp | 2 -- src/net/ea/charserverhandler.cpp | 1 + src/net/ea/charserverhandler.h | 9 +++++++-- src/net/ea/chathandler.cpp | 2 ++ src/net/ea/chathandler.h | 6 +++++- src/net/ea/gamehandler.cpp | 2 ++ src/net/ea/gamehandler.h | 6 +++++- src/net/ea/gui/guildtab.cpp | 3 +-- src/net/ea/guildhandler.cpp | 4 ++++ src/net/ea/guildhandler.h | 7 +++++-- src/net/ea/inventoryhandler.cpp | 2 ++ src/net/ea/inventoryhandler.h | 6 +++++- src/net/ea/itemhandler.cpp | 2 ++ src/net/ea/itemhandler.h | 7 +++++++ src/net/ea/loginhandler.cpp | 2 ++ src/net/ea/loginhandler.h | 6 +++++- src/net/ea/npchandler.cpp | 2 ++ src/net/ea/npchandler.h | 8 +++++++- src/net/ea/partyhandler.cpp | 5 +++++ src/net/ea/partyhandler.h | 9 ++++++--- src/net/ea/playerhandler.cpp | 1 + src/net/ea/playerhandler.h | 6 +++++- src/net/ea/skillhandler.cpp | 2 ++ src/net/ea/skillhandler.h | 8 +++++++- src/net/ea/tradehandler.cpp | 1 + src/net/ea/tradehandler.h | 6 +++++- src/net/eathena/chathandler.cpp | 3 +-- src/net/eathena/chathandler.h | 2 +- src/net/eathena/generalhandler.cpp | 1 + src/net/eathena/network.cpp | 1 + src/net/eathena/network.h | 3 +-- src/net/eathena/partyhandler.cpp | 1 + src/net/tmwa/chathandler.cpp | 3 +-- src/net/tmwa/chathandler.h | 2 +- src/net/tmwa/generalhandler.cpp | 1 + src/net/tmwa/network.cpp | 1 + src/net/tmwa/network.h | 3 +-- src/net/tmwa/partyhandler.cpp | 1 + src/net/tmwa/pethandler.cpp | 3 +-- src/net/tradehandler.h | 2 ++ src/render/sdlgraphics.cpp | 2 ++ src/simpleanimation.cpp | 1 - src/statuseffect.cpp | 3 +++ src/statuseffect.h | 7 ++++--- src/touchmanager.cpp | 2 ++ src/touchmanager.h | 3 +-- src/utils/files.cpp | 1 - src/utils/paths.cpp | 2 ++ src/utils/sdlpixel.h | 6 +++--- src/utils/translation/poparser.cpp | 2 ++ src/utils/translation/poparser.h | 4 ++-- src/utils/xml.h | 2 +- 205 files changed, 376 insertions(+), 278 deletions(-) (limited to 'src/gui/widgets/browserbox.h') diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp index 473e6cbc7..b8ea34286 100644 --- a/src/actionmanager.cpp +++ b/src/actionmanager.cpp @@ -31,10 +31,9 @@ #include "being/playerinfo.h" #include "being/playerrelations.h" -#include "events/inputevent.h" - #include "input/inputmanager.h" +#include "gui/gui.h" #include "gui/sdlinput.h" #include "gui/viewport.h" @@ -45,7 +44,6 @@ #include "gui/windows/questswindow.h" #include "gui/windows/quitdialog.h" #include "gui/windows/whoisonline.h" - #include "gui/windows/botcheckerwindow.h" #include "gui/windows/buyselldialog.h" #include "gui/windows/chatwindow.h" diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index a74f4f477..bbb016525 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -21,6 +21,7 @@ #include "being/actorsprite.h" +#include "animatedsprite.h" #include "configuration.h" #include "imagesprite.h" #include "statuseffect.h" @@ -31,6 +32,8 @@ #include "listeners/actorspritelistener.h" +#include "particle/particle.h" + #include "resources/resourcemanager.h" #include "utils/checkutils.h" diff --git a/src/being/being.cpp b/src/being/being.cpp index 1fcccb0cf..76af509d3 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -40,6 +40,7 @@ #include "particle/particleinfo.h" #include "gui/font.h" +#include "gui/gui.h" #include "gui/popups/speechbubble.h" diff --git a/src/being/being.h b/src/being/being.h index c8da2d97c..afa023068 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -23,12 +23,10 @@ #ifndef BEING_BEING_H #define BEING_BEING_H -#include "equipment.h" +//#include "equipment.h" #include "resources/beinginfo.h" -#include "gui/base/color.hpp" - #include #include "localconsts.h" @@ -45,6 +43,7 @@ static const int DEFAULT_BEING_HEIGHT = 32; class AnimatedSprite; class BeingCacheEntry; +class Equipment; class FlashText; class Guild; class ItemInfo; @@ -55,6 +54,11 @@ class Text; struct ParticleInfo; +namespace gcn +{ + class Color; +} + extern volatile int cur_time; enum Gender diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 0e57eabfe..2a3c5fa2f 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -23,6 +23,7 @@ #include "being/localplayer.h" #include "actormanager.h" +#include "animatedsprite.h" #include "client.h" #include "configuration.h" #include "dropshortcut.h" @@ -42,7 +43,6 @@ #include "input/keyboardconfig.h" -#include "gui/font.h" #include "gui/gui.h" #include "gui/viewport.h" @@ -51,7 +51,6 @@ #include "gui/windows/okdialog.h" #include "gui/windows/outfitwindow.h" #include "gui/windows/shopwindow.h" -#include "gui/windows/skilldialog.h" #include "gui/windows/socialwindow.h" #include "gui/windows/updaterwindow.h" @@ -85,6 +84,8 @@ typedef std::map::const_iterator GuildMapCIter; LocalPlayer *player_node = nullptr; +class SkillDialog; + extern std::list beingInfoCache; extern OkDialog *weightNotice; extern int weightNoticeTime; diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp index a04c77e76..4404791ca 100644 --- a/src/being/playerrelations.cpp +++ b/src/being/playerrelations.cpp @@ -30,6 +30,8 @@ #include "utils/dtor.h" #include "utils/gettext.h" +#include "listeners/playerrelationslistener.h" + #include #include "debug.h" diff --git a/src/being/playerrelations.h b/src/being/playerrelations.h index cddec5f10..3543d4221 100644 --- a/src/being/playerrelations.h +++ b/src/being/playerrelations.h @@ -25,14 +25,13 @@ #include "utils/stringvector.h" -#include "listeners/playerrelationslistener.h" - #include #include #include "localconsts.h" class Being; +class PlayerRelationsListener; struct PlayerRelation final { diff --git a/src/client.cpp b/src/client.cpp index 0fac5b3f2..a08406d10 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -85,6 +85,8 @@ #include "net/netconsts.h" #include "net/partyhandler.h" +#include "particle/particle.h" + #include "resources/imagehelper.h" #include "resources/openglimagehelper.h" #include "resources/surfaceimagehelper.h" @@ -112,7 +114,6 @@ #include "utils/files.h" #include "utils/fuzzer.h" #include "utils/gettext.h" -#include "utils/files.h" #include "utils/mkdir.h" #include "utils/paths.h" #include "utils/physfstools.h" diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 6d3881432..ef8acc26c 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -22,6 +22,8 @@ #include "commandhandler.h" +#include "commands.h" + #include "input/inputmanager.h" #include "gui/widgets/tabs/chattab.h" diff --git a/src/commandhandler.h b/src/commandhandler.h index de1561d74..b2b74d77d 100644 --- a/src/commandhandler.h +++ b/src/commandhandler.h @@ -23,15 +23,16 @@ #ifndef COMMANDHANDLER_H #define COMMANDHANDLER_H -#include "commands.h" - #include +#include #include #include "localconsts.h" class ChatTab; +struct CommandInfo; + extern ChatTab *localChatTab; typedef std::map CommandsMap; diff --git a/src/configuration.cpp b/src/configuration.cpp index 7d6fc43fd..ed2adfc61 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -23,6 +23,7 @@ #include "configuration.h" #include "logger.h" +#include "variabledata.h" #include "listeners/configlistener.h" diff --git a/src/defaults.cpp b/src/defaults.cpp index c343f9f11..7a110a539 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -22,6 +22,7 @@ #include "defaults.h" #include "graphicsmanager.h" +#include "variabledata.h" #include "being/being.h" diff --git a/src/defaults.h b/src/defaults.h index e4ba4d5ae..abc9eb50c 100644 --- a/src/defaults.h +++ b/src/defaults.h @@ -22,13 +22,13 @@ #ifndef DEFAULTS_H #define DEFAULTS_H -#include "variabledata.h" - #include #include #include "localconsts.h" +class VariableData; + typedef std::map DefaultsData; VariableData* createData(const int defData) A_WARN_UNUSED; diff --git a/src/events/actionevent.h b/src/events/actionevent.h index 70ed0f398..3164955e6 100644 --- a/src/events/actionevent.h +++ b/src/events/actionevent.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef EVENTS_ACTIONEVENT_HPP -#define EVENTS_ACTIONEVENT_HPP +#ifndef EVENTS_ACTIONEVENT_H +#define EVENTS_ACTIONEVENT_H #include "events/event.h" @@ -136,4 +136,4 @@ class ActionEvent final : public Event std::string mId; }; -#endif // EVENTS_ACTIONEVENT_HPP +#endif // EVENTS_ACTIONEVENT_H diff --git a/src/events/event.h b/src/events/event.h index d62dd672b..b71d0edd4 100644 --- a/src/events/event.h +++ b/src/events/event.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef EVENTS_EVENT_HPP -#define EVENTS_EVENT_HPP +#ifndef EVENTS_EVENT_H +#define EVENTS_EVENT_H #include "localconsts.h" @@ -114,4 +114,4 @@ class Event gcn::Widget* mSource; }; -#endif // EVENTS_EVENT_HPP +#endif // EVENTS_EVENT_H diff --git a/src/events/inputguievent.h b/src/events/inputguievent.h index a2aefc35f..8523959ed 100644 --- a/src/events/inputguievent.h +++ b/src/events/inputguievent.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef EVENTS_INPUTEVENT_HPP -#define EVENTS_INPUTEVENT_HPP +#ifndef EVENTS_INPUTGUIEVENT_H +#define EVENTS_INPUTGUIEVENT_H #include "events/event.h" @@ -184,4 +184,4 @@ class InputGuiEvent: public Event bool mIsConsumed; }; -#endif // EVENTS_INPUTEVENT_HPP +#endif // EVENTS_INPUTGUIEVENT_H diff --git a/src/events/keyevent.h b/src/events/keyevent.h index 728cd79ea..c0c950639 100644 --- a/src/events/keyevent.h +++ b/src/events/keyevent.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef EVENTS_KEYEVENT_HPP -#define EVENTS_KEYEVENT_HPP +#ifndef EVENTS_KEYEVENT_H +#define EVENTS_KEYEVENT_H #include "events/inputguievent.h" #include "input/key.h" @@ -191,4 +191,4 @@ class KeyEvent: public InputGuiEvent bool mIsNumericPad; }; -#endif // EVENTS_KEYEVENT_HPP +#endif // EVENTS_KEYEVENT_H diff --git a/src/events/mouseevent.h b/src/events/mouseevent.h index 9284822ba..9378faac6 100644 --- a/src/events/mouseevent.h +++ b/src/events/mouseevent.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef EVENTS_MOUSEEVENT_HPP -#define EVENTS_MOUSEEVENT_HPP +#ifndef EVENTS_MOUSEEVENT_H +#define EVENTS_MOUSEEVENT_H #include "events/inputguievent.h" @@ -237,4 +237,4 @@ class MouseEvent: public InputGuiEvent friend class gcn::Gui; }; -#endif // EVENTS_MOUSEEVENT_HPP +#endif // EVENTS_MOUSEEVENT_H diff --git a/src/events/selectionevent.h b/src/events/selectionevent.h index fc030cab0..b2e91e04f 100644 --- a/src/events/selectionevent.h +++ b/src/events/selectionevent.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef EVENTS_SELECTIONEVENT_HPP -#define EVENTS_SELECTIONEVENT_HPP +#ifndef EVENTS_SELECTIONEVENT_H +#define EVENTS_SELECTIONEVENT_H #include "events/event.h" @@ -98,4 +98,4 @@ class SelectionEvent final: public Event { } }; -#endif // EVENTS_SELECTIONEVENT_HPP +#endif // EVENTS_SELECTIONEVENT_H diff --git a/src/graphicsvertexes.h b/src/graphicsvertexes.h index 15256113f..8746bcce3 100644 --- a/src/graphicsvertexes.h +++ b/src/graphicsvertexes.h @@ -38,10 +38,12 @@ #endif -#include "resources/image.h" +#include #include +class Image; + struct DoubleRect final { SDL_Rect src; diff --git a/src/gui/base/basiccontainer.cpp b/src/gui/base/basiccontainer.cpp index 05d89f172..edc465726 100644 --- a/src/gui/base/basiccontainer.cpp +++ b/src/gui/base/basiccontainer.cpp @@ -71,8 +71,6 @@ #include "gui/focushandler.h" -#include "input/mouseinput.h" - #include "render/graphics.h" #include "debug.h" diff --git a/src/gui/base/basiccontainer.hpp b/src/gui/base/basiccontainer.hpp index cc3aee808..fd28ef7b6 100644 --- a/src/gui/base/basiccontainer.hpp +++ b/src/gui/base/basiccontainer.hpp @@ -64,7 +64,6 @@ #ifndef GCN_BASICCONTAINER_HPP #define GCN_BASICCONTAINER_HPP -#include #include #include "gui/base/widget.hpp" @@ -85,7 +84,7 @@ namespace gcn public DeathListener { public: - BasicContainer(const Widget2 *const widget) : + explicit BasicContainer(const Widget2 *const widget) : Widget(widget), DeathListener(), mWidgets() diff --git a/src/gui/base/gui.cpp b/src/gui/base/gui.cpp index f62e24260..d5b23e960 100644 --- a/src/gui/base/gui.cpp +++ b/src/gui/base/gui.cpp @@ -67,20 +67,15 @@ #include "gui/base/gui.hpp" -#include "gui/base/basiccontainer.hpp" #include "gui/base/widget.hpp" #include "gui/focushandler.h" -#include "gui/sdlinput.h" -#include "input/keyinput.h" #include "input/mouseinput.h" #include "listeners/keylistener.h" #include "listeners/mouselistener.h" -#include "render/graphics.h" - #include "debug.h" namespace gcn diff --git a/src/gui/base/gui.hpp b/src/gui/base/gui.hpp index f614c00fd..391a0520e 100644 --- a/src/gui/base/gui.hpp +++ b/src/gui/base/gui.hpp @@ -68,7 +68,6 @@ #include #include "events/keyevent.h" -#include "events/mouseevent.h" #include "input/mouseinput.h" diff --git a/src/gui/base/rectangle.hpp b/src/gui/base/rectangle.hpp index b8503db98..299ce99b9 100644 --- a/src/gui/base/rectangle.hpp +++ b/src/gui/base/rectangle.hpp @@ -95,6 +95,9 @@ namespace gcn */ Rectangle(const int x, const int y, const int width, const int height); + virtual ~Rectangle() + { } + /** * Sets the dimension of a rectangle. * diff --git a/src/gui/base/widget.cpp b/src/gui/base/widget.cpp index f5994d1af..692ea479c 100644 --- a/src/gui/base/widget.cpp +++ b/src/gui/base/widget.cpp @@ -71,17 +71,10 @@ #include "events/event.h" -#include "gui/base/basiccontainer.hpp" - #include "gui/focushandler.h" -#include "input/keyinput.h" -#include "input/mouseinput.h" - #include "listeners/actionlistener.h" #include "listeners/deathlistener.h" -#include "listeners/keylistener.h" -#include "listeners/mouselistener.h" #include "listeners/widgetlistener.h" #include "render/graphics.h" diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp index 013ead3b8..6245d3c98 100644 --- a/src/gui/base/widget.hpp +++ b/src/gui/base/widget.hpp @@ -89,8 +89,6 @@ class WidgetListener; namespace gcn { - class BasicContainer; - /** * Abstract class for widgets of Guichan. It contains basic functions * every widget should have. @@ -110,7 +108,7 @@ namespace gcn * focusable as default, therefore, widgets that are supposed to be * focusable should overide this default in their own constructor. */ - Widget(const Widget2 *const widget); + explicit Widget(const Widget2 *const widget); A_DELETE_COPY(Widget) diff --git a/src/gui/base/widgets/button.cpp b/src/gui/base/widgets/button.cpp index e4285cffd..5187c625b 100644 --- a/src/gui/base/widgets/button.cpp +++ b/src/gui/base/widgets/button.cpp @@ -67,11 +67,6 @@ #include "gui/base/widgets/button.hpp" -#include "gui/font.h" - -#include "input/key.h" -#include "input/mouseinput.h" - #include "events/mouseevent.h" #include "render/graphics.h" diff --git a/src/gui/base/widgets/button.hpp b/src/gui/base/widgets/button.hpp index 7fd5613bd..fea175362 100644 --- a/src/gui/base/widgets/button.hpp +++ b/src/gui/base/widgets/button.hpp @@ -70,8 +70,6 @@ #include "listeners/keylistener.h" #include "listeners/mouselistener.h" -#include "events/mouseevent.h" - #include "gui/base/widget.hpp" #include "render/graphics.h" diff --git a/src/gui/base/widgets/checkbox.cpp b/src/gui/base/widgets/checkbox.cpp index d75fb5cb0..a5ec72dfa 100644 --- a/src/gui/base/widgets/checkbox.cpp +++ b/src/gui/base/widgets/checkbox.cpp @@ -67,13 +67,6 @@ #include "gui/base/widgets/checkbox.hpp" -#include "gui/font.h" - -#include "input/key.h" -#include "input/mouseinput.h" - -#include "render/graphics.h" - #include "debug.h" namespace gcn diff --git a/src/gui/base/widgets/checkbox.hpp b/src/gui/base/widgets/checkbox.hpp index d87a6b206..c79ccaff9 100644 --- a/src/gui/base/widgets/checkbox.hpp +++ b/src/gui/base/widgets/checkbox.hpp @@ -90,7 +90,7 @@ namespace gcn /** * Contructor. */ - CheckBox(const Widget2 *const widget); + explicit CheckBox(const Widget2 *const widget); /** * Constructor. The check box will be automatically resized diff --git a/src/gui/base/widgets/container.hpp b/src/gui/base/widgets/container.hpp index ba3cff153..3e6c0a587 100644 --- a/src/gui/base/widgets/container.hpp +++ b/src/gui/base/widgets/container.hpp @@ -64,12 +64,8 @@ #ifndef GCN_CONTAINER_HPP #define GCN_CONTAINER_HPP -#include - #include "gui/base/basiccontainer.hpp" -#include "render/graphics.h" - namespace gcn { /** @@ -89,7 +85,7 @@ namespace gcn * * @see setOpaque, isOpaque */ - Container(const Widget2 *const widget); + explicit Container(const Widget2 *const widget); /** * Destructor. diff --git a/src/gui/base/widgets/listbox.cpp b/src/gui/base/widgets/listbox.cpp index 0dd5c88f7..02d94626c 100644 --- a/src/gui/base/widgets/listbox.cpp +++ b/src/gui/base/widgets/listbox.cpp @@ -69,16 +69,8 @@ #include "gui/font.h" -#include "gui/base/basiccontainer.hpp" -#include "gui/base/listmodel.hpp" - -#include "input/key.h" -#include "input/mouseinput.h" - #include "listeners/selectionlistener.h" -#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 832c00bbe..e17b9f776 100644 --- a/src/gui/base/widgets/radiobutton.cpp +++ b/src/gui/base/widgets/radiobutton.cpp @@ -67,13 +67,6 @@ #include "gui/base/widgets/radiobutton.hpp" -#include "gui/font.h" - -#include "input/key.h" -#include "input/mouseinput.h" - -#include "render/graphics.h" - #include "debug.h" namespace gcn diff --git a/src/gui/base/widgets/radiobutton.hpp b/src/gui/base/widgets/radiobutton.hpp index 4d4403fac..f4bfd53fa 100644 --- a/src/gui/base/widgets/radiobutton.hpp +++ b/src/gui/base/widgets/radiobutton.hpp @@ -93,7 +93,7 @@ namespace gcn /** * Constructor. */ - RadioButton(const Widget2 *const widget); + explicit RadioButton(const Widget2 *const widget); /** * Constructor. The radio button will be automatically resized diff --git a/src/gui/base/widgets/scrollarea.cpp b/src/gui/base/widgets/scrollarea.cpp index 68e1b72d3..0fc605fa3 100644 --- a/src/gui/base/widgets/scrollarea.cpp +++ b/src/gui/base/widgets/scrollarea.cpp @@ -67,9 +67,6 @@ #include "gui/base/widgets/scrollarea.hpp" - -#include "render/graphics.h" - #include "debug.h" namespace gcn diff --git a/src/gui/base/widgets/scrollarea.hpp b/src/gui/base/widgets/scrollarea.hpp index e2d8aada5..669ccfbdd 100644 --- a/src/gui/base/widgets/scrollarea.hpp +++ b/src/gui/base/widgets/scrollarea.hpp @@ -64,8 +64,6 @@ #ifndef GCN_SCROLLAREA_HPP #define GCN_SCROLLAREA_HPP -#include - #include "gui/base/basiccontainer.hpp" #include "listeners/mouselistener.h" diff --git a/src/gui/base/widgets/slider.cpp b/src/gui/base/widgets/slider.cpp index e995ff55a..4e9df0341 100644 --- a/src/gui/base/widgets/slider.cpp +++ b/src/gui/base/widgets/slider.cpp @@ -67,11 +67,6 @@ #include "gui/base/widgets/slider.hpp" -#include "input/key.h" -#include "input/mouseinput.h" - -#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 7a5b63a50..bb22a6f46 100644 --- a/src/gui/base/widgets/textbox.cpp +++ b/src/gui/base/widgets/textbox.cpp @@ -69,11 +69,6 @@ #include "gui/font.h" -#include "gui/base/basiccontainer.hpp" - -#include "input/key.h" -#include "input/mouseinput.h" - #include "render/graphics.h" #include "debug.h" diff --git a/src/gui/base/widgets/textbox.hpp b/src/gui/base/widgets/textbox.hpp index 0c96096ec..151af8c00 100644 --- a/src/gui/base/widgets/textbox.hpp +++ b/src/gui/base/widgets/textbox.hpp @@ -64,7 +64,6 @@ #ifndef GCN_TEXTBOX_HPP #define GCN_TEXTBOX_HPP -#include #include #include diff --git a/src/gui/base/widgets/textfield.cpp b/src/gui/base/widgets/textfield.cpp index 6ca37c4af..ddcbec1b4 100644 --- a/src/gui/base/widgets/textfield.cpp +++ b/src/gui/base/widgets/textfield.cpp @@ -69,11 +69,6 @@ #include "gui/font.h" -#include "input/key.h" -#include "input/mouseinput.h" - -#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 0ead95bc1..401e3ab6d 100644 --- a/src/gui/base/widgets/window.cpp +++ b/src/gui/base/widgets/window.cpp @@ -67,10 +67,6 @@ #include "gui/base/widgets/window.hpp" -#include "gui/font.h" - -#include "input/mouseinput.h" - #include "render/graphics.h" #include "debug.h" diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp index 22153c91f..0d45b6432 100644 --- a/src/gui/focushandler.cpp +++ b/src/gui/focushandler.cpp @@ -69,6 +69,8 @@ #include "gui/widgets/window.h" +#include "listeners/focuslistener.h" + #include "debug.h" FocusHandler::FocusHandler() : diff --git a/src/gui/font.cpp b/src/gui/font.cpp index a154d8c54..fcc8e8344 100644 --- a/src/gui/font.cpp +++ b/src/gui/font.cpp @@ -77,7 +77,6 @@ #include "resources/surfaceimagehelper.h" #include "utils/paths.h" -#include "utils/physfsrwops.h" #include "utils/sdlcheckutils.h" #include "utils/stringutils.h" #include "utils/timer.h" diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 243b3817e..fdaa299af 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -40,6 +40,8 @@ #include "events/keyevent.h" +#include "listeners/focuslistener.h" + #include "input/keydata.h" #include "input/keyinput.h" #include "input/mouseinput.h" diff --git a/src/gui/gui.h b/src/gui/gui.h index aacd33946..f6b4fbbf6 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -26,10 +26,9 @@ #include "gui/base/color.hpp" #include "gui/base/gui.hpp" -#include "listeners/focuslistener.h" - #include "localconsts.h" +class FocusListener; class Graphics; class GuiConfigListener; class ImageSet; diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp index 32aa11454..07d4b064a 100644 --- a/src/gui/popups/beingpopup.cpp +++ b/src/gui/popups/beingpopup.cpp @@ -25,6 +25,7 @@ #include "being/playerrelations.h" #include "gui/font.h" +#include "gui/gui.h" #include "gui/widgets/label.h" diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp index d6ea5a48a..0a65ce3bc 100644 --- a/src/gui/popups/itempopup.cpp +++ b/src/gui/popups/itempopup.cpp @@ -28,6 +28,7 @@ #include "units.h" #include "gui/font.h" +#include "gui/gui.h" #include "gui/widgets/icon.h" #include "gui/widgets/label.h" diff --git a/src/gui/popups/itempopup.h b/src/gui/popups/itempopup.h index 714e0305c..f1cedf046 100644 --- a/src/gui/popups/itempopup.h +++ b/src/gui/popups/itempopup.h @@ -29,6 +29,7 @@ #include "resources/iteminfo.h" class Icon; +class Item; class Label; class TextBox; diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 450bd504f..a37994884 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -23,6 +23,7 @@ #include "gui/popups/popupmenu.h" #include "actormanager.h" +#include "commands.h" #include "commandhandler.h" #include "configuration.h" #include "dropshortcut.h" @@ -56,6 +57,7 @@ #include "gui/viewport.h" +#include "gui/widgets/button.h" #include "gui/widgets/browserbox.h" #include "gui/widgets/tabs/chattab.h" #include "gui/widgets/progressbar.h" diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index 1ebb0dd89..70f8b7885 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -29,6 +29,7 @@ #include "being/actorsprite.h" #include "listeners/actionlistener.h" + #include "gui/base/listmodel.hpp" #include "localconsts.h" diff --git a/src/gui/popups/speechbubble.cpp b/src/gui/popups/speechbubble.cpp index c74f3f5e6..9bb6157bc 100644 --- a/src/gui/popups/speechbubble.cpp +++ b/src/gui/popups/speechbubble.cpp @@ -24,11 +24,11 @@ #include "gui/popups/speechbubble.h" #include "gui/font.h" +#include "gui/gui.h" #include "gui/viewport.h" #include "gui/widgets/browserbox.h" #include "gui/widgets/label.h" -#include "gui/widgets/textbox.h" #include "debug.h" diff --git a/src/gui/popups/spellpopup.cpp b/src/gui/popups/spellpopup.cpp index 141879da4..8849a53cb 100644 --- a/src/gui/popups/spellpopup.cpp +++ b/src/gui/popups/spellpopup.cpp @@ -24,6 +24,7 @@ #include "gui/popups/spellpopup.h" #include "gui/font.h" +#include "gui/gui.h" #include "gui/widgets/label.h" diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index 8a9128920..29cb5ce1f 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -75,11 +75,10 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GUI_INPUT_H -#define GUI_INPUT_H +#ifndef GUI_SDLINPUT_H +#define GUI_SDLINPUT_H #include "input/keyinput.h" -#include "input/mouseinput.h" #include @@ -163,4 +162,4 @@ protected: bool mMouseInWindow; }; -#endif // GUI_INPUT_H +#endif // GUI_SDLINPUT_H diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 23f221e63..1f09dd0b1 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -24,8 +24,6 @@ #ifndef GUI_WIDGETS_BROWSERBOX_H #define GUI_WIDGETS_BROWSERBOX_H -#include "gui/widgets/widget2.h" - #include "listeners/mouselistener.h" #include "gui/base/widget.hpp" diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index a9b621d90..d7871503e 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -29,9 +29,11 @@ #include "input/keydata.h" +#include "resources/image.h" #include "resources/imageset.h" #include "gui/font.h" +#include "gui/gui.h" #include "debug.h" diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index 73c0d70eb..4f2e9fd89 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_BUTTON_H #define GUI_WIDGETS_BUTTON_H -#include "gui/widgets/widget2.h" - #include "gui/base/widgets/button.hpp" #include "listeners/widgetlistener.h" diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp index bdd740874..7bfc938de 100644 --- a/src/gui/widgets/characterdisplay.cpp +++ b/src/gui/widgets/characterdisplay.cpp @@ -24,6 +24,8 @@ #include "units.h" +#include "gui/gui.h" + #include "gui/windows/charselectdialog.h" #include "gui/popups/textpopup.h" @@ -32,8 +34,7 @@ #include "gui/widgets/layouthelper.h" #include "utils/gettext.h" - -#include +#include "utils/stringutils.h" #include "debug.h" diff --git a/src/gui/widgets/characterdisplay.h b/src/gui/widgets/characterdisplay.h index 8571363c3..8f9acf462 100644 --- a/src/gui/widgets/characterdisplay.h +++ b/src/gui/widgets/characterdisplay.h @@ -26,9 +26,6 @@ #include "gui/widgets/container.h" #include "gui/widgets/playerbox.h" -#include "net/charserverhandler.h" -#include "net/net.h" - #include "listeners/widgetlistener.h" #include "localconsts.h" @@ -37,6 +34,11 @@ class CharSelectDialog; class Label; class TextPopup; +namespace Net +{ + struct Character; +} + class CharacterDisplay final : public Container, public MouseListener, public WidgetListener diff --git a/src/gui/widgets/characterviewnormal.cpp b/src/gui/widgets/characterviewnormal.cpp index 75481268b..1df98d85e 100644 --- a/src/gui/widgets/characterviewnormal.cpp +++ b/src/gui/widgets/characterviewnormal.cpp @@ -23,7 +23,6 @@ #include "configuration.h" #include "gui/widgets/characterdisplay.h" -#include "gui/widgets/characterviewsmall.h" #include "debug.h" diff --git a/src/gui/widgets/characterviewsmall.cpp b/src/gui/widgets/characterviewsmall.cpp index eda1e4a71..4d2c93b48 100644 --- a/src/gui/widgets/characterviewsmall.cpp +++ b/src/gui/widgets/characterviewsmall.cpp @@ -24,6 +24,8 @@ #include "gui/widgets/characterdisplay.h" #include "gui/widgets/label.h" +#include "utils/stringutils.h" + #include "debug.h" CharacterViewSmall::CharacterViewSmall(CharSelectDialog *const widget, diff --git a/src/gui/widgets/characterviewsmall.h b/src/gui/widgets/characterviewsmall.h index 17a549718..a9f6d7f9b 100644 --- a/src/gui/widgets/characterviewsmall.h +++ b/src/gui/widgets/characterviewsmall.h @@ -25,6 +25,8 @@ #include "localconsts.h" +class Label; + class CharacterViewSmall final : public CharacterViewBase { public: diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index e500815c0..63e32a0f9 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -31,6 +31,7 @@ #include "resources/image.h" #include "gui/font.h" +#include "gui/gui.h" #include "debug.h" diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h index e05ab29d3..28eadb75c 100644 --- a/src/gui/widgets/checkbox.h +++ b/src/gui/widgets/checkbox.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_CHECKBOX_H #define GUI_WIDGETS_CHECKBOX_H -#include "gui/widgets/widget2.h" - #include "gui/base/widgets/checkbox.hpp" #include "localconsts.h" diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp index 3c048d630..2d8aad965 100644 --- a/src/gui/widgets/container.cpp +++ b/src/gui/widgets/container.cpp @@ -22,6 +22,8 @@ #include "gui/widgets/container.h" +#include "gui/gui.h" + #include "debug.h" Container::Container(const Widget2 *const widget) : diff --git a/src/gui/widgets/container.h b/src/gui/widgets/container.h index efddb1566..36d7cce86 100644 --- a/src/gui/widgets/container.h +++ b/src/gui/widgets/container.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_CONTAINER_H #define GUI_WIDGETS_CONTAINER_H -#include "gui/widgets/widget2.h" - #include "gui/base/widgets/container.hpp" /** diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 86170036c..6189af75e 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -34,6 +34,7 @@ #include "resources/image.h" #include "gui/font.h" +#include "gui/gui.h" #include diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index b638a2a05..a1908a3c6 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -26,7 +26,7 @@ #include "gui/widgets/widget2.h" #include "gui/base/basiccontainer.hpp" -#include "gui/base/listmodel.hpp" +//#include "gui/base/listmodel.hpp" #include "listeners/actionlistener.h" #include "listeners/focuslistener.h" @@ -43,6 +43,11 @@ class PopupList; class ScrollArea; class Skin; +namespace gcn +{ + class ListModel; +} + /** * A drop down box from which you can select different values. * diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h index dbaac1d9c..236415b32 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(Widget2 *const widget); + explicit DropShortcutContainer(Widget2 *const widget); A_DELETE_COPY(DropShortcutContainer) diff --git a/src/gui/widgets/emotepage.h b/src/gui/widgets/emotepage.h index 8eb1e5f7b..8a508bd26 100644 --- a/src/gui/widgets/emotepage.h +++ b/src/gui/widgets/emotepage.h @@ -21,8 +21,6 @@ #ifndef GUI_WIDGETS_EMOTEPAGE_H #define GUI_WIDGETS_EMOTEPAGE_H -#include "gui/widgets/widget2.h" - #include "listeners/mouselistener.h" #include "listeners/widgetlistener.h" diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 47c45c2dd..296f21126 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -34,6 +34,8 @@ #include "resources/image.h" +#include "resources/db/emotedb.h" + #include "debug.h" static const int MAX_ITEMS = 48; diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index ec0e98675..a3061441f 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -24,12 +24,12 @@ #include "gui/widgets/shortcutcontainer.h" -#include "resources/db/emotedb.h" - #include class TextPopup; +struct EmoteSprite; + /** * An emote shortcut container. Used to quickly use emoticons. * @@ -41,7 +41,7 @@ class EmoteShortcutContainer final : public ShortcutContainer /** * Constructor. Initializes the graphic. */ - EmoteShortcutContainer(Widget2 *const widget); + explicit EmoteShortcutContainer(Widget2 *const widget); A_DELETE_COPY(EmoteShortcutContainer) diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 84bc19e0e..324d4b23e 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -24,6 +24,8 @@ #include "client.h" +#include "gui/gui.h" + #include "events/keyevent.h" #include "input/keydata.h" @@ -32,8 +34,6 @@ #include "listeners/actionlistener.h" -#include "input/key.h" - #include "render/graphics.h" #include "debug.h" diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index 73607c048..73c0db76c 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -22,6 +22,8 @@ #include "gui/widgets/icon.h" +#include "gui/gui.h" + #include "resources/image.h" #include "resources/resourcemanager.h" diff --git a/src/gui/widgets/icon.h b/src/gui/widgets/icon.h index 9dc4827ac..dffdb8e8c 100644 --- a/src/gui/widgets/icon.h +++ b/src/gui/widgets/icon.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_ICON_H #define GUI_WIDGETS_ICON_H -#include "gui/widgets/widget2.h" - #include "gui/base/widget.hpp" #include "localconsts.h" diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index 76dd51ef7..ab813b08f 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_ITEMCONTAINER_H #define GUI_WIDGETS_ITEMCONTAINER_H -#include "gui/widgets/widget2.h" - #include "listeners/keylistener.h" #include "listeners/mouselistener.h" #include "listeners/widgetlistener.h" diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 73e3bca64..0c19d03c3 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -22,6 +22,7 @@ #include "gui/widgets/label.h" #include "gui/font.h" +#include "gui/gui.h" #include "debug.h" diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp index d9a818e0f..f16f40322 100644 --- a/src/gui/widgets/layout.cpp +++ b/src/gui/widgets/layout.cpp @@ -24,6 +24,8 @@ #include "logger.h" +#include "gui/base/widgets/container.hpp" + #include #include "debug.h" diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h index 013963bfa..85998d8e7 100644 --- a/src/gui/widgets/layout.h +++ b/src/gui/widgets/layout.h @@ -25,12 +25,16 @@ #include "localconsts.h" -#include "gui/base/widgets/container.hpp" - #include class LayoutCell; +namespace gcn +{ + class Container; + class Widget; +} + /** * This class is a helper for adding widgets to nested tables in a window. */ diff --git a/src/gui/widgets/layouthelper.cpp b/src/gui/widgets/layouthelper.cpp index 066cabaf8..7b8a428a9 100644 --- a/src/gui/widgets/layouthelper.cpp +++ b/src/gui/widgets/layouthelper.cpp @@ -22,6 +22,8 @@ #include "gui/widgets/layouthelper.h" +#include "gui/base/widgets/container.hpp" + #include "debug.h" LayoutHelper::LayoutHelper(gcn::Container *const container) : diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index cd20ea50a..f1ebee317 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_LISTBOX_H #define GUI_WIDGETS_LISTBOX_H -#include "gui/widgets/widget2.h" - #include "gui/base/widgets/listbox.hpp" #include "localconsts.h" diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 976a1c8f9..7ef543511 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -26,6 +26,8 @@ #include "being/being.h" +#include "gui/gui.h" + #include "resources/image.h" #include "debug.h" diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index 1d4d83687..a2c55e077 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_PROGRESSBAR_H #define GUI_WIDGETS_PROGRESSBAR_H -#include "gui/widgets/widget2.h" - #include "gui/base/widget.hpp" #include "listeners/widgetlistener.h" diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index 8d4cdd67c..f5b295ec8 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -23,6 +23,8 @@ #include "simpleanimation.h" +#include "gui/gui.h" + #include "resources/animation.h" #include "resources/imageset.h" diff --git a/src/gui/widgets/progressindicator.h b/src/gui/widgets/progressindicator.h index 08526c7c2..e62e7ec90 100644 --- a/src/gui/widgets/progressindicator.h +++ b/src/gui/widgets/progressindicator.h @@ -22,8 +22,6 @@ #ifndef GUI_WIDGETS_PROGRESSINDICATOR_H #define GUI_WIDGETS_PROGRESSINDICATOR_H -#include "gui/widgets/widget2.h" - #include "gui/base/widget.hpp" #include "localconsts.h" @@ -37,7 +35,7 @@ class SimpleAnimation; class ProgressIndicator final : public gcn::Widget { public: - ProgressIndicator(Widget2 *const widget); + explicit ProgressIndicator(Widget2 *const widget); A_DELETE_COPY(ProgressIndicator) diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index d52295b57..7b5c5fa11 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -31,6 +31,7 @@ #include "resources/image.h" #include "gui/font.h" +#include "gui/gui.h" #include "debug.h" diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h index faff6bc0e..2deb9a772 100644 --- a/src/gui/widgets/radiobutton.h +++ b/src/gui/widgets/radiobutton.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_RADIOBUTTON_H #define GUI_WIDGETS_RADIOBUTTON_H -#include "gui/widgets/widget2.h" - #include "gui/base/widgets/radiobutton.hpp" #include "localconsts.h" diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 6dd2be526..0cadee888 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -25,6 +25,10 @@ #include "client.h" #include "graphicsvertexes.h" +#include "gui/gui.h" + +#include "resources/image.h" + #include "debug.h" int ScrollArea::instances = 0; diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index bc652e296..39a7eea80 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_SCROLLAREA_H #define GUI_WIDGETS_SCROLLAREA_H -#include "gui/widgets/widget2.h" - #include "gui/base/widgets/scrollarea.hpp" #include "listeners/widgetlistener.h" diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 649388d04..1f5d48d06 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -25,9 +25,11 @@ #include "soundmanager.h" #include "gui/font.h" +#include "gui/gui.h" #include "gui/windows/editdialog.h" +#include "gui/widgets/button.h" #include "gui/widgets/checkbox.h" #include "gui/widgets/dropdown.h" #include "gui/widgets/horizontcontainer.h" @@ -37,6 +39,8 @@ #include "gui/widgets/sliderlist.h" #include "gui/widgets/vertcontainer.h" +#include "gui/widgets/tabs/setuptabscroll.h" + #include "utils/base64.h" #include "utils/gettext.h" #include "utils/mathutils.h" diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h index b5261e2f4..87b7c46f9 100644 --- a/src/gui/widgets/setupitem.h +++ b/src/gui/widgets/setupitem.h @@ -21,14 +21,17 @@ #ifndef GUI_WIDGETS_SETUPITEM_H #define GUI_WIDGETS_SETUPITEM_H -#include "gui/widgets/button.h" -#include "gui/widgets/tabs/setuptabscroll.h" +//#include "gui/widgets/button.h" +//#include "gui/widgets/tabs/setuptabscroll.h" + +#include "gui/widgets/widget2.h" #include "listeners/actionlistener.h" #include #include +class Button; class CheckBox; class Configuration; class DropDown; @@ -36,6 +39,7 @@ class EditDialog; class HorizontContainer; class IntTextField; class Label; +class SetupTabScroll; class Slider; class SliderList; class TextField; diff --git a/src/gui/widgets/setuptouchitem.cpp b/src/gui/widgets/setuptouchitem.cpp index b080de428..f4c213b2f 100644 --- a/src/gui/widgets/setuptouchitem.cpp +++ b/src/gui/widgets/setuptouchitem.cpp @@ -27,6 +27,8 @@ #include "gui/widgets/label.h" #include "gui/widgets/vertcontainer.h" +#include "gui/widgets/tabs/setuptabscroll.h" + #include #include "debug.h" diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index 5df0eafb0..0482281ed 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -24,6 +24,8 @@ #include "graphicsvertexes.h" +#include "gui/gui.h" + #include "debug.h" float ShortcutContainer::mAlpha = 1.0; diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index 610cfef1f..115298081 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_SHORTCUTCONTAINER_H #define GUI_WIDGETS_SHORTCUTCONTAINER_H -#include "gui/widgets/widget2.h" - #include "listeners/mouselistener.h" #include "gui/base/widget.hpp" #include "listeners/widgetlistener.h" diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 0c9b74202..c785f4016 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -29,6 +29,8 @@ #include "input/keydata.h" +#include "gui/gui.h" + #include "resources/image.h" #include "debug.h" diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h index d03799cae..2f21127d1 100644 --- a/src/gui/widgets/slider.h +++ b/src/gui/widgets/slider.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_SLIDER_H #define GUI_WIDGETS_SLIDER_H -#include "gui/widgets/widget2.h" - #include "gui/base/widgets/slider.hpp" #include "localconsts.h" diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index 93a6934ba..c5791f1c2 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -23,6 +23,8 @@ #include "gui/font.h" #include "gui/gui.h" +#include "gui/base/listmodel.hpp" + #include "gui/widgets/button.h" #include "gui/widgets/label.h" diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h index 785ada74b..9adba8080 100644 --- a/src/gui/widgets/sliderlist.h +++ b/src/gui/widgets/sliderlist.h @@ -21,8 +21,6 @@ #ifndef GUI_WIDGETS_SLIDERLIST_H #define GUI_WIDGETS_SLIDERLIST_H -#include "gui/base/listmodel.hpp" - #include "listeners/actionlistener.h" #include "listeners/mouselistener.h" @@ -33,6 +31,11 @@ class Button; class Label; +namespace gcn +{ + class ListModel; +} + class SliderList final : public Container, public ActionListener, public MouseListener diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 5441c4d8a..768206bdb 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -32,7 +32,6 @@ #include "gui/popups/spellpopup.h" -#include "gui/windows/inventorywindow.h" #include "gui/windows/shortcutwindow.h" #include "resources/image.h" diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index af5892845..879ac8ec0 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -69,6 +69,8 @@ #include "input/keydata.h" +#include "gui/gui.h" + #include "gui/widgets/button.h" #include "gui/widgets/scrollarea.h" #include "gui/widgets/tabs/tab.h" diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 1d0794c5c..a95438605 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -66,8 +66,6 @@ #ifndef GUI_WIDGETS_TABBEDAREA_H #define GUI_WIDGETS_TABBEDAREA_H -#include "gui/widgets/widget2.h" - #include "listeners/keylistener.h" #include "listeners/mouselistener.h" #include "listeners/widgetlistener.h" diff --git a/src/gui/widgets/tabs/chattab.cpp b/src/gui/widgets/tabs/chattab.cpp index 283f1927e..b74dc53b8 100644 --- a/src/gui/widgets/tabs/chattab.cpp +++ b/src/gui/widgets/tabs/chattab.cpp @@ -24,6 +24,7 @@ #include "chatlogger.h" #include "client.h" +#include "commands.h" #include "commandhandler.h" #include "configuration.h" #include "soundconsts.h" diff --git a/src/gui/widgets/tabs/setup_audio.h b/src/gui/widgets/tabs/setup_audio.h index 839734b39..aaadebf32 100644 --- a/src/gui/widgets/tabs/setup_audio.h +++ b/src/gui/widgets/tabs/setup_audio.h @@ -25,6 +25,8 @@ #include "gui/widgets/setupitem.h" +#include "gui/widgets/tabs/setuptabscroll.h" + class Setup_Audio final : public SetupTabScroll { public: diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index 2aaad6301..9e78133f5 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -22,6 +22,7 @@ #include "gui/widgets/tabs/setup_colors.h" #include "gui/font.h" +#include "gui/gui.h" #include "gui/userpalette.h" #include "gui/widgets/browserbox.h" diff --git a/src/gui/widgets/tabs/setup_colors.h b/src/gui/widgets/tabs/setup_colors.h index 8864db7db..ce491706c 100644 --- a/src/gui/widgets/tabs/setup_colors.h +++ b/src/gui/widgets/tabs/setup_colors.h @@ -26,8 +26,6 @@ #include "listeners/selectionlistener.h" -#include - class BrowserBox; class Label; class ListBox; diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index 72d05d966..03c8f31e3 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -28,6 +28,7 @@ #include "input/inputmanager.h" #include "input/keyboardconfig.h" +#include "gui/gui.h" #include "gui/setupactiondata.h" #include "gui/windows/okdialog.h" diff --git a/src/gui/widgets/tabs/setup_relations.h b/src/gui/widgets/tabs/setup_relations.h index 55da0bedc..e32889008 100644 --- a/src/gui/widgets/tabs/setup_relations.h +++ b/src/gui/widgets/tabs/setup_relations.h @@ -27,6 +27,8 @@ #include "gui/widgets/tabs/setuptab.h" +#include "listeners/playerrelationslistener.h" + class Button; class CheckBox; class DropDown; diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp index fd70b9158..d27a095d5 100644 --- a/src/gui/widgets/tabs/setup_theme.cpp +++ b/src/gui/widgets/tabs/setup_theme.cpp @@ -22,6 +22,8 @@ #include "gui/widgets/tabs/setup_theme.h" +#include "gui/gui.h" + #include "gui/windows/okdialog.h" #include "gui/widgets/button.h" diff --git a/src/gui/widgets/tabs/setup_touch.cpp b/src/gui/widgets/tabs/setup_touch.cpp index 5d995f914..2baae029e 100644 --- a/src/gui/widgets/tabs/setup_touch.cpp +++ b/src/gui/widgets/tabs/setup_touch.cpp @@ -21,6 +21,8 @@ #include "gui/widgets/tabs/setup_touch.h" #include "gui/widgets/layouthelper.h" +#include "gui/widgets/namesmodel.h" +#include "gui/widgets/setuptouchitem.h" #include "gui/widgets/scrollarea.h" #include "utils/gettext.h" diff --git a/src/gui/widgets/tabs/setup_touch.h b/src/gui/widgets/tabs/setup_touch.h index 9adc2d5cd..ef1afdda3 100644 --- a/src/gui/widgets/tabs/setup_touch.h +++ b/src/gui/widgets/tabs/setup_touch.h @@ -21,7 +21,10 @@ #ifndef GUI_WIDGETS_TABS_SETUP_TOUCH_H #define GUI_WIDGETS_TABS_SETUP_TOUCH_H -#include "gui/widgets/setuptouchitem.h" +#include "gui/widgets/tabs/setuptabscroll.h" + +class NamesModel; +class TouchActionsModel; class Setup_Touch final : public SetupTabScroll { diff --git a/src/gui/widgets/tabs/setup_visual.h b/src/gui/widgets/tabs/setup_visual.h index 2d40d3a08..1229757dd 100644 --- a/src/gui/widgets/tabs/setup_visual.h +++ b/src/gui/widgets/tabs/setup_visual.h @@ -24,6 +24,8 @@ #include "gui/widgets/setupitem.h" +#include "gui/widgets/tabs/setuptabscroll.h" + class NamesModel; class Setup_Visual final : public SetupTabScroll diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index c1650e8a8..2d91129f2 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -68,9 +68,13 @@ #include "client.h" #include "graphicsvertexes.h" +#include "gui/gui.h" + #include "gui/widgets/label.h" #include "gui/widgets/tabbedarea.h" +#include "resources/image.h" + #include "debug.h" int Tab::mInstances = 0; diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h index 878663e36..463a6b668 100644 --- a/src/gui/widgets/tabs/tab.h +++ b/src/gui/widgets/tabs/tab.h @@ -66,8 +66,6 @@ #ifndef GUI_WIDGETS_TABS_TAB_H #define GUI_WIDGETS_TABS_TAB_H -#include "gui/widgets/widget2.h" - #include "gui/base/basiccontainer.hpp" #include "listeners/mouselistener.h" diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 729d40ead..ec0d09a26 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -27,6 +27,7 @@ #include "input/keydata.h" #include "gui/font.h" +#include "gui/gui.h" #include diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h index fe719faf8..24dd57adb 100644 --- a/src/gui/widgets/textbox.h +++ b/src/gui/widgets/textbox.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_TEXTBOX_H #define GUI_WIDGETS_TEXTBOX_H -#include "gui/widgets/widget2.h" - #include "gui/base/widgets/textbox.hpp" #include "localconsts.h" diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 226d9172c..c30045c02 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -29,7 +29,7 @@ #include "events/keyevent.h" #include "gui/font.h" -#include "gui/sdlinput.h" +#include "gui/gui.h" #include "gui/viewport.h" #include "gui/popups/popupmenu.h" diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h index 532175a82..31f64f545 100644 --- a/src/gui/widgets/textpreview.h +++ b/src/gui/widgets/textpreview.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_TEXTPREVIEW_H #define GUI_WIDGETS_TEXTPREVIEW_H -#include "gui/widgets/widget2.h" - #include "gui/base/widget.hpp" #include "localconsts.h" diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index a57ccbb41..c6317702f 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -21,7 +21,6 @@ #ifndef GUI_WIDGETS_WIDGET2_H #define GUI_WIDGETS_WIDGET2_H -#include "gui/gui.h" #include "gui/theme.h" #include "render/renderers.h" diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 64963be3e..37a9900ee 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -25,8 +25,6 @@ #include "render/graphics.h" -#include "gui/widgets/widget2.h" - #include "listeners/widgetlistener.h" #include "gui/base/widgets/window.hpp" diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 4417f18a6..27418b892 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -35,6 +35,8 @@ #include "gui/specialswindow.h" #endif +#include "gui/widgets/button.h" + #include "utils/dtor.h" #include "utils/gettext.h" diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h index 1f2d8adb2..a1ed66a7d 100644 --- a/src/gui/windowmenu.h +++ b/src/gui/windowmenu.h @@ -26,9 +26,9 @@ #include "listeners/configlistener.h" #include "gui/widgets/container.h" -#include "gui/widgets/button.h" #include "listeners/actionlistener.h" +#include "listeners/mouselistener.h" #include "listeners/selectionlistener.h" #include "localconsts.h" @@ -36,8 +36,8 @@ #include #include +class Button; class TextPopup; -class Window; struct ButtonInfo final { diff --git a/src/gui/windows/buydialog.h b/src/gui/windows/buydialog.h index 500f378ef..aa163d5d0 100644 --- a/src/gui/windows/buydialog.h +++ b/src/gui/windows/buydialog.h @@ -35,7 +35,6 @@ class ShopListBox; class SortListModelBuy; class IntTextField; class Label; -class ListBox; class ScrollArea; class Slider; diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index d6b572d40..fb407b9cc 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -31,6 +31,7 @@ #include "gui/windows/okdialog.h" #include "gui/widgets/button.h" +#include "gui/windows/charselectdialog.h" #include "gui/widgets/label.h" #include "gui/widgets/playerbox.h" #include "gui/widgets/radiobutton.h" diff --git a/src/gui/windows/charcreatedialog.h b/src/gui/windows/charcreatedialog.h index 123d826f2..12ddf7970 100644 --- a/src/gui/windows/charcreatedialog.h +++ b/src/gui/windows/charcreatedialog.h @@ -25,11 +25,13 @@ #include "being/being.h" -#include "gui/windows/charselectdialog.h" +#include "gui/widgets/window.h" #include "listeners/actionlistener.h" #include "listeners/keylistener.h" +class Button; +class CharSelectDialog; class Label; class PlayerBox; class RadioButton; diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 7c6e387a4..12a78ce10 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -44,6 +44,7 @@ #include "net/logindata.h" #include "net/loginhandler.h" +#include "net/net.h" #include "utils/gettext.h" diff --git a/src/gui/windows/charselectdialog.h b/src/gui/windows/charselectdialog.h index 348811ee3..38c307f30 100644 --- a/src/gui/windows/charselectdialog.h +++ b/src/gui/windows/charselectdialog.h @@ -35,7 +35,6 @@ class Button; class CharacterDisplay; class CharacterViewBase; -class Label; class LoginData; class TextDialog; diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 45a76495b..565d3644a 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -40,8 +40,7 @@ #include "input/inputmanager.h" #include "gui/focushandler.h" -#include "gui/font.h" -#include "gui/sdlinput.h" +#include "gui/gui.h" #include "gui/viewport.h" #include "gui/windows/emotewindow.h" diff --git a/src/gui/windows/didyouknowwindow.cpp b/src/gui/windows/didyouknowwindow.cpp index 95d657772..79ad4c208 100644 --- a/src/gui/windows/didyouknowwindow.cpp +++ b/src/gui/windows/didyouknowwindow.cpp @@ -24,7 +24,7 @@ #include "configuration.h" -#include "gui/font.h" +#include "gui/gui.h" #include "gui/windows/setupwindow.h" @@ -78,7 +78,8 @@ DidYouKnowWindow::DidYouKnowWindow() : Button *const okButton = new Button(this, _("Close"), "close", this); mBrowserBox->setLinkHandler(this); - mBrowserBox->setFont(gui->getHelpFont()); + if (gui) + mBrowserBox->setFont(gui->getHelpFont()); mBrowserBox->setProcessVersion(true); mBrowserBox->setEnableImages(true); mBrowserBox->setEnableKeys(true); diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index 7457c7b1e..fa9963217 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -24,7 +24,7 @@ #include "configuration.h" -#include "gui/font.h" +#include "gui/gui.h" #include "gui/windows/didyouknowwindow.h" #include "gui/windows/setupwindow.h" @@ -73,7 +73,8 @@ HelpWindow::HelpWindow() : mBrowserBox->setOpaque(false); mBrowserBox->setLinkHandler(this); - mBrowserBox->setFont(gui->getHelpFont()); + if (gui) + mBrowserBox->setFont(gui->getHelpFont()); mBrowserBox->setProcessVersion(true); mBrowserBox->setEnableImages(true); mBrowserBox->setEnableKeys(true); diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index bc66f588c..603b1b26d 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -33,8 +33,11 @@ #include "input/inputmanager.h" #include "gui/font.h" +#include "gui/gui.h" #include "gui/viewport.h" +#include "gui/base/listmodel.hpp" + #include "gui/popups/textpopup.h" #include "gui/windows/equipmentwindow.h" diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h index 6a6999034..c81e83d77 100644 --- a/src/gui/windows/inventorywindow.h +++ b/src/gui/windows/inventorywindow.h @@ -37,7 +37,6 @@ class Button; class DropDown; class Item; class ItemContainer; -class Label; class LayoutCell; class ProgressBar; class SortListModelInv; diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index 8e981ae96..c63157e27 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -33,6 +33,8 @@ #include "net/net.h" #include "gui/viewport.h" +#include "gui/base/listmodel.hpp" + #include "gui/popups/itempopup.h" #include "gui/windows/shopwindow.h" diff --git a/src/gui/windows/npcdialog.h b/src/gui/windows/npcdialog.h index b7b036659..b9fa1aab8 100644 --- a/src/gui/windows/npcdialog.h +++ b/src/gui/windows/npcdialog.h @@ -45,7 +45,6 @@ class ItemContainer; class NpcDialog; class PlayerBox; class ScrollArea; -class TextBox; class TextField; typedef std::map NpcDialogs; diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index 1a8749899..d62ca36ad 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -27,6 +27,7 @@ #include "being/localplayer.h" #include "gui/font.h" +#include "gui/gui.h" #include "gui/widgets/browserbox.h" #include "gui/widgets/button.h" @@ -166,7 +167,7 @@ QuestsWindow::QuestsWindow() : mText->setLinkHandler(mItemLinkHandler); mTextScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mQuestsListBox->setWidth(500); - if (gui->getNpcFont()->getHeight() < 20) + if (gui && gui->getNpcFont()->getHeight() < 20) mQuestsListBox->setRowHeight(20); else mQuestsListBox->setRowHeight(gui->getNpcFont()->getHeight()); diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 6823c2649..a06257b10 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -32,7 +32,9 @@ #include "input/keydata.h" #include "gui/font.h" +#include "gui/gui.h" +#include "gui/widgets/checkbox.h" #include "gui/windows/editserverdialog.h" #include "gui/windows/logindialog.h" @@ -132,7 +134,7 @@ void ServersListModel::setVersionString(const int index, if (index < 0 || index >= static_cast(mVersionStrings.size())) return; - if (version.empty()) + if (version.empty() || !gui) { mVersionStrings[index] = VersionString(0, ""); } diff --git a/src/gui/windows/serverdialog.h b/src/gui/windows/serverdialog.h index 112c8001d..3f63562f7 100644 --- a/src/gui/windows/serverdialog.h +++ b/src/gui/windows/serverdialog.h @@ -24,7 +24,6 @@ #define GUI_WINDOWS_SERVERDIALOG_H #include "gui/widgets/window.h" -#include "gui/widgets/checkbox.h" #include "net/download.h" #include "net/serverinfo.h" @@ -41,6 +40,7 @@ #include class Button; +class CheckBox; class Label; class ListBox; class ServerDialog; diff --git a/src/gui/windows/setupwindow.cpp b/src/gui/windows/setupwindow.cpp index a996d776b..9878807d9 100644 --- a/src/gui/windows/setupwindow.cpp +++ b/src/gui/windows/setupwindow.cpp @@ -44,6 +44,7 @@ #include "gui/widgets/tabs/setup_video.h" #include "gui/widgets/tabs/setup_visual.h" +#include "gui/widgets/button.h" #include "gui/widgets/label.h" #include "gui/widgets/tabbedarea.h" diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp index 98b9cae60..82d1c9ef6 100644 --- a/src/gui/windows/textcommandeditor.cpp +++ b/src/gui/windows/textcommandeditor.cpp @@ -27,6 +27,8 @@ #include "input/keyboardconfig.h" +#include "gui/base/listmodel.hpp" + #include "gui/widgets/button.h" #include "gui/widgets/dropdown.h" #include "gui/widgets/inttextfield.h" diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index 25d077d5d..7fe1a1e36 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -32,6 +32,7 @@ #include "being/playerrelations.h" #include "gui/font.h" +#include "gui/gui.h" #include "gui/windows/inventorywindow.h" #include "gui/windows/itemamountwindow.h" diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index d19130e7c..5d157f0fa 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -28,7 +28,6 @@ #include "input/keyboardconfig.h" #include "input/keyboarddata.h" #include "being/localplayer.h" -#include "being/playerinfo.h" #ifdef USE_SDL2 #include "input/multitouchmanager.h" #endif @@ -47,7 +46,6 @@ #include "gui/windows/setupwindow.h" #include "gui/windows/textdialog.h" #include "gui/windows/tradewindow.h" -#include "gui/windows/quitdialog.h" #include "utils/timer.h" @@ -59,6 +57,8 @@ InputManager inputManager; +class QuitDialog; + extern QuitDialog *quitDialog; static class KeyFunctor final diff --git a/src/input/key.h b/src/input/key.h index fa48d3583..97bc7113d 100644 --- a/src/input/key.h +++ b/src/input/key.h @@ -194,4 +194,4 @@ class Key final int mValue; }; -#endif // end GCN_KEY_HPP +#endif // INPUT_KEY_H diff --git a/src/input/mouseinput.h b/src/input/mouseinput.h index 5ece1f77a..a90a1366d 100644 --- a/src/input/mouseinput.h +++ b/src/input/mouseinput.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef MOUSEINPUT_H -#define MOUSEINPUT_H +#ifndef INPUT_MOUSEINPUT_H +#define INPUT_MOUSEINPUT_H #include "input/mouseinput.h" @@ -213,4 +213,4 @@ class MouseInput final int mRealY; }; -#endif // MOUSEINPUT_H +#endif // INPUT_MOUSEINPUT_H diff --git a/src/input/multitouchmanager.h b/src/input/multitouchmanager.h index 076ccb3a8..82bfd0881 100644 --- a/src/input/multitouchmanager.h +++ b/src/input/multitouchmanager.h @@ -25,7 +25,9 @@ #include "localconsts.h" +#ifdef USE_SDL2 union SDL_Event; +#endif struct MultiTouchEvent { diff --git a/src/listeners/actionlistener.h b/src/listeners/actionlistener.h index b22e5abc6..895cc985d 100644 --- a/src/listeners/actionlistener.h +++ b/src/listeners/actionlistener.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LISTENERS_ACTIONLISTENER_HPP -#define LISTENERS_ACTIONLISTENER_HPP +#ifndef LISTENERS_ACTIONLISTENER_H +#define LISTENERS_ACTIONLISTENER_H #include @@ -106,4 +106,4 @@ class ActionListener { } }; -#endif // end LISTENERS_ACTIONLISTENER_HPP +#endif // LISTENERS_ACTIONLISTENER_H diff --git a/src/listeners/deathlistener.h b/src/listeners/deathlistener.h index beefe1746..ddd7db910 100644 --- a/src/listeners/deathlistener.h +++ b/src/listeners/deathlistener.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LISTENERS_DEATHLISTENER_HPP -#define LISTENERS_DEATHLISTENER_HPP +#ifndef LISTENERS_DEATHLISTENER_H +#define LISTENERS_DEATHLISTENER_H #include @@ -103,4 +103,4 @@ class DeathListener { } }; -#endif // LISTENERS_DEATHLISTENER_HPP +#endif // LISTENERS_DEATHLISTENER_H diff --git a/src/listeners/focuslistener.h b/src/listeners/focuslistener.h index c910f833e..10e4a2af0 100644 --- a/src/listeners/focuslistener.h +++ b/src/listeners/focuslistener.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LISTENERS_FOCUSLISTENER_HPP -#define LISTENERS_FOCUSLISTENER_HPP +#ifndef LISTENERS_FOCUSLISTENER_H +#define LISTENERS_FOCUSLISTENER_H #include @@ -113,4 +113,4 @@ class FocusListener { } }; -#endif // LISTENERS_FOCUSLISTENER_HPP +#endif // LISTENERS_FOCUSLISTENER_H diff --git a/src/listeners/keylistener.h b/src/listeners/keylistener.h index 0873de835..efc387300 100644 --- a/src/listeners/keylistener.h +++ b/src/listeners/keylistener.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GCN_KEYLISTENER_HPP -#define GCN_KEYLISTENER_HPP +#ifndef LISTENERS_KEYLISTENER_H +#define LISTENERS_KEYLISTENER_H #include "events/keyevent.h" @@ -113,4 +113,4 @@ class KeyListener { } }; -#endif // end GCN_KEYLISTENER_HPP +#endif // LISTENERS_KEYLISTENER_H diff --git a/src/listeners/mouselistener.h b/src/listeners/mouselistener.h index d294e4dd6..9a2a4ef04 100644 --- a/src/listeners/mouselistener.h +++ b/src/listeners/mouselistener.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GCN_MOUSELISTENER_HPP -#define GCN_MOUSELISTENER_HPP +#ifndef LISTENERS_MOUSELISTENER_H +#define LISTENERS_MOUSELISTENER_H #include "events/mouseevent.h" @@ -190,4 +190,4 @@ class MouseListener { } }; -#endif // end GCN_MOUSELISTENER_HPP +#endif // LISTENERS_MOUSELISTENER_H diff --git a/src/listeners/playerrelationslistener.h b/src/listeners/playerrelationslistener.h index b95f18c33..6a8bf3b20 100644 --- a/src/listeners/playerrelationslistener.h +++ b/src/listeners/playerrelationslistener.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef LISTERNERS_PLAYERRELATIONSLISTENER_H -#define LISTERNERS_PLAYERRELATIONSLISTENER_H +#ifndef LISTENERS_PLAYERRELATIONSLISTENER_H +#define LISTENERS_PLAYERRELATIONSLISTENER_H #include @@ -40,4 +40,4 @@ class PlayerRelationsListener { } }; -#endif // LISTERNERS_PLAYERRELATIONSLISTENER_H +#endif // LISTENERS_PLAYERRELATIONSLISTENER_H diff --git a/src/listeners/selectionlistener.h b/src/listeners/selectionlistener.h index d3be0f0eb..2efe0a67e 100644 --- a/src/listeners/selectionlistener.h +++ b/src/listeners/selectionlistener.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GCN_SELECTIONLISTENER_HPP -#define GCN_SELECTIONLISTENER_HPP +#ifndef LISTENERS_SELECTIONLISTENER_H +#define LISTENERS_SELECTIONLISTENER_H #include @@ -111,4 +111,4 @@ class SelectionListener { } }; -#endif // end GCN_SELECTIONLISTENER_HPP +#endif // LISTENERS_SELECTIONLISTENER_H diff --git a/src/listeners/widgetlistener.h b/src/listeners/widgetlistener.h index 16d9e1f15..48641cbaa 100644 --- a/src/listeners/widgetlistener.h +++ b/src/listeners/widgetlistener.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LISTENERS_WIDGETLISTENER_HPP -#define LISTENERS_WIDGETLISTENER_HPP +#ifndef LISTENERS_WIDGETLISTENER_H +#define LISTENERS_WIDGETLISTENER_H #include @@ -137,4 +137,4 @@ class WidgetListener { } }; -#endif // LISTENERS_WIDGETLISTENER_HPP +#endif // LISTENERS_WIDGETLISTENER_H diff --git a/src/logger.cpp b/src/logger.cpp index c430aefec..21fea14d7 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -22,9 +22,10 @@ #include "logger.h" -#include #include +#include + #ifdef WIN32 #include #elif defined __APPLE__ diff --git a/src/maplayer.cpp b/src/maplayer.cpp index 86a431cdf..b4fbc6da6 100644 --- a/src/maplayer.cpp +++ b/src/maplayer.cpp @@ -33,6 +33,7 @@ #include "render/graphics.h" +#include "resources/image.h" #include "resources/resourcemanager.h" #include "gui/font.h" diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index 0f592b123..d55a3cea6 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -39,8 +39,6 @@ #include "net/chathandler.h" #include "net/net.h" -#include "net/ea/eaprotocol.h" - #include "utils/timer.h" #include "debug.h" diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index a11c157fd..d541ce09b 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -33,6 +33,7 @@ #include "net/ea/gamehandler.h" #include "net/ea/network.h" +#include "net/messagein.h" #include "net/net.h" #include "utils/dtor.h" diff --git a/src/net/ea/charserverhandler.h b/src/net/ea/charserverhandler.h index 5ffd714f2..af6aafa9b 100644 --- a/src/net/ea/charserverhandler.h +++ b/src/net/ea/charserverhandler.h @@ -24,8 +24,13 @@ #define NET_EA_CHARSERVERHANDLER_H #include "net/charserverhandler.h" -#include "net/messagein.h" -#include "net/serverinfo.h" + +class ServerInfo; + +namespace Net +{ + class MessageIn; +} namespace Ea { diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 6654950f2..997e4bfc1 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -38,6 +38,8 @@ #include "gui/widgets/tabs/chattab.h" +#include "net/messagein.h" + #include #include "debug.h" diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h index 1fabda09d..237abf10a 100644 --- a/src/net/ea/chathandler.h +++ b/src/net/ea/chathandler.h @@ -24,10 +24,14 @@ #define NET_EA_CHATHANDLER_H #include "net/chathandler.h" -#include "net/messagein.h" #include +namespace Net +{ + class MessageIn; +} + namespace Ea { diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 6e1982b6d..de1d6f151 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -31,6 +31,8 @@ #include "gui/windows/okdialog.h" +#include "net/messagein.h" + #include "debug.h" namespace Ea diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h index 8a31ee030..4a0624be0 100644 --- a/src/net/ea/gamehandler.h +++ b/src/net/ea/gamehandler.h @@ -24,7 +24,11 @@ #define NET_EA_GAMEHANDLER_H #include "net/gamehandler.h" -#include "net/messagein.h" + +namespace Net +{ + class MessageIn; +} namespace Ea { diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp index 46b1f1649..af8c3b8df 100644 --- a/src/net/ea/gui/guildtab.cpp +++ b/src/net/ea/gui/guildtab.cpp @@ -28,10 +28,9 @@ #include "soundconsts.h" #include "soundmanager.h" +#include "net/guildhandler.h" #include "net/net.h" -#include "net/ea/guildhandler.h" - #include "utils/gettext.h" #include "debug.h" diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index 536c93263..1e56ac75b 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -30,6 +30,10 @@ #include "gui/windows/socialwindow.h" +#include "net/messagein.h" + +#include "net/ea/gui/guildtab.h" + #include "debug.h" namespace Ea diff --git a/src/net/ea/guildhandler.h b/src/net/ea/guildhandler.h index 191d6fd44..e8bec6a09 100644 --- a/src/net/ea/guildhandler.h +++ b/src/net/ea/guildhandler.h @@ -23,12 +23,15 @@ #define NET_EA_GUILDHANDLER_H #include "net/guildhandler.h" -#include "net/messagein.h" -#include "net/ea/gui/guildtab.h" +namespace Net +{ + class MessageIn; +} namespace Ea { +class GuildTab; class GuildHandler : public Net::GuildHandler { diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 74f0a4ba7..3f4eb9228 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -29,6 +29,8 @@ #include "gui/windows/ministatuswindow.h" +#include "net/messagein.h" + #include "net/ea/eaprotocol.h" #include "debug.h" diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index 6e8ecec38..494b9145a 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -33,11 +33,15 @@ #include "gui/windows/inventorywindow.h" #include "net/inventoryhandler.h" -#include "net/messagein.h" #include #include +namespace Net +{ + class MessageIn; +} + namespace Ea { diff --git a/src/net/ea/itemhandler.cpp b/src/net/ea/itemhandler.cpp index 9ce85a59b..383ba2753 100644 --- a/src/net/ea/itemhandler.cpp +++ b/src/net/ea/itemhandler.cpp @@ -24,6 +24,8 @@ #include "actormanager.h" +#include "net/messagein.h" + #include "debug.h" namespace Ea diff --git a/src/net/ea/itemhandler.h b/src/net/ea/itemhandler.h index 6bc23fb10..80c0a4dbf 100644 --- a/src/net/ea/itemhandler.h +++ b/src/net/ea/itemhandler.h @@ -25,6 +25,13 @@ #include "net/messagein.h" +#include "localconsts.h" + +namespace Net +{ + class MessageIn; +} + namespace Ea { diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 57edcefbf..62514b10b 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -32,6 +32,8 @@ #include "utils/gettext.h" #include "utils/paths.h" +#include "net/messagein.h" + #include "debug.h" namespace Ea diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h index 8fea9d49f..f539176f5 100644 --- a/src/net/ea/loginhandler.h +++ b/src/net/ea/loginhandler.h @@ -24,7 +24,6 @@ #define NET_EA_LOGINHANDLER_H #include "net/loginhandler.h" -#include "net/messagein.h" #include "net/ea/token.h" @@ -32,6 +31,11 @@ class LoginData; +namespace Net +{ + class MessageIn; +} + namespace Ea { diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp index 70c4ce08a..03def7298 100644 --- a/src/net/ea/npchandler.cpp +++ b/src/net/ea/npchandler.cpp @@ -24,6 +24,8 @@ #include "gui/windows/npcdialog.h" +#include "net/messagein.h" + #include "debug.h" namespace Ea diff --git a/src/net/ea/npchandler.h b/src/net/ea/npchandler.h index b8a10bc18..07c281587 100644 --- a/src/net/ea/npchandler.h +++ b/src/net/ea/npchandler.h @@ -23,11 +23,17 @@ #ifndef NET_EA_NPCHANDLER_H #define NET_EA_NPCHANDLER_H -#include "net/messagein.h" #include "net/npchandler.h" +#include "localconsts.h" + class NpcDialog; +namespace Net +{ + class MessageIn; +} + namespace Ea { diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index 98dec750a..7f29f277a 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -25,11 +25,16 @@ #include "configuration.h" #include "notifications.h" #include "notifymanager.h" +#include "party.h" #include "being/localplayer.h" #include "gui/windows/socialwindow.h" +#include "net/messagein.h" + +#include "net/ea/gui/partytab.h" + #include "debug.h" namespace Ea diff --git a/src/net/ea/partyhandler.h b/src/net/ea/partyhandler.h index e7ab8f8ef..29f242285 100644 --- a/src/net/ea/partyhandler.h +++ b/src/net/ea/partyhandler.h @@ -22,15 +22,18 @@ #ifndef NET_EA_PARTYHANDLER_H #define NET_EA_PARTYHANDLER_H -#include "net/messagein.h" #include "net/partyhandler.h" -#include "net/ea/gui/partytab.h" +class Party; -#include "party.h" +namespace Net +{ + class MessageIn; +} namespace Ea { +class PartyTab; class PartyHandler : public Net::PartyHandler { diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 28f16735c..de376cead 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -41,6 +41,7 @@ #include "resources/db/deaddb.h" +#include "net/messagein.h" #include "net/net.h" #include "net/ea/eaprotocol.h" diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h index 589874e2e..087627f92 100644 --- a/src/net/ea/playerhandler.h +++ b/src/net/ea/playerhandler.h @@ -23,9 +23,13 @@ #ifndef NET_EA_PLAYERHANDLER_H #define NET_EA_PLAYERHANDLER_H -#include "net/messagein.h" #include "net/playerhandler.h" +namespace Net +{ + class MessageIn; +} + namespace Ea { diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp index 3a5a1ab75..fd10a6087 100644 --- a/src/net/ea/skillhandler.cpp +++ b/src/net/ea/skillhandler.cpp @@ -33,6 +33,8 @@ #include "utils/stringutils.h" +#include "net/messagein.h" + #include "debug.h" /** job dependend identifiers (?) */ diff --git a/src/net/ea/skillhandler.h b/src/net/ea/skillhandler.h index 8dc724e0a..484ca6878 100644 --- a/src/net/ea/skillhandler.h +++ b/src/net/ea/skillhandler.h @@ -23,9 +23,15 @@ #ifndef NET_EA_SKILLHANDLER_H #define NET_EA_SKILLHANDLER_H -#include "net/messagein.h" #include "net/skillhandler.h" +#include "localconsts.h" + +namespace Net +{ + class MessageIn; +} + namespace Ea { diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index 4cb424fc9..19e597967 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -34,6 +34,7 @@ #include "gui/windows/confirmdialog.h" #include "gui/windows/tradewindow.h" +#include "net/messagein.h" #include "net/net.h" #include "net/ea/eaprotocol.h" diff --git a/src/net/ea/tradehandler.h b/src/net/ea/tradehandler.h index 22a78e9e6..d4c9510b8 100644 --- a/src/net/ea/tradehandler.h +++ b/src/net/ea/tradehandler.h @@ -23,9 +23,13 @@ #ifndef NET_EA_TRADEHANDLER_H #define NET_EA_TRADEHANDLER_H -#include "net/messagein.h" #include "net/tradehandler.h" +namespace Net +{ + class MessageIn; +} + namespace Ea { diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 61e0a8404..a9d11f563 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -24,8 +24,7 @@ #include "being/localplayer.h" -#include "gui/widgets/tabs/chattab.h" - +#include "net/eathena/messageout.h" #include "net/eathena/protocol.h" #include diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h index 9c6b8ea0c..3efaf2d31 100644 --- a/src/net/eathena/chathandler.h +++ b/src/net/eathena/chathandler.h @@ -26,10 +26,10 @@ #include "net/ea/chathandler.h" #include "net/eathena/messagehandler.h" -#include "net/eathena/messageout.h" namespace EAthena { +class MessageOut; class ChatHandler final : public MessageHandler, public Ea::ChatHandler { diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index ebb5d46d7..3a18dede9 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -33,6 +33,7 @@ #include "net/ea/guildhandler.h" +#include "net/ea/gui/guildtab.h" #include "net/ea/gui/partytab.h" #include "net/eathena/adminhandler.h" diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index 56d4f5aae..0162d82e8 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -24,6 +24,7 @@ #include "logger.h" +#include "net/eathena/messagehandler.h" #include "net/eathena/messagein.h" #include "net/eathena/protocol.h" diff --git a/src/net/eathena/network.h b/src/net/eathena/network.h index 4c9349f96..fae4f06d5 100644 --- a/src/net/eathena/network.h +++ b/src/net/eathena/network.h @@ -25,8 +25,6 @@ #include "net/ea/network.h" -#include "net/eathena/messagehandler.h" - /** * Protocol version, reported to the eAthena char and mapserver who can adjust * the protocol accordingly. @@ -35,6 +33,7 @@ namespace EAthena { +class MessageHandler; class Network final : public Ea::Network { diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp index fcc650171..cfec2fe81 100644 --- a/src/net/eathena/partyhandler.cpp +++ b/src/net/eathena/partyhandler.cpp @@ -24,6 +24,7 @@ #include "actormanager.h" #include "notifications.h" #include "notifymanager.h" +#include "party.h" #include "being/localplayer.h" diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index af236f00b..d00f12dd3 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -24,8 +24,7 @@ #include "being/localplayer.h" -#include "gui/widgets/tabs/chattab.h" - +#include "net/tmwa/messageout.h" #include "net/tmwa/protocol.h" #include diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h index a7226c52c..c4f51fec7 100644 --- a/src/net/tmwa/chathandler.h +++ b/src/net/tmwa/chathandler.h @@ -26,10 +26,10 @@ #include "net/ea/chathandler.h" #include "net/tmwa/messagehandler.h" -#include "net/tmwa/messageout.h" namespace TmwAthena { +class MessageOut; class ChatHandler final : public MessageHandler, public Ea::ChatHandler { diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 683eb0711..46d1d490f 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -33,6 +33,7 @@ #include "net/ea/guildhandler.h" +#include "net/ea/gui/guildtab.h" #include "net/ea/gui/partytab.h" #include "net/tmwa/adminhandler.h" diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index c91387898..cc94b6161 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -24,6 +24,7 @@ #include "logger.h" +#include "net/tmwa/messagehandler.h" #include "net/tmwa/messagein.h" #include "net/tmwa/protocol.h" diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h index 6d05d0e48..bf9381227 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -25,8 +25,6 @@ #include "net/ea/network.h" -#include "net/tmwa/messagehandler.h" - /** * Protocol version, reported to the eAthena char and mapserver who can adjust * the protocol accordingly. @@ -36,6 +34,7 @@ namespace TmwAthena { +class MessageHandler; class Network final : public Ea::Network { diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index 78d56f669..ba18a9efa 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -24,6 +24,7 @@ #include "actormanager.h" #include "notifications.h" #include "notifymanager.h" +#include "party.h" #include "being/localplayer.h" diff --git a/src/net/tmwa/pethandler.cpp b/src/net/tmwa/pethandler.cpp index 6b9e5adb7..3293b7edd 100644 --- a/src/net/tmwa/pethandler.cpp +++ b/src/net/tmwa/pethandler.cpp @@ -24,8 +24,7 @@ #include "net/net.h" -#include "net/tmwa/chathandler.h" -#include "net/tmwa/protocol.h" +#include "net/chathandler.h" #include "debug.h" diff --git a/src/net/tradehandler.h b/src/net/tradehandler.h index 823352239..21ca65e97 100644 --- a/src/net/tradehandler.h +++ b/src/net/tradehandler.h @@ -29,6 +29,8 @@ #include "localconsts.h" +class Item; + namespace Net { class TradeHandler diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index 7a15713be..2f4f6c0c2 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -33,6 +33,8 @@ #include "utils/sdlpixel.h" +#include "resources/image.h" + #include "debug.h" #if SDL_BYTEORDER == SDL_LIL_ENDIAN diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp index 63f15c18f..1409146df 100644 --- a/src/simpleanimation.cpp +++ b/src/simpleanimation.cpp @@ -29,7 +29,6 @@ #include "resources/animation.h" #include "resources/dye.h" -#include "resources/image.h" #include "resources/imageset.h" #include "resources/resourcemanager.h" diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 049c010b3..647c6dd99 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -22,12 +22,15 @@ #include "statuseffect.h" +#include "animatedsprite.h" #include "configuration.h" #include "logger.h" #include "soundmanager.h" #include "gui/widgets/tabs/chattab.h" +#include "particle/particle.h" + #include "resources/beingcommon.h" #include diff --git a/src/statuseffect.h b/src/statuseffect.h index 6dda71cfc..8bb164820 100644 --- a/src/statuseffect.h +++ b/src/statuseffect.h @@ -23,12 +23,13 @@ #ifndef STATUSEFFECT_H #define STATUSEFFECT_H -#include "animatedsprite.h" - -#include "particle/particle.h" +#include #include "localconsts.h" +class AnimatedSprite; +class Particle; + class StatusEffect final { public: diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp index 20c56b8d6..49a5a0d3d 100644 --- a/src/touchmanager.cpp +++ b/src/touchmanager.cpp @@ -35,6 +35,8 @@ #include "gui/theme.h" +#include "resources/image.h" + #include "debug.h" TouchManager touchManager; diff --git a/src/touchmanager.h b/src/touchmanager.h index 6419c4b17..09eaabad5 100644 --- a/src/touchmanager.h +++ b/src/touchmanager.h @@ -21,8 +21,6 @@ #ifndef TOUCHMANAGER_H #define TOUCHMANAGER_H -#include "resources/image.h" - #include "listeners/configlistener.h" #include "input/keydata.h" @@ -34,6 +32,7 @@ #include "localconsts.h" +class Image; class ImageCollection; class ImageRect; class MouseInput; diff --git a/src/utils/files.cpp b/src/utils/files.cpp index 24ec9366e..11ac222f5 100644 --- a/src/utils/files.cpp +++ b/src/utils/files.cpp @@ -24,7 +24,6 @@ #include "resources/resourcemanager.h" #endif -#include "utils/mkdir.h" #include "utils/physfstools.h" #include "localconsts.h" diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp index a3f61bde3..96cd0ed29 100644 --- a/src/utils/paths.cpp +++ b/src/utils/paths.cpp @@ -28,7 +28,9 @@ #include "utils/physfstools.h" #include "utils/stringutils.h" +#ifdef USE_X11 #include "resources/resourcemanager.h" +#endif #ifdef __native_client__ #include diff --git a/src/utils/sdlpixel.h b/src/utils/sdlpixel.h index 2a26f28a1..692615688 100644 --- a/src/utils/sdlpixel.h +++ b/src/utils/sdlpixel.h @@ -61,8 +61,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef UTILS_SDLPIXEL_HPP -#define UTILS_SDLPIXEL_HPP +#ifndef UTILS_SDLPIXEL_H +#define UTILS_SDLPIXEL_H #include "SDL.h" #include "gui/base/color.hpp" @@ -229,4 +229,4 @@ inline void SDLputPixelAlpha(SDL_Surface* surface, int x, int y, SDL_UnlockSurface(surface); } -#endif // UTILS_SDLPIXEL_HPP +#endif // UTILS_SDLPIXEL_H diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp index f0ab95005..c105bf0da 100644 --- a/src/utils/translation/poparser.cpp +++ b/src/utils/translation/poparser.cpp @@ -24,6 +24,8 @@ #include "utils/stringutils.h" +#include "utils/translation/podict.h" + #include "logger.h" #include "debug.h" diff --git a/src/utils/translation/poparser.h b/src/utils/translation/poparser.h index 08a6ac7b1..41598442b 100644 --- a/src/utils/translation/poparser.h +++ b/src/utils/translation/poparser.h @@ -21,13 +21,13 @@ #ifndef UTILS_TRANSLATION_POPARSER_H #define UTILS_TRANSLATION_POPARSER_H -#include "utils/translation/podict.h" - #include "localconsts.h" #include #include +class PoDict; + class PoParser final { public: diff --git a/src/utils/xml.h b/src/utils/xml.h index 48d60cda7..d8a281045 100644 --- a/src/utils/xml.h +++ b/src/utils/xml.h @@ -23,8 +23,8 @@ #ifndef UTILS_XML_H #define UTILS_XML_H -#include #include +#include #include -- cgit v1.2.3-70-g09d2 From 48646db55005a0da079bd2c945875dc8225e2f86 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 22 Feb 2014 14:21:27 +0300 Subject: Move color into gui dir. --- src/CMakeLists.txt | 4 +- src/Makefile.am | 8 +- src/being/being.cpp | 2 +- src/being/being.h | 10 +- src/client.cpp | 2 +- src/flooritem.cpp | 8 +- src/gui/base/color.cpp | 168 --------------------------- src/gui/base/color.hpp | 195 -------------------------------- src/gui/base/widget.hpp | 3 +- src/gui/color.cpp | 165 +++++++++++++++++++++++++++ src/gui/color.h | 192 +++++++++++++++++++++++++++++++ src/gui/font.cpp | 16 +-- src/gui/font.h | 18 +-- src/gui/gui.h | 7 +- src/gui/palette.cpp | 30 ++--- src/gui/palette.h | 29 +++-- src/gui/popups/speechbubble.cpp | 4 +- src/gui/popups/speechbubble.h | 4 +- src/gui/theme.cpp | 10 +- src/gui/theme.h | 14 +-- src/gui/userpalette.cpp | 8 +- src/gui/userpalette.h | 9 +- src/gui/viewport.cpp | 4 +- src/gui/viewport.h | 2 +- src/gui/widgets/avatarlistbox.cpp | 5 +- src/gui/widgets/browserbox.cpp | 12 +- src/gui/widgets/browserbox.h | 22 ++-- src/gui/widgets/button.h | 16 +-- src/gui/widgets/colormodel.cpp | 4 +- src/gui/widgets/colormodel.h | 16 +-- src/gui/widgets/desktop.h | 4 +- src/gui/widgets/dropdown.h | 4 +- src/gui/widgets/dropshortcutcontainer.h | 8 +- src/gui/widgets/guitable.h | 2 +- src/gui/widgets/itemcontainer.h | 8 +- src/gui/widgets/itemshortcutcontainer.h | 8 +- src/gui/widgets/label.cpp | 6 +- src/gui/widgets/label.h | 6 +- src/gui/widgets/listbox.h | 8 +- src/gui/widgets/progressbar.cpp | 6 +- src/gui/widgets/progressbar.h | 8 +- src/gui/widgets/shoplistbox.cpp | 4 +- src/gui/widgets/shoplistbox.h | 4 +- src/gui/widgets/skillinfo.h | 4 +- src/gui/widgets/tabs/setup_colors.cpp | 6 +- src/gui/widgets/tabs/tab.h | 40 +++---- src/gui/widgets/textbox.cpp | 6 +- src/gui/widgets/textbox.h | 6 +- src/gui/widgets/textfield.h | 2 +- src/gui/widgets/textpreview.cpp | 8 +- src/gui/widgets/textpreview.h | 16 +-- src/gui/widgets/widget2.h | 16 +-- src/gui/windows/equipmentwindow.h | 8 +- src/gui/windows/outfitwindow.h | 4 +- src/gui/windows/serverdialog.cpp | 4 +- src/gui/windows/skilldialog.cpp | 4 +- src/particle/particle.cpp | 4 +- src/particle/particle.h | 13 +-- src/particle/textparticle.cpp | 6 +- src/particle/textparticle.h | 4 +- src/render/graphics.h | 17 +-- src/render/mobileopenglgraphics.h | 2 +- src/render/normalopenglgraphics.h | 2 +- src/render/nullopenglgraphics.h | 2 +- src/render/openglgraphicsdef.hpp | 4 +- src/render/safeopenglgraphics.h | 2 +- src/text.cpp | 6 +- src/text.h | 12 +- src/utils/sdlpixel.h | 7 +- 69 files changed, 625 insertions(+), 643 deletions(-) delete mode 100644 src/gui/base/color.cpp delete mode 100644 src/gui/base/color.hpp create mode 100644 src/gui/color.cpp create mode 100644 src/gui/color.h (limited to 'src/gui/widgets/browserbox.h') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cdc61aa91..cf8a905f2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -767,7 +767,7 @@ SET(SRCS listeners/actionlistener.h gui/base/basiccontainer.hpp gui/base/cliprectangle.hpp - gui/base/color.hpp + gui/color.h listeners/deathlistener.h events/event.h listeners/focuslistener.h @@ -798,7 +798,7 @@ SET(SRCS gui/base/widgets/window.hpp gui/base/basiccontainer.cpp gui/base/cliprectangle.cpp - gui/base/color.cpp + gui/color.cpp gui/base/gui.cpp input/key.cpp gui/base/rectangle.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 246da6073..5a2fa34d7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,11 +27,11 @@ endif dyecmd_CXXFLAGS = dyecmd_SOURCES = gui/base/cliprectangle.cpp \ - gui/base/color.cpp \ + gui/color.cpp \ gui/base/rectangle.cpp \ events/actionevent.h \ gui/base/cliprectangle.hpp \ - gui/base/color.hpp \ + gui/color.h \ events/event.h \ gui/base/rectangle.hpp @@ -152,7 +152,7 @@ manaplus_SOURCES += events/actionevent.h \ listeners/actionlistener.h \ gui/base/basiccontainer.hpp \ gui/base/cliprectangle.hpp \ - gui/base/color.hpp \ + gui/color.h \ listeners/deathlistener.h \ events/event.h \ listeners/focuslistener.h \ @@ -184,7 +184,7 @@ manaplus_SOURCES += events/actionevent.h \ gui/base/widgets/window.hpp \ gui/base/basiccontainer.cpp \ gui/base/cliprectangle.cpp \ - gui/base/color.cpp \ + gui/color.cpp \ gui/base/gui.cpp \ input/key.cpp \ gui/base/rectangle.cpp \ diff --git a/src/being/being.cpp b/src/being/being.cpp index 76af509d3..485b439af 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -542,7 +542,7 @@ void Being::takeDamage(Being *const attacker, const int amount, // TRANSLATORS: hit or miss message in attacks const std::string damage = amount ? toString(amount) : type == FLEE ? _("dodge") : _("miss"); - const gcn::Color *color; + const Color *color; if (gui) font = gui->getInfoParticleFont(); diff --git a/src/being/being.h b/src/being/being.h index 4ef40d9fd..e427612f0 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -41,6 +41,7 @@ static const int DEFAULT_BEING_HEIGHT = 32; class AnimatedSprite; class BeingCacheEntry; +class Color; class Equipment; class FlashText; class Guild; @@ -52,11 +53,6 @@ class Text; struct ParticleInfo; -namespace gcn -{ - class Color; -} - extern volatile int cur_time; enum Gender @@ -969,7 +965,7 @@ class Being : public ActorSprite, public ConfigListener * Holds a text object when the being displays it's name, 0 otherwise */ FlashText *mDispName; - const gcn::Color *mNameColor; + const Color *mNameColor; /** Engine-related infos about weapon. */ const ItemInfo *mEquippedWeapon; @@ -979,7 +975,7 @@ class Being : public ActorSprite, public ConfigListener Path mPath; Text *mText; - const gcn::Color *mTextColor; + const Color *mTextColor; Vector mDest; /**< destination coordinates. */ diff --git a/src/client.cpp b/src/client.cpp index a08406d10..4aa5d4cd4 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -614,7 +614,7 @@ static void updateProgress(int cnt) { const int progress = cnt + loadingProgressCounter; const int h = mainGraphics->mHeight; - mainGraphics->setColor(gcn::Color(255, 255, 255)); + mainGraphics->setColor(Color(255, 255, 255)); const int maxSize = mainGraphics->mWidth - 100; const int width = maxSize * progress / 450; mainGraphics->fillRectangle(gcn::Rectangle(50, h - 100, width, 50)); diff --git a/src/flooritem.cpp b/src/flooritem.cpp index 2592e6feb..6780b10fa 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -122,21 +122,21 @@ void FloorItem::draw(Graphics *const graphics, if (curTime > mDropTime + 28 && curTime < mDropTime + 50) { - graphics->setColor(gcn::Color(80, 200, 20, 200)); + graphics->setColor(Color(80, 200, 20, 200)); graphics->fillRectangle(gcn::Rectangle( x, y, dx, dy)); } else if (curTime > mDropTime + 19 && curTime < mDropTime + 28) { - graphics->setColor(gcn::Color(200, 80, 20, + graphics->setColor(Color(200, 80, 20, 80 + 10 * (curTime - mDropTime - 18))); graphics->fillRectangle(gcn::Rectangle( x, y, dx, dy)); } else if (curTime > mDropTime && curTime < mDropTime + 20) { - graphics->setColor(gcn::Color(20, 20, 255, + graphics->setColor(Color(20, 20, 255, 7 * (curTime - mDropTime))); graphics->fillRectangle(gcn::Rectangle( x, y, dx, dy)); @@ -153,7 +153,7 @@ void FloorItem::draw(Graphics *const graphics, { if (font && mAmount > 1) { -// graphics->setColor(gcn::Color(255, 255, 255, 100)); +// graphics->setColor(Color(255, 255, 255, 100)); graphics->setColor(userPalette->getColor( UserPalette::FLOOR_ITEM_TEXT)); font->drawString(graphics, toString(mAmount), x, y); diff --git a/src/gui/base/color.cpp b/src/gui/base/color.cpp deleted file mode 100644 index 485367e6d..000000000 --- a/src/gui/base/color.cpp +++ /dev/null @@ -1,168 +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/color.hpp" - -#include "debug.h" - -namespace gcn -{ - Color::Color() : - r(0U), - g(0U), - b(0U), - a(255U) - { - } - - Color::Color(const unsigned int color) : - r((color >> 16) & 0xFF), - g((color >> 8) & 0xFF), - b(color & 0xFF), - a(255U) - { - } - - Color::Color(const unsigned int ar, - const unsigned int ag, - const unsigned int ab, - const unsigned int aa) : - r(ar), - g(ag), - b(ab), - a(aa) - { - } - - Color Color::operator+(const Color& color) const - { - Color result(r + color.r, - g + color.g, - b + color.b, - 255U); - - result.r = (result.r > 255U ? 255U : result.r); - result.g = (result.g > 255U ? 255U : result.g); - result.b = (result.b > 255U ? 255U : result.b); - - return result; - } - - Color Color::operator-(const Color& color) const - { - Color result(r - color.r, - g - color.g, - b - color.b, - 255U); - - result.r = (result.r > 255U ? 255U : result.r); - result.g = (result.g > 255U ? 255U : result.g); - result.b = (result.b > 255U ? 255U : result.b); - - return result; - } - - Color Color::operator*(const float value) const - { - Color result(static_cast(static_cast(r) * value), - static_cast(static_cast(g) * value), - static_cast(static_cast(b) * value), - a); - - result.r = (result.r > 255U ? 255U : result.r); - result.g = (result.g > 255U ? 255U : result.g); - result.b = (result.b > 255U ? 255U : result.b); - - return result; - } - - bool Color::operator==(const Color& color) const - { - return r == color.r && g == color.g && b == color.b && a == color.a; - } - - bool Color::operator!=(const Color& color) const - { - return !(r == color.r && g == color.g && b == color.b && a == color.a); - } - - std::ostream& operator<<(std::ostream& out, - const Color& color) - { - out << "Color [r = " - << color.r - << ", g = " - << color.g - << ", b = " - << color.b - << ", a = " - << color.a - << "]"; - - return out; - } -} // namespace gcn diff --git a/src/gui/base/color.hpp b/src/gui/base/color.hpp deleted file mode 100644 index 781b2cb60..000000000 --- a/src/gui/base/color.hpp +++ /dev/null @@ -1,195 +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_COLOR_HPP -#define GCN_COLOR_HPP - -#include - -#include "localconsts.h" - -namespace gcn -{ - /** - * Represents a color with red, green, blue and alpha components. - */ - class Color final - { - public: - /** - * Constructor. Initializes the color to black. - */ - Color(); - - /** - * Constructor. Constructs a color from the bytes in an integer. - * Call it with a hexadecimal constant for HTML-style color representation. - * The alpha component is 255 by default. - * - * EXAMPLE: Color(0xff50a0) constructs a very nice pinkish color. - * - * NOTE: Because of this constructor, integers will be automatically - * casted to a color by your compiler. - * - * @param color The color to initialise the object with. - */ - explicit Color(const unsigned int color); - - /** - * Constructor. The default alpha value is 255. - * - * @param r Red color component (range 0-255). - * @param g Green color component (range 0-255). - * @param b Blue color component (range 0-255). - * @param a Alpha, used for transparency. A value of 0 means - * totaly transparent, 255 is totaly opaque. - */ - Color(const unsigned int r, - const unsigned int g, - const unsigned int b, - const unsigned int a = 255); - - /** - * Adds the RGB values of two colors together. The values will be - * clamped if they go out of range. - * - * WARNING: This function will reset the alpha value of the - * returned color to 255. - * - * @param color A color to add to this color. - * @return The added colors with an alpha value set to 255. - */ - Color operator+(const Color& color) const; - - /** - * Subtracts the RGB values of one color from another. - * The values will be clamped if they go out of range. - * - * WARNING: This function will reset the alpha value of the - * returned color to 255. - * - * @param color A color to subtract from this color. - * @return The subtracted colors with an alpha value set to 255. - */ - Color operator-(const Color& color) const; - - /** - * Multiplies the RGB values of a color with a float value. - * The values will be clamped if they go out of range. - * - * @param value The value to multiply the color with. - * @return The multiplied colors. The alpha value will, unlike - * the add and subtract operations, be multiplied as - * well. - */ - Color operator*(const float value) const; - - /** - * Compares two colors. - * - * @return True if the two colors have the same RGBA components - * false otherwise. - */ - bool operator==(const Color& color) const; - - /** - * Compares two colors. - * - * @return True if the two colors have different RGBA components, - * false otherwise. - */ - bool operator!=(const Color& color) const; - - /** - * Output operator for output. - * - * @param out The stream to output to. - * @param color The color to output. - */ - friend std::ostream& operator<<(std::ostream& out, - const Color& Color); - - /** - * Holds the red color component (range 0-255). - */ - unsigned int r; - - /** - * Holds the green color component (range 0-255). - */ - unsigned int g; - - /** - * Holds the blue color component (range 0-255). - */ - unsigned int b; - - /** - * Holds the alpha color component. A value of 0 means totally - * transparent while a value of 255 is considered opaque. - */ - unsigned int a; - }; -} // namespace gcn - -#endif // end GCN_COLOR_HPP diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp index dd872d9a1..31d61312e 100644 --- a/src/gui/base/widget.hpp +++ b/src/gui/base/widget.hpp @@ -68,7 +68,8 @@ #include #include -#include "gui/base/color.hpp" +#include "gui/color.h" + #include "gui/base/rectangle.hpp" #include "gui/widgets/widget2.h" diff --git a/src/gui/color.cpp b/src/gui/color.cpp new file mode 100644 index 000000000..9a0034257 --- /dev/null +++ b/src/gui/color.cpp @@ -0,0 +1,165 @@ +/* + * 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/color.h" + +#include "debug.h" + +Color::Color() : + r(0U), + g(0U), + b(0U), + a(255U) +{ +} + +Color::Color(const unsigned int color) : + r((color >> 16) & 0xFF), + g((color >> 8) & 0xFF), + b(color & 0xFF), + a(255U) +{ +} + +Color::Color(const unsigned int ar, + const unsigned int ag, + const unsigned int ab, + const unsigned int aa) : + r(ar), + g(ag), + b(ab), + a(aa) +{ +} + +Color Color::operator+(const Color& color) const +{ + Color result(r + color.r, + g + color.g, + b + color.b, + 255U); + + result.r = (result.r > 255U ? 255U : result.r); + result.g = (result.g > 255U ? 255U : result.g); + result.b = (result.b > 255U ? 255U : result.b); + + return result; +} + +Color Color::operator-(const Color& color) const +{ + Color result(r - color.r, + g - color.g, + b - color.b, + 255U); + + result.r = (result.r > 255U ? 255U : result.r); + result.g = (result.g > 255U ? 255U : result.g); + result.b = (result.b > 255U ? 255U : result.b); + + return result; +} + +Color Color::operator*(const float value) const +{ + Color result(static_cast(static_cast(r) * value), + static_cast(static_cast(g) * value), + static_cast(static_cast(b) * value), + a); + + result.r = (result.r > 255U ? 255U : result.r); + result.g = (result.g > 255U ? 255U : result.g); + result.b = (result.b > 255U ? 255U : result.b); + + return result; +} + +bool Color::operator==(const Color& color) const +{ + return r == color.r && g == color.g && b == color.b && a == color.a; +} + +bool Color::operator!=(const Color& color) const +{ + return !(r == color.r && g == color.g && b == color.b && a == color.a); +} + +std::ostream& operator<<(std::ostream& out, + const Color& color) +{ + out << "Color [r = " + << color.r + << ", g = " + << color.g + << ", b = " + << color.b + << ", a = " + << color.a + << "]"; + + return out; +} diff --git a/src/gui/color.h b/src/gui/color.h new file mode 100644 index 000000000..646680d96 --- /dev/null +++ b/src/gui/color.h @@ -0,0 +1,192 @@ +/* + * 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 GUI_COLOR_H +#define GUI_COLOR_H + +#include + +#include "localconsts.h" + +/** + * Represents a color with red, green, blue and alpha components. + */ +class Color final +{ + public: + /** + * Constructor. Initializes the color to black. + */ + Color(); + + /** + * Constructor. Constructs a color from the bytes in an integer. + * Call it with a hexadecimal constant for HTML-style color representation. + * The alpha component is 255 by default. + * + * EXAMPLE: Color(0xff50a0) constructs a very nice pinkish color. + * + * NOTE: Because of this constructor, integers will be automatically + * casted to a color by your compiler. + * + * @param color The color to initialise the object with. + */ + explicit Color(const unsigned int color); + + /** + * Constructor. The default alpha value is 255. + * + * @param r Red color component (range 0-255). + * @param g Green color component (range 0-255). + * @param b Blue color component (range 0-255). + * @param a Alpha, used for transparency. A value of 0 means + * totaly transparent, 255 is totaly opaque. + */ + Color(const unsigned int r, + const unsigned int g, + const unsigned int b, + const unsigned int a = 255); + + /** + * Adds the RGB values of two colors together. The values will be + * clamped if they go out of range. + * + * WARNING: This function will reset the alpha value of the + * returned color to 255. + * + * @param color A color to add to this color. + * @return The added colors with an alpha value set to 255. + */ + Color operator+(const Color& color) const; + + /** + * Subtracts the RGB values of one color from another. + * The values will be clamped if they go out of range. + * + * WARNING: This function will reset the alpha value of the + * returned color to 255. + * + * @param color A color to subtract from this color. + * @return The subtracted colors with an alpha value set to 255. + */ + Color operator-(const Color& color) const; + + /** + * Multiplies the RGB values of a color with a float value. + * The values will be clamped if they go out of range. + * + * @param value The value to multiply the color with. + * @return The multiplied colors. The alpha value will, unlike + * the add and subtract operations, be multiplied as + * well. + */ + Color operator*(const float value) const; + + /** + * Compares two colors. + * + * @return True if the two colors have the same RGBA components + * false otherwise. + */ + bool operator==(const Color& color) const; + + /** + * Compares two colors. + * + * @return True if the two colors have different RGBA components, + * false otherwise. + */ + bool operator!=(const Color& color) const; + + /** + * Output operator for output. + * + * @param out The stream to output to. + * @param color The color to output. + */ + friend std::ostream& operator<<(std::ostream& out, + const Color& Color); + + /** + * Holds the red color component (range 0-255). + */ + unsigned int r; + + /** + * Holds the green color component (range 0-255). + */ + unsigned int g; + + /** + * Holds the blue color component (range 0-255). + */ + unsigned int b; + + /** + * Holds the alpha color component. A value of 0 means totally + * transparent while a value of 255 is considered opaque. + */ + unsigned int a; +}; + +#endif // GUI_COLOR_H diff --git a/src/gui/font.cpp b/src/gui/font.cpp index fcc8e8344..e1d793ce1 100644 --- a/src/gui/font.cpp +++ b/src/gui/font.cpp @@ -99,8 +99,8 @@ int sdlTextChunkCnt = 0; #endif SDLTextChunkSmall::SDLTextChunkSmall(const std::string &text0, - const gcn::Color &color0, - const gcn::Color &color1) : + const Color &color0, + const Color &color1) : text(text0), color(color0), color2(color1) @@ -125,7 +125,7 @@ bool SDLTextChunkSmall::operator<(const SDLTextChunkSmall &chunk) const if (chunk.text != text) return chunk.text > text; - const gcn::Color &c = chunk.color; + const Color &c = chunk.color; if (c.r != color.r) return c.r > color.r; if (c.g != color.g) @@ -133,7 +133,7 @@ bool SDLTextChunkSmall::operator<(const SDLTextChunkSmall &chunk) const if (c.b != color.b) return c.b > color.b; - const gcn::Color &c2 = chunk.color2; + const Color &c2 = chunk.color2; if (c2.r != color2.r) return c2.r > color2.r; if (c2.g != color2.g) @@ -147,8 +147,8 @@ bool SDLTextChunkSmall::operator<(const SDLTextChunkSmall &chunk) const return false; } -SDLTextChunk::SDLTextChunk(const std::string &text0, const gcn::Color &color0, - const gcn::Color &color1) : +SDLTextChunk::SDLTextChunk(const std::string &text0, const Color &color0, + const Color &color1) : img(nullptr), text(text0), color(color0), @@ -499,8 +499,8 @@ void Font::drawString(Graphics *const graphics, if (!g) return; - gcn::Color col = g->getColor(); - const gcn::Color &col2 = g->getColor2(); + Color col = g->getColor(); + const 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 diff --git a/src/gui/font.h b/src/gui/font.h index 8740b4f3b..bdf81dadc 100644 --- a/src/gui/font.h +++ b/src/gui/font.h @@ -67,7 +67,7 @@ #ifndef GUI_FONT_H #define GUI_FONT_H -#include "gui/base/color.hpp" +#include "gui/color.h" #include @@ -84,8 +84,8 @@ const unsigned int CACHES_NUMBER = 256; class SDLTextChunkSmall { public: - SDLTextChunkSmall(const std::string &text0, const gcn::Color &color0, - const gcn::Color &color1); + SDLTextChunkSmall(const std::string &text0, const Color &color0, + const Color &color1); SDLTextChunkSmall(const SDLTextChunkSmall &old); @@ -93,15 +93,15 @@ class SDLTextChunkSmall bool operator<(const SDLTextChunkSmall &chunk) const; std::string text; - gcn::Color color; - gcn::Color color2; + Color color; + Color color2; }; class SDLTextChunk final { public: - SDLTextChunk(const std::string &text0, const gcn::Color &color0, - const gcn::Color &color1); + SDLTextChunk(const std::string &text0, const Color &color0, + const Color &color1); A_DELETE_COPY(SDLTextChunk) @@ -113,8 +113,8 @@ class SDLTextChunk final Image *img; std::string text; - gcn::Color color; - gcn::Color color2; + Color color; + Color color2; SDLTextChunk *prev; SDLTextChunk *next; }; diff --git a/src/gui/gui.h b/src/gui/gui.h index f6b4fbbf6..232d47a22 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -23,7 +23,8 @@ #ifndef GUI_GUI_H #define GUI_GUI_H -#include "gui/base/color.hpp" +#include "gui/color.h" + #include "gui/base/gui.hpp" #include "localconsts.h" @@ -198,8 +199,8 @@ class Gui final : public gcn::Gui typedef std::list FocusListenerList; typedef FocusListenerList::iterator FocusListenerIterator; FocusListenerList mFocusListeners; - gcn::Color mForegroundColor; - gcn::Color mForegroundColor2; + Color mForegroundColor; + Color mForegroundColor2; int mTime; bool mCustomCursor; /**< Show custom cursor */ bool mDoubleClick; diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index 9d6c19095..21e027d82 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -29,18 +29,18 @@ #include "debug.h" -const gcn::Color Palette::BLACK = gcn::Color(0, 0, 0); +const Color Palette::BLACK = Color(0, 0, 0); Palette::Palettes Palette::mInstances; -const gcn::Color Palette::RAINBOW_COLORS[7] = +const Color Palette::RAINBOW_COLORS[7] = { - gcn::Color(255, 0, 0), - gcn::Color(255, 153, 0), - gcn::Color(255, 255, 0), - gcn::Color(0, 153, 0), - gcn::Color(0, 204, 204), - gcn::Color(51, 0, 153), - gcn::Color(153, 0, 153) + Color(255, 0, 0), + Color(255, 153, 0), + Color(255, 255, 0), + Color(0, 153, 0), + Color(0, 204, 204), + Color(51, 0, 153), + Color(153, 0, 153) }; const int Palette::RAINBOW_COLOR_COUNT = 7; @@ -59,7 +59,7 @@ Palette::~Palette() mInstances.erase(this); } -const gcn::Color& Palette::getCharColor(const signed char c, bool &valid) const +const Color& Palette::getCharColor(const signed char c, bool &valid) const { const CharColors::const_iterator it = mCharColors.find(c); if (it != mCharColors.end()) @@ -128,7 +128,7 @@ void Palette::advanceGradient() else colIndex = gradIndex; - gcn::Color &color = elem->color; + Color &color = elem->color; int colVal; if (grad == PULSE) @@ -136,7 +136,7 @@ void Palette::advanceGradient() colVal = static_cast(255.0 * sin(M_PI * colIndex / numOfColors)); - const gcn::Color &col = elem->testColor; + const Color &col = elem->testColor; color.r = ((colVal * col.r) / 255) % (col.r + 1); color.g = ((colVal * col.g) / 255) % (col.g + 1); @@ -180,9 +180,9 @@ void Palette::advanceGradient() } else if (elem->grad == RAINBOW) { - const gcn::Color &startCol = RAINBOW_COLORS[colIndex]; - const gcn::Color &destCol = - RAINBOW_COLORS[(colIndex + 1) % numOfColors]; + const Color &startCol = RAINBOW_COLORS[colIndex]; + const Color &destCol + = RAINBOW_COLORS[(colIndex + 1) % numOfColors]; double startColVal; double destColVal; diff --git a/src/gui/palette.h b/src/gui/palette.h index 1377822ca..0dbb5d3ad 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -26,7 +26,7 @@ #include "logger.h" -#include "gui/base/color.hpp" +#include "gui/color.h" #if defined __native_client__ #include @@ -49,7 +49,7 @@ class Palette { public: /** Black Color Constant */ - static const gcn::Color BLACK; + static const Color BLACK; /** Colors can be static or can alter over time. */ enum GradientType @@ -71,8 +71,8 @@ class Palette * * @return the requested color or Palette::BLACK */ - const gcn::Color &getCharColor(const signed char c, - bool &valid) const A_WARN_UNUSED; + const Color &getCharColor(const signed char c, + bool &valid) const A_WARN_UNUSED; int getIdByChar(const signed char c, bool &valid) const A_WARN_UNUSED; @@ -85,8 +85,8 @@ class Palette * * @return the requested color */ - inline const gcn::Color &getColor(int type, - const int alpha = 255) A_WARN_UNUSED + inline const Color &getColor(int type, + const int alpha = 255) A_WARN_UNUSED { if (type >= static_cast(mColors.size()) || type < 0) { @@ -94,15 +94,14 @@ class Palette type, static_cast(mColors.size())); type = 0; } - gcn::Color* col = &mColors[type].color; + Color* col = &mColors[type].color; col->a = alpha; return *col; } - inline const gcn::Color &getColorWithAlpha(const int type) - A_WARN_UNUSED + inline const Color &getColorWithAlpha(const int type) A_WARN_UNUSED { - gcn::Color* col = &mColors[type].color; + Color* col = &mColors[type].color; col->a = mColors[type].delay; return *col; } @@ -144,7 +143,7 @@ class Palette protected: /** Colors used for the rainbow gradient */ - static const gcn::Color RAINBOW_COLORS[7]; + static const Color RAINBOW_COLORS[7]; static const int RAINBOW_COLOR_COUNT; /** Time tick, that gradient-type colors were updated the last time. */ @@ -183,9 +182,9 @@ class Palette } int type; - gcn::Color color; - gcn::Color testColor; - gcn::Color committedColor; + Color color; + Color testColor; + Color committedColor; std::string text; signed char ch; GradientType grad; @@ -194,7 +193,7 @@ class Palette int delay; int committedDelay; - void set(const int type0, const gcn::Color &color0, + void set(const int type0, const Color &color0, const GradientType grad0, const int delay0) { type = type0; diff --git a/src/gui/popups/speechbubble.cpp b/src/gui/popups/speechbubble.cpp index 9bb6157bc..3d0250a78 100644 --- a/src/gui/popups/speechbubble.cpp +++ b/src/gui/popups/speechbubble.cpp @@ -57,8 +57,8 @@ void SpeechBubble::postInit() } void SpeechBubble::setCaption(const std::string &name, - const gcn::Color *const color1, - const gcn::Color *const color2) + const Color *const color1, + const Color *const color2) { mCaption->setCaption(name); mCaption->adjustSize(); diff --git a/src/gui/popups/speechbubble.h b/src/gui/popups/speechbubble.h index 62da9b146..1bc5385a4 100644 --- a/src/gui/popups/speechbubble.h +++ b/src/gui/popups/speechbubble.h @@ -47,9 +47,9 @@ class SpeechBubble final : public Popup * Sets the name displayed for the speech bubble, and in what color. */ void setCaption(const std::string &name, - const gcn::Color *const color1 = + const Color *const color1 = &Theme::getThemeColor(Theme::BUBBLE_NAME), - const gcn::Color *const color2 = + const Color *const color2 = &Theme::getThemeColor(Theme::BUBBLE_NAME_OUTLINE)); /** diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 2a1b0d624..1a504f680 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -259,7 +259,7 @@ void Theme::deleteInstance() mInstance = nullptr; } -gcn::Color Theme::getProgressColor(const int type, const float progress) +Color Theme::getProgressColor(const int type, const float progress) { int color[3] = {0, 0, 0}; @@ -273,7 +273,7 @@ gcn::Color Theme::getProgressColor(const int type, const float progress) logger->log("color not found: " + toString(type)); } - return gcn::Color(color[0], color[1], color[2]); + return Color(color[0], color[1], color[2]); } Skin *Theme::load(const std::string &filename, const std::string &filename2, @@ -972,7 +972,7 @@ static int readColorType(const std::string &type) return -1; } -static gcn::Color readColor(const std::string &description) +static Color readColor(const std::string &description) { const int size = static_cast(description.length()); if (size < 7 || description[0] != '#') @@ -1010,7 +1010,7 @@ static gcn::Color readColor(const std::string &description) v = (v << 4) | n; } - return gcn::Color(v); + return Color(v); } static Palette::GradientType readColorGradient(const std::string &grad) @@ -1084,7 +1084,7 @@ void Theme::loadColors(std::string file) int type; std::string temp; - gcn::Color color; + Color color; GradientType grad; for_each_xml_child_node(paletteNode, root) diff --git a/src/gui/theme.h b/src/gui/theme.h index 826902004..86543ea64 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -450,21 +450,21 @@ class Theme final : public Palette, public ConfigListener * * @return the requested color */ - inline static const gcn::Color &getThemeColor(const int type, - const int alpha = 255) - A_WARN_UNUSED + inline static const Color &getThemeColor(const int type, + const int alpha = 255) + A_WARN_UNUSED { return mInstance->getColor(type, alpha); } - static const gcn::Color &getThemeCharColor(const signed char c, - bool &valid) A_WARN_UNUSED + static const Color &getThemeCharColor(const signed char c, + bool &valid) A_WARN_UNUSED { return mInstance->getCharColor(c, valid); } static int getThemeIdByChar(const signed char c, bool &valid) A_WARN_UNUSED { return mInstance->getIdByChar(c, valid); } - static gcn::Color getProgressColor(const int type, - const float progress) A_WARN_UNUSED; + static Color getProgressColor(const int type, + const float progress) A_WARN_UNUSED; /** * Loads a skin. diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp index 69125f8e2..74d47203f 100644 --- a/src/gui/userpalette.cpp +++ b/src/gui/userpalette.cpp @@ -237,7 +237,7 @@ UserPalette::~UserPalette() void UserPalette::setColor(const int type, const int r, const int g, const int b) { - gcn::Color &color = mColors[type].color; + Color &color = mColors[type].color; color.r = r; color.g = g; color.b = b; @@ -296,14 +296,14 @@ void UserPalette::rollback() if (i->grad != i->committedGrad) setGradient(i->type, i->committedGrad); - const gcn::Color &committedColor = i->committedColor; + const Color &committedColor = i->committedColor; setGradientDelay(i->type, i->committedDelay); setColor(i->type, committedColor.r, committedColor.g, committedColor.b); if (i->grad == PULSE) { - gcn::Color &testColor = i->testColor; + Color &testColor = i->testColor; testColor.r = committedColor.r; testColor.g = committedColor.g; testColor.b = committedColor.b; @@ -342,7 +342,7 @@ void UserPalette::addColor(const unsigned type, const unsigned rgb, rgbValue = atox(rgbString); else rgbValue = atoi(rgbString.c_str()); - const gcn::Color &trueCol = gcn::Color(rgbValue); + const Color &trueCol = Color(rgbValue); grad = static_cast(config.getValue(configName + "Gradient", static_cast(grad))); delay = config.getValueInt(configName + "Delay", delay); diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h index fbba415b8..e37eee0ca 100644 --- a/src/gui/userpalette.h +++ b/src/gui/userpalette.h @@ -100,8 +100,8 @@ class UserPalette final : public Palette, public gcn::ListModel * * @return the requested committed color */ - inline const gcn::Color &getCommittedColor(const int type) - const A_WARN_UNUSED + inline const Color &getCommittedColor(const int type) + const A_WARN_UNUSED { return mColors[type].committedColor; } @@ -113,8 +113,7 @@ class UserPalette final : public Palette, public gcn::ListModel * * @return the requested test color */ - inline const gcn::Color &getTestColor(const int type) - const A_WARN_UNUSED + inline const Color &getTestColor(const int type) const A_WARN_UNUSED { return mColors[type].testColor; } /** @@ -123,7 +122,7 @@ class UserPalette final : public Palette, public gcn::ListModel * @param type the color type requested * @param color the color that should be tested */ - inline void setTestColor(const int type, const gcn::Color &color) + inline void setTestColor(const int type, const Color &color) { mColors[type].testColor = color; } /** diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index ee64736eb..54619c3e6 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -121,7 +121,7 @@ void Viewport::draw(Graphics *graphics) if (!mMap || !player_node) { - graphics->setColor(gcn::Color(64, 64, 64)); + graphics->setColor(Color(64, 64, 64)); graphics->fillRectangle( gcn::Rectangle(0, 0, getWidth(), getHeight())); BLOCK_END("Viewport::draw 1") @@ -338,7 +338,7 @@ void Viewport::_drawDebugPath(Graphics *const graphics) } void Viewport::_drawPath(Graphics *const graphics, const Path &path, - const gcn::Color &color) const + const Color &color) const { graphics->setColor(color); Font *const font = getFont(); diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 2b297de37..16d0e4e34 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -298,7 +298,7 @@ class Viewport final : public WindowContainer, * Draws the given path. */ void _drawPath(Graphics *const graphics, const Path &path, - const gcn::Color &color = gcn::Color(255, 0, 0)) const; + const Color &color = Color(255, 0, 0)) const; /** * Make the player go to the mouse position. diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 298ab657a..a71051b5d 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -154,7 +154,7 @@ void AvatarListBox::draw(Graphics *graphics) } if (parent && a->getMaxHp()) { - gcn::Color color = Theme::getProgressColor( + Color color = Theme::getProgressColor( Theme::PROG_HP, static_cast(a->getHp()) / static_cast(a->getMaxHp())); color.a = 80; @@ -180,8 +180,7 @@ void AvatarListBox::draw(Graphics *graphics) if (parent) { - gcn::Color color = Theme::getProgressColor(Theme::PROG_HP, - 1); + Color color = Theme::getProgressColor(Theme::PROG_HP, 1); color.a = 80; graphics->setColor(color); diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index cc83d2b83..b6644cbc1 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -534,8 +534,8 @@ int BrowserBox::calcHeight() const char *const hyphen = "~"; const int hyphenWidth = font->getWidth(hyphen); - gcn::Color selColor[2] = {mForegroundColor, mForegroundColor2}; - const gcn::Color textColor[2] = {mForegroundColor, mForegroundColor2}; + Color selColor[2] = {mForegroundColor, mForegroundColor2}; + const Color textColor[2] = {mForegroundColor, mForegroundColor2}; ResourceManager *const resman = ResourceManager::getInstance(); mLineParts.clear(); @@ -581,7 +581,7 @@ int BrowserBox::calcHeight() continue; } - gcn::Color prevColor[2]; + Color prevColor[2]; prevColor[0] = selColor[0]; prevColor[1] = selColor[1]; bold = false; @@ -621,7 +621,7 @@ int BrowserBox::calcHeight() const signed char c = row.at(start + 2); bool valid(false); - const gcn::Color col[2] = + const Color col[2] = { getThemeCharColor(c, valid), getThemeCharColor(c | 0x80, valid) @@ -897,8 +897,8 @@ std::string BrowserBox::getTextAtPos(const int x, const int y) const return str; } -void BrowserBox::setForegroundColorAll(const gcn::Color &color1, - const gcn::Color &color2) +void BrowserBox::setForegroundColorAll(const Color &color1, + const Color &color2) { mForegroundColor = color1; mForegroundColor2 = color2; diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 1f09dd0b1..a33c69698 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -58,8 +58,8 @@ struct BrowserLink final class LinePart final { public: - LinePart(const int x, const int y, const gcn::Color &color, - const gcn::Color &color2, const std::string &text, + LinePart(const int x, const int y, const Color &color, + const Color &color2, const std::string &text, const bool bold) : mX(x), mY(y), @@ -72,8 +72,8 @@ class LinePart final { } - LinePart(const int x, const int y, const gcn::Color &color, - const gcn::Color &color2, Image *const image) : + LinePart(const int x, const int y, const Color &color, + const Color &color2, Image *const image) : mX(x), mY(y), mColor(color), @@ -88,8 +88,8 @@ class LinePart final ~LinePart(); int mX, mY; - gcn::Color mColor; - gcn::Color mColor2; + Color mColor; + Color mColor2; std::string mText; unsigned char mType; Image *mImage; @@ -228,8 +228,8 @@ class BrowserBox final : public gcn::Widget, int getPadding() const A_WARN_UNUSED { return mPadding; } - void setForegroundColorAll(const gcn::Color &color1, - const gcn::Color &color2); + void setForegroundColorAll(const Color &color1, + const Color &color2); int getDataWidth() const { return mDataWidth; } @@ -266,9 +266,9 @@ class BrowserBox final : public gcn::Widget, int mItemPadding; unsigned int mDataWidth; - gcn::Color mHighlightColor; - gcn::Color mHyperLinkColor; - gcn::Color mColors[2][COLORS_MAX]; + Color mHighlightColor; + Color mHyperLinkColor; + Color mColors[2][COLORS_MAX]; bool mOpaque; bool mUseLinksAndUserColors; diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index 4f2e9fd89..039475150 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -165,14 +165,14 @@ class Button final : public gcn::Button, std::string mDescription; ImageCollection *mVertexes2; - gcn::Color mEnabledColor; - gcn::Color mEnabledColor2; - gcn::Color mDisabledColor; - gcn::Color mDisabledColor2; - gcn::Color mHighlightedColor; - gcn::Color mHighlightedColor2; - gcn::Color mPressedColor; - gcn::Color mPressedColor2; + Color mEnabledColor; + Color mEnabledColor2; + Color mDisabledColor; + Color mDisabledColor2; + Color mHighlightedColor; + Color mHighlightedColor2; + Color mPressedColor; + Color mPressedColor2; Image **mImages; ImageSet *mImageSet; unsigned mClickCount; diff --git a/src/gui/widgets/colormodel.cpp b/src/gui/widgets/colormodel.cpp index 7e59553e3..3a71a93cc 100644 --- a/src/gui/widgets/colormodel.cpp +++ b/src/gui/widgets/colormodel.cpp @@ -56,8 +56,8 @@ const ColorPair *ColorModel::getColorAt(const int i) const return &mColors[i]; } -void ColorModel::add(const std::string &name, const gcn::Color *const color1, - const gcn::Color *const color2) +void ColorModel::add(const std::string &name, const Color *const color1, + const Color *const color2) { mNames.push_back(name); mColors.push_back(ColorPair(color1, color2)); diff --git a/src/gui/widgets/colormodel.h b/src/gui/widgets/colormodel.h index c019d9aac..7386a856b 100644 --- a/src/gui/widgets/colormodel.h +++ b/src/gui/widgets/colormodel.h @@ -27,23 +27,19 @@ #include "localconsts.h" +class Color; class Widget2; -namespace gcn -{ - class Color; -} - struct ColorPair { - ColorPair(const gcn::Color* c1, const gcn::Color* c2) : + ColorPair(const Color* c1, const Color* c2) : color1(c1), color2(c2) { } - const gcn::Color* color1; - const gcn::Color* color2; + const Color* color1; + const Color* color2; }; class ColorModel : public gcn::ListModel @@ -67,8 +63,8 @@ class ColorModel : public gcn::ListModel size_t size() A_WARN_UNUSED { return mNames.size(); } - void add(const std::string &name, const gcn::Color *const color1, - const gcn::Color *const color2); + void add(const std::string &name, const Color *const color1, + const Color *const color2); static ColorModel *createDefault(const Widget2 *const widget); diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h index ad07b0ff8..f0fd500ea 100644 --- a/src/gui/widgets/desktop.h +++ b/src/gui/widgets/desktop.h @@ -72,8 +72,8 @@ class Desktop final : public Container, Image *mWallpaper; Label *mVersionLabel; Skin *mSkin; - gcn::Color mBackgroundColor; - gcn::Color mBackgroundGrayColor; + Color mBackgroundColor; + Color mBackgroundGrayColor; bool mShowBackground; }; diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 9bb459d45..815e4a85d 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -144,8 +144,8 @@ class DropDown final : public ActionListener, void drawButton(Graphics *graphics); PopupList *mPopup; - gcn::Color mShadowColor; - gcn::Color mHighlightColor; + Color mShadowColor; + Color mHighlightColor; int mPadding; int mImagePadding; int mSpacing; diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h index 236415b32..1888292de 100644 --- a/src/gui/widgets/dropshortcutcontainer.h +++ b/src/gui/widgets/dropshortcutcontainer.h @@ -79,10 +79,10 @@ class DropShortcutContainer final : public ShortcutContainer bool mItemClicked; ItemPopup *mItemPopup; - gcn::Color mEquipedColor; - gcn::Color mEquipedColor2; - gcn::Color mUnEquipedColor; - gcn::Color mUnEquipedColor2; + Color mEquipedColor; + Color mEquipedColor2; + Color mUnEquipedColor; + Color mUnEquipedColor2; }; #endif // GUI_WIDGETS_DROPSHORTCUTCONTAINER_H diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index 96f2a9532..b2c7c5620 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -188,7 +188,7 @@ private: /** * Holds the background color of the table. */ - gcn::Color mHighlightColor; + Color mHighlightColor; int mSelectedRow; int mSelectedColumn; diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index ab813b08f..32daa459b 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -181,10 +181,10 @@ class ItemContainer final : public gcn::Widget, ItemPopup *mItemPopup; int *mShowMatrix; Skin *mSkin; - gcn::Color mEquipedColor; - gcn::Color mEquipedColor2; - gcn::Color mUnEquipedColor; - gcn::Color mUnEquipedColor2; + Color mEquipedColor; + Color mEquipedColor2; + Color mUnEquipedColor; + Color mUnEquipedColor2; typedef std::list SelectionListenerList; typedef SelectionListenerList::iterator SelectionListenerIterator; SelectionListenerList mSelectionListeners; diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h index dd95851a6..07c3ef822 100644 --- a/src/gui/widgets/itemshortcutcontainer.h +++ b/src/gui/widgets/itemshortcutcontainer.h @@ -83,10 +83,10 @@ class ItemShortcutContainer final : public ShortcutContainer ItemPopup *mItemPopup; SpellPopup *mSpellPopup; - gcn::Color mEquipedColor; - gcn::Color mEquipedColor2; - gcn::Color mUnEquipedColor; - gcn::Color mUnEquipedColor2; + Color mEquipedColor; + Color mEquipedColor2; + Color mUnEquipedColor; + Color mUnEquipedColor2; }; #endif // GUI_WIDGETS_ITEMSHORTCUTCONTAINER_H diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 0c19d03c3..c02f37adb 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -114,14 +114,14 @@ void Label::adjustSize() setHeight(font->getHeight() + pad2); } -void Label::setForegroundColor(const gcn::Color &color) +void Label::setForegroundColor(const Color &color) { mForegroundColor = color; mForegroundColor2 = color; } -void Label::setForegroundColorAll(const gcn::Color &color1, - const gcn::Color &color2) +void Label::setForegroundColorAll(const Color &color1, + const Color &color2) { mForegroundColor = color1; mForegroundColor2 = color2; diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h index b63c9b10e..616f6cc79 100644 --- a/src/gui/widgets/label.h +++ b/src/gui/widgets/label.h @@ -62,10 +62,10 @@ class Label final : public gcn::Label void adjustSize(); - void setForegroundColor(const gcn::Color &color); + void setForegroundColor(const Color &color); - void setForegroundColorAll(const gcn::Color &color1, - const gcn::Color &color2); + void setForegroundColorAll(const Color &color1, + const Color &color2); void resizeTo(const int maxSize, const int minSize); diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 625f21085..61e1596f7 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -23,7 +23,7 @@ #ifndef GUI_WIDGETS_LISTBOX_H #define GUI_WIDGETS_LISTBOX_H -#include "gui/base/color.hpp" +#include "gui/color.h" #include "gui/base/widgets/listbox.hpp" @@ -115,9 +115,9 @@ class ListBox : public gcn::ListBox { mRowHeight = n; } protected: - gcn::Color mHighlightColor; - gcn::Color mForegroundSelectedColor; - gcn::Color mForegroundSelectedColor2; + Color mHighlightColor; + Color mForegroundSelectedColor; + Color mForegroundSelectedColor2; int mOldSelected; int mPadding; int mPressedIndex; diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index b44b6a1a0..7d2d00ad4 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -184,7 +184,7 @@ void ProgressBar::setProgressPalette(const int progressPalette) } } -void ProgressBar::setBackgroundColor(const gcn::Color &color) +void ProgressBar::setBackgroundColor(const Color &color) { mRedraw = true; mBackgroundColorToGo = color; @@ -193,7 +193,7 @@ void ProgressBar::setBackgroundColor(const gcn::Color &color) mBackgroundColor = color; } -void ProgressBar::setColor(const gcn::Color &color1, const gcn::Color &color2) +void ProgressBar::setColor(const Color &color1, const Color &color2) { mForegroundColor = color1; mForegroundColor2 = color2; @@ -269,7 +269,7 @@ void ProgressBar::render(Graphics *graphics) // The label if (!mText.empty()) { - const gcn::Color oldColor = graphics->getColor(); + const Color oldColor = graphics->getColor(); Font *const font = gui->getFont(); const int textX = mDimension.width / 2; diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index a2c55e077..a4862882e 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -93,14 +93,14 @@ class ProgressBar final : public gcn::Widget, /** * Change the color of the progress bar. */ - void setBackgroundColor(const gcn::Color &color); + void setBackgroundColor(const Color &color); - void setColor(const gcn::Color &color1, const gcn::Color &color2); + void setColor(const Color &color1, const Color &color2); /** * Returns the color of the progress bar. */ - const gcn::Color &getBackgroundColor() const A_WARN_UNUSED + const Color &getBackgroundColor() const A_WARN_UNUSED { return mBackgroundColor; } /** @@ -145,7 +145,7 @@ class ProgressBar final : public gcn::Widget, float mProgress; float mProgressToGo; - gcn::Color mBackgroundColorToGo; + Color mBackgroundColorToGo; std::string mText; ImageCollection *mVertexes; diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 85ff90261..59ae1059e 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -106,8 +106,8 @@ void ShopListBox::draw(Graphics *graphics) ++i, y += mRowHeight) { bool needDraw(false); - gcn::Color temp; - gcn::Color* backgroundColor = &mBackgroundColor; + Color temp; + Color* backgroundColor = &mBackgroundColor; ShopItem *const item = mShopItems->at(i); if (item && ((mShopItems && mPlayerMoney < item->getPrice() diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index 1cf628cca..38e209c33 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -94,8 +94,8 @@ class ShopListBox final : public ListBox ItemPopup *mItemPopup; - gcn::Color mBackgroundColor; - gcn::Color mWarningColor; + Color mBackgroundColor; + Color mWarningColor; bool mPriceCheck; bool mProtectItems; diff --git a/src/gui/widgets/skillinfo.h b/src/gui/widgets/skillinfo.h index a201f3274..f9baec6cc 100644 --- a/src/gui/widgets/skillinfo.h +++ b/src/gui/widgets/skillinfo.h @@ -23,7 +23,7 @@ #ifndef GUI_WIDGETS_SKILLINFO_H #define GUI_WIDGETS_SKILLINFO_H -#include "gui/base/color.hpp" +#include "gui/color.h" #include #include @@ -43,7 +43,7 @@ struct SkillInfo final std::string skillLevel; std::string skillExp; float progress; - gcn::Color color; + Color color; SkillDataMap dataMap; SkillModel *model; SkillData *data; diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index 9e78133f5..61219fa98 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -253,7 +253,7 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED) mSelected = mColorBox->getSelected(); const int type = userPalette->getColorTypeAt(mSelected); - const gcn::Color *col = &userPalette->getColor(type); + const Color *col = &userPalette->getColor(type); const Palette::GradientType grad = userPalette->getGradientType(type); const int delay = userPalette->getGradientDelay(type); @@ -383,7 +383,7 @@ void Setup_Colors::cancel() userPalette->rollback(); const int type = userPalette->getColorTypeAt(mSelected); - const gcn::Color *const col = &userPalette->getColor(type); + const Color *const col = &userPalette->getColor(type); mGradTypeSlider->setValue2(userPalette->getGradientType(type)); const int delay = userPalette->getGradientDelay(type); setEntry(mGradDelaySlider, mGradDelayText, delay); @@ -444,7 +444,7 @@ void Setup_Colors::updateColor() } else if (grad == Palette::PULSE) { - userPalette->setTestColor(type, gcn::Color( + userPalette->setTestColor(type, Color( static_cast(mRedSlider->getValue()), static_cast(mGreenSlider->getValue()), static_cast(mBlueSlider->getValue()))); diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h index 463a6b668..1f52cde88 100644 --- a/src/gui/widgets/tabs/tab.h +++ b/src/gui/widgets/tabs/tab.h @@ -114,8 +114,8 @@ class Tab : public gcn::BasicContainer, /** * Set the normal color for the tab's text. */ - void setTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setTabColor(const Color *const color1, + const Color *const color2) { mTabColor = color1; mTabOutlineColor = color2; @@ -124,8 +124,8 @@ class Tab : public gcn::BasicContainer, /** * Set the highlighted color for the tab's text. */ - void setHighlightedTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setHighlightedTabColor(const Color *const color1, + const Color *const color2) { mTabHighlightedColor = color1; mTabHighlightedOutlineColor = color2; @@ -134,8 +134,8 @@ class Tab : public gcn::BasicContainer, /** * Set the selected color for the tab's text. */ - void setSelectedTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setSelectedTabColor(const Color *const color1, + const Color *const color2) { mTabSelectedColor = color1; mTabSelectedOutlineColor = color2; @@ -144,8 +144,8 @@ class Tab : public gcn::BasicContainer, /** * Set the flash color for the tab's text. */ - void setFlashTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setFlashTabColor(const Color *const color1, + const Color *const color2) { mFlashColor = color1; mFlashOutlineColor = color2; @@ -154,8 +154,8 @@ class Tab : public gcn::BasicContainer, /** * Set the player flash color for the tab's text. */ - void setPlayerFlashTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setPlayerFlashTabColor(const Color *const color1, + const Color *const color2) { mPlayerFlashColor = color1; mPlayerFlashOutlineColor = color2; @@ -214,16 +214,16 @@ class Tab : public gcn::BasicContainer, static int mInstances; /**< Number of tab instances */ static float mAlpha; - const gcn::Color *mTabColor; - const gcn::Color *mTabOutlineColor; - const gcn::Color *mTabHighlightedColor; - const gcn::Color *mTabHighlightedOutlineColor; - const gcn::Color *mTabSelectedColor; - const gcn::Color *mTabSelectedOutlineColor; - const gcn::Color *mFlashColor; - const gcn::Color *mFlashOutlineColor; - const gcn::Color *mPlayerFlashColor; - const gcn::Color *mPlayerFlashOutlineColor; + const Color *mTabColor; + const Color *mTabOutlineColor; + const Color *mTabHighlightedColor; + const Color *mTabHighlightedOutlineColor; + const Color *mTabSelectedColor; + const Color *mTabSelectedOutlineColor; + const Color *mFlashColor; + const Color *mFlashOutlineColor; + const Color *mPlayerFlashColor; + const Color *mPlayerFlashOutlineColor; int mFlash; ImageCollection *mVertexes; Image *mImage; diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index ec0d09a26..e0327e670 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -379,14 +379,14 @@ void TextBox::draw(Graphics* graphics) BLOCK_END("TextBox::draw") } -void TextBox::setForegroundColor(const gcn::Color &color) +void TextBox::setForegroundColor(const Color &color) { mForegroundColor = color; mForegroundColor2 = color; } -void TextBox::setForegroundColorAll(const gcn::Color &color1, - const gcn::Color &color2) +void TextBox::setForegroundColorAll(const Color &color1, + const Color &color2) { mForegroundColor = color1; mForegroundColor2 = color2; diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h index 24dd57adb..3f78fd247 100644 --- a/src/gui/widgets/textbox.h +++ b/src/gui/widgets/textbox.h @@ -61,10 +61,10 @@ class TextBox final : public gcn::TextBox void draw(Graphics* graphics) override final; - void setForegroundColor(const gcn::Color &color); + void setForegroundColor(const Color &color); - void setForegroundColorAll(const gcn::Color &color1, - const gcn::Color &color2); + void setForegroundColorAll(const Color &color1, + const Color &color2); private: int mMinWidth; diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index b05a498dc..ccc1b16d6 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -159,7 +159,7 @@ class TextField : public gcn::TextField, static Skin *mSkin; private: - const gcn::Color *mCaretColor; + const Color *mCaretColor; PopupMenu *mPopupMenu; static int instances; static float mAlpha; diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 1344c647a..462ba17d9 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -89,7 +89,7 @@ void TextPreview::draw(Graphics* graphics) if (mOpaque) { - graphics->setColor(gcn::Color(static_cast(mBGColor->r), + graphics->setColor(Color(static_cast(mBGColor->r), static_cast(mBGColor->g), static_cast(mBGColor->b), static_cast(mAlpha * 255.0F))); @@ -105,7 +105,7 @@ void TextPreview::draw(Graphics* graphics) + 2 * ((mOutline || mShadow) ? 1 :0); const int y = mFont->getHeight() + 1 + 2 * ((mOutline || mShadow) ? 1 : 0); - graphics->setColor(gcn::Color(static_cast(mTextBGColor->r), + graphics->setColor(Color(static_cast(mTextBGColor->r), static_cast(mTextBGColor->g), static_cast(mTextBGColor->b), intAlpha)); @@ -113,9 +113,9 @@ void TextPreview::draw(Graphics* graphics) } } - graphics->setColorAll(gcn::Color(mTextColor->r, + graphics->setColorAll(Color(mTextColor->r, mTextColor->g, mTextColor->b, alpha), - gcn::Color(mTextColor2->r, mTextColor2->g, mTextColor2->b, alpha)); + Color(mTextColor2->r, mTextColor2->g, mTextColor2->b, alpha)); if (mOutline && mTextColor != mTextColor2) graphics->setColor2(Theme::getThemeColor(Theme::OUTLINE)); diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h index 31f64f545..31768fa66 100644 --- a/src/gui/widgets/textpreview.h +++ b/src/gui/widgets/textpreview.h @@ -40,10 +40,10 @@ class TextPreview final : public gcn::Widget ~TextPreview(); - inline void setTextColor(const gcn::Color *color) + inline void setTextColor(const Color *color) { mTextColor = color; adjustSize(); } - inline void setTextColor2(const gcn::Color *color) + inline void setTextColor2(const Color *color) { mTextColor2 = color; adjustSize(); } /** @@ -60,7 +60,7 @@ class TextPreview final : public gcn::Widget * * @param color the color to set */ - inline void setTextBGColor(const gcn::Color *color) + inline void setTextBGColor(const Color *color) { mTextBGColor = color; } /** @@ -68,7 +68,7 @@ class TextPreview final : public gcn::Widget * * @param color the color to set */ - inline void setBGColor(const gcn::Color *color) + inline void setBGColor(const Color *color) { mBGColor = color; } /** @@ -123,10 +123,10 @@ class TextPreview final : public gcn::Widget private: Font *mFont; std::string mText; - const gcn::Color *mTextColor; - const gcn::Color *mTextColor2; - const gcn::Color *mBGColor; - const gcn::Color *mTextBGColor; + const Color *mTextColor; + const Color *mTextColor2; + const Color *mBGColor; + const Color *mTextBGColor; int mPadding; static int instances; static float mAlpha; diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index c6317702f..ff565815f 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -32,16 +32,16 @@ class Widget2 { } - inline const gcn::Color &getThemeColor(const int type, - const int alpha = 255) - const A_WARN_UNUSED + inline const Color &getThemeColor(const int type, + const int alpha = 255) + const A_WARN_UNUSED { return Theme::getThemeColor(mPaletteOffset + type, alpha); } - inline const gcn::Color &getThemeCharColor(const signed char c, - bool &valid) - const A_WARN_UNUSED + inline const Color &getThemeCharColor(const signed char c, + bool &valid) + const A_WARN_UNUSED { const int colorId = Theme::getThemeIdByChar(c, valid); if (valid) @@ -71,7 +71,7 @@ class Widget2 } } - void setForegroundColor2(const gcn::Color &color) + void setForegroundColor2(const Color &color) { mForegroundColor2 = color; } @@ -85,7 +85,7 @@ class Widget2 } int mPaletteOffset; - gcn::Color mForegroundColor2; + Color mForegroundColor2; }; extern RenderType openGLMode; diff --git a/src/gui/windows/equipmentwindow.h b/src/gui/windows/equipmentwindow.h index c9ca12bbd..0ab4ca462 100644 --- a/src/gui/windows/equipmentwindow.h +++ b/src/gui/windows/equipmentwindow.h @@ -136,10 +136,10 @@ class EquipmentWindow final : public Window, ImageSet *mImageSet; Being *mBeing; std::vector mBoxes; - gcn::Color mHighlightColor; - gcn::Color mBorderColor; - gcn::Color mLabelsColor; - gcn::Color mLabelsColor2; + Color mHighlightColor; + Color mBorderColor; + Color mLabelsColor; + Color mLabelsColor2; Image *mSlotBackground; Image *mSlotHighlightedBackground; ImageCollection *mVertexes; diff --git a/src/gui/windows/outfitwindow.h b/src/gui/windows/outfitwindow.h index 909b84a41..55948f834 100644 --- a/src/gui/windows/outfitwindow.h +++ b/src/gui/windows/outfitwindow.h @@ -115,8 +115,8 @@ class OutfitWindow final : public Window, int mItems[OUTFITS_COUNT + 1][OUTFIT_ITEM_COUNT]; int mAwayOutfit; - gcn::Color mBorderColor; - gcn::Color mBackgroundColor; + Color mBorderColor; + Color mBackgroundColor; unsigned char mItemColors[OUTFITS_COUNT + 1][OUTFIT_ITEM_COUNT]; bool mItemClicked; bool mItemsUnequip[OUTFITS_COUNT]; diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index a06257b10..cbab4710d 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -236,8 +236,8 @@ public: return 2 * getFont()->getHeight() + 5; } private: - gcn::Color mNotSupportedColor; - gcn::Color mNotSupportedColor2; + Color mNotSupportedColor; + Color mNotSupportedColor2; }; diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 9cc952ec6..2e9a8be10 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -231,8 +231,8 @@ class SkillListBox final : public ListBox private: SkillModel *mModel; TextPopup *mPopup; - gcn::Color mTextColor; - gcn::Color mTextColor2; + Color mTextColor; + Color mTextColor2; int mTextPadding; int mSpacing; bool mSkillClicked; diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index 83ec97521..c446fa177 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -414,7 +414,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, + const Color *const color, Font *const font, const bool outline) { @@ -438,7 +438,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, + const Color *const color, Font *const font, const bool outline) { diff --git a/src/particle/particle.h b/src/particle/particle.h index f69770513..491232b17 100644 --- a/src/particle/particle.h +++ b/src/particle/particle.h @@ -30,16 +30,11 @@ #include #include +class Color; +class Font; class Particle; class ParticleEmitter; -namespace gcn -{ - class Color; -} - -class Font; - typedef std::list Particles; typedef Particles::iterator ParticleIterator; typedef Particles::const_iterator ParticleConstIterator; @@ -136,7 +131,7 @@ class Particle : public Actor */ Particle *addTextSplashEffect(const std::string &text, const int x, const int y, - const gcn::Color *const color, + const Color *const color, Font *const font, const bool outline = false); @@ -145,7 +140,7 @@ class Particle : public Actor */ Particle *addTextRiseFadeOutEffect(const std::string &text, const int x, const int y, - const gcn::Color *const color, + const Color *const color, Font *const font, const bool outline = false); diff --git a/src/particle/textparticle.cpp b/src/particle/textparticle.cpp index 1ac6ac6c2..41ea683f6 100644 --- a/src/particle/textparticle.cpp +++ b/src/particle/textparticle.cpp @@ -26,13 +26,13 @@ #include "gui/theme.h" -#include "gui/base/color.hpp" +#include "gui/color.h" #include "gui/font.h" #include "debug.h" TextParticle::TextParticle(const std::string &text, - const gcn::Color *const color, + const Color *const color, Font *const font, const bool outline) : Particle(), mText(text), @@ -74,7 +74,7 @@ void TextParticle::draw(Graphics *const graphics, / static_cast(mFadeIn); } - gcn::Color color = *mColor; + Color color = *mColor; color.a = static_cast(alpha); graphics->setColor(color); diff --git a/src/particle/textparticle.h b/src/particle/textparticle.h index 0d598508d..ec586c3a9 100644 --- a/src/particle/textparticle.h +++ b/src/particle/textparticle.h @@ -32,7 +32,7 @@ class TextParticle final : public Particle * Constructor. */ TextParticle(const std::string &text, - const gcn::Color *const color, + const Color *const color, Font *const font, const bool outline = false); A_DELETE_COPY(TextParticle) @@ -54,7 +54,7 @@ class TextParticle final : public Particle private: std::string mText; /**< Text of the particle. */ Font *mTextFont; /**< Font used for drawing the text. */ - const gcn::Color *mColor; /**< Color used for drawing the text. */ + const Color *mColor; /**< Color used for drawing the text. */ int mTextWidth; bool mOutline; /**< Make the text better readable */ }; diff --git a/src/render/graphics.h b/src/render/graphics.h index 53eb4af12..2356d2d31 100644 --- a/src/render/graphics.h +++ b/src/render/graphics.h @@ -70,10 +70,11 @@ #include "sdlshared.h" +#include "gui/color.h" + #include "render/renderers.h" #include "gui/base/cliprectangle.hpp" -#include "gui/base/color.hpp" #ifdef USE_SDL2 #include @@ -331,27 +332,27 @@ class Graphics virtual void initArrays() { } - virtual void setColor(const gcn::Color &color) + virtual void setColor(const Color &color) { mColor = color; mColor2 = color; mAlpha = (color.a != 255); } - void setColor2(const gcn::Color &color) + void setColor2(const Color &color) { mColor2 = color; } - void setColorAll(const gcn::Color &color, const gcn::Color &color2) + void setColorAll(const Color &color, const Color &color2) { mColor = color; mColor2 = color2; mAlpha = (color.a != 255); } - const gcn::Color &getColor() const + const Color &getColor() const { return mColor; } - const gcn::Color &getColor2() const + const Color &getColor2() const { return mColor2; } #ifdef DEBUG_DRAW_CALLS @@ -534,8 +535,8 @@ class Graphics int mStartFreeMem; bool mSync; int mScale; - gcn::Color mColor; - gcn::Color mColor2; + Color mColor; + Color mColor2; }; extern Graphics *mainGraphics; diff --git a/src/render/mobileopenglgraphics.h b/src/render/mobileopenglgraphics.h index f665f743b..0b9cd83e2 100644 --- a/src/render/mobileopenglgraphics.h +++ b/src/render/mobileopenglgraphics.h @@ -127,7 +127,7 @@ class MobileOpenGLGraphics final : public Graphics bool mTexture; bool mIsByteColor; - gcn::Color mByteColor; + Color mByteColor; GLuint mImageCached; float mFloatColor; int mMaxVertices; diff --git a/src/render/normalopenglgraphics.h b/src/render/normalopenglgraphics.h index 882ff5ed8..214954e3c 100644 --- a/src/render/normalopenglgraphics.h +++ b/src/render/normalopenglgraphics.h @@ -143,7 +143,7 @@ class NormalOpenGLGraphics final : public Graphics bool mTexture; bool mIsByteColor; - gcn::Color mByteColor; + Color mByteColor; GLuint mImageCached; float mFloatColor; int mMaxVertices; diff --git a/src/render/nullopenglgraphics.h b/src/render/nullopenglgraphics.h index cbab0614d..ee2a5d189 100644 --- a/src/render/nullopenglgraphics.h +++ b/src/render/nullopenglgraphics.h @@ -130,7 +130,7 @@ class NullOpenGLGraphics final : public Graphics bool mTexture; bool mIsByteColor; - gcn::Color mByteColor; + Color mByteColor; float mFloatColor; int mMaxVertices; bool mColorAlpha; diff --git a/src/render/openglgraphicsdef.hpp b/src/render/openglgraphicsdef.hpp index 89f8e63a9..99bf8e82a 100644 --- a/src/render/openglgraphicsdef.hpp +++ b/src/render/openglgraphicsdef.hpp @@ -92,14 +92,14 @@ void popClipArea() override final; - void setColor(const gcn::Color &color) override final + void setColor(const Color &color) override final { mColor = color; mColor2 = color; mColorAlpha = (color.a != 255); } - void setColorAll(const gcn::Color &color, const gcn::Color &color2) + void setColorAll(const Color &color, const Color &color2) { mColor = color; mColor2 = color2; diff --git a/src/render/safeopenglgraphics.h b/src/render/safeopenglgraphics.h index 28d61b59a..fbb156c6c 100644 --- a/src/render/safeopenglgraphics.h +++ b/src/render/safeopenglgraphics.h @@ -90,7 +90,7 @@ class SafeOpenGLGraphics final : public Graphics bool mTexture; bool mIsByteColor; - gcn::Color mByteColor; + Color mByteColor; float mFloatColor; bool mColorAlpha; FBOInfo mFbo; diff --git a/src/text.cpp b/src/text.cpp index dfc127598..27d794d33 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -39,7 +39,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, + const Color *const color, const bool isSpeech, Font *const font) : mFont(font ? font : (gui ? gui->getFont() : nullptr)), mX(x), @@ -112,7 +112,7 @@ Text::~Text() } } -void Text::setColor(const gcn::Color *const color) +void Text::setColor(const Color *const color) { mColor = color; } @@ -152,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, Font *const font) : + const 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 cade9db18..497792091 100644 --- a/src/text.h +++ b/src/text.h @@ -26,7 +26,7 @@ #include "render/graphics.h" -#include "gui/base/color.hpp" +#include "gui/color.h" #include "localconsts.h" @@ -42,7 +42,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, + const Color *const color, const bool isSpeech = false, Font *const font = nullptr); A_DELETE_COPY(Text) @@ -52,7 +52,7 @@ class Text */ virtual ~Text(); - void setColor(const gcn::Color *const color); + void setColor(const Color *const color); int getWidth() const A_WARN_UNUSED { return mWidth; } @@ -80,8 +80,8 @@ class Text int mXOffset; /**< The offset of mX from the desired x. */ static int mInstances; /**< Instances of text. */ std::string mText; /**< The text to display. */ - const gcn::Color *mColor; /**< The color of the text. */ - const gcn::Color mOutlineColor; + const Color *mColor; /**< The color of the text. */ + const Color mOutlineColor; bool mIsSpeech; /**< Is this text a speech bubble? */ protected: @@ -93,7 +93,7 @@ class FlashText final : public Text public: FlashText(const std::string &text, const int x, const int y, const Graphics::Alignment alignment, - const gcn::Color *const color, + const Color *const color, Font *const font = nullptr); A_DELETE_COPY(FlashText) diff --git a/src/utils/sdlpixel.h b/src/utils/sdlpixel.h index a01858831..282b90afb 100644 --- a/src/utils/sdlpixel.h +++ b/src/utils/sdlpixel.h @@ -64,8 +64,9 @@ #ifndef UTILS_SDLPIXEL_H #define UTILS_SDLPIXEL_H +#include "gui/color.h" + #include "SDL.h" -#include "gui/base/color.hpp" /** * Puts a pixel on an SDL_Surface. @@ -75,7 +76,7 @@ * @param color the color the pixel should be in. */ inline void SDLputPixel(SDL_Surface* surface, int x, int y, - const gcn::Color& color) + const Color& color) { if (!surface) return; @@ -175,7 +176,7 @@ inline unsigned short SDLAlpha16(const unsigned short src, * @param color the color the pixel should be in. */ inline void SDLputPixelAlpha(SDL_Surface* surface, int x, int y, - const gcn::Color& color) + const Color& color) { const int bpp = surface->format->BytesPerPixel; -- cgit v1.2.3-70-g09d2 From 4e7a7c79f41a5aa509fa639f0d3e972ab7db6b06 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 22 Feb 2014 15:43:12 +0300 Subject: Move Widget into gui/widgets directory. --- src/CMakeLists.txt | 4 +- src/Makefile.am | 4 +- src/events/actionevent.h | 7 +- src/events/event.h | 11 +- src/events/inputguievent.h | 2 +- src/events/keyevent.h | 7 +- src/events/mouseevent.h | 5 +- src/events/selectionevent.h | 7 +- src/gui/base/basiccontainer.hpp | 2 +- src/gui/base/gui.cpp | 2 +- src/gui/base/gui.hpp | 3 +- src/gui/base/widget.cpp | 679 ---------------- src/gui/base/widget.hpp | 1231 ------------------------------ src/gui/base/widgets/button.cpp | 4 +- src/gui/base/widgets/button.hpp | 2 +- src/gui/base/widgets/checkbox.cpp | 4 +- src/gui/base/widgets/checkbox.hpp | 2 +- src/gui/base/widgets/label.cpp | 4 +- src/gui/base/widgets/label.hpp | 2 +- src/gui/base/widgets/listbox.cpp | 4 +- src/gui/base/widgets/listbox.hpp | 2 +- src/gui/base/widgets/radiobutton.cpp | 4 +- src/gui/base/widgets/radiobutton.hpp | 2 +- src/gui/base/widgets/slider.cpp | 4 +- src/gui/base/widgets/slider.hpp | 2 +- src/gui/base/widgets/textbox.cpp | 4 +- src/gui/base/widgets/textbox.hpp | 2 +- src/gui/base/widgets/textfield.cpp | 4 +- src/gui/base/widgets/textfield.hpp | 2 +- src/gui/focushandler.cpp | 56 +- src/gui/focushandler.h | 68 +- src/gui/gui.cpp | 22 +- src/gui/gui.h | 6 +- src/gui/widgets/avatarlistbox.cpp | 2 +- src/gui/widgets/browserbox.cpp | 2 +- src/gui/widgets/browserbox.h | 5 +- src/gui/widgets/browserbox_unittest.cc | 2 +- src/gui/widgets/container.cpp | 2 +- src/gui/widgets/container.h | 2 +- src/gui/widgets/emotepage.cpp | 2 +- src/gui/widgets/emotepage.h | 4 +- src/gui/widgets/flowcontainer.cpp | 2 +- src/gui/widgets/flowcontainer.h | 2 +- src/gui/widgets/guitable.cpp | 30 +- src/gui/widgets/guitable.h | 12 +- src/gui/widgets/horizontcontainer.cpp | 4 +- src/gui/widgets/horizontcontainer.h | 4 +- src/gui/widgets/icon.cpp | 4 +- src/gui/widgets/icon.h | 4 +- src/gui/widgets/itemcontainer.cpp | 4 +- src/gui/widgets/itemcontainer.h | 4 +- src/gui/widgets/layout.cpp | 4 +- src/gui/widgets/layout.h | 11 +- src/gui/widgets/layouthelper.cpp | 2 +- src/gui/widgets/layouthelper.h | 2 +- src/gui/widgets/popup.cpp | 2 +- src/gui/widgets/popup.h | 2 +- src/gui/widgets/popuplist.cpp | 2 +- src/gui/widgets/progressbar.cpp | 2 +- src/gui/widgets/progressbar.h | 4 +- src/gui/widgets/progressindicator.cpp | 2 +- src/gui/widgets/progressindicator.h | 4 +- src/gui/widgets/radiogroup.cpp | 2 +- src/gui/widgets/radiogroup.h | 6 +- src/gui/widgets/scrollarea.cpp | 10 +- src/gui/widgets/scrollarea.h | 2 +- src/gui/widgets/setupitem.cpp | 2 +- src/gui/widgets/setupitem.h | 10 +- src/gui/widgets/shortcutcontainer.cpp | 2 +- src/gui/widgets/shortcutcontainer.h | 5 +- src/gui/widgets/tabbedarea.cpp | 34 +- src/gui/widgets/tabbedarea.h | 16 +- src/gui/widgets/tablemodel.cpp | 8 +- src/gui/widgets/tablemodel.h | 13 +- src/gui/widgets/tabs/setup_joystick.cpp | 2 +- src/gui/widgets/tabs/setup_relations.cpp | 6 +- src/gui/widgets/tabstrip.cpp | 4 +- src/gui/widgets/tabstrip.h | 6 +- src/gui/widgets/textbox.cpp | 4 +- src/gui/widgets/textpreview.cpp | 2 +- src/gui/widgets/textpreview.h | 4 +- src/gui/widgets/vertcontainer.cpp | 6 +- src/gui/widgets/vertcontainer.h | 6 +- src/gui/widgets/widget.cpp | 676 ++++++++++++++++ src/gui/widgets/widget.h | 1228 +++++++++++++++++++++++++++++ src/gui/widgets/widgetgroup.cpp | 2 +- src/gui/widgets/widgetgroup.h | 2 +- src/gui/widgets/window.cpp | 6 +- src/gui/widgets/window.h | 6 +- src/gui/widgets/windowcontainer.cpp | 6 +- src/gui/widgets/windowcontainer.h | 8 +- src/gui/windows/botcheckerwindow.cpp | 8 +- src/gui/windows/charselectdialog.cpp | 2 +- src/gui/windows/chatwindow.cpp | 2 +- src/gui/windows/inventorywindow.cpp | 2 +- src/gui/windows/socialwindow.cpp | 2 +- 96 files changed, 2185 insertions(+), 2207 deletions(-) delete mode 100644 src/gui/base/widget.cpp delete mode 100644 src/gui/base/widget.hpp create mode 100644 src/gui/widgets/widget.cpp create mode 100644 src/gui/widgets/widget.h (limited to 'src/gui/widgets/browserbox.h') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 69304d442..cfab9cccb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -783,7 +783,7 @@ SET(SRCS events/selectionevent.h listeners/selectionlistener.h utils/sdlpixel.h - gui/base/widget.hpp + gui/widgets/widget.h listeners/widgetlistener.h gui/base/widgets/button.hpp gui/base/widgets/checkbox.hpp @@ -802,7 +802,7 @@ SET(SRCS gui/base/gui.cpp input/key.cpp gui/rectangle.cpp - gui/base/widget.cpp + gui/widgets/widget.cpp gui/base/widgets/button.cpp gui/base/widgets/checkbox.cpp gui/base/widgets/container.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 0b03f22f0..eba67d244 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -169,7 +169,7 @@ manaplus_SOURCES += events/actionevent.h \ events/selectionevent.h \ listeners/selectionlistener.h \ utils/sdlpixel.h \ - gui/base/widget.hpp \ + gui/widgets/widget.h \ listeners/widgetlistener.h \ gui/base/widgets/button.hpp \ gui/base/widgets/checkbox.hpp \ @@ -188,7 +188,7 @@ manaplus_SOURCES += events/actionevent.h \ gui/base/gui.cpp \ input/key.cpp \ gui/rectangle.cpp \ - gui/base/widget.cpp \ + gui/widgets/widget.cpp \ gui/base/widgets/button.cpp \ gui/base/widgets/checkbox.cpp \ gui/base/widgets/container.cpp \ diff --git a/src/events/actionevent.h b/src/events/actionevent.h index 3164955e6..25f936cdd 100644 --- a/src/events/actionevent.h +++ b/src/events/actionevent.h @@ -70,10 +70,7 @@ #include "localconsts.h" -namespace GCN -{ - class Widget; -} +class Widget; /** * Represents an action event. An action event is an event @@ -106,7 +103,7 @@ class ActionEvent final : public Event * @param source The source widget of the event. * @param id An identifier of the event. */ - ActionEvent(gcn::Widget *const source, const std::string &id) : + ActionEvent(Widget *const source, const std::string &id) : Event(source), mId(id) { diff --git a/src/events/event.h b/src/events/event.h index b71d0edd4..63ccb207d 100644 --- a/src/events/event.h +++ b/src/events/event.h @@ -66,10 +66,7 @@ #include "localconsts.h" -namespace gcn -{ - class Widget; -} +class Widget; /** * Base class for all events. All events in Guichan should @@ -86,7 +83,7 @@ class Event * * @param source The source widget of the event. */ - explicit Event(gcn::Widget *const source) : + explicit Event(Widget *const source) : mSource(source) { } @@ -104,14 +101,14 @@ class Event * * @return The source widget of the event. */ - gcn::Widget* getSource() const A_WARN_UNUSED + Widget* getSource() const A_WARN_UNUSED { return mSource; } protected: /** * Holds the source widget of the event. */ - gcn::Widget* mSource; + Widget* mSource; }; #endif // EVENTS_EVENT_H diff --git a/src/events/inputguievent.h b/src/events/inputguievent.h index 8523959ed..2e5136ea2 100644 --- a/src/events/inputguievent.h +++ b/src/events/inputguievent.h @@ -84,7 +84,7 @@ class InputGuiEvent: public Event * @param isAltPressed True if alt is pressed, false otherwise. * @param isMetaPressed True if meta is pressed, false otherwise. */ - InputGuiEvent(gcn::Widget *const source, + InputGuiEvent(Widget *const source, const bool shiftPressed, const bool controlPressed, const bool altPressed, diff --git a/src/events/keyevent.h b/src/events/keyevent.h index 6ca3d87d8..360d229d7 100644 --- a/src/events/keyevent.h +++ b/src/events/keyevent.h @@ -69,10 +69,7 @@ #include -namespace gcn -{ - class Widget; -} +class Widget; /** * Represents a key event. @@ -102,7 +99,7 @@ class KeyEvent: public InputGuiEvent * false otherwise. * @param key The key of the event. */ - KeyEvent(gcn::Widget *const source, + KeyEvent(Widget *const source, const bool shiftPressed, const bool controlPressed, const bool altPressed, diff --git a/src/events/mouseevent.h b/src/events/mouseevent.h index fc8088341..a717980f9 100644 --- a/src/events/mouseevent.h +++ b/src/events/mouseevent.h @@ -69,9 +69,10 @@ namespace gcn { class Gui; - class Widget; } +class Widget; + /** * Represents a mouse event. * @@ -96,7 +97,7 @@ class MouseEvent: public InputGuiEvent * @param clickCount The number of clicks generated with the same button. * It's set to zero if another button is used. */ - MouseEvent(gcn::Widget *const source, + MouseEvent(Widget *const source, const bool shiftPressed, const bool controlPressed, const bool altPressed, diff --git a/src/events/selectionevent.h b/src/events/selectionevent.h index b2e91e04f..927b66f77 100644 --- a/src/events/selectionevent.h +++ b/src/events/selectionevent.h @@ -68,10 +68,7 @@ #include "localconsts.h" -namespace gcn -{ - class Widget; -} +class Widget; /** * Represents a selection event. @@ -87,7 +84,7 @@ class SelectionEvent final: public Event * * @param source source The widget of the selection event. */ - explicit SelectionEvent(gcn::Widget *const source) : + explicit SelectionEvent(Widget *const source) : Event(source) { } diff --git a/src/gui/base/basiccontainer.hpp b/src/gui/base/basiccontainer.hpp index fd28ef7b6..6d30db100 100644 --- a/src/gui/base/basiccontainer.hpp +++ b/src/gui/base/basiccontainer.hpp @@ -66,7 +66,7 @@ #include -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include "listeners/deathlistener.h" diff --git a/src/gui/base/gui.cpp b/src/gui/base/gui.cpp index d5b23e960..8985ec062 100644 --- a/src/gui/base/gui.cpp +++ b/src/gui/base/gui.cpp @@ -67,7 +67,7 @@ #include "gui/base/gui.hpp" -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include "gui/focushandler.h" diff --git a/src/gui/base/gui.hpp b/src/gui/base/gui.hpp index 8c4ac4db0..4ea923400 100644 --- a/src/gui/base/gui.hpp +++ b/src/gui/base/gui.hpp @@ -76,11 +76,10 @@ class KeyEvent; class KeyListener; class MouseInput; class SDLInput; +class Widget; namespace gcn { - class Widget; - // The following comment will appear in the doxygen main page. /** * @mainpage diff --git a/src/gui/base/widget.cpp b/src/gui/base/widget.cpp deleted file mode 100644 index 692ea479c..000000000 --- a/src/gui/base/widget.cpp +++ /dev/null @@ -1,679 +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/widget.hpp" - -#include "events/actionevent.h" - -#include "events/event.h" - -#include "gui/focushandler.h" - -#include "listeners/actionlistener.h" -#include "listeners/deathlistener.h" -#include "listeners/widgetlistener.h" - -#include "render/graphics.h" - -#include "debug.h" - -namespace gcn -{ - Font* Widget::mGlobalFont = nullptr; - std::list Widget::mWidgets; - std::set Widget::mWidgetsSet; - - Widget::Widget(const Widget2 *const widget) : - Widget2(widget), - mMouseListeners(), - mKeyListeners(), - mActionListeners(), - mDeathListeners(), - mFocusListeners(), - mWidgetListeners(), - mForegroundColor(0x000000), - mBackgroundColor(0xffffff), - mBaseColor(0x808090), - mSelectionColor(0xc3d9ff), - mFocusHandler(nullptr), - mInternalFocusHandler(nullptr), - mParent(nullptr), - mDimension(), - mFrameSize(0), - mActionEventId(), - mFocusable(false), - mVisible(true), - mTabIn(true), - mTabOut(true), - mEnabled(true), - mId(), - mCurrentFont(nullptr) - { - mWidgets.push_back(this); - mWidgetsSet.insert(this); - } - - Widget::~Widget() - { - for (DeathListenerIterator iter = mDeathListeners.begin(); - iter != mDeathListeners.end(); - ++iter) - { - Event event(this); - (*iter)->death(event); - } - - _setFocusHandler(nullptr); - - mWidgets.remove(this); - mWidgetsSet.erase(this); - } - - void Widget::drawFrame(Graphics* graphics) - { - BLOCK_START("Widget::drawFrame") - const Color &faceColor = getBaseColor(); - Color highlightColor = faceColor + Color(0x303030); - Color shadowColor = faceColor - Color(0x303030); - const int alpha = getBaseColor().a; - const int width = getWidth() + getFrameSize() * 2 - 1; - const int height = getHeight() + getFrameSize() * 2 - 1; - highlightColor.a = alpha; - shadowColor.a = alpha; - - for (unsigned int i = 0; i < getFrameSize(); ++i) - { - graphics->setColor(shadowColor); - graphics->drawLine(i, i, width - i, i); - graphics->drawLine(i, i + 1, i, height - i - 1); - graphics->setColor(highlightColor); - graphics->drawLine(width - i, i + 1, width - i, height - i); - graphics->drawLine(i, height - i, width - i - 1, height - i); - } - BLOCK_END("Widget::drawFrame") - } - - void Widget::_setParent(Widget* parent) - { - mParent = parent; - } - - void Widget::setWidth(int width) - { - Rectangle newDimension = mDimension; - newDimension.width = width; - - setDimension(newDimension); - } - - void Widget::setHeight(int height) - { - Rectangle newDimension = mDimension; - newDimension.height = height; - - setDimension(newDimension); - } - - void Widget::setX(int x) - { - Rectangle newDimension = mDimension; - newDimension.x = x; - - setDimension(newDimension); - } - - void Widget::setY(int y) - { - Rectangle newDimension = mDimension; - newDimension.y = y; - - setDimension(newDimension); - } - - void Widget::setPosition(int x, int y) - { - Rectangle newDimension = mDimension; - newDimension.x = x; - newDimension.y = y; - - setDimension(newDimension); - } - - void Widget::setDimension(const Rectangle& dimension) - { - const Rectangle oldDimension = mDimension; - mDimension = dimension; - - if (mDimension.width != oldDimension.width - || mDimension.height != oldDimension.height) - { - distributeResizedEvent(); - } - - if (mDimension.x != oldDimension.x - || mDimension.y != oldDimension.y) - { - distributeMovedEvent(); - } - } - - void Widget::setFrameSize(unsigned int frameSize) - { - mFrameSize = frameSize; - } - - unsigned int Widget::getFrameSize() const - { - return mFrameSize; - } - - const Rectangle& Widget::getDimension() const - { - return mDimension; - } - - const std::string& Widget::getActionEventId() const - { - return mActionEventId; - } - - void Widget::setActionEventId(const std::string& actionEventId) - { - mActionEventId = actionEventId; - } - - bool Widget::isFocused() const - { - if (!mFocusHandler) - return false; - - return (mFocusHandler->isFocused(this)); - } - - void Widget::setFocusable(bool focusable) - { - if (!focusable && isFocused()) - { - mFocusHandler->focusNone(); - } - - mFocusable = focusable; - } - - bool Widget::isFocusable() const - { - return mFocusable && isVisible() && isEnabled(); - } - - void Widget::requestFocus() - { - if (!mFocusHandler) - return; - - if (isFocusable()) - mFocusHandler->requestFocus(this); - } - - void Widget::requestMoveToTop() - { - if (mParent) - mParent->moveToTop(this); - } - - void Widget::requestMoveToBottom() - { - if (mParent) - mParent->moveToBottom(this); - } - - void Widget::setVisible(bool visible) - { - if (!visible && isFocused()) - mFocusHandler->focusNone(); - - if (visible) - distributeShownEvent(); - else - distributeHiddenEvent(); - - mVisible = visible; - } - - void Widget::setBaseColor(const Color& color) - { - mBaseColor = color; - } - - const Color& Widget::getBaseColor() const - { - return mBaseColor; - } - - void Widget::setForegroundColor(const Color& color) - { - mForegroundColor = color; - } - - const Color& Widget::getForegroundColor() const - { - return mForegroundColor; - } - - void Widget::setBackgroundColor(const Color& color) - { - mBackgroundColor = color; - } - - const Color& Widget::getBackgroundColor() const - { - return mBackgroundColor; - } - - void Widget::setSelectionColor(const Color& color) - { - mSelectionColor = color; - } - - const Color& Widget::getSelectionColor() const - { - return mSelectionColor; - } - - void Widget::_setFocusHandler(FocusHandler* focusHandler) - { - if (mFocusHandler) - { - releaseModalFocus(); - mFocusHandler->remove(this); - } - - if (focusHandler) - focusHandler->add(this); - - mFocusHandler = focusHandler; - } - - FocusHandler* Widget::_getFocusHandler() - { - return mFocusHandler; - } - - void Widget::addActionListener(ActionListener* actionListener) - { - mActionListeners.push_back(actionListener); - } - - void Widget::removeActionListener(ActionListener* actionListener) - { - mActionListeners.remove(actionListener); - } - - void Widget::addDeathListener(DeathListener* deathListener) - { - mDeathListeners.push_back(deathListener); - } - - void Widget::removeDeathListener(DeathListener* deathListener) - { - mDeathListeners.remove(deathListener); - } - - void Widget::addKeyListener(KeyListener* keyListener) - { - mKeyListeners.push_back(keyListener); - } - - void Widget::removeKeyListener(KeyListener* keyListener) - { - mKeyListeners.remove(keyListener); - } - - void Widget::addFocusListener(FocusListener* focusListener) - { - mFocusListeners.push_back(focusListener); - } - - void Widget::removeFocusListener(FocusListener* focusListener) - { - mFocusListeners.remove(focusListener); - } - - void Widget::addMouseListener(MouseListener* mouseListener) - { - mMouseListeners.push_back(mouseListener); - } - - void Widget::removeMouseListener(MouseListener* mouseListener) - { - mMouseListeners.remove(mouseListener); - } - - void Widget::addWidgetListener(WidgetListener* widgetListener) - { - mWidgetListeners.push_back(widgetListener); - } - - void Widget::removeWidgetListener(WidgetListener* widgetListener) - { - mWidgetListeners.remove(widgetListener); - } - - void Widget::getAbsolutePosition(int& x, int& y) const - { - if (!mParent) - { - x = mDimension.x; - y = mDimension.y; - return; - } - - int parentX; - int parentY; - - mParent->getAbsolutePosition(parentX, parentY); - - const Rectangle &rect = mParent->getChildrenArea(); - x = parentX + mDimension.x + rect.x; - y = parentY + mDimension.y + rect.y; - } - - Font* Widget::getFont() const - { - if (!mCurrentFont) - return mGlobalFont; - return mCurrentFont; - } - - void Widget::setGlobalFont(Font* font) - { - mGlobalFont = font; - - for (std::list::const_iterator iter = mWidgets.begin(); - iter != mWidgets.end(); ++iter) - { - if (!(*iter)->mCurrentFont) - (*iter)->fontChanged(); - } - } - - void Widget::setFont(Font* font) - { - mCurrentFont = font; - fontChanged(); - } - - bool Widget::widgetExists(const Widget* widget) - { - return mWidgetsSet.find(const_cast(widget)) - != mWidgetsSet.end(); - } - - bool Widget::isTabInEnabled() const - { - return mTabIn; - } - - void Widget::setTabInEnabled(bool enabled) - { - mTabIn = enabled; - } - - bool Widget::isTabOutEnabled() const - { - return mTabOut; - } - - void Widget::setTabOutEnabled(bool enabled) - { - mTabOut = enabled; - } - - void Widget::setSize(int width, int height) - { - Rectangle newDimension = mDimension; - newDimension.width = width; - newDimension.height = height; - - setDimension(newDimension); - } - - void Widget::setEnabled(bool enabled) - { - mEnabled = enabled; - } - - bool Widget::isEnabled() const - { - return mEnabled && isVisible(); - } - - void Widget::requestModalFocus() - { - if (!mFocusHandler) - return; - - mFocusHandler->requestModalFocus(this); - } - - void Widget::requestModalMouseInputFocus() - { - if (!mFocusHandler) - return; - - mFocusHandler->requestModalMouseInputFocus(this); - } - - void Widget::releaseModalFocus() - { - if (!mFocusHandler) - return; - - mFocusHandler->releaseModalFocus(this); - } - - void Widget::releaseModalMouseInputFocus() - { - if (!mFocusHandler) - return; - - mFocusHandler->releaseModalMouseInputFocus(this); - } - - bool Widget::isModalFocused() const - { - if (!mFocusHandler) - return false; - - if (mParent) - { - return (mFocusHandler->getModalFocused() == this) - || mParent->isModalFocused(); - } - - return mFocusHandler->getModalFocused() == this; - } - - bool Widget::isModalMouseInputFocused() const - { - if (!mFocusHandler) - return false; - - if (mParent) - { - return (mFocusHandler->getModalMouseInputFocused() == this) - || mParent->isModalMouseInputFocused(); - } - - return mFocusHandler->getModalMouseInputFocused() == this; - } - - Widget *Widget::getWidgetAt(int x A_UNUSED, int y A_UNUSED) - { - return nullptr; - } - - const std::list& Widget::_getMouseListeners() - { - return mMouseListeners; - } - - const std::list& Widget::_getKeyListeners() - { - return mKeyListeners; - } - - const std::list& Widget::_getFocusListeners() - { - return mFocusListeners; - } - - Rectangle Widget::getChildrenArea() - { - return Rectangle(0, 0, 0, 0); - } - - FocusHandler* Widget::_getInternalFocusHandler() - { - return mInternalFocusHandler; - } - - void Widget::setInternalFocusHandler(FocusHandler* focusHandler) - { - mInternalFocusHandler = focusHandler; - } - - void Widget::setId(const std::string& id) - { - mId = id; - } - - const std::string& Widget::getId() - { - return mId; - } - - void Widget::distributeResizedEvent() - { - for (WidgetListenerIterator iter = mWidgetListeners.begin(); - iter != mWidgetListeners.end(); - ++ iter) - { - Event event(this); - (*iter)->widgetResized(event); - } - } - - void Widget::distributeMovedEvent() - { - for (WidgetListenerIterator iter = mWidgetListeners.begin(); - iter != mWidgetListeners.end(); - ++ iter) - { - Event event(this); - (*iter)->widgetMoved(event); - } - } - - void Widget::distributeHiddenEvent() - { - for (WidgetListenerIterator iter = mWidgetListeners.begin(); - iter != mWidgetListeners.end(); - ++ iter) - { - Event event(this); - (*iter)->widgetHidden(event); - } - } - - void Widget::distributeActionEvent() - { - for (ActionListenerIterator iter = mActionListeners.begin(); - iter != mActionListeners.end(); - ++iter) - { - ActionEvent actionEvent(this, mActionEventId); - (*iter)->action(actionEvent); - } - } - - void Widget::distributeShownEvent() - { - for (WidgetListenerIterator iter = mWidgetListeners.begin(); - iter != mWidgetListeners.end(); - ++iter) - { - Event event(this); - (*iter)->widgetShown(event); - } - } - - void Widget::showPart(Rectangle rectangle) - { - if (mParent) - mParent->showWidgetPart(this, rectangle); - } -} // namespace gcn diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp deleted file mode 100644 index a180cbd12..000000000 --- a/src/gui/base/widget.hpp +++ /dev/null @@ -1,1231 +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_WIDGET_HPP -#define GCN_WIDGET_HPP - -#include -#include -#include - -#include "gui/color.h" -#include "gui/rectangle.h" - -#include "gui/widgets/widget2.h" - -#include "localconsts.h" - -class ActionListener; -class DeathListener; -class FocusHandler; -class FocusListener; -class Font; -class Graphics; -class KeyListener; -class MouseListener; -class WidgetListener; - -namespace gcn -{ - /** - * Abstract class for widgets of Guichan. It contains basic functions - * every widget should have. - * - * NOTE: Functions begining with underscore "_" should not - * be overloaded unless you know what you are doing - * - * @author Olof Naessén - * @author Per Larsson. - * @since 0.1.0 - */ - class Widget : public Widget2 - { - public: - /** - * Constructor. Resets member variables. Noteable, a widget is not - * focusable as default, therefore, widgets that are supposed to be - * focusable should overide this default in their own constructor. - */ - explicit Widget(const Widget2 *const widget); - - A_DELETE_COPY(Widget) - - /** - * Default destructor. - */ - virtual ~Widget(); - - /** - * Draws the widget. It is called by the parent widget when it is time - * for the widget to draw itself. The graphics object is set up so - * that all drawing is relative to the widget, i.e coordinate (0,0) is - * the top left corner of the widget. It is not possible to draw - * outside of a widget's dimension. - * - * @param graphics aA graphics object to draw with. - * @since 0.1.0 - */ - virtual void draw(Graphics* graphics) = 0; - - /** - * Called when a widget is given a chance to draw a frame around itself. - * The frame is not considered a part of the widget, it only allows a frame - * to be drawn around the widget, thus a frame will never be included when - * calculating if a widget should receive events from user input. Also - * a widget's frame will never be included when calculating a widget's - * position. - * - * The size of the frame is calculated using the widget's frame size. - * If a widget has a frame size of 10 pixels than the area the drawFrame - * function can draw to will be the size of the widget with an additional - * extension of 10 pixels in each direction. - * - * An example when drawFrame is a useful function is if a widget needs - * a glow around itself. - * - * @param graphics A graphics object to draw with. - * @see setFrameSize, getFrameSize - * @since 0.8.0 - */ - virtual void drawFrame(Graphics* graphics); - - /** - * Sets the size of the widget's frame. The frame is not considered a part of - * the widget, it only allows a frame to be drawn around the widget, thus a frame - * will never be included when calculating if a widget should receive events - * from user input. Also a widget's frame will never be included when calculating - * a widget's position. - * - * A frame size of 0 means that the widget has no frame. The default frame size - * is 0. - * - * @param frameSize The size of the widget's frame. - * @see getFrameSize, drawFrame - * @since 0.8.0 - */ - void setFrameSize(unsigned int frameSize); - - /** - * Gets the size of the widget's frame. The frame is not considered a part of - * the widget, it only allows a frame to be drawn around the widget, thus a frame - * will never be included when calculating if a widget should receive events - * from user input. Also a widget's frame will never be included when calculating - * a widget's position. - * - * A frame size of 0 means that the widget has no frame. The default frame size - * is 0. - * - * @return The size of the widget's frame. - * @see setFrameSize, drawFrame - * @since 0.8.0 - */ - unsigned int getFrameSize() const A_WARN_UNUSED; - - /** - * Called for all widgets in the gui each time Gui::logic is called. - * You can do logic stuff here like playing an animation. - * - * @see Gui::logic - * @since 0.1.0 - */ - virtual void logic() - { } - - /** - * Gets the widget's parent container. - * - * @return The widget's parent container. NULL if the widget - * has no parent. - * @since 0.1.0 - */ - virtual Widget* getParent() const A_WARN_UNUSED - { return mParent; } - - /** - * Sets the width of the widget. - * - * @param width The width of the widget. - * @see getWidth, setHeight, getHeight, setSize, - * setDimension, getDimensi - * @since 0.1.0 - */ - void setWidth(int width); - - /** - * Gets the width of the widget. - * - * @return The width of the widget. - * @see setWidth, setHeight, getHeight, setSize, - * setDimension, getDimension - * @since 0.1.0 - */ - int getWidth() const A_WARN_UNUSED - { return mDimension.width; } - - /** - * Sets the height of the widget. - * - * @param height The height of the widget. - * @see getHeight, setWidth, getWidth, setSize, - * setDimension, getDimension - * @since 0.1.0 - */ - void setHeight(int height); - - /** - * Gets the height of the widget. - * - * @return The height of the widget. - * @see setHeight, setWidth, getWidth, setSize, - * setDimension, getDimension - * @since 0.1.0 - */ - int getHeight() const A_WARN_UNUSED - { return mDimension.height; } - - /** - * Sets the size of the widget. - * - * @param width The width of the widget. - * @param height The height of the widget. - * @see setWidth, setHeight, getWidth, getHeight, - * setDimension, getDimension - * @since 0.1.0 - */ - void setSize(int width, int height); - - /** - * Sets the x coordinate of the widget. The coordinate is - * relateive to the widget's parent. - * - * @param x The x coordinate of the widget. - * @see getX, setY, getY, setPosition, setDimension, getDimension - * @since 0.1.0 - */ - void setX(int x); - - /** - * Gets the x coordinate of the widget. The coordinate is - * relative to the widget's parent. - * - * @return The x coordinate of the widget. - * @see setX, setY, getY, setPosition, setDimension, getDimension - * @since 0.1.0 - */ - int getX() const A_WARN_UNUSED - { return mDimension.x; } - - /** - * Sets the y coordinate of the widget. The coordinate is - * relative to the widget's parent. - * - * @param y The y coordinate of the widget. - * @see setY, setX, getX, setPosition, setDimension, getDimension - * @since 0.1.0 - */ - void setY(int y); - - /** - * Gets the y coordinate of the widget. The coordinate is - * relative to the widget's parent. - * - * @return The y coordinate of the widget. - * @see setY, setX, getX, setPosition, setDimension, getDimension - * @since 0.1.0 - */ - int getY() const A_WARN_UNUSED - { return mDimension.y; } - - /** - * Sets position of the widget. The position is relative - * to the widget's parent. - * - * @param x The x coordinate of the widget. - * @param y The y coordinate of the widget. - * @see setX, getX, setY, getY, setDimension, getDimension - * @since 0.1.0 - */ - void setPosition(int x, int y); - - /** - * Sets the dimension of the widget. The dimension is - * relative to the widget's parent. - * - * @param dimension The dimension of the widget. - * @see getDimension, setX, getX, setY, getY, setPosition - * @since 0.1.0 - */ - void setDimension(const Rectangle& dimension); - - /** - * Gets the dimension of the widget. The dimension is - * relative to the widget's parent. - * - * @return The dimension of the widget. - * @see getDimension, setX, getX, setY, getY, setPosition - * @since 0.1.0 - */ - const Rectangle& getDimension() const A_WARN_UNUSED; - - /** - * Sets the widget to be fosusable, or not. - * - * @param focusable True if the widget should be focusable, - * false otherwise. - * @see isFocusable - * @since 0.1.0 - */ - void setFocusable(bool focusable); - - /** - * Checks if a widget is focsable. - * - * @return True if the widget should be focusable, false otherwise. - * @see setFocusable - * @since 0.1.0 - */ - bool isFocusable() const A_WARN_UNUSED; - - /** - * Checks if the widget is focused. - * - * @return True if the widget is focused, false otherwise. - * @since 0.1.0 - */ - virtual bool isFocused() const A_WARN_UNUSED; - - /** - * Sets the widget to enabled, or not. A disabled - * widget will never recieve mouse or key events. - * - * @param enabled True if widget should be enabled, - * false otherwise. - * @see isEnabled - * @since 0.1.0 - */ - void setEnabled(bool enabled); - - /** - * Checks if the widget is enabled. A disabled - * widget will never recieve mouse or key events. - * - * @return True if widget is enabled, false otherwise. - * @see setEnabled - * @since 0.1.0 - */ - bool isEnabled() const A_WARN_UNUSED; - - /** - * Sets the widget to be visible, or not. - * - * @param visible True if widget should be visible, false otherwise. - * @see isVisible - * @since 0.1.0 - */ - void setVisible(bool visible); - - /** - * Checks if the widget is visible. - * - * @return True if widget is be visible, false otherwise. - * @see setVisible - * @since 0.1.0 - */ - bool isVisible() const A_WARN_UNUSED - { return mVisible && (!mParent || mParent->isVisible()); } - - /** - * Sets the base color of the widget. - * - * @param color The baseground color. - * @see getBaseColor - * @since 0.1.0 - */ - void setBaseColor(const Color& color); - - /** - * Gets the base color. - * - * @return The base color. - * @see setBaseColor - * @since 0.1.0 - */ - const Color& getBaseColor() const A_WARN_UNUSED; - - /** - * Sets the foreground color. - * - * @param color The foreground color. - * @see getForegroundColor - * @since 0.1.0 - */ - void setForegroundColor(const Color& color); - - /** - * Gets the foreground color. - * - * @see setForegroundColor - * @since 0.1.0 - */ - const Color& getForegroundColor() const A_WARN_UNUSED; - - /** - * Sets the background color. - * - * @param color The background Color. - * @see setBackgroundColor - * @since 0.1.0 - */ - void setBackgroundColor(const Color& color); - - /** - * Gets the background color. - * - * @see setBackgroundColor - * @since 0.1.0 - */ - const Color& getBackgroundColor() const A_WARN_UNUSED; - - /** - * Sets the selection color. - * - * @param color The selection color. - * @see getSelectionColor - * @since 0.6.0 - */ - void setSelectionColor(const Color& color); - - /** - * Gets the selection color. - * - * @return The selection color. - * @see setSelectionColor - * @since 0.6.0 - */ - const Color& getSelectionColor() const A_WARN_UNUSED; - - /** - * Requests focus for the widget. A widget will only recieve focus - * if it is focusable. - */ - virtual void requestFocus(); - - /** - * Requests a move to the top in the parent widget. - */ - virtual void requestMoveToTop(); - - /** - * Requests a move to the bottom in the parent widget. - */ - virtual void requestMoveToBottom(); - - /** - * Sets the focus handler to be used. - * - * WARNING: This function is used internally and should not - * be called or overloaded unless you know what you - * are doing. - * - * @param focusHandler The focus handler to use. - * @see _getFocusHandler - * @since 0.1.0 - */ - virtual void _setFocusHandler(FocusHandler* focusHandler); - - /** - * Gets the focus handler used. - * - * WARNING: This function is used internally and should not - * be called or overloaded unless you know what you - * are doing. - * - * @return The focus handler used. - * @see _setFocusHandler - * @since 0.1.0 - */ - virtual FocusHandler* _getFocusHandler() A_WARN_UNUSED; - - /** - * Adds an action listener to the widget. When an action event - * is fired by the widget the action listeners of the widget - * will get notified. - * - * @param actionListener The action listener to add. - * @see removeActionListener - * @since 0.1.0 - */ - void addActionListener(ActionListener* actionListener); - - /** - * Removes an added action listener from the widget. - * - * @param actionListener The action listener to remove. - * @see addActionListener - * @since 0.1.0 - */ - void removeActionListener(ActionListener* actionListener); - - /** - * Adds a death listener to the widget. When a death event is - * fired by the widget the death listeners of the widget will - * get notified. - * - * @param deathListener The death listener to add. - * @see removeDeathListener - * @since 0.1.0 - */ - void addDeathListener(DeathListener* deathListener); - - /** - * Removes an added death listener from the widget. - * - * @param deathListener The death listener to remove. - * @see addDeathListener - * @since 0.1.0 - */ - void removeDeathListener(DeathListener* deathListener); - - /** - * Adds a mouse listener to the widget. When a mouse event is - * fired by the widget the mouse listeners of the widget will - * get notified. - * - * @param mouseListener The mouse listener to add. - * @see removeMouseListener - * @since 0.1.0 - */ - void addMouseListener(MouseListener* mouseListener); - - /** - * Removes an added mouse listener from the widget. - * - * @param mouseListener The mouse listener to remove. - * @see addMouseListener - * @since 0.1.0 - */ - void removeMouseListener(MouseListener* mouseListener); - - /** - * Adds a key listener to the widget. When a key event is - * fired by the widget the key listeners of the widget will - * get notified. - * - * @param keyListener The key listener to add. - * @see removeKeyListener - * @since 0.1.0 - */ - void addKeyListener(KeyListener* keyListener); - - /** - * Removes an added key listener from the widget. - * - * @param keyListener The key listener to remove. - * @see addKeyListener - * @since 0.1.0 - */ - void removeKeyListener(KeyListener* keyListener); - - /** - * Adds a focus listener to the widget. When a focus event is - * fired by the widget the key listeners of the widget will - * get notified. - * - * @param focusListener The focus listener to add. - * @see removeFocusListener - * @since 0.7.0 - */ - void addFocusListener(FocusListener* focusListener); - - /** - * Removes an added focus listener from the widget. - * - * @param focusListener The focus listener to remove. - * @see addFocusListener - * @since 0.7.0 - */ - void removeFocusListener(FocusListener* focusListener); - - /** - * Adds a widget listener to the widget. When a widget event is - * fired by the widget the key listeners of the widget will - * get notified. - * - * @param widgetListener The widget listener to add. - * @see removeWidgetListener - * @since 0.8.0 - */ - void addWidgetListener(WidgetListener* widgetListener); - - /** - * Removes an added widget listener from the widget. - * - * @param widgetListener The widget listener to remove. - * @see addWidgetListener - * @since 0.8.0 - */ - void removeWidgetListener(WidgetListener* widgetListener); - - /** - * Sets the action event identifier of the widget. The identifier is - * used to be able to identify which action has occured. - * - * NOTE: An action event identifier should not be used to identify a - * certain widget but rather a certain event in your application. - * Several widgets can have the same action event identifer. - * - * @param actionEventId The action event identifier. - * @see getActionEventId - * @since 0.6.0 - */ - void setActionEventId(const std::string& actionEventId); - - /** - * Gets the action event identifier of the widget. - * - * @return The action event identifier of the widget. - * @see setActionEventId - * @since 0.6.0 - */ - const std::string& getActionEventId() const; - - /** - * Gets the absolute position on the screen for the widget. - * - * @param x The absolute x coordinate will be stored in this parameter. - * @param y The absolute y coordinate will be stored in this parameter. - * @since 0.1.0 - */ - virtual void getAbsolutePosition(int& x, int& y) const; - - /** - * Sets the parent of the widget. A parent must be a BasicContainer. - * - * WARNING: This function is used internally and should not - * be called or overloaded unless you know what you - * are doing. - * - * @param parent The parent of the widget. - * @see getParent - * @since 0.1.0 - */ - virtual void _setParent(Widget* parent); - - /** - * Gets the font set for the widget. If no font has been set, - * the global font will be returned. If no global font has been set, - * the default font will be returend. - * - * @return The font set for the widget. - * @see setFont, setGlobalFont - * @since 0.1.0 - */ - Font *getFont() const A_WARN_UNUSED; - - /** - * Sets the global font to be used by default for all widgets. - * - * @param font The global font. - * @see getGlobalFont - * @since 0.1.0 - */ - static void setGlobalFont(Font* font); - - /** - * Sets the font for the widget. If NULL is passed, the global font - * will be used. - * - * @param font The font to set for the widget. - * @see getFont - * @since 0.1.0 - */ - void setFont(Font* font); - - /** - * Called when the font has changed. If the change is global, - * this function will only be called if the widget doesn't have a - * font already set. - * - * @since 0.1.0 - */ - virtual void fontChanged() - { } - - /** - * Checks if a widget exists or not, that is if it still exists - * an instance of the object. - * - * @param widget The widget to check. - * @return True if an instance of the widget exists, false otherwise. - * @since 0.1.0 - */ - static bool widgetExists(const Widget* widget) A_WARN_UNUSED; - - /** - * Checks if tab in is enabled. Tab in means that you can set focus - * to this widget by pressing the tab button. If tab in is disabled - * then the focus handler will skip this widget and focus the next - * in its focus order. - * - * @return True if tab in is enabled, false otherwise. - * @see setTabInEnabled - * @since 0.1.0 - */ - bool isTabInEnabled() const A_WARN_UNUSED; - - /** - * Sets tab in enabled, or not. Tab in means that you can set focus - * to this widget by pressing the tab button. If tab in is disabled - * then the FocusHandler will skip this widget and focus the next - * in its focus order. - * - * @param enabled True if tab in should be enabled, false otherwise. - * @see isTabInEnabled - * @since 0.1.0 - */ - void setTabInEnabled(bool enabled); - - /** - * Checks if tab out is enabled. Tab out means that you can lose - * focus to this widget by pressing the tab button. If tab out is - * disabled then the FocusHandler ignores tabbing and focus will - * stay with this widget. - * - * @return True if tab out is enabled, false otherwise. - * @see setTabOutEnabled - * @since 0.1.0 - */ - bool isTabOutEnabled() const A_WARN_UNUSED; - - /** - * Sets tab out enabled. Tab out means that you can lose - * focus to this widget by pressing the tab button. If tab out is - * disabled then the FocusHandler ignores tabbing and focus will - * stay with this widget. - * - * @param enabled True if tab out should be enabled, false otherwise. - * @see isTabOutEnabled - * @since 0.1.0 - */ - void setTabOutEnabled(bool enabled); - - /** - * Requests modal focus. When a widget has modal focus, only that - * widget and it's children may recieve input. - * - * @throws Exception if another widget already has modal focus. - * @see releaseModalFocus, isModalFocused - * @since 0.4.0 - */ - virtual void requestModalFocus(); - - /** - * Requests modal mouse input focus. When a widget has modal input focus - * that widget will be the only widget receiving input even if the input - * occurs outside of the widget and no matter what the input is. - * - * @throws Exception if another widget already has modal focus. - * @see releaseModalMouseInputFocus, isModalMouseInputFocused - * @since 0.6.0 - */ - virtual void requestModalMouseInputFocus(); - - /** - * Releases modal focus. Modal focus will only be released if the - * widget has modal focus. - * - * @see requestModalFocus, isModalFocused - * @since 0.4.0 - */ - virtual void releaseModalFocus(); - - /** - * Releases modal mouse input focus. Modal mouse input focus will only - * be released if the widget has modal mouse input focus. - * - * @see requestModalMouseInputFocus, isModalMouseInputFocused - * @since 0.6.0 - */ - virtual void releaseModalMouseInputFocus(); - - /** - * Checks if the widget or it's parent has modal focus. - * - * @return True if the widget has modal focus, false otherwise. - * @see requestModalFocus, releaseModalFocus - * @since 0.8.0 - */ - virtual bool isModalFocused() const A_WARN_UNUSED; - - /** - * Checks if the widget or it's parent has modal mouse input focus. - * - * @return True if the widget has modal mouse input focus, false - * otherwise. - * @see requestModalMouseInputFocus, releaseModalMouseInputFocus - * @since 0.8.0 - */ - virtual bool isModalMouseInputFocused() const A_WARN_UNUSED; - - /** - * Gets a widget from a certain position in the widget. - * This function is used to decide which gets mouse input, - * thus it can be overloaded to change that behaviour. - * - * NOTE: This always returns NULL if the widget is not - * a container. - * - * @param x The x coordinate of the widget to get. - * @param y The y coordinate of the widget to get. - * @return The widget at the specified coodinate, NULL - * if no widget is found. - * @since 0.6.0 - */ - virtual Widget *getWidgetAt(int x, int y) A_WARN_UNUSED; - - /** - * Gets the mouse listeners of the widget. - * - * @return The mouse listeners of the widget. - * @since 0.6.0 - */ - virtual const std::list& _getMouseListeners() - A_WARN_UNUSED; - - /** - * Gets the key listeners of the widget. - * - * @return The key listeners of the widget. - * @since 0.6.0 - */ - virtual const std::list& _getKeyListeners() - A_WARN_UNUSED; - - /** - * Gets the focus listeners of the widget. - * - * @return The focus listeners of the widget. - * @since 0.7.0 - */ - virtual const std::list& _getFocusListeners() - A_WARN_UNUSED; - - /** - * Gets the area of the widget occupied by the widget's children. - * By default this method returns an empty rectangle as not all - * widgets are containers. If you want to make a container this - * method should return the area where the children resides. This - * method is used when drawing children of a widget when computing - * clip rectangles for the children. - * - * An example of a widget that overloads this method is ScrollArea. - * A ScrollArea has a view of its contant and that view is the - * children area. The size of a ScrollArea's children area might - * vary depending on if the scroll bars of the ScrollArea is shown - * or not. - * - * @return The area of the widget occupied by the widget's children. - * @see BasicContainer - * @see BasicContainer::getChildrenArea - * @see BasicContainer::drawChildren - * @since 0.1.0 - */ - virtual Rectangle getChildrenArea() A_WARN_UNUSED; - - /** - * Gets the internal focus handler used. - * - * @return the internalFocusHandler used. If no internal focus handler - * is used, NULL will be returned. - * @see setInternalFocusHandler - * @since 0.1.0 - */ - virtual FocusHandler* _getInternalFocusHandler() A_WARN_UNUSED; - - /** - * Sets the internal focus handler. An internal focus handler is - * needed if both a widget in the widget and the widget itself - * should be foucsed at the same time. - * - * @param focusHandler The internal focus handler to be used. - * @see getInternalFocusHandler - * @since 0.1.0 - */ - void setInternalFocusHandler(FocusHandler* internalFocusHandler); - - /** - * Moves a widget to the top of this widget. The moved widget will be - * drawn above all other widgets in this widget. - * - * @param widget The widget to move to the top. - * @see moveToBottom - * @since 0.1.0 - */ - virtual void moveToTop(Widget* widget A_UNUSED) - { } - - /** - * Moves a widget in this widget to the bottom of this widget. - * The moved widget will be drawn below all other widgets in this widget. - * - * @param widget The widget to move to the bottom. - * @see moveToTop - * @since 0.1.0 - */ - virtual void moveToBottom(Widget* widget A_UNUSED) - { } - - /** - * Focuses the next widget in the widget. - * - * @see moveToBottom - * @since 0.1.0 - */ - virtual void focusNext() - { } - - /** - * Focuses the previous widget in the widget. - * - * @see moveToBottom - * @since 0.1.0 - */ - virtual void focusPrevious() - { } - - /** - * Tries to show a specific part of a widget by moving it. Used if the - * widget should act as a container. - * - * @param widget The target widget. - * @param area The area to show. - * @since 0.1.0 - */ - virtual void showWidgetPart(Widget* widget A_UNUSED, - Rectangle area A_UNUSED) - { } - - /** - * Sets an id of a widget. An id can be useful if a widget needs to be - * identified in a container. For example, if widgets are created by an - * XML document, a certain widget can be retrieved given that the widget - * has an id. - * - * @param id The id to set to the widget. - * @see getId, BasicContainer::findWidgetById - * @since 0.8.0 - */ - void setId(const std::string& id); - - /** - * Gets the id of a widget. An id can be useful if a widget needs to be - * identified in a container. For example, if widgets are created by an - * XML document, a certain widget can be retrieved given that the widget - * has an id. - * - * @param id The id to set to the widget. - * @see setId, BasicContainer::findWidgetById - * @since 0.8.0 - */ - const std::string& getId() A_WARN_UNUSED; - - /** - * Shows a certain part of a widget in the widget's parent. - * Used when widgets want a specific part to be visible in - * its parent. An example is a TextArea that wants a specific - * part of its text to be visible when a TextArea is a child - * of a ScrollArea. - * - * @param rectangle The rectangle to be shown. - * @since 0.8.0 - */ - virtual void showPart(Rectangle rectangle); - - protected: - /** - * Distributes an action event to all action listeners - * of the widget. - * - * @since 0.8.0 - */ - void distributeActionEvent(); - - /** - * Distributes resized events to all of the widget's listeners. - * - * @since 0.8.0 - */ - void distributeResizedEvent(); - - /** - * Distributes moved events to all of the widget's listeners. - * - * @since 0.8.0 - */ - void distributeMovedEvent(); - - /** - * Distributes hidden events to all of the widget's listeners. - * - * @since 0.8.0 - * @author Olof Naessén - */ - void distributeHiddenEvent(); - - /** - * Distributes shown events to all of the widget's listeners. - * - * @since 0.8.0 - * @author Olof Naessén - */ - void distributeShownEvent(); - - /** - * Typdef. - */ - typedef std::list MouseListenerList; - - /** - * Typdef. - */ - typedef MouseListenerList::iterator MouseListenerIterator; - - /** - * Holds the mouse listeners of the widget. - */ - MouseListenerList mMouseListeners; - - /** - * Typdef. - */ - typedef std::list KeyListenerList; - - /** - * Holds the key listeners of the widget. - */ - KeyListenerList mKeyListeners; - - /** - * Typdef. - */ - typedef KeyListenerList::iterator KeyListenerIterator; - - /** - * Typdef. - */ - typedef std::list ActionListenerList; - - /** - * Holds the action listeners of the widget. - */ - ActionListenerList mActionListeners; - - /** - * Typdef. - */ - typedef ActionListenerList::iterator ActionListenerIterator; - - /** - * Typdef. - */ - typedef std::list DeathListenerList; - - /** - * Holds the death listeners of the widget. - */ - DeathListenerList mDeathListeners; - - /** - * Typdef. - */ - typedef DeathListenerList::iterator DeathListenerIterator; - - /** - * Typdef. - */ - typedef std::list FocusListenerList; - - /** - * Holds the focus listeners of the widget. - */ - FocusListenerList mFocusListeners; - - /** - * Typdef. - */ - typedef FocusListenerList::iterator FocusListenerIterator; - - typedef std::list WidgetListenerList; - - /** - * Holds the widget listeners of the widget. - */ - WidgetListenerList mWidgetListeners; - - /** - * Typdef. - */ - typedef WidgetListenerList::iterator WidgetListenerIterator; - - /** - * Holds the foreground color of the widget. - */ - Color mForegroundColor; - - /** - * Holds the background color of the widget. - */ - Color mBackgroundColor; - - /** - * Holds the base color of the widget. - */ - Color mBaseColor; - - /** - * Holds the selection color of the widget. - */ - Color mSelectionColor; - - /** - * Holds the focus handler used by the widget. - */ - FocusHandler* mFocusHandler; - - /** - * Holds the focus handler used by the widget. NULL - * if no internal focus handler is used. - */ - FocusHandler* mInternalFocusHandler; - - /** - * Holds the parent of the widget. NULL if the widget - * has no parent. - */ - Widget* mParent; - - /** - * Holds the dimension of the widget. - */ - Rectangle mDimension; - - /** - * Holds the frame size of the widget. - */ - unsigned int mFrameSize; - - /** - * Holds the action event of the widget. - */ - std::string mActionEventId; - - /** - * True if the widget focusable, false otherwise. - */ - bool mFocusable; - - /** - * True if the widget visible, false otherwise. - */ - bool mVisible; - - /** - * True if the widget has tab in enabled, false otherwise. - */ - bool mTabIn; - - /** - * True if the widget has tab in enabled, false otherwise. - */ - bool mTabOut; - - /** - * True if the widget is enabled, false otherwise. - */ - bool mEnabled; - - /** - * Holds the id of the widget. - */ - std::string mId; - - /** - * Holds the font used by the widget. - */ - Font* mCurrentFont; - - /** - * Holds the global font used by the widget. - */ - static Font* mGlobalFont; - - /** - * Holds a list of all instances of widgets. - */ - static std::list mWidgets; - - static std::set mWidgetsSet; - }; -} // namespace gcn - -#endif // end GCN_WIDGET_HPP diff --git a/src/gui/base/widgets/button.cpp b/src/gui/base/widgets/button.cpp index 5187c625b..2d6afa672 100644 --- a/src/gui/base/widgets/button.cpp +++ b/src/gui/base/widgets/button.cpp @@ -76,7 +76,7 @@ namespace gcn { Button::Button(const Widget2 *const widget) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), FocusListener(), @@ -98,7 +98,7 @@ namespace gcn Button::Button(const Widget2 *const widget, const std::string& caption) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), FocusListener(), diff --git a/src/gui/base/widgets/button.hpp b/src/gui/base/widgets/button.hpp index fea175362..99e5db4f4 100644 --- a/src/gui/base/widgets/button.hpp +++ b/src/gui/base/widgets/button.hpp @@ -70,7 +70,7 @@ #include "listeners/keylistener.h" #include "listeners/mouselistener.h" -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include "render/graphics.h" diff --git a/src/gui/base/widgets/checkbox.cpp b/src/gui/base/widgets/checkbox.cpp index a5ec72dfa..476fb3c6b 100644 --- a/src/gui/base/widgets/checkbox.cpp +++ b/src/gui/base/widgets/checkbox.cpp @@ -73,7 +73,7 @@ namespace gcn { CheckBox::CheckBox(const Widget2 *const widget) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), mSelected(false), @@ -87,7 +87,7 @@ namespace gcn CheckBox::CheckBox(const Widget2 *const widget, const std::string &caption, bool selected) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), mSelected(selected), diff --git a/src/gui/base/widgets/checkbox.hpp b/src/gui/base/widgets/checkbox.hpp index c79ccaff9..6fcb04767 100644 --- a/src/gui/base/widgets/checkbox.hpp +++ b/src/gui/base/widgets/checkbox.hpp @@ -69,7 +69,7 @@ #include "listeners/keylistener.h" #include "listeners/mouselistener.h" -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" namespace gcn { diff --git a/src/gui/base/widgets/label.cpp b/src/gui/base/widgets/label.cpp index 84ba87d84..d2293a957 100644 --- a/src/gui/base/widgets/label.cpp +++ b/src/gui/base/widgets/label.cpp @@ -76,7 +76,7 @@ namespace gcn { Label::Label(const Widget2 *const widget) : - gcn::Widget(widget), + Widget(widget), mCaption(), mAlignment(Graphics::LEFT) { @@ -84,7 +84,7 @@ namespace gcn Label::Label(const Widget2 *const widget, const std::string& caption) : - gcn::Widget(widget), + Widget(widget), mCaption(caption), mAlignment(Graphics::LEFT) { diff --git a/src/gui/base/widgets/label.hpp b/src/gui/base/widgets/label.hpp index 399e4202a..fd0d54f8e 100644 --- a/src/gui/base/widgets/label.hpp +++ b/src/gui/base/widgets/label.hpp @@ -66,7 +66,7 @@ #include -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include "render/graphics.h" diff --git a/src/gui/base/widgets/listbox.cpp b/src/gui/base/widgets/listbox.cpp index 765878834..9aca373b9 100644 --- a/src/gui/base/widgets/listbox.cpp +++ b/src/gui/base/widgets/listbox.cpp @@ -78,7 +78,7 @@ namespace gcn { ListBox::ListBox(const Widget2 *const widget) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), mSelected(-1), @@ -95,7 +95,7 @@ namespace gcn ListBox::ListBox(const Widget2 *const widget, ListModel *listModel) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), mSelected(-1), diff --git a/src/gui/base/widgets/listbox.hpp b/src/gui/base/widgets/listbox.hpp index c46aca6ae..4046f5ddf 100644 --- a/src/gui/base/widgets/listbox.hpp +++ b/src/gui/base/widgets/listbox.hpp @@ -66,7 +66,7 @@ #include -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include "listeners/keylistener.h" #include "listeners/mouselistener.h" diff --git a/src/gui/base/widgets/radiobutton.cpp b/src/gui/base/widgets/radiobutton.cpp index e17b9f776..f9d68555a 100644 --- a/src/gui/base/widgets/radiobutton.cpp +++ b/src/gui/base/widgets/radiobutton.cpp @@ -74,7 +74,7 @@ namespace gcn RadioButton::GroupMap RadioButton::mGroupMap; RadioButton::RadioButton(const Widget2 *const widget) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), mSelected(false), @@ -92,7 +92,7 @@ namespace gcn const std::string &caption, const std::string &group, bool selected) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), mSelected(false), diff --git a/src/gui/base/widgets/radiobutton.hpp b/src/gui/base/widgets/radiobutton.hpp index f4bfd53fa..a86a4eed3 100644 --- a/src/gui/base/widgets/radiobutton.hpp +++ b/src/gui/base/widgets/radiobutton.hpp @@ -70,7 +70,7 @@ #include "listeners/keylistener.h" #include "listeners/mouselistener.h" -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" namespace gcn { diff --git a/src/gui/base/widgets/slider.cpp b/src/gui/base/widgets/slider.cpp index 4e9df0341..40c73ceb5 100644 --- a/src/gui/base/widgets/slider.cpp +++ b/src/gui/base/widgets/slider.cpp @@ -73,7 +73,7 @@ namespace gcn { Slider::Slider(const Widget2 *const widget, const double scaleEnd) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), mDragged(false), @@ -94,7 +94,7 @@ namespace gcn Slider::Slider(const Widget2 *const widget, const double scaleStart, const double scaleEnd) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), mDragged(false), diff --git a/src/gui/base/widgets/slider.hpp b/src/gui/base/widgets/slider.hpp index f29ad5950..9d5adc6d8 100644 --- a/src/gui/base/widgets/slider.hpp +++ b/src/gui/base/widgets/slider.hpp @@ -67,7 +67,7 @@ #include "listeners/keylistener.h" #include "listeners/mouselistener.h" -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" namespace gcn { diff --git a/src/gui/base/widgets/textbox.cpp b/src/gui/base/widgets/textbox.cpp index bb22a6f46..04b506c59 100644 --- a/src/gui/base/widgets/textbox.cpp +++ b/src/gui/base/widgets/textbox.cpp @@ -76,7 +76,7 @@ namespace gcn { TextBox::TextBox(const Widget2 *const widget) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), mTextRows(), @@ -95,7 +95,7 @@ namespace gcn TextBox::TextBox(const Widget2 *const widget, const std::string& text) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), mTextRows(), diff --git a/src/gui/base/widgets/textbox.hpp b/src/gui/base/widgets/textbox.hpp index 151af8c00..148b4f007 100644 --- a/src/gui/base/widgets/textbox.hpp +++ b/src/gui/base/widgets/textbox.hpp @@ -70,7 +70,7 @@ #include "listeners/keylistener.h" #include "listeners/mouselistener.h" -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" namespace gcn { diff --git a/src/gui/base/widgets/textfield.cpp b/src/gui/base/widgets/textfield.cpp index ddcbec1b4..c2cead500 100644 --- a/src/gui/base/widgets/textfield.cpp +++ b/src/gui/base/widgets/textfield.cpp @@ -74,7 +74,7 @@ namespace gcn { TextField::TextField(const Widget2 *const widget) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), mText(), @@ -89,7 +89,7 @@ namespace gcn TextField::TextField(const Widget2 *const widget, const std::string& text) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), mText(text), diff --git a/src/gui/base/widgets/textfield.hpp b/src/gui/base/widgets/textfield.hpp index aa5f210c5..e9df238ba 100644 --- a/src/gui/base/widgets/textfield.hpp +++ b/src/gui/base/widgets/textfield.hpp @@ -67,7 +67,7 @@ #include "listeners/keylistener.h" #include "listeners/mouselistener.h" -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp index 0d45b6432..928b3b72e 100644 --- a/src/gui/focushandler.cpp +++ b/src/gui/focushandler.cpp @@ -87,7 +87,7 @@ FocusHandler::FocusHandler() : { } -void FocusHandler::requestModalFocus(gcn::Widget *widget) +void FocusHandler::requestModalFocus(Widget *widget) { /* If there is another widget with modal focus, remove its modal focus * and put it on the modal widget stack. @@ -103,7 +103,7 @@ void FocusHandler::requestModalFocus(gcn::Widget *widget) focusNone(); } -void FocusHandler::releaseModalFocus(gcn::Widget *widget) +void FocusHandler::releaseModalFocus(Widget *widget) { mModalStack.remove(widget); @@ -123,7 +123,7 @@ void FocusHandler::releaseModalFocus(gcn::Widget *widget) } } -void FocusHandler::remove(gcn::Widget *widget) +void FocusHandler::remove(Widget *widget) { releaseModalFocus(widget); @@ -217,7 +217,7 @@ void FocusHandler::tabNext() if (focusedWidget == focused) return; - const gcn::Widget *const widget = mWidgets.at(focusedWidget); + const Widget *const widget = mWidgets.at(focusedWidget); if (widget->isFocusable() && widget->isTabInEnabled() && (!mModalFocusedWidget || widget->isModalFocused())) { @@ -288,7 +288,7 @@ void FocusHandler::tabPrevious() if (focusedWidget == focused) return; - const gcn::Widget *const widget = mWidgets.at(focusedWidget); + const Widget *const widget = mWidgets.at(focusedWidget); if (widget->isFocusable() && widget->isTabInEnabled() && (!mModalFocusedWidget || widget->isModalFocused())) { @@ -317,7 +317,7 @@ void FocusHandler::checkForWindow() const { if (mFocusedWidget) { - gcn::Widget *widget = mFocusedWidget->getParent(); + Widget *widget = mFocusedWidget->getParent(); while (widget) { @@ -339,7 +339,7 @@ void FocusHandler::distributeFocusGainedEvent(const Event &focusEvent) if (gui) gui->distributeGlobalFocusGainedEvent(focusEvent); - gcn::Widget *const sourceWidget = focusEvent.getSource(); + Widget *const sourceWidget = focusEvent.getSource(); std::list focusListeners = sourceWidget->_getFocusListeners(); @@ -354,7 +354,7 @@ void FocusHandler::distributeFocusGainedEvent(const Event &focusEvent) } } -void FocusHandler::requestFocus(gcn::Widget* widget) +void FocusHandler::requestFocus(Widget* widget) { if (!widget || widget == mFocusedWidget) return; @@ -373,7 +373,7 @@ void FocusHandler::requestFocus(gcn::Widget* widget) if (toBeFocusedIndex < 0) return; - gcn::Widget *const oldFocused = mFocusedWidget; + Widget *const oldFocused = mFocusedWidget; if (oldFocused != widget) { @@ -390,7 +390,7 @@ void FocusHandler::requestFocus(gcn::Widget* widget) } } -void FocusHandler::requestModalMouseInputFocus(gcn::Widget* widget) +void FocusHandler::requestModalMouseInputFocus(Widget* widget) { if (mModalMouseInputFocusedWidget && mModalMouseInputFocusedWidget != widget) @@ -401,23 +401,23 @@ void FocusHandler::requestModalMouseInputFocus(gcn::Widget* widget) mModalMouseInputFocusedWidget = widget; } -void FocusHandler::releaseModalMouseInputFocus(gcn::Widget* widget) +void FocusHandler::releaseModalMouseInputFocus(Widget* widget) { if (mModalMouseInputFocusedWidget == widget) mModalMouseInputFocusedWidget = nullptr; } -gcn::Widget* FocusHandler::getFocused() const +Widget* FocusHandler::getFocused() const { return mFocusedWidget; } -gcn::Widget* FocusHandler::getModalFocused() const +Widget* FocusHandler::getModalFocused() const { return mModalFocusedWidget; } -gcn::Widget* FocusHandler::getModalMouseInputFocused() const +Widget* FocusHandler::getModalMouseInputFocused() const { return mModalMouseInputFocusedWidget; } @@ -527,12 +527,12 @@ void FocusHandler::focusPrevious() } } -bool FocusHandler::isFocused(const gcn::Widget* widget) const +bool FocusHandler::isFocused(const Widget* widget) const { return mFocusedWidget == widget; } -void FocusHandler::add(gcn::Widget* widget) +void FocusHandler::add(Widget* widget) { mWidgets.push_back(widget); } @@ -541,7 +541,7 @@ void FocusHandler::focusNone() { if (mFocusedWidget) { - gcn::Widget *const focused = mFocusedWidget; + Widget *const focused = mFocusedWidget; mFocusedWidget = nullptr; Event focusEvent(focused); @@ -551,7 +551,7 @@ void FocusHandler::focusNone() void FocusHandler::distributeFocusLostEvent(const Event& focusEvent) { - gcn::Widget *const sourceWidget = focusEvent.getSource(); + Widget *const sourceWidget = focusEvent.getSource(); std::list focusListeners = sourceWidget->_getFocusListeners(); @@ -566,52 +566,52 @@ void FocusHandler::distributeFocusLostEvent(const Event& focusEvent) } } -gcn::Widget* FocusHandler::getDraggedWidget() +Widget* FocusHandler::getDraggedWidget() { return mDraggedWidget; } -void FocusHandler::setDraggedWidget(gcn::Widget* draggedWidget) +void FocusHandler::setDraggedWidget(Widget* draggedWidget) { mDraggedWidget = draggedWidget; } -gcn::Widget* FocusHandler::getLastWidgetWithMouse() +Widget* FocusHandler::getLastWidgetWithMouse() { return mLastWidgetWithMouse; } -void FocusHandler::setLastWidgetWithMouse(gcn::Widget* lastWidgetWithMouse) +void FocusHandler::setLastWidgetWithMouse(Widget* lastWidgetWithMouse) { mLastWidgetWithMouse = lastWidgetWithMouse; } -gcn::Widget* FocusHandler::getLastWidgetWithModalFocus() +Widget* FocusHandler::getLastWidgetWithModalFocus() { return mLastWidgetWithModalFocus; } -void FocusHandler::setLastWidgetWithModalFocus(gcn::Widget* widget) +void FocusHandler::setLastWidgetWithModalFocus(Widget* widget) { mLastWidgetWithModalFocus = widget; } -gcn::Widget* FocusHandler::getLastWidgetWithModalMouseInputFocus() +Widget* FocusHandler::getLastWidgetWithModalMouseInputFocus() { return mLastWidgetWithModalMouseInputFocus; } -void FocusHandler::setLastWidgetWithModalMouseInputFocus(gcn::Widget* widget) +void FocusHandler::setLastWidgetWithModalMouseInputFocus(Widget* widget) { mLastWidgetWithModalMouseInputFocus = widget; } -gcn::Widget* FocusHandler::getLastWidgetPressed() +Widget* FocusHandler::getLastWidgetPressed() { return mLastWidgetPressed; } -void FocusHandler::setLastWidgetPressed(gcn::Widget* lastWidgetPressed) +void FocusHandler::setLastWidgetPressed(Widget* lastWidgetPressed) { mLastWidgetPressed = lastWidgetPressed; } diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h index c8885ef2c..ed3a08e98 100644 --- a/src/gui/focushandler.h +++ b/src/gui/focushandler.h @@ -74,11 +74,7 @@ #include "localconsts.h" class Event; - -namespace gcn -{ - class Widget; -} +class Widget; /** * The focus handler. This focus handler does exactly the same as the Guichan @@ -101,7 +97,7 @@ class FocusHandler final * @param widget The widget to request focus for. * @see isFocused, Widget::requestFocus */ - void requestFocus(gcn::Widget* widget); + void requestFocus(Widget* widget); /** * Requests modal focus for a widget. Focus will only be granted @@ -112,7 +108,7 @@ class FocusHandler final * @throws Exception when another widget already has modal focus. * @see releaseModalFocus, Widget::requestModalFocus */ - void requestModalFocus(gcn::Widget* widget); + void requestModalFocus(Widget* widget); /** * Requests modal mouse input focus for a widget. Focus will only @@ -129,7 +125,7 @@ class FocusHandler final * focus. * @see releaseModalMouseInputFocus, Widget::requestModalMouseInputFocus */ - void requestModalMouseInputFocus(gcn::Widget* widget); + void requestModalMouseInputFocus(Widget* widget); /** * Releases modal focus if the widget has modal focus. @@ -138,7 +134,7 @@ class FocusHandler final * @param widget The widget to release modal focus for. * @see reuqestModalFocus, Widget::releaseModalFocus */ - void releaseModalFocus(gcn::Widget* widget); + void releaseModalFocus(Widget* widget); /** * Releases modal mouse input focus if the widget has modal mouse input @@ -148,7 +144,7 @@ class FocusHandler final * @param widget the widget to release modal mouse input focus for. * @see requestModalMouseInputFocus, Widget::releaseModalMouseInputFocus */ - void releaseModalMouseInputFocus(gcn::Widget* widget); + void releaseModalMouseInputFocus(Widget* widget); /** * Checks if a widget is focused. @@ -157,14 +153,14 @@ class FocusHandler final * @return True if the widget is focused, false otherwise. * @see Widget::isFocused */ - bool isFocused(const gcn::Widget* widget) const; + bool isFocused(const Widget* widget) const; /** * Gets the widget with focus. * * @return The widget with focus. NULL if no widget has focus. */ - gcn::Widget* getFocused() const A_WARN_UNUSED; + Widget* getFocused() const A_WARN_UNUSED; /** * Gets the widget with modal focus. @@ -172,7 +168,7 @@ class FocusHandler final * @return The widget with modal focus. NULL if no widget has * modal focus. */ - gcn::Widget* getModalFocused() const A_WARN_UNUSED; + Widget* getModalFocused() const A_WARN_UNUSED; /** * Gets the widget with modal mouse input focus. @@ -180,7 +176,7 @@ class FocusHandler final * @return The widget with modal mouse input focus. NULL if * no widget has modal mouse input focus. */ - gcn::Widget* getModalMouseInputFocused() const A_WARN_UNUSED; + Widget* getModalMouseInputFocused() const A_WARN_UNUSED; /** * Focuses the next widget added to a conainer. @@ -208,7 +204,7 @@ class FocusHandler final * @param widget The widget to add. * @see remove */ - void add(gcn::Widget* widget); + void add(Widget* widget); /** * Removes a widget from the focus handler. @@ -216,7 +212,7 @@ class FocusHandler final * @param widget The widget to remove. * @see add */ - void remove(gcn::Widget* widget); + void remove(Widget* widget); /** * Focuses nothing. A focus event will also be sent to the @@ -247,7 +243,7 @@ class FocusHandler final * @return the widget being dragged. * @see setDraggedWidget */ - gcn::Widget* getDraggedWidget() A_WARN_UNUSED; + Widget* getDraggedWidget() A_WARN_UNUSED; /** * Sets the widget being dragged. Used by the Gui class to @@ -256,7 +252,7 @@ class FocusHandler final * @param draggedWidget The widget being dragged. * @see getDraggedWidget */ - void setDraggedWidget(gcn::Widget* draggedWidget); + void setDraggedWidget(Widget* draggedWidget); /** * Gets the last widget with the mouse. Used by the Gui class @@ -265,7 +261,7 @@ class FocusHandler final * @return The last widget with the mouse. * @see setLastWidgetWithMouse */ - gcn::Widget* getLastWidgetWithMouse() A_WARN_UNUSED; + Widget* getLastWidgetWithMouse() A_WARN_UNUSED; /** * Sets the last widget with the mouse. Used by the Gui class @@ -274,7 +270,7 @@ class FocusHandler final * @param lastWidgetWithMouse The last widget with the mouse. * @see getLastWidgetWithMouse */ - void setLastWidgetWithMouse(gcn::Widget* lastWidgetWithMouse); + void setLastWidgetWithMouse(Widget* lastWidgetWithMouse); /** * Gets the last widget with modal focus. @@ -282,7 +278,7 @@ class FocusHandler final * @return The last widget with modal focus. * @see setLastWidgetWithModalFocus */ - gcn::Widget* getLastWidgetWithModalFocus() A_WARN_UNUSED; + Widget* getLastWidgetWithModalFocus() A_WARN_UNUSED; /** * Sets the last widget with modal focus. @@ -290,7 +286,7 @@ class FocusHandler final * @param widget The last widget with modal focus. * @see getLastWidgetWithModalFocus */ - void setLastWidgetWithModalFocus(gcn::Widget* widget); + void setLastWidgetWithModalFocus(Widget* widget); /** * Gets the last widget with modal mouse input focus. @@ -298,7 +294,7 @@ class FocusHandler final * @return The last widget with modal mouse input focus. * @see setLastWidgetWithModalMouseInputFocus */ - gcn::Widget* getLastWidgetWithModalMouseInputFocus() A_WARN_UNUSED; + Widget* getLastWidgetWithModalMouseInputFocus() A_WARN_UNUSED; /** * Sets the last widget with modal mouse input focus. @@ -306,7 +302,7 @@ class FocusHandler final * @param widget The last widget with modal mouse input focus. * @see getLastWidgetWithModalMouseInputFocus */ - void setLastWidgetWithModalMouseInputFocus(gcn::Widget* widget); + void setLastWidgetWithModalMouseInputFocus(Widget* widget); /** * Gets the last widget pressed. Used by the Gui class to keep track @@ -315,7 +311,7 @@ class FocusHandler final * @return The last widget pressed. * @see setLastWidgetPressed */ - gcn::Widget* getLastWidgetPressed() A_WARN_UNUSED; + Widget* getLastWidgetPressed() A_WARN_UNUSED; /** * Sets the last widget pressed. Used by the Gui class to keep track @@ -324,7 +320,7 @@ class FocusHandler final * @param lastWidgetPressed The last widget pressed. * @see getLastWidgetPressed */ - void setLastWidgetPressed(gcn::Widget* lastWidgetPressed); + void setLastWidgetPressed(Widget* lastWidgetPressed); private: /** @@ -352,7 +348,7 @@ class FocusHandler final /** * Typedef. */ - typedef std::vector WidgetVector; + typedef std::vector WidgetVector; /** * Typedef. @@ -368,50 +364,50 @@ class FocusHandler final /** * Holds the focused widget. NULL if no widget has focus. */ - gcn::Widget* mFocusedWidget; + Widget* mFocusedWidget; /** * Holds the modal focused widget. NULL if no widget has * modal focused. */ - gcn::Widget* mModalFocusedWidget; + Widget* mModalFocusedWidget; /** * Holds the modal mouse input focused widget. NULL if no widget * is being dragged. */ - gcn::Widget* mModalMouseInputFocusedWidget; + Widget* mModalMouseInputFocusedWidget; /** * Holds the dragged widget. NULL if no widget is * being dragged. */ - gcn::Widget* mDraggedWidget; + Widget* mDraggedWidget; /** * Holds the last widget with the mouse. */ - gcn::Widget* mLastWidgetWithMouse; + Widget* mLastWidgetWithMouse; /** * Holds the last widget with modal focus. */ - gcn::Widget* mLastWidgetWithModalFocus; + Widget* mLastWidgetWithModalFocus; /** * Holds the last widget with modal mouse input focus. */ - gcn::Widget* mLastWidgetWithModalMouseInputFocus; + Widget* mLastWidgetWithModalMouseInputFocus; /** * Holds the last widget pressed. */ - gcn::Widget* mLastWidgetPressed; + Widget* mLastWidgetPressed; /** * Stack of widgets that have requested modal forcus. */ - std::list mModalStack; + std::list mModalStack; }; #endif // GUI_FOCUSHANDLER_H diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index fdaa299af..07aca0c81 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -223,7 +223,7 @@ void Gui::postInit(Graphics *const graphics) mNpcFont = new Font(fontFile, npcFontSize); - gcn::Widget::setGlobalFont(mGuiFont); + Widget::setGlobalFont(mGuiFont); // Initialize mouse cursor and listen for changes to the option setUseCustomCursor(config.getBoolValue("customcursor")); @@ -538,7 +538,7 @@ void Gui::handleMousePressed(const MouseInput &mouseInput) const unsigned int button = mouseInput.getButton(); const int timeStamp = mouseInput.getTimeStamp(); - gcn::Widget *sourceWidget = getMouseEventSource(x, y); + Widget *sourceWidget = getMouseEventSource(x, y); if (mFocusHandler->getDraggedWidget()) sourceWidget = mFocusHandler->getDraggedWidget(); @@ -601,14 +601,14 @@ void Gui::updateFonts() mNpcFont->loadFont(fontFile, npcFontSize); } -void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button, +void Gui::distributeMouseEvent(Widget* source, int type, int button, int x, int y, bool force, bool toSourceOnly) { if (!source || !mFocusHandler) return; - gcn::Widget* widget = source; + Widget* widget = source; if (!force && mFocusHandler->getModalFocused() != nullptr && !widget->isModalFocused()) @@ -626,12 +626,12 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button, mAltPressed, mMetaPressed, type, button, x, y, mClickCount); - gcn::Widget* parent = source; + Widget* parent = source; while (parent) { // If the widget has been removed due to input // cancel the distribution. - if (!gcn::Widget::widgetExists(widget)) + if (!Widget::widgetExists(widget)) break; parent = widget->getParent(); @@ -691,7 +691,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button, break; } - const gcn::Widget *const swap = widget; + const Widget *const swap = widget; widget = parent; parent = swap->getParent(); @@ -740,7 +740,7 @@ MouseEvent *Gui::createMouseEvent(Window *const widget) mouseX - x, mouseY - y, mClickCount); } -void Gui::getAbsolutePosition(gcn::Widget *restrict widget, +void Gui::getAbsolutePosition(Widget *restrict widget, int &restrict x, int &restrict y) { x = 0; @@ -806,7 +806,7 @@ void Gui::handleMouseInput() void Gui::handleMouseReleased(const MouseInput &mouseInput) { - gcn::Widget *sourceWidget = getMouseEventSource( + Widget *sourceWidget = getMouseEventSource( mouseInput.getX(), mouseInput.getY()); int sourceWidgetX, sourceWidgetY; @@ -815,7 +815,7 @@ void Gui::handleMouseReleased(const MouseInput &mouseInput) if (sourceWidget != mFocusHandler->getLastWidgetPressed()) mFocusHandler->setLastWidgetPressed(nullptr); - gcn::Widget *oldWidget = sourceWidget; + Widget *oldWidget = sourceWidget; sourceWidget = mFocusHandler->getDraggedWidget(); if (oldWidget != sourceWidget) { @@ -876,7 +876,7 @@ void Gui::distributeGlobalFocusGainedEvent(const Event &focusEvent) } } -void Gui::removeDragged(gcn::Widget *widget) +void Gui::removeDragged(Widget *widget) { if (!mFocusHandler) return; diff --git a/src/gui/gui.h b/src/gui/gui.h index 232d47a22..4038bbec4 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -148,7 +148,7 @@ class Gui final : public gcn::Gui MouseEvent *createMouseEvent(Window *const widget) A_WARN_UNUSED; - static void getAbsolutePosition(gcn::Widget *restrict widget, + static void getAbsolutePosition(Widget *restrict widget, int &restrict x, int &restrict y); @@ -158,7 +158,7 @@ class Gui final : public gcn::Gui void distributeGlobalFocusGainedEvent(const Event &focusEvent); - void removeDragged(gcn::Widget *widget); + void removeDragged(Widget *widget); int getLastMouseX() const { return mLastMouseX; } @@ -177,7 +177,7 @@ class Gui final : public gcn::Gui void handleMouseInput(); - void distributeMouseEvent(gcn::Widget* source, int type, int button, + void distributeMouseEvent(Widget* source, int type, int button, int x, int y, bool force = false, bool toSourceOnly = false); diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 4300f4ea8..46b6ea20f 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -103,7 +103,7 @@ void AvatarListBox::draw(Graphics *graphics) Font *const font = getFont(); const int fontHeight = getFont()->getHeight(); - const gcn::Widget *const parent = mParent; + const Widget *const parent = mParent; const std::string name = player_node->getName(); // Draw the list elements diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 6e506eeeb..cfc26da0e 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -52,7 +52,7 @@ BrowserBox::BrowserBox(const Widget2 *const widget, const unsigned int mode, const bool opaque, const std::string &skin) : - gcn::Widget(widget), + Widget(widget), MouseListener(), mTextRows(), mTextRowLinksCount(), diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index a33c69698..8202fa548 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -25,7 +25,8 @@ #define GUI_WIDGETS_BROWSERBOX_H #include "listeners/mouselistener.h" -#include "gui/base/widget.hpp" + +#include "gui/widgets/widget.h" #include #include @@ -100,7 +101,7 @@ class LinePart final * A simple browser box able to handle links and forward events to the * parent conteiner. */ -class BrowserBox final : public gcn::Widget, +class BrowserBox final : public Widget, public MouseListener { public: diff --git a/src/gui/widgets/browserbox_unittest.cc b/src/gui/widgets/browserbox_unittest.cc index 7bf674037..2acc5f5d3 100644 --- a/src/gui/widgets/browserbox_unittest.cc +++ b/src/gui/widgets/browserbox_unittest.cc @@ -51,7 +51,7 @@ TEST(browserbox, test1) logger = new Logger(); imageHelper = new SDLImageHelper(); Theme *theme = Theme::instance(); - gcn::Widget::setGlobalFont(new Font("/usr/share/fonts/truetype/" + Widget::setGlobalFont(new Font("/usr/share/fonts/truetype/" "ttf-dejavu/DejaVuSans-Oblique.ttf", 18)); BrowserBox *box = new BrowserBox(nullptr, BrowserBox::AUTO_WRAP, true, ""); box->setWidth(100); diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp index 2d8aad965..93d74dc8d 100644 --- a/src/gui/widgets/container.cpp +++ b/src/gui/widgets/container.cpp @@ -45,7 +45,7 @@ void Container::removeControls() delete mWidgets.front(); } -bool Container::safeRemove(gcn::Widget *const widget) +bool Container::safeRemove(Widget *const widget) { for (WidgetListConstIterator iter = mWidgets.begin(); iter != mWidgets.end(); ++iter) diff --git a/src/gui/widgets/container.h b/src/gui/widgets/container.h index 36d7cce86..17d6b2af4 100644 --- a/src/gui/widgets/container.h +++ b/src/gui/widgets/container.h @@ -41,7 +41,7 @@ class Container : public gcn::Container virtual ~Container(); - bool safeRemove(gcn::Widget *const widget); + bool safeRemove(Widget *const widget); void removeControls(); }; diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index 1ebcb4841..2aff81955 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -34,7 +34,7 @@ namespace } // namespace EmotePage::EmotePage(const Widget2 *const widget) : - gcn::Widget(widget), + Widget(widget), MouseListener(), WidgetListener(), mEmotes(ResourceManager::getInstance()->getImageSet( diff --git a/src/gui/widgets/emotepage.h b/src/gui/widgets/emotepage.h index 8a508bd26..2ce50f1fc 100644 --- a/src/gui/widgets/emotepage.h +++ b/src/gui/widgets/emotepage.h @@ -24,11 +24,11 @@ #include "listeners/mouselistener.h" #include "listeners/widgetlistener.h" -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include "localconsts.h" -class EmotePage final : public gcn::Widget, +class EmotePage final : public Widget, public MouseListener, public WidgetListener { diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp index 06fb731c4..e9b5c1e0c 100644 --- a/src/gui/widgets/flowcontainer.cpp +++ b/src/gui/widgets/flowcontainer.cpp @@ -86,7 +86,7 @@ void FlowContainer::widgetResized(const Event &event A_UNUSED) } } -void FlowContainer::add(gcn::Widget *widget) +void FlowContainer::add(Widget *widget) { if (!widget) return; diff --git a/src/gui/widgets/flowcontainer.h b/src/gui/widgets/flowcontainer.h index 8e96204ae..7266bb06a 100644 --- a/src/gui/widgets/flowcontainer.h +++ b/src/gui/widgets/flowcontainer.h @@ -64,7 +64,7 @@ class FlowContainer final : public Container, int getBoxHeight() const A_WARN_UNUSED { return mBoxHeight; } - void add(gcn::Widget *widget) override final; + void add(Widget *widget) override final; private: int mBoxWidth; diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 7bd920046..98e7e5f23 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -44,7 +44,7 @@ class GuiTableActionListener final : public ActionListener { public: GuiTableActionListener(GuiTable *restrict _table, - gcn::Widget *restrict _widget, + Widget *restrict _widget, int _row, int _column); A_DELETE_COPY(GuiTableActionListener) @@ -57,12 +57,12 @@ protected: GuiTable *mTable; int mRow; int mColumn; - gcn::Widget *mWidget; + Widget *mWidget; }; GuiTableActionListener::GuiTableActionListener(GuiTable *restrict table, - gcn::Widget *restrict widget, + Widget *restrict widget, int row, int column) : ActionListener(), mTable(table), @@ -96,7 +96,7 @@ void GuiTableActionListener::action(const ActionEvent &actionEvent A_UNUSED) GuiTable::GuiTable(const Widget2 *const widget, TableModel *const initial_model, const bool opacity) : - gcn::Widget(widget), + Widget(widget), MouseListener(), KeyListener(), mModel(nullptr), @@ -282,7 +282,7 @@ void GuiTable::installActionListeners() { for (int column = 0; column < columns; ++column) { - gcn::Widget *const widget = mModel->getElementAt(row, column); + Widget *const widget = mModel->getElementAt(row, column); if (widget) { mActionListeners.push_back(new GuiTableActionListener( @@ -347,7 +347,7 @@ void GuiTable::draw(Graphics* graphics) for (unsigned c = first_column; c + 1 <= last_column1; ++c) { - gcn::Widget *const widget = mModel->getElementAt(r, c); + Widget *const widget = mModel->getElementAt(r, c); const int cWidth = getColumnWidth(c); if (widget) { @@ -401,15 +401,15 @@ void GuiTable::draw(Graphics* graphics) BLOCK_END("GuiTable::draw") } -void GuiTable::moveToTop(gcn::Widget *widget) +void GuiTable::moveToTop(Widget *widget) { - gcn::Widget::moveToTop(widget); + Widget::moveToTop(widget); mTopWidget = widget; } -void GuiTable::moveToBottom(gcn::Widget *widget) +void GuiTable::moveToBottom(Widget *widget) { - gcn::Widget::moveToBottom(widget); + Widget::moveToBottom(widget); if (widget == mTopWidget) mTopWidget = nullptr; } @@ -532,7 +532,7 @@ void GuiTable::modelUpdated(const bool completed) } } -gcn::Widget *GuiTable::getWidgetAt(int x, int y) +Widget *GuiTable::getWidgetAt(int x, int y) { const int row = getRowForY(y); const int column = getColumnForX(x); @@ -542,7 +542,7 @@ gcn::Widget *GuiTable::getWidgetAt(int x, int y) if (mModel && row > -1 && column > -1) { - gcn::Widget *const w = mModel->getElementAt(row, column); + Widget *const w = mModel->getElementAt(row, column); if (w && w->isFocusable()) return w; else @@ -595,7 +595,7 @@ void GuiTable::_setFocusHandler(FocusHandler* focusHandler) if (!mModel || !focusHandler) return; - gcn::Widget::_setFocusHandler(focusHandler); + Widget::_setFocusHandler(focusHandler); const int rows = mModel->getRows(); const int cols = mModel->getColumns(); @@ -603,7 +603,7 @@ void GuiTable::_setFocusHandler(FocusHandler* focusHandler) { for (int c = 0; c < cols ; ++c) { - gcn::Widget *const w = mModel->getElementAt(r, c); + Widget *const w = mModel->getElementAt(r, c); if (w) w->_setFocusHandler(focusHandler); } @@ -614,5 +614,5 @@ void GuiTable::requestFocus() { if (!mFocusHandler) return; - gcn::Widget::requestFocus(); + Widget::requestFocus(); } diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index 055c6c5f2..23185a903 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -30,7 +30,7 @@ #include "listeners/keylistener.h" #include "listeners/mouselistener.h" -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include @@ -45,7 +45,7 @@ class GuiTableActionListener; * * \ingroup GUI */ -class GuiTable final : public gcn::Widget, +class GuiTable final : public Widget, public MouseListener, public KeyListener, public TableModelListener @@ -114,11 +114,11 @@ public: // Inherited from Widget void draw(Graphics* graphics) override final; - gcn::Widget *getWidgetAt(int x, int y) override final A_WARN_UNUSED; + Widget *getWidgetAt(int x, int y) override final A_WARN_UNUSED; - void moveToTop(gcn::Widget *child) override final; + void moveToTop(Widget *child) override final; - void moveToBottom(gcn::Widget *child) override final; + void moveToBottom(Widget *child) override final; void _setFocusHandler(FocusHandler* focusHandler) override final; @@ -180,7 +180,7 @@ private: TableModel *mModel; /** If someone moves a fresh widget to the top, we must display it. */ - gcn::Widget *mTopWidget; + Widget *mTopWidget; /** Vector for compactness; used as a list in practice. */ std::vector mActionListeners; diff --git a/src/gui/widgets/horizontcontainer.cpp b/src/gui/widgets/horizontcontainer.cpp index 5d0e14903..8e3be9662 100644 --- a/src/gui/widgets/horizontcontainer.cpp +++ b/src/gui/widgets/horizontcontainer.cpp @@ -36,12 +36,12 @@ HorizontContainer::HorizontContainer(const Widget2 *const widget, addWidgetListener(this); } -void HorizontContainer::add(gcn::Widget *widget) +void HorizontContainer::add(Widget *widget) { add(widget, mSpacing); } -void HorizontContainer::add(gcn::Widget *const widget, const int spacing) +void HorizontContainer::add(Widget *const widget, const int spacing) { if (!widget) return; diff --git a/src/gui/widgets/horizontcontainer.h b/src/gui/widgets/horizontcontainer.h index 9a873272c..bef3d0b00 100644 --- a/src/gui/widgets/horizontcontainer.h +++ b/src/gui/widgets/horizontcontainer.h @@ -43,9 +43,9 @@ class HorizontContainer final : public Container, A_DELETE_COPY(HorizontContainer) - void add(gcn::Widget *widget) override final; + void add(Widget *widget) override final; - void add(gcn::Widget *const widget, const int spacing); + void add(Widget *const widget, const int spacing); void clear() override; diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index 73c0db76c..53be9ef91 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -31,7 +31,7 @@ Icon::Icon(const Widget2 *const widget, const std::string &file) : - gcn::Widget(widget), + Widget(widget), mImage(ResourceManager::getInstance()->getImage(file)) { if (mImage) @@ -43,7 +43,7 @@ Icon::Icon(const Widget2 *const widget, Icon::Icon(const Widget2 *const widget, Image *const image) : - gcn::Widget(widget), + Widget(widget), mImage(image) { if (mImage) diff --git a/src/gui/widgets/icon.h b/src/gui/widgets/icon.h index dffdb8e8c..1e015f8e6 100644 --- a/src/gui/widgets/icon.h +++ b/src/gui/widgets/icon.h @@ -23,7 +23,7 @@ #ifndef GUI_WIDGETS_ICON_H #define GUI_WIDGETS_ICON_H -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include "localconsts.h" @@ -34,7 +34,7 @@ class Image; * * \ingroup GUI */ -class Icon final : public gcn::Widget +class Icon final : public Widget { public: /** diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 85f020af4..0ea3adef1 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -158,7 +158,7 @@ namespace ItemContainer::ItemContainer(const Widget2 *const widget, Inventory *const inventory, const bool forceQuantity) : - gcn::Widget(widget), + Widget(widget), KeyListener(), MouseListener(), WidgetListener(), @@ -226,7 +226,7 @@ ItemContainer::~ItemContainer() void ItemContainer::logic() { BLOCK_START("ItemContainer::logic") - gcn::Widget::logic(); + Widget::logic(); if (!mInventory) { diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index 32daa459b..f7bc44849 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -27,7 +27,7 @@ #include "listeners/mouselistener.h" #include "listeners/widgetlistener.h" -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include @@ -44,7 +44,7 @@ class SelectionListener; * * \ingroup GUI */ -class ItemContainer final : public gcn::Widget, +class ItemContainer final : public Widget, public KeyListener, public MouseListener, public WidgetListener diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp index 4132741e4..2af27a21c 100644 --- a/src/gui/widgets/layout.cpp +++ b/src/gui/widgets/layout.cpp @@ -36,7 +36,7 @@ ContainerPlacer ContainerPlacer::at(const int x, const int y) } LayoutCell &ContainerPlacer::operator() - (const int x, const int y, gcn::Widget *const wg, const int w, const int h) + (const int x, const int y, Widget *const wg, const int w, const int h) { mContainer->add(wg); return mCell->place(wg, x, y, w, h); @@ -203,7 +203,7 @@ void LayoutArray::extend(const int x, const int y, const int w, const int h) cell.mExtent[1] = h; } -LayoutCell &LayoutArray::place(gcn::Widget *const widget, const int x, +LayoutCell &LayoutArray::place(Widget *const widget, const int x, const int y, const int w, const int h) { LayoutCell &cell = at(x, y, w, h); diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h index 85998d8e7..288c282a0 100644 --- a/src/gui/widgets/layout.h +++ b/src/gui/widgets/layout.h @@ -32,9 +32,10 @@ class LayoutCell; namespace gcn { class Container; - class Widget; } +class Widget; + /** * This class is a helper for adding widgets to nested tables in a window. */ @@ -61,7 +62,7 @@ class ContainerPlacer final * Adds the given widget to the container and places it in the layout. * @see LayoutArray::place */ - LayoutCell &operator()(const int x, const int y, gcn::Widget *const wg, + LayoutCell &operator()(const int x, const int y, Widget *const wg, const int w = 1, const int h = 1); private: @@ -94,7 +95,7 @@ class LayoutArray final * @note When @a w is 1, the width of column @a x is reset to zero if * it was AUTO_DEF. Similarly for @a h. */ - LayoutCell &place(gcn::Widget *const widget, const int x, const int y, + LayoutCell &place(Widget *const widget, const int x, const int y, const int w = 1, const int h = 1); /** @@ -220,7 +221,7 @@ class LayoutCell /** * @see LayoutArray::place */ - LayoutCell &place(gcn::Widget *wg, int x, int y, int w = 1, int h = 1) + LayoutCell &place(Widget *wg, int x, int y, int w = 1, int h = 1) { return getArray().place(wg, x, y, w, h); } /** @@ -298,7 +299,7 @@ class LayoutCell union { - gcn::Widget *mWidget; + Widget *mWidget; LayoutArray *mArray; }; diff --git a/src/gui/widgets/layouthelper.cpp b/src/gui/widgets/layouthelper.cpp index e4b931c92..83e6d050a 100644 --- a/src/gui/widgets/layouthelper.cpp +++ b/src/gui/widgets/layouthelper.cpp @@ -45,7 +45,7 @@ const Layout &LayoutHelper::getLayout() const } LayoutCell &LayoutHelper::place(const int x, const int y, - gcn::Widget *const wg, + Widget *const wg, const int w, const int h) { mContainer->add(wg); diff --git a/src/gui/widgets/layouthelper.h b/src/gui/widgets/layouthelper.h index d5a94e656..32e3d9e34 100644 --- a/src/gui/widgets/layouthelper.h +++ b/src/gui/widgets/layouthelper.h @@ -67,7 +67,7 @@ class LayoutHelper final : public WidgetListener /** * Adds a widget to the container and sets it at given cell. */ - LayoutCell &place(const int x, const int y, gcn::Widget *const wg, + LayoutCell &place(const int x, const int y, Widget *const wg, const int w = 1, const int h = 1); /** diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 76eb3707a..9a0a38013 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -148,7 +148,7 @@ void Popup::setContentSize(int width, int height) mRedraw = true; } -void Popup::setLocationRelativeTo(const gcn::Widget *const widget) +void Popup::setLocationRelativeTo(const Widget *const widget) { if (!widget) return; diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index d1709a328..3c8947fce 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -86,7 +86,7 @@ class Popup : public Container, /** * Sets the location relative to the given widget. */ - void setLocationRelativeTo(const gcn::Widget *const widget); + void setLocationRelativeTo(const Widget *const widget); void mouseMoved(MouseEvent &event) override; diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp index 133cbd2ca..8ad4bd0c4 100644 --- a/src/gui/widgets/popuplist.cpp +++ b/src/gui/widgets/popuplist.cpp @@ -156,7 +156,7 @@ void PopupList::mouseReleased(MouseEvent& mouseEvent) void PopupList::focusGained(const Event& event) { - const gcn::Widget *const source = event.getSource(); + const Widget *const source = event.getSource(); if (!mVisible || source == this || source == mListBox || source == mScrollArea || source == mDropDown) { diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index db199a714..1a1b8dc0e 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -40,7 +40,7 @@ ProgressBar::ProgressBar(const Widget2 *const widget, const int backColor, const std::string &skin, const std::string &skinFill): - gcn::Widget(widget), + Widget(widget), WidgetListener(), mFillRect(), mSkin(nullptr), diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index a4862882e..fef9bf11d 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -23,7 +23,7 @@ #ifndef GUI_WIDGETS_PROGRESSBAR_H #define GUI_WIDGETS_PROGRESSBAR_H -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include "listeners/widgetlistener.h" @@ -39,7 +39,7 @@ class Skin; * * \ingroup GUI */ -class ProgressBar final : public gcn::Widget, +class ProgressBar final : public Widget, public WidgetListener { public: diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index f5b295ec8..8e86417bd 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -31,7 +31,7 @@ #include "debug.h" ProgressIndicator::ProgressIndicator(Widget2 *const widget) : - gcn::Widget(widget), + Widget(widget), mIndicator(nullptr) { ImageSet *const images = Theme::getImageSetFromTheme( diff --git a/src/gui/widgets/progressindicator.h b/src/gui/widgets/progressindicator.h index e62e7ec90..447c3d4e4 100644 --- a/src/gui/widgets/progressindicator.h +++ b/src/gui/widgets/progressindicator.h @@ -22,7 +22,7 @@ #ifndef GUI_WIDGETS_PROGRESSINDICATOR_H #define GUI_WIDGETS_PROGRESSINDICATOR_H -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include "localconsts.h" @@ -32,7 +32,7 @@ class SimpleAnimation; * A widget that indicates progress. Suitable to use instead of a progress bar * in cases where it is unknown how long something is going to take. */ -class ProgressIndicator final : public gcn::Widget +class ProgressIndicator final : public Widget { public: explicit ProgressIndicator(Widget2 *const widget); diff --git a/src/gui/widgets/radiogroup.cpp b/src/gui/widgets/radiogroup.cpp index d2f130c1b..9bb4f40c5 100644 --- a/src/gui/widgets/radiogroup.cpp +++ b/src/gui/widgets/radiogroup.cpp @@ -31,7 +31,7 @@ RadioGroup::RadioGroup(const Widget2 *const widget, { } -gcn::Widget *RadioGroup::createWidget(const std::string &text) const +Widget *RadioGroup::createWidget(const std::string &text) const { RadioButton *const widget = new RadioButton( this, text, mGroup, mCount == 0); diff --git a/src/gui/widgets/radiogroup.h b/src/gui/widgets/radiogroup.h index d0bf18532..b553c629a 100644 --- a/src/gui/widgets/radiogroup.h +++ b/src/gui/widgets/radiogroup.h @@ -23,7 +23,7 @@ #include "gui/widgets/widgetgroup.h" -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" class RadioGroup final : public WidgetGroup { @@ -35,8 +35,8 @@ class RadioGroup final : public WidgetGroup A_DELETE_COPY(RadioGroup) - gcn::Widget *createWidget(const std::string &name) - const override final A_WARN_UNUSED; + Widget *createWidget(const std::string &name) + const override final A_WARN_UNUSED; }; #endif // GUI_WIDGETS_RADIOGROUP_H diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index b508e2dd4..2ca851254 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -50,7 +50,7 @@ static std::string const buttonFiles[2] = }; ScrollArea::ScrollArea(Widget2 *const widget2, - gcn::Widget *const widget, + Widget *const widget, const bool opaque, const std::string &skin) : gcn::ScrollArea(widget2, widget), @@ -179,7 +179,7 @@ void ScrollArea::logic() } gcn::ScrollArea::logic(); - gcn::Widget *const content = getContent(); + Widget *const content = getContent(); // When no scrollbar in a certain direction, adapt content size to match // the content dimension exactly. @@ -656,7 +656,7 @@ void ScrollArea::widgetResized(const Event &event A_UNUSED) { mRedraw = true; const unsigned int frameSize = 2 * mFrameSize; - gcn::Widget *const content = getContent(); + Widget *const content = getContent(); if (content) { content->setSize(mDimension.width - frameSize, @@ -900,7 +900,7 @@ Rectangle ScrollArea::getVerticalMarkerDimension() int height; const int h2 = mShowButtons ? mScrollbarWidth : mMarkerSize / 2; - const gcn::Widget *content; + const Widget *content; if (!mWidgets.empty()) content = *mWidgets.begin(); else @@ -958,7 +958,7 @@ Rectangle ScrollArea::getHorizontalMarkerDimension() int width; const int w2 = mShowButtons ? mScrollbarWidth : mMarkerSize / 2; - const gcn::Widget *content; + const Widget *content; if (!mWidgets.empty()) content = *mWidgets.begin(); else diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index e5c9ffb79..a6081e506 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -51,7 +51,7 @@ class ScrollArea final : public gcn::ScrollArea, * @param content the initial content to show in the scroll area */ ScrollArea(Widget2 *const widget2, - gcn::Widget *const widget, + 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 1f5d48d06..3e40b902e 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -191,7 +191,7 @@ void SetupItem::externalUnloaded(const std::string &eventName A_UNUSED) { } -void SetupItem::fixFirstItemSize(gcn::Widget *const widget) +void SetupItem::fixFirstItemSize(Widget *const widget) { const int maxSize = mParent->getPreferredFirstItemSize(); if (widget->getWidth() < maxSize) diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h index 502d85d21..18e838cdf 100644 --- a/src/gui/widgets/setupitem.h +++ b/src/gui/widgets/setupitem.h @@ -70,10 +70,10 @@ class SetupItem : public ActionListener, virtual void toWidget() = 0; - void setWidget(gcn::Widget *widget) + void setWidget(Widget *widget) { mWidget = widget; } - gcn::Widget *getWidget() const A_WARN_UNUSED + Widget *getWidget() const A_WARN_UNUSED { return mWidget; } Configuration *getConfig() const A_WARN_UNUSED; @@ -95,7 +95,7 @@ class SetupItem : public ActionListener, bool isMainConfig() const A_WARN_UNUSED { return mMainConfig; } - void fixFirstItemSize(gcn::Widget *const widget); + void fixFirstItemSize(Widget *const widget); virtual void rereadValue(); @@ -138,9 +138,9 @@ class SetupItem : public ActionListener, std::string mDefault; - gcn::Widget *mWidget; + Widget *mWidget; - std::list mTempWidgets; + std::list mTempWidgets; int mValueType; diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index a8acb3f5f..a7e166da3 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -31,7 +31,7 @@ float ShortcutContainer::mAlpha = 1.0; ShortcutContainer::ShortcutContainer(Widget2 *const widget) : - gcn::Widget(widget), + Widget(widget), WidgetListener(), MouseListener(), mBackgroundImg(nullptr), diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index 115298081..81392097b 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -23,8 +23,9 @@ #ifndef GUI_WIDGETS_SHORTCUTCONTAINER_H #define GUI_WIDGETS_SHORTCUTCONTAINER_H +#include "gui/widgets/widget.h" + #include "listeners/mouselistener.h" -#include "gui/base/widget.hpp" #include "listeners/widgetlistener.h" class Image; @@ -35,7 +36,7 @@ class ImageCollection; * * \ingroup GUI */ -class ShortcutContainer : public gcn::Widget, +class ShortcutContainer : public Widget, public WidgetListener, public MouseListener { diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index ce2c02886..7f58a061e 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -197,7 +197,7 @@ void TabbedArea::draw(Graphics *graphics) BLOCK_END("TabbedArea::draw") } -gcn::Widget *TabbedArea::getWidget(const std::string &name) const +Widget *TabbedArea::getWidget(const std::string &name) const { TabContainer::const_iterator itr = mTabs.begin(); const TabContainer::const_iterator itr_end = mTabs.end(); @@ -212,7 +212,7 @@ gcn::Widget *TabbedArea::getWidget(const std::string &name) const return nullptr; } -gcn::Widget *TabbedArea::getCurrentWidget() const +Widget *TabbedArea::getCurrentWidget() const { const Tab *const tab = getSelectedTab(); @@ -223,7 +223,7 @@ gcn::Widget *TabbedArea::getCurrentWidget() const } void TabbedArea::addTab(Tab *const tab, - gcn::Widget *const widget) + Widget *const widget) { if (!tab || !widget) return; @@ -232,7 +232,7 @@ void TabbedArea::addTab(Tab *const tab, tab->addActionListener(this); mTabContainer->add(tab); - mTabs.push_back(std::pair(tab, widget)); + mTabs.push_back(std::pair(tab, widget)); if (!mSelectedTab) setSelectedTab(tab); @@ -248,14 +248,14 @@ void TabbedArea::addTab(Tab *const tab, updateArrowEnableState(); } -void TabbedArea::adjustWidget(gcn::Widget *const widget) const +void TabbedArea::adjustWidget(Widget *const widget) const { const int frameSize = 2 * mFrameSize; widget->setSize(getWidth() - frameSize, getHeight() - frameSize - mTabContainer->getHeight()); } -void TabbedArea::addTab(const std::string &caption, gcn::Widget *const widget) +void TabbedArea::addTab(const std::string &caption, Widget *const widget) { Tab *const tab = new Tab(this); tab->setCaption(caption); @@ -264,7 +264,7 @@ void TabbedArea::addTab(const std::string &caption, gcn::Widget *const widget) addTab(tab, widget); } -void TabbedArea::addTab(Image *const image, gcn::Widget *const widget) +void TabbedArea::addTab(Image *const image, Widget *const widget) { Tab *const tab = new Tab(this); tab->setImage(image); @@ -375,7 +375,7 @@ void TabbedArea::mousePressed(MouseEvent &mouseEvent) if (mouseEvent.getButton() == MouseEvent::LEFT) { - gcn::Widget *const widget = mTabContainer->getWidgetAt( + Widget *const widget = mTabContainer->getWidgetAt( mouseEvent.getX(), mouseEvent.getY()); Tab *const tab = dynamic_cast(widget); @@ -449,7 +449,7 @@ void TabbedArea::widgetResized(const Event &event A_UNUSED) const int height = h1 - frameSize - mWidgetContainer->getY() - widgetFrameSize; - gcn::Widget *const w = getCurrentWidget(); + Widget *const w = getCurrentWidget(); if (w) { ScrollArea *const scr = dynamic_cast(w); @@ -545,7 +545,7 @@ void TabbedArea::adjustSize() mWidgetContainer->setPosition(0, maxTabHeight); mWidgetContainer->setSize(width, height - maxTabHeight); - gcn::Widget *const w = getCurrentWidget(); + Widget *const w = getCurrentWidget(); if (w) { const int wFrameSize = w->getFrameSize(); @@ -605,7 +605,7 @@ void TabbedArea::adjustTabPositions() void TabbedArea::action(const ActionEvent& actionEvent) { - gcn::Widget *const source = actionEvent.getSource(); + Widget *const source = actionEvent.getSource(); Tab *const tab = dynamic_cast(source); if (tab) @@ -677,7 +677,7 @@ Tab *TabbedArea::getTabByIndex(const int index) const return static_cast(mTabs[index].first); } -gcn::Widget *TabbedArea::getWidgetByIndex(const int index) const +Widget *TabbedArea::getWidgetByIndex(const int index) const { if (index < 0 || index >= static_cast(mTabs.size())) return nullptr; @@ -694,7 +694,7 @@ void TabbedArea::removeAll(const bool del) { const int idx = getNumberOfTabs() - 1; Tab *tab = mTabs[idx].first; - gcn::Widget *widget = mTabs[idx].second; + Widget *widget = mTabs[idx].second; removeTab(tab); if (del) { @@ -706,25 +706,25 @@ void TabbedArea::removeAll(const bool del) void TabbedArea::setWidth(int width) { - gcn::Widget::setWidth(width); + Widget::setWidth(width); adjustSize(); } void TabbedArea::setHeight(int height) { - gcn::Widget::setHeight(height); + Widget::setHeight(height); adjustSize(); } void TabbedArea::setSize(int width, int height) { - gcn::Widget::setSize(width, height); + Widget::setSize(width, height); adjustSize(); } void TabbedArea::setDimension(const Rectangle &dimension) { - gcn::Widget::setDimension(dimension); + Widget::setDimension(dimension); adjustSize(); } diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 2affd7368..0ad4fbbe6 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -118,17 +118,17 @@ class TabbedArea final : public ActionListener, Tab *getTabByIndex(const int index) const A_WARN_UNUSED; - gcn::Widget *getWidgetByIndex(const int index) const A_WARN_UNUSED; + Widget *getWidgetByIndex(const int index) const A_WARN_UNUSED; /** * Returns the widget with the tab that has specified caption */ - gcn::Widget *getWidget(const std::string &name) const A_WARN_UNUSED; + Widget *getWidget(const std::string &name) const A_WARN_UNUSED; /** * Returns the widget for the current tab */ - gcn::Widget *getCurrentWidget() const A_WARN_UNUSED; + Widget *getCurrentWidget() const A_WARN_UNUSED; /** * Add a tab. Overridden since it needs to size the widget. @@ -136,11 +136,11 @@ class TabbedArea final : public ActionListener, * @param tab The tab widget for the tab. * @param widget The widget to view when the tab is selected. */ - void addTab(Tab *const tab, gcn::Widget *const widget); + void addTab(Tab *const tab, Widget *const widget); - void addTab(const std::string &caption, gcn::Widget *const widget); + void addTab(const std::string &caption, Widget *const widget); - void addTab(Image *const image, gcn::Widget *const widget); + void addTab(Image *const image, Widget *const widget); bool isTabSelected(const unsigned int index) const A_WARN_UNUSED; @@ -229,14 +229,14 @@ class TabbedArea final : public ActionListener, void setResizeHeight(bool b) { mResizeHeight = b; } - void adjustWidget(gcn::Widget *const widget) const; + void adjustWidget(Widget *const widget) const; void selectNextTab(); void selectPrevTab(); private: - typedef std::vector > TabContainer; + typedef std::vector > TabContainer; /** The tab arrows */ Button *mArrowButton[2]; diff --git a/src/gui/widgets/tablemodel.cpp b/src/gui/widgets/tablemodel.cpp index 7b6b8048e..82b249d0f 100644 --- a/src/gui/widgets/tablemodel.cpp +++ b/src/gui/widgets/tablemodel.cpp @@ -24,7 +24,7 @@ #include "utils/dtor.h" -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include "debug.h" @@ -89,7 +89,7 @@ void StaticTableModel::resize() } void StaticTableModel::set(const int row, const int column, - gcn::Widget *const widget) + Widget *const widget) { if (!widget || row >= mRows || row < 0 || column >= mColumns || column < 0) @@ -119,8 +119,8 @@ void StaticTableModel::set(const int row, const int column, signalAfterUpdate(); } -gcn::Widget *StaticTableModel::getElementAt(const int row, - const int column) const +Widget *StaticTableModel::getElementAt(const int row, + const int column) const { return mTableModel[WIDGET_AT(row, column)]; } diff --git a/src/gui/widgets/tablemodel.h b/src/gui/widgets/tablemodel.h index 1273c6873..48bd336af 100644 --- a/src/gui/widgets/tablemodel.h +++ b/src/gui/widgets/tablemodel.h @@ -28,10 +28,7 @@ #include "localconsts.h" -namespace gcn -{ - class Widget; -} +class Widget; class TableModelListener { @@ -83,7 +80,7 @@ public: /** * Retrieves the widget stored at the specified location within the table. */ - virtual gcn::Widget *getElementAt(const int row, const int column) + virtual Widget *getElementAt(const int row, const int column) const A_WARN_UNUSED = 0; virtual void installListener(TableModelListener *const listener); @@ -125,7 +122,7 @@ public: * The model is resized to accomodate the widget's width and height, * unless column width / row height have been fixed. */ - void set(const int row, const int column, gcn::Widget *const widget); + void set(const int row, const int column, Widget *const widget); /** * Fixes the column width for a given column; this overrides dynamic width @@ -153,14 +150,14 @@ public: int getWidth() const A_WARN_UNUSED; int getHeight() const A_WARN_UNUSED; int getColumnWidth(const int index) const override final A_WARN_UNUSED; - gcn::Widget *getElementAt(const int row, + Widget *getElementAt(const int row, const int column) const override final A_WARN_UNUSED; protected: int mRows, mColumns; int mHeight; - std::vector mTableModel; + std::vector mTableModel; std::vector mWidths; }; diff --git a/src/gui/widgets/tabs/setup_joystick.cpp b/src/gui/widgets/tabs/setup_joystick.cpp index aa1180cef..e2e66c6fc 100644 --- a/src/gui/widgets/tabs/setup_joystick.cpp +++ b/src/gui/widgets/tabs/setup_joystick.cpp @@ -104,7 +104,7 @@ Setup_Joystick::~Setup_Joystick() void Setup_Joystick::action(const ActionEvent &event) { - const gcn::Widget *const source = event.getSource(); + const Widget *const source = event.getSource(); if (source == mJoystickEnabled) { setTempEnabled(mJoystickEnabled->isSelected()); diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp index 30e1c96bd..dd08d437b 100644 --- a/src/gui/widgets/tabs/setup_relations.cpp +++ b/src/gui/widgets/tabs/setup_relations.cpp @@ -165,7 +165,7 @@ public: player_names->size()); r < sz; ++r) { const std::string name = (*player_names)[r]; - gcn::Widget *const widget = new Label(this, name); + Widget *const widget = new Label(this, name); mWidgets.push_back(widget); DropDown *const choicebox = new DropDown(this, mListModel); @@ -186,7 +186,7 @@ public: } - gcn::Widget *getElementAt(int row, int column) const override final + Widget *getElementAt(int row, int column) const override final { return mWidgets[WIDGET_AT(row, column)]; } @@ -209,7 +209,7 @@ public: protected: StringVect *mPlayers; - std::vector mWidgets; + std::vector mWidgets; PlayerRelationListModel *mListModel; }; diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp index 4a72d7ccd..57520afce 100644 --- a/src/gui/widgets/tabstrip.cpp +++ b/src/gui/widgets/tabstrip.cpp @@ -39,7 +39,7 @@ TabStrip::TabStrip(const Widget2 *const widget, { } -gcn::Widget *TabStrip::createWidget(const std::string &text) const +Widget *TabStrip::createWidget(const std::string &text) const { Button *const widget = new Button(this); widget->setStick(true); @@ -55,7 +55,7 @@ void TabStrip::action(const ActionEvent &event) WidgetGroup::action(event); if (event.getSource()) { - gcn::Widget *const widget = event.getSource(); + Widget *const widget = event.getSource(); if (static_cast(widget)->isPressed2()) { FOR_EACH (WidgetListConstIterator, iter, mWidgets) diff --git a/src/gui/widgets/tabstrip.h b/src/gui/widgets/tabstrip.h index 57a178ff0..b2dfc99e2 100644 --- a/src/gui/widgets/tabstrip.h +++ b/src/gui/widgets/tabstrip.h @@ -23,7 +23,7 @@ #include "gui/widgets/widgetgroup.h" -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" class TabStrip final : public WidgetGroup { @@ -39,8 +39,8 @@ class TabStrip final : public WidgetGroup A_DELETE_COPY(TabStrip) - gcn::Widget *createWidget(const std::string &name) - const override final A_WARN_UNUSED; + Widget *createWidget(const std::string &name) + const override final A_WARN_UNUSED; void action(const ActionEvent &event) override final; }; diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 59e61f8d2..6fce77641 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -292,7 +292,7 @@ void TextBox::keyPressed(KeyEvent& keyEvent) case Input::KEY_GUI_PAGE_UP: { - gcn::Widget *const par = getParent(); + Widget *const par = getParent(); if (par) { @@ -308,7 +308,7 @@ void TextBox::keyPressed(KeyEvent& keyEvent) case Input::KEY_GUI_PAGE_DOWN: { - gcn::Widget *const par = getParent(); + Widget *const par = getParent(); if (par) { diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 0676dec25..3772f3bbc 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -35,7 +35,7 @@ Skin *TextPreview::mSkin = nullptr; TextPreview::TextPreview(const Widget2 *const widget, const std::string &text) : - gcn::Widget(widget), + Widget(widget), mFont(gui->getFont()), mText(text), mTextColor(&getThemeColor(Theme::TEXT)), diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h index 31768fa66..5a09e1148 100644 --- a/src/gui/widgets/textpreview.h +++ b/src/gui/widgets/textpreview.h @@ -23,14 +23,14 @@ #ifndef GUI_WIDGETS_TEXTPREVIEW_H #define GUI_WIDGETS_TEXTPREVIEW_H -#include "gui/base/widget.hpp" +#include "gui/widgets/widget.h" #include "localconsts.h" /** * Preview widget for particle colors, etc. */ -class TextPreview final : public gcn::Widget +class TextPreview final : public Widget { public: TextPreview(const Widget2 *const widget, diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp index 9d596d620..b86aa3e5f 100644 --- a/src/gui/widgets/vertcontainer.cpp +++ b/src/gui/widgets/vertcontainer.cpp @@ -40,12 +40,12 @@ VertContainer::VertContainer(const Widget2 *const widget, addWidgetListener(this); } -void VertContainer::add1(gcn::Widget *const widget, const int spacing) +void VertContainer::add1(Widget *const widget, const int spacing) { add2(widget, mResizable, spacing); } -void VertContainer::add2(gcn::Widget *const widget, const bool resizable, +void VertContainer::add2(Widget *const widget, const bool resizable, const int spacing) { if (!widget) @@ -82,6 +82,6 @@ void VertContainer::clear() void VertContainer::widgetResized(const Event &event A_UNUSED) { - FOR_EACH (std::vector::const_iterator, it, mResizableWidgets) + 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 5fb212b48..05ba2e32f 100644 --- a/src/gui/widgets/vertcontainer.h +++ b/src/gui/widgets/vertcontainer.h @@ -46,17 +46,17 @@ class VertContainer final : public Container, A_DELETE_COPY(VertContainer) - void add2(gcn::Widget *const widget, const bool resizable, + void add2(Widget *const widget, const bool resizable, const int spacing = -1); - void add1(gcn::Widget *const widget, const int spacing = -1); + void add1(Widget *const widget, const int spacing = -1); void clear(); void widgetResized(const Event &event) override final; private: - std::vector mResizableWidgets; + std::vector mResizableWidgets; int mVerticalItemSize; int mCount; int mNextY; diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp new file mode 100644 index 000000000..f93107bc5 --- /dev/null +++ b/src/gui/widgets/widget.cpp @@ -0,0 +1,676 @@ +/* + * 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/widgets/widget.h" + +#include "events/actionevent.h" + +#include "events/event.h" + +#include "gui/focushandler.h" + +#include "listeners/actionlistener.h" +#include "listeners/deathlistener.h" +#include "listeners/widgetlistener.h" + +#include "render/graphics.h" + +#include "debug.h" + +Font* Widget::mGlobalFont = nullptr; +std::list Widget::mWidgets; +std::set Widget::mWidgetsSet; + +Widget::Widget(const Widget2 *const widget) : + Widget2(widget), + mMouseListeners(), + mKeyListeners(), + mActionListeners(), + mDeathListeners(), + mFocusListeners(), + mWidgetListeners(), + mForegroundColor(0x000000), + mBackgroundColor(0xffffff), + mBaseColor(0x808090), + mSelectionColor(0xc3d9ff), + mFocusHandler(nullptr), + mInternalFocusHandler(nullptr), + mParent(nullptr), + mDimension(), + mFrameSize(0), + mActionEventId(), + mFocusable(false), + mVisible(true), + mTabIn(true), + mTabOut(true), + mEnabled(true), + mId(), + mCurrentFont(nullptr) +{ + mWidgets.push_back(this); + mWidgetsSet.insert(this); +} + +Widget::~Widget() +{ + for (DeathListenerIterator iter = mDeathListeners.begin(); + iter != mDeathListeners.end(); + ++iter) + { + Event event(this); + (*iter)->death(event); + } + + _setFocusHandler(nullptr); + + mWidgets.remove(this); + mWidgetsSet.erase(this); +} + +void Widget::drawFrame(Graphics* graphics) +{ + BLOCK_START("Widget::drawFrame") + const Color &faceColor = getBaseColor(); + Color highlightColor = faceColor + Color(0x303030); + Color shadowColor = faceColor - Color(0x303030); + const int alpha = getBaseColor().a; + const int width = getWidth() + getFrameSize() * 2 - 1; + const int height = getHeight() + getFrameSize() * 2 - 1; + highlightColor.a = alpha; + shadowColor.a = alpha; + + for (unsigned int i = 0; i < getFrameSize(); ++i) + { + graphics->setColor(shadowColor); + graphics->drawLine(i, i, width - i, i); + graphics->drawLine(i, i + 1, i, height - i - 1); + graphics->setColor(highlightColor); + graphics->drawLine(width - i, i + 1, width - i, height - i); + graphics->drawLine(i, height - i, width - i - 1, height - i); + } + BLOCK_END("Widget::drawFrame") +} + +void Widget::_setParent(Widget* parent) +{ + mParent = parent; +} + +void Widget::setWidth(int width) +{ + Rectangle newDimension = mDimension; + newDimension.width = width; + + setDimension(newDimension); +} + +void Widget::setHeight(int height) +{ + Rectangle newDimension = mDimension; + newDimension.height = height; + + setDimension(newDimension); +} + +void Widget::setX(int x) +{ + Rectangle newDimension = mDimension; + newDimension.x = x; + + setDimension(newDimension); +} + +void Widget::setY(int y) +{ + Rectangle newDimension = mDimension; + newDimension.y = y; + + setDimension(newDimension); +} + +void Widget::setPosition(int x, int y) +{ + Rectangle newDimension = mDimension; + newDimension.x = x; + newDimension.y = y; + + setDimension(newDimension); +} + +void Widget::setDimension(const Rectangle& dimension) +{ + const Rectangle oldDimension = mDimension; + mDimension = dimension; + + if (mDimension.width != oldDimension.width + || mDimension.height != oldDimension.height) + { + distributeResizedEvent(); + } + + if (mDimension.x != oldDimension.x + || mDimension.y != oldDimension.y) + { + distributeMovedEvent(); + } +} + +void Widget::setFrameSize(unsigned int frameSize) +{ + mFrameSize = frameSize; +} + +unsigned int Widget::getFrameSize() const +{ + return mFrameSize; +} + +const Rectangle& Widget::getDimension() const +{ + return mDimension; +} + +const std::string& Widget::getActionEventId() const +{ + return mActionEventId; +} + +void Widget::setActionEventId(const std::string& actionEventId) +{ + mActionEventId = actionEventId; +} + +bool Widget::isFocused() const +{ + if (!mFocusHandler) + return false; + + return (mFocusHandler->isFocused(this)); +} + +void Widget::setFocusable(bool focusable) +{ + if (!focusable && isFocused()) + { + mFocusHandler->focusNone(); + } + + mFocusable = focusable; +} + +bool Widget::isFocusable() const +{ + return mFocusable && isVisible() && isEnabled(); +} + +void Widget::requestFocus() +{ + if (!mFocusHandler) + return; + + if (isFocusable()) + mFocusHandler->requestFocus(this); +} + +void Widget::requestMoveToTop() +{ + if (mParent) + mParent->moveToTop(this); +} + +void Widget::requestMoveToBottom() +{ + if (mParent) + mParent->moveToBottom(this); +} + +void Widget::setVisible(bool visible) +{ + if (!visible && isFocused()) + mFocusHandler->focusNone(); + + if (visible) + distributeShownEvent(); + else + distributeHiddenEvent(); + + mVisible = visible; +} + +void Widget::setBaseColor(const Color& color) +{ + mBaseColor = color; +} + +const Color& Widget::getBaseColor() const +{ + return mBaseColor; +} + +void Widget::setForegroundColor(const Color& color) +{ + mForegroundColor = color; +} + +const Color& Widget::getForegroundColor() const +{ + return mForegroundColor; +} + +void Widget::setBackgroundColor(const Color& color) +{ + mBackgroundColor = color; +} + +const Color& Widget::getBackgroundColor() const +{ + return mBackgroundColor; +} + +void Widget::setSelectionColor(const Color& color) +{ + mSelectionColor = color; +} + +const Color& Widget::getSelectionColor() const +{ + return mSelectionColor; +} + +void Widget::_setFocusHandler(FocusHandler* focusHandler) +{ + if (mFocusHandler) + { + releaseModalFocus(); + mFocusHandler->remove(this); + } + + if (focusHandler) + focusHandler->add(this); + + mFocusHandler = focusHandler; +} + +FocusHandler* Widget::_getFocusHandler() +{ + return mFocusHandler; +} + +void Widget::addActionListener(ActionListener* actionListener) +{ + mActionListeners.push_back(actionListener); +} + +void Widget::removeActionListener(ActionListener* actionListener) +{ + mActionListeners.remove(actionListener); +} + +void Widget::addDeathListener(DeathListener* deathListener) +{ + mDeathListeners.push_back(deathListener); +} + +void Widget::removeDeathListener(DeathListener* deathListener) +{ + mDeathListeners.remove(deathListener); +} + +void Widget::addKeyListener(KeyListener* keyListener) +{ + mKeyListeners.push_back(keyListener); +} + +void Widget::removeKeyListener(KeyListener* keyListener) +{ + mKeyListeners.remove(keyListener); +} + +void Widget::addFocusListener(FocusListener* focusListener) +{ + mFocusListeners.push_back(focusListener); +} + +void Widget::removeFocusListener(FocusListener* focusListener) +{ + mFocusListeners.remove(focusListener); +} + +void Widget::addMouseListener(MouseListener* mouseListener) +{ + mMouseListeners.push_back(mouseListener); +} + +void Widget::removeMouseListener(MouseListener* mouseListener) +{ + mMouseListeners.remove(mouseListener); +} + +void Widget::addWidgetListener(WidgetListener* widgetListener) +{ + mWidgetListeners.push_back(widgetListener); +} + +void Widget::removeWidgetListener(WidgetListener* widgetListener) +{ + mWidgetListeners.remove(widgetListener); +} + +void Widget::getAbsolutePosition(int& x, int& y) const +{ + if (!mParent) + { + x = mDimension.x; + y = mDimension.y; + return; + } + + int parentX; + int parentY; + + mParent->getAbsolutePosition(parentX, parentY); + + const Rectangle &rect = mParent->getChildrenArea(); + x = parentX + mDimension.x + rect.x; + y = parentY + mDimension.y + rect.y; +} + +Font* Widget::getFont() const +{ + if (!mCurrentFont) + return mGlobalFont; + return mCurrentFont; +} + +void Widget::setGlobalFont(Font* font) +{ + mGlobalFont = font; + + for (std::list::const_iterator iter = mWidgets.begin(); + iter != mWidgets.end(); ++iter) + { + if (!(*iter)->mCurrentFont) + (*iter)->fontChanged(); + } +} + +void Widget::setFont(Font* font) +{ + mCurrentFont = font; + fontChanged(); +} + +bool Widget::widgetExists(const Widget* widget) +{ + return mWidgetsSet.find(const_cast(widget)) + != mWidgetsSet.end(); +} + +bool Widget::isTabInEnabled() const +{ + return mTabIn; +} + +void Widget::setTabInEnabled(bool enabled) +{ + mTabIn = enabled; +} + +bool Widget::isTabOutEnabled() const +{ + return mTabOut; +} + +void Widget::setTabOutEnabled(bool enabled) +{ + mTabOut = enabled; +} + +void Widget::setSize(int width, int height) +{ + Rectangle newDimension = mDimension; + newDimension.width = width; + newDimension.height = height; + + setDimension(newDimension); +} + +void Widget::setEnabled(bool enabled) +{ + mEnabled = enabled; +} + +bool Widget::isEnabled() const +{ + return mEnabled && isVisible(); +} + +void Widget::requestModalFocus() +{ + if (!mFocusHandler) + return; + + mFocusHandler->requestModalFocus(this); +} + +void Widget::requestModalMouseInputFocus() +{ + if (!mFocusHandler) + return; + + mFocusHandler->requestModalMouseInputFocus(this); +} + +void Widget::releaseModalFocus() +{ + if (!mFocusHandler) + return; + + mFocusHandler->releaseModalFocus(this); +} + +void Widget::releaseModalMouseInputFocus() +{ + if (!mFocusHandler) + return; + + mFocusHandler->releaseModalMouseInputFocus(this); +} + +bool Widget::isModalFocused() const +{ + if (!mFocusHandler) + return false; + + if (mParent) + { + return (mFocusHandler->getModalFocused() == this) + || mParent->isModalFocused(); + } + + return mFocusHandler->getModalFocused() == this; +} + +bool Widget::isModalMouseInputFocused() const +{ + if (!mFocusHandler) + return false; + + if (mParent) + { + return (mFocusHandler->getModalMouseInputFocused() == this) + || mParent->isModalMouseInputFocused(); + } + + return mFocusHandler->getModalMouseInputFocused() == this; +} + +Widget *Widget::getWidgetAt(int x A_UNUSED, int y A_UNUSED) +{ + return nullptr; +} + +const std::list& Widget::_getMouseListeners() +{ + return mMouseListeners; +} + +const std::list& Widget::_getKeyListeners() +{ + return mKeyListeners; +} + +const std::list& Widget::_getFocusListeners() +{ + return mFocusListeners; +} + +Rectangle Widget::getChildrenArea() +{ + return Rectangle(0, 0, 0, 0); +} + +FocusHandler* Widget::_getInternalFocusHandler() +{ + return mInternalFocusHandler; +} + +void Widget::setInternalFocusHandler(FocusHandler* focusHandler) +{ + mInternalFocusHandler = focusHandler; +} + +void Widget::setId(const std::string& id) +{ + mId = id; +} + +const std::string& Widget::getId() +{ + return mId; +} + +void Widget::distributeResizedEvent() +{ + for (WidgetListenerIterator iter = mWidgetListeners.begin(); + iter != mWidgetListeners.end(); + ++ iter) + { + Event event(this); + (*iter)->widgetResized(event); + } +} + +void Widget::distributeMovedEvent() +{ + for (WidgetListenerIterator iter = mWidgetListeners.begin(); + iter != mWidgetListeners.end(); + ++ iter) + { + Event event(this); + (*iter)->widgetMoved(event); + } +} + +void Widget::distributeHiddenEvent() +{ + for (WidgetListenerIterator iter = mWidgetListeners.begin(); + iter != mWidgetListeners.end(); + ++ iter) + { + Event event(this); + (*iter)->widgetHidden(event); + } +} + +void Widget::distributeActionEvent() +{ + for (ActionListenerIterator iter = mActionListeners.begin(); + iter != mActionListeners.end(); + ++iter) + { + ActionEvent actionEvent(this, mActionEventId); + (*iter)->action(actionEvent); + } +} + +void Widget::distributeShownEvent() +{ + for (WidgetListenerIterator iter = mWidgetListeners.begin(); + iter != mWidgetListeners.end(); + ++iter) + { + Event event(this); + (*iter)->widgetShown(event); + } +} + +void Widget::showPart(Rectangle rectangle) +{ + if (mParent) + mParent->showWidgetPart(this, rectangle); +} diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h new file mode 100644 index 000000000..08f1456b0 --- /dev/null +++ b/src/gui/widgets/widget.h @@ -0,0 +1,1228 @@ +/* + * 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 GUI_WIDGETS_WIDGET_H +#define GUI_WIDGETS_WIDGET_H + +#include +#include +#include + +#include "gui/color.h" +#include "gui/rectangle.h" + +#include "gui/widgets/widget2.h" + +#include "localconsts.h" + +class ActionListener; +class DeathListener; +class FocusHandler; +class FocusListener; +class Font; +class Graphics; +class KeyListener; +class MouseListener; +class WidgetListener; + +/** + * Abstract class for widgets of Guichan. It contains basic functions + * every widget should have. + * + * NOTE: Functions begining with underscore "_" should not + * be overloaded unless you know what you are doing + * + * @author Olof Naessén + * @author Per Larsson. + * @since 0.1.0 + */ +class Widget : public Widget2 +{ + public: + /** + * Constructor. Resets member variables. Noteable, a widget is not + * focusable as default, therefore, widgets that are supposed to be + * focusable should overide this default in their own constructor. + */ + explicit Widget(const Widget2 *const widget); + + A_DELETE_COPY(Widget) + + /** + * Default destructor. + */ + virtual ~Widget(); + + /** + * Draws the widget. It is called by the parent widget when it is time + * for the widget to draw itself. The graphics object is set up so + * that all drawing is relative to the widget, i.e coordinate (0,0) is + * the top left corner of the widget. It is not possible to draw + * outside of a widget's dimension. + * + * @param graphics aA graphics object to draw with. + * @since 0.1.0 + */ + virtual void draw(Graphics* graphics) = 0; + + /** + * Called when a widget is given a chance to draw a frame around itself. + * The frame is not considered a part of the widget, it only allows a frame + * to be drawn around the widget, thus a frame will never be included when + * calculating if a widget should receive events from user input. Also + * a widget's frame will never be included when calculating a widget's + * position. + * + * The size of the frame is calculated using the widget's frame size. + * If a widget has a frame size of 10 pixels than the area the drawFrame + * function can draw to will be the size of the widget with an additional + * extension of 10 pixels in each direction. + * + * An example when drawFrame is a useful function is if a widget needs + * a glow around itself. + * + * @param graphics A graphics object to draw with. + * @see setFrameSize, getFrameSize + * @since 0.8.0 + */ + virtual void drawFrame(Graphics* graphics); + + /** + * Sets the size of the widget's frame. The frame is not considered a part of + * the widget, it only allows a frame to be drawn around the widget, thus a frame + * will never be included when calculating if a widget should receive events + * from user input. Also a widget's frame will never be included when calculating + * a widget's position. + * + * A frame size of 0 means that the widget has no frame. The default frame size + * is 0. + * + * @param frameSize The size of the widget's frame. + * @see getFrameSize, drawFrame + * @since 0.8.0 + */ + void setFrameSize(unsigned int frameSize); + + /** + * Gets the size of the widget's frame. The frame is not considered a part of + * the widget, it only allows a frame to be drawn around the widget, thus a frame + * will never be included when calculating if a widget should receive events + * from user input. Also a widget's frame will never be included when calculating + * a widget's position. + * + * A frame size of 0 means that the widget has no frame. The default frame size + * is 0. + * + * @return The size of the widget's frame. + * @see setFrameSize, drawFrame + * @since 0.8.0 + */ + unsigned int getFrameSize() const A_WARN_UNUSED; + + /** + * Called for all widgets in the gui each time Gui::logic is called. + * You can do logic stuff here like playing an animation. + * + * @see Gui::logic + * @since 0.1.0 + */ + virtual void logic() + { } + + /** + * Gets the widget's parent container. + * + * @return The widget's parent container. NULL if the widget + * has no parent. + * @since 0.1.0 + */ + virtual Widget* getParent() const A_WARN_UNUSED + { return mParent; } + + /** + * Sets the width of the widget. + * + * @param width The width of the widget. + * @see getWidth, setHeight, getHeight, setSize, + * setDimension, getDimensi + * @since 0.1.0 + */ + void setWidth(int width); + + /** + * Gets the width of the widget. + * + * @return The width of the widget. + * @see setWidth, setHeight, getHeight, setSize, + * setDimension, getDimension + * @since 0.1.0 + */ + int getWidth() const A_WARN_UNUSED + { return mDimension.width; } + + /** + * Sets the height of the widget. + * + * @param height The height of the widget. + * @see getHeight, setWidth, getWidth, setSize, + * setDimension, getDimension + * @since 0.1.0 + */ + void setHeight(int height); + + /** + * Gets the height of the widget. + * + * @return The height of the widget. + * @see setHeight, setWidth, getWidth, setSize, + * setDimension, getDimension + * @since 0.1.0 + */ + int getHeight() const A_WARN_UNUSED + { return mDimension.height; } + + /** + * Sets the size of the widget. + * + * @param width The width of the widget. + * @param height The height of the widget. + * @see setWidth, setHeight, getWidth, getHeight, + * setDimension, getDimension + * @since 0.1.0 + */ + void setSize(int width, int height); + + /** + * Sets the x coordinate of the widget. The coordinate is + * relateive to the widget's parent. + * + * @param x The x coordinate of the widget. + * @see getX, setY, getY, setPosition, setDimension, getDimension + * @since 0.1.0 + */ + void setX(int x); + + /** + * Gets the x coordinate of the widget. The coordinate is + * relative to the widget's parent. + * + * @return The x coordinate of the widget. + * @see setX, setY, getY, setPosition, setDimension, getDimension + * @since 0.1.0 + */ + int getX() const A_WARN_UNUSED + { return mDimension.x; } + + /** + * Sets the y coordinate of the widget. The coordinate is + * relative to the widget's parent. + * + * @param y The y coordinate of the widget. + * @see setY, setX, getX, setPosition, setDimension, getDimension + * @since 0.1.0 + */ + void setY(int y); + + /** + * Gets the y coordinate of the widget. The coordinate is + * relative to the widget's parent. + * + * @return The y coordinate of the widget. + * @see setY, setX, getX, setPosition, setDimension, getDimension + * @since 0.1.0 + */ + int getY() const A_WARN_UNUSED + { return mDimension.y; } + + /** + * Sets position of the widget. The position is relative + * to the widget's parent. + * + * @param x The x coordinate of the widget. + * @param y The y coordinate of the widget. + * @see setX, getX, setY, getY, setDimension, getDimension + * @since 0.1.0 + */ + void setPosition(int x, int y); + + /** + * Sets the dimension of the widget. The dimension is + * relative to the widget's parent. + * + * @param dimension The dimension of the widget. + * @see getDimension, setX, getX, setY, getY, setPosition + * @since 0.1.0 + */ + void setDimension(const Rectangle& dimension); + + /** + * Gets the dimension of the widget. The dimension is + * relative to the widget's parent. + * + * @return The dimension of the widget. + * @see getDimension, setX, getX, setY, getY, setPosition + * @since 0.1.0 + */ + const Rectangle& getDimension() const A_WARN_UNUSED; + + /** + * Sets the widget to be fosusable, or not. + * + * @param focusable True if the widget should be focusable, + * false otherwise. + * @see isFocusable + * @since 0.1.0 + */ + void setFocusable(bool focusable); + + /** + * Checks if a widget is focsable. + * + * @return True if the widget should be focusable, false otherwise. + * @see setFocusable + * @since 0.1.0 + */ + bool isFocusable() const A_WARN_UNUSED; + + /** + * Checks if the widget is focused. + * + * @return True if the widget is focused, false otherwise. + * @since 0.1.0 + */ + virtual bool isFocused() const A_WARN_UNUSED; + + /** + * Sets the widget to enabled, or not. A disabled + * widget will never recieve mouse or key events. + * + * @param enabled True if widget should be enabled, + * false otherwise. + * @see isEnabled + * @since 0.1.0 + */ + void setEnabled(bool enabled); + + /** + * Checks if the widget is enabled. A disabled + * widget will never recieve mouse or key events. + * + * @return True if widget is enabled, false otherwise. + * @see setEnabled + * @since 0.1.0 + */ + bool isEnabled() const A_WARN_UNUSED; + + /** + * Sets the widget to be visible, or not. + * + * @param visible True if widget should be visible, false otherwise. + * @see isVisible + * @since 0.1.0 + */ + void setVisible(bool visible); + + /** + * Checks if the widget is visible. + * + * @return True if widget is be visible, false otherwise. + * @see setVisible + * @since 0.1.0 + */ + bool isVisible() const A_WARN_UNUSED + { return mVisible && (!mParent || mParent->isVisible()); } + + /** + * Sets the base color of the widget. + * + * @param color The baseground color. + * @see getBaseColor + * @since 0.1.0 + */ + void setBaseColor(const Color& color); + + /** + * Gets the base color. + * + * @return The base color. + * @see setBaseColor + * @since 0.1.0 + */ + const Color& getBaseColor() const A_WARN_UNUSED; + + /** + * Sets the foreground color. + * + * @param color The foreground color. + * @see getForegroundColor + * @since 0.1.0 + */ + void setForegroundColor(const Color& color); + + /** + * Gets the foreground color. + * + * @see setForegroundColor + * @since 0.1.0 + */ + const Color& getForegroundColor() const A_WARN_UNUSED; + + /** + * Sets the background color. + * + * @param color The background Color. + * @see setBackgroundColor + * @since 0.1.0 + */ + void setBackgroundColor(const Color& color); + + /** + * Gets the background color. + * + * @see setBackgroundColor + * @since 0.1.0 + */ + const Color& getBackgroundColor() const A_WARN_UNUSED; + + /** + * Sets the selection color. + * + * @param color The selection color. + * @see getSelectionColor + * @since 0.6.0 + */ + void setSelectionColor(const Color& color); + + /** + * Gets the selection color. + * + * @return The selection color. + * @see setSelectionColor + * @since 0.6.0 + */ + const Color& getSelectionColor() const A_WARN_UNUSED; + + /** + * Requests focus for the widget. A widget will only recieve focus + * if it is focusable. + */ + virtual void requestFocus(); + + /** + * Requests a move to the top in the parent widget. + */ + virtual void requestMoveToTop(); + + /** + * Requests a move to the bottom in the parent widget. + */ + virtual void requestMoveToBottom(); + + /** + * Sets the focus handler to be used. + * + * WARNING: This function is used internally and should not + * be called or overloaded unless you know what you + * are doing. + * + * @param focusHandler The focus handler to use. + * @see _getFocusHandler + * @since 0.1.0 + */ + virtual void _setFocusHandler(FocusHandler* focusHandler); + + /** + * Gets the focus handler used. + * + * WARNING: This function is used internally and should not + * be called or overloaded unless you know what you + * are doing. + * + * @return The focus handler used. + * @see _setFocusHandler + * @since 0.1.0 + */ + virtual FocusHandler* _getFocusHandler() A_WARN_UNUSED; + + /** + * Adds an action listener to the widget. When an action event + * is fired by the widget the action listeners of the widget + * will get notified. + * + * @param actionListener The action listener to add. + * @see removeActionListener + * @since 0.1.0 + */ + void addActionListener(ActionListener* actionListener); + + /** + * Removes an added action listener from the widget. + * + * @param actionListener The action listener to remove. + * @see addActionListener + * @since 0.1.0 + */ + void removeActionListener(ActionListener* actionListener); + + /** + * Adds a death listener to the widget. When a death event is + * fired by the widget the death listeners of the widget will + * get notified. + * + * @param deathListener The death listener to add. + * @see removeDeathListener + * @since 0.1.0 + */ + void addDeathListener(DeathListener* deathListener); + + /** + * Removes an added death listener from the widget. + * + * @param deathListener The death listener to remove. + * @see addDeathListener + * @since 0.1.0 + */ + void removeDeathListener(DeathListener* deathListener); + + /** + * Adds a mouse listener to the widget. When a mouse event is + * fired by the widget the mouse listeners of the widget will + * get notified. + * + * @param mouseListener The mouse listener to add. + * @see removeMouseListener + * @since 0.1.0 + */ + void addMouseListener(MouseListener* mouseListener); + + /** + * Removes an added mouse listener from the widget. + * + * @param mouseListener The mouse listener to remove. + * @see addMouseListener + * @since 0.1.0 + */ + void removeMouseListener(MouseListener* mouseListener); + + /** + * Adds a key listener to the widget. When a key event is + * fired by the widget the key listeners of the widget will + * get notified. + * + * @param keyListener The key listener to add. + * @see removeKeyListener + * @since 0.1.0 + */ + void addKeyListener(KeyListener* keyListener); + + /** + * Removes an added key listener from the widget. + * + * @param keyListener The key listener to remove. + * @see addKeyListener + * @since 0.1.0 + */ + void removeKeyListener(KeyListener* keyListener); + + /** + * Adds a focus listener to the widget. When a focus event is + * fired by the widget the key listeners of the widget will + * get notified. + * + * @param focusListener The focus listener to add. + * @see removeFocusListener + * @since 0.7.0 + */ + void addFocusListener(FocusListener* focusListener); + + /** + * Removes an added focus listener from the widget. + * + * @param focusListener The focus listener to remove. + * @see addFocusListener + * @since 0.7.0 + */ + void removeFocusListener(FocusListener* focusListener); + + /** + * Adds a widget listener to the widget. When a widget event is + * fired by the widget the key listeners of the widget will + * get notified. + * + * @param widgetListener The widget listener to add. + * @see removeWidgetListener + * @since 0.8.0 + */ + void addWidgetListener(WidgetListener* widgetListener); + + /** + * Removes an added widget listener from the widget. + * + * @param widgetListener The widget listener to remove. + * @see addWidgetListener + * @since 0.8.0 + */ + void removeWidgetListener(WidgetListener* widgetListener); + + /** + * Sets the action event identifier of the widget. The identifier is + * used to be able to identify which action has occured. + * + * NOTE: An action event identifier should not be used to identify a + * certain widget but rather a certain event in your application. + * Several widgets can have the same action event identifer. + * + * @param actionEventId The action event identifier. + * @see getActionEventId + * @since 0.6.0 + */ + void setActionEventId(const std::string& actionEventId); + + /** + * Gets the action event identifier of the widget. + * + * @return The action event identifier of the widget. + * @see setActionEventId + * @since 0.6.0 + */ + const std::string& getActionEventId() const; + + /** + * Gets the absolute position on the screen for the widget. + * + * @param x The absolute x coordinate will be stored in this parameter. + * @param y The absolute y coordinate will be stored in this parameter. + * @since 0.1.0 + */ + virtual void getAbsolutePosition(int& x, int& y) const; + + /** + * Sets the parent of the widget. A parent must be a BasicContainer. + * + * WARNING: This function is used internally and should not + * be called or overloaded unless you know what you + * are doing. + * + * @param parent The parent of the widget. + * @see getParent + * @since 0.1.0 + */ + virtual void _setParent(Widget* parent); + + /** + * Gets the font set for the widget. If no font has been set, + * the global font will be returned. If no global font has been set, + * the default font will be returend. + * + * @return The font set for the widget. + * @see setFont, setGlobalFont + * @since 0.1.0 + */ + Font *getFont() const A_WARN_UNUSED; + + /** + * Sets the global font to be used by default for all widgets. + * + * @param font The global font. + * @see getGlobalFont + * @since 0.1.0 + */ + static void setGlobalFont(Font* font); + + /** + * Sets the font for the widget. If NULL is passed, the global font + * will be used. + * + * @param font The font to set for the widget. + * @see getFont + * @since 0.1.0 + */ + void setFont(Font* font); + + /** + * Called when the font has changed. If the change is global, + * this function will only be called if the widget doesn't have a + * font already set. + * + * @since 0.1.0 + */ + virtual void fontChanged() + { } + + /** + * Checks if a widget exists or not, that is if it still exists + * an instance of the object. + * + * @param widget The widget to check. + * @return True if an instance of the widget exists, false otherwise. + * @since 0.1.0 + */ + static bool widgetExists(const Widget* widget) A_WARN_UNUSED; + + /** + * Checks if tab in is enabled. Tab in means that you can set focus + * to this widget by pressing the tab button. If tab in is disabled + * then the focus handler will skip this widget and focus the next + * in its focus order. + * + * @return True if tab in is enabled, false otherwise. + * @see setTabInEnabled + * @since 0.1.0 + */ + bool isTabInEnabled() const A_WARN_UNUSED; + + /** + * Sets tab in enabled, or not. Tab in means that you can set focus + * to this widget by pressing the tab button. If tab in is disabled + * then the FocusHandler will skip this widget and focus the next + * in its focus order. + * + * @param enabled True if tab in should be enabled, false otherwise. + * @see isTabInEnabled + * @since 0.1.0 + */ + void setTabInEnabled(bool enabled); + + /** + * Checks if tab out is enabled. Tab out means that you can lose + * focus to this widget by pressing the tab button. If tab out is + * disabled then the FocusHandler ignores tabbing and focus will + * stay with this widget. + * + * @return True if tab out is enabled, false otherwise. + * @see setTabOutEnabled + * @since 0.1.0 + */ + bool isTabOutEnabled() const A_WARN_UNUSED; + + /** + * Sets tab out enabled. Tab out means that you can lose + * focus to this widget by pressing the tab button. If tab out is + * disabled then the FocusHandler ignores tabbing and focus will + * stay with this widget. + * + * @param enabled True if tab out should be enabled, false otherwise. + * @see isTabOutEnabled + * @since 0.1.0 + */ + void setTabOutEnabled(bool enabled); + + /** + * Requests modal focus. When a widget has modal focus, only that + * widget and it's children may recieve input. + * + * @throws Exception if another widget already has modal focus. + * @see releaseModalFocus, isModalFocused + * @since 0.4.0 + */ + virtual void requestModalFocus(); + + /** + * Requests modal mouse input focus. When a widget has modal input focus + * that widget will be the only widget receiving input even if the input + * occurs outside of the widget and no matter what the input is. + * + * @throws Exception if another widget already has modal focus. + * @see releaseModalMouseInputFocus, isModalMouseInputFocused + * @since 0.6.0 + */ + virtual void requestModalMouseInputFocus(); + + /** + * Releases modal focus. Modal focus will only be released if the + * widget has modal focus. + * + * @see requestModalFocus, isModalFocused + * @since 0.4.0 + */ + virtual void releaseModalFocus(); + + /** + * Releases modal mouse input focus. Modal mouse input focus will only + * be released if the widget has modal mouse input focus. + * + * @see requestModalMouseInputFocus, isModalMouseInputFocused + * @since 0.6.0 + */ + virtual void releaseModalMouseInputFocus(); + + /** + * Checks if the widget or it's parent has modal focus. + * + * @return True if the widget has modal focus, false otherwise. + * @see requestModalFocus, releaseModalFocus + * @since 0.8.0 + */ + virtual bool isModalFocused() const A_WARN_UNUSED; + + /** + * Checks if the widget or it's parent has modal mouse input focus. + * + * @return True if the widget has modal mouse input focus, false + * otherwise. + * @see requestModalMouseInputFocus, releaseModalMouseInputFocus + * @since 0.8.0 + */ + virtual bool isModalMouseInputFocused() const A_WARN_UNUSED; + + /** + * Gets a widget from a certain position in the widget. + * This function is used to decide which gets mouse input, + * thus it can be overloaded to change that behaviour. + * + * NOTE: This always returns NULL if the widget is not + * a container. + * + * @param x The x coordinate of the widget to get. + * @param y The y coordinate of the widget to get. + * @return The widget at the specified coodinate, NULL + * if no widget is found. + * @since 0.6.0 + */ + virtual Widget *getWidgetAt(int x, int y) A_WARN_UNUSED; + + /** + * Gets the mouse listeners of the widget. + * + * @return The mouse listeners of the widget. + * @since 0.6.0 + */ + virtual const std::list& _getMouseListeners() + A_WARN_UNUSED; + + /** + * Gets the key listeners of the widget. + * + * @return The key listeners of the widget. + * @since 0.6.0 + */ + virtual const std::list& _getKeyListeners() + A_WARN_UNUSED; + + /** + * Gets the focus listeners of the widget. + * + * @return The focus listeners of the widget. + * @since 0.7.0 + */ + virtual const std::list& _getFocusListeners() + A_WARN_UNUSED; + + /** + * Gets the area of the widget occupied by the widget's children. + * By default this method returns an empty rectangle as not all + * widgets are containers. If you want to make a container this + * method should return the area where the children resides. This + * method is used when drawing children of a widget when computing + * clip rectangles for the children. + * + * An example of a widget that overloads this method is ScrollArea. + * A ScrollArea has a view of its contant and that view is the + * children area. The size of a ScrollArea's children area might + * vary depending on if the scroll bars of the ScrollArea is shown + * or not. + * + * @return The area of the widget occupied by the widget's children. + * @see BasicContainer + * @see BasicContainer::getChildrenArea + * @see BasicContainer::drawChildren + * @since 0.1.0 + */ + virtual Rectangle getChildrenArea() A_WARN_UNUSED; + + /** + * Gets the internal focus handler used. + * + * @return the internalFocusHandler used. If no internal focus handler + * is used, NULL will be returned. + * @see setInternalFocusHandler + * @since 0.1.0 + */ + virtual FocusHandler* _getInternalFocusHandler() A_WARN_UNUSED; + + /** + * Sets the internal focus handler. An internal focus handler is + * needed if both a widget in the widget and the widget itself + * should be foucsed at the same time. + * + * @param focusHandler The internal focus handler to be used. + * @see getInternalFocusHandler + * @since 0.1.0 + */ + void setInternalFocusHandler(FocusHandler* internalFocusHandler); + + /** + * Moves a widget to the top of this widget. The moved widget will be + * drawn above all other widgets in this widget. + * + * @param widget The widget to move to the top. + * @see moveToBottom + * @since 0.1.0 + */ + virtual void moveToTop(Widget* widget A_UNUSED) + { } + + /** + * Moves a widget in this widget to the bottom of this widget. + * The moved widget will be drawn below all other widgets in this widget. + * + * @param widget The widget to move to the bottom. + * @see moveToTop + * @since 0.1.0 + */ + virtual void moveToBottom(Widget* widget A_UNUSED) + { } + + /** + * Focuses the next widget in the widget. + * + * @see moveToBottom + * @since 0.1.0 + */ + virtual void focusNext() + { } + + /** + * Focuses the previous widget in the widget. + * + * @see moveToBottom + * @since 0.1.0 + */ + virtual void focusPrevious() + { } + + /** + * Tries to show a specific part of a widget by moving it. Used if the + * widget should act as a container. + * + * @param widget The target widget. + * @param area The area to show. + * @since 0.1.0 + */ + virtual void showWidgetPart(Widget* widget A_UNUSED, + Rectangle area A_UNUSED) + { } + + /** + * Sets an id of a widget. An id can be useful if a widget needs to be + * identified in a container. For example, if widgets are created by an + * XML document, a certain widget can be retrieved given that the widget + * has an id. + * + * @param id The id to set to the widget. + * @see getId, BasicContainer::findWidgetById + * @since 0.8.0 + */ + void setId(const std::string& id); + + /** + * Gets the id of a widget. An id can be useful if a widget needs to be + * identified in a container. For example, if widgets are created by an + * XML document, a certain widget can be retrieved given that the widget + * has an id. + * + * @param id The id to set to the widget. + * @see setId, BasicContainer::findWidgetById + * @since 0.8.0 + */ + const std::string& getId() A_WARN_UNUSED; + + /** + * Shows a certain part of a widget in the widget's parent. + * Used when widgets want a specific part to be visible in + * its parent. An example is a TextArea that wants a specific + * part of its text to be visible when a TextArea is a child + * of a ScrollArea. + * + * @param rectangle The rectangle to be shown. + * @since 0.8.0 + */ + virtual void showPart(Rectangle rectangle); + + protected: + /** + * Distributes an action event to all action listeners + * of the widget. + * + * @since 0.8.0 + */ + void distributeActionEvent(); + + /** + * Distributes resized events to all of the widget's listeners. + * + * @since 0.8.0 + */ + void distributeResizedEvent(); + + /** + * Distributes moved events to all of the widget's listeners. + * + * @since 0.8.0 + */ + void distributeMovedEvent(); + + /** + * Distributes hidden events to all of the widget's listeners. + * + * @since 0.8.0 + * @author Olof Naessén + */ + void distributeHiddenEvent(); + + /** + * Distributes shown events to all of the widget's listeners. + * + * @since 0.8.0 + * @author Olof Naessén + */ + void distributeShownEvent(); + + /** + * Typdef. + */ + typedef std::list MouseListenerList; + + /** + * Typdef. + */ + typedef MouseListenerList::iterator MouseListenerIterator; + + /** + * Holds the mouse listeners of the widget. + */ + MouseListenerList mMouseListeners; + + /** + * Typdef. + */ + typedef std::list KeyListenerList; + + /** + * Holds the key listeners of the widget. + */ + KeyListenerList mKeyListeners; + + /** + * Typdef. + */ + typedef KeyListenerList::iterator KeyListenerIterator; + + /** + * Typdef. + */ + typedef std::list ActionListenerList; + + /** + * Holds the action listeners of the widget. + */ + ActionListenerList mActionListeners; + + /** + * Typdef. + */ + typedef ActionListenerList::iterator ActionListenerIterator; + + /** + * Typdef. + */ + typedef std::list DeathListenerList; + + /** + * Holds the death listeners of the widget. + */ + DeathListenerList mDeathListeners; + + /** + * Typdef. + */ + typedef DeathListenerList::iterator DeathListenerIterator; + + /** + * Typdef. + */ + typedef std::list FocusListenerList; + + /** + * Holds the focus listeners of the widget. + */ + FocusListenerList mFocusListeners; + + /** + * Typdef. + */ + typedef FocusListenerList::iterator FocusListenerIterator; + + typedef std::list WidgetListenerList; + + /** + * Holds the widget listeners of the widget. + */ + WidgetListenerList mWidgetListeners; + + /** + * Typdef. + */ + typedef WidgetListenerList::iterator WidgetListenerIterator; + + /** + * Holds the foreground color of the widget. + */ + Color mForegroundColor; + + /** + * Holds the background color of the widget. + */ + Color mBackgroundColor; + + /** + * Holds the base color of the widget. + */ + Color mBaseColor; + + /** + * Holds the selection color of the widget. + */ + Color mSelectionColor; + + /** + * Holds the focus handler used by the widget. + */ + FocusHandler* mFocusHandler; + + /** + * Holds the focus handler used by the widget. NULL + * if no internal focus handler is used. + */ + FocusHandler* mInternalFocusHandler; + + /** + * Holds the parent of the widget. NULL if the widget + * has no parent. + */ + Widget* mParent; + + /** + * Holds the dimension of the widget. + */ + Rectangle mDimension; + + /** + * Holds the frame size of the widget. + */ + unsigned int mFrameSize; + + /** + * Holds the action event of the widget. + */ + std::string mActionEventId; + + /** + * True if the widget focusable, false otherwise. + */ + bool mFocusable; + + /** + * True if the widget visible, false otherwise. + */ + bool mVisible; + + /** + * True if the widget has tab in enabled, false otherwise. + */ + bool mTabIn; + + /** + * True if the widget has tab in enabled, false otherwise. + */ + bool mTabOut; + + /** + * True if the widget is enabled, false otherwise. + */ + bool mEnabled; + + /** + * Holds the id of the widget. + */ + std::string mId; + + /** + * Holds the font used by the widget. + */ + Font* mCurrentFont; + + /** + * Holds the global font used by the widget. + */ + static Font* mGlobalFont; + + /** + * Holds a list of all instances of widgets. + */ + static std::list mWidgets; + + static std::set mWidgetsSet; +}; + +#endif // GUI_WIDGETS_WIDGET_H diff --git a/src/gui/widgets/widgetgroup.cpp b/src/gui/widgets/widgetgroup.cpp index 4a0065ca8..07c4df43c 100644 --- a/src/gui/widgets/widgetgroup.cpp +++ b/src/gui/widgets/widgetgroup.cpp @@ -67,7 +67,7 @@ void WidgetGroup::action(const ActionEvent &event) } } -void WidgetGroup::add(gcn::Widget *const widget, const int spacing) +void WidgetGroup::add(Widget *const widget, const int spacing) { if (!widget) return; diff --git a/src/gui/widgets/widgetgroup.h b/src/gui/widgets/widgetgroup.h index 37523fcdc..051234cda 100644 --- a/src/gui/widgets/widgetgroup.h +++ b/src/gui/widgets/widgetgroup.h @@ -42,7 +42,7 @@ class WidgetGroup : public Container, void action(const ActionEvent &event) override; - virtual void add(gcn::Widget *const widget, + virtual void add(Widget *const widget, const int spacing); virtual void clear(); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index cccb1cdc7..8388ae64e 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -343,7 +343,7 @@ void Window::setContentSize(int width, int height) setSize(width, height); } -void Window::setLocationRelativeTo(const gcn::Widget *const widget) +void Window::setLocationRelativeTo(const Widget *const widget) { if (!widget) return; @@ -360,7 +360,7 @@ void Window::setLocationRelativeTo(const gcn::Widget *const widget) - mDimension.height) / 2 - y)); } -void Window::setLocationHorisontallyRelativeTo(const gcn::Widget *const widget) +void Window::setLocationHorisontallyRelativeTo(const Widget *const widget) { if (!widget) return; @@ -1165,7 +1165,7 @@ void Window::clearLayout() } } -LayoutCell &Window::place(const int x, const int y, gcn::Widget *const wg, +LayoutCell &Window::place(const int x, const int y, Widget *const wg, const int w, const int h) { add(wg); diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 10c9123be..50babfce4 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -87,12 +87,12 @@ class Window : public gcn::Window, /** * Sets the location relative to the given widget. */ - void setLocationRelativeTo(const gcn::Widget *const widget); + void setLocationRelativeTo(const Widget *const widget); /** * Sets the location relative to the given widget (only horisontally) */ - void setLocationHorisontallyRelativeTo(const gcn::Widget + void setLocationHorisontallyRelativeTo(const Widget *const widget); /** @@ -370,7 +370,7 @@ class Window : public gcn::Window, /** * Adds a widget to the window and sets it at given cell. */ - LayoutCell &place(const int x, const int y, gcn::Widget *const wg, + LayoutCell &place(const int x, const int y, Widget *const wg, const int w = 1, const int h = 1); /** diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp index 5adde3cae..a9b556410 100644 --- a/src/gui/widgets/windowcontainer.cpp +++ b/src/gui/widgets/windowcontainer.cpp @@ -42,7 +42,7 @@ void WindowContainer::slowLogic() mDeathList.clear(); } -void WindowContainer::scheduleDelete(gcn::Widget *const widget) +void WindowContainer::scheduleDelete(Widget *const widget) { if (widget) mDeathList.push_back(widget); @@ -58,8 +58,8 @@ void WindowContainer::adjustAfterResize(const int oldScreenWidth, } } -void WindowContainer::moveWidgetAfter(gcn::Widget *const after, - gcn::Widget *const widget) +void WindowContainer::moveWidgetAfter(Widget *const after, + Widget *const widget) { const WidgetListIterator widgetIter = std::find( mWidgets.begin(), mWidgets.end(), widget); diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h index d940a4e91..a822fadb5 100644 --- a/src/gui/widgets/windowcontainer.h +++ b/src/gui/widgets/windowcontainer.h @@ -44,7 +44,7 @@ class WindowContainer : public Container * Schedule a widget for deletion. It will be deleted at the start of * the next logic update. */ - void scheduleDelete(gcn::Widget *const widget); + void scheduleDelete(Widget *const widget); /** * Ensures that all visible windows are on the screen after the screen @@ -53,8 +53,8 @@ class WindowContainer : public Container void adjustAfterResize(const int oldScreenWidth, const int oldScreenHeight); - void moveWidgetAfter(gcn::Widget *const before, - gcn::Widget *const widget); + void moveWidgetAfter(Widget *const before, + Widget *const widget); #ifdef USE_PROFILER void draw(Graphics* graphics); @@ -64,7 +64,7 @@ class WindowContainer : public Container /** * List of widgets that are scheduled to be deleted. */ - typedef std::vector Widgets; + typedef std::vector Widgets; typedef Widgets::iterator WidgetIterator; Widgets mDeathList; }; diff --git a/src/gui/windows/botcheckerwindow.cpp b/src/gui/windows/botcheckerwindow.cpp index 3bdebff71..d1fc0e7bd 100644 --- a/src/gui/windows/botcheckerwindow.cpp +++ b/src/gui/windows/botcheckerwindow.cpp @@ -125,7 +125,7 @@ public: continue; const Being *const player = mPlayers.at(r); - gcn::Widget *widget = new Label(this, player->getName()); + Widget *widget = new Label(this, player->getName()); mWidgets.push_back(widget); @@ -235,14 +235,14 @@ public: { } - gcn::Widget *getElementAt(const int row, const int column) const + Widget *getElementAt(const int row, const int column) const { return mWidgets[WIDGET_AT(row, column)]; } void freeWidgets() { - for (std::vector::const_iterator it = mWidgets.begin(); + for (std::vector::const_iterator it = mWidgets.begin(); it != mWidgets.end(); ++it) { delete *it; @@ -253,7 +253,7 @@ public: protected: std::vector mPlayers; - std::vector mWidgets; + std::vector mWidgets; }; diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 12a78ce10..d67c15bf0 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -210,7 +210,7 @@ void CharSelectDialog::postInit() void CharSelectDialog::action(const ActionEvent &event) { // Check if a button of a character was pressed - const gcn::Widget *const sourceParent = event.getSource()->getParent(); + const Widget *const sourceParent = event.getSource()->getParent(); int selected = -1; for (unsigned int i = 0, sz = static_cast( mCharacterEntries.size()); i < sz; ++i) diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 1754ca0bf..acd4c50bd 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -424,7 +424,7 @@ void ChatWindow::adjustTabSize() const ChatTab *const tab = getFocused(); if (tab) { - gcn::Widget *const content = tab->mScrollArea; + Widget *const content = tab->mScrollArea; if (content) { const int contentFrame2 = 2 * content->getFrameSize(); diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index bd6719df9..0b0e6c6de 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -593,7 +593,7 @@ void InventoryWindow::mouseClicked(MouseEvent &event) void InventoryWindow::mouseMoved(MouseEvent &event) { Window::mouseMoved(event); - const gcn::Widget *const src = event.getSource(); + const Widget *const src = event.getSource(); if (src == mSlotsBar || src == mWeightBar) { const int x = event.getX(); diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 86b4b9ba3..3dbfa566d 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -1261,7 +1261,7 @@ public: setVisible(false); } - void show(gcn::Widget *parent) + void show(Widget *parent) { if (!parent) return; -- cgit v1.2.3-70-g09d2