source: GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventListeners.h @ 1812

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