From 01d93aedcc4d1632ff5915c3989a502ec31cd978 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 15 Feb 2014 23:40:05 +0300 Subject: move focuslistener from base into listeners. --- src/gui/base/focushandler.cpp | 3 +- src/gui/base/focuslistener.hpp | 119 ---------------------------------------- src/gui/base/widget.hpp | 2 +- src/gui/base/widgets/button.cpp | 4 +- src/gui/base/widgets/button.hpp | 5 +- 5 files changed, 8 insertions(+), 125 deletions(-) delete mode 100644 src/gui/base/focuslistener.hpp (limited to 'src/gui/base') diff --git a/src/gui/base/focushandler.cpp b/src/gui/base/focushandler.cpp index 6984d1fcd..ff149bf99 100644 --- a/src/gui/base/focushandler.cpp +++ b/src/gui/base/focushandler.cpp @@ -67,10 +67,11 @@ #include "gui/base/focushandler.hpp" -#include "gui/base/focuslistener.hpp" #include "gui/base/exception.hpp" #include "gui/base/widget.hpp" +#include "listeners/focuslistener.h" + #include "debug.h" namespace gcn diff --git a/src/gui/base/focuslistener.hpp b/src/gui/base/focuslistener.hpp deleted file mode 100644 index f6a7da5ea..000000000 --- a/src/gui/base/focuslistener.hpp +++ /dev/null @@ -1,119 +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_FOCUSLISTENER_HPP -#define GCN_FOCUSLISTENER_HPP - -#include - -#include "gui/base/event.hpp" - -#include "localconsts.h" - -namespace gcn -{ - /** - * Interface for listening for focus events from widgets. - * - * @see Widget::addFocusListener, Widget::removeFocusListener - * @author Olof Naessén - * @since 0.7.0 - */ - class FocusListener - { - public: - /** - * Destructor. - */ - virtual ~FocusListener() - { } - - /** - * Called when a widget gains focus. - * - * @param event Discribes the event. - */ - virtual void focusGained(const Event& event A_UNUSED) - { } - - /** - * Called when a widget loses focus. - * - * @param event Discribes the event. - */ - virtual void focusLost(const Event& event A_UNUSED) - { } - - protected: - /** - * Constructor. - * - * You should not be able to make an instance of FocusListener, - * therefore its constructor is protected. - */ - FocusListener() - { } - }; -} // namespace gcn - -#endif // end GCN_FOCUSLISTENER_HPP diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp index b896ac1e9..a6dc2ed13 100644 --- a/src/gui/base/widget.hpp +++ b/src/gui/base/widget.hpp @@ -75,13 +75,13 @@ class ActionListener; class DeathListener; +class FocusListener; class Graphics; namespace gcn { class BasicContainer; class FocusHandler; - class FocusListener; class Font; class KeyInput; class KeyListener; diff --git a/src/gui/base/widgets/button.cpp b/src/gui/base/widgets/button.cpp index 3e699670a..82ff878a0 100644 --- a/src/gui/base/widgets/button.cpp +++ b/src/gui/base/widgets/button.cpp @@ -83,7 +83,7 @@ namespace gcn gcn::Widget(), gcn::MouseListener(), gcn::KeyListener(), - gcn::FocusListener(), + FocusListener(), mCaption(), mHasMouse(false), mKeyPressed(false), @@ -104,7 +104,7 @@ namespace gcn gcn::Widget(), gcn::MouseListener(), gcn::KeyListener(), - gcn::FocusListener(), + FocusListener(), mCaption(caption), mHasMouse(false), mKeyPressed(false), diff --git a/src/gui/base/widgets/button.hpp b/src/gui/base/widgets/button.hpp index cd41a1b02..e2d6c0c8e 100644 --- a/src/gui/base/widgets/button.hpp +++ b/src/gui/base/widgets/button.hpp @@ -66,10 +66,11 @@ #include -#include "gui/base/focuslistener.hpp" +#include "listeners/focuslistener.h" #include "gui/base/keylistener.hpp" -#include "gui/base/mouseevent.hpp" #include "gui/base/mouselistener.hpp" + +#include "gui/base/mouseevent.hpp" #include "gui/base/widget.hpp" #include "render/graphics.h" -- cgit v1.2.3-70-g09d2