| basiccontainer.hpp | | basiccontainer.hpp | |
| /* _______ __ __ __ ______ __ __ _______ __ __ | | /* _______ __ __ __ ______ __ __ _______ __ __ | |
| * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | | * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
| * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | | * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
| * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | | * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
| * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | | * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
| * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | | * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
| * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | | * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
| * | | * | |
|
| * Copyright (c) 2004, 2005, 2006 Olof Naess | | * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess | |
| * | | * | |
| * Js_./ | | * Js_./ | |
| * Per Larsson a.k.a finalman _RqZ{a<^_aa | | * Per Larsson a.k.a finalman _RqZ{a<^_aa | |
| * Olof Naess | | * Olof Naess | |
| * _Qhm`] _f "'c 1!5m | | * _Qhm`] _f "'c 1!5m | |
| * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | | * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | |
| * .)j(] .d_/ '-( P . S | | * .)j(] .d_/ '-( P . S | |
| * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | | * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | |
| * Redistribution and use in source and _dV>ws?a-?' ._/L #' | | * Redistribution and use in source and _dV>ws?a-?' ._/L #' | |
| * binary forms, with or without )4d[#7r, . ' )d`)[ | | * binary forms, with or without )4d[#7r, . ' )d`)[ | |
| | | | |
| skipping to change at line 62 | | skipping to change at line 62 | |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
| * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | |
| * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * 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/platform.hpp" | | #include "guichan/platform.hpp" | |
| #include "guichan/widget.hpp" | | #include "guichan/widget.hpp" | |
| | | | |
| namespace gcn | | namespace gcn | |
| { | | { | |
| /** | | /** | |
|
| * Containers base class. Contains basic container functions every | | * Implements basic container behaviour. Most container will suffice by | |
| * container should have. Containers should inherit from this class and | | * inheriting from this class. | |
| * implement it's functions. | | | |
| * | | * | |
| * @see Container | | * @see Container | |
| */ | | */ | |
|
| class GCN_CORE_DECLSPEC BasicContainer : public Widget | | class GCN_CORE_DECLSPEC BasicContainer : public Widget, public DeathLis
tener | |
| { | | { | |
| public: | | public: | |
| /** | | /** | |
|
| * Constructor | | | |
| */ | | | |
| BasicContainer(); | | | |
| | | | |
| /** | | | |
| * Destructor | | * Destructor | |
| */ | | */ | |
| virtual ~BasicContainer(); | | virtual ~BasicContainer(); | |
| | | | |
|
| /** | | // Inherited from Widget | |
| * Moves a Widget to the top of the BasicContainer. The widget will | | | |
| be | | | |
| * drawn above all other Widgets in the BasicContainer. | | | |
| * | | | |
| * @param widget the Widget to move. | | | |
| */ | | | |
| virtual void moveToTop(Widget* widget); | | virtual void moveToTop(Widget* widget); | |
| | | | |
|
| /** | | | |
| * Moves a widget to the bottom of the BasicContainer. The Widget w | | | |
| ill | | | |
| * be drawn below all other Widgets in the BasicContainer. | | | |
| * | | | |
| * @param widget the Widget to move. | | | |
| */ | | | |
| virtual void moveToBottom(Widget* widget); | | virtual void moveToBottom(Widget* widget); | |
| | | | |
|
| /** | | | |
| * Called when a child of the BasicContainer gets destroyed. | | | |
| * | | | |
| * @param widget the destroyed Widget. | | | |
| */ | | | |
| virtual void _announceDeath(Widget *widget); | | | |
| | | | |
| /** | | | |
| * Gets the subarea of the BasicContainer that the children | | | |
| * occupy. | | | |
| * | | | |
| * @return the subarea as a Rectangle. | | | |
| */ | | | |
| virtual Rectangle getChildrenArea(); | | virtual Rectangle getChildrenArea(); | |
| | | | |
|
| /** | | | |
| * Focuses the next Widget in the BasicContainer. | | | |
| */ | | | |
| virtual void focusNext(); | | virtual void focusNext(); | |
| | | | |
|
| /** | | | |
| * Focuses the previous Widge in the BasicContainer. | | | |
| */ | | | |
| virtual void focusPrevious(); | | virtual void focusPrevious(); | |
| | | | |
|
| /** | | | |
| * Gets a widget from a certain position in the container. | | | |
| * This function is used to decide which gets mouse input, | | | |
| * thus it can be overloaded to change that behaviour. | | | |
| * | | | |
| * @param x the x coordinate. | | | |
| * @param y the y coordinate. | | | |
| * @return the widget at the specified coodinate, or NULL | | | |
| * if no such widget exists. | | | |
| */ | | | |
| virtual Widget *getWidgetAt(int x, int y); | | | |
| | | | |
| /** | | | |
| * Tries to show a specific part of a Widget by moving it. | | | |
| * | | | |
| * @param widget the target Widget. | | | |
| * @param area the area to show. | | | |
| */ | | | |
| virtual void showWidgetPart(Widget* widget, Rectangle area); | | | |
| | | | |
| // Inherited from Widget | | | |
| | | | |
| virtual void logic(); | | virtual void logic(); | |
| | | | |
| virtual void _setFocusHandler(FocusHandler* focusHandler); | | virtual void _setFocusHandler(FocusHandler* focusHandler); | |
| | | | |
|
| virtual void _mouseInputMessage(const MouseInput& mouseInput); | | virtual void setInternalFocusHandler(FocusHandler* focusHandler); | |
| | | | |
|
| virtual void _mouseOutMessage(); | | virtual void showWidgetPart(Widget* widget, Rectangle area); | |
| | | | |
|
| virtual void _keyInputMessage(const KeyInput& keyInput); | | virtual Widget *getWidgetAt(int x, int y); | |
| | | | |
|
| enum | | // Inherited from DeathListener | |
| { | | | |
| NEVER, | | virtual void death(const Event& event); | |
| ALWAYS, | | | |
| NOT_ON_CHILD, | | | |
| NOT_IN_CHILDREN_AREA | | | |
| }; | | | |
| | | | |
| protected: | | protected: | |
| /** | | /** | |
|
| * Adds a widget. | | * Adds a widget to the basic container. | |
| * | | * | |
|
| * @param widget the Widget to add. | | * @param widget the widget to add. | |
| */ | | */ | |
| virtual void add(Widget* widget); | | virtual void add(Widget* widget); | |
| | | | |
| /** | | /** | |
|
| * Removes a widget. | | * Removes a widget from the basic container. | |
| * | | * | |
|
| * @param widget the Widget to remove. | | * @param widget the widget to remove. | |
| */ | | */ | |
| virtual void remove(Widget* widget); | | virtual void remove(Widget* widget); | |
| | | | |
| /** | | /** | |
|
| * Clears the BasicContainer of widgets. | | * Clears the basic container from all widgets. | |
| */ | | */ | |
| virtual void clear(); | | virtual void clear(); | |
| | | | |
| /** | | /** | |
| * Draws children widgets. | | * Draws children widgets. | |
| * | | * | |
| * @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 children widgets. | |
| */ | | */ | |
| virtual void logicChildren(); | | virtual void logicChildren(); | |
| | | | |
|
| /** | | | |
| * Sets the mouse input policy. | | | |
| * | | | |
| * @param policy the mouse input policy. See enum. | | | |
| */ | | | |
| virtual void setMouseInputPolicy(unsigned int policy); | | | |
| | | | |
| /** | | | |
| * Gets the mouse input policy. | | | |
| * | | | |
| * @return the mouse input policy. See enum. | | | |
| */ | | | |
| virtual unsigned int getMouseInputPolicy(); | | | |
| | | | |
| /** | | | |
| * Gets the internal FocusHandler used. | | | |
| * | | | |
| * @return the internalFocusHandler used. If no internal FocusHandl | | | |
| er | | | |
| * is used, NULL will be returned. | | | |
| */ | | | |
| virtual FocusHandler* getInternalFocusHandler(); | | | |
| | | | |
| /** | | | |
| * Sets the internal FocusHandler. An internal focushandler is | | | |
| * needed if both a widget in the container and the container | | | |
| * should be foucsed at once. | | | |
| * | | | |
| * @param focusHandler the FocusHandler to be used. | | | |
| */ | | | |
| virtual void setInternalFocusHandler(FocusHandler* focusHandler); | | | |
| | | | |
| typedef std::list<Widget *> WidgetList; | | typedef std::list<Widget *> WidgetList; | |
| typedef WidgetList::iterator WidgetListIterator; | | typedef WidgetList::iterator WidgetListIterator; | |
| typedef WidgetList::reverse_iterator WidgetListReverseIterator; | | typedef WidgetList::reverse_iterator WidgetListReverseIterator; | |
| | | | |
| WidgetList mWidgets; | | WidgetList mWidgets; | |
|
| Widget *mWidgetWithMouse; | | | |
| unsigned int mMouseInputPolicy; | | | |
| FocusHandler* mInternalFocusHandler; | | | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif // end GCN_BASICCONTAINER_HPP | | #endif // end GCN_BASICCONTAINER_HPP | |
| | | | |
End of changes. 22 change blocks. |
| 115 lines changed or deleted | | 18 lines changed or added | |
|
| button.hpp | | button.hpp | |
| /* _______ __ __ __ ______ __ __ _______ __ __ | | /* _______ __ __ __ ______ __ __ _______ __ __ | |
| * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | | * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
| * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | | * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
| * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | | * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
| * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | | * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
| * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | | * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
| * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | | * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
| * | | * | |
|
| * Copyright (c) 2004, 2005, 2006 Olof Naess | | * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess | |
| * | | * | |
| * Js_./ | | * Js_./ | |
| * Per Larsson a.k.a finalman _RqZ{a<^_aa | | * Per Larsson a.k.a finalman _RqZ{a<^_aa | |
| * Olof Naess | | * Olof Naess | |
| * _Qhm`] _f "'c 1!5m | | * _Qhm`] _f "'c 1!5m | |
| * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | | * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | |
| * .)j(] .d_/ '-( P . S | | * .)j(] .d_/ '-( P . S | |
| * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | | * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | |
| * Redistribution and use in source and _dV>ws?a-?' ._/L #' | | * Redistribution and use in source and _dV>ws?a-?' ._/L #' | |
| * binary forms, with or without )4d[#7r, . ' )d`)[ | | * binary forms, with or without )4d[#7r, . ' )d`)[ | |
| | | | |
| skipping to change at line 63 | | skipping to change at line 63 | |
| * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | |
| * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * 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/keylistener.hpp" | | #include "guichan/keylistener.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 | | * A regular button. Add an ActionListener to it to know when it | |
| * has been clicked. | | * has been clicked. | |
| * | | * | |
| | | | |
| skipping to change at line 141 | | skipping to change at line 142 | |
| * @return true if the button is pressed down. | | * @return true if the button is pressed down. | |
| */ | | */ | |
| virtual bool isPressed() const; | | virtual bool isPressed() const; | |
| | | | |
| //Inherited from Widget | | //Inherited from Widget | |
| | | | |
| virtual void draw(Graphics* graphics); | | virtual void draw(Graphics* graphics); | |
| | | | |
| virtual void drawBorder(Graphics* graphics); | | virtual void drawBorder(Graphics* graphics); | |
| | | | |
|
| virtual void lostFocus(); | | virtual void focusLost(); | |
| | | | |
| // Inherited from MouseListener | | // Inherited from MouseListener | |
| | | | |
|
| virtual void mouseClick(int x, int y, int button, int count); | | virtual void mousePressed(MouseEvent& mouseEvent); | |
| | | | |
|
| virtual void mousePress(int x, int y, int button); | | virtual void mouseReleased(MouseEvent& mouseEvent); | |
| | | | |
|
| virtual void mouseRelease(int x, int y, int button); | | virtual void mouseEntered(MouseEvent& mouseEvent); | |
| | | | |
| | | virtual void mouseExited(MouseEvent& mouseEvent); | |
| | | | |
| | | virtual void mouseDragged(MouseEvent& mouseEvent); | |
| | | | |
| // Inherited from KeyListener | | // Inherited from KeyListener | |
| | | | |
|
| virtual void keyPress(const Key& key); | | virtual void keyPressed(KeyEvent& keyEvent); | |
| | | | |
|
| virtual void keyRelease(const Key& key); | | virtual void keyReleased(KeyEvent& keyEvent); | |
| | | | |
| protected: | | protected: | |
| std::string mCaption; | | std::string mCaption; | |
|
| bool mMouseDown, mKeyDown; | | bool mHasMouse; | |
| | | bool mKeyPressed; | |
| | | bool mMousePressed; | |
| unsigned int mAlignment; | | unsigned int mAlignment; | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif // end GCN_BUTTON_HPP | | #endif // end GCN_BUTTON_HPP | |
| | | | |
End of changes. 9 change blocks. |
| 8 lines changed or deleted | | 15 lines changed or added | |
|
| dropdown.hpp | | dropdown.hpp | |
| /* _______ __ __ __ ______ __ __ _______ __ __ | | /* _______ __ __ __ ______ __ __ _______ __ __ | |
| * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | | * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
| * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | | * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
| * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | | * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
| * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | | * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
| * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | | * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
| * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | | * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
| * | | * | |
|
| * Copyright (c) 2004, 2005, 2006 Olof Naess | | * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess | |
| * | | * | |
| * Js_./ | | * Js_./ | |
| * Per Larsson a.k.a finalman _RqZ{a<^_aa | | * Per Larsson a.k.a finalman _RqZ{a<^_aa | |
| * Olof Naess | | * Olof Naess | |
| * _Qhm`] _f "'c 1!5m | | * _Qhm`] _f "'c 1!5m | |
| * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | | * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | |
| * .)j(] .d_/ '-( P . S | | * .)j(] .d_/ '-( P . S | |
| * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | | * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | |
| * Redistribution and use in source and _dV>ws?a-?' ._/L #' | | * Redistribution and use in source and _dV>ws?a-?' ._/L #' | |
| * binary forms, with or without )4d[#7r, . ' )d`)[ | | * binary forms, with or without )4d[#7r, . ' )d`)[ | |
| | | | |
| skipping to change at line 62 | | skipping to change at line 62 | |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
| * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | |
| * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * 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/focushandler.hpp" | | #include "guichan/focushandler.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/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
e of | | * A drop down box from which you can select different values. It is on
e of | |
| * the most complicated Widgets you will find in Guichan. For drawing t
he | | * the most complicated Widgets you will find in Guichan. For drawing t
he | |
| * DroppedDown box it uses one ScrollArea and one ListBox. It also uses
an | | * DroppedDown box it uses one ScrollArea and one ListBox. It also uses
an | |
| * internal FocusHandler to handle the focus of the internal ScollArea
and | | * internal FocusHandler to handle the focus of the internal ScollArea
and | |
| * ListBox. DropDown uses a ListModel to handle the list. To be able to
use | | * ListBox. DropDown uses a ListModel to handle the list. To be able to
use | |
| * DropDown you must give DropDown an implemented ListModel which repre
sents | | * DropDown you must give DropDown an implemented ListModel which repre
sents | |
| * your list. | | * your list. | |
| */ | | */ | |
| class GCN_CORE_DECLSPEC DropDown : | | class GCN_CORE_DECLSPEC DropDown : | |
|
| | | public ActionListener, | |
| public BasicContainer, | | public BasicContainer, | |
|
| public MouseListener, | | | |
| public KeyListener, | | public KeyListener, | |
|
| public ActionListener | | public MouseListener | |
| { | | { | |
| 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. | |
| */ | | */ | |
| | | | |
| skipping to change at line 144 | | skipping to change at line 145 | |
| * Adjusts the height of the DropDown fitting it's parents height. | | * Adjusts the height of the DropDown fitting it's parents height. | |
| */ | | */ | |
| virtual void adjustHeight(); | | virtual void adjustHeight(); | |
| | | | |
| // Inherited from Widget | | // Inherited from Widget | |
| | | | |
| virtual void draw(Graphics* graphics); | | virtual void draw(Graphics* graphics); | |
| | | | |
| virtual void drawBorder(Graphics* graphics); | | virtual void drawBorder(Graphics* graphics); | |
| | | | |
|
| virtual void lostFocus(); | | virtual void focusLost(); | |
| | | | |
| virtual void setBaseColor(const Color& color); | | virtual void setBaseColor(const Color& color); | |
| | | | |
| virtual void setBackgroundColor(const Color& color); | | virtual void setBackgroundColor(const Color& color); | |
| | | | |
| virtual void setForegroundColor(const Color& color); | | virtual void setForegroundColor(const Color& color); | |
| | | | |
| virtual void logic(); | | virtual void logic(); | |
| | | | |
| virtual void setFont(Font *font); | | virtual void setFont(Font *font); | |
| | | | |
| // Inherited from BasicContainer | | // Inherited from BasicContainer | |
| | | | |
|
| virtual void _announceDeath(Widget* widget); | | | |
| | | | |
| virtual Rectangle getChildrenArea(); | | virtual Rectangle getChildrenArea(); | |
| | | | |
| // Inherited from ActionListener | | // Inherited from ActionListener | |
| | | | |
|
| virtual void action(const std::string& eventId, Widget* widget); | | virtual void action(const ActionEvent& actionEvent); | |
| | | | |
| | | // Inherited from DeathListener | |
| | | | |
| | | virtual void death(const Event& event); | |
| | | | |
| // Inherited from KeyListener | | // Inherited from KeyListener | |
| | | | |
|
| virtual void keyPress(const Key& key); | | virtual void keyPressed(KeyEvent& keyEvent); | |
| | | | |
| // Inherited from MouseListener | | // Inherited from MouseListener | |
| | | | |
|
| virtual void mousePress(int x, int y, int button); | | virtual void mousePressed(MouseEvent& mouseEvent); | |
| | | | |
|
| virtual void mouseRelease(int x, int y, int button); | | virtual void mouseReleased(MouseEvent& mouseEvent); | |
| | | | |
| | | virtual void mouseWheelMovedUp(MouseEvent& mouseEvent); | |
| | | | |
| | | virtual void mouseWheelMovedDown(MouseEvent& mouseEvent); | |
| | | | |
| | | virtual void mouseDragged(MouseEvent& mouseEvent); | |
| | | | |
| protected: | | protected: | |
| /** | | /** | |
| * Draws the button with the little down arrow. | | * Draws the button with the little down arrow. | |
| * | | * | |
| * @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); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 199 | | skipping to change at line 208 | |
| /** | | /** | |
| * Sets the DropDown Widget to folded-up mode. | | * Sets the DropDown Widget to folded-up mode. | |
| */ | | */ | |
| virtual void foldUp(); | | virtual void foldUp(); | |
| | | | |
| bool mDroppedDown; | | bool mDroppedDown; | |
| bool mPushed; | | bool mPushed; | |
| int mOldH; | | int mOldH; | |
| ScrollArea* mScrollArea; | | ScrollArea* mScrollArea; | |
| ListBox* mListBox; | | ListBox* mListBox; | |
|
| FocusHandler mFocusHandler; | | FocusHandler mInternalFocusHandler; | |
| bool mInternalScrollArea; | | bool mInternalScrollArea; | |
| bool mInternalListBox; | | bool mInternalListBox; | |
|
| | | bool mIsDragged; | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif // end GCN_DROPDOWN_HPP | | #endif // end GCN_DROPDOWN_HPP | |
| | | | |
End of changes. 13 change blocks. |
| 11 lines changed or deleted | | 21 lines changed or added | |
|
| focushandler.hpp | | focushandler.hpp | |
| /* _______ __ __ __ ______ __ __ _______ __ __ | | /* _______ __ __ __ ______ __ __ _______ __ __ | |
| * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | | * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
| * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | | * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
| * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | | * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
| * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | | * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
| * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | | * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
| * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | | * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
| * | | * | |
|
| * Copyright (c) 2004, 2005, 2006 Olof Naess | | * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess | |
| * | | * | |
| * Js_./ | | * Js_./ | |
| * Per Larsson a.k.a finalman _RqZ{a<^_aa | | * Per Larsson a.k.a finalman _RqZ{a<^_aa | |
| * Olof Naess | | * Olof Naess | |
| * _Qhm`] _f "'c 1!5m | | * _Qhm`] _f "'c 1!5m | |
| * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | | * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | |
| * .)j(] .d_/ '-( P . S | | * .)j(] .d_/ '-( P . S | |
| * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | | * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | |
| * Redistribution and use in source and _dV>ws?a-?' ._/L #' | | * Redistribution and use in source and _dV>ws?a-?' ._/L #' | |
| * binary forms, with or without )4d[#7r, . ' )d`)[ | | * binary forms, with or without )4d[#7r, . ' )d`)[ | |
| | | | |
| skipping to change at line 96 | | skipping to change at line 96 | |
| * Constructor. | | * Constructor. | |
| */ | | */ | |
| FocusHandler(); | | FocusHandler(); | |
| | | | |
| /** | | /** | |
| * Destructor. | | * Destructor. | |
| */ | | */ | |
| virtual ~FocusHandler() { }; | | virtual ~FocusHandler() { }; | |
| | | | |
| /** | | /** | |
|
| * Sets focus to a Widget. Widget::lostFocus and | | * Sets focus to a widget. Widget::lostFocus and | |
| * Widget::gotFocus will be called. | | * Widget::gotFocus will be called. | |
| * | | * | |
|
| * @param widget the Widget to focus. | | * @param widget the widget to focus. | |
| */ | | */ | |
| virtual void requestFocus(Widget* widget); | | virtual void requestFocus(Widget* widget); | |
| | | | |
| /** | | /** | |
|
| * Sets drag to a Widget. | | * Sets modal focus to a widget. | |
| * | | | |
| * @param widget the Widget to drag. | | | |
| */ | | | |
| virtual void requestDrag(Widget* widget); | | | |
| | | | |
| /** | | | |
| * Sets modal focus to a Widget. If another Widget already | | | |
| * has modal focus will an exception be thrown. | | | |
| * | | * | |
| * @param widget the Widget to focus modal. | | * @param widget the Widget to focus modal. | |
| * @throws Exception when another widget already has modal focus. | | * @throws Exception when another widget already has modal focus. | |
| */ | | */ | |
| virtual void requestModalFocus(Widget* widget); | | virtual void requestModalFocus(Widget* widget); | |
| | | | |
| /** | | /** | |
|
| * Releases modal focus if the Widget has modal focus. | | * Releases modal focus if the widget has modal focus. | |
| * Otherwise nothing will be done. | | * Otherwise nothing will be done. | |
| * | | * | |
| * @param widget the Widget to release modal focus for. | | * @param widget the Widget to release modal focus for. | |
| */ | | */ | |
| virtual void releaseModalFocus(Widget* widget); | | virtual void releaseModalFocus(Widget* widget); | |
| | | | |
| /** | | /** | |
|
| * Gets the Widget with focus. | | * Sets modal mouse input focus to a widget. Modal mouse input focu | |
| | | s means | |
| | | * 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. | |
| * | | * | |
|
| * @return the Widget with focus. NULL will be returned if | | * @param widget the widget to focus for modal mouse input focus. | |
| * no Widget has focus. | | * @throws Exception when another widget already has modal mouse in | |
| | | put focus. | |
| */ | | */ | |
|
| virtual Widget* getFocused() const; | | virtual void requestModalMouseInputFocus(Widget* widget); | |
| | | | |
| /** | | /** | |
|
| * Gets the widget that is dragged. | | * Releases modal mouse input focus if the widget has modal mouse i | |
| | | nput | |
| | | * focus. Otherwise nothing will be done. | |
| * | | * | |
|
| * @return the widget that is dragged. NULL will be returned | | * @param widget the widget to release modal mouse input focus for. | |
| * if no Widget is dragged. | | | |
| */ | | */ | |
|
| virtual Widget* getDragged() const; | | virtual void releaseModalMouseInputFocus(Widget* widget); | |
| | | | |
| /** | | /** | |
|
| * Gets the Widget with modal focus. | | * Gets the widget with focus. | |
| | | * | |
| | | * @return the Widget with focus. NULL will be returned if | |
| | | * no Widget has focus. | |
| | | */ | |
| | | virtual Widget* getFocused() const; | |
| | | | |
| | | /** | |
| | | * Gets the widget with modal focus. | |
| * | | * | |
| * @return the Widget with modal focus. NULL will be returned | | * @return the Widget with modal focus. NULL will be returned | |
| * if no Widget has modal focus. | | * if no Widget has modal focus. | |
| */ | | */ | |
| virtual Widget* getModalFocused() const; | | virtual Widget* getModalFocused() const; | |
| | | | |
| /** | | /** | |
|
| | | * Gets the widget with modal mouse input focus. | |
| | | * | |
| | | * @return the widget with modal mouse input focus. NULL will be re | |
| | | turned | |
| | | * if no widget has modal mouse input focus. | |
| | | */ | |
| | | virtual Widget* getModalMouseInputFocused() const; | |
| | | | |
| | | /** | |
| * Focuses the next Widget. If no Widget has focus the first | | * Focuses the next Widget. If no Widget has focus the first | |
| * Widget gets focus. The order in which the Widgets are focused | | * Widget gets focus. The order in which the Widgets are focused | |
| * depends on the order you add them to the GUI. | | * depends on the order you add them to the GUI. | |
| */ | | */ | |
| virtual void focusNext(); | | virtual void focusNext(); | |
| | | | |
| /** | | /** | |
| * Focuses the previous Widget. If no Widget has focus the first | | * Focuses the previous Widget. If no Widget has focus the first | |
| * Widget gets focus. The order in which the widgets are focused | | * Widget gets focus. The order in which the widgets are focused | |
| * depends on the order you add them to the GUI. | | * depends on the order you add them to the GUI. | |
| | | | |
| skipping to change at line 174 | | skipping to change at line 186 | |
| | | | |
| /** | | /** | |
| * Checks if a Widget is focused. | | * Checks if a Widget is focused. | |
| * | | * | |
| * @param widget widget to check if it is focused. | | * @param widget widget to check if it is focused. | |
| * @return true if the widget is focused. | | * @return true if the widget is focused. | |
| */ | | */ | |
| virtual bool isFocused(const Widget* widget) const; | | virtual bool isFocused(const Widget* widget) const; | |
| | | | |
| /** | | /** | |
|
| * Checks if a widget is being dragged | | | |
| * | | | |
| * @param widget the Widget to check if it is being dragged. | | | |
| * @return true if the widget is being dragged. | | | |
| */ | | | |
| virtual bool isDragged(const Widget* widget) const; | | | |
| | | | |
| /** | | | |
| * Adds a widget to the FocusHandler. | | * Adds a widget to the FocusHandler. | |
| * | | * | |
| * @param widget the widget to add. | | * @param widget the widget to add. | |
| */ | | */ | |
| virtual void add(Widget* widget); | | virtual void add(Widget* widget); | |
| | | | |
| /** | | /** | |
| * Removes a widget from the FocusHandler. | | * Removes a widget from the FocusHandler. | |
| * | | * | |
| * @param widget the widget to remove. | | * @param widget the widget to remove. | |
| | | | |
| skipping to change at line 217 | | skipping to change at line 221 | |
| * Focuses the previous Widget which allows tab in unless current f
ocused | | * Focuses the previous Widget which allows tab in unless current f
ocused | |
| * Widget disallows tab out. | | * Widget disallows tab out. | |
| */ | | */ | |
| virtual void tabPrevious(); | | virtual void tabPrevious(); | |
| | | | |
| /** | | /** | |
| * Applies the changes. | | * Applies the changes. | |
| */ | | */ | |
| virtual void applyChanges(); | | virtual void applyChanges(); | |
| | | | |
|
| /** | | | |
| * Drag nothing. | | | |
| */ | | | |
| virtual void dragNone(); | | | |
| | | | |
| protected: | | protected: | |
| typedef std::vector<Widget*> WidgetVector; | | typedef std::vector<Widget*> WidgetVector; | |
| typedef WidgetVector::iterator WidgetIterator; | | typedef WidgetVector::iterator WidgetIterator; | |
| WidgetVector mWidgets; | | WidgetVector mWidgets; | |
| | | | |
| Widget* mFocusedWidget; | | Widget* mFocusedWidget; | |
|
| Widget* mDraggedWidget; | | | |
| Widget* mToBeFocused; | | Widget* mToBeFocused; | |
|
| Widget* mToBeDragged; | | | |
| Widget* mModalFocusedWidget; | | Widget* mModalFocusedWidget; | |
|
| | | Widget* mModalMouseInputFocusedWidget; | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif // end GCN_FOCUSHANDLER_HPP | | #endif // end GCN_FOCUSHANDLER_HPP | |
| | | | |
End of changes. 18 change blocks. |
| 37 lines changed or deleted | | 41 lines changed or added | |
|
| gui.hpp | | gui.hpp | |
| /* _______ __ __ __ ______ __ __ _______ __ __ | | /* _______ __ __ __ ______ __ __ _______ __ __ | |
| * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | | * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
| * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | | * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
| * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | | * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
| * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | | * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
| * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | | * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
| * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | | * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
| * | | * | |
|
| * Copyright (c) 2004, 2005, 2006 Olof Naess | | * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess | |
| * | | * | |
| * Js_./ | | * Js_./ | |
| * Per Larsson a.k.a finalman _RqZ{a<^_aa | | * Per Larsson a.k.a finalman _RqZ{a<^_aa | |
| * Olof Naess | | * Olof Naess | |
| * _Qhm`] _f "'c 1!5m | | * _Qhm`] _f "'c 1!5m | |
| * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | | * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | |
| * .)j(] .d_/ '-( P . S | | * .)j(] .d_/ '-( P . S | |
| * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | | * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | |
| * Redistribution and use in source and _dV>ws?a-?' ._/L #' | | * Redistribution and use in source and _dV>ws?a-?' ._/L #' | |
| * binary forms, with or without )4d[#7r, . ' )d`)[ | | * binary forms, with or without )4d[#7r, . ' )d`)[ | |
| | | | |
| skipping to change at line 62 | | skipping to change at line 62 | |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
| * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | |
| * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * 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 "guichan/keyevent.hpp" | |
| | | #include "guichan/mouseevent.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; | |
| class Input; | | class Input; | |
| class KeyListener; | | class KeyListener; | |
| class Widget; | | class Widget; | |
| | | | |
| | | | |
| skipping to change at line 203 | | skipping to change at line 206 | |
| | | | |
| /** | | /** | |
| * Remove global KeyListener from the Gui. | | * Remove global KeyListener from the Gui. | |
| * | | * | |
| * @param keyListener a KeyListener to remove. | | * @param keyListener a KeyListener to remove. | |
| * @throws Exception if the KeyListener hasn't been added. | | * @throws Exception if the KeyListener hasn't been added. | |
| */ | | */ | |
| virtual void removeGlobalKeyListener(KeyListener* keyListener); | | virtual void removeGlobalKeyListener(KeyListener* keyListener); | |
| | | | |
| protected: | | protected: | |
|
| bool mTopHasMouse; | | /** | |
| bool mTabbing; | | * Handles all mouse input. | |
| | | * | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual void handleMouseInput(); | |
| | | | |
| | | /** | |
| | | * Handles key input. | |
| | | * | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual void handleKeyInput(); | |
| | | | |
| | | /** | |
| | | * Handles mouse moved input. | |
| | | * | |
| | | * @param mouseInput the mouse input to handle. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual void handleMouseMoved(const MouseInput& mouseInput); | |
| | | | |
| | | /** | |
| | | * Handles mouse pressed input. | |
| | | * | |
| | | * @param mouseInput the mouse input to handle. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual void handleMousePressed(const MouseInput& mouseInput); | |
| | | | |
| | | /** | |
| | | * | |
| | | * Handles mouse wheel moved down input. | |
| | | * | |
| | | * @param mouseInput the mouse input to handle. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual void handleMouseWheelMovedDown(const MouseInput& mouseInput | |
| | | ); | |
| | | | |
| | | /** | |
| | | * Handles mouse wheel moved up input. | |
| | | * | |
| | | * @param mouseInput the mouse input to handle. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual void handleMouseWheelMovedUp(const MouseInput& mouseInput); | |
| | | | |
| | | /** | |
| | | * Handles mouse released input. | |
| | | * | |
| | | * @param mouseInput the mouse input to handle. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual void handleMouseReleased(const MouseInput& mouseInput); | |
| | | | |
| | | /** | |
| | | * Handles modal mouse input focus releases. When a release occurs | |
| | | appropriate | |
| | | * mouse events should be distributed (such as mouse entered and mo | |
| | | use exited). | |
| | | * | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual void handleModalMouseInputFocusRelease(); | |
| | | | |
| | | /** | |
| | | * Handles modal focus releases. When a release occurs appropriate | |
| | | mouse events | |
| | | * should be distributed (such as mouse entered and mouse exited). | |
| | | * | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual void handleModalFocusRelease(); | |
| | | | |
| | | /** | |
| | | * Distributes a mouse event. | |
| | | * | |
| | | * @param mouseEvent the mouse event to distribute. | |
| | | * @param fource indicates whether the distribution should be force | |
| | | d or not. | |
| | | * A forced distribution distributes the event even i | |
| | | f a widget | |
| | | * is not enabled or not visible. Default value is fa | |
| | | lse. | |
| | | * @param toSourceOnly indicates whether the distribution should be | |
| | | to the | |
| | | * source widget only or to it's parent's mouse | |
| | | listeners | |
| | | * as well. | |
| | | * | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual void distributeMouseEvent(MouseEvent& mouseEvent, bool forc | |
| | | e = false, bool toSourceOnly = false); | |
| | | | |
| | | /** | |
| | | * Distributes a key event. | |
| | | * | |
| | | * @param keyEvent the key event to distribute. | |
| | | | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual void distributeKeyEvent(KeyEvent& keyEvent); | |
| | | | |
| | | /** | |
| | | * Distributes a key event to the global key listeners. | |
| | | * | |
| | | * @param keyEvent the key event to distribute. | |
| | | * | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual void distributeKeyEventToGlobalKeyListeners(KeyEvent& keyEv | |
| | | ent); | |
| | | | |
| | | /** | |
| | | * Gets the widget at a certain position. | |
| | | * | |
| | | * @return the widget at a certain position. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual Widget* getWidgetAt(int x, int y); | |
| | | | |
| | | /** | |
| | | * Gets the source of the mouse event. | |
| | | * | |
| | | * @return the source widget of the mouse event. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual Widget* getMouseEventSource(int x, int y); | |
| | | | |
| | | /** | |
| | | * Gets the source of the key event. | |
| | | * | |
| | | * @return the source widget of the key event. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual Widget* getKeyEventSource(); | |
| | | | |
| Widget* mTop; | | Widget* mTop; | |
| Graphics* mGraphics; | | Graphics* mGraphics; | |
| Input* mInput; | | Input* mInput; | |
| FocusHandler* mFocusHandler; | | FocusHandler* mFocusHandler; | |
|
| | | | |
| | | bool mTabbing; | |
| | | | |
| typedef std::list<KeyListener*> KeyListenerList; | | typedef std::list<KeyListener*> KeyListenerList; | |
|
| KeyListenerList mKeyListeners; | | | |
| typedef KeyListenerList::iterator KeyListenerListIterator; | | typedef KeyListenerList::iterator KeyListenerListIterator; | |
|
| | | | |
| | | KeyListenerList mKeyListeners; | |
| | | | |
| | | Widget* mDraggedWidget; | |
| | | Widget* mLastWidgetWithMouse; | |
| | | Widget* mLastWidgetWithModalFocus; | |
| | | Widget* mLastWidgetWithModalMouseInputFocus; | |
| | | Widget* mLastWidgetPressed; | |
| | | | |
| | | // Current input state | |
| | | bool mShiftPressed; | |
| | | bool mMetaPressed; | |
| | | bool mControlPressed; | |
| | | bool mAltPressed; | |
| | | | |
| | | // Last mouse state | |
| | | unsigned int mLastMousePressButton; | |
| | | int mLastMousePressTimeStamp; | |
| | | int mLastMouseX; | |
| | | int mLastMouseY; | |
| | | int mClickCount; | |
| }; | | }; | |
| } | | } | |
| | | | |
| #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. 6 change blocks. |
| 4 lines changed or deleted | | 166 lines changed or added | |
|
| guichan.hpp | | guichan.hpp | |
| /* _______ __ __ __ ______ __ __ _______ __ __ | | /* _______ __ __ __ ______ __ __ _______ __ __ | |
| * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | | * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
| * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | | * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
| * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | | * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
| * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | | * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
| * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | | * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
| * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | | * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
| * | | * | |
|
| * Copyright (c) 2004, 2005, 2006 Olof Naess | | * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess | |
| * | | * | |
| * Js_./ | | * Js_./ | |
| * Per Larsson a.k.a finalman _RqZ{a<^_aa | | * Per Larsson a.k.a finalman _RqZ{a<^_aa | |
| * Olof Naess | | * Olof Naess | |
| * _Qhm`] _f "'c 1!5m | | * _Qhm`] _f "'c 1!5m | |
| * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | | * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | |
| * .)j(] .d_/ '-( P . S | | * .)j(] .d_/ '-( P . S | |
| * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | | * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | |
| * Redistribution and use in source and _dV>ws?a-?' ._/L #' | | * Redistribution and use in source and _dV>ws?a-?' ._/L #' | |
| * binary forms, with or without )4d[#7r, . ' )d`)[ | | * binary forms, with or without )4d[#7r, . ' )d`)[ | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 60 | |
| * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
| * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | |
| * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * 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/actionlistener.hpp> | | #include <guichan/actionlistener.hpp> | |
| #include <guichan/graphics.hpp> | | #include <guichan/graphics.hpp> | |
| #include <guichan/color.hpp> | | #include <guichan/color.hpp> | |
|
| | | #include <guichan/deathlistener.hpp> | |
| | | #include <guichan/event.hpp> | |
| #include <guichan/exception.hpp> | | #include <guichan/exception.hpp> | |
| #include <guichan/focushandler.hpp> | | #include <guichan/focushandler.hpp> | |
| #include <guichan/font.hpp> | | #include <guichan/font.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/key.hpp> | | #include <guichan/key.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/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/cliprectangle.hpp> | |
| | | | |
| #include <guichan/widget.hpp> | | #include <guichan/widget.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> | |
| | | | |
End of changes. 6 change blocks. |
| 1 lines changed or deleted | | 7 lines changed or added | |
|
| key.hpp | | key.hpp | |
| /* _______ __ __ __ ______ __ __ _______ __ __ | | /* _______ __ __ __ ______ __ __ _______ __ __ | |
| * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | | * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
| * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | | * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
| * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | | * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
| * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | | * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
| * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | | * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
| * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | | * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
| * | | * | |
|
| * Copyright (c) 2004, 2005, 2006 Olof Naess | | * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess | |
| * | | * | |
| * Js_./ | | * Js_./ | |
| * Per Larsson a.k.a finalman _RqZ{a<^_aa | | * Per Larsson a.k.a finalman _RqZ{a<^_aa | |
| * Olof Naess | | * Olof Naess | |
| * _Qhm`] _f "'c 1!5m | | * _Qhm`] _f "'c 1!5m | |
| * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | | * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | |
| * .)j(] .d_/ '-( P . S | | * .)j(] .d_/ '-( P . S | |
| * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | | * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | |
| * Redistribution and use in source and _dV>ws?a-?' ._/L #' | | * Redistribution and use in source and _dV>ws?a-?' ._/L #' | |
| * binary forms, with or without )4d[#7r, . ' )d`)[ | | * binary forms, with or without )4d[#7r, . ' )d`)[ | |
| | | | |
| skipping to change at line 100 | | skipping to change at line 100 | |
| bool isNumber() const; | | bool isNumber() const; | |
| | | | |
| /** | | /** | |
| * Checks whether a key is a letter. | | * Checks whether 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). | |
| */ | | */ | |
| bool isLetter() const; | | bool isLetter() const; | |
| | | | |
| /** | | /** | |
|
| * Checks whether shift is pressed. | | | |
| * | | | |
| * @return true if shift was pressed at the same time as the key. | | | |
| */ | | | |
| bool isShiftPressed() const; | | | |
| | | | |
| /** | | | |
| * Sets the shift pressed flag. | | | |
| * | | | |
| * @param pressed the shift flag value. | | | |
| */ | | | |
| void setShiftPressed(bool pressed); | | | |
| | | | |
| /** | | | |
| * Checks whether control is pressed. | | | |
| * | | | |
| * @return true if control was pressed at the same time as the key. | | | |
| */ | | | |
| bool isControlPressed() const; | | | |
| | | | |
| /** | | | |
| * Sets the control pressed flag. | | | |
| * | | | |
| * @param pressed the control flag value. | | | |
| */ | | | |
| void setControlPressed(bool pressed); | | | |
| | | | |
| /** | | | |
| * Checks whether alt is pressed. | | | |
| * | | | |
| * @return true if alt was pressed at the same time as the key. | | | |
| */ | | | |
| bool isAltPressed() const; | | | |
| | | | |
| /** | | | |
| * Sets the alt pressed flag. | | | |
| * | | | |
| * @param pressed the alt flag value. | | | |
| */ | | | |
| void setAltPressed(bool pressed); | | | |
| | | | |
| /** | | | |
| * Checks whether meta is pressed. | | | |
| * | | | |
| * @return true if meta was pressed at the same time as the key. | | | |
| */ | | | |
| bool isMetaPressed() const; | | | |
| | | | |
| /** | | | |
| * Sets the meta pressed flag. | | | |
| * | | | |
| * @param pressed the meta flag value. | | | |
| */ | | | |
| void setMetaPressed(bool pressed); | | | |
| | | | |
| /** | | | |
| * Checks whether the key was pressed at the numeric pad. | | | |
| * | | | |
| * @return true if key pressed at the numeric pad. | | | |
| */ | | | |
| bool isNumericPad() const; | | | |
| | | | |
| /** | | | |
| * Sets the numeric pad flag. | | | |
| * | | | |
| * @param numpad the numeric pad flag value. | | | |
| */ | | | |
| void setNumericPad(bool numpad); | | | |
| | | | |
| /** | | | |
| * 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 will be | |
| * returned. Otherwise an enum value will be returned. | | * 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; | |
| | | | |
| /** | | /** | |
|
| * Sets the value of the key. An ascii value or an enum value. | | | |
| * | | | |
| * @param value the key value. | | | |
| */ | | | |
| void setValue(int value); | | | |
| | | | |
| /** | | | |
| * 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, | |
| LEFT_SHIFT, | | LEFT_SHIFT, | |
| | | | |
| skipping to change at line 239 | | skipping to change at line 162 | |
| NUM_LOCK, | | NUM_LOCK, | |
| ALT_GR, | | ALT_GR, | |
| LEFT, | | LEFT, | |
| RIGHT, | | RIGHT, | |
| UP, | | UP, | |
| DOWN | | DOWN | |
| }; | | }; | |
| | | | |
| protected: | | protected: | |
| int mValue; | | int mValue; | |
|
| bool mShiftPressed; | | | |
| bool mControlPressed; | | | |
| bool mAltPressed; | | | |
| bool mMetaPressed; | | | |
| bool mNumericPad; | | | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif // end GCN_KEY_HPP | | #endif // end GCN_KEY_HPP | |
| | | | |
End of changes. 4 change blocks. |
| 83 lines changed or deleted | | 1 lines changed or added | |
|
| keyinput.hpp | | keyinput.hpp | |
| /* _______ __ __ __ ______ __ __ _______ __ __ | | /* _______ __ __ __ ______ __ __ _______ __ __ | |
| * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | | * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
| * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | | * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
| * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | | * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
| * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | | * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
| * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | | * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
| * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | | * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
| * | | * | |
|
| * Copyright (c) 2004, 2005, 2006 Olof Naess | | * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess | |
| * | | * | |
| * Js_./ | | * Js_./ | |
| * Per Larsson a.k.a finalman _RqZ{a<^_aa | | * Per Larsson a.k.a finalman _RqZ{a<^_aa | |
| * Olof Naess | | * Olof Naess | |
| * _Qhm`] _f "'c 1!5m | | * _Qhm`] _f "'c 1!5m | |
| * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | | * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | |
| * .)j(] .d_/ '-( P . S | | * .)j(] .d_/ '-( P . S | |
| * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | | * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | |
| * Redistribution and use in source and _dV>ws?a-?' ._/L #' | | * Redistribution and use in source and _dV>ws?a-?' ._/L #' | |
| * binary forms, with or without )4d[#7r, . ' )d`)[ | | * binary forms, with or without )4d[#7r, . ' )d`)[ | |
| | | | |
| skipping to change at line 115 | | skipping to change at line 115 | |
| void setKey(const Key& key); | | void setKey(const Key& key); | |
| | | | |
| /** | | /** | |
| * Gets the key the input concerns. | | * Gets the key the input concerns. | |
| * | | * | |
| * @return the Key the input concerns. | | * @return the Key the input concerns. | |
| */ | | */ | |
| const Key& getKey() const; | | const Key& getKey() const; | |
| | | | |
| /** | | /** | |
|
| * Enum with key input values. | | * Checks whether shift is pressed. | |
| | | * | |
| | | * @return true if shift was pressed at the same time as the key. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | bool isShiftPressed() const; | |
| | | | |
| | | /** | |
| | | * Sets the shift pressed flag. | |
| | | * | |
| | | * @param pressed the shift flag value. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | void setShiftPressed(bool pressed); | |
| | | | |
| | | /** | |
| | | * Checks whether control is pressed. | |
| | | * | |
| | | * @return true if control was pressed at the same time as the key. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | bool isControlPressed() const; | |
| | | | |
| | | /** | |
| | | * Sets the control pressed flag. | |
| | | * | |
| | | * @param pressed the control flag value. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | void setControlPressed(bool pressed); | |
| | | | |
| | | /** | |
| | | * Checks whether alt is pressed. | |
| | | * | |
| | | * @return true if alt was pressed at the same time as the key. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | bool isAltPressed() const; | |
| | | | |
| | | /** | |
| | | * Sets the alt pressed flag. | |
| | | * | |
| | | * @param pressed the alt flag value. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | void setAltPressed(bool pressed); | |
| | | | |
| | | /** | |
| | | * Checks whether meta is pressed. | |
| | | * | |
| | | * @return true if meta was pressed at the same time as the key. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | bool isMetaPressed() const; | |
| | | | |
| | | /** | |
| | | * Sets the meta pressed flag. | |
| | | * | |
| | | * @param pressed the meta flag value. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | void setMetaPressed(bool pressed); | |
| | | | |
| | | /** | |
| | | * Checks whether the key was pressed at the numeric pad. | |
| | | * | |
| | | * @return true if key pressed at the numeric pad. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | bool isNumericPad() const; | |
| | | | |
| | | /** | |
| | | * Sets the numeric pad flag. | |
| | | * | |
| | | * @param numpad the numeric pad flag value. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | void setNumericPad(bool numpad); | |
| | | | |
| | | /** | |
| | | * Key input types. This enum corresponds to the enum with event | |
| | | * types on KeyEvent for easy mapping. | |
| */ | | */ | |
| enum | | enum | |
| { | | { | |
|
| EMPTY = 0, | | PRESSED = 0, | |
| PRESS, | | RELEASED | |
| RELEASE | | | |
| }; | | }; | |
| | | | |
| protected: | | protected: | |
| Key mKey; | | Key mKey; | |
| int mType; | | int mType; | |
| int mButton; | | int mButton; | |
|
| | | bool mShiftPressed; | |
| | | bool mControlPressed; | |
| | | bool mAltPressed; | |
| | | bool mMetaPressed; | |
| | | bool mNumericPad; | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif // end GCN_KEYINPUT_HPP | | #endif // end GCN_KEYINPUT_HPP | |
| | | | |
End of changes. 4 change blocks. |
| 5 lines changed or deleted | | 90 lines changed or added | |
|
| keylistener.hpp | | keylistener.hpp | |
| /* _______ __ __ __ ______ __ __ _______ __ __ | | /* _______ __ __ __ ______ __ __ _______ __ __ | |
| * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | | * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
| * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | | * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
| * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | | * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
| * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | | * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
| * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | | * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
| * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | | * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
| * | | * | |
|
| * Copyright (c) 2004, 2005, 2006 Olof Naess | | * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess | |
| * | | * | |
| * Js_./ | | * Js_./ | |
| * Per Larsson a.k.a finalman _RqZ{a<^_aa | | * Per Larsson a.k.a finalman _RqZ{a<^_aa | |
| * Olof Naess | | * Olof Naess | |
| * _Qhm`] _f "'c 1!5m | | * _Qhm`] _f "'c 1!5m | |
| * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | | * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | |
| * .)j(] .d_/ '-( P . S | | * .)j(] .d_/ '-( P . S | |
| * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | | * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | |
| * Redistribution and use in source and _dV>ws?a-?' ._/L #' | | * Redistribution and use in source and _dV>ws?a-?' ._/L #' | |
| * binary forms, with or without )4d[#7r, . ' )d`)[ | | * binary forms, with or without )4d[#7r, . ' )d`)[ | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 60 | |
| * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
| * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | |
| * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * 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/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 | | * Key listeners base class. Inorder to use this class you must inherit | |
| * from it and implements it's functions. KeyListeners listen for key | | * from it and implements it's functions. KeyListeners listen for key | |
| * events on a Widgets. When a Widget recives a key event, the | | * events on a Widgets. When a Widget recives a key event, the | |
| | | | |
| skipping to change at line 89 | | skipping to change at line 90 | |
| /** | | /** | |
| * 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 key the key pressed. | | * @param keyEvent discribes the event. | |
| */ | | */ | |
|
| virtual void keyPress(const Key& key) { } | | 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 key the key released. | | * @param keyEvent discribes the event. | |
| */ | | */ | |
|
| virtual void keyRelease(const Key& key) { } | | 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. To use KeyListener | |
| * you must inherit from this class and implement it's | | * you must inherit from this class and implement it's | |
| * functions. | | * functions. | |
| */ | | */ | |
| | | | |
End of changes. 6 change blocks. |
| 5 lines changed or deleted | | 6 lines changed or added | |
|
| mouseinput.hpp | | mouseinput.hpp | |
| /* _______ __ __ __ ______ __ __ _______ __ __ | | /* _______ __ __ __ ______ __ __ _______ __ __ | |
| * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | | * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
| * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | | * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
| * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | | * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
| * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | | * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
| * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | | * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
| * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | | * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
| * | | * | |
|
| * Copyright (c) 2004, 2005, 2006 Olof Naess | | * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess | |
| * | | * | |
| * Js_./ | | * Js_./ | |
| * Per Larsson a.k.a finalman _RqZ{a<^_aa | | * Per Larsson a.k.a finalman _RqZ{a<^_aa | |
| * Olof Naess | | * Olof Naess | |
| * _Qhm`] _f "'c 1!5m | | * _Qhm`] _f "'c 1!5m | |
| * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | | * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | |
| * .)j(] .d_/ '-( P . S | | * .)j(] .d_/ '-( P . S | |
| * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | | * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | |
| * Redistribution and use in source and _dV>ws?a-?' ._/L #' | | * Redistribution and use in source and _dV>ws?a-?' ._/L #' | |
| * binary forms, with or without )4d[#7r, . ' )d`)[ | | * binary forms, with or without )4d[#7r, . ' )d`)[ | |
| | | | |
| skipping to change at line 67 | | skipping to change at line 67 | |
| #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 representing mouse input. Generally you won't have to | |
|
| * bother using this class. | | * bother using this class as it will get translated into a MouseEvent. | |
| | | * The class should be seen as a bridge between the low layer backends | |
| | | * providing input and the higher lever parts of the Gui (such as widge | |
| | | ts). | |
| | | * | |
| | | * @author Olof Naess | |
| | | * @author Per Larsson | |
| */ | | */ | |
| 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 input. | |
|
| * @param mousex the mouse x coordinate. | | * @param x the mouse x coordinate. | |
| * @param mousey the mouse y coordinate. | | * @param y the mouse y coordinate. | |
| * @param timeStamp the mouse inputs time stamp. | | * @param timeStamp the mouse inputs time stamp. | |
| */ | | */ | |
|
| MouseInput(int button, int type, int mousex, int mousey, int timeSt | | MouseInput(unsigned int button, | |
| amp); | | unsigned int type, | |
| | | int x, | |
| | | int y, | |
| | | int timeStamp); | |
| | | | |
| /** | | /** | |
| * Sets the input type. | | * Sets the input type. | |
| * | | * | |
| * @param type the type of input. | | * @param type the type of input. | |
| */ | | */ | |
|
| void setType(int type); | | void setType(unsigned int type); | |
| | | | |
| /** | | /** | |
| * Gets the input type. | | * Gets the input type. | |
| * | | * | |
| * @return the input type. | | * @return the input type. | |
| */ | | */ | |
|
| 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. | |
| */ | | */ | |
|
| void setButton(int button); | | void setButton(unsigned int button); | |
| | | | |
| /** | | /** | |
| * Gets the button pressed. | | * Gets the button pressed. | |
| * | | * | |
| * @return the button pressed. | | * @return the button pressed. | |
| */ | | */ | |
|
| int getButton() const; | | unsigned int getButton() const; | |
| | | | |
| /** | | /** | |
| * Sets the timestamp for the input. | | * Sets the timestamp for the input. | |
| * | | * | |
| * @param timeStamp the timestamp of the input. | | * @param timeStamp the timestamp of the input. | |
| */ | | */ | |
| void setTimeStamp(int timeStamp); | | void setTimeStamp(int timeStamp); | |
| | | | |
| /** | | /** | |
| * Gets the time stamp of the input. | | * Gets the time stamp of the input. | |
| * | | * | |
| * @return the time stamp of the input. | | * @return the time stamp of the input. | |
| */ | | */ | |
| int getTimeStamp() const; | | int getTimeStamp() const; | |
| | | | |
| /** | | /** | |
|
| * Enum with mouse input values. | | * Sets the x coordinate of the input. | |
| | | * | |
| | | * @param x the x coordinate of the input. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | void setX(int x); | |
| | | | |
| | | /** | |
| | | * Gets the x coordinate of the input. | |
| | | * | |
| | | * @return the x coordinate of the input. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | int getX() const; | |
| | | | |
| | | /** | |
| | | * Sets the y coordinate of the input. | |
| | | * | |
| | | * @param y the y coordinate of the input. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | void setY(int y); | |
| | | | |
| | | /** | |
| | | * Gets the y coordinate of the input. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | int getY() const; | |
| | | | |
| | | /** | |
| | | * Mouse input event types. This enum partially corresponds | |
| | | * to the enum with event types in MouseEvent for easy mapping. | |
| | | */ | |
| | | enum | |
| | | { | |
| | | MOVED = 0, | |
| | | PRESSED, | |
| | | RELEASED, | |
| | | WHEEL_MOVED_DOWN, | |
| | | WHEEL_MOVED_UP | |
| | | }; | |
| | | | |
| | | /** | |
| | | * Mouse button types. | |
| */ | | */ | |
| enum | | enum | |
| { | | { | |
| EMPTY = 0, | | EMPTY = 0, | |
| LEFT, | | LEFT, | |
| RIGHT, | | RIGHT, | |
|
| MIDDLE, | | MIDDLE | |
| WHEEL_UP, | | | |
| WHEEL_DOWN, | | | |
| PRESS, | | | |
| RELEASE, | | | |
| MOTION | | | |
| }; | | }; | |
| | | | |
|
| int x, y; | | | |
| | | | |
| protected: | | protected: | |
|
| int mType; | | unsigned int mType; | |
| int mButton; | | unsigned int mButton; | |
| int mTimeStamp; | | int mTimeStamp; | |
|
| | | int mX; | |
| | | int mY; | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif // end GCN_MOUSEINPUT_HPP | | #endif // end GCN_MOUSEINPUT_HPP | |
| | | | |
End of changes. 14 change blocks. |
| 22 lines changed or deleted | | 69 lines changed or added | |
|
| mouselistener.hpp | | mouselistener.hpp | |
| /* _______ __ __ __ ______ __ __ _______ __ __ | | /* _______ __ __ __ ______ __ __ _______ __ __ | |
| * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | | * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
| * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | | * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
| * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | | * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
| * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | | * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
| * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | | * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
| * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | | * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
| * | | * | |
|
| * Copyright (c) 2004, 2005, 2006 Olof Naess | | * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess | |
| * | | * | |
| * Js_./ | | * Js_./ | |
| * Per Larsson a.k.a finalman _RqZ{a<^_aa | | * Per Larsson a.k.a finalman _RqZ{a<^_aa | |
| * Olof Naess | | * Olof Naess | |
| * _Qhm`] _f "'c 1!5m | | * _Qhm`] _f "'c 1!5m | |
| * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | | * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | |
| * .)j(] .d_/ '-( P . S | | * .)j(] .d_/ '-( P . S | |
| * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | | * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | |
| * Redistribution and use in source and _dV>ws?a-?' ._/L #' | | * Redistribution and use in source and _dV>ws?a-?' ._/L #' | |
| * binary forms, with or without )4d[#7r, . ' )d`)[ | | * binary forms, with or without )4d[#7r, . ' )d`)[ | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 60 | |
| * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
| * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | |
| * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * 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/platform.hpp" | | #include "guichan/platform.hpp" | |
| | | | |
| namespace gcn | | namespace gcn | |
| { | | { | |
| /** | | /** | |
| * Mouse listeners base class. Inorder to use this class you must inher
it | | * Mouse listeners base class. Inorder to use this class you must inher
it | |
| * from it and implements it's functions. MouseListeners listen for mou
se | | * from it and implements it's functions. MouseListeners listen for mou
se | |
| * events on a Widgets. When a Widget recives a mouse event, the | | * events on a Widgets. When a Widget recives a mouse event, the | |
|
| * corresponding function in all it's mouse listeners will be | | * corresponding function in all it's mouse listeners will be called. | |
| * | | * | |
| * @see Widget::addMouseListener | | * @see Widget::addMouseListener | |
| */ | | */ | |
| class GCN_CORE_DECLSPEC MouseListener | | class GCN_CORE_DECLSPEC MouseListener | |
| { | | { | |
| public: | | public: | |
| | | | |
| /** | | /** | |
| * Destructor. | | * Destructor. | |
| */ | | */ | |
| virtual ~MouseListener() { } | | virtual ~MouseListener() { } | |
| | | | |
| /** | | /** | |
|
| * Called when the mouse enters into the widget area. | | * Called when the mouse has entered into the widget area. | |
| | | * | |
| | | * @param mouseEvent describes the event. | |
| | | * @since 0.6.0 | |
| */ | | */ | |
|
| virtual void mouseIn() { } | | virtual void mouseEntered(MouseEvent& mouseEvent) | |
| | | { | |
| | | | |
| | | } | |
| | | | |
| /** | | /** | |
|
| * Called when the mouse leaves the Widget area. | | * Called when the mouse has exited the widget area. | |
| | | * | |
| | | * @param mouseEvent describes the event. | |
| */ | | */ | |
|
| virtual void mouseOut() { } | | virtual void mouseExited(MouseEvent& mouseEvent) | |
| | | { | |
| | | | |
| | | } | |
| | | | |
| /** | | /** | |
|
| * Called when a mouse button is pressed when the mouse is in the | | * Called when a mouse button has been pressed on the widget area. | |
| * Widget area or if the Widget has focus. | | | |
| * | | * | |
| * 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 x the x coordinate of the mouse relative to the Widget | | * @param mouseEvent describes the event. | |
| * itself. | | * @since 0.6.0 | |
| * @param y the y coordinate of the mouse relative to the Widget | | | |
| * itself. | | | |
| * @param button the button pressed. | | | |
| */ | | */ | |
|
| virtual void mousePress(int x, int y, int button) { } | | virtual void mousePressed(MouseEvent& mouseEvent) | |
| | | { | |
| | | | |
| | | } | |
| | | | |
| /** | | /** | |
|
| * Called when a mouse button is released when the mouse is in the | | * Called when a mouse button has been released on the widget area. | |
| * Widget area or if the Widget has focus. | | | |
| * | | * | |
|
| * @param x the x coordinate of the mouse relative to the Widget | | * @param mouseEvent describes the event. | |
| * itself. | | */ | |
| | | virtual void mouseReleased(MouseEvent& mouseEvent) | |
| | | { | |
| | | | |
| | | } | |
| | | | |
| | | /** | |
| | | * Called when a mouse button is pressed and released (clicked) on | |
| | | * the widget area. | |
| * | | * | |
|
| * @param y the y coordinate of the mouse relative to the Widget | | * @param mouseEvent describes the event. | |
| * itself. | | * @since 0.6.0 | |
| * @param button the button released. | | | |
| */ | | */ | |
|
| virtual void mouseRelease(int x, int y, int button) { } | | virtual void mouseClicked(MouseEvent& mouseEvent) | |
| | | { | |
| | | | |
| | | } | |
| | | | |
| /** | | /** | |
|
| * Called when a mouse button is pressed and released (clicked) | | * Called when the mouse wheel has moved up on the widget area. | |
| * when the mouse is in the Widget area or if the Widget has | | | |
| * focus. | | | |
| * | | * | |
|
| * @param x the x coordinate of the mouse relative to the Widget | | * @param mouseEvent describes the event. | |
| * itself. | | * @since 0.6.0 | |
| * @param y the y coordinate of the mouse relative to the Widget | | | |
| * itself. | | | |
| * @param button the button clicked. | | | |
| * @param count the number of clicks. | | | |
| */ | | */ | |
|
| virtual void mouseClick(int x, int y, int button, int count) { } | | virtual void mouseWheelMovedUp(MouseEvent& mouseEvent) | |
| | | { | |
| | | | |
| | | } | |
| | | | |
| /** | | /** | |
|
| * Called on a mouse wheel up when the mouse is in the Widget | | * Called when the mouse wheel has moved down on the widget area. | |
| * area or if the Widget has focus. | | | |
| * | | * | |
|
| * @param x the x coordinate of the mouse relative to the Widget | | * @param mousEvent describes the event. | |
| * itself. | | * @since 0.6.0 | |
| * @param y the y coordinate of the mouse relative to the Widget | | | |
| * itself. | | | |
| */ | | */ | |
|
| virtual void mouseWheelUp(int x, int y) { } | | virtual void mouseWheelMovedDown(MouseEvent& mouseEvent) | |
| | | { | |
| | | | |
| | | } | |
| | | | |
| /** | | /** | |
|
| * Called on a mouse wheel down when the mouse is in the Widget | | * Called when the mouse has moved in the widget area and no mouse | |
| * area or if the Widget has focus. | | button | |
| | | * has been pressed (i.e no widget is being dragged). | |
| * | | * | |
|
| * @param x the x coordinate of the mouse relative to the Widget | | * @param mouseEvent describes the event. | |
| * itself. | | * @since 0.6.0 | |
| * @param y the y coordinate of the mouse relative to the Widget | | | |
| * itself. | | | |
| */ | | */ | |
|
| virtual void mouseWheelDown(int x, int y) { } | | virtual void mouseMoved(MouseEvent& mouseEvent) | |
| | | { | |
| | | | |
| | | } | |
| | | | |
| /** | | /** | |
|
| * Called when the mouse moves and the mouse is in the Widget | | * Called when the mouse has moved and the mouse has previously bee | |
| * area or if the Widget has focus. | | n | |
| | | * pressed on the widget. | |
| * | | * | |
|
| * @param x the x coordinate of the mouse relative to the Widget | | * @param mouseEvent describes the event. | |
| * itself. | | * @since 0.6.0 | |
| * @param y the y coordinate of the mouse relative to the Widget | | | |
| * itself. | | | |
| */ | | */ | |
|
| virtual void mouseMotion(int x, int y) { } | | 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. To use MouseListener | |
| * you must inherit from this class and implement it's | | * you must inherit from this class and implement it's | |
| * functions. | | * functions. | |
| */ | | */ | |
| | | | |
End of changes. 26 change blocks. |
| 53 lines changed or deleted | | 74 lines changed or added | |
|
| scrollarea.hpp | | scrollarea.hpp | |
| /* _______ __ __ __ ______ __ __ _______ __ __ | | /* _______ __ __ __ ______ __ __ _______ __ __ | |
| * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | | * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
| * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | | * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
| * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | | * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
| * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | | * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
| * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | | * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
| * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | | * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
| * | | * | |
|
| * Copyright (c) 2004, 2005, 2006 Olof Naess | | * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess | |
| * | | * | |
| * Js_./ | | * Js_./ | |
| * Per Larsson a.k.a finalman _RqZ{a<^_aa | | * Per Larsson a.k.a finalman _RqZ{a<^_aa | |
| * Olof Naess | | * Olof Naess | |
| * _Qhm`] _f "'c 1!5m | | * _Qhm`] _f "'c 1!5m | |
| * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | | * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | |
| * .)j(] .d_/ '-( P . S | | * .)j(] .d_/ '-( P . S | |
| * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | | * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | |
| * Redistribution and use in source and _dV>ws?a-?' ._/L #' | | * Redistribution and use in source and _dV>ws?a-?' ._/L #' | |
| * binary forms, with or without )4d[#7r, . ' )d`)[ | | * binary forms, with or without )4d[#7r, . ' )d`)[ | |
| | | | |
| skipping to change at line 310 | | skipping to change at line 310 | |
| virtual void logic(); | | virtual void logic(); | |
| | | | |
| virtual void setWidth(int width); | | virtual void setWidth(int width); | |
| | | | |
| virtual void setHeight(int height); | | virtual void setHeight(int height); | |
| | | | |
| virtual void setDimension(const Rectangle& dimension); | | virtual void setDimension(const Rectangle& dimension); | |
| | | | |
| // Inherited from MouseListener | | // Inherited from MouseListener | |
| | | | |
|
| virtual void mousePress(int x, int y, int button); | | virtual void mousePressed(MouseEvent& mouseEvent); | |
| | | | |
|
| virtual void mouseRelease(int x, int y, int button); | | virtual void mouseReleased(MouseEvent& mouseEvent); | |
| | | | |
|
| virtual void mouseMotion(int x, int y); | | virtual void mouseDragged(MouseEvent& mouseEvent); | |
| | | | |
|
| virtual void mouseWheelUp(int x, int y); | | virtual void mouseWheelMovedUp(MouseEvent& mouseEvent); | |
| | | | |
|
| virtual void mouseWheelDown(int x, int y); | | virtual void mouseWheelMovedDown(MouseEvent& mouseEvent); | |
| | | | |
| /** | | /** | |
| * Scrollpolicies for the horizontal and vertical scrollbar. | | * Scrollpolicies for the horizontal and vertical scrollbar. | |
| * The policies are: | | * The policies are: | |
| * | | * | |
| * SHOW_ALWAYS - Always show the scrollbars no matter what. | | * SHOW_ALWAYS - Always show the scrollbars no matter what. | |
| * SHOW_NEVER - Never show the scrollbars no matter waht. | | * SHOW_NEVER - Never show the scrollbars no matter waht. | |
| * SHOW_AUTO - Show the scrollbars only when needed. That is if t
he | | * SHOW_AUTO - Show the scrollbars only when needed. That is if t
he | |
| * content grows larger then the ScrollArea. | | * content grows larger then the ScrollArea. | |
| */ | | */ | |
| | | | |
| skipping to change at line 473 | | skipping to change at line 473 | |
| int mHScroll; | | int mHScroll; | |
| int mScrollbarWidth; | | int mScrollbarWidth; | |
| unsigned int mHPolicy; | | unsigned int mHPolicy; | |
| unsigned int mVPolicy; | | unsigned int mVPolicy; | |
| bool mVBarVisible; | | bool mVBarVisible; | |
| bool mHBarVisible; | | bool mHBarVisible; | |
| bool mUpButtonPressed; | | bool mUpButtonPressed; | |
| bool mDownButtonPressed; | | bool mDownButtonPressed; | |
| bool mLeftButtonPressed; | | bool mLeftButtonPressed; | |
| bool mRightButtonPressed; | | bool mRightButtonPressed; | |
|
| bool mVerticalMarkerPressed; | | | |
| int mVerticalMarkerMousePosition; | | | |
| bool mHorizontalMarkerPressed; | | | |
| int mHorizontalMarkerMousePosition; | | | |
| int mUpButtonScrollAmount; | | int mUpButtonScrollAmount; | |
| int mDownButtonScrollAmount; | | int mDownButtonScrollAmount; | |
| int mLeftButtonScrollAmount; | | int mLeftButtonScrollAmount; | |
| int mRightButtonScrollAmount; | | int mRightButtonScrollAmount; | |
|
| | | bool mIsVerticalMarkerDragged; | |
| | | bool mIsHorizontalMarkerDragged; | |
| | | int mHorizontalMarkerDragOffset; | |
| | | int mVerticalMarkerDragOffset; | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif // end GCN_SCROLLAREA_HPP | | #endif // end GCN_SCROLLAREA_HPP | |
| | | | |
End of changes. 8 change blocks. |
| 10 lines changed or deleted | | 10 lines changed or added | |
|
| widget.hpp | | widget.hpp | |
| /* _______ __ __ __ ______ __ __ _______ __ __ | | /* _______ __ __ __ ______ __ __ _______ __ __ | |
| * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | | * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
| * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | | * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
| * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | | * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
| * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | | * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
| * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | | * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
| * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | | * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
| * | | * | |
|
| * Copyright (c) 2004, 2005, 2006 Olof Naess | | * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess | |
| * | | * | |
| * Js_./ | | * Js_./ | |
| * Per Larsson a.k.a finalman _RqZ{a<^_aa | | * Per Larsson a.k.a finalman _RqZ{a<^_aa | |
| * Olof Naess | | * Olof Naess | |
| * _Qhm`] _f "'c 1!5m | | * _Qhm`] _f "'c 1!5m | |
| * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | | * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[ | |
| * .)j(] .d_/ '-( P . S | | * .)j(] .d_/ '-( P . S | |
| * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | | * License: (BSD) <Td/Z <fP"5(\"??"\a. .L | |
| * Redistribution and use in source and _dV>ws?a-?' ._/L #' | | * Redistribution and use in source and _dV>ws?a-?' ._/L #' | |
| * binary forms, with or without )4d[#7r, . ' )d`)[ | | * binary forms, with or without )4d[#7r, . ' )d`)[ | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 70 | |
| #include <list> | | #include <list> | |
| #include <string> | | #include <string> | |
| | | | |
| #include "guichan/color.hpp" | | #include "guichan/color.hpp" | |
| #include "guichan/rectangle.hpp" | | #include "guichan/rectangle.hpp" | |
| | | | |
| namespace gcn | | namespace gcn | |
| { | | { | |
| class ActionListener; | | class ActionListener; | |
| class BasicContainer; | | class BasicContainer; | |
|
| | | class DeathListener; | |
| class DefaultFont; | | class DefaultFont; | |
| class FocusHandler; | | class FocusHandler; | |
| class Font; | | class Font; | |
| class Graphics; | | class Graphics; | |
| class KeyInput; | | class KeyInput; | |
| class KeyListener; | | class KeyListener; | |
| class MouseInput; | | class MouseInput; | |
| class MouseListener; | | class MouseListener; | |
| | | | |
| /** | | /** | |
| * Widget base class. Contains basic widget functions every widget shou
ld | | * Widget base class. Contains basic widget functions every widget shou
ld | |
| * have. Widgets should inherit from this class and implements it's | | * have. Widgets should inherit from this class and implements it's | |
| * functions. | | * 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 Per Larsson. | |
| */ | | */ | |
| 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(); | |
| | | | |
| skipping to change at line 137 | | skipping to change at line 141 | |
| * @see Gui | | * @see Gui | |
| */ | | */ | |
| virtual void logic() { } | | virtual void logic() { } | |
| | | | |
| /** | | /** | |
| * Gets the Widget parent container. | | * Gets the Widget parent container. | |
| * | | * | |
| * @return the Widget parent container. Returns NULL if the Widget | | * @return the Widget parent container. Returns NULL if the Widget | |
| * has no parent. | | * has no parent. | |
| */ | | */ | |
|
| virtual BasicContainer* getParent() const; | | virtual Widget* getParent() const; | |
| | | | |
| /** | | /** | |
| * Sets the width of the Widget in pixels. | | * Sets the width of the Widget in pixels. | |
| * | | * | |
| * @param width the Widget width in pixels. | | * @param width the Widget width in pixels. | |
| */ | | */ | |
| virtual void setWidth(int width); | | virtual void setWidth(int width); | |
| | | | |
| /** | | /** | |
| * Gets the width of the Widget in pixels. | | * Gets the width of the Widget in pixels. | |
| | | | |
| skipping to change at line 284 | | skipping to change at line 288 | |
| /** | | /** | |
| * Checks if a Widget is disabled or not. | | * Checks if a Widget is disabled or not. | |
| * | | * | |
| * @return true if the Widget should be enabled. | | * @return true if the Widget should be enabled. | |
| */ | | */ | |
| virtual bool isEnabled() const; | | virtual bool isEnabled() const; | |
| | | | |
| /** | | /** | |
| * Called if the Widget looses focus. | | * Called if the Widget looses focus. | |
| */ | | */ | |
|
| virtual void lostFocus() { }; | | virtual void focusLost() { }; | |
| | | | |
| /** | | /** | |
| * Called if the Widget recieves focus. | | * Called if the Widget recieves focus. | |
| */ | | */ | |
|
| virtual void gotFocus() { }; | | virtual void focusGained() { }; | |
| | | | |
| /** | | | |
| * Checks if the Widget has the mouse. | | | |
| * | | | |
| * @return true if the Widget has the mouse. | | | |
| */ | | | |
| virtual bool hasMouse() const; | | | |
| | | | |
| /** | | /** | |
| * Sets the Widget to be visible. | | * Sets the Widget to be visible. | |
| * | | * | |
| * @param visible true if the Widget should be visiable. | | * @param visible true if the Widget should be visiable. | |
| */ | | */ | |
| virtual void setVisible(bool visible); | | virtual void setVisible(bool visible); | |
| | | | |
| /** | | /** | |
| * Checks if the Widget is visible. | | * Checks if the Widget is visible. | |
| | | | |
| skipping to change at line 356 | | skipping to change at line 353 | |
| virtual void setBackgroundColor(const Color& color); | | virtual void setBackgroundColor(const Color& color); | |
| | | | |
| /** | | /** | |
| * Gets the background color. | | * Gets the background color. | |
| * | | * | |
| * @return the background Color. | | * @return the background Color. | |
| */ | | */ | |
| virtual const Color& getBackgroundColor() const; | | virtual const Color& getBackgroundColor() const; | |
| | | | |
| /** | | /** | |
|
| * Called when a Widget recieves a MouseInput. | | | |
| * | | | |
| * WARNING: This function is used internally to handle all mouse | | | |
| * messages. Don't call or overload it unless you know wha | | | |
| t | | | |
| * you are doing. | | | |
| * | | | |
| * @param mouseInput the MouseInput message. | | | |
| */ | | | |
| virtual void _mouseInputMessage(const MouseInput& mouseInput); | | | |
| | | | |
| /** | | | |
| * Called when a Widget recieves a KeyInput. | | | |
| * | | | |
| * WARNING: This function is used internally to handle all key | | | |
| * messages. Don't call or overload it unless you know wha | | | |
| t | | | |
| * you are doing. | | | |
| * | | | |
| * @param keyInput the KeyInput message. | | | |
| */ | | | |
| virtual void _keyInputMessage(const KeyInput& keyInput); | | | |
| | | | |
| /** | | | |
| * Called when the mouse enters the Widget area. | | | |
| * | | | |
| * WARNING: This function is used internally to handle mouse in | | | |
| * messages. Don't call or overload this function unless | | | |
| * you know what you are doing. | | | |
| */ | | | |
| virtual void _mouseInMessage(); | | | |
| | | | |
| /** | | | |
| * Called when the mouse leaves the Widget area. | | | |
| * | | | |
| * WARNING: This function is used internally be to handle mouse | | | |
| * out messages. Don't call or overload this function | | | |
| * unless you know what you are doing. | | | |
| */ | | | |
| virtual void _mouseOutMessage(); | | | |
| | | | |
| /** | | | |
| * 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(); | |
| | | | |
| | | | |
| skipping to change at line 447 | | skipping to change at line 404 | |
| * | | * | |
| * @param actionListener the ActionListener to add. | | * @param actionListener the ActionListener to add. | |
| */ | | */ | |
| virtual void addActionListener(ActionListener* actionListener); | | virtual void addActionListener(ActionListener* actionListener); | |
| | | | |
| /** | | /** | |
| * Removes an added ActionListener from the Widget. | | * Removes an added ActionListener from the Widget. | |
| * | | * | |
| * @param actionListener the ActionListener to remove. | | * @param actionListener the ActionListener to remove. | |
| */ | | */ | |
|
| virtual void removeActionListener(ActionListener* actionListener | | virtual void removeActionListener(ActionListener* actionListener); | |
| ); | | | |
| | | /** | |
| | | * Adds a DeathListener to the Widget. When the widget dies | |
| | | * the death function in all the Widget's DeathListeners will be ca | |
| | | lled. | |
| | | * | |
| | | * @param actionListener the DeathListener to add. | |
| | | */ | |
| | | virtual void addDeathListener(DeathListener* deathListener); | |
| | | | |
| | | /** | |
| | | * Removes an added DeathListener from the Widget. | |
| | | * | |
| | | * @param deathListener the DeathListener to remove. | |
| | | */ | |
| | | virtual void removeDeathListener(DeathListener* deathListener); | |
| | | | |
| /** | | /** | |
| * Adds a MouseListener to the Widget. When a mouse message is | | * Adds a MouseListener to the Widget. When a mouse message is | |
| * recieved, it will be sent to the Widget's MouseListeners. | | * recieved, it will be sent to the Widget's MouseListeners. | |
| * | | * | |
| * @param mouseListener the MouseListener to add. | | * @param mouseListener the MouseListener to add. | |
| */ | | */ | |
|
| virtual void addMouseListener(MouseListener* mouseListener); | | virtual void addMouseListener(MouseListener* mouseListener); | |
| | | | |
| /** | | /** | |
| * Removes an added MouseListener from the Widget. | | * Removes an added MouseListener from the Widget. | |
| * | | * | |
| * @param mouseListener the MouseListener to remove. | | * @param mouseListener the MouseListener to remove. | |
| */ | | */ | |
|
| virtual void removeMouseListener(MouseListener* mouseListener); | | virtual void removeMouseListener(MouseListener* mouseListener); | |
| | | | |
| /** | | /** | |
| * Adds a KeyListener to the Widget. When a key message is recieved
, | | * Adds a KeyListener to the Widget. When a key message is recieved
, | |
| * it will be sent to the Widget's KeyListeners. | | * it will be sent to the Widget's KeyListeners. | |
| * | | * | |
| * @param keyListener the KeyListener to add. | | * @param keyListener the KeyListener to add. | |
| */ | | */ | |
|
| virtual void addKeyListener(KeyListener* keyListener); | | virtual void addKeyListener(KeyListener* keyListener); | |
| | | | |
| /** | | /** | |
| * Removes an added KeyListener from the Widget. | | * Removes an added KeyListener from the Widget. | |
| * | | * | |
| * @param keyListener the KeyListener to remove. | | * @param keyListener the KeyListener to remove. | |
| */ | | */ | |
|
| virtual void removeKeyListener(KeyListener* keyListener); | | virtual void removeKeyListener(KeyListener* keyListener); | |
| | | | |
| /** | | /** | |
|
| * Sets the event identifier of the Widget. The event identifier is | | * Sets the action event identifier of the Widget. The identifier i | |
| * used to be able to identify which Widget generated an action whe | | s | |
| n | | * used to be able to identify which action has occured. | |
| * an action has occured. | | | |
| * | | * | |
|
| * NOTE: An event identifier should not be used to identify a certa | | * NOTE: An action event identifier should not be used to identify | |
| in | | a | |
| * Widget but rather a certain event in your application. Sev | | * certain Widget but rather a certain event in your applicat | |
| eral | | ion. | |
| * Widgets can have the same event identifer. | | * Several Widgets can have the same action event identifer. | |
| * | | * | |
|
| * @param eventId the event identifier. | | * @param actionEventId the action event identifier. | |
| | | * @since 0.6.0 | |
| */ | | */ | |
|
| virtual void setEventId(const std::string& eventId); | | virtual void setActionEventId(const std::string& actionEventId); | |
| | | | |
| /** | | /** | |
|
| * Gets the event identifier. | | * Gets the action event identifier. | |
| * | | * | |
|
| * @return the event identifier. | | * @return the action event identifier. | |
| */ | | */ | |
|
| virtual const std::string& getEventId() const; | | virtual 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 absolute x coordinate will be stored in this parameter. | |
| * @param y absolute y coordinate will be stored in this parameter. | | * @param y absolute y coordinate will be stored in this parameter. | |
| */ | | */ | |
|
| 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 BasicContainer.. | |
| */ | | */ | |
|
| virtual void _setParent(BasicContainer* parent); | | virtual void _setParent(Widget* parent); | |
| | | | |
| /** | | /** | |
| * Gets the font used. If no font has been set, the global font wil
l | | * Gets the font used. If no font has been set, the global font wil
l | |
| * be returned instead. If no global font has been set, the default | | * be returned instead. If no global font has been set, the default | |
| * font will be returend. | | * font will be returend. | |
| * ugly default. | | * ugly default. | |
| * | | * | |
| * @return the used Font. | | * @return the used Font. | |
| */ | | */ | |
| Font *getFont() const; | | Font *getFont() const; | |
| | | | |
| skipping to change at line 598 | | skipping to change at line 570 | |
| * 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. | |
| */ | | */ | |
| virtual void setTabOutEnabled(bool enabled); | | virtual void setTabOutEnabled(bool enabled); | |
| | | | |
| /** | | /** | |
|
| * Checks if the Widget is dragged. Dragged means that the mouse | | * Requests modal focus. When a widget has modal focus, only that | |
| * button has been pressed down over the Widget and the mouse has | | * widget and it's children may recieve input. | |
| * been moved. | | | |
| * | | * | |
|
| * @return true if the widget is dragged. | | * @throws Exception if another widget already has modal focus. | |
| */ | | */ | |
|
| virtual bool isDragged() const; | | virtual void requestModalFocus(); | |
| | | | |
| /** | | /** | |
|
| * Requests modal focus. When a widget has modal focus, only that | | * Requests modal mouse input focus. When a widget has modal input | |
| * Widget and it's children may recieve input. If some other Widget | | focus | |
| * already has modal focus, an exception will be thrown. | | * that widget will be the only widget receiving input even if the | |
| | | input | |
| | | * occurs outside of the widget and no matter what the input is. | |
| * | | * | |
|
| * @throws Exception if another Widget already has modal focus. | | * @throws Exception if another widget already has modal focus. | |
| | | * @since 0.6.0 | |
| */ | | */ | |
|
| virtual void requestModalFocus(); | | 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 the modal focus. | | * widget has modal focus. | |
| */ | | */ | |
| virtual void releaseModalFocus(); | | virtual void releaseModalFocus(); | |
| | | | |
| /** | | /** | |
|
| * Checks if the Widget or it's parent has modal focus. | | * Releases modal mouse input focus. Modal mouse input focus will o | |
| | | nly | |
| | | * be released if the widget has modal mouse input focus. | |
| | | * | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual void releaseModalMouseInputFocus(); | |
| | | | |
| | | /** | |
| | | * Checks if the widget or it's parent has modal focus. | |
| */ | | */ | |
| virtual bool hasModalFocus() const; | | virtual bool hasModalFocus() const; | |
| | | | |
|
| | | /** | |
| | | * Checks if the widget or it's parent has modal mouse input focus. | |
| | | * | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual bool hasModalMouseInputFocus() const; | |
| | | | |
| | | /** | |
| | | * Gets a widget from a certain position in the widget. | |
| | | * This function is used to decide which gets mouse input, | |
| | | * thus it can be overloaded to change that behaviour. | |
| | | * | |
| | | * NOTE: This always returns NULL if the widget is not | |
| | | * a container. | |
| | | * | |
| | | * @param x the x coordinate. | |
| | | * @param y the y coordinate. | |
| | | * @return the widget at the specified coodinate, or NULL | |
| | | * if no such widget exists. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual Widget *getWidgetAt(int x, int y); | |
| | | | |
| | | /** | |
| | | * Gets the mouse listeners of the widget. | |
| | | * | |
| | | * @return the mouse listeners of the widget. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual const std::list<MouseListener*>& _getMouseListeners(); | |
| | | | |
| | | /** | |
| | | * Gets the key listeners of the widget. | |
| | | * | |
| | | * @return the key listeners of the widget. | |
| | | * @since 0.6.0 | |
| | | */ | |
| | | virtual const std::list<KeyListener*>& _getKeyListeners(); | |
| | | | |
| | | /** | |
| | | * Gets the subarea of the widget that the children occupy. | |
| | | * | |
| | | * @return the subarea as a Rectangle. | |
| | | */ | |
| | | virtual Rectangle getChildrenArea(); | |
| | | | |
| | | /** | |
| | | * Gets the internal FocusHandler used. | |
| | | * | |
| | | * @return the internalFocusHandler used. If no internal FocusHandl | |
| | | er | |
| | | * is used, NULL will be returned. | |
| | | */ | |
| | | virtual FocusHandler* _getInternalFocusHandler(); | |
| | | | |
| | | /** | |
| | | * Sets the internal FocusHandler. An internal focushandler is | |
| | | * needed if both a widget in the widget and the widget itself | |
| | | * should be foucsed at the same time. | |
| | | * | |
| | | * @param focusHandler the FocusHandler to be used. | |
| | | */ | |
| | | virtual void setInternalFocusHandler(FocusHandler* focusHandler); | |
| | | | |
| | | /** | |
| | | * Moves a Widget to the top of this widget. The moved widget will | |
| | | be | |
| | | * drawn above all other widgets in this widget. | |
| | | * | |
| | | * @param widget the Widget to move. | |
| | | */ | |
| | | virtual void moveToTop(Widget* 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. | |
| | | * | |
| | | * @param widget the Widget to move. | |
| | | */ | |
| | | virtual void moveToBottom(Widget* widget) { }; | |
| | | | |
| | | /** | |
| | | * Focuses the next Widget in the widget. | |
| | | */ | |
| | | virtual void focusNext() { }; | |
| | | | |
| | | /** | |
| | | * Focuses the previous Widget in the widget. | |
| | | */ | |
| | | virtual void focusPrevious() { }; | |
| | | | |
| | | /** | |
| | | * Tries to show a specific part of a Widget by moving it. Used if | |
| | | the | |
| | | * widget should act as a container. | |
| | | * | |
| | | * @param widget the target Widget. | |
| | | * @param area the area to show. | |
| | | */ | |
| | | virtual void showWidgetPart(Widget* widget, Rectangle area) { }; | |
| | | | |
| protected: | | protected: | |
| /** | | /** | |
| * Generates an action to the Widget's ActionListeners. | | * Generates an action to the Widget's ActionListeners. | |
| */ | | */ | |
| void generateAction(); | | void generateAction(); | |
| | | | |
| typedef std::list<MouseListener*> MouseListenerList; | | typedef std::list<MouseListener*> MouseListenerList; | |
|
| MouseListenerList mMouseListeners; | | | |
| typedef MouseListenerList::iterator MouseListenerIterator; | | typedef MouseListenerList::iterator MouseListenerIterator; | |
|
| | | MouseListenerList mMouseListeners; | |
| | | | |
| typedef std::list<KeyListener*> KeyListenerList; | | typedef std::list<KeyListener*> KeyListenerList; | |
| KeyListenerList mKeyListeners; | | KeyListenerList mKeyListeners; | |
| typedef KeyListenerList::iterator KeyListenerIterator; | | typedef KeyListenerList::iterator KeyListenerIterator; | |
| | | | |
| typedef std::list<ActionListener*> ActionListenerList; | | typedef std::list<ActionListener*> ActionListenerList; | |
| ActionListenerList mActionListeners; | | ActionListenerList mActionListeners; | |
| typedef ActionListenerList::iterator ActionListenerIterator; | | typedef ActionListenerList::iterator ActionListenerIterator; | |
| | | | |
|
| | | typedef std::list<DeathListener*> DeathListenerList; | |
| | | DeathListenerList mDeathListeners; | |
| | | typedef DeathListenerList::iterator DeathListenerIterator; | |
| | | | |
| Color mForegroundColor; | | Color mForegroundColor; | |
| Color mBackgroundColor; | | Color mBackgroundColor; | |
| Color mBaseColor; | | Color mBaseColor; | |
| FocusHandler* mFocusHandler; | | FocusHandler* mFocusHandler; | |
|
| BasicContainer* mParent; | | FocusHandler* mInternalFocusHandler; | |
| | | Widget* mParent; | |
| Rectangle mDimension; | | Rectangle mDimension; | |
| unsigned int mBorderSize; | | unsigned int mBorderSize; | |
|
| std::string mEventId; | | std::string mActionEventId; | |
| int mClickTimeStamp; | | | |
| int mClickCount; | | | |
| int mClickButton; | | | |
| bool mHasMouse; | | | |
| bool mFocusable; | | bool mFocusable; | |
| bool mVisible; | | bool mVisible; | |
| bool mTabIn; | | bool mTabIn; | |
| bool mTabOut; | | bool mTabOut; | |
| bool mEnabled; | | bool mEnabled; | |
| | | | |
| Font* mCurrentFont; | | Font* mCurrentFont; | |
| static DefaultFont mDefaultFont; | | static DefaultFont mDefaultFont; | |
| static Font* mGlobalFont; | | static Font* mGlobalFont; | |
| static std::list<Widget*> mWidgets; | | static std::list<Widget*> mWidgets; | |
| | | | |
End of changes. 35 change blocks. |
| 95 lines changed or deleted | | 179 lines changed or added | |
|