macWindowManager.h
Engine/source/windowManager/mac/macWindowManager.h
Classes:
class
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _MACWINDOWMANAGER_H_ 25#define _MACWINDOWMANAGER_H_ 26 27#include "windowManager/platformWindowMgr.h" 28#include "core/util/tVector.h" 29 30class MacWindow; 31 32class MacWindowManager : public PlatformWindowManager 33{ 34private: 35 typedef VectorPtr<MacWindow*> WindowList; 36 WindowList mWindowList; 37 U32 mFadeToken; 38 Delegate<bool(void)> mNotifyShutdownDelegate; 39 40public: 41 MacWindowManager(); 42 ~MacWindowManager(); 43 44 virtual void setParentWindow(void* newParent) { 45 } 46 47 /// Get the parent window 48 virtual void* getParentWindow() 49 { 50 return NULL; 51 } 52 53 virtual PlatformWindow *createWindow(GFXDevice *device, const GFXVideoMode &mode); 54 55 /// @name Desktop Queries 56 /// @{ 57 58 /// Return the extents in window coordinates of the primary desktop 59 /// area. On a single monitor system this is just the display extents. 60 /// On a multi-monitor system this is the primary monitor (which Torque should 61 /// launch on). 62 virtual RectI getPrimaryDesktopArea(); 63 64 /// Populate a vector with all monitors and their extents in window space. 65 virtual void getMonitorRegions(Vector<RectI> ®ions); 66 67 /// Retrieve the currently set desktop bit depth 68 /// @return The current desktop bit depth, or -1 if an error occurred 69 virtual S32 getDesktopBitDepth(); 70 71 /// Retrieve the currently set desktop resolution 72 /// @return The current desktop bit depth, or Point2I(-1,-1) if an error occurred 73 virtual Point2I getDesktopResolution(); 74 75 /// @} 76 77 /// @name Window Lookup 78 /// @{ 79 80 /// Get the number of Window's in this system 81 virtual S32 getWindowCount(); 82 83 /// Populate a list with references to all the windows created from this manager. 84 virtual void getWindows(VectorPtr<PlatformWindow*> &windows); 85 86 /// Get a window from a device ID. 87 /// 88 /// @return The window associated with the specified ID, or NULL if no 89 /// match was found. 90 virtual PlatformWindow *getWindowById(WindowId id); 91 92 virtual PlatformWindow *getFirstWindow(); 93 virtual PlatformWindow* getFocusedWindow(); 94 95 /// During full-screen toggles we want to suppress ugly transition states, 96 /// which we do (on Win32) by showing and hiding a full-monitor black window. 97 /// 98 /// This method cues the appearance of that window ("lowering the curtain"). 99 virtual void lowerCurtain(); 100 101 /// @see lowerCurtain 102 /// 103 /// This method removes the curtain window. 104 virtual void raiseCurtain(); 105 106 /// @} 107 /// @name Command Line Usage 108 /// @{ 109 110 /// Process command line arguments sent to this window manager 111 /// to manipulate it's windows. 112 virtual void _processCmdLineArgs(const S32 argc, const char **argv); 113 114 /// @} 115 116 // static MacWindowManager* get() { return (MacWindowManager*)PlatformWindowManager::get(); } 117 void _addWindow(MacWindow* window); 118 void _removeWindow(MacWindow* window); 119 120 void _onAppSignal(WindowId wnd, S32 event); 121 122 bool onShutdown(); 123 bool canWindowGainFocus(MacWindow* window); 124 125 126private: 127 bool mIsShuttingDown; 128}; 129 130#endif 131