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-2013 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 {
62  class _OgreExport WindowEventListener
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 
122  class _OgreExport WindowEventUtilities
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
OgreHeaderSuffix.h
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::WindowEventListener::windowResized
virtual void windowResized(RenderWindow *rw)
Definition: OgreWindowEventUtilities.h:82
Ogre::RenderWindow
Manages the target rendering window.
Definition: OgreRenderWindow.h:62
Ogre::WindowEventListener::windowClosing
virtual bool windowClosing(RenderWindow *rw)
Definition: OgreWindowEventUtilities.h:92
Ogre::WindowEventUtilities::WindowEventListeners
multimap< RenderWindow *, WindowEventListener * >::type WindowEventListeners
Definition: OgreWindowEventUtilities.h:181
OgreHeaderPrefix.h
OgrePrerequisites.h
Ogre::RenderWindowList
vector< RenderWindow * >::type RenderWindowList
Render window container.
Definition: OgreCommon.h:764
Ogre::WindowEventUtilities
Definition: OgreWindowEventUtilities.h:122
OgreCommon.h
Ogre::WindowEventUtilities::_msWindows
static RenderWindowList _msWindows
Definition: OgreWindowEventUtilities.h:183
Ogre::multimap::type
std::multimap< K, V, P, A > type
Definition: OgrePrerequisites.h:550
Ogre::WindowEventListener::windowClosed
virtual void windowClosed(RenderWindow *rw)
Definition: OgreWindowEventUtilities.h:105
Ogre::WindowEventListener::~WindowEventListener
virtual ~WindowEventListener()
Definition: OgreWindowEventUtilities.h:65
Ogre::WindowEventListener
Definition: OgreWindowEventUtilities.h:62
OgrePlatform.h
Ogre::WindowEventListener::windowFocusChange
virtual void windowFocusChange(RenderWindow *rw)
Definition: OgreWindowEventUtilities.h:114
Ogre::WindowEventUtilities::_msListeners
static WindowEventListeners _msListeners
Definition: OgreWindowEventUtilities.h:182
Ogre::WindowEventListener::windowMoved
virtual void windowMoved(RenderWindow *rw)
Definition: OgreWindowEventUtilities.h:73

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Tue Apr 13 2021 08:53:15