00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright (c) 2000-2005 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 00026 /*************************************************************************** 00027 OgreEventDispatcher.h - 00028 Handles the Dispatching of events to a EventTarget (mainly a PositionTarget for 00029 mouse moving). The EventTargets are managed by a target manager. 00030 00031 A EventDispatcher is needed for each TargetManager. ie 1 dispatcher for the OverlayManager, 00032 for managing the 2D GUI components, and another EventDispatcher for a SceneManager 00033 managing the 3D objects.(NOTE currently the SceneManager isn't a TargetManager.. this is a TODO). 00034 00035 ------------------- 00036 begin : Nov 19 2002 00037 copyright : (C) 2002 by Kenny Sabir 00038 email : kenny@sparksuit.com 00039 ***************************************************************************/ 00040 00041 00042 00043 #ifndef __EventDispatcher_H__ 00044 #define __EventDispatcher_H__ 00045 00046 #include "OgrePrerequisites.h" 00047 00048 namespace Ogre { 00049 00058 class _OgreExport EventDispatcher 00059 { 00060 protected: 00061 TargetManager* mTargetManager; 00062 00069 PositionTarget* mFocus; // isn't implemented yet 00070 00075 PositionTarget* mMouseDragSource; 00076 00080 PositionTarget* mKeyCursorOn; 00081 00085 PositionTarget* mTargetLastEntered; 00086 00091 Real mMouseX; 00092 Real mMouseY; 00093 00099 bool mDragging; // i.e. mouse grab 00100 00107 bool mDragDropOn; 00108 00112 bool mDragDropActive; 00113 00114 int mEventMask; 00115 00116 //------------------- 00117 // protected methods 00118 00119 bool processKeyEvent(KeyEvent* e) ; 00120 00129 bool processMouseEvent(MouseEvent* e) ; 00130 00140 void retargetMouseEvent(PositionTarget* target, MouseEvent* e) ; 00141 00151 void retargetMouseEvent(PositionTarget* target, int id, MouseEvent* e, bool consume = false) ; 00152 00158 void retargetKeyEvent(PositionTarget* target, int id, MouseEvent* e) ; 00159 00160 /* 00161 * Generates enter/exit events as mouse moves over lw PositionTargets 00162 * @param targetOver Target mouse is over (including native container) 00163 * @param e Mouse event in native container 00164 */ 00165 00166 void trackMouseEnterExit(PositionTarget* targetOver, MouseEvent* e) ; 00167 00168 /* 00169 * Generates FocusIn/FocusOut events as the keyboard focus changes. 00170 * @param targetOver Target mouse is over (including native container) 00171 * @param e Mouse event in native container 00172 */ 00173 void trackKeyEnterExit(PositionTarget* targetOver, MouseEvent* e); 00174 00175 public: 00176 EventDispatcher(TargetManager* pTargetManager); 00177 virtual ~EventDispatcher(); 00178 00186 bool dispatchEvent(InputEvent* e); 00187 00197 void setDragDrop(bool dragDropOn); 00198 00202 inline Real getMouseX() const { return mMouseX; } 00206 inline Real getMouseY() const { return mMouseY; } 00207 }; 00208 00209 } 00210 00211 00212 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:40 2006