/src/gui/kernel/qplatformwindowformat_qpa.h

https://bitbucket.org/ultra_iter/qt-vtl · C Header · 234 lines · 151 code · 43 blank · 40 comment · 0 complexity · 1c517d0a716adafdd31ae4ef11f17ae3 MD5 · raw file

  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
  4. ** All rights reserved.
  5. ** Contact: Nokia Corporation (qt-info@nokia.com)
  6. **
  7. ** This file is part of the QtGui module of the Qt Toolkit.
  8. **
  9. ** $QT_BEGIN_LICENSE:LGPL$
  10. ** GNU Lesser General Public License Usage
  11. ** This file may be used under the terms of the GNU Lesser General Public
  12. ** License version 2.1 as published by the Free Software Foundation and
  13. ** appearing in the file LICENSE.LGPL included in the packaging of this
  14. ** file. Please review the following information to ensure the GNU Lesser
  15. ** General Public License version 2.1 requirements will be met:
  16. ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
  17. **
  18. ** In addition, as a special exception, Nokia gives you certain additional
  19. ** rights. These rights are described in the Nokia Qt LGPL Exception
  20. ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
  21. **
  22. ** GNU General Public License Usage
  23. ** Alternatively, this file may be used under the terms of the GNU General
  24. ** Public License version 3.0 as published by the Free Software Foundation
  25. ** and appearing in the file LICENSE.GPL included in the packaging of this
  26. ** file. Please review the following information to ensure the GNU General
  27. ** Public License version 3.0 requirements will be met:
  28. ** http://www.gnu.org/copyleft/gpl.html.
  29. **
  30. ** Other Usage
  31. ** Alternatively, this file may be used in accordance with the terms and
  32. ** conditions contained in a signed written agreement between you and Nokia.
  33. **
  34. **
  35. **
  36. **
  37. **
  38. ** $QT_END_LICENSE$
  39. **
  40. ****************************************************************************/
  41. #ifndef QPLATFORMWINDOWFORMAT_QPA_H
  42. #define QPLATFORMWINDOWFORMAT_QPA_H
  43. #include <QtGui/QPlatformWindow>
  44. QT_BEGIN_HEADER
  45. QT_BEGIN_NAMESPACE
  46. QT_MODULE(Gui)
  47. class QPlatformWindowFormatPrivate;
  48. class Q_GUI_EXPORT QPlatformWindowFormat
  49. {
  50. public:
  51. enum FormatOption {
  52. DoubleBuffer = 0x0001,
  53. DepthBuffer = 0x0002,
  54. Rgba = 0x0004,
  55. AlphaChannel = 0x0008,
  56. AccumBuffer = 0x0010,
  57. StencilBuffer = 0x0020,
  58. StereoBuffers = 0x0040,
  59. DirectRendering = 0x0080,
  60. HasOverlay = 0x0100,
  61. SampleBuffers = 0x0200,
  62. DeprecatedFunctions = 0x0400,
  63. HasWindowSurface = 0x0800,
  64. SingleBuffer = DoubleBuffer << 16,
  65. NoDepthBuffer = DepthBuffer << 16,
  66. ColorIndex = Rgba << 16,
  67. NoAlphaChannel = AlphaChannel << 16,
  68. NoAccumBuffer = AccumBuffer << 16,
  69. NoStencilBuffer = StencilBuffer << 16,
  70. NoStereoBuffers = StereoBuffers << 16,
  71. IndirectRendering = DirectRendering << 16,
  72. NoOverlay = HasOverlay << 16,
  73. NoSampleBuffers = SampleBuffers << 16,
  74. NoDeprecatedFunctions = DeprecatedFunctions << 16,
  75. NoWindowSurface = HasWindowSurface << 16
  76. };
  77. Q_DECLARE_FLAGS(FormatOptions, FormatOption)
  78. enum WindowApi {
  79. Raster,
  80. OpenGL,
  81. OpenVG
  82. };
  83. QPlatformWindowFormat();
  84. QPlatformWindowFormat(FormatOptions options);
  85. QPlatformWindowFormat(const QPlatformWindowFormat &other);
  86. QPlatformWindowFormat &operator=(const QPlatformWindowFormat &other);
  87. ~QPlatformWindowFormat();
  88. void setDepthBufferSize(int size);
  89. int depthBufferSize() const;
  90. void setAccumBufferSize(int size);
  91. int accumBufferSize() const;
  92. void setRedBufferSize(int size);
  93. int redBufferSize() const;
  94. void setGreenBufferSize(int size);
  95. int greenBufferSize() const;
  96. void setBlueBufferSize(int size);
  97. int blueBufferSize() const;
  98. void setAlphaBufferSize(int size);
  99. int alphaBufferSize() const;
  100. void setStencilBufferSize(int size);
  101. int stencilBufferSize() const;
  102. void setSampleBuffers(bool enable);
  103. bool sampleBuffers() const;
  104. void setSamples(int numSamples);
  105. int samples() const;
  106. void setSwapInterval(int interval);
  107. int swapInterval() const;
  108. void setWindowApi(QPlatformWindowFormat::WindowApi api);
  109. WindowApi windowApi() const;
  110. void setSharedContext(QPlatformGLContext *context);
  111. QPlatformGLContext *sharedGLContext() const;
  112. bool doubleBuffer() const;
  113. void setDoubleBuffer(bool enable);
  114. bool depth() const;
  115. void setDepth(bool enable);
  116. bool rgba() const;
  117. void setRgba(bool enable);
  118. bool alpha() const;
  119. void setAlpha(bool enable);
  120. bool accum() const;
  121. void setAccum(bool enable);
  122. bool stencil() const;
  123. void setStencil(bool enable);
  124. bool stereo() const;
  125. void setStereo(bool enable);
  126. bool directRendering() const;
  127. void setDirectRendering(bool enable);
  128. bool hasWindowSurface() const;
  129. void setWindowSurface(bool enable);
  130. void setOption(QPlatformWindowFormat::FormatOptions opt);
  131. bool testOption(QPlatformWindowFormat::FormatOptions opt) const;
  132. static QPlatformWindowFormat defaultFormat();
  133. static void setDefaultFormat(const QPlatformWindowFormat& f);
  134. private:
  135. QPlatformWindowFormatPrivate *d;
  136. void detach();
  137. friend Q_GUI_EXPORT bool operator==(const QPlatformWindowFormat&, const QPlatformWindowFormat&);
  138. friend Q_GUI_EXPORT bool operator!=(const QPlatformWindowFormat&, const QPlatformWindowFormat&);
  139. #ifndef QT_NO_DEBUG_STREAM
  140. friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QPlatformWindowFormat &);
  141. #endif
  142. };
  143. Q_GUI_EXPORT bool operator==(const QPlatformWindowFormat&, const QPlatformWindowFormat&);
  144. Q_GUI_EXPORT bool operator!=(const QPlatformWindowFormat&, const QPlatformWindowFormat&);
  145. #ifndef QT_NO_DEBUG_STREAM
  146. Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QPlatformWindowFormat &);
  147. #endif
  148. Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformWindowFormat::FormatOptions)
  149. inline bool QPlatformWindowFormat::doubleBuffer() const
  150. {
  151. return testOption(QPlatformWindowFormat::DoubleBuffer);
  152. }
  153. inline bool QPlatformWindowFormat::depth() const
  154. {
  155. return testOption(QPlatformWindowFormat::DepthBuffer);
  156. }
  157. inline bool QPlatformWindowFormat::rgba() const
  158. {
  159. return testOption(QPlatformWindowFormat::Rgba);
  160. }
  161. inline bool QPlatformWindowFormat::alpha() const
  162. {
  163. return testOption(QPlatformWindowFormat::AlphaChannel);
  164. }
  165. inline bool QPlatformWindowFormat::accum() const
  166. {
  167. return testOption(QPlatformWindowFormat::AccumBuffer);
  168. }
  169. inline bool QPlatformWindowFormat::stencil() const
  170. {
  171. return testOption(QPlatformWindowFormat::StencilBuffer);
  172. }
  173. inline bool QPlatformWindowFormat::stereo() const
  174. {
  175. return testOption(QPlatformWindowFormat::StereoBuffers);
  176. }
  177. inline bool QPlatformWindowFormat::directRendering() const
  178. {
  179. return testOption(QPlatformWindowFormat::DirectRendering);
  180. }
  181. inline bool QPlatformWindowFormat::hasWindowSurface() const
  182. {
  183. return testOption(QPlatformWindowFormat::HasWindowSurface);
  184. }
  185. inline bool QPlatformWindowFormat::sampleBuffers() const
  186. {
  187. return testOption(QPlatformWindowFormat::SampleBuffers);
  188. }
  189. QT_END_NAMESPACE
  190. QT_END_HEADER
  191. #endif //QPLATFORMWINDOWFORMAT_QPA_H