CmWin32Window.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. #pragma once
  25. #include "CmWin32Prerequisites.h"
  26. #include "CmRenderWindow.h"
  27. namespace CamelotFramework
  28. {
  29. class CM_RSGL_EXPORT Win32Window : public RenderWindow
  30. {
  31. public:
  32. ~Win32Window();
  33. /**
  34. * @copydoc RenderWindow::setFullscreen
  35. */
  36. void setFullscreen(bool fullScreen, UINT32 width, UINT32 height);
  37. /**
  38. * @copydoc RenderWindow::setHidden
  39. */
  40. void setHidden(bool hidden);
  41. /**
  42. * @copydoc RenderWindow::isActive
  43. */
  44. bool isActive() const;
  45. /**
  46. * @copydoc RenderWindow::isVisible
  47. */
  48. bool isVisible() const;
  49. /**
  50. * @copydoc RenderWindow::isClosed
  51. */
  52. bool isClosed() const;
  53. /**
  54. * @copydoc RenderWindow::reposition
  55. */
  56. void move(INT32 left, INT32 top);
  57. /**
  58. * @copydoc RenderWindow::resize
  59. */
  60. void resize(UINT32 width, UINT32 height);
  61. /**
  62. * @copydoc RenderWindow::copyContentsToMemory
  63. */
  64. void copyToMemory(const PixelData &dst, FrameBuffer buffer);
  65. /**
  66. * @copydoc RenderWindow::swapBuffers
  67. */
  68. void swapBuffers();
  69. /**
  70. * @copydoc RenderWindow::requiresTextureFlipping
  71. */
  72. bool requiresTextureFlipping() const { return false; }
  73. /**
  74. * @copydoc RenderWindow::screenToWindowPos
  75. */
  76. Vector2I screenToWindowPos(const Vector2I& screenPos) const;
  77. /**
  78. * @copydoc RenderWindow::windowToScreenPos
  79. */
  80. Vector2I windowToScreenPos(const Vector2I& windowPos) const;
  81. /**
  82. * @copydoc RenderWindow::getCustomAttribute
  83. */
  84. void getCustomAttribute(const String& name, void* pData) const;
  85. /**
  86. * @copydoc RenderWindow::setActive
  87. */
  88. virtual void setActive( bool state );
  89. /**
  90. * @copydoc RenderWindow::_windowMovedOrResized
  91. */
  92. void _windowMovedOrResized(void);
  93. HWND _getWindowHandle() const { return mHWnd; }
  94. HDC _getHDC() const { return mHDC; }
  95. void _adjustWindow(unsigned int clientWidth, unsigned int clientHeight,
  96. unsigned int* winWidth, unsigned int* winHeight);
  97. protected:
  98. friend class GLRenderWindowManager;
  99. friend class Win32GLSupport;
  100. Win32Window(const RENDER_WINDOW_DESC& desc, Win32GLSupport &glsupport);
  101. Win32GLSupport &mGLSupport;
  102. HWND mHWnd; // Win32 Window handle
  103. HDC mHDC;
  104. HGLRC mGlrc;
  105. bool mIsExternal;
  106. char* mDeviceName;
  107. bool mIsExternalGLControl;
  108. bool mIsExternalGLContext;
  109. bool mSizing;
  110. bool mClosed;
  111. int mDisplayFrequency; // fullscreen only, to restore display
  112. Win32Context *mContext;
  113. /**
  114. * @copydoc RenderWindow::initialize_internal().
  115. */
  116. void initialize_internal();
  117. /**
  118. * @copydoc RenderWindow::destroy_internal().
  119. */
  120. void destroy_internal();
  121. };
  122. }