From 892424cc005d41b8976ae9193a3a4161b5c1950f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 2 Dec 2014 12:44:30 +0300 Subject: Rename DeathListener into WidgetDeathListener. --- src/CMakeLists.txt | 2 +- src/Makefile.am | 2 +- src/gui/widgets/basiccontainer.h | 8 +-- src/gui/widgets/widget.cpp | 8 +-- src/gui/widgets/widget.h | 12 ++-- src/listeners/deathlistener.h | 106 ------------------------------------ src/listeners/widgetdeathlistener.h | 106 ++++++++++++++++++++++++++++++++++++ 7 files changed, 122 insertions(+), 122 deletions(-) delete mode 100644 src/listeners/deathlistener.h create mode 100644 src/listeners/widgetdeathlistener.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b4ede1dd9..7b704787e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1091,9 +1091,9 @@ SET(SRCS gui/color.h gui/colorpair.h gui/dialogtype.h - listeners/deathlistener.h listeners/errorlistener.cpp listeners/errorlistener.h + listeners/widgetdeathlistener.h events/event.h listeners/focuslistener.h listeners/guiconfiglistener.h diff --git a/src/Makefile.am b/src/Makefile.am index 1631dda65..2660d26bb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -181,9 +181,9 @@ manaplus_SOURCES += events/actionevent.h \ gui/cliprect.h \ gui/color.h \ gui/dialogtype.h \ - listeners/deathlistener.h \ listeners/errorlistener.cpp \ listeners/errorlistener.h \ + listeners/widgetdeathlistener.h \ events/event.h \ listeners/focuslistener.h \ listeners/guiconfiglistener.h \ diff --git a/src/gui/widgets/basiccontainer.h b/src/gui/widgets/basiccontainer.h index 47fa2abc1..cfbfb8931 100644 --- a/src/gui/widgets/basiccontainer.h +++ b/src/gui/widgets/basiccontainer.h @@ -69,7 +69,7 @@ #include "gui/widgets/widget.h" -#include "listeners/deathlistener.h" +#include "listeners/widgetdeathlistener.h" /** * A base class for containers. The class implements the most @@ -80,12 +80,12 @@ * @since 0.6.0 */ class BasicContainer notfinal : public Widget, - public DeathListener + public WidgetDeathListener { public: explicit BasicContainer(const Widget2 *const widget) : Widget(widget), - DeathListener(), + WidgetDeathListener(), mWidgets(), mLogicWidgets() { } @@ -131,7 +131,7 @@ class BasicContainer notfinal : public Widget, virtual Widget *getWidgetAt(int x, int y) override A_WARN_UNUSED; - // Inherited from DeathListener + // Inherited from WidgetDeathListener virtual void death(const Event& event) override; diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp index 43c8df92f..68b97ece2 100644 --- a/src/gui/widgets/widget.cpp +++ b/src/gui/widgets/widget.cpp @@ -74,7 +74,7 @@ #include "gui/focushandler.h" #include "listeners/actionlistener.h" -#include "listeners/deathlistener.h" +#include "listeners/widgetdeathlistener.h" #include "listeners/widgetlistener.h" #include "debug.h" @@ -117,7 +117,7 @@ Widget::Widget(const Widget2 *const widget) : Widget::~Widget() { - FOR_EACH (DeathListenerIterator, iter, mDeathListeners) + FOR_EACH (WidgetDeathListenerIterator, iter, mDeathListeners) { Event event(this); (*iter)->death(event); @@ -258,12 +258,12 @@ void Widget::removeActionListener(ActionListener *const actionListener) mActionListeners.remove(actionListener); } -void Widget::addDeathListener(DeathListener *const deathListener) +void Widget::addDeathListener(WidgetDeathListener *const deathListener) { mDeathListeners.push_back(deathListener); } -void Widget::removeDeathListener(DeathListener *const deathListener) +void Widget::removeDeathListener(WidgetDeathListener *const deathListener) { mDeathListeners.remove(deathListener); } diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h index 8109d142d..c4d30e492 100644 --- a/src/gui/widgets/widget.h +++ b/src/gui/widgets/widget.h @@ -76,7 +76,7 @@ #include "localconsts.h" class ActionListener; -class DeathListener; +class WidgetDeathListener; class FocusHandler; class FocusListener; class Font; @@ -532,7 +532,7 @@ class Widget notfinal : public Widget2 * @see removeDeathListener * @since 0.1.0 */ - void addDeathListener(DeathListener *const deathListener); + void addDeathListener(WidgetDeathListener *const deathListener); /** * Removes an added death listener from the widget. @@ -541,7 +541,7 @@ class Widget notfinal : public Widget2 * @see addDeathListener * @since 0.1.0 */ - void removeDeathListener(DeathListener *const deathListener); + void removeDeathListener(WidgetDeathListener *const deathListener); /** * Adds a mouse listener to the widget. When a mouse event is @@ -1112,17 +1112,17 @@ class Widget notfinal : public Widget2 /** * Typdef. */ - typedef std::list DeathListenerList; + typedef std::list WidgetDeathListenerList; /** * Holds the death listeners of the widget. */ - DeathListenerList mDeathListeners; + WidgetDeathListenerList mDeathListeners; /** * Typdef. */ - typedef DeathListenerList::iterator DeathListenerIterator; + typedef WidgetDeathListenerList::iterator WidgetDeathListenerIterator; /** * Typdef. diff --git a/src/listeners/deathlistener.h b/src/listeners/deathlistener.h deleted file mode 100644 index 940a623b1..000000000 --- a/src/listeners/deathlistener.h +++ /dev/null @@ -1,106 +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 LISTENERS_DEATHLISTENER_H -#define LISTENERS_DEATHLISTENER_H - -#include - -#include "events/event.h" - -/** - * Interface for listening for death events from widgets. - * - * @see Widget::addDeathListener, Widget::removeDeathListener - * @author Olof Naessén - * @since 0.6.0 - */ -class DeathListener notfinal -{ - public: - /** - * Destructor. - */ - virtual ~DeathListener() - { } - - /** - * Called when a widget dies. It is used to be able to recieve - * a notification when a death of a widget occurs. - * - * @param event The event of the death. - */ - virtual void death(const Event &event) = 0; - - protected: - /** - * Constructor. - * - * You should not be able to make an instance of DeathListener, - * therefore its constructor is protected. - */ - DeathListener() - { } -}; - -#endif // LISTENERS_DEATHLISTENER_H diff --git a/src/listeners/widgetdeathlistener.h b/src/listeners/widgetdeathlistener.h new file mode 100644 index 000000000..b51e28fb5 --- /dev/null +++ b/src/listeners/widgetdeathlistener.h @@ -0,0 +1,106 @@ +/* + * 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 LISTENERS_WIDGETDEATHLISTENER_H +#define LISTENERS_WIDGETDEATHLISTENER_H + +#include + +#include "events/event.h" + +/** + * Interface for listening for death events from widgets. + * + * @see Widget::addDeathListener, Widget::removeDeathListener + * @author Olof Naessén + * @since 0.6.0 + */ +class WidgetDeathListener notfinal +{ + public: + /** + * Destructor. + */ + virtual ~WidgetDeathListener() + { } + + /** + * Called when a widget dies. It is used to be able to recieve + * a notification when a death of a widget occurs. + * + * @param event The event of the death. + */ + virtual void death(const Event &event) = 0; + + protected: + /** + * Constructor. + * + * You should not be able to make an instance of DeathListener, + * therefore its constructor is protected. + */ + WidgetDeathListener() + { } +}; + +#endif // LISTENERS_WIDGETDEATHLISTENER_H -- cgit v1.2.3-70-g09d2