[1030] | 1 | /*
|
---|
| 2 | -----------------------------------------------------------------------------
|
---|
| 3 | This source file is part of OGRE
|
---|
| 4 | (Object-oriented Graphics Rendering Engine)
|
---|
| 5 | For the latest info, see http://www.ogre3d.org/
|
---|
| 6 |
|
---|
| 7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
| 8 | Also see acknowledgements in Readme.html
|
---|
| 9 |
|
---|
| 10 | This program is free software; you can redistribute it and/or modify it under
|
---|
| 11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
| 12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
| 13 | version.
|
---|
| 14 |
|
---|
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
| 16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
| 17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
| 18 |
|
---|
| 19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
| 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
| 21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
| 22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
| 23 | -----------------------------------------------------------------------------
|
---|
| 24 | */
|
---|
| 25 |
|
---|
| 26 | /***************************************************************************
|
---|
| 27 | OgreEventListeners.h -
|
---|
| 28 | This file contains definatitions of all the different EventListeners.
|
---|
| 29 | They are all included in 1 file, due to their small size.
|
---|
| 30 |
|
---|
| 31 | They all inherit from an abstract base listener called EventListener.
|
---|
| 32 |
|
---|
| 33 | So far we have the following listeners:
|
---|
| 34 | MouseListener - handles mouse buttons clicked, pressed released,
|
---|
| 35 | and mouse entered,exited,
|
---|
| 36 | MouseMotionListener - handles mouse move and mouse drag
|
---|
| 37 | ActionListener - Used for buttons, when pressed and released.
|
---|
| 38 |
|
---|
| 39 | -------------------
|
---|
| 40 | begin : Nov 19 2002
|
---|
| 41 | copyright : (C) 2002 by Kenny Sabir
|
---|
| 42 | email : kenny@sparksuit.com
|
---|
| 43 | ***************************************************************************/
|
---|
| 44 |
|
---|
| 45 | #ifndef __MouseListener_H__
|
---|
| 46 | #define __MouseListener_H__
|
---|
| 47 |
|
---|
| 48 | #include "OgrePrerequisites.h"
|
---|
| 49 | #include "OgreMouseEvent.h"
|
---|
| 50 |
|
---|
| 51 | namespace Ogre {
|
---|
| 52 |
|
---|
| 53 | class _OgreExport EventListener
|
---|
| 54 | {
|
---|
| 55 | };
|
---|
| 56 |
|
---|
| 57 | /** Specialised EventListener for discrete mouse events.
|
---|
| 58 | @remarks
|
---|
| 59 | This excludes mouse motion (this is not a discrete event), see
|
---|
| 60 | MouseMotionListener for that.
|
---|
| 61 | */
|
---|
| 62 | class _OgreExport MouseListener : public EventListener
|
---|
| 63 | {
|
---|
| 64 | public :
|
---|
| 65 | /**
|
---|
| 66 | * Invoked when the mouse has been clicked on a component.
|
---|
| 67 | */
|
---|
| 68 | virtual void mouseClicked(MouseEvent* e) = 0;
|
---|
| 69 | /**
|
---|
| 70 | * Invoked when the mouse enters a component.
|
---|
| 71 | */
|
---|
| 72 | virtual void mouseEntered(MouseEvent* e) = 0;
|
---|
| 73 | /**
|
---|
| 74 | * Invoked when the mouse exits a component.
|
---|
| 75 | */
|
---|
| 76 | virtual void mouseExited(MouseEvent* e) = 0;
|
---|
| 77 |
|
---|
| 78 | /**
|
---|
| 79 | * Invoked when a mouse button has been pressed on a component.
|
---|
| 80 | */
|
---|
| 81 | virtual void mousePressed(MouseEvent* e) = 0;
|
---|
| 82 | /**
|
---|
| 83 | * Invoked when a mouse button has been released on a component.
|
---|
| 84 | */
|
---|
| 85 | virtual void mouseReleased(MouseEvent* e) = 0;
|
---|
| 86 |
|
---|
| 87 | virtual void mouseDragEntered(MouseEvent* e) {};
|
---|
| 88 | virtual void mouseDragExited(MouseEvent* e) {};
|
---|
| 89 | virtual void mouseDragDropped(MouseEvent* e) {};
|
---|
| 90 |
|
---|
| 91 | };
|
---|
| 92 |
|
---|
| 93 |
|
---|
| 94 | class _OgreExport KeyListener : public EventListener
|
---|
| 95 | {
|
---|
| 96 | protected:
|
---|
| 97 |
|
---|
| 98 | public :
|
---|
| 99 | /**
|
---|
| 100 | * Invoked when the key has been clicked on a component.
|
---|
| 101 | */
|
---|
| 102 | virtual void keyClicked(KeyEvent* e) = 0;
|
---|
| 103 | /**
|
---|
| 104 | * Invoked when a key button has been pressed on a component.
|
---|
| 105 | */
|
---|
| 106 | virtual void keyPressed(KeyEvent* e) = 0;
|
---|
| 107 | /**
|
---|
| 108 | * Invoked when a key button has been released on a component.
|
---|
| 109 | */
|
---|
| 110 | virtual void keyReleased(KeyEvent* e) = 0;
|
---|
| 111 | /**
|
---|
| 112 | * Invoked when the target receives the keyboard focus
|
---|
| 113 | */
|
---|
| 114 | virtual void keyFocusIn(KeyEvent* e) {}
|
---|
| 115 | /**
|
---|
| 116 | * Invoked when the target loses the keyboard focus
|
---|
| 117 | */
|
---|
| 118 | virtual void keyFocusOut(KeyEvent* e) {}
|
---|
| 119 |
|
---|
| 120 | };
|
---|
| 121 |
|
---|
| 122 | /** Specialised EventListener for mouse motion. */
|
---|
| 123 | class _OgreExport MouseMotionListener : public EventListener
|
---|
| 124 | {
|
---|
| 125 | protected:
|
---|
| 126 |
|
---|
| 127 | public :
|
---|
| 128 | /**
|
---|
| 129 | * Invoked when the mouse has been moved
|
---|
| 130 | */
|
---|
| 131 | virtual void mouseMoved(MouseEvent* e) = 0;
|
---|
| 132 | /**
|
---|
| 133 | * Invoked when the mouse dragged
|
---|
| 134 | */
|
---|
| 135 | virtual void mouseDragged(MouseEvent* e) = 0;
|
---|
| 136 | /**
|
---|
| 137 | * sent to target
|
---|
| 138 | */
|
---|
| 139 | virtual void mouseDragMoved(MouseEvent* e) {};
|
---|
| 140 | };
|
---|
| 141 |
|
---|
| 142 |
|
---|
| 143 |
|
---|
| 144 | }
|
---|
| 145 |
|
---|
| 146 |
|
---|
| 147 | #endif // __MouseListener_H__
|
---|