OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreWindowEventUtilities.h
Go to the documentation of this file.
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-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __OgreWindowEventUtils_H__
29 #define __OgreWindowEventUtils_H__
30 
31 #include "OgrePrerequisites.h"
32 #include "OgrePlatform.h"
33 #include "OgreCommon.h"
34 #include "OgreHeaderPrefix.h"
35 
36 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
37 # if !defined(WIN32_LEAN_AND_MEAN)
38 # define WIN32_LEAN_AND_MEAN
39 # endif
40 # if !defined(NOMINMAX) && defined(_MSC_VER)
41 # define NOMINMAX // required to stop windows.h messing up std::min
42 # endif
43 # include <windows.h>
44 #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE && !defined(__LP64__)
45 # include <Carbon/Carbon.h>
46 #endif
47 
48 
49 
50 namespace Ogre
51 {
63  {
64  public:
65  virtual ~WindowEventListener() {}
66 
73  virtual void windowMoved(RenderWindow* rw)
74  { (void)rw; }
75 
82  virtual void windowResized(RenderWindow* rw)
83  { (void)rw; }
84 
92  virtual bool windowClosing(RenderWindow* rw)
93  { (void)rw; return true; }
94 
105  virtual void windowClosed(RenderWindow* rw)
106  { (void)rw; }
107 
114  virtual void windowFocusChange(RenderWindow* rw)
115  { (void)rw; }
116  };
117 
123  {
124  public:
130  static void messagePump();
131 
142  static void addWindowEventListener( RenderWindow* window, WindowEventListener* listener );
143 
152  static void removeWindowEventListener( RenderWindow* window, WindowEventListener* listener );
153 
161  static void _addRenderWindow(RenderWindow* window);
162 
170  static void _removeRenderWindow(RenderWindow* window);
171 
172 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
173  static LRESULT CALLBACK _WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
175 #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE && !defined __OBJC__ && !defined(__LP64__)
176  static OSStatus _CarbonWindowHandler(EventHandlerCallRef nextHandler, EventRef event, void* wnd);
178 #endif
179 
180  //These are public only so GLXProc can access them without adding Xlib headers header
184  };
187 }
188 
189 #include "OgreHeaderSuffix.h"
190 
191 #endif
Manages the target rendering window.
#define _OgreExport
Definition: OgrePlatform.h:255
std::multimap< K, V, P, A > type
virtual void windowClosed(RenderWindow *rw)
static WindowEventListeners _msListeners
virtual void windowMoved(RenderWindow *rw)
vector< RenderWindow * >::type RenderWindowList
Render window container.
Definition: OgreCommon.h:794
virtual void windowResized(RenderWindow *rw)
multimap< RenderWindow *, WindowEventListener * >::type WindowEventListeners
virtual void windowFocusChange(RenderWindow *rw)
virtual bool windowClosing(RenderWindow *rw)
static RenderWindowList _msWindows