CmWin32Window.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. Copyright (c) 2000-2011 Torus Knot Software Ltd
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  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 FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. THE SOFTWARE.
  22. -----------------------------------------------------------------------------
  23. */
  24. #ifndef __Win32Window_H__
  25. #define __Win32Window_H__
  26. #include "CmWin32Prerequisites.h"
  27. #include "CmRenderWindow.h"
  28. namespace CamelotFramework {
  29. class CM_RSGL_EXPORT Win32Window : public RenderWindow
  30. {
  31. public:
  32. ~Win32Window();
  33. void setFullscreen(bool fullScreen, unsigned int width, unsigned int height);
  34. bool isActive(void) const;
  35. bool isVisible() const;
  36. bool isClosed(void) const;
  37. void reposition(int left, int top);
  38. void resize(unsigned int width, unsigned int height);
  39. /** Overridden - see RenderTarget. */
  40. virtual void copyContentsToMemory(const PixelData &dst, FrameBuffer buffer);
  41. void swapBuffers();
  42. bool requiresTextureFlipping() const { return false; }
  43. HWND getWindowHandle() const { return mHWnd; }
  44. HDC getHDC() const { return mHDC; }
  45. // Method for dealing with resize / move & 3d library
  46. virtual void windowMovedOrResized(void);
  47. void getCustomAttribute( const String& name, void* pData ) const;
  48. /** Used to set the active state of the render target.
  49. */
  50. virtual void setActive( bool state );
  51. void adjustWindow(unsigned int clientWidth, unsigned int clientHeight,
  52. unsigned int* winWidth, unsigned int* winHeight);
  53. protected:
  54. friend class GLRenderWindowManager;
  55. friend class Win32GLSupport;
  56. Win32Window(const RENDER_WINDOW_DESC& desc, Win32GLSupport &glsupport);
  57. Win32GLSupport &mGLSupport;
  58. HWND mHWnd; // Win32 Window handle
  59. HDC mHDC;
  60. HGLRC mGlrc;
  61. bool mIsExternal;
  62. char* mDeviceName;
  63. bool mIsExternalGLControl;
  64. bool mIsExternalGLContext;
  65. bool mSizing;
  66. bool mClosed;
  67. int mDisplayFrequency; // fullscreen only, to restore display
  68. Win32Context *mContext;
  69. /**
  70. * @copydoc RenderWindow::initialize_internal().
  71. */
  72. void initialize_internal();
  73. /**
  74. * @copydoc RenderWindow::destroy_internal().
  75. */
  76. void destroy_internal();
  77. };
  78. }
  79. #endif