OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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-2011 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 
34 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
35 # define WIN32_LEAN_AND_MEAN
36 # if !defined(NOMINMAX) && defined(_MSC_VER)
37 # define NOMINMAX // required to stop windows.h messing up std::min
38 # endif
39 # include <windows.h>
40 #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE && !defined(__LP64__)
41 # include <Carbon/Carbon.h>
42 #endif
43 
44 
45 
46 namespace Ogre
47 {
59  {
60  public:
61  virtual ~WindowEventListener() {}
62 
69  virtual void windowMoved(RenderWindow* rw)
70  { (void)rw; }
71 
78  virtual void windowResized(RenderWindow* rw)
79  { (void)rw; }
80 
88  virtual bool windowClosing(RenderWindow* rw)
89  { (void)rw; return true; }
90 
101  virtual void windowClosed(RenderWindow* rw)
102  { (void)rw; }
103 
110  virtual void windowFocusChange(RenderWindow* rw)
111  { (void)rw; }
112  };
113 
119  {
120  public:
126  static void messagePump();
127 
138  static void addWindowEventListener( RenderWindow* window, WindowEventListener* listener );
139 
148  static void removeWindowEventListener( RenderWindow* window, WindowEventListener* listener );
149 
157  static void _addRenderWindow(RenderWindow* window);
158 
166  static void _removeRenderWindow(RenderWindow* window);
167 
168 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
169  static LRESULT CALLBACK _WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
171 #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE && !defined __OBJC__ && !defined(__LP64__)
172  static OSStatus _CarbonWindowHandler(EventHandlerCallRef nextHandler, EventRef event, void* wnd);
174 #endif
175 
176  //These are public only so GLXProc can access them without adding Xlib headers header
179 
182  };
185 }
186 #endif
Manages the target rendering window.
Utility class to handle Window Events/Pumping/Messages
#define _OgreExport
Definition: OgrePlatform.h:203
std::multimap< K, V, P, A > type
std::vector< T, A > type
virtual void windowClosed(RenderWindow *rw)
Window has been closed (Only triggered if user pressed the [X] button)
static WindowEventListeners _msListeners
virtual void windowMoved(RenderWindow *rw)
Window has moved position
virtual void windowResized(RenderWindow *rw)
Window has resized
multimap< RenderWindow *, WindowEventListener * >::type WindowEventListeners
virtual void windowFocusChange(RenderWindow *rw)
Window has lost/gained focus
Callback class used to send out window events to client app
virtual bool windowClosing(RenderWindow *rw)
Window is closing (Only triggered if user pressed the [X] button)
vector< RenderWindow * >::type Windows