diff options
Diffstat (limited to 'src/guichan')
-rw-r--r-- | src/guichan/defaultfont.cpp | 3 | ||||
-rw-r--r-- | src/guichan/defaultfont.hpp | 6 | ||||
-rw-r--r-- | src/guichan/focuslistener.hpp | 196 | ||||
-rw-r--r-- | src/guichan/keylistener.hpp | 10 | ||||
-rw-r--r-- | src/guichan/mouselistener.hpp | 24 | ||||
-rw-r--r-- | src/guichan/qqq | 75 | ||||
-rw-r--r-- | src/guichan/sdl/sdlgraphics.cpp | 8 | ||||
-rw-r--r-- | src/guichan/sdl/sdlpixel.hpp | 8 | ||||
-rw-r--r-- | src/guichan/widget.cpp | 2 | ||||
-rw-r--r-- | src/guichan/widget.hpp | 14 | ||||
-rw-r--r-- | src/guichan/widgetlistener.hpp | 242 | ||||
-rw-r--r-- | src/guichan/widgets/button.cpp | 6 | ||||
-rw-r--r-- | src/guichan/widgets/button.hpp | 6 | ||||
-rw-r--r-- | src/guichan/widgets/dropdown.cpp | 10 | ||||
-rw-r--r-- | src/guichan/widgets/dropdown.hpp | 6 | ||||
-rw-r--r-- | src/guichan/widgets/tab.cpp | 4 | ||||
-rw-r--r-- | src/guichan/widgets/tab.hpp | 6 | ||||
-rw-r--r-- | src/guichan/widgets/window.cpp | 2 | ||||
-rw-r--r-- | src/guichan/widgets/window.hpp | 6 |
19 files changed, 317 insertions, 317 deletions
diff --git a/src/guichan/defaultfont.cpp b/src/guichan/defaultfont.cpp index d792e727d..aa8f0c24f 100644 --- a/src/guichan/defaultfont.cpp +++ b/src/guichan/defaultfont.cpp @@ -64,7 +64,8 @@ namespace gcn return 8*text.size(); } - int DefaultFont::drawGlyph(Graphics* graphics, unsigned char glyph, int x, int y) + int DefaultFont::drawGlyph(Graphics* graphics, + unsigned char glyph _UNUSED_, int x, int y) { graphics->drawRectangle( Rectangle(x, y, 8, 8)); diff --git a/src/guichan/defaultfont.hpp b/src/guichan/defaultfont.hpp index 430911ca3..9343e96d3 100644 --- a/src/guichan/defaultfont.hpp +++ b/src/guichan/defaultfont.hpp @@ -47,6 +47,12 @@ #include "guichan/font.hpp" #include "guichan/platform.hpp" +#ifdef __GNUC__ +#define _UNUSED_ __attribute__ ((unused)) +#else +#define _UNUSED_ +#endif + namespace gcn { /** diff --git a/src/guichan/focuslistener.hpp b/src/guichan/focuslistener.hpp index 418a6859b..8e3f63d71 100644 --- a/src/guichan/focuslistener.hpp +++ b/src/guichan/focuslistener.hpp @@ -1,95 +1,101 @@ -/* _______ __ __ __ ______ __ __ _______ __ __
- * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
- * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
- * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
- * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
- * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
- * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
- *
- * 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 <string>
-
-#include "guichan/event.hpp"
-#include "guichan/platform.hpp"
-
-namespace gcn
-{
- /**
- * Interface for listening for focus events from widgets.
- *
- * @see Widget::addFocusListener, Widget::removeFocusListener
- * @author Olof Naessén
- * @since 0.7.0
- */
- class GCN_CORE_DECLSPEC FocusListener
- {
- public:
-
- /**
- * Destructor.
- */
- virtual ~FocusListener() { }
-
- /**
- * Called when a widget gains focus.
- *
- * @param event Discribes the event.
- */
- virtual void focusGained(const Event& event) { };
-
- /**
- * Called when a widget loses focus.
- *
- * @param event Discribes the event.
- */
- virtual void focusLost(const Event& event) { };
-
- protected:
- /**
- * Constructor.
- *
- * You should not be able to make an instance of FocusListener,
- * therefore its constructor is protected.
- */
- FocusListener() { }
- };
-}
-
-#endif // end GCN_FOCUSLISTENER_HPP
+/* _______ __ __ __ ______ __ __ _______ __ __ + * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ + * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / + * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / + * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / + * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / + * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ + * + * 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 <string> + +#include "guichan/event.hpp" +#include "guichan/platform.hpp" + +#ifdef __GNUC__ +#define _UNUSED_ __attribute__ ((unused)) +#else +#define _UNUSED_ +#endif + +namespace gcn +{ + /** + * Interface for listening for focus events from widgets. + * + * @see Widget::addFocusListener, Widget::removeFocusListener + * @author Olof Naessén + * @since 0.7.0 + */ + class GCN_CORE_DECLSPEC FocusListener + { + public: + + /** + * Destructor. + */ + virtual ~FocusListener() { } + + /** + * Called when a widget gains focus. + * + * @param event Discribes the event. + */ + virtual void focusGained(const Event& event _UNUSED_) { }; + + /** + * Called when a widget loses focus. + * + * @param event Discribes the event. + */ + virtual void focusLost(const Event& event _UNUSED_) { }; + + protected: + /** + * Constructor. + * + * You should not be able to make an instance of FocusListener, + * therefore its constructor is protected. + */ + FocusListener() { } + }; +} + +#endif // end GCN_FOCUSLISTENER_HPP diff --git a/src/guichan/keylistener.hpp b/src/guichan/keylistener.hpp index 7685558bd..caeed0da4 100644 --- a/src/guichan/keylistener.hpp +++ b/src/guichan/keylistener.hpp @@ -47,6 +47,12 @@ #include "guichan/keyevent.hpp" #include "guichan/platform.hpp" +#ifdef __GNUC__ +#define _UNUSED_ __attribute__ ((unused)) +#else +#define _UNUSED_ +#endif + namespace gcn { class Key; @@ -72,14 +78,14 @@ namespace gcn * * @param keyEvent Discribes the event. */ - virtual void keyPressed(KeyEvent& keyEvent) { } + virtual void keyPressed(KeyEvent& keyEvent _UNUSED_) { } /** * Called if a key is released when the widget has keyboard focus. * * @param keyEvent Discribes the event. */ - virtual void keyReleased(KeyEvent& keyEvent) { } + virtual void keyReleased(KeyEvent& keyEvent _UNUSED_) { } protected: /** diff --git a/src/guichan/mouselistener.hpp b/src/guichan/mouselistener.hpp index 345a66531..152d3494e 100644 --- a/src/guichan/mouselistener.hpp +++ b/src/guichan/mouselistener.hpp @@ -47,6 +47,12 @@ #include "guichan/mouseevent.hpp" #include "guichan/platform.hpp" +#ifdef __GNUC__ +#define _UNUSED_ __attribute__ ((unused)) +#else +#define _UNUSED_ +#endif + namespace gcn { /** @@ -70,7 +76,7 @@ namespace gcn * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseEntered(MouseEvent& mouseEvent) + virtual void mouseEntered(MouseEvent& mouseEvent _UNUSED_) { } @@ -81,7 +87,7 @@ namespace gcn * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseExited(MouseEvent& mouseEvent) + virtual void mouseExited(MouseEvent& mouseEvent _UNUSED_) { } @@ -95,7 +101,7 @@ namespace gcn * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mousePressed(MouseEvent& mouseEvent) + virtual void mousePressed(MouseEvent& mouseEvent _UNUSED_) { } @@ -106,7 +112,7 @@ namespace gcn * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseReleased(MouseEvent& mouseEvent) + virtual void mouseReleased(MouseEvent& mouseEvent _UNUSED_) { } @@ -118,7 +124,7 @@ namespace gcn * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseClicked(MouseEvent& mouseEvent) + virtual void mouseClicked(MouseEvent& mouseEvent _UNUSED_) { } @@ -129,7 +135,7 @@ namespace gcn * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseWheelMovedUp(MouseEvent& mouseEvent) + virtual void mouseWheelMovedUp(MouseEvent& mouseEvent _UNUSED_) { } @@ -140,7 +146,7 @@ namespace gcn * @param mousEvent Describes the event. * @since 0.6.0 */ - virtual void mouseWheelMovedDown(MouseEvent& mouseEvent) + virtual void mouseWheelMovedDown(MouseEvent& mouseEvent _UNUSED_) { } @@ -152,7 +158,7 @@ namespace gcn * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseMoved(MouseEvent& mouseEvent) + virtual void mouseMoved(MouseEvent& mouseEvent _UNUSED_) { } @@ -164,7 +170,7 @@ namespace gcn * @param mouseEvent Describes the event. * @since 0.6.0 */ - virtual void mouseDragged(MouseEvent& mouseEvent) + virtual void mouseDragged(MouseEvent& mouseEvent _UNUSED_) { } diff --git a/src/guichan/qqq b/src/guichan/qqq deleted file mode 100644 index 54615aa81..000000000 --- a/src/guichan/qqq +++ /dev/null @@ -1,75 +0,0 @@ -actionevent.cpp -actionevent.hpp -actionlistener.hpp -basiccontainer.cpp -basiccontainer.hpp -cliprectangle.cpp -cliprectangle.hpp -color.cpp -color.hpp -event.cpp -event.hpp -exception.cpp -exception.hpp -focushandler.cpp -focushandler.hpp -focuslistener.hpp -font.cpp -font.hpp -graphics.cpp -graphics.hpp -gui.cpp -gui.hpp -image.cpp -image.hpp -imageloader.hpp -input.hpp -key.hpp -keyinput.hpp -keylistener.hpp -listmodel.hpp -mouseevent.cpp -mouseevent.hpp -mouseinput.cpp -mouseinput.hpp -mouselistener.hpp -platform.hpp -rectangle.cpp -rectangle.hpp -selectionevent.cpp -selectionevent.hpp -widget.cpp -widget.hpp -widgetlistener.hpp -widgets/button.cpp -widgets/button.hpp -widgets/checkbox.cpp -widgets/checkbox.hpp -widgets/container.cpp -widgets/container.hpp -widgets/dropdown.cpp -widgets/dropdown.hpp -widgets/icon.cpp -widgets/icon.hpp -widgets/imagebutton.cpp -widgets/imagebutton.hpp -widgets/label.cpp -widgets/label.hpp -widgets/listbox.cpp -widgets/listbox.hpp -widgets/radiobutton.cpp -widgets/radiobutton.hpp -widgets/scrollarea.cpp -widgets/scrollarea.hpp -widgets/slider.cpp -widgets/slider.hpp -widgets/tabbedarea.cpp -widgets/tabbedarea.hpp -widgets/tab.cpp -widgets/tab.hpp -widgets/textbox.cpp -widgets/textbox.hpp -widgets/textfield.cpp -widgets/textfield.hpp -widgets/window.cpp -widgets/window.hpp diff --git a/src/guichan/sdl/sdlgraphics.cpp b/src/guichan/sdl/sdlgraphics.cpp index 8c4504a59..c64018755 100644 --- a/src/guichan/sdl/sdlgraphics.cpp +++ b/src/guichan/sdl/sdlgraphics.cpp @@ -353,6 +353,8 @@ namespace gcn } break; } + default: + break; } // end switch @@ -413,7 +415,7 @@ namespace gcn Uint32 pixel = SDL_MapRGB(mTarget->format, mColor.r, mColor.g, mColor.b); switch(bpp) - { + { case 1: for (;y1 <= y2; ++y1) { @@ -467,7 +469,9 @@ namespace gcn p += mTarget->pitch; } break; - + + default: + break; } // end switch SDL_UnlockSurface(mTarget); diff --git a/src/guichan/sdl/sdlpixel.hpp b/src/guichan/sdl/sdlpixel.hpp index 49686ebc1..a5d9ca5a1 100644 --- a/src/guichan/sdl/sdlpixel.hpp +++ b/src/guichan/sdl/sdlpixel.hpp @@ -93,6 +93,9 @@ namespace gcn color = *(Uint32 *)p; break; + default: + color = *p; + break; } unsigned char r,g,b,a; @@ -148,6 +151,9 @@ namespace gcn case 4: *(Uint32 *)p = pixel; break; + + default: + break; } SDL_UnlockSurface(surface); @@ -251,6 +257,8 @@ namespace gcn case 4: *(Uint32 *)p = SDLAlpha32(pixel, *(Uint32 *)p, color.a); break; + default: + break; } SDL_UnlockSurface(surface); diff --git a/src/guichan/widget.cpp b/src/guichan/widget.cpp index 7dfc7e10d..f5ccabffe 100644 --- a/src/guichan/widget.cpp +++ b/src/guichan/widget.cpp @@ -626,7 +626,7 @@ namespace gcn return mFocusHandler->getModalMouseInputFocused() == this; } - Widget *Widget::getWidgetAt(int x, int y) + Widget *Widget::getWidgetAt(int x _UNUSED_, int y _UNUSED_) { return NULL; } diff --git a/src/guichan/widget.hpp b/src/guichan/widget.hpp index e702ffd62..0f8c803ca 100644 --- a/src/guichan/widget.hpp +++ b/src/guichan/widget.hpp @@ -50,6 +50,12 @@ #include "guichan/color.hpp" #include "guichan/rectangle.hpp" +#ifdef __GNUC__ +#define _UNUSED_ __attribute__ ((unused)) +#else +#define _UNUSED_ +#endif + namespace gcn { class ActionListener; @@ -887,7 +893,7 @@ namespace gcn * @see moveToBottom * @since 0.1.0 */ - virtual void moveToTop(Widget* widget) { }; + virtual void moveToTop(Widget* widget _UNUSED_) { }; /** * Moves a widget in this widget to the bottom of this widget. @@ -897,7 +903,7 @@ namespace gcn * @see moveToTop * @since 0.1.0 */ - virtual void moveToBottom(Widget* widget) { }; + virtual void moveToBottom(Widget* widget _UNUSED_) { }; /** * Focuses the next widget in the widget. @@ -923,7 +929,9 @@ namespace gcn * @param area The area to show. * @since 0.1.0 */ - virtual void showWidgetPart(Widget* widget, Rectangle area) { }; + virtual void showWidgetPart(Widget* widget _UNUSED_, + Rectangle area _UNUSED_) + { }; /** * Sets an id of a widget. An id can be useful if a widget needs to be diff --git a/src/guichan/widgetlistener.hpp b/src/guichan/widgetlistener.hpp index 5519761a5..eb1f838ec 100644 --- a/src/guichan/widgetlistener.hpp +++ b/src/guichan/widgetlistener.hpp @@ -1,118 +1,124 @@ -/* _______ __ __ __ ______ __ __ _______ __ __
- * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
- * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
- * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
- * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
- * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
- * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
- *
- * 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_WIDGETLISTENER_HPP
-#define GCN_WIDGETLISTENER_HPP
-
-#include <string>
-
-#include "guichan/event.hpp"
-#include "guichan/platform.hpp"
-
-namespace gcn
-{
- /**
- * Interface for listening for events from widgets. When a widget's size,
- * location or visibility changes, the relevant method of the listener is
- * invoked.
- *
- * @see Widget::addWidgetListener, Widget::removeWidgetListener
- * @author Olof Naessén
- * @since 0.8.0
- */
- class GCN_CORE_DECLSPEC WidgetListener
- {
- public:
-
- /**
- * Destructor.
- */
- virtual ~WidgetListener() { }
-
- /**
- * Invoked when a widget changes its size.
- *
- * @param event Describes the event.
- * @since 0.8.0
- */
- virtual void widgetResized(const Event& event) { }
-
- /**
- * Invoked when a widget is moved.
- *
- * @param event Describes the event.
- * @since 0.8.0
- */
- virtual void widgetMoved(const Event& event) { }
-
- /**
- * Invoked when a widget is hidden, i.e it's set to be
- * not visible.
- *
- * @param event Describes the event.
- * @since 0.8.0
- */
- virtual void widgetHidden(const Event& event) { }
-
- /**
- * Invoked when a widget is shown, i.e it's set to be
- * visible.
- *
- * @param event Describes the event.
- * @since 0.8.0
- */
- virtual void widgetShown(const Event& event) { }
-
- protected:
- /**
- * Constructor.
- *
- * You should not be able to make an instance of WidgetListener,
- * therefore its constructor is protected.
- */
- WidgetListener() { }
-
- };
-}
-
-#endif // end GCN_WIDGETLISTENER_HPP
+/* _______ __ __ __ ______ __ __ _______ __ __ + * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ + * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / + * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / + * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / + * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / + * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ + * + * 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_WIDGETLISTENER_HPP +#define GCN_WIDGETLISTENER_HPP + +#include <string> + +#include "guichan/event.hpp" +#include "guichan/platform.hpp" + +#ifdef __GNUC__ +#define _UNUSED_ __attribute__ ((unused)) +#else +#define _UNUSED_ +#endif + +namespace gcn +{ + /** + * Interface for listening for events from widgets. When a widget's size, + * location or visibility changes, the relevant method of the listener is + * invoked. + * + * @see Widget::addWidgetListener, Widget::removeWidgetListener + * @author Olof Naessén + * @since 0.8.0 + */ + class GCN_CORE_DECLSPEC WidgetListener + { + public: + + /** + * Destructor. + */ + virtual ~WidgetListener() { } + + /** + * Invoked when a widget changes its size. + * + * @param event Describes the event. + * @since 0.8.0 + */ + virtual void widgetResized(const Event& event _UNUSED_) { } + + /** + * Invoked when a widget is moved. + * + * @param event Describes the event. + * @since 0.8.0 + */ + virtual void widgetMoved(const Event& event _UNUSED_) { } + + /** + * Invoked when a widget is hidden, i.e it's set to be + * not visible. + * + * @param event Describes the event. + * @since 0.8.0 + */ + virtual void widgetHidden(const Event& event _UNUSED_) { } + + /** + * Invoked when a widget is shown, i.e it's set to be + * visible. + * + * @param event Describes the event. + * @since 0.8.0 + */ + virtual void widgetShown(const Event& event _UNUSED_) { } + + protected: + /** + * Constructor. + * + * You should not be able to make an instance of WidgetListener, + * therefore its constructor is protected. + */ + WidgetListener() { } + + }; +} + +#endif // end GCN_WIDGETLISTENER_HPP diff --git a/src/guichan/widgets/button.cpp b/src/guichan/widgets/button.cpp index 199f5c96e..96e64406e 100644 --- a/src/guichan/widgets/button.cpp +++ b/src/guichan/widgets/button.cpp @@ -218,12 +218,12 @@ namespace gcn } } - void Button::mouseExited(MouseEvent& mouseEvent) + void Button::mouseExited(MouseEvent& mouseEvent _UNUSED_) { mHasMouse = false; } - void Button::mouseEntered(MouseEvent& mouseEvent) + void Button::mouseEntered(MouseEvent& mouseEvent _UNUSED_) { mHasMouse = true; } @@ -276,7 +276,7 @@ namespace gcn } } - void Button::focusLost(const Event& event) + void Button::focusLost(const Event& event _UNUSED_) { mMousePressed = false; mKeyPressed = false; diff --git a/src/guichan/widgets/button.hpp b/src/guichan/widgets/button.hpp index cfe097327..05b961b1e 100644 --- a/src/guichan/widgets/button.hpp +++ b/src/guichan/widgets/button.hpp @@ -54,6 +54,12 @@ #include "guichan/platform.hpp" #include "guichan/widget.hpp" +#ifdef __GNUC__ +#define _UNUSED_ __attribute__ ((unused)) +#else +#define _UNUSED_ +#endif + namespace gcn { /** diff --git a/src/guichan/widgets/dropdown.cpp b/src/guichan/widgets/dropdown.cpp index ad0a14cf5..13feaa1f7 100644 --- a/src/guichan/widgets/dropdown.cpp +++ b/src/guichan/widgets/dropdown.cpp @@ -475,7 +475,7 @@ namespace gcn } } - void DropDown::focusLost(const Event& event) + void DropDown::focusLost(const Event& event _UNUSED_) { foldUp(); mInternalFocusHandler.focusNone(); @@ -492,7 +492,7 @@ namespace gcn BasicContainer::death(event); } - void DropDown::action(const ActionEvent& actionEvent) + void DropDown::action(const ActionEvent& actionEvent _UNUSED_) { foldUp(); releaseModalMouseInputFocus(); @@ -599,14 +599,14 @@ namespace gcn void DropDown::setSelectionColor(const Color& color) { Widget::setSelectionColor(color); - + if (mInternalListBox) { mListBox->setSelectionColor(color); - } + } } - void DropDown::valueChanged(const SelectionEvent& event) + void DropDown::valueChanged(const SelectionEvent& event _UNUSED_) { distributeValueChangedEvent(); } diff --git a/src/guichan/widgets/dropdown.hpp b/src/guichan/widgets/dropdown.hpp index 090fff0ce..4a0993b1a 100644 --- a/src/guichan/widgets/dropdown.hpp +++ b/src/guichan/widgets/dropdown.hpp @@ -57,6 +57,12 @@ #include "guichan/widgets/listbox.hpp" #include "guichan/widgets/scrollarea.hpp" +#ifdef __GNUC__ +#define _UNUSED_ __attribute__ ((unused)) +#else +#define _UNUSED_ +#endif + namespace gcn { /** * An implementation of a drop downable list from which an item can be diff --git a/src/guichan/widgets/tab.cpp b/src/guichan/widgets/tab.cpp index 8ba122b26..f6283dfe6 100644 --- a/src/guichan/widgets/tab.cpp +++ b/src/guichan/widgets/tab.cpp @@ -168,12 +168,12 @@ namespace gcn graphics->popClipArea(); } - void Tab::mouseEntered(MouseEvent& mouseEvent) + void Tab::mouseEntered(MouseEvent& mouseEvent _UNUSED_) { mHasMouse = true; } - void Tab::mouseExited(MouseEvent& mouseEvent) + void Tab::mouseExited(MouseEvent& mouseEvent _UNUSED_) { mHasMouse = false; } diff --git a/src/guichan/widgets/tab.hpp b/src/guichan/widgets/tab.hpp index bf89afccb..d123bac15 100644 --- a/src/guichan/widgets/tab.hpp +++ b/src/guichan/widgets/tab.hpp @@ -51,6 +51,12 @@ #include "guichan/mouselistener.hpp" #include "guichan/platform.hpp" +#ifdef __GNUC__ +#define _UNUSED_ __attribute__ ((unused)) +#else +#define _UNUSED_ +#endif + namespace gcn { class Label; diff --git a/src/guichan/widgets/window.cpp b/src/guichan/widgets/window.cpp index 2ac4d553b..d73d2339b 100644 --- a/src/guichan/widgets/window.cpp +++ b/src/guichan/widgets/window.cpp @@ -236,7 +236,7 @@ namespace gcn mMoved = mouseEvent.getY() <= (int)mTitleBarHeight; } - void Window::mouseReleased(MouseEvent& mouseEvent) + void Window::mouseReleased(MouseEvent& mouseEvent _UNUSED_) { mMoved = false; } diff --git a/src/guichan/widgets/window.hpp b/src/guichan/widgets/window.hpp index 373efd164..63685c7fb 100644 --- a/src/guichan/widgets/window.hpp +++ b/src/guichan/widgets/window.hpp @@ -50,6 +50,12 @@ #include "guichan/platform.hpp" #include "guichan/widgets/container.hpp" +#ifdef __GNUC__ +#define _UNUSED_ __attribute__ ((unused)) +#else +#define _UNUSED_ +#endif + namespace gcn { /** |