actionevent.hpp   actionevent.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_ACTIONEVENT_HPP #ifndef GCN_ACTIONEVENT_HPP
#define GCN_ACTIONEVENT_HPP #define GCN_ACTIONEVENT_HPP
#include "guichan/event.hpp" #include "guichan/event.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include <string> #include <string>
namespace gcn namespace gcn
{ {
class Widget; class Widget;
/** /**
* Represents an action event. * Represents an action event. An action event is an event
* that can be fired by a widget whenever an action has occured.
* What exactly an action is is up to the widget that fires
* the action event. An example is a Button which fires an action
* event as soon as the Button is clicked, another example is
* TextField which fires an action event as soon as the enter
* key is pressed.
*
* Any object can listen for actions from widgets by implementing
* the ActionListener interface.
*
* If you have implement a widget of your own it's a good idea to
* let the widget fire action events whenever you feel an action
* has occured so action listeners of the widget can be informed
* of the state of the widget.
* *
* @see Widget::addActionListener, Widget::removeActionListener,
* Widget::distributeActionEvent
* @author Olof Naess * @author Olof Naess
* @since 0.6.0 * @since 0.6.0
*/ */
class GCN_CORE_DECLSPEC ActionEvent: public Event class GCN_CORE_DECLSPEC ActionEvent: public Event
{ {
public: public:
/** /**
* Constructor. * Constructor.
* *
* @param source the source widget of the event. * @param source The source widget of the event.
* @param id the identifier of the event. * @param id An identifier of the event.
*/ */
ActionEvent(Widget* source, const std::string& id); ActionEvent(Widget* source, const std::string& id);
/** /**
* Destructor. * Destructor.
*/ */
virtual ~ActionEvent(); virtual ~ActionEvent();
/** /**
* Gets the id of the event. * Gets the identifier of the event. An identifier can
* be used to distinguish from two actions from the same
* widget or to let many widgets fire the same widgets
* that should be treated equally.
* *
* @return the id of the event. * @return The identifier of the event.
*/ */
const std::string& getId() const; const std::string& getId() const;
protected: protected:
/**
* Holds the identifier of the event.
*/
std::string mId; std::string mId;
}; };
} }
#endif // GCN_ACTIONEVENT_HPP #endif // GCN_ACTIONEVENT_HPP
 End of changes. 8 change blocks. 
50 lines changed or deleted 59 lines changed or added


 actionlistener.hpp   actionlistener.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_ACTIONLISTENER_HPP #ifndef GCN_ACTIONLISTENER_HPP
#define GCN_ACTIONLISTENER_HPP #define GCN_ACTIONLISTENER_HPP
#include <string> #include <string>
#include "guichan/actionevent.hpp" #include "guichan/actionevent.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/** /**
* Listener of action events from Widgets. To be able to * Interface for listening for action events from widgets.
* listen for actions you must make a class which inherits
* from this class and implements the action function.
* *
* @see Widget::addActionListener * @see Widget::addActionListener, Widget::removeActionListener,
* ActionEvent
* @author Olof Naess * @author Olof Naess
* @author Per Larsson * @author Per Larsson
*/ */
class GCN_CORE_DECLSPEC ActionListener class GCN_CORE_DECLSPEC ActionListener
{ {
public: public:
/** /**
* Destructor. * Destructor.
*/ */
virtual ~ActionListener() { } virtual ~ActionListener() { }
/** /**
* Called when an action is recieved from a Widget. It is used * Called when an action is recieved from a widget. It is used
* to be able to recieve a notification that an action has * to be able to recieve a notification that an action has
* occured. * occured.
* *
* @param actionEvent the event of the action. * @param actionEvent The event of the action.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void action(const ActionEvent& actionEvent) = 0; virtual void action(const ActionEvent& actionEvent) = 0;
protected:
/**
* Constructor.
*
* You should not be able to make an instance of ActionListener,
* therefore its constructor is protected.
*/
ActionListener() { }
}; };
} }
#endif // end GCN_ACTIONLISTENER_HPP #endif // end GCN_ACTIONLISTENER_HPP
 End of changes. 7 change blocks. 
51 lines changed or deleted 46 lines changed or added


 allegro.hpp   allegro.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_ALLEGRO_HPP #ifndef GCN_ALLEGRO_HPP
#define GCN_ALLEGRO_HPP #define GCN_ALLEGRO_HPP
#include <guichan/allegro/allegrofont.hpp> #include <guichan/allegro/allegrofont.hpp>
#include <guichan/allegro/allegrographics.hpp> #include <guichan/allegro/allegrographics.hpp>
#include <guichan/allegro/allegroimage.hpp> #include <guichan/allegro/allegroimage.hpp>
#include <guichan/allegro/allegroimageloader.hpp> #include <guichan/allegro/allegroimageloader.hpp>
#include <guichan/allegro/allegroinput.hpp> #include <guichan/allegro/allegroinput.hpp>
 End of changes. 2 change blocks. 
45 lines changed or deleted 32 lines changed or added


 allegrofont.hpp   allegrofont.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La */
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_ALLEGROFONT_HPP #ifndef GCN_ALLEGROFONT_HPP
#define GCN_ALLEGROFONT_HPP #define GCN_ALLEGROFONT_HPP
#include <allegro.h> #include <allegro.h>
#include "guichan/font.hpp" #include "guichan/font.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/**
* Allegro font implementation of Font that uses the native
* Allegro font.
*/
class GCN_EXTENSION_DECLSPEC AllegroFont : public Font class GCN_EXTENSION_DECLSPEC AllegroFont : public Font
{ {
public: public:
/** /**
* Constructor. * Constructor.
* *
* @param font An Allegro font. * @param font An Allegro font.
*/ */
AllegroFont(FONT* font); AllegroFont(FONT* font);
 End of changes. 2 change blocks. 
55 lines changed or deleted 45 lines changed or added


 allegrographics.hpp   allegrographics.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_ALLEGROGRAPHICS_HPP #ifndef GCN_ALLEGROGRAPHICS_HPP
#define GCN_ALLEGROGRAPHICS_HPP #define GCN_ALLEGROGRAPHICS_HPP
#include <allegro.h> #include <allegro.h>
#include "guichan/color.hpp" #include "guichan/color.hpp"
#include "guichan/graphics.hpp" #include "guichan/graphics.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
 End of changes. 2 change blocks. 
45 lines changed or deleted 32 lines changed or added


 allegroimage.hpp   allegroimage.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_ALLEGROIMAGE_HPP #ifndef GCN_ALLEGROIMAGE_HPP
#define GCN_ALLEGROIMAGE_HPP #define GCN_ALLEGROIMAGE_HPP
#include <allegro.h> #include <allegro.h>
#include <string> #include <string>
#include "guichan/color.hpp" #include "guichan/color.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
 End of changes. 2 change blocks. 
45 lines changed or deleted 32 lines changed or added


 allegroimageloader.hpp   allegroimageloader.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_ALLEGROIMAGELOADER_HPP #ifndef GCN_ALLEGROIMAGELOADER_HPP
#define GCN_ALLEGROIMAGELOADER_HPP #define GCN_ALLEGROIMAGELOADER_HPP
#include <allegro.h> #include <allegro.h>
#include "guichan/image.hpp" #include "guichan/image.hpp"
#include "guichan/imageloader.hpp" #include "guichan/imageloader.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
 End of changes. 2 change blocks. 
45 lines changed or deleted 32 lines changed or added


 allegroinput.hpp   allegroinput.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_ALLEGROINPUT_HPP #ifndef GCN_ALLEGROINPUT_HPP
#define GCN_ALLEGROINPUT_HPP #define GCN_ALLEGROINPUT_HPP
#include <map> #include <map>
#include <queue> #include <queue>
#include "guichan/input.hpp" #include "guichan/input.hpp"
#include "guichan/keyinput.hpp" #include "guichan/keyinput.hpp"
 End of changes. 2 change blocks. 
45 lines changed or deleted 32 lines changed or added


 basiccontainer.hpp   basiccontainer.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_BASICCONTAINER_HPP #ifndef GCN_BASICCONTAINER_HPP
#define GCN_BASICCONTAINER_HPP #define GCN_BASICCONTAINER_HPP
#include <list> #include <list>
#include "guichan/deathlistener.hpp" #include "guichan/deathlistener.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include "guichan/widget.hpp" #include "guichan/widget.hpp"
namespace gcn namespace gcn
{ {
/** /**
* Implements basic container behaviour. Most container will suffice by * A base class for containers. The class implements the most
* inheriting from this class. * common things for a container. If you are implementing a
* container, consider inheriting from this class.
* *
* @see Container * @see Container
* @since 0.6.0
*/ */
class GCN_CORE_DECLSPEC BasicContainer : public Widget, public DeathLis tener class GCN_CORE_DECLSPEC BasicContainer : public Widget, public DeathLis tener
{ {
public: public:
/** /**
* Destructor * Destructor
*/ */
virtual ~BasicContainer(); virtual ~BasicContainer();
/**
* Shows a certain part of a widget in the basic container.
* 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 widget The widget whom wants a specific part of
* itself to be visible.
* @param rectangle The rectangle to be visible.
*/
virtual void showWidgetPart(Widget* widget, Rectangle area);
// Inherited from Widget // Inherited from Widget
virtual void moveToTop(Widget* widget); virtual void moveToTop(Widget* widget);
virtual void moveToBottom(Widget* widget); virtual void moveToBottom(Widget* widget);
virtual Rectangle getChildrenArea(); virtual Rectangle getChildrenArea();
virtual void focusNext(); virtual void focusNext();
virtual void focusPrevious(); virtual void focusPrevious();
virtual void logic(); virtual void logic();
virtual void _setFocusHandler(FocusHandler* focusHandler); virtual void _setFocusHandler(FocusHandler* focusHandler);
virtual void setInternalFocusHandler(FocusHandler* focusHandler); void setInternalFocusHandler(FocusHandler* focusHandler);
virtual void showWidgetPart(Widget* widget, Rectangle area);
virtual Widget *getWidgetAt(int x, int y); virtual Widget *getWidgetAt(int x, int y);
// Inherited from DeathListener // Inherited from DeathListener
virtual void death(const Event& event); virtual void death(const Event& event);
protected: protected:
/** /**
* Adds a widget to the basic container. * Adds a widget to the basic container.
* *
* @param widget the widget to add. * @param widget The widget to add.
* @see remove, clear
*/ */
virtual void add(Widget* widget); void add(Widget* widget);
/** /**
* Removes a widget from the basic container. * Removes a widget from the basic container.
* *
* @param widget the widget to remove. * @param widget The widget to remove.
* @see add, clear
*/ */
virtual void remove(Widget* widget); virtual void remove(Widget* widget);
/** /**
* Clears the basic container from all widgets. * Clears the basic container from all widgets.
*
* @see remove, clear
*/ */
virtual void clear(); virtual void clear();
/** /**
* Draws children widgets. * Draws the children widgets of the basic container.
* *
* @param graphics a Graphics object to draw with. * @param graphics A graphics object to draw with.
*/ */
virtual void drawChildren(Graphics* graphics); virtual void drawChildren(Graphics* graphics);
/** /**
* Calls logic for children widgets. * Calls logic for the children widgets of the basic
* container.
*/ */
virtual void logicChildren(); virtual void logicChildren();
/**
* Finds a widget given an id. This function can be useful
* when implementing a GUI generator for Guichan, such as
* the ability to create a Guichan GUI from an XML file.
*
* @param id The id to find a widget by.
* @return The widget with the corrosponding id,
NULL of no widget is found.
*/
virtual Widget* findWidgetById(const std::string& id);
/**
* Typedef.
*/
typedef std::list<Widget *> WidgetList; typedef std::list<Widget *> WidgetList;
/**
* Typedef.
*/
typedef WidgetList::iterator WidgetListIterator; typedef WidgetList::iterator WidgetListIterator;
/**
* Typedef.
*/
typedef WidgetList::reverse_iterator WidgetListReverseIterator; typedef WidgetList::reverse_iterator WidgetListReverseIterator;
/**
* Holds all widgets of the basic container.
*/
WidgetList mWidgets; WidgetList mWidgets;
}; };
} }
#endif // end GCN_BASICCONTAINER_HPP #endif // end GCN_BASICCONTAINER_HPP
 End of changes. 17 change blocks. 
56 lines changed or deleted 86 lines changed or added


 button.hpp   button.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_BUTTON_HPP #ifndef GCN_BUTTON_HPP
#define GCN_BUTTON_HPP #define GCN_BUTTON_HPP
#include <string> #include <string>
#include "guichan/focuslistener.hpp" #include "guichan/focuslistener.hpp"
#include "guichan/graphics.hpp"
#include "guichan/keylistener.hpp" #include "guichan/keylistener.hpp"
#include "guichan/mouseevent.hpp" #include "guichan/mouseevent.hpp"
#include "guichan/mouselistener.hpp" #include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include "guichan/widget.hpp" #include "guichan/widget.hpp"
namespace gcn namespace gcn
{ {
/** /**
* A regular button. Add an ActionListener to it to know when it * An implementation of a regular clickable button. A button is capable
* has been clicked. of
* displaying a caption.
* *
* NOTE: You can only have text (a caption) on the button. If you want * If a button is clicked an action event will be sent to all action li
it stener's
* to handle, for instance images, you can implement an ImageButt * of the button.
on *
* of your own and overload member functions from Button. * @see ImageButton
*/ */
class GCN_CORE_DECLSPEC Button : public Widget, class GCN_CORE_DECLSPEC Button : public Widget,
public MouseListener, public MouseListener,
public KeyListener, public KeyListener,
public FocusListener public FocusListener
{ {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
Button(); Button();
/** /**
* Constructor. * Constructor. The button will be automatically resized
* to fit the caption.
* *
* @param caption the caption of the Button. * @param caption The caption of the button.
*/ */
Button(const std::string& caption); Button(const std::string& caption);
/** /**
* Sets the Button caption. * Sets the caption of the button. It's advisable to call
* adjustSize after setting of the caption to adjust the
* button's size to fit the caption.
* *
* @param caption the Button caption. * @param caption The caption of the button.
* @see getCaption, adjustSize
*/ */
virtual void setCaption(const std::string& caption); void setCaption(const std::string& caption);
/** /**
* Gets the Button caption. * Gets the caption of the button.
* *
* @return the Button caption. * @return The caption of the button.
*/ */
virtual const std::string& getCaption() const; const std::string& getCaption() const;
/** /**
* Sets the alignment for the caption. * Sets the alignment of the caption. The alignment is relative
* to the center of the button.
* *
* @param alignment Graphics::LEFT, Graphics::CENTER or Graphics::R * @param alignment The alignment of the caption.
IGHT * @see getAlignment, Graphics
* @see Graphics
*/ */
virtual void setAlignment(unsigned int alignment); void setAlignment(Graphics::Alignment alignment);
/** /**
* Gets the alignment for the caption. * Gets the alignment of the caption.
* *
* @return alignment of caption. * @return The alignment of the caption.
* @see setAlignment, Graphics
*/ */
virtual unsigned int getAlignment() const; Graphics::Alignment getAlignment() const;
/** /**
* Adjusts the buttons size to fit the content. * Sets the spacing between the border of the button and its captio
n.
*
* @param spacing The default value for spacing is 4 and can be cha
nged
* using this method.
* @see getSpacing
*/ */
virtual void adjustSize(); void setSpacing(unsigned int spacing);
/** /**
* Checks if the button is pressed down. Useful when drawing. * Gets the spacing between the border of the button and its captio n.
* *
* @return true if the button is pressed down. * @return spacing.
* @see setSpacing
*/ */
virtual bool isPressed() const; unsigned int getSpacing() const;
/**
* Adjusts the button's size to fit the caption.
*/
void adjustSize();
//Inherited from Widget //Inherited from Widget
virtual void draw(Graphics* graphics); virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
// Inherited from FocusListener // Inherited from FocusListener
virtual void focusLost(const Event& event); virtual void focusLost(const Event& event);
// Inherited from MouseListener // Inherited from MouseListener
virtual void mousePressed(MouseEvent& mouseEvent); virtual void mousePressed(MouseEvent& mouseEvent);
virtual void mouseReleased(MouseEvent& mouseEvent); virtual void mouseReleased(MouseEvent& mouseEvent);
skipping to change at line 167 skipping to change at line 170
virtual void mouseDragged(MouseEvent& mouseEvent); virtual void mouseDragged(MouseEvent& mouseEvent);
// Inherited from KeyListener // Inherited from KeyListener
virtual void keyPressed(KeyEvent& keyEvent); virtual void keyPressed(KeyEvent& keyEvent);
virtual void keyReleased(KeyEvent& keyEvent); virtual void keyReleased(KeyEvent& keyEvent);
protected: protected:
/**
* Checks if the button is pressed. Convenient method to use
* when overloading the draw method of the button.
*
* @return True if the button is pressed, false otherwise.
*/
bool isPressed() const;
/**
* Holds the caption of the button.
*/
std::string mCaption; std::string mCaption;
/**
* True if the mouse is ontop of the button, false otherwise.
*/
bool mHasMouse; bool mHasMouse;
/**
* True if a key has been pressed, false otherwise.
*/
bool mKeyPressed; bool mKeyPressed;
/**
* True if a mouse has been pressed, false otherwise.
*/
bool mMousePressed; bool mMousePressed;
unsigned int mAlignment;
/**
* Holds the alignment of the caption.
*/
Graphics::Alignment mAlignment;
/**
* Holds the spacing between the border and the caption.
*/
unsigned int mSpacing;
}; };
} }
#endif // end GCN_BUTTON_HPP #endif // end GCN_BUTTON_HPP
 End of changes. 30 change blocks. 
76 lines changed or deleted 112 lines changed or added


 checkbox.hpp   checkbox.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_CHECKBOX_HPP #ifndef GCN_CHECKBOX_HPP
#define GCN_CHECKBOX_HPP #define GCN_CHECKBOX_HPP
#include <string> #include <string>
#include "guichan/keylistener.hpp" #include "guichan/keylistener.hpp"
#include "guichan/mouselistener.hpp" #include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include "guichan/widget.hpp" #include "guichan/widget.hpp"
namespace gcn namespace gcn
{ {
/** /**
* A regular CheckBox. It can be checked and unchecked. * An implementation of a check box where a user can select or deselect
* the check box and where the status of the check box is displayed to
the user.
* A check box is capable of displaying a caption.
*
* If a check box's state changes an action event will be sent to all a
ction
* listeners of the check box.
*/ */
class GCN_CORE_DECLSPEC CheckBox : class GCN_CORE_DECLSPEC CheckBox :
public Widget, public Widget,
public MouseListener, public MouseListener,
public KeyListener public KeyListener
{ {
public: public:
/** /**
* Contructor. * Contructor.
*/ */
CheckBox(); CheckBox();
/** /**
* Constructor. * Constructor. The check box will be automatically resized
* to fit the caption.
* *
* @param caption the CheckBox caption. * @param caption The caption of the check box.
* @param marked true if the CheckBox should be marked. * @param marked True if the check box is selected, false otherwise
.
*/ */
CheckBox(const std::string &caption, bool marked=false); CheckBox(const std::string &caption, bool selected = false);
/** /**
* Destructor. * Destructor.
*/ */
virtual ~CheckBox() { } virtual ~CheckBox() { }
/** /**
* Draws the box i.a not the caption. * Checks if the check box is selected.
*
* @param graphics a Graphics object to draw with.
*/
virtual void drawBox(Graphics *graphics);
/**
* Checks if the CheckBox is marked.
* *
* @return true if the CheckBox is marked. * @return True if the check box is selected, false otherwise.
* @see setSelected
*/ */
virtual bool isMarked() const; bool isSelected() const;
/** /**
* Sets the CheckBox to be marked. * Sets the check box to be selected or not.
* *
* @param marked true if the CheckBox should be marked. * @param selected True if the check box should be set as selected.
* @see isSelected
*/ */
virtual void setMarked(bool marked); void setSelected(bool selected);
/** /**
* Gets the CheckBox caption. * Gets the caption of the check box.
* *
* @return the CheckBox caption. * @return The caption of the check box.
* @see setCaption
*/ */
virtual const std::string &getCaption() const; const std::string &getCaption() const;
/** /**
* Sets the CheckBox caption. * Sets the caption of the check box. It's advisable to call
* adjustSize after setting of the caption to adjust the
* check box's size to fit the caption.
* *
* @param caption the CheckBox caption. * @param caption The caption of the check box.
* @see getCaption, adjustSize
*/ */
virtual void setCaption(const std::string& caption); void setCaption(const std::string& caption);
/** /**
* Adjusts the CheckBox size to fit the font size. * Adjusts the check box's size to fit the caption.
*/ */
virtual void adjustSize(); void adjustSize();
// Inherited from Widget // Inherited from Widget
virtual void draw(Graphics* graphics); virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
// Inherited from KeyListener // Inherited from KeyListener
virtual void keyPressed(KeyEvent& keyEvent); virtual void keyPressed(KeyEvent& keyEvent);
// Inherited from MouseListener // Inherited from MouseListener
virtual void mouseClicked(MouseEvent& mouseEvent); virtual void mouseClicked(MouseEvent& mouseEvent);
virtual void mouseDragged(MouseEvent& mouseEvent); virtual void mouseDragged(MouseEvent& mouseEvent);
protected: protected:
/** /**
* Toggles between marked and unmarked. * Draws the box of the check box.
*
* @param graphics A Graphics object to draw with.
*/ */
virtual void toggle(); virtual void drawBox(Graphics *graphics);
bool mMarked; /**
* Toggles the check box between being selected and
* not being selected.
*/
virtual void toggleSelected();
/**
* True if the check box is selected, false otherwise.
*/
bool mSelected;
/**
* Holds the caption of the check box.
*/
std::string mCaption; std::string mCaption;
}; };
} }
#endif // end GCN_CHECKBOX_HPP #endif // end GCN_CHECKBOX_HPP
 End of changes. 24 change blocks. 
76 lines changed or deleted 84 lines changed or added


 cliprectangle.hpp   cliprectangle.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_CLIPRECTANGLE_HPP #ifndef GCN_CLIPRECTANGLE_HPP
#define GCN_CLIPRECTANGLE_HPP #define GCN_CLIPRECTANGLE_HPP
#include "guichan/rectangle.hpp" #include "guichan/rectangle.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/** /**
* A rectangle used when dealing with clipping. It is a regular * A rectangle used when dealing with clipping. A clip rectangle is
* Rectangle extended with variables for x offsets and y offsets. * a regular rectangle extended with variables for x offsets and y
* offsets. The offsets are used for calculations from relative
* screen coordinates to actual screen coordinates.
*/ */
class GCN_CORE_DECLSPEC ClipRectangle : public Rectangle class GCN_CORE_DECLSPEC ClipRectangle : public Rectangle
{ {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
ClipRectangle(); ClipRectangle();
/** /**
* Constructor. * Constructor.
* *
* @param x the rectangle x coordinate. * @param x The rectangle x coordinate.
* @param y the rectangle y coordinate. * @param y The rectangle y coordinate.
* @param width the rectangle width. * @param width The rectangle width.
* @param height the rectangle height. * @param height The rectangle height.
* @param xOffset origin of drawing (used by Graphics). * @param xOffset The offset of the x coordinate. Used to for
* @param yOffset origin of drawing (used by Graphics) . * calculating the actual screen coordinate from
* the relative screen coordinate.
* @param yOffset The offset of the y coordinate. Used to for
* calculating the actual screen coordinate from
* the relative screen coordinate.
*/ */
ClipRectangle(int x, int y, int width, int height, ClipRectangle(int x,
int xOffset, int yOffset); int y,
int width,
int height,
int xOffset,
int yOffset);
/** /**
* Copies x, y, width and height field from a Rectangle. * Copy constructor. Copies x, y, width and height
* field from a rectangle to a clip rectangle.
* *
* @param other the Rectangle to copy from. * @param other The rectangle to copy data from.
* @returns a ClipRectangle. * @returns A clip rectangle with data copyied from a rectangle.
*/ */
const ClipRectangle& operator=(const Rectangle& other); const ClipRectangle& operator=(const Rectangle& other);
/** /**
* x-origin of drawing (used by Graphics). * Holds the x offset of the x coordinate.
*/ */
int xOffset; int xOffset;
/** /**
* y-origin of drawing (used by Graphics). * Holds the y offset of the y coordinate.
*/ */
int yOffset; int yOffset;
}; };
} }
#endif // end GCN_CLIPRECTANGLE_HPP #endif // end GCN_CLIPRECTANGLE_HPP
 End of changes. 9 change blocks. 
60 lines changed or deleted 58 lines changed or added


 color.hpp   color.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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 #ifndef GCN_COLOR_HPP
#define GCN_COLOR_HPP #define GCN_COLOR_HPP
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include <iostream>
namespace gcn namespace gcn
{ {
/** /**
* Represents a color with red, green, blue and alpha components. * Represents a color with red, green, blue and alpha components.
*/ */
class GCN_CORE_DECLSPEC Color class GCN_CORE_DECLSPEC Color
{ {
public: public:
/** /**
* Constructor. Initializes the color to black. * Constructor. Initializes the color to black.
*/ */
Color(); Color();
/** /**
* Constructs a color from the bytes in an integer. Call it with * Constructor. Constructs a color from the bytes in an integer.
* a hexadecimal constant for HTML-style color representation. * Call it with a hexadecimal constant for HTML-style color represe
* The alpha component will be set to 255. ntation.
* The alpha component is 255 by default.
* *
* EXAMPLE: Color(0xff50a0) constructs Gui-chan's favourite color. * EXAMPLE: Color(0xff50a0) constructs a very nice pinkish color.
* *
* NOTE: Because of this constructor, integers will be automaticall y * NOTE: Because of this constructor, integers will be automaticall y
* casted to a color by your compiler. * casted to a color by your compiler.
* *
* @param color the color. * @param color The color to initialise the object with.
*/ */
Color(int color); Color(int color);
/** /**
* Constructor. * Constructor. The default alpha value is 255.
* *
* @param r Red color component (range 0-255). * @param r Red color component (range 0-255).
* @param g Green color component (range 0-255). * @param g Green color component (range 0-255).
* @param b Blue color component (range 0-255). * @param b Blue color component (range 0-255).
* @param a Color alpha, used for transparency. A value of 0 means * @param a Alpha, used for transparency. A value of 0 means
* totaly transparent, 255 is totaly opaque (the default). * totaly transparent, 255 is totaly opaque.
*/ */
Color(int r, int g, int b, int a = 255); Color(int r, int g, int b, int a = 255);
/** /**
* Adds the RGB values of two colors together. The values will be * Adds the RGB values of two colors together. The values will be
* clamped if they go out of range. * clamped if they go out of range.
* *
* @param color a color to add to this color. * WARNING: This function will reset the alpha value of the
* @return the resulting color with alpha set to 255. * 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; Color operator+(const Color& color) const;
/** /**
* Subtracts the RGB values of one color from another. * Subtracts the RGB values of one color from another.
* The values will be clamped if they go out of range. * The values will be clamped if they go out of range.
* *
* @param color a color to subtract from this color. * WARNING: This function will reset the alpha value of the
* @return the resulting color with alpha set to 255. * 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; Color operator-(const Color& color) const;
/** /**
* Multiplies the RGB values of a color with a float value. * Multiplies the RGB values of a color with a float value.
* The values will be clamped if they go out of range. * The values will be clamped if they go out of range.
* *
* @param value the value to multiply the color with. * @param value The value to multiply the color with.
* @return the resulting color with alpha untouched. * @return The multiplied colors. The alpha value will, unlike
* the add and subtract operations, be multiplied as
* well.
*/ */
Color operator*(float value) const; Color operator*(float value) const;
/** /**
* Compares two colors. * Compares two colors.
* *
* @return true if the two colors have the same RGBA components. * @return True if the two colors have the same RGBA components
* false otherwise.
*/ */
bool operator==(const Color& color) const; bool operator==(const Color& color) const;
/** /**
* Compares two colors. * Compares two colors.
* *
* @return true if the two colors have different RGBA components. * @return True if the two colors have different RGBA components,
* false otherwise.
*/ */
bool operator!=(const Color& color) const; 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);
/** /**
* Red color component (range 0-255). * Holds the red color component (range 0-255).
*/ */
int r; int r;
/** /**
* Green color component (range 0-255). * Holds the green color component (range 0-255).
*/ */
int g; int g;
/** /**
* Blue color component (range 0-255). * Holds the blue color component (range 0-255).
*/ */
int b; int b;
/** /**
* Color alpha, used for transparency. A value of 0 means totaly * Holds the alpha color component. A value of 0 means totally
* transparent, 255 is totaly opaque (the default) * transparent while a value of 255 is considered opaque.
*/ */
int a; int a;
}; };
} }
#endif // end GCN_COLOR_HPP #endif // end GCN_COLOR_HPP
 End of changes. 18 change blocks. 
66 lines changed or deleted 75 lines changed or added


 container.hpp   container.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_CONTAINER_HPP #ifndef GCN_CONTAINER_HPP
#define GCN_CONTAINER_HPP #define GCN_CONTAINER_HPP
#include <list> #include <list>
#include "guichan/basiccontainer.hpp" #include "guichan/basiccontainer.hpp"
#include "guichan/graphics.hpp" #include "guichan/graphics.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/** /**
* A container able to contain other Widgets. It is in other words a * An implementation of a container able to contain other widgets. A wi
* Widget that holds other Widgets. A Widget's position in the containe dget's
r is * position in the container is relative to the container itself and no
* always relativ to the Container itself, not the screen. Using a t the screen.
* Container as the top Widget in Gui is the only way to use more then * A container is the most common widget to use as the Gui's top widget
one as makes the Gui
* Widget in your Gui. * able to contain more than one widget.
*
* @see Gui::setTop
*/ */
class GCN_CORE_DECLSPEC Container: public BasicContainer class GCN_CORE_DECLSPEC Container: public BasicContainer
{ {
public: public:
/** /**
* Constructor. A container is opauqe as default. * Constructor. A container is opauqe as default, if you want a
* none opaque container call setQpaque(false).
* *
* @see setOpaque, isOpaque * @see setOpaque, isOpaque
*/ */
Container(); Container();
/** /**
* Destructor. * Destructor.
*/ */
virtual ~Container(); virtual ~Container();
/** /**
* Sets whether the background should be drawn or not. If the * Sets the container to be opaque or not. If the container
* Container is not opaque it will be completely transparent. * is opaque it's background will be drawn, if it's not opaque
* it's background will not be drawn, and thus making the container
* completely transparent.
* *
* NOTE: This is not the same as to set visibility. A nonvisible * NOTE: This is not the same as to set visibility. A non visible
* Container will not draw it's content. * container will not itself nor will it draw it's content.
* *
* @param opaque true if the Container should be opaque. * @param opaque True if the container should be opaque, false othe rwise.
* @see isOpaque * @see isOpaque
*/ */
virtual void setOpaque(bool opaque); void setOpaque(bool opaque);
/** /**
* Checks if the Container is opaque. * Checks if the container is opaque or not.
* *
* @return true if the Container is opaque. * @return true if the container is opaque, false otherwise.
* @see setOpaque * @see setOpaque
*/ */
virtual bool isOpaque() const; bool isOpaque() const;
/** /**
* Adds a Widget to the Container. * Adds a widget to the container.
* *
* @param widget the Widget to add. * @param widget The widget to add.
* @see remove * @see remove, clear
*/ */
virtual void add(Widget* widget); virtual void add(Widget* widget);
/** /**
* Adds a Widget to the container and also specifices it's postion * Adds a widget to the container and also specifices the widget's
* postion in the container. The position is relative to the contai
ner
* and not relative to the screen.
* *
* @param widget the Widget to add. * @param widget The widget to add.
* @param x the x coordinat for the Widget in the Container. * @param x The x coordinat for the widget.
* @param y the y coordinat for the Widget in the Container. * @param y The y coordinat for the widget.
* @see remove * @see remove, clear
*/ */
virtual void add(Widget* widget, int x, int y); virtual void add(Widget* widget, int x, int y);
/** /**
* Removes a Widget from the Container. * Removes a widget from the Container.
* *
* @param widget the Widget to remove. * @param widget The widget to remove.
* @throws Exception when the Widget has not been added to the * @throws Exception when the widget has not been added to the
* Container. * container.
* @see add, clear * @see add, clear
*/ */
virtual void remove(Widget* widget); virtual void remove(Widget* widget);
/** /**
* Clears the Container of all widgets. * Clears the container of all widgets.
* *
* @see add, remove * @see add, remove
*/ */
virtual void clear(); virtual void clear();
/**
* Finds a widget given an id.
*
* @param id The id to find a widget by.
* @return A widget with a corrosponding id, NULL if no widget
* is found.
* @see Widget::setId
*/
virtual Widget* findWidgetById(const std::string &id);
// Inherited from Widget // Inherited from Widget
virtual void draw(Graphics* graphics); virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
protected: protected:
/**
* True if the container is opaque, false otherwise.
*/
bool mOpaque; bool mOpaque;
}; };
} }
#endif // end GCN_CONTAINER_HPP #endif // end GCN_CONTAINER_HPP
 End of changes. 21 change blocks. 
77 lines changed or deleted 83 lines changed or added


 deathlistener.hpp   deathlistener.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_DEATHLISTENER_HPP #ifndef GCN_DEATHLISTENER_HPP
#define GCN_DEATHLISTENER_HPP #define GCN_DEATHLISTENER_HPP
#include <string> #include <string>
#include "guichan/event.hpp" #include "guichan/event.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/** /**
* Listener of death events from Widgets. To be able to * Interface for listening for death events from widgets.
* listen for deaths you must make a class which inherits
* from this class and implements the death function.
* *
* @see Widget::addDeathListener * @see Widget::addDeathListener, Widget::removeDeathListener
* @author Olof Naess * @author Olof Naess
* @since 0.6.0 * @since 0.6.0
*/ */
class GCN_CORE_DECLSPEC DeathListener class GCN_CORE_DECLSPEC DeathListener
{ {
public: public:
/** /**
* Destructor. * Destructor.
*/ */
virtual ~DeathListener() { } virtual ~DeathListener() { }
/** /**
* Called when a widget dies. It is used to be able to recieve * Called when a widget dies. It is used to be able to recieve
* a notification when a death of a widget occurs. * a notification when a death of a widget occurs.
* *
* @param event the event of the death. * @param event The event of the death.
*/ */
virtual void death(const Event& event) = 0; 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 // end GCN_DEATHLISTENER_HPP #endif // end GCN_DEATHLISTENER_HPP
 End of changes. 6 change blocks. 
50 lines changed or deleted 44 lines changed or added


 defaultfont.hpp   defaultfont.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_DEFAULTFONT_HPP #ifndef GCN_DEFAULTFONT_HPP
#define GCN_DEFAULTFONT_HPP #define GCN_DEFAULTFONT_HPP
#include "guichan/font.hpp" #include "guichan/font.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/** /**
* A font only capable of drawing rectangles. It is used by default * A font only capable of drawing rectangles. It is used by default
* merely to show that no font have been set. * in Guichan if no font has been set merely to show that no font has
* been set.
*/ */
class GCN_CORE_DECLSPEC DefaultFont : public Font class GCN_CORE_DECLSPEC DefaultFont : public Font
{ {
public: public:
/** /**
* Destructor. * Destructor.
*/ */
virtual ~DefaultFont(){} virtual ~DefaultFont(){}
/** /**
* Draws a glyph as a rectangle. The glyphs always be drawn as * Draws a glyph as a rectangle. The glyphs will always be drawn as
* rectangles no matter the glyph. * rectangles no matter the glyph.
* *
* NOTE: You normally won't use this function to draw text since * NOTE: You normally won't use this function to draw text since
* the Graphics class contains better functions for drawing * the Graphics class contains better functions for drawing
* text. * text.
* *
* @param graphics a Graphics object to be used for drawing. * @param graphics A Graphics object to be used for drawing.
* @param glyph a glyph to draw. * @param glyph The glyph to draw.
* @param x the x coordinate where to draw the glyph. * @param x The x coordinate where to draw the glyph.
* @param y the y coordinate where to draw the glyph. * @param y The y coordinate where to draw the glyph.
* @return the width of the glyph in pixels. * @return The width of the drawn glyph in pixels.
*/ */
virtual int drawGlyph(Graphics* graphics, unsigned char glyph, int x, int y); virtual int drawGlyph(Graphics* graphics, unsigned char glyph, int x, int y);
// Inherited from Font // Inherited from Font
virtual void drawString(Graphics* graphics, const std::string& text , int x, int y); virtual void drawString(Graphics* graphics, const std::string& text , int x, int y);
virtual int getWidth(const std::string& text) const; virtual int getWidth(const std::string& text) const;
virtual int getHeight() const; virtual int getHeight() const;
 End of changes. 5 change blocks. 
52 lines changed or deleted 40 lines changed or added


 dropdown.hpp   dropdown.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_DROPDOWN_HPP #ifndef GCN_DROPDOWN_HPP
#define GCN_DROPDOWN_HPP #define GCN_DROPDOWN_HPP
#include "guichan/actionlistener.hpp" #include "guichan/actionlistener.hpp"
#include "guichan/basiccontainer.hpp" #include "guichan/basiccontainer.hpp"
#include "guichan/deathlistener.hpp" #include "guichan/deathlistener.hpp"
#include "guichan/focushandler.hpp" #include "guichan/focushandler.hpp"
#include "guichan/focuslistener.hpp" #include "guichan/focuslistener.hpp"
#include "guichan/keylistener.hpp" #include "guichan/keylistener.hpp"
#include "guichan/listmodel.hpp" #include "guichan/listmodel.hpp"
#include "guichan/mouselistener.hpp" #include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include "guichan/selectionlistener.hpp"
#include "guichan/widgets/listbox.hpp" #include "guichan/widgets/listbox.hpp"
#include "guichan/widgets/scrollarea.hpp" #include "guichan/widgets/scrollarea.hpp"
namespace gcn namespace gcn
{ {
/** /**
* A drop down box from which you can select different values. It is on * An implementation of a drop downable list from which an item can be
e of selected.
* the most complicated Widgets you will find in Guichan. For drawing t * The drop down consists of an internal ScrollArea and an internal Lis
he tBox.
* DroppedDown box it uses one ScrollArea and one ListBox. It also uses * The drop down also uses an internal FocusHandler to handle the focus
an of the
* internal FocusHandler to handle the focus of the internal ScollArea * internal ScollArea and the internal ListBox. The scroll area and the
and list box
* ListBox. DropDown uses a ListModel to handle the list. To be able to * can be passed to the drop down if a custom scroll area and or a cust
use om list box
* DropDown you must give DropDown an implemented ListModel which repre * is preferable.
sents *
* your list. * To be able display a list the drop down uses a user provided list mo
del.
* A list model can be any class that implements the ListModel interfac
e.
*
* If an item is selected in the drop down a select event will be sent
to all selection
* listeners of the drop down. If an item is selected by using a mouse
click or by using
* the enter or space key an action event will be sent to all action li
steners of the
* drop down.
*/ */
class GCN_CORE_DECLSPEC DropDown : class GCN_CORE_DECLSPEC DropDown :
public ActionListener, public ActionListener,
public BasicContainer, public BasicContainer,
public KeyListener, public KeyListener,
public MouseListener, public MouseListener,
public FocusListener public FocusListener,
public SelectionListener
{ {
public: public:
/** /**
* Contructor. * Contructor.
* *
* @param listModel the ListModel to use. * @param listModel the ListModel to use.
* @param scrollArea the ScrollArea to use. * @param scrollArea the ScrollArea to use.
* @param listBox the listBox to use. * @param listBox the listBox to use.
* @see ListModel, ScrollArea, ListBox. * @see ListModel, ScrollArea, ListBox.
*/ */
DropDown(ListModel *listModel = NULL, DropDown(ListModel *listModel = NULL,
ScrollArea *scrollArea = NULL, ScrollArea *scrollArea = NULL,
ListBox *listBox = NULL); ListBox *listBox = NULL);
/** /**
* Destructor. * Destructor.
*/ */
virtual ~DropDown(); virtual ~DropDown();
/** /**
* Gets the index int the ListModel of the selected element. * Gets the selected item as an index in the list model.
* *
* @return the selected element. * @return the selected item as an index in the list model.
* @see setSelected
*/ */
virtual int getSelected(); int getSelected() const;
/** /**
* Sets the ListModel index of the selected element. * Sets the selected item. The selected item is represented by
* an index from the list model.
* *
* @param selected the ListModel index of the selected element. * @param selected the selected item as an index from the list mode
l.
* @see getSelected
*/ */
virtual void setSelected(int selected); void setSelected(int selected);
/** /**
* Sets the ListModel to use. * Sets the list model to use when displaying the list.
* *
* @param listModel the ListModel to use. * @param listModel the list model to use.
* @see getListModel
*/ */
virtual void setListModel(ListModel *listModel); void setListModel(ListModel *listModel);
/** /**
* Gets the ListModel used. * Gets the list model used.
* *
* @return the ListModel used. * @return the ListModel used.
* @see setListModel
*/ */
virtual ListModel *getListModel(); ListModel *getListModel();
/** /**
* Adjusts the height of the DropDown fitting it's parents height. * Adjusts the height of the drop down to fit the height of the
* drop down's parent's height. It's used to not make the drop down
* draw itself outside of it's parent if folded down.
*/ */
virtual void adjustHeight(); void adjustHeight();
/**
* Adds a selection listener to the drop down. When the selection
* changes an event will be sent to all selection listeners of the
* drop down.
*
* @param selectionListener the selection listener to add.
* @since 0.8.0
*/
void addSelectionListener(SelectionListener* selectionListener);
/**
* Removes a selection listener from the drop down.
*
* @param selectionListener the selection listener to remove.
* @since 0.8.0
*/
void removeSelectionListener(SelectionListener* selectionListener);
// Inherited from Widget // Inherited from Widget
virtual void draw(Graphics* graphics); virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics); void setBaseColor(const Color& color);
virtual void setBaseColor(const Color& color); void setBackgroundColor(const Color& color);
virtual void setBackgroundColor(const Color& color); void setForegroundColor(const Color& color);
virtual void setForegroundColor(const Color& color); void setFont(Font *font);
virtual void setFont(Font *font); void setSelectionColor(const Color& color);
// Inherited from BasicContainer // Inherited from BasicContainer
virtual Rectangle getChildrenArea(); virtual Rectangle getChildrenArea();
// Inherited from FocusListener // Inherited from FocusListener
virtual void focusLost(const Event& event); virtual void focusLost(const Event& event);
// Inherited from ActionListener // Inherited from ActionListener
skipping to change at line 187 skipping to change at line 208
virtual void mousePressed(MouseEvent& mouseEvent); virtual void mousePressed(MouseEvent& mouseEvent);
virtual void mouseReleased(MouseEvent& mouseEvent); virtual void mouseReleased(MouseEvent& mouseEvent);
virtual void mouseWheelMovedUp(MouseEvent& mouseEvent); virtual void mouseWheelMovedUp(MouseEvent& mouseEvent);
virtual void mouseWheelMovedDown(MouseEvent& mouseEvent); virtual void mouseWheelMovedDown(MouseEvent& mouseEvent);
virtual void mouseDragged(MouseEvent& mouseEvent); virtual void mouseDragged(MouseEvent& mouseEvent);
// Inherited from SelectionListener
virtual void valueChanged(const SelectionEvent& event);
protected: protected:
/** /**
* Draws the button with the little down arrow. * Draws the button of the drop down.
* *
* @param graphics a Graphics object to draw with. * @param graphics a Graphics object to draw with.
*/ */
virtual void drawButton(Graphics *graphics); virtual void drawButton(Graphics *graphics);
/** /**
* Sets the DropDown Widget to dropped-down mode. * Sets the drop down to be dropped down.
*/ */
virtual void dropDown(); virtual void dropDown();
/** /**
* Sets the DropDown Widget to folded-up mode. * Sets the drop down to be folded up.
*/ */
virtual void foldUp(); virtual void foldUp();
/**
* Distributes a value changed event to all selection listeners
* of the drop down.
*
* @since 0.8.0
*/
void distributeValueChangedEvent();
/**
* True if the drop down is dropped down, false otherwise.
*/
bool mDroppedDown; bool mDroppedDown;
/**
* True if the drop down has been pushed with the mouse, false
* otherwise.
*/
bool mPushed; bool mPushed;
int mOldH;
/**
* Holds what the height is if the drop down is folded up. Used whe
n
* checking if the list of the drop down was clicked or if the uppe
r part
* of the drop down was clicked on a mouse click
*/
int mFoldedUpHeight;
/**
* The scroll area used.
*/
ScrollArea* mScrollArea; ScrollArea* mScrollArea;
/**
* The list box used.
*/
ListBox* mListBox; ListBox* mListBox;
/**
* The internal focus handler used to keep track of focus for the
* internal list box.
*/
FocusHandler mInternalFocusHandler; FocusHandler mInternalFocusHandler;
/**
* True if an internal scroll area is used, false if a scroll area
* has been passed to the drop down which the drop down should not
* deleted in it's destructor.
*/
bool mInternalScrollArea; bool mInternalScrollArea;
/**
* True if an internal list box is used, false if a list box
* has been passed to the drop down which the drop down should not
* deleted in it's destructor.
*/
bool mInternalListBox; bool mInternalListBox;
/**
* True if the drop down is dragged.
*/
bool mIsDragged; bool mIsDragged;
/**
* Typedef.
*/
typedef std::list<SelectionListener*> SelectionListenerList;
/**
* The selection listener's of the drop down.
*/
SelectionListenerList mSelectionListeners;
/**
* Typedef.
*/
typedef SelectionListenerList::iterator SelectionListenerIterator;
}; };
} }
#endif // end GCN_DROPDOWN_HPP #endif // end GCN_DROPDOWN_HPP
 End of changes. 37 change blocks. 
81 lines changed or deleted 179 lines changed or added


 event.hpp   event.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ^
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef GCN_EVENT_HPP #ifndef GCN_EVENT_HPP
#define GCN_EVENT_HPP #define GCN_EVENT_HPP
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
class Widget; class Widget;
/** /**
* Base class for all events. * Base class for all events. All events in Guichan should
* inherit from this class.
* *
* @author Olof Naess * @author Olof Naess
* @since 0.6.0 * @since 0.6.0
*/ */
class GCN_CORE_DECLSPEC Event class GCN_CORE_DECLSPEC Event
{ {
public: public:
/** /**
* Constructor. * Constructor.
* *
* @param source the source widget of the event. * @param source The source widget of the event.
*/ */
Event(Widget* source); Event(Widget* source);
/** /**
* Destructor. * Destructor.
*/ */
virtual ~Event(); virtual ~Event();
/** /**
* Gets the source widget of the event. * Gets the source widget of the event. The function
* is used to tell which widget fired an event.
* *
* @return the source widget of the event. * @return The source widget of the event.
*/ */
virtual Widget* getSource() const; Widget* getSource() const;
protected: protected:
/**
* Holds the source widget of the event.
*/
Widget* mSource; Widget* mSource;
unsigned int mType;
}; };
} }
#endif // end GCN_EVENT_HPP #endif // end GCN_EVENT_HPP
 End of changes. 9 change blocks. 
51 lines changed or deleted 43 lines changed or added


 exception.hpp   exception.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_EXCEPTION_HPP #ifndef GCN_EXCEPTION_HPP
#define GCN_EXCEPTION_HPP #define GCN_EXCEPTION_HPP
#include <string> #include <string>
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#ifdef _MSC_VER #ifdef _MSC_VER
#if _MSC_VER <= 1200 #if _MSC_VER <= 1200
#define __FUNCTION__ "?" #define __FUNCTION__ "?"
#endif #endif
#endif #endif
/* /*
* A macro to be used when throwing exceptions. * A macro used to create a standard exception object.
* What it basicly does is that it creates a new exception * What it basicly does is that it creates a new exception
* and automatically sets the filename and line number where * and automatically sets the filename and line number where
* the exception occured. * the exception occured by using other compiler macros.
*/ */
#define GCN_EXCEPTION(mess) gcn::Exception(mess, \ #define GCN_EXCEPTION(mess) gcn::Exception(mess, \
__FUNCTION__, \ __FUNCTION__, \
__FILE__, \ __FILE__, \
__LINE__) __LINE__)
namespace gcn namespace gcn
{ {
/** /**
* An exception containing a message, a file and a line number. * An exception containing a message, a file and a line number
* Guichan will only throw exceptions of this class. You can use * where the exception occured. Guichan will only throw exceptions
* this class for your own exceptions. A nifty feature of the * of this class.
*
* You can use this class for your own exceptions that has
* something to do with a GUI exception. A nifty feature of the
* excpetion class is that it can tell you from which line and * excpetion class is that it can tell you from which line and
* file it was thrown. To make things easier when throwing * file it was thrown. To make things easier when throwing
* exceptions there exists a macro for creating exceptions * exceptions there exists a macro for creating exceptions
* which automatically sets the filename and line number. * which automatically sets the filename and line number.
* *
* EXAMPLE: @code * EXAMPLE: @code
* throw GCN_EXCEPTION("my error message"); * throw GCN_EXCEPTION("my error message");
* @endcode * @endcode
*/ */
class GCN_CORE_DECLSPEC Exception class GCN_CORE_DECLSPEC Exception
skipping to change at line 109 skipping to change at line 99
public: public:
/** /**
* Constructor. * Constructor.
*/ */
Exception(); Exception();
/** /**
* Constructor. * Constructor.
* *
* @param message the error message. * @param message The error message of the exception.
*/ */
Exception(const std::string& message); Exception(const std::string& message);
/** /**
* Constructor. * Constructor.
* *
* NOTE: Don't use this constructor. Use the GCN_EXCEPTION macro in stead. * NOTE: Don't use this constructor. Use the GCN_EXCEPTION macro in stead.
* This constructor merely exists for the GCN_EXCEPTION macro
to
* use.
* *
* @param message the error message. * @param message The error message of the exception.
* @param function the function name. * @param function The function name where the exception occured.
* @param filename the name of the file. * @param filename The name of the file where the exception occured
* @param line the line number. .
* @param line The line number in the source code where the excepti
on
* occured.
*/ */
Exception(const std::string& message, Exception(const std::string& message,
const std::string& function, const std::string& function,
const std::string& filename, const std::string& filename,
int line); unsigned int line);
/** /**
* Gets the function name in which the exception was thrown. * Gets the function name where the exception occured.
* *
* @return the function name in which the exception was thrown. * @return The function name where the exception occured.
*/ */
const std::string& getFunction() const; const std::string& getFunction() const;
/** /**
* Gets the error message of the exception. * Gets the error message of the exception.
* *
* @return the error message. * @return The error message of the exception.
*/ */
const std::string& getMessage() const; const std::string& getMessage() const;
/** /**
* Gets the filename in which the exceptions was thrown. * Gets the filename where the exception occured.
* *
* @return the filename in which the exception was thrown. * @return The filename where the exception occured.
*/ */
const std::string& getFilename() const; const std::string& getFilename() const;
/** /**
* Gets the line number of the line where the exception was thrown. * Gets the line number where the exception occured.
* *
* @return the line number of the line where the exception was thro wn. * @return The line number where the exception occured.
*/ */
int getLine() const; unsigned int getLine() const;
protected: protected:
/**
* Holds the name of the function name where the
* exception occured.
*/
std::string mFunction; std::string mFunction;
/**
* Holds the error message of the exception.
*/
std::string mMessage; std::string mMessage;
/**
* Holds the filename where the exception occured.
*/
std::string mFilename; std::string mFilename;
int mLine;
/**
* Holds the line number where the exception occured.
*/
unsigned int mLine;
}; };
} }
#endif // end GCN_EXCEPTION_HPP #endif // end GCN_EXCEPTION_HPP
/* /*
* "Final Fantasy XI is the BEST!... It's even better then water!" * "Final Fantasy XI is the BEST!... It's even better then water!"
* - Astrolite * - Astrolite
* I believe it's WoW now days. * I believe it's WoW now days.
*/ */
 End of changes. 21 change blocks. 
65 lines changed or deleted 77 lines changed or added


 focushandler.hpp   focushandler.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_FOCUSHANDLER_HPP #ifndef GCN_FOCUSHANDLER_HPP
#define GCN_FOCUSHANDLER_HPP #define GCN_FOCUSHANDLER_HPP
#include <vector> #include <vector>
#include "guichan/event.hpp" #include "guichan/event.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
class Widget; class Widget;
/** /**
* Used to keep track of widget focus. You will probably not have * Handles focus for widgets in a Gui. Each Gui has at least one
* to use the FocusHandler directly to handle focus. Widget has * focus handler.
* functions for handling focus which uses a FocusHandler. Use them
* instead. * You will probably not use the focus handler directly as Widget
* has functions that automatically uses the active focus handler.
* *
* @see Widget::isFocused * @see Widget::isFocus, Widget::isModalFocused,
* @see Widget::requestFocus * Widget::isModalMouseInputFocused, Widget::requestFocus,
* @see Widget::setFocusable * Widget::requestModalFocus, Widget::requestModalMouseInputFocus,
* @see Widget::isFocusable * Widget::releaseModalFocus, Widget::relaseModalMouseInputFocus,
* @see FocusListener * Widget::setFocusable, Widget::isFocusable, FocusListener
*
* @since 0.1.0
*/ */
class GCN_CORE_DECLSPEC FocusHandler class GCN_CORE_DECLSPEC FocusHandler
{ {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
FocusHandler(); FocusHandler();
/** /**
* Destructor. * Destructor.
*/ */
virtual ~FocusHandler() { }; virtual ~FocusHandler() { };
/** /**
* Sets focus to a widget. A focus event will also be sent to the w * Requests focus for a widget. Focus will only be granted to a wid
idget's get
* focus listeners. * if it's focusable and if no other widget has modal focus.
* If a widget receives focus a focus event will be sent to the
* focus listeners of the widget.
* *
* @param widget the widget to focus. * @param widget The widget to request focus for.
* @see isFocused, Widget::requestFocus
*/ */
virtual void requestFocus(Widget* widget); virtual void requestFocus(Widget* widget);
/** /**
* Sets modal focus to a widget. * Requests modal focus for a widget. Focus will only be granted
* to a widget if it's focusable and if no other widget has modal
* focus.
* *
* @param widget the Widget to focus modal. * @param widget The widget to request modal focus for.
* @throws Exception when another widget already has modal focus. * @throws Exception when another widget already has modal focus.
* @see releaseModalFocus, Widget::requestModalFocus
*/ */
virtual void requestModalFocus(Widget* widget); virtual void requestModalFocus(Widget* widget);
/** /**
* Releases modal focus if the widget has modal focus. * Requests modal mouse input focus for a widget. Focus will only
* Otherwise nothing will be done. * be granted to a widget if it's focusable and if no other widget
* has modal mouse input focus.
* *
* @param widget the Widget to release modal focus for. * Modal mouse input focus means no other widget then the widget wi
th
* modal mouse input focus will receive mouse input. The widget wit
h
* modal mouse input focus will also receive mouse input no matter
what
* the mouse input is or where the mouse input occurs.
*
* @param widget The widget to focus for modal mouse input focus.
* @throws Exception when another widget already has modal mouse in
put
* focus.
* @see releaseModalMouseInputFocus, Widget::requestModalMouseInput
Focus
*/ */
virtual void releaseModalFocus(Widget* widget); virtual void requestModalMouseInputFocus(Widget* widget);
/** /**
* Sets modal mouse input focus to a widget. Modal mouse input focu * Releases modal focus if the widget has modal focus.
s means * If the widget doesn't have modal focus no relase will occur.
* no other widget then the widget with modal mouse input focus wil
l
* receive mouse input..
* The widget with modal mouse input focus will also receive mouse
input no
* matter what the mouse input is or where the mouse input occurs.
* *
* @param widget the widget to focus for modal mouse input focus. * @param widget The widget to release modal focus for.
* @throws Exception when another widget already has modal mouse in * @see reuqestModalFocus, Widget::releaseModalFocus
put focus.
*/ */
virtual void requestModalMouseInputFocus(Widget* widget); virtual void releaseModalFocus(Widget* widget);
/** /**
* Releases modal mouse input focus if the widget has modal mouse i nput * Releases modal mouse input focus if the widget has modal mouse i nput
* focus. Otherwise nothing will be done. * focus. If the widget doesn't have modal mouse input focus no rel
ase
* will occur.
* *
* @param widget the widget to release modal mouse input focus for. * @param widget the widget to release modal mouse input focus for.
* @see requestModalMouseInputFocus, Widget::releaseModalMouseInput Focus
*/ */
virtual void releaseModalMouseInputFocus(Widget* widget); virtual void releaseModalMouseInputFocus(Widget* widget);
/** /**
* Checks if a widget is focused.
*
* @param widget The widget to check.
* @return True if the widget is focused, false otherwise.
* @see Widget::isFocused
*/
virtual bool isFocused(const Widget* widget) const;
/**
* Gets the widget with focus. * Gets the widget with focus.
* *
* @return the Widget with focus. NULL will be returned if * @return The widget with focus. NULL if no widget has focus.
* no Widget has focus.
*/ */
virtual Widget* getFocused() const; virtual Widget* getFocused() const;
/** /**
* Gets the widget with modal focus. * Gets the widget with modal focus.
* *
* @return the Widget with modal focus. NULL will be returned * @return The widget with modal focus. NULL if no widget has
* if no Widget has modal focus. * modal focus.
*/ */
virtual Widget* getModalFocused() const; virtual Widget* getModalFocused() const;
/** /**
* Gets the widget with modal mouse input focus. * Gets the widget with modal mouse input focus.
* *
* @return the widget with modal mouse input focus. NULL will be re * @return The widget with modal mouse input focus. NULL if
turned * no widget has modal mouse input focus.
* if no widget has modal mouse input focus.
*/ */
virtual Widget* getModalMouseInputFocused() const; virtual Widget* getModalMouseInputFocused() const;
/** /**
* Focuses the next Widget. If no Widget has focus the first * Focuses the next widget added to a conainer.
* Widget gets focus. The order in which the Widgets are focused * If no widget has focus the first widget gets focus. The order
* depends on the order you add them to the GUI. * in which the widgets are focused is determined by the order
* they were added to a container.
*
* @see focusPrevious
*/ */
virtual void focusNext(); virtual void focusNext();
/** /**
* Focuses the previous Widget. If no Widget has focus the first * Focuses the previous widget added to a contaienr.
* Widget gets focus. The order in which the widgets are focused * If no widget has focus the first widget gets focus. The order
* depends on the order you add them to the GUI. * in which the widgets are focused is determined by the order
*/ * they were added to a container.
virtual void focusPrevious();
/**
* Checks if a Widget is focused.
* *
* @param widget widget to check if it is focused. * @see focusNext
* @return true if the widget is focused.
*/ */
virtual bool isFocused(const Widget* widget) const; virtual void focusPrevious();
/** /**
* Adds a widget to the FocusHandler. * Adds a widget to by handles by the focus handler.
* *
* @param widget the widget to add. * @param widget The widget to add.
* @see remove
*/ */
virtual void add(Widget* widget); virtual void add(Widget* widget);
/** /**
* Removes a widget from the FocusHandler. * Removes a widget from the focus handler.
* *
* @param widget the widget to remove. * @param widget The widget to remove.
* @see add
*/ */
virtual void remove(Widget* widget); virtual void remove(Widget* widget);
/** /**
* Focuses nothing. A focus event will also be sent to the focused * Focuses nothing. A focus event will also be sent to the
widget's * focused widget's focus listeners if a widget has focus.
* focus listeners if a widget has focus.
*/ */
virtual void focusNone(); virtual void focusNone();
/** /**
* Focuses the next Widget which allows tab in unless current focus * Focuses the next widget which allows tabbing in unless
ed * the current focused Widget disallows tabbing out.
* Widget disallows tab out. *
* @see tabPrevious
*/ */
virtual void tabNext(); virtual void tabNext();
/** /**
* Focuses the previous Widget which allows tab in unless current f * Focuses the previous widget which allows tabbing in unless
ocused * current focused widget disallows tabbing out.
* Widget disallows tab out. *
* @see tabNext
*/ */
virtual void tabPrevious(); virtual void tabPrevious();
/** /**
* Gets the widget being dragged. * Gets the widget being dragged. Used by the Gui class to
* keep track of the dragged widget.
* *
* @return the widget being dragged. * @return the widget being dragged.
* @see setDraggedWidget
*/ */
virtual Widget* getDraggedWidget(); virtual Widget* getDraggedWidget();
/** /**
* Sets the widget being dragged. * Sets the widget being dragged. Used by the Gui class to
* keep track of the dragged widget.
* *
* @param draggedWidget the widget being dragged. * @param draggedWidget The widget being dragged.
* @see getDraggedWidget
*/ */
virtual void setDraggedWidget(Widget* draggedWidget); virtual void setDraggedWidget(Widget* draggedWidget);
/** /**
* Gets the last widget with the mouse. * Gets the last widget with the mouse. Used by the Gui class
* to keep track the last widget with the mouse.
* *
* @return the last widget with the mouse. * @return The last widget with the mouse.
* @see setLastWidgetWithMouse
*/ */
virtual Widget* getLastWidgetWithMouse(); virtual Widget* getLastWidgetWithMouse();
/** /**
* Sets the last widget with the mouse. * Sets the last widget with the mouse. Used by the Gui class
* to keep track the last widget with the mouse.
* *
* @param lastWidgetWithMouse the last widget with the mouse. * @param lastWidgetWithMouse The last widget with the mouse.
* @see getLastWidgetWithMouse
*/ */
virtual void setLastWidgetWithMouse(Widget* lastWidgetWithMouse); virtual void setLastWidgetWithMouse(Widget* lastWidgetWithMouse);
/** /**
* Gets the last widget with modal focus. * Gets the last widget with modal focus.
* *
* @return the last widget with modal focus. * @return The last widget with modal focus.
* @see setLastWidgetWithModalFocus
*/ */
virtual Widget* getLastWidgetWithModalFocus(); virtual Widget* getLastWidgetWithModalFocus();
/** /**
* Sets the last widget with modal focus. * Sets the last widget with modal focus.
* *
* @param lastWidgetWithModalFocus the last widget with modal focus * @param lastWidgetWithModalFocus The last widget with modal focus
. .
* @see getLastWidgetWithModalFocus
*/ */
virtual void setLastWidgetWithModalFocus(Widget* lastWidgetWithModa lFocus); virtual void setLastWidgetWithModalFocus(Widget* lastWidgetWithModa lFocus);
/** /**
* Gets the last widget with modal mouse input focus. * Gets the last widget with modal mouse input focus.
* *
* @return the last widget with modal mouse input focus. * @return The last widget with modal mouse input focus.
* @see setLastWidgetWithModalMouseInputFocus
*/ */
virtual Widget* getLastWidgetWithModalMouseInputFocus(); virtual Widget* getLastWidgetWithModalMouseInputFocus();
/** /**
* Sets the last widget with modal mouse input focus. * Sets the last widget with modal mouse input focus.
* *
* @param lastMouseWithModalMouseInputFocus the last widget with m * @param lastMouseWithModalMouseInputFocus The last widget with
odal mouse input focus. * modal mouse input focus
.
* @see getLastWidgetWithModalMouseInputFocus
*/ */
virtual void setLastWidgetWithModalMouseInputFocus(Widget* lastWidg etWithModalMouseInputFocus); virtual void setLastWidgetWithModalMouseInputFocus(Widget* lastWidg etWithModalMouseInputFocus);
/** /**
* Gets the last widget pressed. * Gets the last widget pressed. Used by the Gui class to keep trac
k
* of pressed widgets.
* *
* @return the last widget pressed. * @return The last widget pressed.
* @see setLastWidgetPressed
*/ */
virtual Widget* getLastWidgetPressed(); virtual Widget* getLastWidgetPressed();
/** /**
* Sets the last widget pressed. * Sets the last widget pressed. Used by the Gui class to keep trac
k
* of pressed widgets.
* *
* @param lastWidgetPressed the last widget pressed. * @param lastWidgetPressed The last widget pressed.
* @see getLastWidgetPressed
*/ */
virtual void setLastWidgetPressed(Widget* lastWidgetPressed); virtual void setLastWidgetPressed(Widget* lastWidgetPressed);
protected: protected:
/** /**
* Distributes a focus lost event. * Distributes a focus lost event.
* *
* @param focusEvent the event to distribute. * @param focusEvent the event to distribute.
* @author Olof Naess
* @since 0.7.0 * @since 0.7.0
*/ */
virtual void distributeFocusLostEvent(const Event& focusEvent); virtual void distributeFocusLostEvent(const Event& focusEvent);
/** /**
* Distributes a focus gained event. * Distributes a focus gained event.
* *
* @param focusEvent the event to distribute. * @param focusEvent the event to distribute.
* @author Olof Naess
* @since 0.7.0 * @since 0.7.0
*/ */
virtual void distributeFocusGainedEvent(const Event& focusEvent); virtual void distributeFocusGainedEvent(const Event& focusEvent);
/**
* Typedef.
*/
typedef std::vector<Widget*> WidgetVector; typedef std::vector<Widget*> WidgetVector;
/**
* Typedef.
*/
typedef WidgetVector::iterator WidgetIterator; typedef WidgetVector::iterator WidgetIterator;
/**
* Holds the widgets currently being handled by the
* focus handler.
*/
WidgetVector mWidgets; WidgetVector mWidgets;
/**
* Holds the focused widget. NULL if no widget has focus.
*/
Widget* mFocusedWidget; Widget* mFocusedWidget;
/**
* Holds the modal focused widget. NULL if no widget has
* modal focused.
*/
Widget* mModalFocusedWidget; Widget* mModalFocusedWidget;
/**
* Holds the modal mouse input focused widget. NULL if no widget
* is being dragged.
*/
Widget* mModalMouseInputFocusedWidget; Widget* mModalMouseInputFocusedWidget;
/**
* Holds the dragged widget. NULL if no widget is
* being dragged.
*/
Widget* mDraggedWidget; Widget* mDraggedWidget;
/**
* Holds the last widget with the mouse.
*/
Widget* mLastWidgetWithMouse; Widget* mLastWidgetWithMouse;
/**
* Holds the last widget with modal focus.
*/
Widget* mLastWidgetWithModalFocus; Widget* mLastWidgetWithModalFocus;
/**
* Holds the last widget with modal mouse input focus.
*/
Widget* mLastWidgetWithModalMouseInputFocus; Widget* mLastWidgetWithModalMouseInputFocus;
/**
* Holds the last widget pressed.
*/
Widget* mLastWidgetPressed; Widget* mLastWidgetPressed;
}; };
} }
#endif // end GCN_FOCUSHANDLER_HPP #endif // end GCN_FOCUSHANDLER_HPP
 End of changes. 61 change blocks. 
130 lines changed or deleted 206 lines changed or added


 focuslistener.hpp   focuslistener.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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 #ifndef GCN_FOCUSLISTENER_HPP
#define GCN_FOCUSLISTENER_HPP #define GCN_FOCUSLISTENER_HPP
#include <string> #include <string>
#include "guichan/event.hpp" #include "guichan/event.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/** /**
* Listener of focus events from Widgets. To be able to listen for * Interface for listening for focus events from widgets.
* focus events you must make a class which inherits from this class
* and implements it's functions.
* *
* @see Widget::addFocusListener * @see Widget::addFocusListener, Widget::removeFocusListener
* @author Olof Naess * @author Olof Naess
* @since 0.7.0 * @since 0.7.0
*/ */
class GCN_CORE_DECLSPEC FocusListener class GCN_CORE_DECLSPEC FocusListener
{ {
public: public:
/** /**
* Destructor. * Destructor.
*/ */
virtual ~FocusListener() { } virtual ~FocusListener() { }
/** /**
* Called when a widget gains focus. * Called when a widget gains focus.
* *
* @param event discribes the event. * @param event Discribes the event.
*/ */
virtual void focusGained(const Event& event) { }; virtual void focusGained(const Event& event) { };
/** /**
* Called when a widget loses focus. * Called when a widget loses focus.
* *
* @param event discribes the event. * @param event Discribes the event.
*/ */
virtual void focusLost(const Event& 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 #endif // end GCN_FOCUSLISTENER_HPP
 End of changes. 7 change blocks. 
51 lines changed or deleted 45 lines changed or added


 font.hpp   font.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ^
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef GCN_FONT_HPP #ifndef GCN_FONT_HPP
#define GCN_FONT_HPP #define GCN_FONT_HPP
#include <string> #include <string>
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
class Graphics; class Graphics;
/** /**
* Holder of a font. Fonts should inherit from this class and * Interface for a font.
* implements it's functions.
* *
* @see ImageFont * @see ImageFont
*/ */
class GCN_CORE_DECLSPEC Font class GCN_CORE_DECLSPEC Font
{ {
public: public:
/** /**
* Destructor. * Destructor.
*/ */
virtual ~Font(){ } virtual ~Font(){ }
/** /**
* Gets the width of a string. The width of a string is not necesse rily * Gets the width of a string. The width of a string is not necesse rily
* the sum of all the widths of it's glyphs. * the sum of all the widths of it's glyphs.
* *
* @param text the string to return the width of. * @param text The string to return the width of.
* @return the width of a string. * @return The width of a string.
*/ */
virtual int getWidth(const std::string& text) const = 0; virtual int getWidth(const std::string& text) const = 0;
/** /**
* Gets the height of the glyphs in the font. * Gets the height of the glyphs in the font.
* *
* @return the height of the glyphs int the font. * @return The height of the glyphs int the font.
*/ */
virtual int getHeight() const = 0; virtual int getHeight() const = 0;
/** /**
* Gets a string index in a string providing an x coordinate. * Gets a string index in a string providing an x coordinate.
* Used to retrive a string index (for a character in a * Used to retrive a string index (for a character in a
* string) at a certain x position. It is especially useful * string) at a certain x position. It is especially useful
* when a mouse clicks in a TextField and you want to know which * when a mouse clicks in a TextField and you want to know which
* character was clicked. * character was clicked.
* *
* @return a string index in a string providing an x coordinate. * @return A string index in a string providing an x coordinate.
*/ */
virtual int getStringIndexAt(const std::string& text, int x) const; virtual int getStringIndexAt(const std::string& text, int x) const;
/** /**
* Draws a string. * Draws a string.
* *
* NOTE: You normally won't use this function to draw text since * NOTE: You normally won't use this function to draw text since
* Graphics contains better functions for drawing text. * Graphics contains better functions for drawing text.
* *
* @param graphics a Graphics object to use for drawing. * @param graphics A Graphics object to use for drawing.
* @param text the string to draw. * @param text The string to draw.
* @param x the x coordinate where to draw the string. * @param x The x coordinate where to draw the string.
* @param y the y coordinate where to draw the string. * @param y The y coordinate where to draw the string.
*/ */
virtual void drawString(Graphics* graphics, const std::string& text , virtual void drawString(Graphics* graphics, const std::string& text ,
int x, int y) = 0; int x, int y) = 0;
}; };
} }
#endif // end GCN_FONT_HPP #endif // end GCN_FONT_HPP
 End of changes. 7 change blocks. 
55 lines changed or deleted 41 lines changed or added


 genericinput.hpp   genericinput.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_GENERICINPUT_HPP #ifndef GCN_GENERICINPUT_HPP
#define GCN_GENERICINPUT_HPP #define GCN_GENERICINPUT_HPP
#include <queue> #include <queue>
#include "guichan/input.hpp" #include "guichan/input.hpp"
#include "guichan/keyinput.hpp" #include "guichan/keyinput.hpp"
#include "guichan/mouseinput.hpp" #include "guichan/mouseinput.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
class Key; class Key;
/** /**
* Generic input which can be used with any backend. * Implementation of a generic input which can be used with any
* back end.
*/ */
class GCN_CORE_DECLSPEC GenericInput: public Input class GCN_CORE_DECLSPEC GenericInput: public Input
{ {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
GenericInput(); GenericInput();
/** /**
* Pushes a key pressed event. * Pushes a key pressed event.
* *
* NOTE: If a special key is pressed, like the F1 key, * NOTE: If a special key is pressed, like the F1 key,
* the corresponding Guichan key value found * the corresponding Guichan key value found
* in the enum in Key should be pushed as the * in the enum in Key should be pushed as the
* unicode value. * unicode value.
* *
* @param unicode the unicode value of the key. * @param unicode The unicode value of the key.
*/ */
void pushKeyPressed(int unicode); void pushKeyPressed(int unicode);
/** /**
* Pushes a key released event. * Pushes a key released event.
* *
* NOTE: If a special key is pressed, like the F1 key, * NOTE: If a special key is pressed, like the F1 key,
* the corresponding Guichan key value found * the corresponding Guichan key value found
* in the enum in Key should be pushed as the * in the enum in Key should be pushed as the
* unicode value. * unicode value.
* *
* @param unicode the unicode value of the key. * @param unicode The unicode value of the key.
*/ */
void pushKeyReleased(int unicode); void pushKeyReleased(int unicode);
/** /**
* Pushes a mouse button pressed event. * Pushes a mouse button pressed event.
* *
* @param x the x coordinate of the mouse event. * @param x The x coordinate of the mouse event.
* @param y the y coordinate of the mouse event. * @param y The y coordinate of the mouse event.
* @param button the button of the mouse event. * @param button The button of the mouse event.
*/ */
void pushMouseButtonPressed(int x, int y, int button); void pushMouseButtonPressed(int x, int y, int button);
/** /**
* Pushes a mouse button released event. * Pushes a mouse button released event.
* *
* @param x the x coordinate of the mouse event. * @param x The x coordinate of the mouse event.
* @param y the y coordinate of the mouse event. * @param y The y coordinate of the mouse event.
* @param button the button of the mouse event. * @param button The button of the mouse event.
*/ */
void pushMouseButtonReleased(int x, int y, int button); void pushMouseButtonReleased(int x, int y, int button);
/** /**
* Pushes a mouse wheel moved up event. * Pushes a mouse wheel moved up event.
* *
* @param x the x coordinate of the mouse event. * @param x The x coordinate of the mouse event.
* @param y the y coordinate of the mouse event. * @param y The y coordinate of the mouse event.
*/ */
void pushMouseWheelMovedUp(int x, int y); void pushMouseWheelMovedUp(int x, int y);
/** /**
* Pushes a mouse wheel moved down event. * Pushes a mouse wheel moved down event.
* *
* @param x the x coordinate of the mouse event. * @param x The x coordinate of the mouse event.
* @param y the y coordinate of the mouse event. * @param y The y coordinate of the mouse event.
*/ */
void pushMouseWheelMovedDown(int x, int y); void pushMouseWheelMovedDown(int x, int y);
/** /**
* Pushes a mouse moved event. * Pushes a mouse moved event.
* *
* @param x the x coordinate of the mouse event. * @param x The x coordinate of the mouse event.
* @param y the y coordinate of the mouse event. * @param y The y coordinate of the mouse event.
*/ */
void pushMouseMoved(int x, int y); void pushMouseMoved(int x, int y);
// Inherited from Input // Inherited from Input
virtual bool isKeyQueueEmpty(); virtual bool isKeyQueueEmpty();
virtual KeyInput dequeueKeyInput(); virtual KeyInput dequeueKeyInput();
virtual bool isMouseQueueEmpty(); virtual bool isMouseQueueEmpty();
virtual MouseInput dequeueMouseInput(); virtual MouseInput dequeueMouseInput();
virtual void _pollInput(); virtual void _pollInput();
protected: protected:
/**
* Holds the key input queue.
*/
std::queue<KeyInput> mKeyInputQueue; std::queue<KeyInput> mKeyInputQueue;
/**
* Holds the mouse input queue.
*/
std::queue<MouseInput> mMouseInputQueue; std::queue<MouseInput> mMouseInputQueue;
}; };
} }
#endif // end GCN_INPUT_HPP #endif // end GCN_INPUT_HPP
 End of changes. 12 change blocks. 
60 lines changed or deleted 55 lines changed or added


 glut.hpp   glut.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_GLUT_HPP #ifndef GCN_GLUT_HPP
#define GCN_GLUT_HPP #define GCN_GLUT_HPP
#include <guichan/glut/glutinput.hpp> #include <guichan/glut/glutinput.hpp>
#include "platform.hpp" #include "platform.hpp"
extern "C" extern "C"
 End of changes. 2 change blocks. 
45 lines changed or deleted 32 lines changed or added


 graphics.hpp   graphics.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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 #ifndef GCN_GRAPHICS_HPP
#define GCN_GRAPHICS_HPP #define GCN_GRAPHICS_HPP
#include <iosfwd> #include <iosfwd>
#include <stack> #include <stack>
#include "guichan/cliprectangle.hpp" #include "guichan/cliprectangle.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
class Color; class Color;
class Font; class Font;
class Image; class Image;
/** /**
* Used for drawing graphics. It contains all vital functions for drawi * Abstract class for providing drawing primitve functions.
ng. * It contains all vital functions for drawing.
* We include implemented Graphics classes for some common platforms li *
ke * Guichan contains implementations of Graphics for common
* the Allegro library, the OpenGL library and the SDL library. To make * libraries like the Allegro library, the HGE library,
* Guichan usable under another platform, a Graphics class must be * the OpenGL library, the OpenLayer library, and the SDL library.
* implemented. * 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 * 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 * areas of the screen. Clip areas are put on a stack, which
you * means that you can push smaller and smaller clip areas onto the
* can push smaller and smaller clip areas onto the stack. All coordina * stack. All coordinates will be relative to the top most clip area.
tes * In most cases you won't have to worry about the clip areas,
* will be relative to the topmost clip area. In most cases you won't h * unless you want to implement some really complex widget.
ave * Pushing and poping of clip areas are handled automatically by
* to worry about the clip areas, unless you want to implement some rea * container widgets when their child widgets are drawn.
lly
* complex widget. Pushing and poping of clip areas are handled
* automatically by container widgets when their child widgets are draw
n.
* *
* IMPORTANT: Remember to pop each clip area that you pushed on the sta ck * IMPORTANT: Remember to pop each clip area that you pushed on the sta ck
* after you are done with it. * after you are done with it.
* *
* If you feel that Graphics is to restrictive for your needs, there is * If you feel that Graphics is to restrictive for your needs,
* no one stopping you from using your own code for drawing in Widgets. * there is no one stopping you from using your own code for drawing
* You could for instance use pure SDL in the drawing of Widgets bypass * in widgets. You could for instance use pure SDL in the drawing of
ing * widgets bypassing Graphics. This might however hurt portability of
* Graphics. This might however hurt portability of your application. * your application.
* *
* If you implement a Graphics class not present in Guichan we would be * If you implement a Graphics class not present in Guichan we would
very * be very happy to add it to Guichan.
* happy to add it to Guichan.
* *
* @see AllegroGraphics, OpenGLGraphics, SDLGraphics, Image * @see AllegroGraphics, HGEGraphics, OpenLayerGraphics, OpenGLGraphics
,
* SDLGraphics, Image
* @since 0.1.0
*/ */
class GCN_CORE_DECLSPEC Graphics class GCN_CORE_DECLSPEC Graphics
{ {
public: public:
/**
* Alignments for text drawing.
*/
enum Alignment
{
LEFT = 0,
CENTER,
RIGHT
};
/**
* Constructor.
*/
Graphics(); Graphics();
/**
* Destructor.
*/
virtual ~Graphics() { } virtual ~Graphics() { }
/** /**
* Initializes drawing. Called by the Gui when Gui::draw() is calle d. * Initializes drawing. Called by the Gui when Gui::draw() is calle d.
* It is needed by some implementations of Graphics to perform * It is needed by some implementations of Graphics to perform
* preparations before drawing. An example of such an implementatio n * preparations before drawing. An example of such an implementatio n
* would be OpenGLGraphics. * is the OpenGLGraphics.
* *
* NOTE: You will never need to call this function yourself. * NOTE: You will never need to call this function yourself, unless
* Gui will do it for you. * you use a Graphics object outside of Guichan.
* *
* @see _endDraw, Gui::draw * @see _endDraw, Gui::draw
*/ */
virtual void _beginDraw() { } virtual void _beginDraw() { }
/** /**
* Deinitializes drawing. Called by the Gui when a Gui::draw() is d one. * Deinitializes drawing. Called by the Gui when a Gui::draw() is d one.
* done. It should reset any state changes made by _beginDraw(). * done. It should reset any state changes made by _beginDraw().
* *
* NOTE: You will never need to call this function yourself. * NOTE: You will never need to call this function yourself, unless
* Gui will do it for you. * you use a Graphics object outside of Guichan.
* *
* @see _beginDraw, Gui::draw * @see _beginDraw, Gui::draw
*/ */
virtual void _endDraw() { } virtual void _endDraw() { }
/** /**
* Pushes a clip area onto the stack. The x and y coordinates in th e * Pushes a clip area onto the stack. The x and y coordinates in th e
* Rectangle will be relative to the last pushed clip area. * rectangle is relative to the last pushed clip area.
* If the new area falls outside the current clip area, it will be * If the new area falls outside the current clip area, it will be
* clipped as necessary. * clipped as necessary.
* *
* @param area the clip area to be pushed onto the stack. * If a clip area is outside of the top clip area a clip area with
* @return false if the the new area lays totally outside the * zero width and height will be pushed.
* current clip area. Note that an empty clip area *
* will be pused in this case. * @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); virtual bool pushClipArea(Rectangle area);
/** /**
* Removes the topmost clip area from the stack. * Removes the top most clip area from the stack.
* *
* @throws Exception if the stack is empty. * @throws Exception if the stack is empty.
*/ */
virtual void popClipArea(); virtual void popClipArea();
/** /**
* Gets the current clip area. Usefull if you want to do drawing * Gets the current clip area. Usefull if you want to do drawing
* bypassing Graphics. * bypassing Graphics.
* *
* @return the current clip area. * @return The current clip area.
*/ */
virtual const ClipRectangle& getCurrentClipArea(); virtual const ClipRectangle& getCurrentClipArea();
/** /**
* Draws a part of an Image. * Draws a part of an image.
* *
* NOTE: Width and height arguments will not scale the Image but * NOTE: Width and height arguments will not scale the image but
* specifies the size of the part to be drawn. If you want * specifies the size of the part to be drawn. If you want
* to draw the whole Image there is a simplified version of * to draw the whole image there is a simplified version of
* this function. * this function.
* *
* EXAMPLE: @code drawImage(myImage, 10, 10, 20, 20, 40, 40); @endc ode * EXAMPLE: @code drawImage(myImage, 10, 10, 20, 20, 40, 40); @endc ode
* Will draw a rectangular piece of myImage starting at * Will draw a rectangular piece of myImage starting at
* coordinate (10, 10) in myImage, with width and height 4 0. * coordinate (10, 10) in myImage, with width and height 4 0.
* The piece will be drawn with it's top left corner at * The piece will be drawn with it's top left corner at
* coordinate (20, 20). * coordinate (20, 20).
* *
* @param image the Image to draw. * @param image The image to draw.
* @param srcX source Image x coordinate. * @param srcX The source image x coordinate.
* @param srcY source Image y coordinate. * @param srcY The source image y coordinate.
* @param dstX destination x coordinate. * @param dstX The destination x coordinate.
* @param dstY destination y coordinate. * @param dstY The destination y coordinate.
* @param width the width of the piece. * @param width The width of the piece.
* @param height the height of the piece. * @param height The height of the piece.
*/ */
virtual void drawImage(const Image* image, virtual void drawImage(const Image* image,
int srcX, int srcX,
int srcY, int srcY,
int dstX, int dstX,
int dstY, int dstY,
int width, int width,
int height) = 0; int height) = 0;
/** /**
* Draws an image. A simplified version of the other drawImage. * Draws an image. A simplified version of the other drawImage.
* It will draw a whole image at the coordinate you specify. * It will draw a whole image at the coordinate you specify.
* It is equivalent to calling: * It is equivalent to calling:
* @code drawImage(myImage, 0, 0, dstX, dstY, image->getWidth(), \ * @code drawImage(myImage, 0, 0, dstX, dstY, image->getWidth(), \
image->getHeight()); @endcode image->getHeight()); @endcode
*/ */
virtual void drawImage(const Image* image, int dstX, int dstY); virtual void drawImage(const Image* image, int dstX, int dstY);
/** /**
* Draws a single point/pixel. * Draws a single point/pixel.
* *
* @param x the x coordinate. * @param x The x coordinate.
* @param y the y coordinate. * @param y The y coordinate.
*/ */
virtual void drawPoint(int x, int y) = 0; virtual void drawPoint(int x, int y) = 0;
/** /**
* Ddraws a line. * Ddraws a line.
* *
* @param x1 the first x coordinate. * @param x1 The first x coordinate.
* @param y1 the first y coordinate. * @param y1 The first y coordinate.
* @param x2 the second x coordinate. * @param x2 The second x coordinate.
* @param y2 the second y coordinate. * @param y2 The second y coordinate.
*/ */
virtual void drawLine(int x1, int y1, int x2, int y2) = 0; virtual void drawLine(int x1, int y1, int x2, int y2) = 0;
/** /**
* Draws a simple, non-filled, Rectangle with one pixel width. * Draws a simple, non-filled, rectangle with a one pixel width.
* *
* @param rectangle the Rectangle to draw. * @param rectangle The rectangle to draw.
*/ */
virtual void drawRectangle(const Rectangle& rectangle) = 0; virtual void drawRectangle(const Rectangle& rectangle) = 0;
/** /**
* Draws a filled Rectangle. * Draws a filled rectangle.
* *
* @param rectangle the filled Rectangle to draw. * @param rectangle The filled rectangle to draw.
*/ */
virtual void fillRectangle(const Rectangle& rectangle) = 0; virtual void fillRectangle(const Rectangle& rectangle) = 0;
/** /**
* Sets the Color to use when drawing. * Sets the color to use when drawing.
* *
* @param color a Color. * @param color A color.
* @see getColor
*/ */
virtual void setColor(const Color& color) = 0; virtual void setColor(const Color& color) = 0;
/** /**
* Gets the Color to use when drawing. * Gets the color to use when drawing.
* *
* @return the Color used when drawing. * @return The color used when drawing.
* @see setColor
*/ */
virtual const Color& getColor() const = 0; virtual const Color& getColor() const = 0;
/** /**
* Sets the font to use when drawing text. * Sets the font to use when drawing text.
* *
* @param font the Font to use when drawing. * @param font The font to use when drawing.
*/ */
virtual void setFont(Font* font); virtual void setFont(Font* font);
/** /**
* Draws text. * Draws text.
* *
* @param text the text to draw. * @param text The text to draw.
* @param x the x coordinate where to draw the text. * @param x The x coordinate where to draw the text.
* @param y the y coordinate where to draw the text. * @param y The y coordinate where to draw the text.
* @param alignment Graphics::LEFT, Graphics::CENTER or Graphics::R * @param alignment The alignemnt to use when drawing.
IGHT. * @throws Exception when no font has been set.
* @throws Exception when no Font is set.
*/ */
virtual void drawText(const std::string& text, virtual void drawText(const std::string& text,
int x, int x,
int y, int y,
unsigned int alignment = LEFT); Alignment alignment = LEFT);
/**
* Alignments for text drawing.
*/
enum
{
LEFT = 0,
CENTER,
RIGHT
};
protected: protected:
/**
* Holds the clip area stack.
*/
std::stack<ClipRectangle> mClipStack; std::stack<ClipRectangle> mClipStack;
/**
* Holds the current font.
*/
Font* mFont; Font* mFont;
}; };
} }
#endif // end GCN_GRAPHICS_HPP #endif // end GCN_GRAPHICS_HPP
/*
* yakslem - "little cake on cake, but that's the fall"
* finalman - "skall jag skriva det?"
* yakslem - "ja, varfor inte?"
*/
 End of changes. 36 change blocks. 
125 lines changed or deleted 128 lines changed or added


 gui.hpp   gui.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_GUI_HPP #ifndef GCN_GUI_HPP
#define GCN_GUI_HPP #define GCN_GUI_HPP
#include <list> #include <list>
#include <deque>
#include "guichan/keyevent.hpp" #include "guichan/keyevent.hpp"
#include "guichan/mouseevent.hpp" #include "guichan/mouseevent.hpp"
#include "guichan/mouseinput.hpp" #include "guichan/mouseinput.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
class FocusHandler; class FocusHandler;
class Graphics; class Graphics;
skipping to change at line 86 skipping to change at line 74
/** /**
* @mainpage * @mainpage
* @section Introduction * @section Introduction
* This documentation is mostly intended as a reference to the API. If you want to get started with Guichan, we suggest you check out the programs in the examples directory of the Guichan release. * This documentation is mostly intended as a reference to the API. If you want to get started with Guichan, we suggest you check out the programs in the examples directory of the Guichan release.
* @n * @n
* @n * @n
* This documentation is, and will always be, work in progress. If you find any errors, typos or inconsistencies, or if you feel something needs t o be explained in more detail - don't hesitate to tell us. * This documentation is, and will always be, work in progress. If you find any errors, typos or inconsistencies, or if you feel something needs t o be explained in more detail - don't hesitate to tell us.
*/ */
/** /**
* Gui core class. Contains a special widget called the top widget. * Contains a Guichan GUI. This is the core class of Guichan to which
* If you want to be able to have more then one Widget in your Gui, * implementations of back ends are passed, to make Guichan work with
* the top widget should be a Container. * a specific library, and to where the top widget (root widget of GUI)
* is added. If you want to be able to have more then one widget in you
r
* GUI, the top widget should be a container.
* *
* NOTE: For the Gui to function properly you need to set a Graphics * A Gui object cannot work properly without passing back end
* object to use and an Input object to use. * implementations to it. A Gui object must have an implementation of a
* Graphics and an implementation of Input.
*
* NOTE: A complete GUI also must have the ability to load images.
* Images are loaded with the Image class, so to make Guichan
* able to load images an implementation of ImageLoader must be
* passed to Image.
*
* @see Graphics, Input, Image
*/ */
class GCN_CORE_DECLSPEC Gui class GCN_CORE_DECLSPEC Gui
{ {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
Gui(); Gui();
/** /**
* Destructor. * Destructor.
*/ */
virtual ~Gui(); virtual ~Gui();
/** /**
* Sets the top Widget. * Sets the top widget. The top widget is the root widget
* of the GUI. If you want a GUI to be able to contain more
* than one widget the top widget should be a container.
* *
* @param top the top Widget. * @param top The top widget.
* @see Container
* @since 0.1.0
*/ */
virtual void setTop(Widget* top); virtual void setTop(Widget* top);
/** /**
* Gets the top Widget. * Gets the top widget. The top widget is the root widget
* of the GUI.
* *
* @return the top widget. NULL if no top widget has been set. * @return The top widget. NULL if no top widget has been set.
* @since 0.1.0
*/ */
virtual Widget* getTop() const; virtual Widget* getTop() const;
/** /**
* Sets the Graphics object to use for drawing. * Sets the graphics object to use for drawing.
* *
* @param graphics the Graphics object to use for drawing. * @param graphics The graphics object to use for drawing.
* @see SDLGraphics, OpenGLGraphics, AllegroGraphics * @see getGraphics, AllegroGraphics, HGEGraphics,
* OpenLayerGraphics, OpenGLGraphics, SDLGraphics
* @since 0.1.0
*/ */
virtual void setGraphics(Graphics* graphics); virtual void setGraphics(Graphics* graphics);
/** /**
* Gets the Graphics object used for drawing. * Gets the graphics object used for drawing.
* *
* @return the Graphics object used for drawing. NULL if no * @return The graphics object used for drawing. NULL if no
* Graphics object has been set. * graphics object has been set.
* @see setGraphics, AllegroGraphics, HGEGraphics,
* OpenLayerGraphics, OpenGLGraphics, SDLGraphics
* @since 0.1.0
*/ */
virtual Graphics* getGraphics() const; virtual Graphics* getGraphics() const;
/** /**
* Sets the Input object to use for input handling. * Sets the input object to use for input handling.
* *
* @param input the Input object to use for input handling. * @param input The input object to use for input handling.
* @see SDLInput, AllegroInput * @see getInput, AllegroInput, HGEInput, OpenLayerInput,
* SDLInput
* @since 0.1.0
*/ */
virtual void setInput(Input* input); virtual void setInput(Input* input);
/** /**
* Gets the Input object being used for input handling. * Gets the input object being used for input handling.
* *
* @return the Input object used for handling input. NULL if no * @return The input object used for handling input. NULL if no
* Input object has been set. * input object has been set.
* @see setInput, AllegroInput, HGEInput, OpenLayerInput,
* SDLInput
* @since 0.1.0
*/ */
virtual Input* getInput() const; virtual Input* getInput() const;
/** /**
* Performs the Gui logic. By calling this function all logic * Performs logic of the GUI. By calling this function all logic
* functions down in the Gui heirarchy will be called. * functions down in the GUI heirarchy will be called. When logic
* What performs in Logic can be just about anything like * is called for Gui, user input will be handled.
* adjusting a Widgets size or doing some calculations.
* *
* NOTE: Logic also deals with user input (Mouse and Keyboard) * @see Widget::logic
* for Widgets. * @since 0.1.0
*/ */
virtual void logic(); virtual void logic();
/** /**
* Draws the Gui. By calling this funcion all draw functions * Draws the GUI. By calling this funcion all draw functions
* down in the Gui hierarchy will be called. * down in the GUI hierarchy will be called. When draw is called
* the used Graphics object will be initialised and drawing of
* the top widget will commence.
*
* @see Widget::draw
* @since 0.1.0
*/ */
virtual void draw(); virtual void draw();
/** /**
* Focus none of the Widgets in the Gui. * Focuses none of the widgets in the Gui.
*
* @since 0.1.0
*/ */
virtual void focusNone(); virtual void focusNone();
/** /**
* Toggles the use of the tab key to focus Widgets. * Sets tabbing enabled, or not. Tabbing is the usage of
* By default, tabbing is enabled. * changing focus by utilising the tab key.
* *
* @param tabbing set to false if you want to disable tabbing. * @param tabbing True if tabbing should be enabled, false
* otherwise.
* @see isTabbingEnabled
* @since 0.1.0
*/ */
virtual void setTabbingEnabled(bool tabbing); virtual void setTabbingEnabled(bool tabbing);
/** /**
* Checks if tabbing is enabled. * Checks if tabbing is enabled.
* *
* @return true if tabbing is enabled. * @return True if tabbing is enabled, false otherwise.
* @see setTabbingEnabled
* @since 0.1.0
*/ */
virtual bool isTabbingEnabled(); virtual bool isTabbingEnabled();
/** /**
* Adds a global KeyListener to the Gui. * Adds a global key listener to the Gui. A global key listener
* will receive all key events generated from the GUI and global
* key listeners will receive the events before key listeners
* of widgets.
* *
* @param keyListener a KeyListener to add. * @param keyListener The key listener to add.
* @see removeGlobalKeyListener
* @since 0.5.0
*/ */
virtual void addGlobalKeyListener(KeyListener* keyListener); virtual void addGlobalKeyListener(KeyListener* keyListener);
/** /**
* Remove global KeyListener from the Gui. * Removes global key listener from the Gui.
* *
* @param keyListener a KeyListener to remove. * @param keyListener The key listener to remove.
* @throws Exception if the KeyListener hasn't been added. * @throws Exception if the key listener hasn't been added.
* @see addGlobalKeyListener
* @since 0.5.0
*/ */
virtual void removeGlobalKeyListener(KeyListener* keyListener); virtual void removeGlobalKeyListener(KeyListener* keyListener);
protected: protected:
/** /**
* Handles all mouse input. * Handles all mouse input.
* *
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void handleMouseInput(); virtual void handleMouseInput();
skipping to change at line 223 skipping to change at line 255
/** /**
* Handles key input. * Handles key input.
* *
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void handleKeyInput(); virtual void handleKeyInput();
/** /**
* Handles mouse moved input. * Handles mouse moved input.
* *
* @param mouseInput the mouse input to handle. * @param mouseInput The mouse input to handle.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void handleMouseMoved(const MouseInput& mouseInput); virtual void handleMouseMoved(const MouseInput& mouseInput);
/** /**
* Handles mouse pressed input. * Handles mouse pressed input.
* *
* @param mouseInput the mouse input to handle. * @param mouseInput The mouse input to handle.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void handleMousePressed(const MouseInput& mouseInput); virtual void handleMousePressed(const MouseInput& mouseInput);
/** /**
* *
* Handles mouse wheel moved down input. * Handles mouse wheel moved down input.
* *
* @param mouseInput the mouse input to handle. * @param mouseInput The mouse input to handle.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void handleMouseWheelMovedDown(const MouseInput& mouseInput ); virtual void handleMouseWheelMovedDown(const MouseInput& mouseInput );
/** /**
* Handles mouse wheel moved up input. * Handles mouse wheel moved up input.
* *
* @param mouseInput the mouse input to handle. * @param mouseInput The mouse input to handle.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void handleMouseWheelMovedUp(const MouseInput& mouseInput); virtual void handleMouseWheelMovedUp(const MouseInput& mouseInput);
/** /**
* Handles mouse released input. * Handles mouse released input.
* *
* @param mouseInput the mouse input to handle. * @param mouseInput The mouse input to handle.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void handleMouseReleased(const MouseInput& mouseInput); virtual void handleMouseReleased(const MouseInput& mouseInput);
/** /**
* Handles modal mouse input focus releases. When a release occurs * Handles modal focus. Modal focus needs to be checked at
appropriate * each logic iteration as it might be necessary to distribute
* mouse events should be distributed (such as mouse entered and mo * mouse entered or mouse exited events.
use exited).
* *
* @since 0.6.0 * @since 0.8.0
*/ */
virtual void handleModalMouseInputFocusRelease(); virtual void handleModalFocus();
/** /**
* Handles modal focus releases. When a release occurs appropriate * Handles modal mouse input focus. Modal mouse input focus needs
mouse events * to be checked at each logic iteration as it might be necessary t
* should be distributed (such as mouse entered and mouse exited). o
* distribute mouse entered or mouse exited events.
* *
* @since 0.6.0 * @since 0.8.0
*/ */
virtual void handleModalFocusRelease(); virtual void handleModalMouseInputFocus();
/**
* Handles modal focus gained. If modal focus has been gaind it mig
ht
* be necessary to distribute mouse entered or mouse exited events.
*
* @since 0.8.0
*/
virtual void handleModalFocusGained();
/**
* Handles modal mouse input focus gained. If modal focus has been
gaind
* it might be necessary to distribute mouse entered or mouse exite
d events.
*
* @since 0.8.0
*/
virtual void handleModalFocusReleased();
/** /**
* Distributes a mouse event. * Distributes a mouse event.
* *
* @param type The type of the event to distribute, * @param type The type of the event to distribute,
* @param button The button of the event (if any used) to distribut e. * @param button The button of the event (if any used) to distribut e.
* @param x The x coordinate of the event. * @param x The x coordinate of the event.
* @param y The y coordinate of the event. * @param y The y coordinate of the event.
* @param fource indicates whether the distribution should be force d or not. * @param fource indicates whether the distribution should be force d or not.
* A forced distribution distributes the event even i f a widget * A forced distribution distributes the event even i f a widget
* is not enabled or not visible. Default value is fa * is not enabled, not visible, another widget has mo
lse. dal
* focus or another widget has modal mouse input focu
s.
* Default value is false.
* @param toSourceOnly indicates whether the distribution should be to the * @param toSourceOnly indicates whether the distribution should be to the
* source widget only or to it's parent's mouse listeners * source widget only or to it's parent's mouse listeners
* as well. * as well.
* *
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void distributeMouseEvent(Widget* source, virtual void distributeMouseEvent(Widget* source,
int type, int type,
int button, int button,
int x, int x,
int y, int y,
bool force = false, bool force = false,
bool toSourceOnly = false); bool toSourceOnly = false);
/** /**
* Distributes a key event. * Distributes a key event.
* *
* @param keyEvent the key event to distribute. * @param keyEvent The key event to distribute.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void distributeKeyEvent(KeyEvent& keyEvent); virtual void distributeKeyEvent(KeyEvent& keyEvent);
/** /**
* Distributes a key event to the global key listeners. * Distributes a key event to the global key listeners.
* *
* @param keyEvent the key event to distribute. * @param keyEvent The key event to distribute.
* *
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void distributeKeyEventToGlobalKeyListeners(KeyEvent& keyEv ent); virtual void distributeKeyEventToGlobalKeyListeners(KeyEvent& keyEv ent);
/** /**
* Gets the widget at a certain position. * Gets the widget at a certain position.
* *
* @return the widget at a certain position. * @return The widget at a certain position.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual Widget* getWidgetAt(int x, int y); virtual Widget* getWidgetAt(int x, int y);
/** /**
* Gets the source of the mouse event. * Gets the source of the mouse event.
* *
* @return the source widget of the mouse event. * @return The source widget of the mouse event.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual Widget* getMouseEventSource(int x, int y); virtual Widget* getMouseEventSource(int x, int y);
/** /**
* Gets the source of the key event. * Gets the source of the key event.
* *
* @return the source widget of the key event. * @return The source widget of the key event.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual Widget* getKeyEventSource(); virtual Widget* getKeyEventSource();
/**
* Holds the top widget.
*/
Widget* mTop; Widget* mTop;
/**
* Holds the graphics implementation used.
*/
Graphics* mGraphics; Graphics* mGraphics;
/**
* Holds the input implementation used.
*/
Input* mInput; Input* mInput;
/**
* Holds the focus handler for the Gui.
*/
FocusHandler* mFocusHandler; FocusHandler* mFocusHandler;
/**
* True if tabbing is enabled, false otherwise.
*/
bool mTabbing; bool mTabbing;
/**
* Typedef.
*/
typedef std::list<KeyListener*> KeyListenerList; typedef std::list<KeyListener*> KeyListenerList;
/**
* Typedef.
*/
typedef KeyListenerList::iterator KeyListenerListIterator; typedef KeyListenerList::iterator KeyListenerListIterator;
/**
* Holds the global key listeners of the Gui.
*/
KeyListenerList mKeyListeners; KeyListenerList mKeyListeners;
// Current input state /**
* True if shift is pressed, false otherwise.
*/
bool mShiftPressed; bool mShiftPressed;
/**
* True if meta is pressed, false otherwise.
*/
bool mMetaPressed; bool mMetaPressed;
/**
* True if control is pressed, false otherwise.
*/
bool mControlPressed; bool mControlPressed;
/**
* True if alt is pressed, false otherwise.
*/
bool mAltPressed; bool mAltPressed;
// Last mouse state /**
* Holds the last mouse button pressed.
*/
unsigned int mLastMousePressButton; unsigned int mLastMousePressButton;
/**
* Holds the last mouse press time stamp.
*/
int mLastMousePressTimeStamp; int mLastMousePressTimeStamp;
/**
* Holds the last mouse x coordinate.
*/
int mLastMouseX; int mLastMouseX;
/**
* Holds the last mouse y coordinate.
*/
int mLastMouseY; int mLastMouseY;
/**
* Holds the current click count. Used to keep track
* of clicks for a the last pressed button.
*/
int mClickCount; int mClickCount;
/**
* Holds the last button used when a drag of a widget
* was initiated. Used to be able to release a drag
* when the same button is released.
*/
int mLastMouseDragButton; int mLastMouseDragButton;
/**
* Holds a stack with all the widgets with the mouse.
* Used to properly distribute mouse events.
*/
std::deque<Widget*> mWidgetWithMouseQueue;
}; };
} }
#endif // end GCN_GUI_HPP #endif // end GCN_GUI_HPP
/* yakslem - "Women, it's a constant struggle." /* yakslem - "Women, it's a constant struggle."
* finalman - "Yes, but sometimes they succeed with their guesses." * finalman - "Yes, but sometimes they succeed with their guesses."
* yaklsem - "...eh...I was talking about love." * yaklsem - "...eh...I was talking about love."
* finalman - "Oh...ok..." * finalman - "Oh...ok..."
* An awkward silence followed. * An awkward silence followed.
 End of changes. 64 change blocks. 
109 lines changed or deleted 237 lines changed or added


 guichan.hpp   guichan.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_GUICHAN_HPP #ifndef GCN_GUICHAN_HPP
#define GCN_GUICHAN_HPP #define GCN_GUICHAN_HPP
#include <guichan/actionevent.hpp> #include <guichan/actionevent.hpp>
#include <guichan/actionlistener.hpp> #include <guichan/actionlistener.hpp>
#include <guichan/graphics.hpp> #include <guichan/cliprectangle.hpp>
#include <guichan/color.hpp> #include <guichan/color.hpp>
#include <guichan/deathlistener.hpp> #include <guichan/deathlistener.hpp>
#include <guichan/event.hpp> #include <guichan/event.hpp>
#include <guichan/exception.hpp> #include <guichan/exception.hpp>
#include <guichan/focushandler.hpp> #include <guichan/focushandler.hpp>
#include <guichan/focuslistener.hpp> #include <guichan/focuslistener.hpp>
#include <guichan/font.hpp> #include <guichan/font.hpp>
#include <guichan/genericinput.hpp> #include <guichan/genericinput.hpp>
#include <guichan/graphics.hpp>
#include <guichan/gui.hpp> #include <guichan/gui.hpp>
#include <guichan/image.hpp> #include <guichan/image.hpp>
#include <guichan/imagefont.hpp> #include <guichan/imagefont.hpp>
#include <guichan/imageloader.hpp> #include <guichan/imageloader.hpp>
#include <guichan/input.hpp> #include <guichan/input.hpp>
#include <guichan/inputevent.hpp> #include <guichan/inputevent.hpp>
#include <guichan/key.hpp> #include <guichan/key.hpp>
#include <guichan/keyevent.hpp> #include <guichan/keyevent.hpp>
#include <guichan/keyinput.hpp> #include <guichan/keyinput.hpp>
#include <guichan/keylistener.hpp> #include <guichan/keylistener.hpp>
#include <guichan/listmodel.hpp> #include <guichan/listmodel.hpp>
#include <guichan/mouseevent.hpp> #include <guichan/mouseevent.hpp>
#include <guichan/mouseinput.hpp> #include <guichan/mouseinput.hpp>
#include <guichan/mouselistener.hpp> #include <guichan/mouselistener.hpp>
#include <guichan/rectangle.hpp> #include <guichan/rectangle.hpp>
#include <guichan/cliprectangle.hpp> #include <guichan/selectionevent.hpp>
#include <guichan/selectionlistener.hpp>
#include <guichan/widget.hpp> #include <guichan/widget.hpp>
#include <guichan/widgetlistener.hpp>
#include <guichan/widgets/button.hpp> #include <guichan/widgets/button.hpp>
#include <guichan/widgets/checkbox.hpp> #include <guichan/widgets/checkbox.hpp>
#include <guichan/widgets/container.hpp> #include <guichan/widgets/container.hpp>
#include <guichan/widgets/dropdown.hpp> #include <guichan/widgets/dropdown.hpp>
#include <guichan/widgets/icon.hpp> #include <guichan/widgets/icon.hpp>
#include <guichan/widgets/imagebutton.hpp>
#include <guichan/widgets/label.hpp> #include <guichan/widgets/label.hpp>
#include <guichan/widgets/listbox.hpp> #include <guichan/widgets/listbox.hpp>
#include <guichan/widgets/scrollarea.hpp> #include <guichan/widgets/scrollarea.hpp>
#include <guichan/widgets/slider.hpp> #include <guichan/widgets/slider.hpp>
#include <guichan/widgets/radiobutton.hpp> #include <guichan/widgets/radiobutton.hpp>
#include <guichan/widgets/tab.hpp>
#include <guichan/widgets/tabbedarea.hpp>
#include <guichan/widgets/textbox.hpp> #include <guichan/widgets/textbox.hpp>
#include <guichan/widgets/textfield.hpp> #include <guichan/widgets/textfield.hpp>
#include <guichan/widgets/window.hpp> #include <guichan/widgets/window.hpp>
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
class Widget; class Widget;
extern "C" extern "C"
{ {
 End of changes. 8 change blocks. 
49 lines changed or deleted 40 lines changed or added


 icon.hpp   icon.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_ICON_HPP #ifndef GCN_ICON_HPP
#define GCN_ICON_HPP #define GCN_ICON_HPP
#include "guichan/image.hpp" #include "guichan/image.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include "guichan/widget.hpp" #include "guichan/widget.hpp"
namespace gcn namespace gcn
{ {
/** /**
* An Icon for displaying images. * Implements an icon capable of displaying an image.
*/ */
class GCN_CORE_DECLSPEC Icon: public Widget class GCN_CORE_DECLSPEC Icon: public Widget
{ {
public: public:
/** /**
* Default constructor.
*/
Icon();
/**
* Constructor. * Constructor.
* *
* @param image an Image to display. * @param filename The filename of the image to display.
*/ */
Icon(Image* image); Icon(const std::string& filename);
/**
* Constructor.
*
* @param image The image to display.
*/
Icon(const Image* image);
/**
* Descructor.
*/
virtual ~Icon();
/**
* Sets the image to display. Existing image is freed automatically
* if it was loaded internally.
*
* @param image The image to display.
*/
void setImage(const Image* image);
/**
* Gets the current image.
*
* @return The current image.
*/
const Image* getImage() const;
// Inherited from Widget // Inherited from Widget
virtual void draw(Graphics* graphics); virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
protected: protected:
Image* mImage; /**
* The image to display.
*/
const Image* mImage;
/**
* True if the image has been loaded internally, false otherwise.
* An image not loaded internally should not be deleted in the
* destructor.
*/
bool mInternalImage;
}; };
} }
#endif // end GCN_ICON_HPP #endif // end GCN_ICON_HPP
 End of changes. 8 change blocks. 
51 lines changed or deleted 78 lines changed or added


 image.hpp   image.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_IMAGE_HPP #ifndef GCN_IMAGE_HPP
#define GCN_IMAGE_HPP #define GCN_IMAGE_HPP
#include <string> #include <string>
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
skipping to change at line 78 skipping to change at line 65
/** /**
* Holds an image. To be able to use this class you must first set an * Holds an image. To be able to use this class you must first set an
* ImageLoader in Image by calling * ImageLoader in Image by calling
* @code Image::setImageLoader(myImageLoader) @endcode * @code Image::setImageLoader(myImageLoader) @endcode
* The function is static. If this is not done, the constructor taking a * The function is static. If this is not done, the constructor taking a
* filename will throw an exception. The ImageLoader you use must be * filename will throw an exception. The ImageLoader you use must be
* compatible with the Graphics object you use. * compatible with the Graphics object you use.
* *
* EXAMPLE: If you use SDLGraphics you should use SDLImageLoader. * EXAMPLE: If you use SDLGraphics you should use SDLImageLoader.
* Otherwise your program will crash in a most bizarre way. * Otherwise your program might crash in a most bizarre way.
* @see AllegroImageLoader, HGEImageLoader, OpenLayerImageLoader,
* OpenGLAllegroImageLoader, OpenGLSDLImageLoader, SDLImageLoader
* @since 0.1.0
*/ */
class GCN_CORE_DECLSPEC Image class GCN_CORE_DECLSPEC Image
{ {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
Image(); Image();
/** /**
* Destructor. * Destructor.
*/ */
virtual ~Image(); virtual ~Image();
/** /**
* Loads an image by calling the Image class' ImageLoader. All imag e loaders implemented * Loads an image by using the class' image laoder. All image loade rs implemented
* in Guichan return a newly instantiated image which must be delet ed in * in Guichan return a newly instantiated image which must be delet ed in
* order to avoid a memory leak. * order to avoid a memory leak.
* *
* NOTE: The functions getPixel and putPixel are only guaranteed to work * NOTE: The functions getPixel and putPixel are only guaranteed to work
* before an image has been converted to display format. * before an image has been converted to display format.
* *
* @param filename the file to load. * @param filename The file to load.
* @param convertToDisplayFormat true if the image should be conver * @param convertToDisplayFormat True if the image should be conver
ted ted
* to display, false otherwise. * to display, false otherwise.
* @since 0.5.0
*/ */
static Image* load(const std::string& filename, bool convertToDispl ayFormat = true); static Image* load(const std::string& filename, bool convertToDispl ayFormat = true);
/** /**
* Gets the ImageLoader used for loading Images. * Gets the image loader used for loading images.
* *
* @return the ImageLoader used for loading Images. * @return The image loader used for loading images.
* @see SDLImageLoader, AllegroImageLoader * @see setImageLoader, AllegroImageLoader, HGEImageLoader,
* OpenLayerImageLoader, OpenGLAllegroImageLoader,
* OpenGLSDLImageLoader, SDLImageLoader
* @since 0.1.0
*/ */
static ImageLoader* getImageLoader(); static ImageLoader* getImageLoader();
/** /**
* Sets the ImageLoader to be used for loading images. * Sets the ImageLoader to be used for loading images.
* *
* IMPORTANT: The ImageLoader is static and MUST be set before load * IMPORTANT: The image loader is static and MUST be set before
ing * loading images!
* images!
* *
* @param imageLoader the ImageLoader to be used for loading images * @param imageLoader The image loader to be used for loading image
. s.
* @see SDLImageLoader, AllegroImageLoader * @see getImageLoader, AllegroImageLoader, HGEImageLoader,
* OpenLayerImageLoader, OpenGLAllegroImageLoader,
* OpenGLSDLImageLoader, SDLImageLoader
* @since 0.1.0
*/ */
static void setImageLoader(ImageLoader* imageLoader); static void setImageLoader(ImageLoader* imageLoader);
/** /**
* Frees an image. * Frees an image.
*
* @since 0.5.0
*/ */
virtual void free() = 0; virtual void free() = 0;
/** /**
* Gets the width of the Image. * Gets the width of the image.
* *
* @return the image width * @return The width of the image.
*
* @since 0.1.0
*/ */
virtual int getWidth() const = 0; virtual int getWidth() const = 0;
/** /**
* Gets the height of the Image. * Gets the height of the image.
* *
* @return the image height * @return The height of the image.
*
* @since 0.1.0
*/ */
virtual int getHeight() const = 0; virtual int getHeight() const = 0;
/** /**
* Gets the color of a pixel at coordinate (x, y) in the image. * Gets the color of a pixel at coordinate (x, y) in the image.
* *
* IMPORTANT: Only guaranteed to work before the image has been * IMPORTANT: Only guaranteed to work before the image has been
* converted to display format. * converted to display format.
* *
* @param x the x coordinate. * @param x The x coordinate.
* @param y the y coordinate. * @param y The y coordinate.
* @return the color of the pixel. * @return The color of the pixel.
*
* @since 0.5.0
*/ */
virtual Color getPixel(int x, int y) = 0; virtual Color getPixel(int x, int y) = 0;
/** /**
* Puts a pixel with a certain color at coordinate (x, y). * Puts a pixel with a certain color at coordinate (x, y).
* *
* @param x the x coordinate. * @param x The x coordinate.
* @param y the y coordinate. * @param y The y coordinate.
* @param color the color of the pixel to put. * @param color The color of the pixel to put.
* @since 0.5.0
*/ */
virtual void putPixel(int x, int y, const Color& color) = 0; virtual void putPixel(int x, int y, const Color& color) = 0;
/** /**
* Converts the image, if possible, to display format. * Converts the image, if possible, to display format.
* *
* IMPORTANT: Only guaranteed to work before the image has been * IMPORTANT: Only guaranteed to work before the image has been
* converted to display format. * converted to display format.
* @since 0.5.0
*/ */
virtual void convertToDisplayFormat() = 0; virtual void convertToDisplayFormat() = 0;
protected: protected:
/**
* Holds the image loader to be used when loading images.
*/
static ImageLoader* mImageLoader; static ImageLoader* mImageLoader;
}; };
} }
#endif // end GCN_IMAGE_HPP #endif // end GCN_IMAGE_HPP
 End of changes. 19 change blocks. 
69 lines changed or deleted 78 lines changed or added


 imagefont.hpp   imagefont.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_IMAGEFONT_HPP #ifndef GCN_IMAGEFONT_HPP
#define GCN_IMAGEFONT_HPP #define GCN_IMAGEFONT_HPP
#include <string> #include <string>
#include "guichan/font.hpp" #include "guichan/font.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include "guichan/rectangle.hpp" #include "guichan/rectangle.hpp"
namespace gcn namespace gcn
{ {
class Color; class Color;
class Graphics; class Graphics;
class Image; class Image;
/** /**
* A font using an image containing the font data. It implements the fo * A font using an image containing the font data. ImageFont can be use
nt d
* class. You can use any filetype for the font data as long as it can * with any supported by the current used ImageLoader.
be
* loaded with your ImageLoader.
* *
* This are two examples of an image containing a font. * These are two examples of an image containing a font.
* \image html imagefontexample.bmp * \image html imagefontexample.bmp
* \image html imagefontexample2.bmp * \image html imagefontexample2.bmp
* *
* The Image font format works like this: The first pixel, the pixal at * The Image font format works like this: The first pixel, the pixal at
* coordinate (0,0), tells which color to look for when seperating glyp hs. * coordinate (0,0), tells which color to look for when seperating glyp hs.
* You create an image with your glyphs and simple separates them with * You create an image with your glyphs and simple separates them with
* the seperation color. When you create your ImageFont you supply the * the seperation color. When you create your image font you supply the
* constructor with the glyphs present in your image. When creating an * constructor with the glyphs present in your image.
* ImageFont for the image data in the first example above, the followi *
ng * To create an ImageFont from the first image example above the follow
* constructor call would be used. ing
* constructor call should be made:
* @code gcn::ImageFont imageFont("fixedfont_big.bmp"," abcdefghijklmno \ * @code gcn::ImageFont imageFont("fixedfont_big.bmp"," abcdefghijklmno \
pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); @endcode pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); @endcode
* Noteworthy is that the first glyph actually gives the width of space *
. * Note worthy is that the first glyph actually gives the width of spac
* Glyphs can, as seen in the second example above, be seperated with e.
* Glyphs can, as seen in the second image example above, be seperated
with
* horizontal lines making it possible to draw glyphs on more then one * horizontal lines making it possible to draw glyphs on more then one
* line in the image. However, these vertical lines must be of one pixe * line in the image. However, these vertical lines must have a height
l of
* size! * one pixel!
*/ */
class GCN_CORE_DECLSPEC ImageFont: public Font class GCN_CORE_DECLSPEC ImageFont: public Font
{ {
public: public:
/** /**
* Constructor which takes an image file containing the font and * Constructor. Takes an image file containing the font and
* a string containing the glyphs. The glyphs in the string should * a string containing the glyphs. The glyphs in the string should
* be in the same order as they appear in the font image. * be in the same order as they appear in the font image.
* *
* @param filename the filename of the image. * @param filename The filename of the image.
* @param glyphs the glyphs found in the image. * @param glyphs The glyphs found in the image.
* @throws Exception when glyph list is incorrect or the font file is * @throws Exception when glyph list is incorrect or the font file is
* corrupt or if no ImageLoader exists. * corrupt or if no ImageLoader exists.
*/ */
ImageFont(const std::string& filename, const std::string& glyphs); ImageFont(const std::string& filename, const std::string& glyphs);
/** /**
* Constructor which takes an image file containing the font and * Constructor. Takes an image containing the font and
* a string containing the glyphs. The glyphs in the string should
* be in the same order as they appear in the font image.
* The image will be deleted in the destructor.
*
* @param image The image with font glyphs.
* @param glyphs The glyphs found in the image.
* @throws Exception when glyph list is incorrect or the font image
is
* is missing.
*/
ImageFont(Image* image, const std::string& glyphs);
/**
* Constructor. Takes an image file containing the font and
* two boundaries of ASCII values. The font image should include * two boundaries of ASCII values. The font image should include
* all glyphs specified with the boundaries in increasing ASCII * all glyphs specified with the boundaries in increasing ASCII
* order. The boundaries are inclusive. * order. The boundaries are inclusive.
* *
* @param filename the filename of the image. * @param filename The filename of the image.
* @param glyphsFrom the ASCII value of the first glyph found in th * @param glyphsFrom The ASCII value of the first glyph found in th
e e
* image. * image.
* @param glyphsTo the ASCII value of the last glyph found in the * @param glyphsTo The ASCII value of the last glyph found in the
* image. * image.
* @throws Exception when glyph bondaries are incorrect or the font * @throws Exception when glyph bondaries are incorrect or the font
* file is corrupt or if no ImageLoader exists. * file is corrupt or if no ImageLoader exists.
*/ */
ImageFont(const std::string& filename, unsigned char glyphsFrom=32, ImageFont(const std::string& filename,
unsigned char glyphsFrom=32,
unsigned char glyphsTo=126); unsigned char glyphsTo=126);
/** /**
* Destructor. * Destructor.
*/ */
virtual ~ImageFont(); virtual ~ImageFont();
/** /**
* Draws a glyph. * Draws a glyph.
* *
* NOTE: You normally won't use this function to draw text since * NOTE: You normally won't use this function to draw text since
* the Graphics class contains better functions for drawing * the Graphics class contains better functions for drawing
* text. * text.
* *
* @param graphics a graphics object to be used for drawing. * @param graphics A graphics object used for drawing.
* @param glyph a glyph to draw. * @param glyph A glyph to draw.
* @param x the x coordinate where to draw the glyph. * @param x The x coordinate where to draw the glyph.
* @param y the y coordinate where to draw the glyph. * @param y The y coordinate where to draw the glyph.
* @return the width of the glyph in pixels. * @return The width of the glyph in pixels.
* @see Graphics
*/ */
virtual int drawGlyph(Graphics* graphics, unsigned char glyph, virtual int drawGlyph(Graphics* graphics, unsigned char glyph,
int x, int y); int x, int y);
/** /**
* Sets the spacing between rows in pixels. Default is 0 pixels. * Sets the space between rows in pixels. Default is 0 pixels.
* The spacing can be negative. * The space can be negative.
* *
* @param spacing the spacing in pixels. * @param spacing The space between rows in pixels.
* @see getRowSpacing
*/ */
virtual void setRowSpacing(int spacing); virtual void setRowSpacing(int spacing);
/** /**
* Gets the spacing between rows in pixels. * Gets the space between rows in pixels.
* *
* @return the spacing. * @return The space between rows in pixels.
* @see setRowSpacing
*/ */
virtual int getRowSpacing(); virtual int getRowSpacing();
/** /**
* Sets the spacing between letters in pixels. Default is 0 pixels. * Sets the spacing between glyphs in pixels. Default is 0 pixels.
* The spacing can be negative. * The space can be negative.
* *
* @param spacing the spacing in pixels * @param spacing The glyph space in pixels.
* @see getGlyphSpacing
*/ */
virtual void setGlyphSpacing(int spacing); virtual void setGlyphSpacing(int spacing);
/** /**
* Gets the spacing between letters in pixels. * Gets the spacing between letters in pixels.
* *
* @return the spacing. * @return the spacing.
* @see setGlyphSpacing
*/ */
virtual int getGlyphSpacing(); virtual int getGlyphSpacing();
/** /**
* Gets a width of a glyph. * Gets a width of a glyph in pixels.
* *
* @param glyph the glyph which width will be returned * @param glyph The glyph which width will be returned.
* @return the width of a glyph * @return The width of a glyph in pixels.
*/ */
virtual int getWidth(unsigned char glyph) const; virtual int getWidth(unsigned char glyph) const;
// Inherited from Font // Inherited from Font
virtual int getWidth(const std::string& text) const; virtual int getWidth(const std::string& text) const;
virtual void drawString(Graphics* graphics, const std::string& text , virtual void drawString(Graphics* graphics, const std::string& text ,
int x, int y); int x, int y);
virtual int getHeight() const; virtual int getHeight() const;
virtual int getStringIndexAt(const std::string& text, int x); virtual int getStringIndexAt(const std::string& text, int x);
protected: protected:
void addGlyph(unsigned char c, int &x, int &y, const Color& separat /**
or); * Scans for a certain glyph.
*
* @param glyph The glyph to scan for. Used for exception messages.
* @param x The x coordinate where to begin the scan. The coordinat
e
* will be updated with the end x coordinate of the glyph
* when the scan is complete.
* @param y The y coordinate where to begin the scan. The coordinat
e
* will be updated with the end y coordinate of the glyph
* when the scan is complete.
* @param separator The color separator to look for where the glyph
ends.
* @return A rectangle with the found glyph dimension in the image
* with the font.
* @throws Exception when no glyph is found.
*/
Rectangle scanForGlyph(unsigned char glyph,
int x,
int y,
const Color& separator);
/**
* Holds the glyphs areas in the image.
*/
Rectangle mGlyph[256]; Rectangle mGlyph[256];
/**
* Holds the height of the image font.
*/
int mHeight; int mHeight;
/**
* Holds the glyph spacing of the image font.
*/
int mGlyphSpacing; int mGlyphSpacing;
/**
* Holds the row spacing of the image font.
*/
int mRowSpacing; int mRowSpacing;
/**
* Holds the image with the font data.
*/
Image* mImage; Image* mImage;
/**
* Holds the filename of the image with the font data.
*/
std::string mFilename; std::string mFilename;
}; };
} }
#endif // end GCN_IMAGEFONT_HPP #endif // end GCN_IMAGEFONT_HPP
 End of changes. 30 change blocks. 
90 lines changed or deleted 139 lines changed or added


 imageloader.hpp   imageloader.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_IMAGELOADER_HPP #ifndef GCN_IMAGELOADER_HPP
#define GCN_IMAGELOADER_HPP #define GCN_IMAGELOADER_HPP
#include <iosfwd> #include <iosfwd>
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
class Image; class Image;
/** /**
* ImageLoaders base class. Contains basic image loading functions ever * Abstract class for providing functions for loading images.
y *
* image loader should have. Image loaders should inherit from this * Guichan contains implementations of ImageLoader for common
* class and impements it's functions. * libraries like the Allegro library, the HGE library,
* he OpenLayer library, and the SDL library.
* To make Guichan usable with other libraries, an ImageLoader
* class must be implemented.
*
* To make Guichan use an image loader, the image loader needs
* to be passed to the Image class using the static method
* Image::setImageLoader.
*
* @see Image::setImageLoader, Image::getImageLoader,
* AllegroImageLoader, HGEImageLoader, OpenLayerImageLoader,
* OpenGLAllegroImageLoader, OpenGLSDLImageLoader,
* SDLImageLoader
* @since 0.1.0
*/ */
class GCN_CORE_DECLSPEC ImageLoader class GCN_CORE_DECLSPEC ImageLoader
{ {
public: public:
/** /**
* Destructor. * Destructor.
*/ */
virtual ~ImageLoader() { } virtual ~ImageLoader() { }
/** /**
* Loads an image by calling the image's ImageLoader. * Loads an image.
* *
* NOTE: The functions getPixel and putPixel in Image are only guar * NOTE: The functions Image::getPixel and Image::putPixel
anteed to * are only guaranteed to work before an image has
* work before an image has been converted to display format. * been converted to display format.
* *
* @param filename the file to load. * @param filename The filename of the image to load.
* @param convertToDisplayFormat true if the image should be conver * @param convertToDisplayFormat True if the image should be conver
ted ted
* to display, false otherwise. * to display, false otherwise.
*/ */
virtual Image* load(const std::string& filename, bool convertToDisp layFormat = true) = 0; virtual Image* load(const std::string& filename, bool convertToDisp layFormat = true) = 0;
}; };
} }
#endif // end GCN_IMAGELOADER_HPP #endif // end GCN_IMAGELOADER_HPP
 End of changes. 6 change blocks. 
56 lines changed or deleted 56 lines changed or added


 input.hpp   input.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_INPUT_HPP #ifndef GCN_INPUT_HPP
#define GCN_INPUT_HPP #define GCN_INPUT_HPP
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
class KeyInput; class KeyInput;
class MouseInput; class MouseInput;
/** /**
* Input events base class. Input classes should inherit from this clas * Abstract class for providing functions for user input.
s
* and implements it's functions.
* *
* @see SDLInput, AllegroInput * Guichan contains implementations of Input for common
* libraries like the Allegro library, the HGE library,
* and the SDL library.
* To make Guichan usable with other libraries, an Input
* class must be implemented.
*
* @see AllegroInput, HGEInput, OpenLayerInput,
* SDLInput
*/ */
class GCN_CORE_DECLSPEC Input class GCN_CORE_DECLSPEC Input
{ {
public: public:
/** /**
* Destructor. * Destructor.
*/ */
virtual ~Input(){ } virtual ~Input(){ }
/** /**
* Checks whether the key queue is empty or not. * Checks if the key queue is empty, or not.
* *
* @return true if the key queue is empty. * @return True if the key queue is empty,
* false otherwise.
*/ */
virtual bool isKeyQueueEmpty() = 0; virtual bool isKeyQueueEmpty() = 0;
/** /**
* Dequeues the key input queue. * Dequeues the key input queue.
* *
* @return key input. * @return The first key input in the key input queue.
*/ */
virtual KeyInput dequeueKeyInput() = 0; virtual KeyInput dequeueKeyInput() = 0;
/** /**
* Checks whether the mouse queue is empyt or not. * Checks if the mouse queue is empyt, or not.
* *
* @return true if the mouse queue is empty. * @return True if the mouse queue is empty,
* false otherwise.
*/ */
virtual bool isMouseQueueEmpty() = 0; virtual bool isMouseQueueEmpty() = 0;
/** /**
* Dequeues the mouse input queue. * Dequeues the mouse input queue.
* *
* @return mouse input. * @return The first mouse input in the mouse input queue.
*/ */
virtual MouseInput dequeueMouseInput() = 0; virtual MouseInput dequeueMouseInput() = 0;
/** /**
* Polls all exsisting input. It exists for Input implementation * Polls all exsisting input. Called when input should
* compatibility. It is used internally by the library. * be polled. The function exists for compatibility reason
* where some libraries need to poll input at a certain
* logic rate.
*/ */
virtual void _pollInput() = 0; virtual void _pollInput() = 0;
}; };
} }
#endif // end GCN_INPUT_HPP #endif // end GCN_INPUT_HPP
 End of changes. 11 change blocks. 
57 lines changed or deleted 53 lines changed or added


 inputevent.hpp   inputevent.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_INPUTEVENT_HPP #ifndef GCN_INPUTEVENT_HPP
#define GCN_INPUTEVENT_HPP #define GCN_INPUTEVENT_HPP
#include "guichan/event.hpp" #include "guichan/event.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/** /**
* Base class for all input events. * Base class for all events concerning input.
* *
* @author Olof Naess * @author Olof Naess
* @since 0.6.0 * @since 0.6.0
*/ */
class GCN_CORE_DECLSPEC InputEvent: public Event class GCN_CORE_DECLSPEC InputEvent: public Event
{ {
public: public:
/** /**
* Constructor. * Constructor.
* *
* @param source the source widget of the event. * @param source The source widget of the event.
* @param isShiftPressed true if shift is pressed, false otherwise. * @param isShiftPressed True if shift is pressed, false otherwise.
* @param isControlPressed true if control is pressed, false otherw * @param isControlPressed True if control is pressed, false otherw
ise. ise.
* @param isAltPressed true if alt is pressed, false otherwise. * @param isAltPressed True if alt is pressed, false otherwise.
* @param isMetaPressed true if meta is pressed, false otherwise. * @param isMetaPressed True if meta is pressed, false otherwise.
*/ */
InputEvent(Widget* source, InputEvent(Widget* source,
bool isShiftPressed, bool isShiftPressed,
bool isControlPressed, bool isControlPressed,
bool isAltPressed, bool isAltPressed,
bool isMetaPressed); bool isMetaPressed);
/** /**
* Checks whether shift is pressed. * Checks if shift is pressed.
* *
* @return true if shift was pressed at the same time as the key. * @return True if shift was pressed at the same time as the key,
* false otherwise.
*/ */
virtual bool isShiftPressed() const; bool isShiftPressed() const;
/** /**
* Checks whether control is pressed. * Checks if control is pressed.
* *
* @return true if control was pressed at the same time as the key. * @return True if control was pressed at the same time as the key,
* false otherwise.
*/ */
virtual bool isControlPressed() const; bool isControlPressed() const;
/** /**
* Checks whether alt is pressed. * Checks if alt is pressed.
* *
* @return true if alt was pressed at the same time as the key. * @return True if alt was pressed at the same time as the key,
* false otherwise.
*/ */
virtual bool isAltPressed() const; bool isAltPressed() const;
/** /**
* Checks whether meta is pressed. * Checks whether meta is pressed.
* *
* @return true if meta was pressed at the same time as the key. * @return True if meta was pressed at the same time as the key,
* false otherwise.
*/ */
virtual bool isMetaPressed() const; bool isMetaPressed() const;
/** /**
* Marks the event as consumed. How widgets should act on consumed * Marks the event as consumed. Input event listeners may discard
* events are up to the widgets themselves. * consumed input or act on consumed input. An example of a widget
* that discards consumed input is the ScrollArea widget that
* discards consumed mouse wheel events so the ScrollArea will not
* scroll if for instance a Slider's value inside the ScrollArea wa
s
* changed with the mouse wheel.
*
* @see isConsumed
*/ */
virtual void consume(); void consume();
/** /**
* Checks if the input event is consumed. * Checks if the input event is consumed.
* *
* @return true if the input event is consumed, false otherwise. * @return True if the input event is consumed,
* false otherwise.
* @see consume
*/ */
virtual bool isConsumed() const; bool isConsumed() const;
protected: protected:
/**
* True if shift is pressed, false otherwise.
*/
bool mShiftPressed; bool mShiftPressed;
/**
* True if control is pressed, false otherwise.
*/
bool mControlPressed; bool mControlPressed;
/**
* True if alt is pressed, false otherwise.
*/
bool mAltPressed; bool mAltPressed;
/**
* True if meta is pressed, false otherwise.
*/
bool mMetaPressed; bool mMetaPressed;
/**
* True if the input event is consumed,
* false otherwise.
*/
bool mIsConsumed; bool mIsConsumed;
}; };
} }
#endif // end GCN_INPUTEVENT_HPP #endif // end GCN_INPUTEVENT_HPP
 End of changes. 24 change blocks. 
68 lines changed or deleted 88 lines changed or added


 key.hpp   key.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_KEY_HPP #ifndef GCN_KEY_HPP
#define GCN_KEY_HPP #define GCN_KEY_HPP
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/** /**
* Represents a key or a character. * Represents a key or a character.
*/ */
class GCN_CORE_DECLSPEC Key class GCN_CORE_DECLSPEC Key
{ {
public: public:
/** /**
* Constructor. * Constructor.
* *
* @param value the ascii or enum value for the key. * @param value The ascii or enum value for the key.
*/ */
Key(int value = 0); Key(int value = 0);
/** /**
* Checks whether a key is a character. * Checks if a key is a character.
* *
* @return true if the key is a letter, number or whitespace. * @return True if the key is a letter, number or whitespace,
* false otherwise.
*/ */
bool isCharacter() const; bool isCharacter() const;
/** /**
* Checks whether a key is a number. * Checks if a key is a number.
* *
* @return true if the key is a number (0-9). * @return True if the key is a number (0-9),
* false otherwise.
*/ */
bool isNumber() const; bool isNumber() const;
/** /**
* Checks whether a key is a letter. * Checks if a key is a letter.
* *
* @return true if the key is a letter (a-z,A-Z). * @return True if the key is a letter (a-z,A-Z),
* false otherwise.
*/ */
bool isLetter() const; bool isLetter() const;
/** /**
* Gets the value of the key. If an ascii value exists it will be * Gets the value of the key. If an ascii value exists it
* returned. Otherwise an enum value will be returned. * will be returned. Otherwise an enum value will be returned.
* *
* @return the value of the key. * @return the value of the key.
*/ */
int getValue() const; int getValue() const;
/**
* Compares to keys.
*
* @param key The key to compare this key with.
* @return True if the keys are equal, false otherwise.
*/
bool operator==(const Key& key) const;
/**
* Compares to keys.
*
* @param key The key to compare this key with.
* @return True if the keys are not equal, false otherwise.
*/
bool operator!=(const Key& key) const;
/** /**
* An enum with key values. * An enum with key values.
*/ */
enum enum
{ {
SPACE = ' ', SPACE = ' ',
TAB = '\t', TAB = '\t',
ENTER = '\n', ENTER = '\n',
LEFT_ALT = 1000, LEFT_ALT = 1000,
RIGHT_ALT, RIGHT_ALT,
skipping to change at line 161 skipping to change at line 167
PAUSE, PAUSE,
NUM_LOCK, NUM_LOCK,
ALT_GR, ALT_GR,
LEFT, LEFT,
RIGHT, RIGHT,
UP, UP,
DOWN DOWN
}; };
protected: protected:
/**
* Holds the value of the key. It may be an ascii value
* or an enum value.
*/
int mValue; int mValue;
}; };
} }
#endif // end GCN_KEY_HPP #endif // end GCN_KEY_HPP
 End of changes. 12 change blocks. 
54 lines changed or deleted 64 lines changed or added


 keyevent.hpp   keyevent.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_KEYEVENT_HPP #ifndef GCN_KEYEVENT_HPP
#define GCN_KEYEVENT_HPP #define GCN_KEYEVENT_HPP
#include "guichan/inputevent.hpp" #include "guichan/inputevent.hpp"
#include "guichan/key.hpp" #include "guichan/key.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
class Widget; class Widget;
/** /**
* Key event. * Represents a key event.
*/ */
class GCN_CORE_DECLSPEC KeyEvent: public InputEvent class GCN_CORE_DECLSPEC KeyEvent: public InputEvent
{ {
public: public:
/**
* Key event types.
*/
enum
{
PRESSED = 0,
RELEASED
};
/** /**
* Constructor. * Constructor.
* *
* @param source the source widget of the event. * @param source The source widget of the event.
* @param isShiftPressed true if shift is pressed, false otherwise. * @param isShiftPressed True if shift is pressed, false otherwise.
* @param isControlPressed true if control is pressed, false otherw * @param isControlPressed True if control is pressed, false otherw
ise. ise.
* @param isAltPressed true if alt is pressed, false otherwise. * @param isAltPressed True if alt is pressed, false otherwise.
* @param isMetaPressed true if meta is pressed, false otherwise. * @param isMetaPressed True if meta is pressed, false otherwise.
* @param type the type of the event. * @param type The type of the event. A value from KeyEventType.
* @param isNumericPad true if the event occured on the numeric pad * @param isNumericPad True if the event occured on the numeric pad
, ,
* false otherwise. * false otherwise.
* @param key represents the key of the event. * @param key The key of the event.
*/ */
KeyEvent(Widget* source, KeyEvent(Widget* source,
bool isShiftPressed, bool isShiftPressed,
bool isControlPressed, bool isControlPressed,
bool isAltPressed, bool isAltPressed,
bool isMetaPressed, bool isMetaPressed,
unsigned int type, unsigned int type,
bool isNumericPad, bool isNumericPad,
const Key& key); const Key& key);
/** /**
* Destructor. * Destructor.
*/ */
virtual ~KeyEvent(); virtual ~KeyEvent();
/** /**
* Gets the type of the event. * Gets the type of the event.
* *
* @return the type of the event. * @return The type of the event.
*/ */
virtual unsigned int getType() const; unsigned int getType() const;
/** /**
* Checks whether the key event occured on the numeric pad. * Checks if the key event occured on the numeric pad.
*
* @return True if key event occured on the numeric pad,
* false otherwise.
* *
* @return true if key event occured on the numeric pad.
*/ */
bool isNumericPad() const; bool isNumericPad() const;
/** /**
* Gets the key of the event. * Gets the key of the event.
* *
* @return the key of the event. * @return The key of the event.
*/ */
const Key& getKey() const; const Key& getKey() const;
protected:
/** /**
* Key event types. * Holds the type of the key event.
*/ */
enum
{
PRESSED = 0,
RELEASED
};
protected:
unsigned int mType; unsigned int mType;
/**
* True if the numeric pad was used, false otherwise.
*/
bool mIsNumericPad; bool mIsNumericPad;
/**
* Holds the key of the key event.
*/
Key mKey; Key mKey;
}; };
} }
#endif // end GCN_KEYEVENT_HPP #endif // end GCN_KEYEVENT_HPP
 End of changes. 16 change blocks. 
69 lines changed or deleted 68 lines changed or added


 keyinput.hpp   keyinput.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_KEYINPUT_HPP #ifndef GCN_KEYINPUT_HPP
#define GCN_KEYINPUT_HPP #define GCN_KEYINPUT_HPP
#include "guichan/key.hpp" #include "guichan/key.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/** /**
* Internal class representing keyboard input. Generally you won't have * Internal class that represents key input. Generally you won't have t
to o
* bother using this class. * bother using this class unless you implement an Input class for
* a back end.
*
* @since 0.1.0
*/ */
class GCN_CORE_DECLSPEC KeyInput class GCN_CORE_DECLSPEC KeyInput
{ {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
KeyInput() { }; KeyInput() { };
/** /**
* Constructor. * Constructor.
* *
* @param key the Key the input concerns. * @param key The key of the key input.
* @param type the type of input. * @param type The type of key input.
*/ */
KeyInput(const Key& key, int type); KeyInput(const Key& key, unsigned int type);
/** /**
* Sets the input type. * Sets the type of the key input.
* *
* @param type the type of input. * @param type The type of key input.
* @see getType
*/ */
void setType(int type); void setType(unsigned int type);
/** /**
* Gets the input type. * Gets the type of the key input.
* *
* @return the input type. * @return the input type.
* @see setType
*/ */
int getType() const; int getType() const;
/** /**
* Sets the key the input concerns. * Sets the key of the key input.
* *
* @param key the Key the input concerns. * @param key The key of the key input.
* @see getKey
*/ */
void setKey(const Key& key); void setKey(const Key& key);
/** /**
* Gets the key the input concerns. * Gets the key of the key input.
* *
* @return the Key the input concerns. * @return The key of the key input.
* @see setKey
*/ */
const Key& getKey() const; const Key& getKey() const;
/** /**
* Checks whether shift is pressed. * Checks if shift is pressed.
* *
* @return true if shift was pressed at the same time as the key. * @return True if shift was pressed at the same
* time as the key, false otherwise.
* @see setShiftPressed
* @since 0.6.0 * @since 0.6.0
*/ */
bool isShiftPressed() const; bool isShiftPressed() const;
/** /**
* Sets the shift pressed flag. * Sets shift to be pressed at the same time as the key,
* or not.
* *
* @param pressed the shift flag value. * @param pressed True if shift is pressed, false otherwise.
* @see isShiftPressed
* @since 0.6.0 * @since 0.6.0
*/ */
void setShiftPressed(bool pressed); void setShiftPressed(bool pressed);
/** /**
* Checks whether control is pressed. * Checks if control is pressed.
* *
* @return true if control was pressed at the same time as the key. * @return True if control was pressed at the same
* time as the key, false otherwise.
* @see setControlPressed
* @since 0.6.0 * @since 0.6.0
*/ */
bool isControlPressed() const; bool isControlPressed() const;
/** /**
* Sets the control pressed flag. * Sets control to be pressed at the same time as the key,
* or not.
* *
* @param pressed the control flag value. * @param pressed True if control is pressed, false otherwise.
* @see isControlPressed
* @since 0.6.0 * @since 0.6.0
*/ */
void setControlPressed(bool pressed); void setControlPressed(bool pressed);
/** /**
* Checks whether alt is pressed. * Checks if alt is pressed.
* *
* @return true if alt was pressed at the same time as the key. * @return True if alt was pressed at the same
* time as the key, false otherwise.
* @see setAltPressed
* @since 0.6.0 * @since 0.6.0
*/ */
bool isAltPressed() const; bool isAltPressed() const;
/** /**
* Sets the alt pressed flag. * Sets the alt to be pressed at the same time as the key,
* or not.
* *
* @param pressed the alt flag value. * @param pressed True if alt is pressed at the same
* time as the key, , false otherwise.
* @see isAltPressed
* @since 0.6.0 * @since 0.6.0
*/ */
void setAltPressed(bool pressed); void setAltPressed(bool pressed);
/** /**
* Checks whether meta is pressed. * Checks if meta is pressed.
* *
* @return true if meta was pressed at the same time as the key. * @return True if meta was pressed at the same
* time as the key, false otherwise.
* @see setMetaPressed
* @since 0.6.0 * @since 0.6.0
*/ */
bool isMetaPressed() const; bool isMetaPressed() const;
/** /**
* Sets the meta pressed flag. * Sets meta to be pressed at the same time as the key,
* or not.
* *
* @param pressed the meta flag value. * @param pressed True if meta is pressed at the same
* time as the key, false otherwise.
* @see isMetaPressed
* @since 0.6.0 * @since 0.6.0
*/ */
void setMetaPressed(bool pressed); void setMetaPressed(bool pressed);
/** /**
* Checks whether the key was pressed at the numeric pad. * Checks if the key was pressed at the numeric pad.
* *
* @return true if key pressed at the numeric pad. * @return True if key pressed at the numeric pad,
* false otherwise.
* @setNumericPad
* @since 0.6.0 * @since 0.6.0
*/ */
bool isNumericPad() const; bool isNumericPad() const;
/** /**
* Sets the numeric pad flag. * Sets the key to be pressed at the numeric pad.
* *
* @param numpad the numeric pad flag value. * @param numpad True if the key was pressed at the numeric
* pad, false otherwise.
* @see isNumericPad
* @since 0.6.0 * @since 0.6.0
*/ */
void setNumericPad(bool numpad); void setNumericPad(bool numpad);
/** /**
* Key input types. This enum corresponds to the enum with event * Key input types. This enum corresponds to the enum with event
* types on KeyEvent for easy mapping. * types on KeyEvent for easy mapping.
*/ */
enum enum
{ {
PRESSED = 0, PRESSED = 0,
RELEASED RELEASED
}; };
protected: protected:
/**
* Holds the key of the key input.
*/
Key mKey; Key mKey;
int mType;
int mButton; /**
* Holds the type of the key input.
*/
unsigned int mType;
/**
* True if shift was pressed at the same time as the key,
* false otherwise.
*/
bool mShiftPressed; bool mShiftPressed;
/**
* True if control was pressed at the same time as the key,
* false otherwise.
*/
bool mControlPressed; bool mControlPressed;
/**
* True if alt was pressed at the same time as the key,
* false otherwise.
*/
bool mAltPressed; bool mAltPressed;
/**
* True if meta was pressed at the same time as the key,
* false otherwise.
*/
bool mMetaPressed; bool mMetaPressed;
/**
* True if the numeric pad was used when the key was pressed,
* false otherwise.
*/
bool mNumericPad; bool mNumericPad;
}; };
} }
#endif // end GCN_KEYINPUT_HPP #endif // end GCN_KEYINPUT_HPP
 End of changes. 40 change blocks. 
81 lines changed or deleted 128 lines changed or added


 keylistener.hpp   keylistener.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_KEYLISTENER_HPP #ifndef GCN_KEYLISTENER_HPP
#define GCN_KEYLISTENER_HPP #define GCN_KEYLISTENER_HPP
#include "guichan/keyevent.hpp" #include "guichan/keyevent.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
class Key; class Key;
/** /**
* Key listeners base class. Inorder to use this class you must inherit * Interface for listening for key events from widgets.
* from it and implements it's functions. KeyListeners listen for key
* events on a Widgets. When a Widget recives a key event, the
* corresponding function in all it's key listeners will be called.
* Only focused Widgets will generate key events.
* *
* @see Widget::addKeyListener * @see Widget::addKeyListener, Widget::removeKeyListener
*/ */
class GCN_CORE_DECLSPEC KeyListener class GCN_CORE_DECLSPEC KeyListener
{ {
public: public:
/** /**
* Destructor * Destructor.
*/ */
virtual ~KeyListener() { } virtual ~KeyListener() { }
/** /**
* Called if a key is pressed when the widget has keyboard focus. * Called if a key is pressed when the widget has keyboard focus.
* If a key is held down the widget will generate multiple key * If a key is held down the widget will generate multiple key
* presses. * presses.
* *
* @param keyEvent discribes the event. * @param keyEvent Discribes the event.
*/ */
virtual void keyPressed(KeyEvent& keyEvent) { } virtual void keyPressed(KeyEvent& keyEvent) { }
/** /**
* Called if a key is released when the widget has keyboard focus. * Called if a key is released when the widget has keyboard focus.
* *
* @param keyEvent discribes the event. * @param keyEvent Discribes the event.
*/ */
virtual void keyReleased(KeyEvent& keyEvent) { } virtual void keyReleased(KeyEvent& keyEvent) { }
protected: protected:
/** /**
* Constructor. * Constructor.
* *
* You should not be able to make an instance of KeyListener, * You should not be able to make an instance of KeyListener,
* therefore its constructor is protected. To use KeyListener * therefore its constructor is protected.
* you must inherit from this class and implement it's
* functions.
*/ */
KeyListener() { } KeyListener() { }
}; };
} }
#endif // end GCN_KEYLISTENER_HPP #endif // end GCN_KEYLISTENER_HPP
 End of changes. 8 change blocks. 
57 lines changed or deleted 38 lines changed or added


 label.hpp   label.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_LABEL_HPP #ifndef GCN_LABEL_HPP
#define GCN_LABEL_HPP #define GCN_LABEL_HPP
#include <string> #include <string>
#include "guichan/graphics.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include "guichan/widget.hpp" #include "guichan/widget.hpp"
namespace gcn namespace gcn
{ {
/** /**
* A label for displaying text. * Implementation of a label capable of displaying a caption.
*/ */
class GCN_CORE_DECLSPEC Label: public Widget class GCN_CORE_DECLSPEC Label: public Widget
{ {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
Label(); Label();
/** /**
* Constructor. * Constructor. The label will be automatically resized
* to fit the caption.
* *
* @param caption the Label caption. * @param caption The caption of the label.
*/ */
Label(const std::string& caption); Label(const std::string& caption);
/** /**
* Gets the Label caption. * Gets the caption of the label.
* *
* @return the Label caption. * @return The caption of the label.
* @see setCaption
*/ */
virtual const std::string &getCaption() const; const std::string &getCaption() const;
/** /**
* Sets the Label caption. * Sets the caption of the label. It's advisable to call
* adjustSize after setting of the caption to adjust the
* label's size to fit the caption.
* *
* @param caption the Label caption. * @param caption The caption of the label.
* @see getCaption, adjustSize
*/ */
virtual void setCaption(const std::string& caption); void setCaption(const std::string& caption);
/** /**
* Sets the alignment for the caption. * Sets the alignment of the caption. The alignment is relative
* to the center of the label.
* *
* @param alignemnt Graphics::LEFT, Graphics::CENTER or Graphics::R * @param alignemnt The alignment of the caption of the label.
IGHT. * @see getAlignment, Graphics
* @see Graphics
*/ */
virtual void setAlignment(unsigned int alignment); void setAlignment(Graphics::Alignment alignment);
/** /**
* Gets the alignment for the caption. * Gets the alignment of the caption. The alignment is relative to
* the center of the label.
* *
* @return alignment of caption. * @return The alignment of caption of the label.
* @see setAlignmentm Graphics
*/ */
virtual unsigned int getAlignment(); Graphics::Alignment getAlignment() const;
/** /**
* Adjusts the Label size to fit the font size. * Adjusts the label's size to fit the caption.
*/ */
virtual void adjustSize(); void adjustSize();
// Inherited from Widget // Inherited from Widget
virtual void draw(Graphics* graphics); virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
protected: protected:
/**
* Holds the caption of the label.
*/
std::string mCaption; std::string mCaption;
unsigned int mAlignment;
/**
* Holds the alignment of the caption.
*/
Graphics::Alignment mAlignment;
}; };
} }
#endif // end GCN_LABEL_HPP #endif // end GCN_LABEL_HPP
 End of changes. 23 change blocks. 
67 lines changed or deleted 67 lines changed or added


 listbox.hpp   listbox.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_LISTBOX_HPP #ifndef GCN_LISTBOX_HPP
#define GCN_LISTBOX_HPP #define GCN_LISTBOX_HPP
#include <list>
#include "guichan/keylistener.hpp" #include "guichan/keylistener.hpp"
#include "guichan/listmodel.hpp" #include "guichan/listmodel.hpp"
#include "guichan/mouselistener.hpp" #include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include "guichan/widget.hpp" #include "guichan/widget.hpp"
namespace gcn namespace gcn
{ {
class SelectionListener;
/** /**
* A ListBox displaying a list in which elemets can be selected. Only o * An implementation of a list box where an item can be selected.
ne *
* element can be selected at time. ListBox uses a ListModel to handle * To be able display a list the list box uses a user provided list mod
the el.
* list. To be able to use ListBox you must give ListBox an implemented * A list model can be any class that implements the ListModel interfac
* ListModel which represents your list. e.
*
* If an item is selected in the list box a select event will be sent t
o all selection
* listeners of the list box. If an item is selected by using a mouse c
lick or by using
* the enter or space key an action event will be sent to all action li
steners of the
* list box.
*/ */
class GCN_CORE_DECLSPEC ListBox : class GCN_CORE_DECLSPEC ListBox :
public Widget, public Widget,
public MouseListener, public MouseListener,
public KeyListener public KeyListener
{ {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
ListBox(); ListBox();
/** /**
* Constructor. * Constructor.
* *
* @param listModel the ListModel to use. * @param listModel the list model to use.
*/ */
ListBox(ListModel *listModel); ListBox(ListModel *listModel);
/** /**
* Destructor. * Destructor.
*/ */
virtual ~ListBox() { } virtual ~ListBox() { }
/** /**
* Gets the ListModel index of the selected element. * Gets the selected item as an index in the list model.
* *
* @return the ListModel index of the selected element. * @return the selected item as an index in the list model.
* @see setSelected
*/ */
virtual int getSelected(); int getSelected() const;
/** /**
* Sets the ListModel index of the selected element. * Sets the selected item. The selected item is represented by
* an index from the list model.
* *
* @param selected the ListModel index of the selected element. * @param selected the selected item as an index from the list mode
l.
* @see getSelected
*/ */
virtual void setSelected(int selected); void setSelected(int selected);
/** /**
* Sets the ListModel to use. * Sets the list model to use.
* *
* @param listModel the ListModel to use. * @param listModel the list model to use.
* @see getListModel
*/ */
virtual void setListModel(ListModel *listModel); void setListModel(ListModel *listModel);
/** /**
* Gets the ListModel used. * Gets the list model used.
* *
* @return the ListModel used. * @return the list model used.
* @see setListModel
*/ */
virtual ListModel *getListModel(); ListModel *getListModel();
/** /**
* Adjusts the size of the ListBox to fit the font used. * Adjusts the size of the list box to fit it's list model.
*/ */
virtual void adjustSize(); void adjustSize();
/** /**
* Checks whether the ListBox wraps when selecting items with keybo ard. * Checks whether the list box wraps when selecting items with a ke yboard.
* *
* Wrapping means that if up is pressed and the first item is selec * Wrapping means that the selection of items will be wrapped. That
ted, the last is, if
* item will get selected. If down is pressed and the last item is * the first item is selected and up is pressed, the last item will
selected, the get
* first item will get selected. * selected. If the last item is selected and down is pressed, the
first item
* will get selected.
* *
* @return true if wrapping, fasle otherwise. * @return true if wrapping is enabled, fasle otherwise.
* @see setWrappingEnabled
*/ */
virtual bool isWrappingKeyboardSelection(); bool isWrappingEnabled() const;
/** /**
* Sets the ListBox to wrap or not when selecting items with keyboa rd. * Sets the list box to wrap or not when selecting items with a key board.
* *
* Wrapping means that if up is pressed and the first item is selec * Wrapping means that the selection of items will be wrapped. That
ted, the last is, if
* item will get selected. If down is pressed and the last item is * the first item is selected and up is pressed, the last item will
selected, the get
* first item will get selected. * selected. If the last item is selected and down is pressed, the
first item
* will get selected.
* *
* @see isWrappingEnabled
*/ */
virtual void setWrappingKeyboardSelection(bool wrapping); void setWrappingEnabled(bool wrappingEnabled);
/**
* Adds a selection listener to the list box. When the selection
* changes an event will be sent to all selection listeners of the
* list box.
*
* @param selectionListener The selection listener to add.
* @since 0.8.0
*/
void addSelectionListener(SelectionListener* selectionListener);
/**
* Removes a selection listener from the list box.
*
* @param selectionListener The selection listener to remove.
* @since 0.8.0
*/
void removeSelectionListener(SelectionListener* selectionListener);
/**
* Gets the height of a row. Should be overridden if another
row
* height than the font height is preferred.
*
* @return The height of a row.
* @since 0.8.0
*/
virtual unsigned int getRowHeight() const;
// Inherited from Widget // Inherited from Widget
virtual void draw(Graphics* graphics); virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
virtual void logic(); virtual void logic();
// Inherited from KeyListener // Inherited from KeyListener
virtual void keyPressed(KeyEvent& keyEvent); virtual void keyPressed(KeyEvent& keyEvent);
// Inherited from MouseListener // Inherited from MouseListener
virtual void mousePressed(MouseEvent& mouseEvent); virtual void mousePressed(MouseEvent& mouseEvent);
virtual void mouseWheelMovedUp(MouseEvent& mouseEvent); virtual void mouseWheelMovedUp(MouseEvent& mouseEvent);
virtual void mouseWheelMovedDown(MouseEvent& mouseEvent); virtual void mouseWheelMovedDown(MouseEvent& mouseEvent);
virtual void mouseDragged(MouseEvent& mouseEvent); virtual void mouseDragged(MouseEvent& mouseEvent);
protected: protected:
ListModel *mListModel; /**
* Distributes a value changed event to all selection listeners
* of the list box.
*
* @since 0.8.0
*/
void distributeValueChangedEvent();
/**
* The selected item as an index in the list model.
*/
int mSelected; int mSelected;
bool mWrappingKeyboardSelection;
/**
* The list model to use.
*/
ListModel *mListModel;
/**
* True if wrapping is enabled, false otherwise.
*/
bool mWrappingEnabled;
/**
* Typdef.
*/
typedef std::list<SelectionListener*> SelectionListenerList;
/**
* The selection listeners of the list box.
*/
SelectionListenerList mSelectionListeners;
/**
* Typedef.
*/
typedef SelectionListenerList::iterator SelectionListenerIterator;
}; };
} }
#endif // end GCN_LISTBOX_HPP #endif // end GCN_LISTBOX_HPP
 End of changes. 31 change blocks. 
86 lines changed or deleted 157 lines changed or added


 listmodel.hpp   listmodel.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_LISTMODEL_HPP #ifndef GCN_LISTMODEL_HPP
#define GCN_LISTMODEL_HPP #define GCN_LISTMODEL_HPP
#include <string> #include <string>
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/** /**
* Represents a list. It is used in certain Widgets, like the ListBox, * An interface for a model that represents a list. It is
to * used in certain widgets, like the ListBox, to handle a
* handle a list with string elements. If you want to use Widgets like * lists with string elements. If you want to use widgets
* ListBox, you should inherit from this class and implement it's * like ListBox, make a derived class from this class that
* functions. * represents your list.
*/ */
class GCN_CORE_DECLSPEC ListModel class GCN_CORE_DECLSPEC ListModel
{ {
public: public:
/** /**
* Destructor. * Destructor.
*/ */
virtual ~ListModel() { } virtual ~ListModel() { }
/** /**
* Gets the number of elements in the ListModel. * Gets the number of elements in the list.
* *
* @return the number of elements in the ListModel * @return The number of elements in the list
*/ */
virtual int getNumberOfElements() = 0; virtual int getNumberOfElements() = 0;
/** /**
* Gets an element at a certain index in the list. * Gets an element at a certain index in the list.
* *
* @param i an index in the list. * @param i An index in the list.
* @return an element as a string. * @return An element as a string at the a certain index.
*/ */
virtual std::string getElementAt(int i) = 0; virtual std::string getElementAt(int i) = 0;
}; };
} }
#endif // end GCN_LISTMODEL_HPP #endif // end GCN_LISTMODEL_HPP
 End of changes. 6 change blocks. 
54 lines changed or deleted 41 lines changed or added


 mouseevent.hpp   mouseevent.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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 #ifndef GCN_MOUSEEVENT_HPP
#define GCN_MOUSEEVENT_HPP #define GCN_MOUSEEVENT_HPP
#include "guichan/inputevent.hpp" #include "guichan/inputevent.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
class Gui;
class Widget; class Widget;
/** /**
* Represents a mouse event. * Represents a mouse event.
* *
* @author Olof Naess * @author Olof Naess
* @since 0.6.0 * @since 0.6.0
*/ */
class GCN_CORE_DECLSPEC MouseEvent: public InputEvent class GCN_CORE_DECLSPEC MouseEvent: public InputEvent
{ {
public: public:
/** /**
* Constructor. * Constructor.
* *
* @param source the source widget of the event. * @param source The source widget of the mouse event.
* @param isShiftPressed true if shift is pressed, false otherwise. * @param isShiftPressed True if shift is pressed, false otherwise.
* @param isControlPressed true if control is pressed, false otherw * @param isControlPressed True if control is pressed, false otherw
ise. ise.
* @param isAltPressed true if alt is pressed, false otherwise. * @param isAltPressed True if alt is pressed, false otherwise.
* @param isMetaPressed true if meta is pressed, false otherwise. * @param isMetaPressed True if meta is pressed, false otherwise.
* @param the type of the event. * @param type The type of the mouse event.
* @param button the button of the event. * @param button The button of the mouse event.
* @param the x coordinate of the event relative to the source widg * @param x The x coordinate of the event relative to the source wi
et. dget.
* @param the y coordinate of the event relative the source widget. * @param y The y coordinate of the event relative the source widge
t.
* @param clickCount The number of clicks generated with the same b
utton.
* It's set to zero if another button is used.
*/ */
MouseEvent(Widget* source, MouseEvent(Widget* source,
bool isShiftPressed, bool isShiftPressed,
bool isControlPressed, bool isControlPressed,
bool isAltPressed, bool isAltPressed,
bool isMetaPressed, bool isMetaPressed,
unsigned int type, unsigned int type,
unsigned int button, unsigned int button,
int x, int x,
int y, int y,
int clickCount); int clickCount);
/** /**
* Gets the button of the mouse event. * Gets the button of the mouse event.
* *
* @return the button of the mouse event. * @return The button of the mouse event.
*/ */
virtual unsigned int getButton() const; unsigned int getButton() const;
/** /**
* Gets the x coordinate of the mouse event. The coordinate is rela * Gets the x coordinate of the mouse event.
tive to * The coordinate relative to widget the mouse listener
* the source Widget. * receiving the events have registered to.
* *
* @return the x coordinate of the mouse event. * @return The x coordinate of the mouse event.
* @see Widget::addMouseListener, Widget::removeMouseListener
*/ */
virtual int getX() const; int getX() const;
/** /**
* Gets the y coordinate of the mouse event. The coordinate is rela * Gets the y coordinate of the mouse event.
tive to * The coordinate relative to widget the mouse listener
* the source Widget. * receiving the events have registered to.
* *
* @return the y coordinate of the mouse event. * @return The y coordinate of the mouse event.
* @see Widget::addMouseListener, Widget::removeMouseListener
*/ */
virtual int getY() const; int getY() const;
/** /**
* Gets the click count. * Gets the number of clicks generated with the same button.
* It's set to zero if another button is used.
* *
* @return the click count of the mouse event. * @return The number of clicks generated with the same button.
*/ */
virtual int getClickCount() const; int getClickCount() const;
/** /**
* Gets the type of the event. * Gets the type of the event.
* *
* @return the type of the event. * @return The type of the event.
*/ */
virtual unsigned int getType() const; unsigned int getType() const;
/** /**
* Mouse event types. * Mouse event types.
*/ */
enum enum
{ {
MOVED = 0, MOVED = 0,
PRESSED, PRESSED,
RELEASED, RELEASED,
WHEEL_MOVED_DOWN, WHEEL_MOVED_DOWN,
skipping to change at line 167 skipping to change at line 162
*/ */
enum enum
{ {
EMPTY = 0, EMPTY = 0,
LEFT, LEFT,
RIGHT, RIGHT,
MIDDLE MIDDLE
}; };
protected: protected:
/**
* Holds the type of the mouse event.
*/
unsigned int mType; unsigned int mType;
/**
* Holds the button of the mouse event.
*/
unsigned int mButton; unsigned int mButton;
/**
* Holds the x-coordinate of the mouse event.
*/
int mX; int mX;
/**
* Holds the y-coordinate of the mouse event.
*/
int mY; int mY;
/**
* The number of clicks generated with the same button.
* It's set to zero if another button is used.
*/
int mClickCount; 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 tim
e
* keep the MouseEvent class as const as possible. Gui needs to
* update the x och y coordinates for the coordinates to be relativ
e
* to widget the mouse listener receiving the events have registere
d
* to.
*/
friend class Gui;
}; };
} }
#endif // GCN_MOUSEEVENT_HPP #endif // GCN_MOUSEEVENT_HPP
 End of changes. 23 change blocks. 
73 lines changed or deleted 100 lines changed or added


 mouseinput.hpp   mouseinput.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_MOUSEINPUT_HPP #ifndef GCN_MOUSEINPUT_HPP
#define GCN_MOUSEINPUT_HPP #define GCN_MOUSEINPUT_HPP
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/** /**
* Internal class representing mouse input. Generally you won't have to * Internal class that represents mouse input. Generally you won't have
* bother using this class as it will get translated into a MouseEvent. to
* The class should be seen as a bridge between the low layer backends * bother using this class unless you implement an Input class for
* providing input and the higher lever parts of the Gui (such as widge * a back end.
ts).
* *
* @author Olof Naess * @author Olof Naess
* @author Per Larsson * @author Per Larsson
* @since 0.1.0
*/ */
class GCN_CORE_DECLSPEC MouseInput class GCN_CORE_DECLSPEC MouseInput
{ {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
MouseInput() { }; MouseInput() { };
/** /**
* Constructor. * Constructor.
* *
* @param button the button pressed. * @param button The button pressed.
* @param type the type of input. * @param type The type of mouse input.
* @param x the mouse x coordinate. * @param x The mouse x coordinate.
* @param y the mouse y coordinate. * @param y The mouse y coordinate.
* @param timeStamp the mouse inputs time stamp. * @param timeStamp The timestamp of the mouse input. Used to
* check for double clicks.
*/ */
MouseInput(unsigned int button, MouseInput(unsigned int button,
unsigned int type, unsigned int type,
int x, int x,
int y, int y,
int timeStamp); int timeStamp);
/** /**
* Sets the input type. * Sets the type of the mouse input.
* *
* @param type the type of input. * @param type The type of the mouse input. Should be a value from
the
* mouse event type enum
* @see getType
* @since 0.1.0
*/ */
void setType(unsigned int type); void setType(unsigned int type);
/** /**
* Gets the input type. * Gets the type of the mouse input.
* *
* @return the input type. * @return The type of the mouse input. A value from the mouse even
t
* type enum.
* @see setType
* @since 0.1.0
*/ */
unsigned int getType() const; unsigned int getType() const;
/** /**
* Sets the button pressed. * Sets the button pressed.
* *
* @param button the button pressed. * @param button The button pressed. Should be one of the values
* in the mouse event button enum.
* @see getButton.
* @since 0.1.0
*/ */
void setButton(unsigned int button); void setButton(unsigned int button);
/** /**
* Gets the button pressed. * Gets the button pressed.
* *
* @return the button pressed. * @return The button pressed. A value from the mouse event
* button enum.
* @see setButton
* @since 0.1.0
*/ */
unsigned int getButton() const; unsigned int getButton() const;
/** /**
* Sets the timestamp for the input. * Sets the timestamp for the mouse input.
* Used to check for double clicks.
* *
* @param timeStamp the timestamp of the input. * @param timeStamp The timestamp of the mouse input.
* @see getTimeStamp
* @since 0.1.0
*/ */
void setTimeStamp(int timeStamp); void setTimeStamp(int timeStamp);
/** /**
* Gets the time stamp of the input. * Gets the time stamp of the input.
* Used to check for double clicks.
* *
* @return the time stamp of the input. * @return The time stamp of the mouse input.
* @see setTimeStamp
* @since 0.1.0
*/ */
int getTimeStamp() const; int getTimeStamp() const;
/** /**
* Sets the x coordinate of the input. * Sets the x coordinate of the mouse input.
* *
* @param x the x coordinate of the input. * @param x The x coordinate of the mouse input.
* @see getX
* @since 0.6.0 * @since 0.6.0
*/ */
void setX(int x); void setX(int x);
/** /**
* Gets the x coordinate of the input. * Gets the x coordinate of the mouse input.
* *
* @return the x coordinate of the input. * @return The x coordinate of the mouse input.
* @see setX
* @since 0.6.0 * @since 0.6.0
*/ */
int getX() const; int getX() const;
/** /**
* Sets the y coordinate of the input. * Sets the y coordinate of the mouse input.
* *
* @param y the y coordinate of the input. * @param y The y coordinate of the mouse input.
* @see getY
* @since 0.6.0 * @since 0.6.0
*/ */
void setY(int y); void setY(int y);
/** /**
* Gets the y coordinate of the input. * Gets the y coordinate of the mouse input.
*
* @return The y coordinate of the mouse input.
* @see setY
* @since 0.6.0 * @since 0.6.0
*/ */
int getY() const; int getY() const;
/** /**
* Mouse input event types. This enum partially corresponds * Mouse input event types. This enum partially corresponds
* to the enum with event types in MouseEvent for easy mapping. * to the enum with event types in MouseEvent for easy mapping.
*/ */
enum enum
{ {
skipping to change at line 195 skipping to change at line 207
*/ */
enum enum
{ {
EMPTY = 0, EMPTY = 0,
LEFT, LEFT,
RIGHT, RIGHT,
MIDDLE MIDDLE
}; };
protected: protected:
/**
* Holds the type of the mouse input.
*/
unsigned int mType; unsigned int mType;
/**
* Holds the button of the mouse input.
*/
unsigned int mButton; unsigned int mButton;
/**
* Holds the timestamp of the mouse input. Used to
* check for double clicks.
*/
int mTimeStamp; int mTimeStamp;
/**
* Holds the x coordinate of the mouse input.
*/
int mX; int mX;
/**
* Holds the y coordinate of the mouse input.
*/
int mY; int mY;
}; };
} }
#endif // end GCN_MOUSEINPUT_HPP #endif // end GCN_MOUSEINPUT_HPP
 End of changes. 27 change blocks. 
71 lines changed or deleted 105 lines changed or added


 mouselistener.hpp   mouselistener.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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 #ifndef GCN_MOUSELISTENER_HPP
#define GCN_MOUSELISTENER_HPP #define GCN_MOUSELISTENER_HPP
#include "guichan/mouseevent.hpp" #include "guichan/mouseevent.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/** /**
* Mouse listeners base class. Inorder to use this class you must inher * Interface for listening for mouse events from widgets.
it
* from it and implements it's functions. MouseListeners listen for mou
se
* events on a Widgets. When a Widget recives a mouse event, the
* corresponding function in all it's mouse listeners will be called.
* *
* @see Widget::addMouseListener * @see Widget::addMouseListener, Widget::removeMouseListener
* @since 0.1.0
*/ */
class GCN_CORE_DECLSPEC MouseListener class GCN_CORE_DECLSPEC MouseListener
{ {
public: public:
/** /**
* Destructor. * Destructor.
*/ */
virtual ~MouseListener() { } virtual ~MouseListener() { }
/** /**
* Called when the mouse has entered into the widget area. * Called when the mouse has entered into the widget area.
* *
* @param mouseEvent describes the event. * @param mouseEvent Describes the event.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void mouseEntered(MouseEvent& mouseEvent) virtual void mouseEntered(MouseEvent& mouseEvent)
{ {
} }
/** /**
* Called when the mouse has exited the widget area. * Called when the mouse has exited the widget area.
* *
* @param mouseEvent describes the event. * @param mouseEvent Describes the event.
* @since 0.6.0
*/ */
virtual void mouseExited(MouseEvent& mouseEvent) virtual void mouseExited(MouseEvent& mouseEvent)
{ {
} }
/** /**
* Called when a mouse button has been pressed on the widget area. * Called when a mouse button has been pressed on the widget area.
* *
* NOTE: A mouse press is NOT equal to a mouse click. * NOTE: A mouse press is NOT equal to a mouse click.
* Use mouseClickMessage to check for mouse clicks. * Use mouseClickMessage to check for mouse clicks.
* *
* @param mouseEvent describes the event. * @param mouseEvent Describes the event.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void mousePressed(MouseEvent& mouseEvent) virtual void mousePressed(MouseEvent& mouseEvent)
{ {
} }
/** /**
* Called when a mouse button has been released on the widget area. * Called when a mouse button has been released on the widget area.
* *
* @param mouseEvent describes the event. * @param mouseEvent Describes the event.
* @since 0.6.0
*/ */
virtual void mouseReleased(MouseEvent& mouseEvent) virtual void mouseReleased(MouseEvent& mouseEvent)
{ {
} }
/** /**
* Called when a mouse button is pressed and released (clicked) on * Called when a mouse button is pressed and released (clicked) on
* the widget area. * the widget area.
* *
* @param mouseEvent describes the event. * @param mouseEvent Describes the event.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void mouseClicked(MouseEvent& mouseEvent) virtual void mouseClicked(MouseEvent& mouseEvent)
{ {
} }
/** /**
* Called when the mouse wheel has moved up on the widget area. * Called when the mouse wheel has moved up on the widget area.
* *
* @param mouseEvent describes the event. * @param mouseEvent Describes the event.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void mouseWheelMovedUp(MouseEvent& mouseEvent) virtual void mouseWheelMovedUp(MouseEvent& mouseEvent)
{ {
} }
/** /**
* Called when the mouse wheel has moved down on the widget area. * Called when the mouse wheel has moved down on the widget area.
* *
* @param mousEvent describes the event. * @param mousEvent Describes the event.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void mouseWheelMovedDown(MouseEvent& mouseEvent) virtual void mouseWheelMovedDown(MouseEvent& mouseEvent)
{ {
} }
/** /**
* Called when the mouse has moved in the widget area and no mouse button * Called when the mouse has moved in the widget area and no mouse button
* has been pressed (i.e no widget is being dragged). * has been pressed (i.e no widget is being dragged).
* *
* @param mouseEvent describes the event. * @param mouseEvent Describes the event.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void mouseMoved(MouseEvent& mouseEvent) virtual void mouseMoved(MouseEvent& mouseEvent)
{ {
} }
/** /**
* Called when the mouse has moved and the mouse has previously bee n * Called when the mouse has moved and the mouse has previously bee n
* pressed on the widget. * pressed on the widget.
* *
* @param mouseEvent describes the event. * @param mouseEvent Describes the event.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void mouseDragged(MouseEvent& mouseEvent) virtual void mouseDragged(MouseEvent& mouseEvent)
{ {
} }
protected: protected:
/** /**
* Constructor. * Constructor.
* *
* You should not be able to make an instance of MouseListener, * You should not be able to make an instance of MouseListener,
* therefore its constructor is protected. To use MouseListener * therefore its constructor is protected.
* you must inherit from this class and implement it's
* functions.
*/ */
MouseListener() { } MouseListener() { }
}; };
} }
#endif // end GCN_MOUSELISTENER_HPP #endif // end GCN_MOUSELISTENER_HPP
 End of changes. 14 change blocks. 
64 lines changed or deleted 47 lines changed or added


 opengl.hpp   opengl.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_OPENGL_HPP #ifndef GCN_OPENGL_HPP
#define GCN_OPENGL_HPP #define GCN_OPENGL_HPP
#include <guichan/opengl/openglgraphics.hpp> #include <guichan/opengl/openglgraphics.hpp>
#include <guichan/opengl/openglimage.hpp> #include <guichan/opengl/openglimage.hpp>
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
 End of changes. 2 change blocks. 
45 lines changed or deleted 32 lines changed or added


 openglgraphics.hpp   openglgraphics.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_OPENGLGRAPHICS_HPP #ifndef GCN_OPENGLGRAPHICS_HPP
#define GCN_OPENGLGRAPHICS_HPP #define GCN_OPENGLGRAPHICS_HPP
#include "guichan/color.hpp" #include "guichan/color.hpp"
#include "guichan/graphics.hpp" #include "guichan/graphics.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
 End of changes. 2 change blocks. 
45 lines changed or deleted 32 lines changed or added


 openglimage.hpp   openglimage.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_OPENGLIMAGE_HPP #ifndef GCN_OPENGLIMAGE_HPP
#define GCN_OPENGLIMAGE_HPP #define GCN_OPENGLIMAGE_HPP
#if defined (_WIN32) #if defined (_WIN32)
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#if defined (DELETE) #if defined (DELETE)
#undef DELETE #undef DELETE
skipping to change at line 104 skipping to change at line 91
* *
* NOTE: The functions getPixel and putPixel are only guaranteed to work * NOTE: The functions getPixel and putPixel are only guaranteed to work
* before an image has been converted to display format. * before an image has been converted to display format.
* *
* @param pixels to load from. * @param pixels to load from.
* @param width the width of the image. * @param width the width of the image.
* @param height the height of the image. * @param height the height of the image.
* @param convertToDisplayFormat true if the image should be conver ted * @param convertToDisplayFormat true if the image should be conver ted
* to display, false otherwise. * to display, false otherwise.
*/ */
OpenGLImage(unsigned int* pixels, int width, int height, bool conve rtToDisplayFormat = true); OpenGLImage(const unsigned int* pixels, int width, int height, bool convertToDisplayFormat = true);
/** /**
* Constructor. Load an image from an OpenGL texture handle. The wi dth * Constructor. Load an image from an OpenGL texture handle. The wi dth
* and height specifies the size of the "interesting" part o f the * and height specifies the size of the "interesting" part o f the
* texture, the real width and height of the texture are ass umed to * texture, the real width and height of the texture are ass umed to
* be the closest higher power of two. * be the closest higher power of two.
* *
* @param textureHandle the texture handle from which to load. * @param textureHandle the texture handle from which to load.
* @param width the width of the image. * @param width the width of the image.
* @param height the height of the image. * @param height the height of the image.
 End of changes. 3 change blocks. 
46 lines changed or deleted 33 lines changed or added


 openglsdlimageloader.hpp   openglsdlimageloader.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_OPENGLSDLIMAGELOADER_HPP #ifndef GCN_OPENGLSDLIMAGELOADER_HPP
#define GCN_OPENGLSDLIMAGELOADER_HPP #define GCN_OPENGLSDLIMAGELOADER_HPP
#include <guichan/sdl/sdlimageloader.hpp> #include <guichan/sdl/sdlimageloader.hpp>
#include <guichan/exception.hpp> #include <guichan/exception.hpp>
#include <guichan/opengl/openglimage.hpp> #include <guichan/opengl/openglimage.hpp>
 End of changes. 2 change blocks. 
45 lines changed or deleted 32 lines changed or added


 platform.hpp   platform.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_PLATFORM_HPP #ifndef GCN_PLATFORM_HPP
#define GCN_PLATFORM_HPP #define GCN_PLATFORM_HPP
#if defined (__MINGW32__) && defined(GUICHAN_BUILD) #if defined (__MINGW32__) && defined(GUICHAN_BUILD)
#define GCN_CORE_DECLSPEC __declspec(dllexport) #define GCN_CORE_DECLSPEC __declspec(dllexport)
#elif defined (__MINGW32__) && defined(GUICHAN_EXTENSION_BUILD) #elif defined (__MINGW32__) && defined(GUICHAN_EXTENSION_BUILD)
#define GCN_EXTENSION_DECLSPEC __declspec(dllexport) #define GCN_EXTENSION_DECLSPEC __declspec(dllexport)
#define GCN_CORE_DECLSPEC __declspec(dllimport) #define GCN_CORE_DECLSPEC __declspec(dllimport)
#elif defined (__MINGW32__) #elif defined (__MINGW32__) && defined(GUICHAN_DLL_IMPORT)
#define GCN_CORE_DECLSPEC __declspec(dllimport) #define GCN_CORE_DECLSPEC __declspec(dllimport)
#define GCN_EXTENSION_DECLSPEC __declspec(dllimport) #define GCN_EXTENSION_DECLSPEC __declspec(dllimport)
#elif defined(_MSC_VER) && defined(GUICHAN_BUILD) #elif defined(_MSC_VER) && defined(GUICHAN_BUILD)
#define GCN_CORE_DECLSPEC _declspec(dllexport) #define GCN_CORE_DECLSPEC _declspec(dllexport)
#elif defined(_MSC_VER) && defined(GUICHAN_EXTENSION_BUILD) #elif defined(_MSC_VER) && defined(GUICHAN_EXTENSION_BUILD)
#define GCN_CORE_DECLSPEC _declspec(dllimport) #define GCN_CORE_DECLSPEC _declspec(dllimport)
#define GCN_EXTENSION_DECLSPEC _declspec(dllexport) #define GCN_EXTENSION_DECLSPEC _declspec(dllexport)
 End of changes. 3 change blocks. 
46 lines changed or deleted 33 lines changed or added


 radiobutton.hpp   radiobutton.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_RADIOBUTTON_HPP #ifndef GCN_RADIOBUTTON_HPP
#define GCN_RADIOBUTTON_HPP #define GCN_RADIOBUTTON_HPP
#include <map> #include <map>
#include <string> #include <string>
#include "guichan/keylistener.hpp" #include "guichan/keylistener.hpp"
#include "guichan/mouselistener.hpp" #include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include "guichan/widget.hpp" #include "guichan/widget.hpp"
namespace gcn namespace gcn
{ {
/** /**
* A RadioButton which can be grouped into RadioButtons groups. In a * An implementation of a radio button where a user can select or desel
* RadioButton group, only one of the RadioButtons can be selected. ect
* the radio button and where the status of the radio button is display
ed to the user.
* A radio button can belong to a group and when a radio button belongs
to a
* group only one radio button can be selected in the group. A radio bu
tton is
* capable of displaying a caption.
*
* If a radio button's state changes an action event will be sent to al
l action
* listeners of the check box.
*/ */
class GCN_CORE_DECLSPEC RadioButton : class GCN_CORE_DECLSPEC RadioButton :
public Widget, public Widget,
public MouseListener, public MouseListener,
public KeyListener public KeyListener
{ {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
RadioButton(); RadioButton();
/** /**
* Constructor. * Constructor. The radio button will be automatically resized
* to fit the caption.
* *
* @param caption the Radiobutton caption. * @param caption The caption of the radio button.
* @param group the group the RadioButton belongs to. * @param group The group the radio button should belong to.
* @param marked true if the RadioButton should be marked. * @param selected True if the radio button should be selected.
*/ */
RadioButton(const std::string &caption, RadioButton(const std::string &caption,
const std::string &group, const std::string &group,
bool marked=false); bool selected = false);
/** /**
* Destructor. * Destructor.
*/ */
virtual ~RadioButton(); virtual ~RadioButton();
/** /**
* Draws the box i.a not the caption. * Checks if the radio button is selected.
*
* @param graphics a Graphics object to draw with.
*/
virtual void drawBox(Graphics *graphics);
/**
* Checks if the RadioButton is marked.
* *
* @return true if the RadioButton is marked. * @return True if the radio button is selecte, false otherwise.
* @see setSelected
*/ */
virtual bool isMarked() const; bool isSelected() const;
/** /**
* Sets the RadioButton to be marked. * Sets the radio button to selected or not.
* *
* @param marked true if the RadioButton should be marked. * @param selected True if the radio button should be selected,
* false otherwise.
* @see isSelected
*/ */
virtual void setMarked(bool marked); void setSelected(bool selected);
/** /**
* Gets the RadioButton caption. * Gets the caption of the radio button.
* *
* @return the RadioButton caption. * @return The caption of the radio button.
* @see setCaption
*/ */
virtual const std::string &getCaption() const; const std::string &getCaption() const;
/** /**
* Sets the RadioButton caption. * Sets the caption of the radio button. It's advisable to call
* adjustSize after setting of the caption to adjust the
* radio button's size to fit the caption.
* *
* @param caption the RadioButton caption. * @param caption The caption of the radio button.
* @see getCaption, adjustSize
*/ */
virtual void setCaption(const std::string caption); void setCaption(const std::string caption);
/** /**
* Sets the group the RadioButton should belong to. * Sets the group the radio button should belong to. Note that
* a radio button group is unique per application, not per Gui obje
ct
* as the group is stored in a static map.
* *
* @param group the name of the group. * @param group The name of the group.
* @see getGroup
*/ */
virtual void setGroup(const std::string &group); void setGroup(const std::string &group);
/** /**
* Gets the group the RadioButton belongs to. * Gets the group the radio button belongs to.
* *
* @return the group the RadioButton belongs to. * @return The group the radio button belongs to.
* @see setGroup
*/ */
virtual const std::string &getGroup() const; const std::string &getGroup() const;
/** /**
* Adjusts the RadioButtons size to fit the font size. * Adjusts the radio button's size to fit the caption.
*/ */
virtual void adjustSize(); void adjustSize();
// Inherited from Widget // Inherited from Widget
virtual void draw(Graphics* graphics); virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
// Inherited from KeyListener // Inherited from KeyListener
virtual void keyPressed(KeyEvent& keyEvent); virtual void keyPressed(KeyEvent& keyEvent);
// Inherited from MouseListener // Inherited from MouseListener
virtual void mouseClicked(MouseEvent& mouseEvent); virtual void mouseClicked(MouseEvent& mouseEvent);
virtual void mouseDragged(MouseEvent& mouseEvent); virtual void mouseDragged(MouseEvent& mouseEvent);
protected: protected:
bool mMarked; /**
* Draws the box.
*
* @param graphics a Graphics object to draw with.
*/
virtual void drawBox(Graphics *graphics);
/**
* True if the radio button is selected, false otherwise.
*/
bool mSelected;
/**
* Holds the caption of the radio button.
*/
std::string mCaption; std::string mCaption;
/**
* Holds the group of the radio button.
*/
std::string mGroup; std::string mGroup;
/**
* Typdef.
*/
typedef std::multimap<std::string, RadioButton *> GroupMap; typedef std::multimap<std::string, RadioButton *> GroupMap;
/**
* Typdef.
*/
typedef GroupMap::iterator GroupIterator; typedef GroupMap::iterator GroupIterator;
/**
* Holds all available radio button groups.
*/
static GroupMap mGroupMap; static GroupMap mGroupMap;
}; };
} }
#endif // end GCN_RADIOBUTTON_HPP #endif // end GCN_RADIOBUTTON_HPP
 End of changes. 32 change blocks. 
82 lines changed or deleted 112 lines changed or added


 rectangle.hpp   rectangle.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_RECTANGLE_HPP #ifndef GCN_RECTANGLE_HPP
#define GCN_RECTANGLE_HPP #define GCN_RECTANGLE_HPP
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include <iostream>
namespace gcn namespace gcn
{ {
/** /**
* Represents a rectangle. * Represents a rectangle.
*
* @since 0.1.0
*/ */
class GCN_CORE_DECLSPEC Rectangle class GCN_CORE_DECLSPEC Rectangle
{ {
public: public:
/** /**
* Constructor. Resets member variables. * Constructor. The default rectangle is an empty rectangle
* at the coordinates (0,0).
*/ */
Rectangle(); Rectangle();
/** /**
* Constructor. * Constructor.
* *
* @param x the Rectangle x coordinate. * @param x The x coordinate of the rectangle.
* @param y the Rectangle y coordinate. * @param y The y coordinate of the rectangle.
* @param width the Rectangle width. * @param width The width of the rectangle.
* @param height the Rectangle height. * @param height The height of the rectangle.
* @since 0.1.0
*/ */
Rectangle(int x, int y, int width, int height); Rectangle(int x, int y, int width, int height);
/** /**
* Sets the dimension of a rectangle. * Sets the dimension of a rectangle.
* *
* @param x the Rectangle x coordinate. * @param x The x coordinate of the rectangle.
* @param y the Rectangle y coordinate. * @param y The y coordinate of the rectangle.
* @param width the Rectangle width. * @param width The width of the rectangle.
* @param height the Rectangle height. * @param height The height of the rectangle.
* @since 0.1.0
*/ */
void setAll(int x, int y, int width, int height); void setAll(int x, int y, int width, int height);
/** /**
* Checks if another Rectangle intersects with the Rectangle. * Checks if another rectangle intersects with the rectangle.
* *
* @param rectangle another Rectangle. * @param rectangle Another rectangle to check for intersection.
* @return True if the rectangles intersect, false otherwise.
* @since 0.1.0
*/ */
bool intersect(const Rectangle& rectangle); bool isIntersecting(const Rectangle& rectangle) const;
/** /**
* Checks if a point is inside the Rectangle. * Checks if a point is inside the rectangle
* *
* @param x the point x coordinate. * @param x The x coordinate of the point.
* @param y the point y coordinate. * @param y The y coordinate of the point.
* @return True if the point is inside the rectangle.
* @since 0.1.0
*/ */
bool isPointInRect(int x, int y) const; bool isPointInRect(int x, int y) const;
/**
* Output operator for output.
*
* @param out The stream to output to.
* @param rectangle The rectangle to output.
*/
friend std::ostream& operator<<(std::ostream& out,
const Rectangle& rectangle);
/**
* Holds the x coordinate of the rectangle.
*/
int x; int x;
/**
* Holds the x coordinate of the rectangle.
*/
int y; int y;
/**
* Holds the width of the rectangle.
*/
int width; int width;
/**
* Holds the height of the rectangle.
*/
int height; int height;
}; };
} }
#endif // end GCN_RECTANGEL_HPP #endif // end GCN_RECTANGEL_HPP
 End of changes. 16 change blocks. 
60 lines changed or deleted 82 lines changed or added


 scrollarea.hpp   scrollarea.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_SCROLLAREA_HPP #ifndef GCN_SCROLLAREA_HPP
#define GCN_SCROLLAREA_HPP #define GCN_SCROLLAREA_HPP
#include <string> #include <string>
#include "guichan/basiccontainer.hpp" #include "guichan/basiccontainer.hpp"
#include "guichan/mouselistener.hpp" #include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
namespace gcn namespace gcn
{ {
/** /**
* A ScrollArea in which another Widget can be added. It the other Widg * Implementation if a scrollable area used to view widgets larger than
et the scroll area.
* is bigger then the ScrollArea, the ScrollArea will only display the * A scroll area can be customized to always show scroll bars or to sho
part w them only when
* of the Widget that fits the ScrollArea and make it possible to scrol * necessary.
l
* to the other areas of the Widget.
*
* NOTE: A TextBox or a ListBox looks really ugly unless they exist in
a
* ScrollArea.
*/ */
class GCN_CORE_DECLSPEC ScrollArea: class GCN_CORE_DECLSPEC ScrollArea:
public BasicContainer, public BasicContainer,
public MouseListener public MouseListener
{ {
public: public:
/** /**
* Scrollpolicies for the horizontal and vertical scrollbar.
* The policies are:
*
* SHOW_ALWAYS - Always show the scrollbars no matter what.
* SHOW_NEVER - Never show the scrollbars no matter waht.
* SHOW_AUTO - Show the scrollbars only when needed. That is if t
he
* content grows larger then the ScrollArea.
*/
enum ScrollPolicy
{
SHOW_ALWAYS = 0,
SHOW_NEVER,
SHOW_AUTO
};
/**
* Constructor. * Constructor.
*/ */
ScrollArea(); ScrollArea();
/** /**
* Constructor. * Constructor.
* *
* @param content the content of the ScrollArea. * @param content The content of the scroll area.
*/ */
ScrollArea(Widget *content); ScrollArea(Widget *content);
/** /**
* Constructor. * Constructor.
* *
* @param content the content of the ScrollArea. * @param content The content of the scroll area.
* @param hPolicy the policy for the horizontal scrollbar. See enum * @param hPolicy The policy for the horizontal scrollbar. See enum
with with
* policies. * policies.
* @param vPolicy the policy for the vertical scrollbar. See enum w ith * @param vPolicy The policy for the vertical scrollbar. See enum w ith
* policies. * policies.
*/ */
ScrollArea(Widget *content, unsigned int hPolicy, unsigned int vPol ScrollArea(Widget *content,
icy); ScrollPolicy hPolicy,
ScrollPolicy vPolicy);
/** /**
* Destructor. * Destructor.
*/ */
virtual ~ScrollArea(); virtual ~ScrollArea();
/** /**
* Sets the content. * Sets the content.
* *
* @param widget the content of the ScrollArea. * @param widget The content of the scroll area.
*/ */
virtual void setContent(Widget* widget); void setContent(Widget* widget);
/** /**
* Gets the content. * Gets the content.
* *
* @return the content of the ScrollArea. * @return The content of the scroll area.
*/ */
virtual Widget* getContent(); Widget* getContent();
/** /**
* Sets the horizontal scrollbar policy. See enum with policies. * Sets the horizontal scrollbar policy. See enum with policies.
* *
* @param hPolicy the policy for the horizontal scrollbar. See enum * @param hPolicy The policy for the horizontal scrollbar.
with * @see getHorizontalScrollPolicy
* policies.
*/ */
virtual void setHorizontalScrollPolicy(unsigned int hPolicy); void setHorizontalScrollPolicy(ScrollPolicy hPolicy);
/** /**
* Gets the horizontal scrollbar policy. See enum with policies. * Gets the horizontal scrollbar policy. See enum with policies.
* *
* @return the policy for the horizontal scrollbar policy. See enum * @return The policy for the horizontal scrollbar policy.
with * @see setHorizontalScrollPolicy, setScrollPolicy
* policies.
*/ */
virtual unsigned int getHorizontalScrollPolicy(); ScrollPolicy getHorizontalScrollPolicy() const;
/** /**
* Sets the vertical scrollbar policy. See enum with policies. * Sets the vertical scrollbar policy. See enum with policies.
* *
* @param vPolicy the policy for the vertical scrollbar. See enum w * @param vPolicy The policy for the vertical scrollbar.
ith * @see getVerticalScrollPolicy
* policies.
*/ */
virtual void setVerticalScrollPolicy(unsigned int vPolicy); void setVerticalScrollPolicy(ScrollPolicy vPolicy);
/** /**
* Gets the vertical scrollbar policy. See enum with policies. * Gets the vertical scrollbar policy. See enum with policies.
* *
* @return the policy for the vertical scrollbar. See enum with * @return The policy for the vertical scrollbar.
* policies. * @see setVerticalScrollPolicy, setScrollPolicy
*/ */
virtual unsigned int getVerticalScrollPolicy(); ScrollPolicy getVerticalScrollPolicy() const;
/** /**
* Sets the horizontal and vertical scrollbar policy. See enum with policies. * Sets the horizontal and vertical scrollbar policy.
* *
* @param hPolicy the policy for the horizontal scrollbar. See enum * @param hPolicy The policy for the horizontal scrollbar.
with * @param vPolicy The policy for the vertical scrollbar.
* policies. * @see getVerticalScrollPolicy, getHorizontalScrollPolicy
* @param vPolicy the policy for the vertical scrollbar. See enum w
ith
* policies.
*/ */
virtual void setScrollPolicy(unsigned int hPolicy, unsigned int vPo licy); void setScrollPolicy(ScrollPolicy hPolicy, ScrollPolicy vPolicy);
/** /**
* Sets the amount to scroll vertically. * Sets the amount to scroll vertically.
* *
* @param vScroll the amount to scroll. * @param vScroll The amount to scroll.
* @see getVerticalScrollAmount
*/ */
virtual void setVerticalScrollAmount(int vScroll); void setVerticalScrollAmount(int vScroll);
/** /**
* Gets the amount that is scrolled vertically. * Gets the amount that is scrolled vertically.
* @return the scroll amount on vertical scroll. *
* @return The scroll amount on vertical scroll.
* @see setVerticalScrollAmount, setScrollAmount
*/ */
virtual int getVerticalScrollAmount(); int getVerticalScrollAmount() const;
/** /**
* Sets the amount to scroll horizontally. * Sets the amount to scroll horizontally.
* *
* @param hScroll the amount to scroll. * @param hScroll The amount to scroll.
* @see getHorizontalScrollAmount
*/ */
virtual void setHorizontalScrollAmount(int hScroll); void setHorizontalScrollAmount(int hScroll);
/** /**
* Gets the amount that is scrolled horizontally. * Gets the amount that is scrolled horizontally.
* *
* @return the scroll amount on horizontal scroll. * @return The scroll amount on horizontal scroll.
* @see setHorizontalScrollAmount, setScrollAmount
*/ */
virtual int getHorizontalScrollAmount(); int getHorizontalScrollAmount() const;
/** /**
* Sets the amount to scroll horizontally and vertically. * Sets the amount to scroll horizontally and vertically.
* *
* @param hScroll the amount to scroll on horizontal scroll. * @param hScroll The amount to scroll on horizontal scroll.
* @param vScroll the amount to scroll on vertical scroll. * @param vScroll The amount to scroll on vertical scroll.
* @see getHorizontalScrollAmount, getVerticalScrollAmount
*/ */
virtual void setScrollAmount(int hScroll, int vScroll); void setScrollAmount(int hScroll, int vScroll);
/** /**
* Gets the maximum amount of horizontal scroll. * Gets the maximum amount of horizontal scroll.
* *
* @return the horizontal max scroll. * @return The horizontal max scroll.
*/ */
virtual int getHorizontalMaxScroll(); int getHorizontalMaxScroll();
/** /**
* Gets the maximum amount of vertical scroll. * Gets the maximum amount of vertical scroll.
* *
* @return the vertical max scroll. * @return The vertical max scroll.
*/ */
virtual int getVerticalMaxScroll(); int getVerticalMaxScroll();
/** /**
* Sets the width. * Sets the width of the scroll bars.
* *
* @param width the width of the ScrollBar. * @param width The width of the scroll bars.
* @see getScrollbarWidth
*/ */
virtual void setScrollbarWidth(int width); void setScrollbarWidth(int width);
/** /**
* Gets the width. * Gets the width of the scroll bars.
*
* @return the width of the ScrollBar. * @return the width of the ScrollBar.
* @see setScrollbarWidth
*/ */
virtual int getScrollbarWidth(); int getScrollbarWidth() const;
/** /**
* Sets the amount to scroll in pixels when the left scroll button is * Sets the amount to scroll in pixels when the left scroll button is
* pushed. * pushed.
*
* @param amount The amount to scroll in pixels.
* @see getLeftButtonScrollAmount
*/ */
virtual void setLeftButtonScrollAmount(int amount); void setLeftButtonScrollAmount(int amount);
/** /**
* Sets the amount to scroll in pixels when the right scroll button is * Sets the amount to scroll in pixels when the right scroll button is
* pushed. * pushed.
*
* @param amount The amount to scroll in pixels.
* @see getRightButtonScrollAmount
*/ */
virtual void setRightButtonScrollAmount(int amount); void setRightButtonScrollAmount(int amount);
/** /**
* Sets the amount to scroll in pixels when the up scroll button is * Sets the amount to scroll in pixels when the up scroll button is
* pushed. * pushed.
*
* @param amount The amount to scroll in pixels.
* @see getUpButtonScrollAmount
*/ */
virtual void setUpButtonScrollAmount(int amount); void setUpButtonScrollAmount(int amount);
/** /**
* Sets the amount to scroll in pixels when the down scroll button is * Sets the amount to scroll in pixels when the down scroll button is
* pushed. * pushed.
*
* @param amount The amount to scroll in pixels.
* @see getDownButtonScrollAmount
*/ */
virtual void setDownButtonScrollAmount(int amount); void setDownButtonScrollAmount(int amount);
/** /**
* Gets the amount to scroll in pixels when the left scroll button is * Gets the amount to scroll in pixels when the left scroll button is
* pushed. * pushed.
* *
* @return the amount to scroll when the left scroll button is push * @return The amount to scroll in pixels.
ed. * @see setLeftButtonScrollAmount
*/ */
virtual int getLeftButtonScrollAmount(); int getLeftButtonScrollAmount() const;
/** /**
* Gets the amount to scroll in pixels when the right scroll button is * Gets the amount to scroll in pixels when the right scroll button is
* pushed. * pushed.
* *
* @return the amount to scroll when the right scroll button is pus * @return The amount to scroll in pixels.
hed. * @see setRightButtonScrollAmount
*/ */
virtual int getRightButtonScrollAmount(); int getRightButtonScrollAmount() const;
/** /**
* Gets the amount to scroll in pixels when the up scroll button is * Gets the amount to scroll in pixels when the up scroll button is
* pushed. * pushed.
* *
* @return the amount to scroll when the up scroll button is pushed * @return The amount to scroll in pixels.
. * @see setUpButtonScrollAmount
*/ */
virtual int getUpButtonScrollAmount(); int getUpButtonScrollAmount() const;
/** /**
* Gets the amount to scroll in pixels when the down scroll button is * Gets the amount to scroll in pixels when the down scroll button is
* pushed. * pushed.
* *
* @return the amount to scroll when the down scroll button is push * @return The amount to scroll in pixels.
ed. * @see setDownButtonScrollAmount
*/ */
virtual int getDownButtonScrollAmount(); int getDownButtonScrollAmount() const;
// Inherited from BasicContainer // Inherited from BasicContainer
virtual void showWidgetPart(Widget* widget, Rectangle area); virtual void showWidgetPart(Widget* widget, Rectangle area);
virtual Rectangle getChildrenArea(); virtual Rectangle getChildrenArea();
virtual Widget *getWidgetAt(int x, int y); virtual Widget *getWidgetAt(int x, int y);
// Inherited from Widget // Inherited from Widget
virtual void draw(Graphics *graphics); virtual void draw(Graphics *graphics);
virtual void drawBorder(Graphics* graphics);
virtual void logic(); virtual void logic();
virtual void setWidth(int width); void setWidth(int width);
virtual void setHeight(int height); void setHeight(int height);
virtual void setDimension(const Rectangle& dimension); void setDimension(const Rectangle& dimension);
// Inherited from MouseListener // Inherited from MouseListener
virtual void mousePressed(MouseEvent& mouseEvent); virtual void mousePressed(MouseEvent& mouseEvent);
virtual void mouseReleased(MouseEvent& mouseEvent); virtual void mouseReleased(MouseEvent& mouseEvent);
virtual void mouseDragged(MouseEvent& mouseEvent); virtual void mouseDragged(MouseEvent& mouseEvent);
virtual void mouseWheelMovedUp(MouseEvent& mouseEvent); virtual void mouseWheelMovedUp(MouseEvent& mouseEvent);
virtual void mouseWheelMovedDown(MouseEvent& mouseEvent); virtual void mouseWheelMovedDown(MouseEvent& mouseEvent);
/**
* Scrollpolicies for the horizontal and vertical scrollbar.
* The policies are:
*
* SHOW_ALWAYS - Always show the scrollbars no matter what.
* SHOW_NEVER - Never show the scrollbars no matter waht.
* SHOW_AUTO - Show the scrollbars only when needed. That is if t
he
* content grows larger then the ScrollArea.
*/
enum
{
SHOW_ALWAYS,
SHOW_NEVER,
SHOW_AUTO
};
protected: protected:
/** /**
* Draws the background of the ScrollArea * Draws the background of the scroll area, that is
* (the area behind the content). * the area behind the content.
* *
* @param graphics a Graphics object to draw with. * @param graphics a Graphics object to draw with.
*/ */
virtual void drawBackground(Graphics *graphics); virtual void drawBackground(Graphics *graphics);
/** /**
* Draws the up button. * Draws the up button.
* *
* @param graphics a Graphics object to draw with. * @param graphics a Graphics object to draw with.
*/ */
skipping to change at line 374 skipping to change at line 380
virtual void drawLeftButton(Graphics *graphics); virtual void drawLeftButton(Graphics *graphics);
/** /**
* Draws the right button. * Draws the right button.
* *
* @param graphics a Graphics object to draw with. * @param graphics a Graphics object to draw with.
*/ */
virtual void drawRightButton(Graphics *graphics); virtual void drawRightButton(Graphics *graphics);
/** /**
* Draws the vertical scrollbar. * Draws the vertical scroll bar.
* *
* @param graphics a Graphics object to draw with. * @param graphics a Graphics object to draw with.
*/ */
virtual void drawVBar(Graphics* graphics); virtual void drawVBar(Graphics* graphics);
/** /**
* Draws the horizontal scrollbar. * Draws the horizontal scroll bar.
* *
* @param graphics a Graphics object to draw with. * @param graphics a Graphics object to draw with.
*/ */
virtual void drawHBar(Graphics* graphics); virtual void drawHBar(Graphics* graphics);
/** /**
* Draws the vertical marker. * Draws the vertical marker.
* *
* @param graphics a Graphics object to draw with. * @param graphics a Graphics object to draw with.
*/ */
virtual void drawVMarker(Graphics* graphics); virtual void drawVMarker(Graphics* graphics);
/** /**
* Draws the horizontal marker. * Draws the horizontal marker.
* *
* @param graphics a Graphics object to draw with. * @param graphics a Graphics object to draw with.
*/ */
virtual void drawHMarker(Graphics* graphics); virtual void drawHMarker(Graphics* graphics);
/** /**
* Checks the policies for the scrollbars. * Checks the policies for the scroll bars.
*/ */
virtual void checkPolicies(); virtual void checkPolicies();
/** /**
* Gets the up button dimension. * Gets the up button dimension.
* *
* @return the dimension of the up button. * @return the dimension of the up button.
*/ */
virtual Rectangle getUpButtonDimension(); Rectangle getUpButtonDimension();
/** /**
* Gets the down button dimension. * Gets the down button dimension.
* *
* @return the dimension of the down button. * @return the dimension of the down button.
*/ */
virtual Rectangle getDownButtonDimension(); Rectangle getDownButtonDimension();
/** /**
* Gets the left button dimension. * Gets the left button dimension.
* *
* @return the dimension of the left button. * @return the dimension of the left button.
*/ */
virtual Rectangle getLeftButtonDimension(); Rectangle getLeftButtonDimension();
/** /**
* Gets the right button dimension. * Gets the right button dimension.
* *
* @return the dimension of the right button. * @return the dimension of the right button.
*/ */
virtual Rectangle getRightButtonDimension(); Rectangle getRightButtonDimension();
/** /**
* Gets the vertical scrollbar dimension. * Gets the vertical scrollbar dimension.
* *
* @return the dimension of the vertical scrollbar. * @return the dimension of the vertical scrollbar.
*/ */
virtual Rectangle getVerticalBarDimension(); Rectangle getVerticalBarDimension();
/** /**
* Gets the horizontal scrollbar dimension. * Gets the horizontal scrollbar dimension.
* *
* @return the dimension of the horizontal scrollbar. * @return the dimension of the horizontal scrollbar.
*/ */
virtual Rectangle getHorizontalBarDimension(); Rectangle getHorizontalBarDimension();
/** /**
* Gets the vertical marker dimension. * Gets the vertical marker dimension.
* *
* @return the dimension of the vertical marker. * @return the dimension of the vertical marker.
*/ */
virtual Rectangle getVerticalMarkerDimension(); Rectangle getVerticalMarkerDimension();
/** /**
* Gets the horizontal marker dimension. * Gets the horizontal marker dimension.
* *
* @return the dimension of the horizontal marker. * @return the dimension of the horizontal marker.
*/ */
virtual Rectangle getHorizontalMarkerDimension(); Rectangle getHorizontalMarkerDimension();
/**
* Holds the vertical scroll amount.
*/
int mVScroll; int mVScroll;
/**
* Holds the horizontal scroll amount.
*/
int mHScroll; int mHScroll;
/**
* Holds the width of the scroll bars.
*/
int mScrollbarWidth; int mScrollbarWidth;
unsigned int mHPolicy;
unsigned int mVPolicy; /**
* Holds the horizontal scroll bar policy.
*/
ScrollPolicy mHPolicy;
/**
* Holds the vertical scroll bar policy.
*/
ScrollPolicy mVPolicy;
/**
* True if the vertical scroll bar is visible, false otherwise.
*/
bool mVBarVisible; bool mVBarVisible;
/**
* True if the horizontal scroll bar is visible, false otherwise.
*/
bool mHBarVisible; bool mHBarVisible;
/**
* True if the up button is pressed, false otherwise.
*/
bool mUpButtonPressed; bool mUpButtonPressed;
/**
* True if the down button is pressed, false otherwise.
*/
bool mDownButtonPressed; bool mDownButtonPressed;
/**
* True if the left button is pressed, false otherwise.
*/
bool mLeftButtonPressed; bool mLeftButtonPressed;
/**
* True if the right button is pressed, false otherwise.
*/
bool mRightButtonPressed; bool mRightButtonPressed;
/**
* Holds the up button scroll amount.
*/
int mUpButtonScrollAmount; int mUpButtonScrollAmount;
/**
* Holds the down button scroll amount.
*/
int mDownButtonScrollAmount; int mDownButtonScrollAmount;
/**
* Holds the left button scroll amount.
*/
int mLeftButtonScrollAmount; int mLeftButtonScrollAmount;
/**
* Holds the right button scroll amount.
*/
int mRightButtonScrollAmount; int mRightButtonScrollAmount;
/**
* True if the vertical marked is dragged.
*/
bool mIsVerticalMarkerDragged; bool mIsVerticalMarkerDragged;
/**
* True if the horizontal marked is dragged.
*/
bool mIsHorizontalMarkerDragged; bool mIsHorizontalMarkerDragged;
/**
* Holds the horizontal markers drag offset.
*/
int mHorizontalMarkerDragOffset; int mHorizontalMarkerDragOffset;
/**
* Holds the vertical markers drag offset.
*/
int mVerticalMarkerDragOffset; int mVerticalMarkerDragOffset;
}; };
} }
#endif // end GCN_SCROLLAREA_HPP #endif // end GCN_SCROLLAREA_HPP
 End of changes. 93 change blocks. 
164 lines changed or deleted 233 lines changed or added


 sdl.hpp   sdl.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_SDL_HPP #ifndef GCN_SDL_HPP
#define GCN_SDL_HPP #define GCN_SDL_HPP
#include <guichan/sdl/sdlgraphics.hpp> #include <guichan/sdl/sdlgraphics.hpp>
#include <guichan/sdl/sdlimage.hpp> #include <guichan/sdl/sdlimage.hpp>
#include <guichan/sdl/sdlimageloader.hpp> #include <guichan/sdl/sdlimageloader.hpp>
#include <guichan/sdl/sdlinput.hpp> #include <guichan/sdl/sdlinput.hpp>
 End of changes. 2 change blocks. 
45 lines changed or deleted 32 lines changed or added


 slider.hpp   slider.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_SLIDER_HPP #ifndef GCN_SLIDER_HPP
#define GCN_SLIDER_HPP #define GCN_SLIDER_HPP
#include "guichan/keylistener.hpp" #include "guichan/keylistener.hpp"
#include "guichan/mouselistener.hpp" #include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include "guichan/widget.hpp" #include "guichan/widget.hpp"
namespace gcn namespace gcn
{ {
/** /**
* A slider able to slide between different values. You can set the sca * An implementation of a slider where a user can select different valu
le es by
* of the slider yourself so that it ranges between, for example, -1.0 * sliding between a start value and an end value of a scale.
and *
* 2.0. * If the selected value is changed an action event will be sent to all
* action listeners of the slider.
*/ */
class GCN_CORE_DECLSPEC Slider : class GCN_CORE_DECLSPEC Slider :
public Widget, public Widget,
public MouseListener, public MouseListener,
public KeyListener public KeyListener
{ {
public: public:
/** /**
* Constructor. Scale start is 0. * Draw orientations for the slider. A slider can be drawn vertical
ly or
* horizontally.
*/
enum Orientation
{
HORIZONTAL = 0,
VERTICAL
};
/**
* Constructor. The default start value of the slider scale is zero
.
* *
* @param scaleEnd the end of the slider scale. * @param scaleEnd The end value of the slider scale.
*/ */
Slider(double scaleEnd = 1.0); Slider(double scaleEnd = 1.0);
/** /**
* Constructor. * Constructor.
* *
* @param scaleStart the start of the scale. * @param scaleStart The start value of the slider scale.
* @param scaleEnd the end of the scale. * @param scaleEnd The end value of the slider scale.
*/ */
Slider(double scaleStart, double scaleEnd); Slider(double scaleStart, double scaleEnd);
/** /**
* Destructor. * Destructor.
*/ */
virtual ~Slider() { } virtual ~Slider() { }
/** /**
* Sets the scale. * Sets the scale of the slider.
*
* @param scaleStart the start of the scale.
* @param scaleEnd the end of the scale.
*/
virtual void setScale(double scaleStart, double scaleEnd);
/**
* Gets the scale start.
* *
* @return the scale start. * @param scaleStart The start value of the scale.
* @param scaleEnd tThe end of value the scale.
* @see getScaleStart, getScaleEnd
*/ */
virtual double getScaleStart() const; void setScale(double scaleStart, double scaleEnd);
/** /**
* Sets the scale start. * Gets the start value of the scale.
* *
* @param scaleStart the start of the scale. * @return The start value of the scale.
* @see setScaleStart, setScale
*/ */
virtual void setScaleStart(double scaleStart); double getScaleStart() const;
/** /**
* Gets the scale end. * Sets the start value of the scale.
* *
* @return the scale end. * @param scaleStart The start value of the scale.
* @see getScaleStart
*/ */
virtual double getScaleEnd() const; void setScaleStart(double scaleStart);
/** /**
* Sets the scale end. * Gets the end value of the scale.
* *
* @param scaleEnd the end of the scale. * @return The end value of the scale.
* @see setScaleEnd, setScale
*/ */
virtual void setScaleEnd(double scaleEnd); double getScaleEnd() const;
/** /**
* Gets the current value. * Sets the end value of the scale.
* *
* @return the current value. * @param scaleEnd The end value of the scale.
* @see getScaleEnd
*/ */
virtual double getValue() const; void setScaleEnd(double scaleEnd);
/** /**
* Sets the current value. * Gets the current selected value.
* *
* @param value a scale value. * @return The current selected value.
* @see setValue
*/ */
virtual void setValue(double value); double getValue() const;
/** /**
* Draws the marker. * Sets the current selected value.
* *
* @param graphics a graphics object to draw with. * @param value The current selected value.
* @see getValue
*/ */
virtual void drawMarker(gcn::Graphics* graphics); void setValue(double value);
/** /**
* Sets the length of the marker. * Sets the length of the marker.
* *
* @param length new length for the marker. * @param length The length for the marker.
* @see getMarkerLength
*/ */
virtual void setMarkerLength(int length); void setMarkerLength(int length);
/** /**
* Gets the length of the marker. * Gets the length of the marker.
* *
* @return the length of the marker. * @return The length of the marker.
* @see setMarkerLength
*/ */
virtual int getMarkerLength() const; int getMarkerLength() const;
/** /**
* Sets the orientation of the slider. A slider can be drawn vertic * Sets the orientation of the slider. A slider can be drawn vertic
aly ally
* or horizontaly. For orientation, see the enum in this class. * or horizontally.
* *
* @param orientation the orientation. * @param orientation The orientation of the slider.
* @see getOrientation
*/ */
virtual void setOrientation(unsigned int orientation); void setOrientation(Orientation orientation);
/** /**
* Gets the orientation of the slider. Se the enum in this class. * Gets the orientation of the slider. A slider can be drawn vertic
ally
* or horizontally.
* *
* @return the orientation of the slider. * @return The orientation of the slider.
* @see setOrientation
*/ */
virtual unsigned int getOrientation() const; Orientation getOrientation() const;
/** /**
* Sets the step length. Step length is used when the keys left and * Sets the step length. The step length is used when the keys LEFT
* right are pressed. * and RIGHT are pressed to step in the scale.
* *
* @param length the step length. * @param length The step length.
* @see getStepLength
*/ */
virtual void setStepLength(double length); void setStepLength(double length);
/** /**
* Gets the step length. * Gets the step length. The step length is used when the keys LEFT
* and RIGHT are pressed to step in the scale.
* *
* @return the step length. * @return the step length.
* @see setStepLength
*/ */
virtual double getStepLength() const; double getStepLength() const;
// Inherited from Widget // Inherited from Widget
virtual void draw(gcn::Graphics* graphics); virtual void draw(Graphics* graphics);
virtual void drawBorder(gcn::Graphics* graphics);
// Inherited from MouseListener. // Inherited from MouseListener.
virtual void mousePressed(MouseEvent& mouseEvent); virtual void mousePressed(MouseEvent& mouseEvent);
virtual void mouseDragged(MouseEvent& mouseEvent); virtual void mouseDragged(MouseEvent& mouseEvent);
virtual void mouseWheelMovedUp(MouseEvent& mouseEvent); virtual void mouseWheelMovedUp(MouseEvent& mouseEvent);
virtual void mouseWheelMovedDown(MouseEvent& mouseEvent); virtual void mouseWheelMovedDown(MouseEvent& mouseEvent);
// Inherited from KeyListener // Inherited from KeyListener
virtual void keyPressed(KeyEvent& keyEvent); virtual void keyPressed(KeyEvent& keyEvent);
protected:
/** /**
* Draw orientations for the slider. It can be drawn verticaly or * Draws the marker.
* horizontaly. *
* @param graphics A graphics object to draw with.
*/ */
enum virtual void drawMarker(gcn::Graphics* graphics);
{
HORIZONTAL = 0,
VERTICAL
};
protected:
/** /**
* Converts a marker position to a value. * Converts a marker position to a value in the scale.
* *
* @param v the position to convert. * @param position The position to convert.
* @return the value corresponding to the position. * @return A scale value corresponding to the position.
* @see valueToMarkerPosition
*/ */
virtual double markerPositionToValue(int v) const; virtual double markerPositionToValue(int position) const;
/** /**
* Converts a value to a marker position. * Converts a value to a marker position.
* *
* @param value the value to convert. * @param value The value to convert.
* @return the position corresponding to the value. * @return A marker position corresponding to the value.
* @see markerPositionToValue
*/ */
virtual int valueToMarkerPosition(double value) const; virtual int valueToMarkerPosition(double value) const;
/** /**
* Gets the marker position for the current value. * Gets the marker position of the current selected value.
* *
* @return the marker position for the current value. * @return The marker position of the current selected value.
*/ */
virtual int getMarkerPosition() const; virtual int getMarkerPosition() const;
bool mMouseDrag; /**
* True if the slider is dragged, false otherwise.
*/
bool mDragged;
/**
* Holds the current selected value.
*/
double mValue; double mValue;
/**
* Holds the step length. The step length is used when the keys LEF
T
* and RIGHT are pressed to step in the scale.
*/
double mStepLength; double mStepLength;
/**
* Holds the length of the marker.
*/
int mMarkerLength; int mMarkerLength;
/**
* Holds the start value of the scale.
*/
double mScaleStart; double mScaleStart;
/**
* Holds the end value of the scale.
*/
double mScaleEnd; double mScaleEnd;
unsigned int mOrientation;
/**
* Holds the orientation of the slider. A slider can be drawn
* vertically or horizontally.
*/
Orientation mOrientation;
}; };
} }
#endif // end GCN_SLIDER_HPP #endif // end GCN_SLIDER_HPP
 End of changes. 60 change blocks. 
122 lines changed or deleted 158 lines changed or added


 textbox.hpp   textbox.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_TEXTBOX_HPP #ifndef GCN_TEXTBOX_HPP
#define GCN_TEXTBOX_HPP #define GCN_TEXTBOX_HPP
#include <ctime> #include <ctime>
#include <string> #include <string>
#include <vector> #include <vector>
#include "guichan/keylistener.hpp" #include "guichan/keylistener.hpp"
#include "guichan/mouselistener.hpp" #include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include "guichan/widget.hpp" #include "guichan/widget.hpp"
namespace gcn namespace gcn
{ {
/** /**
* A TextBox in which you can write and/or display a lines of text. * An implementation of a text box where a user can enter text that con
* tains of many lines.
* NOTE: A plain TextBox is really uggly and looks much better inside a
* ScrollArea.
*/ */
class GCN_CORE_DECLSPEC TextBox: class GCN_CORE_DECLSPEC TextBox:
public Widget, public Widget,
public MouseListener, public MouseListener,
public KeyListener public KeyListener
{ {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
TextBox(); TextBox();
/** /**
* Constructor. * Constructor.
* *
* @param text the text of the TextBox. * @param text The default text of the text box.
*/ */
TextBox(const std::string& text); TextBox(const std::string& text);
/** /**
* Sets the text. * Sets the text of the text box.
* *
* @param text the text of the TextBox. * @param text The text of the text box.
* @see getText
*/ */
virtual void setText(const std::string& text); void setText(const std::string& text);
/** /**
* Gets the text. * Gets the text of the text box.
* @return the text of the TextBox. *
* @return The text of the text box.
* @see setText
*/ */
virtual std::string getText() const; std::string getText() const;
/** /**
* Gets the row of a text. * Gets a certain row from the text.
* *
* @return the text of a certain row in the TextBox. * @param row The number of the row to get from the text.
* @return A row from the text of the text box.
* @see setTextRow
*/ */
virtual const std::string& getTextRow(int row) const; const std::string& getTextRow(int row) const;
/** /**
* Sets the text of a certain row in a TextBox. * Sets the text of a certain row of the text.
* *
* @param row the row number. * @param row The number of the row to set in the text.
* @param text the text of a certain row in the TextBox. * @param text The text to set in the given row number.
* @see getTextRow
*/ */
virtual void setTextRow(int row, const std::string& text); void setTextRow(int row, const std::string& text);
/** /**
* Gets the number of rows in the text. * Gets the number of rows in the text.
* *
* @return the number of rows in the text. * @return The number of rows in the text.
*/ */
virtual unsigned int getNumberOfRows() const; unsigned int getNumberOfRows() const;
/** /**
* Gets the caret position in the text. * Gets the caret position in the text.
* *
* @return the caret position in the text. * @return The caret position in the text.
* @see setCaretPosition
*/ */
virtual unsigned int getCaretPosition() const; unsigned int getCaretPosition() const;
/** /**
* Sets the position of the caret in the text. * Sets the position of the caret in the text.
* *
* @param position the positon of the caret. * @param position the positon of the caret.
* @see getCaretPosition
*/ */
virtual void setCaretPosition(unsigned int position); void setCaretPosition(unsigned int position);
/** /**
* Gets the row the caret is in in the text. * Gets the row number where the caret is currently located.
* *
* @return the row the caret is in in the text. * @return The row number where the caret is currently located.
* @see setCaretRow
*/ */
virtual unsigned int getCaretRow() const; unsigned int getCaretRow() const;
/** /**
* Sets the row the caret should be in in the text. * Sets the row where the caret should be currently located.
* *
* @param row the row number. * @param The row where the caret should be currently located.
* @see getCaretRow
*/ */
virtual void setCaretRow(int row); void setCaretRow(int row);
/** /**
* Gets the column the caret is in in the text. * Gets the column where the caret is currently located.
* *
* @return the column the caret is in in the text. * @return The column where the caret is currently located.
* @see setCaretColumn
*/ */
virtual unsigned int getCaretColumn() const; unsigned int getCaretColumn() const;
/** /**
* Sets the column the caret should be in in the text. * Sets the column where the caret should be currently located.
* *
* @param column the column number. * @param The column where the caret should be currently located.
* @see getCaretColumn
*/ */
virtual void setCaretColumn(int column); void setCaretColumn(int column);
/** /**
* Sets the row and the column the caret should be in in the text. * Sets the row and the column where the caret should be curretly
* located.
* *
* @param row the row number. * @param row The row where the caret should be currently located.
* @param column the column number. * @param column The column where the caret should be currently loc
ated.
* @see getCaretRow, getCaretColumn
*/ */
virtual void setCaretRowColumn(int row, int column); void setCaretRowColumn(int row, int column);
/** /**
* Scrolls the text to the caret if the TextBox is in a ScrollArea. * Scrolls the text to the caret if the text box is in a scroll are
a.
*
* @see ScrollArea
*/ */
virtual void scrollToCaret(); virtual void scrollToCaret();
/** /**
* Checks if the TextBox is editable. * Checks if the text box is editable.
* *
* @return true it the TextBox is editable. * @return True it the text box is editable, false otherwise.
* @see setEditable
*/ */
virtual bool isEditable() const; bool isEditable() const;
/** /**
* Sets if the TextBox should be editable or not. * Sets the text box to be editable or not.
* *
* @param editable true if the TextBox should be editable. * @param editable True if the text box should be editable, false o therwise.
*/ */
virtual void setEditable(bool editable); void setEditable(bool editable);
/** /**
* Adds a text row to the text. * Adds a row of text to the end of the text.
* *
* @param row a row. * @param row The row to add.
*/ */
virtual void addRow(const std::string row); virtual void addRow(const std::string row);
/** /**
* Checks if the TextBox is opaque * Checks if the text box is opaque. An opaque text box will draw
* it's background and it's text. A non opaque text box only draw i
t's
* text making it transparent.
* *
* @return true if the TextBox is opaque * @return True if the text box is opaque, false otherwise.
* @see setOpaque
*/ */
virtual bool isOpaque(); bool isOpaque();
/** /**
* Sets the TextBox to be opaque. * Sets the text box to be opaque or not. An opaque text box will d
raw
* it's background and it's text. A non opaque text box only draw i
t's
* text making it transparent.
* *
* @param opaque true if the TextBox should be opaque. * @param opaque True if the text box should be opaque, false other
wise.
* @see isOpaque
*/ */
virtual void setOpaque(bool opaque); void setOpaque(bool opaque);
// Inherited from Widget // Inherited from Widget
virtual void draw(Graphics* graphics); virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
virtual void fontChanged(); virtual void fontChanged();
// Inherited from KeyListener // Inherited from KeyListener
virtual void keyPressed(KeyEvent& keyEvent); virtual void keyPressed(KeyEvent& keyEvent);
// Inherited from MouseListener // Inherited from MouseListener
virtual void mousePressed(MouseEvent& mouseEvent); virtual void mousePressed(MouseEvent& mouseEvent);
virtual void mouseDragged(MouseEvent& mouseEvent); virtual void mouseDragged(MouseEvent& mouseEvent);
protected: protected:
/** /**
* Draws the caret. * Draws the caret. Overloaded this method if you want to
* change the style of the caret.
* *
* @param graphics a Graphics object to draw with. * @param graphics a Graphics object to draw with.
* @param x the x position. * @param x the x position.
* @param y the y position. * @param y the y position.
*/ */
virtual void drawCaret(Graphics* graphics, int x, int y); virtual void drawCaret(Graphics* graphics, int x, int y);
/** /**
* Adjusts the TextBox size to fit the font size. * Adjusts the text box's size to fit the text.
*/ */
virtual void adjustSize(); virtual void adjustSize();
/**
* Holds all the rows of the text.
*/
std::vector<std::string> mTextRows; std::vector<std::string> mTextRows;
/**
* Holds the current column of the caret.
*/
int mCaretColumn; int mCaretColumn;
/**
* Holds the current row of the caret.
*/
int mCaretRow; int mCaretRow;
/**
* True if the text box is editable, false otherwise.
*/
bool mEditable; bool mEditable;
/**
* True if the text box is editable, false otherwise.
*/
bool mOpaque; bool mOpaque;
}; };
} }
#endif // end GCN_TEXTBOX_HPP #endif // end GCN_TEXTBOX_HPP
 End of changes. 59 change blocks. 
103 lines changed or deleted 135 lines changed or added


 textfield.hpp   textfield.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_TEXTFIELD_HPP #ifndef GCN_TEXTFIELD_HPP
#define GCN_TEXTFIELD_HPP #define GCN_TEXTFIELD_HPP
#include "guichan/keylistener.hpp" #include "guichan/keylistener.hpp"
#include "guichan/mouselistener.hpp" #include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include "guichan/widget.hpp" #include "guichan/widget.hpp"
#include <string> #include <string>
namespace gcn namespace gcn
{ {
/** /**
* A text field in which you can write or display a line of text. * An implementation of a text field where a user can enter a line of t ext.
*/ */
class GCN_CORE_DECLSPEC TextField: class GCN_CORE_DECLSPEC TextField:
public Widget, public Widget,
public MouseListener, public MouseListener,
public KeyListener public KeyListener
{ {
public: public:
/** /**
* Default constructor. * Constructor.
*/ */
TextField(); TextField();
/** /**
* Constructor. Initializes the textfield with a given string. * Constructor. The text field will be automatically resized
* to fit the text.
* *
* @param text the initial text. * @param text The default text of the text field.
*/ */
TextField(const std::string& text); TextField(const std::string& text);
/** /**
* Sets the text. * Sets the text of the text field.
*
* @param text the new text in the TextField.
*/
virtual void setText(const std::string& text);
/**
* Gets the text.
* *
* @return the text of the TextField. * @param text The text of the text field.
* @see getText
*/ */
virtual const std::string& getText() const; void setText(const std::string& text);
/** /**
* Draws the caret (the little marker in the text that shows where * Gets the text of the text field.
the
* letters you type will appear). Easily overloaded if you want to
* change the style of the caret.
* *
* @param graphics the Graphics object to draw with. * @return The text of the text field.
* @param x the caret's x-position. * @see setText
*/ */
virtual void drawCaret(Graphics* graphics, int x); const std::string& getText() const;
/** /**
* Adjusts the size of the TextField to fit the font size. The * Adjusts the size of the text field to fit the text.
* constructor taking a string uses this function to initialize the
* size of the TextField.
*/ */
virtual void adjustSize(); void adjustSize();
/** /**
* Adjusts the height of the text field to fit the font size. The * Adjusts the height of the text field to fit caption.
* height of the TextField is initialized with this function by the
* constructors.
*/ */
virtual void adjustHeight(); void adjustHeight();
/** /**
* Sets the caret position. * Sets the caret position. As there is only one line of text
* in a text field the position is the caret's x coordinate.
* *
* @param position the caret position. * @param position The caret position.
* @see getCaretPosition
*/ */
virtual void setCaretPosition(unsigned int position); void setCaretPosition(unsigned int position);
/** /**
* Gets the caret position. * Gets the caret position. As there is only one line of text
* in a text field the position is the caret's x coordinate.
* *
* @return the caret position. * @return The caret position.
* @see setCaretPosition
*/ */
virtual unsigned int getCaretPosition() const; unsigned int getCaretPosition() const;
// Inherited from Widget // Inherited from Widget
virtual void fontChanged(); virtual void fontChanged();
virtual void draw(Graphics* graphics); virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
// Inherited from MouseListener // Inherited from MouseListener
virtual void mousePressed(MouseEvent& mouseEvent); virtual void mousePressed(MouseEvent& mouseEvent);
virtual void mouseDragged(MouseEvent& mouseEvent); virtual void mouseDragged(MouseEvent& mouseEvent);
// Inherited from KeyListener // Inherited from KeyListener
virtual void keyPressed(KeyEvent& keyEvent); virtual void keyPressed(KeyEvent& keyEvent);
protected: protected:
/** /**
* Draws the caret. Overloaded this method if you want to
* change the style of the caret.
*
* @param graphics the Graphics object to draw with.
* @param x the caret's x-position.
*/
virtual void drawCaret(Graphics* graphics, int x);
/**
* Scrolls the text horizontally so that the caret shows if needed. * Scrolls the text horizontally so that the caret shows if needed.
* The method is used any time a user types in the text field so th
e
* caret always will be shown.
*/ */
void fixScroll(); void fixScroll();
/**
* Holds the text of the text box.
*/
std::string mText; std::string mText;
/**
* Holds the caret position.
*/
unsigned int mCaretPosition; unsigned int mCaretPosition;
/**
* Holds the amount scrolled in x. If a user types more characters
than
* the text field can display, due to the text field being to small
, the
* text needs to scroll in order to show the last type character.
*/
int mXScroll; int mXScroll;
}; };
} }
#endif // end GCN_TEXTFIELD_HPP #endif // end GCN_TEXTFIELD_HPP
 End of changes. 28 change blocks. 
82 lines changed or deleted 86 lines changed or added


 widget.hpp   widget.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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 #ifndef GCN_WIDGET_HPP
#define GCN_WIDGET_HPP #define GCN_WIDGET_HPP
#include <list> #include <list>
#include <string> #include <string>
#include "guichan/color.hpp" #include "guichan/color.hpp"
#include "guichan/rectangle.hpp" #include "guichan/rectangle.hpp"
skipping to change at line 80 skipping to change at line 67
class DeathListener; class DeathListener;
class DefaultFont; class DefaultFont;
class FocusHandler; class FocusHandler;
class FocusListener; class FocusListener;
class Font; class Font;
class Graphics; class Graphics;
class KeyInput; class KeyInput;
class KeyListener; class KeyListener;
class MouseInput; class MouseInput;
class MouseListener; class MouseListener;
class WidgetListener;
/** /**
* Widget base class. Contains basic widget functions every widget shou * Abstract class for widgets of Guichan. It contains basic functions
ld * every widget should have.
* have. Widgets should inherit from this class and implements it's
* functions.
* *
* NOTE: Functions begining with underscore "_" should not * NOTE: Functions begining with underscore "_" should not
* be overloaded unless you know what you are doing * be overloaded unless you know what you are doing
* *
* @author Olof Naess * @author Olof Naess
* @author Per Larsson. * @author Per Larsson.
* @since 0.1.0
*/ */
class GCN_CORE_DECLSPEC Widget class GCN_CORE_DECLSPEC Widget
{ {
public: public:
/** /**
* Constructor. Resets member variables. Noteable, a widget is not * Constructor. Resets member variables. Noteable, a widget is not
* focusable as default, therefore, widgets that are supposed to be * focusable as default, therefore, widgets that are supposed to be
* focusable should overide this default in their own constructor. * focusable should overide this default in their own constructor.
*/ */
Widget(); Widget();
/** /**
* Default destructor. * Default destructor.
*/ */
virtual ~Widget(); virtual ~Widget();
/** /**
* Draws the widget. It is called by the parent widget when it is t ime * Draws the widget. It is called by the parent widget when it is t ime
* for the widget to draw itself. The graphics object is set up so * 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 * 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 * the top left corner of the widget. It is not possible to draw
* outside of a widgets dimension. * outside of a widget's dimension.
* *
* @param graphics a Graphics object to draw with. * @param graphics aA graphics object to draw with.
* @since 0.1.0
*/ */
virtual void draw(Graphics* graphics) = 0; virtual void draw(Graphics* graphics) = 0;
/** /**
* Draws the widget border. A border is drawn around a widget. * Called when a widget is given a chance to draw a frame around it
* The width and height of the border is therefore the widgets self.
* height+2*bordersize. Think of a painting that has a certain size * The frame is not considered a part of the widget, it only allows
, a frame
* the border surrounds the painting. * to be drawn around the widget, thus a frame will never be includ
ed when
* calculating if a widget should receive events from user input. A
lso
* a widget's frame will never be included when calculating a widge
t's
* position.
* *
* @param graphics a Graphics object to draw with. * The size of the frame is calculated using the widget's frame siz
e.
* If a widget has a frame size of 10 pixels than the area the draw
Frame
* function can draw to will be the size of the widget with an addi
tional
* extension of 10 pixels in each direction.
*
* An example when drawFrame is a useful function is if a widget ne
eds
* a glow around itself.
*
* @param graphics A graphics object to draw with.
* @see setFrameSize, getFrameSize
* @since 0.8.0
*/ */
virtual void drawBorder(Graphics* graphics) { } virtual void drawFrame(Graphics* graphics);
/** /**
* Called for all widgets in the gui each time Gui::logic is called * Sets the size of the widget's frame. The frame is not considered
. a part of
* You can do logic stuff here like playing an animation. * 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 recei
ve events
* from user input. Also a widget's frame will never be included wh
en calculating
* a widget's position.
* *
* @see Gui * A frame size of 0 means that the widget has no frame. The defaul
t frame size
* is 0.
*
* @param frameSize The size of the widget's frame.
* @see getFrameSize, drawFrame
* @since 0.8.0
*/ */
virtual void logic() { } void setFrameSize(unsigned int frameSize);
/** /**
* Gets the widget parent container. * 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 recei
ve events
* from user input. Also a widget's frame will never be included wh
en calculating
* a widget's position.
* *
* @return the widget parent container. Returns NULL if the widget * A frame size of 0 means that the widget has no frame. The defaul
* has no parent. t frame size
* is 0.
*
* @return The size of the widget's frame.
* @see setFrameSize, drawFrame
* @since 0.8.0
*/ */
virtual Widget* getParent() const; unsigned int getFrameSize() const;
/** /**
* Sets the width of the widget in pixels. * Called for all widgets in the gui each time Gui::logic is called
.
* You can do logic stuff here like playing an animation.
* *
* @param width the widget width in pixels. * @see Gui::logic
* @since 0.1.0
*/ */
virtual void setWidth(int width); virtual void logic() { }
/** /**
* Gets the width of the widget in pixels. * Gets the widget's parent container.
* *
* @return the widget with in pixels. * @return The widget's parent container. NULL if the widget
* has no parent.
* @since 0.1.0
*/ */
virtual int getWidth() const; virtual Widget* getParent() const;
/** /**
* Sets the height of the widget in pixels. * Sets the width of the widget.
* *
* @param height the widget height in pixels. * @param width The width of the widget.
* @see getWidth, setHeight, getHeight, setSize,
* setDimension, getDimensi
* @since 0.1.0
*/ */
virtual void setHeight(int height); void setWidth(int width);
/** /**
* Gets the height of the widget in pixels. * Gets the width of the widget.
* *
* @return the widget height in pixels. * @return The width of the widget.
* @see setWidth, setHeight, getHeight, setSize,
* setDimension, getDimension
* @since 0.1.0
*/ */
virtual int getHeight() const; int getWidth() const;
/** /**
* Sets the size of the widget. * Sets the height of the widget.
* *
* @param width the width. * @param height The height of the widget.
* @param height the height. * @see getHeight, setWidth, getWidth, setSize,
* setDimension, getDimension
* @since 0.1.0
*/ */
virtual void setSize(int width, int height); void setHeight(int height);
/** /**
* Set the widget x coordinate. It is relateive to it's parent. * Gets the height of the widget.
* *
* @param x the widget x coordinate. * @return The height of the widget.
* @see setHeight, setWidth, getWidth, setSize,
* setDimension, getDimension
* @since 0.1.0
*/ */
virtual void setX(int x); int getHeight() const;
/** /**
* Gets the widget x coordinate. It is relative to it's parent. * Sets the size of the widget.
* *
* @return the widget x coordinate. * @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
*/ */
virtual int getX() const; void setSize(int width, int height);
/** /**
* Set the widget y coordinate. It is relative to it's parent. * Sets the x coordinate of the widget. The coordinate is
* relateive to the widget's parent.
* *
* @param y the widget y coordinate. * @param x The x coordinate of the widget.
* @see getX, setY, getY, setPosition, setDimension, getDimension
* @since 0.1.0
*/ */
virtual void setY(int y); void setX(int x);
/** /**
* Gets the widget y coordinate. It is relative to it's parent. * Gets the x coordinate of the widget. The coordinate is
* relative to the widget's parent.
* *
* @return the widget y coordinate. * @return The x coordinate of the widget.
* @see setX, setY, getY, setPosition, setDimension, getDimension
* @since 0.1.0
*/ */
virtual int getY() const; int getX() const;
/** /**
* Sets the widget position. It is relative to it's parent. * Sets the y coordinate of the widget. The coordinate is
* relative to the widget's parent.
* *
* @param x the widget x coordinate. * @param y The y coordinate of the widget.
* @param y the widgets y coordinate. * @see setY, setX, getX, setPosition, setDimension, getDimension
* @since 0.1.0
*/ */
virtual void setPosition(int x, int y); void setY(int y);
/** /**
* Sets the dimension of the widget. It is relative to it's parent. * Gets the y coordinate of the widget. The coordinate is
* relative to the widget's parent.
* *
* @param dimension the widget dimension. * @return The y coordinate of the widget.
* @see setY, setX, getX, setPosition, setDimension, getDimension
* @since 0.1.0
*/ */
virtual void setDimension(const Rectangle& dimension); int getY() const;
/** /**
* Sets the size of the border, or the width if you so like. The si * Sets position of the widget. The position is relative
ze * to the widget's parent.
* is the number of pixels that the border extends outside the widg
et.
* Border size = 0 means no border.
* *
* @param borderSize the size of the border. * @param x The x coordinate of the widget.
* @see drawBorder * @param y The y coordinate of the widget.
*/ * @see setX, getX, setY, getY, setDimension, getDimension
virtual void setBorderSize(unsigned int borderSize); * @since 0.1.0
*/
void setPosition(int x, int y);
/** /**
* Gets the size of the border, or the width if you so like. The si * Sets the dimension of the widget. The dimension is
ze * relative to the widget's parent.
* is the number of pixels that the border extends outside the widg
et.
* Border size = 0 means no border.
* *
* @return the size of the border. * @param dimension The dimension of the widget.
* @see drawBorder * @see getDimension, setX, getX, setY, getY, setPosition
* @since 0.1.0
*/ */
virtual unsigned int getBorderSize() const; void setDimension(const Rectangle& dimension);
/** /**
* Gets the dimension of the widget. It is relative to it's parent. * Gets the dimension of the widget. The dimension is
* relative to the widget's parent.
* *
* @return the widget dimension. * @return The dimension of the widget.
* @see getDimension, setX, getX, setY, getY, setPosition
* @since 0.1.0
*/ */
virtual const Rectangle& getDimension() const; const Rectangle& getDimension() const;
/** /**
* Sets a widgets focusability. * Sets the widget to be fosusable, or not.
* *
* @param focusable true if the widget should be focusable. * @param focusable True if the widget should be focusable,
* false otherwise.
* @see isFocusable
* @since 0.1.0
*/ */
virtual void setFocusable(bool focusable); void setFocusable(bool focusable);
/** /**
* Checks whether the widget is focusable. * Checks if a widget is focsable.
* *
* @return true if the widget is focusable. * @return True if the widget should be focusable, false otherwise.
* @see setFocusable
* @since 0.1.0
*/ */
virtual bool isFocusable() const; bool isFocusable() const;
/** /**
* Checks if the widget is focused. * Checks if the widget is focused.
* *
* @return true if the widget currently has focus. * @return True if the widget is focused, false otherwise.
* @since 0.1.0
*/ */
virtual bool isFocused() const; virtual bool isFocused() const;
/** /**
* Sets the widget to be disabled or enabled. A disabled * Sets the widget to enabled, or not. A disabled
* widget will never recieve mouse or key input. * widget will never recieve mouse or key events.
* *
* @param enabled true if widget is enabled. * @param enabled True if widget should be enabled,
* false otherwise.
* @see isEnabled
* @since 0.1.0
*/ */
virtual void setEnabled(bool enabled); void setEnabled(bool enabled);
/** /**
* Checks if a widget is disabled or not. * Checks if the widget is enabled. A disabled
* widget will never recieve mouse or key events.
* *
* @return true if the widget should be enabled. * @return True if widget is enabled, false otherwise.
* @see setEnabled
* @since 0.1.0
*/ */
virtual bool isEnabled() const; bool isEnabled() const;
/** /**
* Sets the widget to be visible. * Sets the widget to be visible, or not.
* *
* @param visible true if the widget should be visiable. * @param visible True if widget should be visible, false otherwise
.
* @see isVisible
* @since 0.1.0
*/ */
virtual void setVisible(bool visible); void setVisible(bool visible);
/** /**
* Checks if the widget is visible. * Checks if the widget is visible.
* *
* @return true if the widget is visible. * @return True if widget is be visible, false otherwise.
* @see setVisible
* @since 0.1.0
*/ */
virtual bool isVisible() const; bool isVisible() const;
/** /**
* Sets the base color. The base color is the background * Sets the base color of the widget.
* color for many widgets like the Button and Contianer widgets.
* *
* @param color the baseground color. * @param color The baseground color.
* @see getBaseColor
* @since 0.1.0
*/ */
virtual void setBaseColor(const Color& color); void setBaseColor(const Color& color);
/** /**
* Gets the base color. * Gets the base color.
* *
* @return the foreground color. * @return The base color.
* @see setBaseColor
* @since 0.1.0
*/ */
virtual const Color& getBaseColor() const; const Color& getBaseColor() const;
/** /**
* Sets the foreground color. * Sets the foreground color.
* *
* @param color the foreground color. * @param color The foreground color.
* @see getForegroundColor
* @since 0.1.0
*/ */
virtual void setForegroundColor(const Color& color); void setForegroundColor(const Color& color);
/** /**
* Gets the foreground color. * Gets the foreground color.
* *
* @return the foreground color. * @see setForegroundColor
* @since 0.1.0
*/ */
virtual const Color& getForegroundColor() const; const Color& getForegroundColor() const;
/** /**
* Sets the background color. * Sets the background color.
* *
* @param color the background Color. * @param color The background Color.
* @see setBackgroundColor
* @since 0.1.0
*/ */
virtual void setBackgroundColor(const Color& color); void setBackgroundColor(const Color& color);
/** /**
* Gets the background color. * Gets the background color.
* *
* @return the background color. * @see setBackgroundColor
* @since 0.1.0
*/ */
virtual const Color& getBackgroundColor() const; const Color& getBackgroundColor() const;
/** /**
* Sets the selection color. * Sets the selection color.
* *
* @param color the selection color. * @param color The selection color.
* @see getSelectionColor
* @since 0.6.0
*/ */
virtual void setSelectionColor(const Color& color); void setSelectionColor(const Color& color);
/** /**
* Gets the selection color. * Gets the selection color.
* *
* @return the selection color. * @return The selection color.
* @see setSelectionColor
* @since 0.6.0
*/ */
virtual const Color& getSelectionColor() const; const Color& getSelectionColor() const;
/** /**
* Requests focus for the widget. A widget will only recieve focus * Requests focus for the widget. A widget will only recieve focus
* if it is focusable. * if it is focusable.
*/ */
virtual void requestFocus(); virtual void requestFocus();
/** /**
* Requests a move to the top in the parent widget. * Requests a move to the top in the parent widget.
*/ */
virtual void requestMoveToTop(); virtual void requestMoveToTop();
/** /**
* Requests a move to the bottom in the parent widget. * Requests a move to the bottom in the parent widget.
*/ */
virtual void requestMoveToBottom(); virtual void requestMoveToBottom();
/** /**
* Sets the FocusHandler to be used. * Sets the focus handler to be used.
* *
* WARNING: This function is used internally and should not * WARNING: This function is used internally and should not
* be called or overloaded unless you know what you * be called or overloaded unless you know what you
* are doing. * are doing.
* *
* @param focusHandler the FocusHandler to use. * @param focusHandler The focus handler to use.
* @see _getFocusHandler
* @since 0.1.0
*/ */
virtual void _setFocusHandler(FocusHandler* focusHandler); virtual void _setFocusHandler(FocusHandler* focusHandler);
/** /**
* Gets the FocusHandler used. * Gets the focus handler used.
* *
* WARNING: This function is used internally and should not * WARNING: This function is used internally and should not
* be called or overloaded unless you know what you * be called or overloaded unless you know what you
* are doing. * are doing.
* *
* @return the FocusHandler used. * @return The focus handler used.
* @see _setFocusHandler
* @since 0.1.0
*/ */
virtual FocusHandler* _getFocusHandler(); virtual FocusHandler* _getFocusHandler();
/** /**
* Adds an ActionListener to the widget. When an action is triggere * Adds an action listener to the widget. When an action event
d * is fired by the widget the action listeners of the widget
* by the widget, the action function in all the widget's * will get notified.
* ActionListeners will be called.
* *
* @param actionListener the ActionListener to add. * @param actionListener The action listener to add.
* @see removeActionListener
* @since 0.1.0
*/ */
virtual void addActionListener(ActionListener* actionListener); void addActionListener(ActionListener* actionListener);
/** /**
* Removes an added ActionListener from the widget. * Removes an added action listener from the widget.
* *
* @param actionListener the ActionListener to remove. * @param actionListener The action listener to remove.
* @see addActionListener
* @since 0.1.0
*/ */
virtual void removeActionListener(ActionListener* actionListener); void removeActionListener(ActionListener* actionListener);
/** /**
* Adds a DeathListener to the widget. When the widget dies * Adds a death listener to the widget. When a death event is
* the death function in all the widget's DeathListeners will be ca * fired by the widget the death listeners of the widget will
lled. * get notified.
* *
* @param actionListener the DeathListener to add. * @param deathListener The death listener to add.
* @see removeDeathListener
* @since 0.1.0
*/ */
virtual void addDeathListener(DeathListener* deathListener); void addDeathListener(DeathListener* deathListener);
/** /**
* Removes an added DeathListener from the widget. * Removes an added death listener from the widget.
* *
* @param deathListener the DeathListener to remove. * @param deathListener The death listener to remove.
* @see addDeathListener
* @since 0.1.0
*/ */
virtual void removeDeathListener(DeathListener* deathListener); void removeDeathListener(DeathListener* deathListener);
/** /**
* Adds a MouseListener to the widget. When a mouse message is * Adds a mouse listener to the widget. When a mouse event is
* recieved, it will be sent to the widget's MouseListeners. * fired by the widget the mouse listeners of the widget will
* get notified.
* *
* @param mouseListener the MouseListener to add. * @param mouseListener The mouse listener to add.
* @see removeMouseListener
* @since 0.1.0
*/ */
virtual void addMouseListener(MouseListener* mouseListener); void addMouseListener(MouseListener* mouseListener);
/** /**
* Removes an added MouseListener from the widget. * Removes an added mouse listener from the widget.
* *
* @param mouseListener the MouseListener to remove. * @param mouseListener The mouse listener to remove.
* @see addMouseListener
* @since 0.1.0
*/ */
virtual void removeMouseListener(MouseListener* mouseListener); void removeMouseListener(MouseListener* mouseListener);
/** /**
* Adds a KeyListener to the widget. When a key message is recieved * Adds a key listener to the widget. When a key event is
, * fired by the widget the key listeners of the widget will
* it will be sent to the widget's KeyListeners. * get notified.
* *
* @param keyListener the KeyListener to add. * @param keyListener The key listener to add.
* @see removeKeyListener
* @since 0.1.0
*/ */
virtual void addKeyListener(KeyListener* keyListener); void addKeyListener(KeyListener* keyListener);
/** /**
* Removes an added KeyListener from the widget. * Removes an added key listener from the widget.
* *
* @param keyListener the KeyListener to remove. * @param keyListener The key listener to remove.
* @see addKeyListener
* @since 0.1.0
*/ */
virtual void removeKeyListener(KeyListener* keyListener); void removeKeyListener(KeyListener* keyListener);
/** /**
* Adds a FocusListener to the widget. When a focus event is reciev * Adds a focus listener to the widget. When a focus event is
ed, * fired by the widget the key listeners of the widget will
* it will be sent to the widget's FocusListeners. * get notified.
* *
* @param focusListener the FocusListener to add. * @param focusListener The focus listener to add.
* @author Olof Naess * @see removeFocusListener
* @since 0.7.0 * @since 0.7.0
*/ */
virtual void addFocusListener(FocusListener* focusListener); void addFocusListener(FocusListener* focusListener);
/** /**
* Removes an added FocusListener from the widget. * Removes an added focus listener from the widget.
* *
* @param focusListener the FocusListener to remove. * @param focusListener The focus listener to remove.
* @author Olof Naess * @see addFocusListener
* @since 0.7.0 * @since 0.7.0
*/ */
virtual void removeFocusListener(FocusListener* FocusListener); 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 i s * Sets the action event identifier of the widget. The identifier i s
* used to be able to identify which action has occured. * used to be able to identify which action has occured.
* *
* NOTE: An action event identifier should not be used to identify a * NOTE: An action event identifier should not be used to identify a
* certain widget but rather a certain event in your applicat ion. * certain widget but rather a certain event in your applicat ion.
* Several widgets can have the same action event identifer. * Several widgets can have the same action event identifer.
* *
* @param actionEventId the action event identifier. * @param actionEventId The action event identifier.
* @see getActionEventId
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void setActionEventId(const std::string& actionEventId); void setActionEventId(const std::string& actionEventId);
/** /**
* Gets the action event identifier. * Gets the action event identifier of the widget.
* *
* @return the action event identifier. * @return The action event identifier of the widget.
* @see setActionEventId
* @since 0.6.0
*/ */
virtual const std::string& getActionEventId() const; const std::string& getActionEventId() const;
/** /**
* Gets the absolute position on the screen for the widget. * Gets the absolute position on the screen for the widget.
* *
* @param x absolute x coordinate will be stored in this parameter. * @param x The absolute x coordinate will be stored in this parame
* @param y absolute y coordinate will be stored in this parameter. ter.
* @param y The absolute y coordinate will be stored in this parame
ter.
* @since 0.1.0
*/ */
virtual void getAbsolutePosition(int& x, int& y) const; virtual void getAbsolutePosition(int& x, int& y) const;
/** /**
* Sets the parent of the widget. A parent must be a BasicContainer . * Sets the parent of the widget. A parent must be a BasicContainer .
* *
* WARNING: This function is used internally and should not * WARNING: This function is used internally and should not
* be called or overloaded unless you know what you * be called or overloaded unless you know what you
* are doing. * are doing.
* *
* @param parent the parent BasicContainer.. * @param parent The parent of the widget.
* @see getParent
* @since 0.1.0
*/ */
virtual void _setParent(Widget* parent); virtual void _setParent(Widget* parent);
/** /**
* Gets the font used. If no font has been set, the global font wil * Gets the font set for the widget. If no font has been set,
l * the global font will be returned. If no global font has been set
* be returned instead. If no global font has been set, the default ,
* font will be returend. * the default font will be returend.
* ugly default.
* *
* @return the used Font. * @return The font set for the widget.
* @see setFont, setGlobalFont
* @since 0.1.0
*/ */
Font *getFont() const; Font *getFont() const;
/** /**
* Sets the global font to be used by default for all widgets. * Sets the global font to be used by default for all widgets.
* *
* @param font the global Font. * @param font The global font.
* @see getGlobalFont
* @since 0.1.0
*/ */
static void setGlobalFont(Font* font); static void setGlobalFont(Font* font);
/** /**
* Sets the font. If font is NULL, the global font will be used. * Sets the font for the widget. If NULL is passed, the global font
* will be used.
* *
* @param font the Font. * @param font The font to set for the widget.
* @see getFont
* @since 0.1.0
*/ */
virtual void setFont(Font* font); void setFont(Font* font);
/** /**
* Called when the font has changed. If the change is global, * Called when the font has changed. If the change is global,
* this function will only be called if the widget don't have a * this function will only be called if the widget doesn't have a
* font already set. * font already set.
*
* @since 0.1.0
*/ */
virtual void fontChanged() { } virtual void fontChanged() { }
/** /**
* Checks whether a widget exists or not, that is if it still exist s * Checks if a widget exists or not, that is if it still exists
* an instance of the object. * an instance of the object.
* *
* @param widget the widget to check. * @param widget The widget to check.
* @return True if an instance of the widget exists, false otherwis
e.
* @since 0.1.0
*/ */
static bool widgetExists(const Widget* widget); static bool widgetExists(const Widget* widget);
/** /**
* Check if tab in is enabled. Tab in means that you can set focus * 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 * to this widget by pressing the tab button. If tab in is disabled
* then the FocusHandler will skip this widget and focus the next * then the focus handler will skip this widget and focus the next
* in its focus order. * in its focus order.
* *
* @return true if tab in is enabled. * @return True if tab in is enabled, false otherwise.
* @see setTabInEnabled
* @since 0.1.0
*/ */
virtual bool isTabInEnabled() const; bool isTabInEnabled() const;
/** /**
* Sets tab in enabled. Tab in means that you can set focus * 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 * to this widget by pressing the tab button. If tab in is disabled
* then the FocusHandler will skip this widget and focus the next * then the FocusHandler will skip this widget and focus the next
* in its focus order. * in its focus order.
* *
* @param enabled true if tab in should be enabled. * @param enabled True if tab in should be enabled, false otherwise
.
* @see isTabInEnabled
* @since 0.1.0
*/ */
virtual void setTabInEnabled(bool enabled); void setTabInEnabled(bool enabled);
/** /**
* Checks if tab out is enabled. Tab out means that you can lose * 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 * focus to this widget by pressing the tab button. If tab out is
* disabled then the FocusHandler ignores tabbing and focus will * disabled then the FocusHandler ignores tabbing and focus will
* stay with this widget. * stay with this widget.
* *
* @return true if tab out is enabled. * @return True if tab out is enabled, false otherwise.
* @see setTabOutEnabled
* @since 0.1.0
*/ */
virtual bool isTabOutEnabled() const; bool isTabOutEnabled() const;
/** /**
* Sets tab out enabled. Tab out means that you can lose * Sets tab out enabled. Tab out means that you can lose
* focus to this widget by pressing the tab button. If tab out is * focus to this widget by pressing the tab button. If tab out is
* disabled then the FocusHandler ignores tabbing and focus will * disabled then the FocusHandler ignores tabbing and focus will
* stay with this widget. * stay with this widget.
* *
* @param enabled true if tab out should be enabled. * @param enabled True if tab out should be enabled, false otherwis
e.
* @see isTabOutEnabled
* @since 0.1.0
*/ */
virtual void setTabOutEnabled(bool enabled); void setTabOutEnabled(bool enabled);
/** /**
* Requests modal focus. When a widget has modal focus, only that * Requests modal focus. When a widget has modal focus, only that
* widget and it's children may recieve input. * widget and it's children may recieve input.
* *
* @throws Exception if another widget already has modal focus. * @throws Exception if another widget already has modal focus.
* @see releaseModalFocus, isModalFocused
* @since 0.4.0
*/ */
virtual void requestModalFocus(); virtual void requestModalFocus();
/** /**
* Requests modal mouse input focus. When a widget has modal input focus * 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 * 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. * occurs outside of the widget and no matter what the input is.
* *
* @throws Exception if another widget already has modal focus. * @throws Exception if another widget already has modal focus.
* @see releaseModalMouseInputFocus, isModalMouseInputFocused
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void requestModalMouseInputFocus(); virtual void requestModalMouseInputFocus();
/** /**
* Releases modal focus. Modal focus will only be released if the * Releases modal focus. Modal focus will only be released if the
* widget has modal focus. * widget has modal focus.
*
* @see requestModalFocus, isModalFocused
* @since 0.4.0
*/ */
virtual void releaseModalFocus(); virtual void releaseModalFocus();
/** /**
* Releases modal mouse input focus. Modal mouse input focus will o nly * Releases modal mouse input focus. Modal mouse input focus will o nly
* be released if the widget has modal mouse input focus. * be released if the widget has modal mouse input focus.
* *
* @see requestModalMouseInputFocus, isModalMouseInputFocused
* @since 0.6.0 * @since 0.6.0
*/ */
virtual void releaseModalMouseInputFocus(); virtual void releaseModalMouseInputFocus();
/** /**
* Checks if the widget or it's parent has modal focus. * 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 hasModalFocus() const; virtual bool isModalFocused() const;
/** /**
* Checks if the widget or it's parent has modal mouse input focus. * Checks if the widget or it's parent has modal mouse input focus.
* *
* @since 0.6.0 * @return True if the widget has modal mouse input focus, false
* otherwise.
* @see requestModalMouseInputFocus, releaseModalMouseInputFocus
* @since 0.8.0
*/ */
virtual bool hasModalMouseInputFocus() const; virtual bool isModalMouseInputFocused() const;
/** /**
* Gets a widget from a certain position in the widget. * Gets a widget from a certain position in the widget.
* This function is used to decide which gets mouse input, * This function is used to decide which gets mouse input,
* thus it can be overloaded to change that behaviour. * thus it can be overloaded to change that behaviour.
* *
* NOTE: This always returns NULL if the widget is not * NOTE: This always returns NULL if the widget is not
* a container. * a container.
* *
* @param x the x coordinate. * @param x The x coordinate of the widget to get.
* @param y the y coordinate. * @param y The y coordinate of the widget to get.
* @return the widget at the specified coodinate, or NULL * @return The widget at the specified coodinate, NULL
* if no such widget exists. * if no widget is found.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual Widget *getWidgetAt(int x, int y); virtual Widget *getWidgetAt(int x, int y);
/** /**
* Gets the mouse listeners of the widget. * Gets the mouse listeners of the widget.
* *
* @return the mouse listeners of the widget. * @return The mouse listeners of the widget.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual const std::list<MouseListener*>& _getMouseListeners(); virtual const std::list<MouseListener*>& _getMouseListeners();
/** /**
* Gets the key listeners of the widget. * Gets the key listeners of the widget.
* *
* @return the key listeners of the widget. * @return The key listeners of the widget.
* @since 0.6.0 * @since 0.6.0
*/ */
virtual const std::list<KeyListener*>& _getKeyListeners(); virtual const std::list<KeyListener*>& _getKeyListeners();
/** /**
* Gets the focus listeners of the widget. * Gets the focus listeners of the widget.
* *
* @return the focus listeners of the widget. * @return The focus listeners of the widget.
* @since 0.7.0 * @since 0.7.0
*/ */
virtual const std::list<FocusListener*>& _getFocusListeners(); virtual const std::list<FocusListener*>& _getFocusListeners();
/** /**
* Gets the subarea of the widget that the children occupy. * Gets the area of the widget that the widget's children occupy.
* *
* @return the subarea as a Rectangle. * @return The area of the widget that the widget's children occupy
.
* @since 0.1.0
*/ */
virtual Rectangle getChildrenArea(); virtual Rectangle getChildrenArea();
/** /**
* Gets the internal FocusHandler used. * Gets the internal focus handler used.
* *
* @return the internalFocusHandler used. If no internal FocusHandl er * @return the internalFocusHandler used. If no internal focus hand ler
* is used, NULL will be returned. * is used, NULL will be returned.
* @see setInternalFocusHandler
* @since 0.1.0
*/ */
virtual FocusHandler* _getInternalFocusHandler(); virtual FocusHandler* _getInternalFocusHandler();
/** /**
* Sets the internal FocusHandler. An internal focushandler is * Sets the internal focus handler. An internal focus handler is
* needed if both a widget in the widget and the widget itself * needed if both a widget in the widget and the widget itself
* should be foucsed at the same time. * should be foucsed at the same time.
* *
* @param focusHandler the FocusHandler to be used. * @param focusHandler The internal focus handler to be used.
* @see getInternalFocusHandler
* @since 0.1.0
*/ */
virtual void setInternalFocusHandler(FocusHandler* focusHandler); void setInternalFocusHandler(FocusHandler* internalFocusHandler);
/** /**
* Moves a widget to the top of this widget. The moved widget will be * Moves a widget to the top of this widget. The moved widget will be
* drawn above all other widgets in this widget. * drawn above all other widgets in this widget.
* *
* @param widget the widget to move. * @param widget The widget to move to the top.
* @see moveToBottom
* @since 0.1.0
*/ */
virtual void moveToTop(Widget* widget) { }; virtual void moveToTop(Widget* widget) { };
/** /**
* Moves a widget in this widget to the bottom of this widget. * Moves a widget in this widget to the bottom of this widget.
* The moved widget will be drawn below all other widgets in this w idget. * The moved widget will be drawn below all other widgets in this w idget.
* *
* @param widget the widget to move. * @param widget The widget to move to the bottom.
* @see moveToTop
* @since 0.1.0
*/ */
virtual void moveToBottom(Widget* widget) { }; virtual void moveToBottom(Widget* widget) { };
/** /**
* Focuses the next widget in the widget. * Focuses the next widget in the widget.
*
* @see moveToBottom
* @since 0.1.0
*/ */
virtual void focusNext() { }; virtual void focusNext() { };
/** /**
* Focuses the previous widget in the widget. * Focuses the previous widget in the widget.
*
* @see moveToBottom
* @since 0.1.0
*/ */
virtual void focusPrevious() { }; virtual void focusPrevious() { };
/** /**
* Tries to show a specific part of a widget by moving it. Used if the * Tries to show a specific part of a widget by moving it. Used if the
* widget should act as a container. * widget should act as a container.
* *
* @param widget the target widget. * @param widget The target widget.
* @param area the area to show. * @param area The area to show.
* @since 0.1.0
*/ */
virtual void showWidgetPart(Widget* widget, Rectangle area) { }; virtual void showWidgetPart(Widget* widget, Rectangle area) { };
/**
* 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 b
y an
* XML document, a certain widget can be retrieved given that the w
idget
* 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 t
o be
* identified in a container. For example, if widgets are created b
y an
* XML document, a certain widget can be retrieved given that the w
idget
* has an id.
*
* @param id The id to set to the widget.
* @see setId, BasicContainer::findWidgetById
* @since 0.8.0
*/
const std::string& getId();
/**
* 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: protected:
/** /**
* Generates an action to the widget's ActionListeners. * Distributes an action event to all action listeners
* of the widget.
*
* @since 0.8.0
*/ */
void generateAction(); 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
*/
void distributeHiddenEvent();
/**
* Distributes shown events to all of the widget's listeners.
*
* @since 0.8.0
* @author Olof Naess
*/
void distributeShownEvent();
/**
* Typdef.
*/
typedef std::list<MouseListener*> MouseListenerList; typedef std::list<MouseListener*> MouseListenerList;
/**
* Typdef.
*/
typedef MouseListenerList::iterator MouseListenerIterator; typedef MouseListenerList::iterator MouseListenerIterator;
/**
* Holds the mouse listeners of the widget.
*/
MouseListenerList mMouseListeners; MouseListenerList mMouseListeners;
/**
* Typdef.
*/
typedef std::list<KeyListener*> KeyListenerList; typedef std::list<KeyListener*> KeyListenerList;
/**
* Holds the key listeners of the widget.
*/
KeyListenerList mKeyListeners; KeyListenerList mKeyListeners;
/**
* Typdef.
*/
typedef KeyListenerList::iterator KeyListenerIterator; typedef KeyListenerList::iterator KeyListenerIterator;
/**
* Typdef.
*/
typedef std::list<ActionListener*> ActionListenerList; typedef std::list<ActionListener*> ActionListenerList;
/**
* Holds the action listeners of the widget.
*/
ActionListenerList mActionListeners; ActionListenerList mActionListeners;
/**
* Typdef.
*/
typedef ActionListenerList::iterator ActionListenerIterator; typedef ActionListenerList::iterator ActionListenerIterator;
/**
* Typdef.
*/
typedef std::list<DeathListener*> DeathListenerList; typedef std::list<DeathListener*> DeathListenerList;
/**
* Holds the death listeners of the widget.
*/
DeathListenerList mDeathListeners; DeathListenerList mDeathListeners;
/**
* Typdef.
*/
typedef DeathListenerList::iterator DeathListenerIterator; typedef DeathListenerList::iterator DeathListenerIterator;
/**
* Typdef.
*/
typedef std::list<FocusListener*> FocusListenerList; typedef std::list<FocusListener*> FocusListenerList;
/**
* Holds the focus listeners of the widget.
*/
FocusListenerList mFocusListeners; FocusListenerList mFocusListeners;
/**
* Typdef.
*/
typedef FocusListenerList::iterator FocusListenerIterator; typedef FocusListenerList::iterator FocusListenerIterator;
typedef std::list<WidgetListener*> WidgetListenerList;
/**
* Holds the widget listeners of the widget.
*/
WidgetListenerList mWidgetListeners;
/**
* Typdef.
*/
typedef WidgetListenerList::iterator WidgetListenerIterator;
/**
* Holds the foreground color of the widget.
*/
Color mForegroundColor; Color mForegroundColor;
/**
* Holds the background color of the widget.
*/
Color mBackgroundColor; Color mBackgroundColor;
/**
* Holds the base color of the widget.
*/
Color mBaseColor; Color mBaseColor;
/**
* Holds the selection color of the widget.
*/
Color mSelectionColor; Color mSelectionColor;
/**
* Holds the focus handler used by the widget.
*/
FocusHandler* mFocusHandler; FocusHandler* mFocusHandler;
/**
* Holds the focus handler used by the widget. NULL
* if no internal focus handler is used.
*/
FocusHandler* mInternalFocusHandler; FocusHandler* mInternalFocusHandler;
/**
* Holds the parent of the widget. NULL if the widget
* has no parent.
*/
Widget* mParent; Widget* mParent;
/**
* Holds the dimension of the widget.
*/
Rectangle mDimension; Rectangle mDimension;
unsigned int mBorderSize;
/**
* Holds the frame size of the widget.
*/
unsigned int mFrameSize;
/**
* Holds the action event of the widget.
*/
std::string mActionEventId; std::string mActionEventId;
/**
* True if the widget focusable, false otherwise.
*/
bool mFocusable; bool mFocusable;
/**
* True if the widget visible, false otherwise.
*/
bool mVisible; bool mVisible;
/**
* True if the widget has tab in enabled, false otherwise.
*/
bool mTabIn; bool mTabIn;
/**
* True if the widget has tab in enabled, false otherwise.
*/
bool mTabOut; bool mTabOut;
/**
* True if the widget is enabled, false otherwise.
*/
bool mEnabled; bool mEnabled;
/**
* Holds the id of the widget.
*/
std::string mId;
/**
* Holds the font used by the widget.
*/
Font* mCurrentFont; Font* mCurrentFont;
/**
* Holds the default font used by the widget.
*/
static DefaultFont mDefaultFont; static DefaultFont mDefaultFont;
/**
* Holds the global font used by the widget.
*/
static Font* mGlobalFont; static Font* mGlobalFont;
/**
* Holds a list of all instances of widgets.
*/
static std::list<Widget*> mWidgets; static std::list<Widget*> mWidgets;
}; };
} }
#endif // end GCN_WIDGET_HPP #endif // end GCN_WIDGET_HPP
/*
* yakslem - "I have a really great idea! Why not have an
* interesting and funny quote or story at the
* end of every source file."
* finalman - "Yeah - good idea! .... do you know any funny
* quotes?"
* yakslem - "Well.. I guess not. I just thought it would be
* fun to tell funny quotes."
* finalman - "That's not a very funny quote. But i believe
* pointless quotes are funny in their own pointless
* way."
* yakslem - "...eh...ok..."
*/
 End of changes. 216 change blocks. 
264 lines changed or deleted 681 lines changed or added


 window.hpp   window.hpp 
/* _______ __ __ __ ______ __ __ _______ __ __ /* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
* *
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naess * Copyright (c) 2004 - 2008 Olof Naess
* *
* Js_./ *
* Per Larsson a.k.a finalman _RqZ{a<^_aa * Per Larsson a.k.a finalman
* Olof Naess * Olof Naess
* _Qhm`] _f "'c 1!5m *
* Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ * Visit: http://guichan.sourceforge.net
* .)j(] .d_/ '-( P . S *
* License: (BSD) <Td/Z <fP"5(\"??"\a. .L * License: (BSD)
* Redistribution and use in source and _dV>ws?a-?' ._/L #' * Redistribution and use in source and binary forms, with or without
* binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided that the following conditions
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * are met:
* that the following conditions are met: j<<WP+k/);. _W=j f * 1. Redistributions of source code must retain the above copyright
* 1. Redistributions of source code must .$%w\/]Q . ."' . mj$ * notice, this list of conditions and the following disclaimer.
* retain the above copyright notice, ]E.pYY(Q]>. a J@\ * 2. Redistributions in binary form must reproduce the above copyright
* this list of conditions and the j(]1u<sE"L,. . ./^ ]{a * notice, this list of conditions and the following disclaimer in
* following disclaimer. 4'_uomm\. )L);-4 (3= * the documentation and/or other materials provided with the
* 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[ * distribution.
* reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m * 3. Neither the name of Guichan nor the names of its contributors may
* this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/ * be used to endorse or promote products derived from this software
* following disclaimer in the <B!</]C)d_, '(<' .f. =C+m * without specific prior written permission.
* documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]' *
* provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* 3. Neither the name of Guichan nor the :$we` _! + _/ . j? * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* names of its contributors may be used =3)= _f (_yQmWW$#( " * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* to endorse or promote products derived - W, sQQQQmZQ#Wwa].. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* from this software without specific (js, \[QQW$QWW#?!V"". * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* prior written permission. ]y:.<\.. . * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* -]n w/ ' [. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ ! * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , ' * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- % * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
* 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_WINDOW_HPP #ifndef GCN_WINDOW_HPP
#define GCN_WINDOW_HPP #define GCN_WINDOW_HPP
#include <string> #include <string>
#include "guichan/mouselistener.hpp" #include "guichan/mouselistener.hpp"
#include "guichan/platform.hpp" #include "guichan/platform.hpp"
#include "guichan/widgets/container.hpp" #include "guichan/widgets/container.hpp"
namespace gcn namespace gcn
{ {
/** /**
* A movable window which can contain another Widgets. * An implementation of a movable window that can contain other widgets .
*/ */
class GCN_CORE_DECLSPEC Window : public Container, class GCN_CORE_DECLSPEC Window : public Container,
public MouseListener public MouseListener
{ {
public: public:
/** /**
* Constructor. * Constructor.
*/ */
Window(); Window();
/** /**
* Constructor. * Constructor. The window will be automatically resized in height
* to fit the caption.
* *
* @param caption the Window caption. * @param caption the caption of the window.
*/ */
Window(const std::string& caption); Window(const std::string& caption);
/** /**
* Destructor. * Destructor.
*/ */
virtual ~Window(); virtual ~Window();
/** /**
* Sets the Window caption. * Sets the caption of the window.
* *
* @param caption the Window caption. * @param caption The caption of the window.
* @see getCaption
*/ */
virtual void setCaption(const std::string& caption); void setCaption(const std::string& caption);
/** /**
* Gets the Window caption. * Gets the caption of the window.
* *
* @return the Window caption. * @return the caption of the window.
* @see setCaption
*/ */
virtual const std::string& getCaption() const; const std::string& getCaption() const;
/** /**
* Sets the alignment for the caption. * Sets the alignment of the caption.
* *
* @param alignment Graphics::LEFT, Graphics::CENTER or Graphics::R * @param alignment The alignment of the caption.
IGHT. * @see getAlignment, Graphics
*/ */
virtual void setAlignment(unsigned int alignment); void setAlignment(Graphics::Alignment alignment);
/** /**
* Gets the alignment for the caption. * Gets the alignment of the caption.
* *
* @return alignment of caption. * @return The alignment of caption.
* @see setAlignment, Graphics
*/ */
virtual unsigned int getAlignment() const; Graphics::Alignment getAlignment() const;
/** /**
* Sets the padding of the window which is the distance between the * Sets the padding of the window. The padding is the distance betw een the
* window border and the content. * window border and the content.
* *
* @param padding the padding value. * @param padding The padding of the window.
* @see getPadding
*/ */
virtual void setPadding(unsigned int padding); void setPadding(unsigned int padding);
/** /**
* Gets the padding. * Gets the padding of the window. The padding is the distance betw
een the
* window border and the content.
* *
* @return the padding value. * @return The padding of the window.
* @see setPadding
*/ */
virtual unsigned int getPadding() const; unsigned int getPadding() const;
/** /**
* Sets the title bar height. * Sets the title bar height.
* *
* @param height the title height value. * @param height The title height value.
* @see getTitleBarHeight
*/ */
virtual void setTitleBarHeight(unsigned int height); void setTitleBarHeight(unsigned int height);
/** /**
* Gets the title bar height. * Gets the title bar height.
* *
* @return the title bar height. * @return The title bar height.
* @see setTitleBarHeight
*/ */
virtual unsigned int getTitleBarHeight(); unsigned int getTitleBarHeight();
/** /**
* Sets the Window to be moveble. * Sets the window to be moveble or not.
* *
* @param movable true or false. * @param movable True if the window should be movable, false other
wise.
* @see isMovable
*/ */
virtual void setMovable(bool movable); void setMovable(bool movable);
/** /**
* Check if the window is movable. * Checks if the window is movable.
* *
* @return true or false. * @return True if the window is movable, false otherwise.
* @see setMovable
*/ */
virtual bool isMovable() const; bool isMovable() const;
/** /**
* Sets the Window to be opaque. If it's not opaque, the content ar * Sets the window to be opaque or not. An opaque window will draw
ea it's background
* will not be filled with a color. * and it's content. A non opaque window will only draw it's conten
t.
* *
* @param opaque true or false. * @param opaque True if the window should be opaque, false otherwi
se.
* @see isOpaque
*/ */
virtual void setOpaque(bool opaque); void setOpaque(bool opaque);
/** /**
* Checks if the Window is opaque. * Checks if the window is opaque.
* *
* @return true or false. * @return True if the window is opaque, false otherwise.
* @see setOpaque
*/ */
virtual bool isOpaque(); bool isOpaque();
/** /**
* Resizes the container to fit the content exactly. * Resizes the window to fit the content.
*/ */
virtual void resizeToContent(); virtual void resizeToContent();
// Inherited from BasicContainer // Inherited from BasicContainer
virtual Rectangle getChildrenArea(); virtual Rectangle getChildrenArea();
// Inherited from Widget // Inherited from Widget
virtual void draw(Graphics* graphics); virtual void draw(Graphics* graphics);
virtual void drawBorder(Graphics* graphics);
// Inherited from MouseListener // Inherited from MouseListener
virtual void mousePressed(MouseEvent& mouseEvent); virtual void mousePressed(MouseEvent& mouseEvent);
virtual void mouseDragged(MouseEvent& mouseEvent); virtual void mouseDragged(MouseEvent& mouseEvent);
virtual void mouseReleased(MouseEvent& mouseEvent);
protected: protected:
/**
* Holds the caption of the window.
*/
std::string mCaption; std::string mCaption;
unsigned int mAlignment;
/**
* Holds the alignment of the caption.
*/
Graphics::Alignment mAlignment;
/**
* Holds the padding of the window.
*/
unsigned int mPadding; unsigned int mPadding;
/**
* Holds the title bar height of the window.
*/
unsigned int mTitleBarHeight; unsigned int mTitleBarHeight;
/**
* True if the window is movable, false otherwise.
*/
bool mMovable; bool mMovable;
/**
* True if the window is opaque, false otherwise.
*/
bool mOpaque; bool mOpaque;
/**
* Holds a drag offset as an x coordinate where the drag of the win
dow
* started if the window is being dragged. It's used to move the wi
ndow
* correctly when dragged.
*/
int mDragOffsetX; int mDragOffsetX;
/**
* Holds a drag offset as an y coordinate where the drag of the win
dow
* started if the window is being dragged. It's used to move the wi
ndow
* correctly when dragged.
*/
int mDragOffsetY; int mDragOffsetY;
bool mIsMoving;
/**
* True if the window is being moved, false otherwise.
*/
bool mMoved;
}; };
} }
#endif // end GCN_WINDOW_HPP #endif // end GCN_WINDOW_HPP
 End of changes. 50 change blocks. 
90 lines changed or deleted 137 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/