win32WindowMgr.h
Engine/source/windowManager/win32/win32WindowMgr.h
Classes:
class
Win32 implementation of the window manager interface.
class
Internal structure used when enumerating monitors.
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 _WINDOWMANAGER_WIN32_WIN32WINDOWMANAGER_ 25#define _WINDOWMANAGER_WIN32_WIN32WINDOWMANAGER_ 26 27#include <windows.h> 28 29#include "math/mMath.h" 30#include "gfx/gfxStructs.h" 31#include "windowManager/win32/win32Window.h" 32#include "core/util/tVector.h" 33 34/// Win32 implementation of the window manager interface. 35class Win32WindowManager : public PlatformWindowManager 36{ 37 friend class Win32Window; 38 39 virtual void _processCmdLineArgs(const S32 argc, const char **argv); 40 41 /// Link the specified window into the window list. 42 void linkWindow(Win32Window *w); 43 44 /// Remove specified window from the window list. 45 void unlinkWindow(Win32Window *w); 46 47 /// Callback for the process list. 48 void _process(); 49 50 /// List of allocated windows. 51 Win32Window *mWindowListHead; 52 53 /// Parent window, used in window setup in web plugin scenarios. 54 HWND mParentWindow; 55 56 /// set via command line -offscreen option, controls whether rendering/input 57 // is intended for offscreen rendering 58 bool mOffscreenRender; 59 60 /// This is set as part of the canvas being shown, and flags that the windows should render as normal from now on. 61 // Basically a flag that lets the window manager know that we've handled the splash screen, and to operate as normal. 62 bool mDisplayWindow; 63 64 /// Internal structure used when enumerating monitors 65 struct MonitorInfo { 66 HMONITOR monitorHandle; 67 RectI region; 68 String name; 69 }; 70 71 /// Array of enumerated monitors 72 Vector<MonitorInfo> mMonitors; 73 74 /// Callback to receive information about available monitors. 75 static BOOL CALLBACK MonitorEnumProc( 76 HMONITOR hMonitor, // handle to display monitor 77 HDC hdcMonitor, // handle to monitor DC 78 LPRECT lprcMonitor, // monitor intersection rectangle 79 LPARAM dwData // data 80 ); 81 82 /// Callback to receive information about available monitor regions 83 static BOOL CALLBACK MonitorRegionEnumProc( 84 HMONITOR hMonitor, // handle to display monitor 85 HDC hdcMonitor, // handle to monitor DC 86 LPRECT lprcMonitor, // monitor intersection rectangle 87 LPARAM dwData // data 88 ); 89 90 /// If a curtain window is present, then its HWND will be stored here. 91 HWND mCurtainWindow; 92 93 SignalSlot<void()> mOnProcessSignalSlot; 94 95public: 96 Win32WindowManager(); 97 ~Win32WindowManager(); 98 99 virtual RectI getPrimaryDesktopArea(); 100 virtual S32 getDesktopBitDepth(); 101 virtual Point2I getDesktopResolution(); 102 103 /// Build out the monitors list. Also used to rebuild the list after 104 /// a WM_DISPLAYCHANGE message. 105 virtual void buildMonitorsList(); 106 107 virtual S32 findFirstMatchingMonitor(const char* name); 108 virtual U32 getMonitorCount(); 109 virtual const char* getMonitorName(U32 index); 110 virtual RectI getMonitorRect(U32 index); 111 112 virtual void getMonitorRegions(Vector<RectI> ®ions); 113 virtual PlatformWindow *createWindow(GFXDevice *device, const GFXVideoMode &mode); 114 virtual void getWindows(VectorPtr<PlatformWindow*> &windows); 115 116 virtual void setParentWindow(void* newParent); 117 virtual void* getParentWindow(); 118 119 virtual PlatformWindow *getWindowById(WindowId id); 120 virtual PlatformWindow *getFirstWindow(); 121 virtual PlatformWindow* getFocusedWindow(); 122 123 virtual void lowerCurtain(); 124 virtual void raiseCurtain(); 125 126 virtual void setDisplayWindow(bool set) { mDisplayWindow = set; } 127}; 128 129#endif 130