~ubuntu-branches/ubuntu/oneiric/soqt/oneiric

« back to all changes in this revision

Viewing changes to build/msvc6/src/Inventor/Qt/SoQtGLWidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2009-03-01 11:41:00 UTC
  • mfrom: (1.1.4 upstream) (5.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090301114100-f4zz3n1oasa52fgk
Tags: 1.4.2~svn20090224-2
* Upload upstream SVN head version containing fixes to build with Coin 3
  (Closes: #515729, #515736, #515742).  Upstream indicated to me that
  SVN is stable enough to release.

* control: Update Standards-Version to 3.8.0; no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**************************************************************************\
2
 
 *
3
 
 *  This file is part of the Coin 3D visualization library.
4
 
 *  Copyright (C) 1998-2005 by Systems in Motion.  All rights reserved.
5
 
 *
6
 
 *  This library is free software; you can redistribute it and/or
7
 
 *  modify it under the terms of the GNU General Public License
8
 
 *  ("GPL") version 2 as published by the Free Software Foundation.
9
 
 *  See the file LICENSE.GPL at the root directory of this source
10
 
 *  distribution for additional information about the GNU GPL.
11
 
 *
12
 
 *  For using Coin with software that can not be combined with the GNU
13
 
 *  GPL, and for taking advantage of the additional benefits of our
14
 
 *  support services, please contact Systems in Motion about acquiring
15
 
 *  a Coin Professional Edition License.
16
 
 *
17
 
 *  See <URL:http://www.coin3d.org/> for more information.
18
 
 *
19
 
 *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
20
 
 *  <URL:http://www.sim.no/>.
21
 
 *
22
 
\**************************************************************************/
23
 
 
24
 
#ifndef SOQT_GLWIDGET_H
25
 
#define SOQT_GLWIDGET_H
26
 
 
27
 
#include <Inventor/SbBasic.h>
28
 
#include <Inventor/Qt/SoQtBasic.h>
29
 
#include <Inventor/Qt/SoQtComponent.h>
30
 
 
31
 
#ifdef __COIN_SOQT__
32
 
class QEvent;
33
 
#endif // __COIN_SOQT__
34
 
#ifdef __COIN_SOXT__
35
 
/*
36
 
 * GL/glx.h includes X11/Xmd.h which contains typedefs for BOOL and
37
 
 * INT32 that conflict with the definitions in windef.h (which is
38
 
 * included from windows.h, which may be included from
39
 
 * Inventor/system/gl.h).  To avoid this conflict, we rename the
40
 
 * typedefs done in X11/Xmd.h to use other names (tempbool and
41
 
 * tempint32), and try to clean up the hack after the header has been
42
 
 * parsed.  2003-06-25 larsa
43
 
 */
44
 
#ifndef BOOL
45
 
#define BOOL tempbool
46
 
#define COIN_DEFINED_BOOL
47
 
#endif /* !BOOL */
48
 
#ifndef INT32
49
 
#define INT32 tempint32
50
 
#define COIN_DEFINED_INT32
51
 
#endif /* !INT32 */
52
 
#include <GL/glx.h>
53
 
/*
54
 
 * This is the cleanup part of the X11/Xmd.h conflict fix hack set up
55
 
 * above.  2003-06-25 larsa
56
 
 */
57
 
#ifdef COIN_DEFINED_BOOL
58
 
#undef BOOL
59
 
#undef COIN_DEFINED_BOOL
60
 
#endif /* COIN_DEFINED_BOOL */
61
 
#ifdef COIN_DEFINED_INT32
62
 
#undef INT32
63
 
#undef COIN_DEFINED_INT32
64
 
#endif /* COIN_DEFINED_INT32 */
65
 
#endif // __COIN_SOXT__
66
 
#ifdef __COIN_SOGTK__
67
 
#include <gtk/gtk.h>
68
 
#endif // __COIN_SOGTK__
69
 
 
70
 
// *************************************************************************
71
 
 
72
 
enum GLModes {
73
 
  SO_GL_RGB      = 0x01, SO_GLX_RGB      = SO_GL_RGB,
74
 
  SO_GL_DOUBLE   = 0x02, SO_GLX_DOUBLE   = SO_GL_DOUBLE,
75
 
  SO_GL_ZBUFFER  = 0x04, SO_GLX_ZBUFFER  = SO_GL_ZBUFFER,
76
 
  SO_GL_OVERLAY  = 0x08, SO_GLX_OVERLAY  = SO_GL_OVERLAY,
77
 
  SO_GL_STEREO   = 0x10, SO_GLX_STEREO   = SO_GL_STEREO
78
 
};
79
 
 
80
 
// *************************************************************************
81
 
 
82
 
class SOQT_DLL_API SoQtGLWidget : public SoQtComponent {
83
 
  SOQT_OBJECT_ABSTRACT_HEADER(SoQtGLWidget, SoQtComponent);
84
 
 
85
 
public:
86
 
 
87
 
  void setBorder(const SbBool enable);
88
 
  SbBool isBorder(void) const;
89
 
 
90
 
  virtual void setDoubleBuffer(const SbBool enable);
91
 
  SbBool isDoubleBuffer(void) const;
92
 
 
93
 
  void setDrawToFrontBufferEnable(const SbBool enable);
94
 
  SbBool isDrawToFrontBufferEnable(void) const;
95
 
  
96
 
  void setQuadBufferStereo(const SbBool enable);
97
 
  SbBool isQuadBufferStereo(void) const;
98
 
 
99
 
  void setAccumulationBuffer(const SbBool enable);
100
 
  SbBool getAccumulationBuffer(void) const;
101
 
 
102
 
  void setStencilBuffer(const SbBool enable);
103
 
  SbBool getStencilBuffer(void) const;
104
 
 
105
 
  void setAlphaChannel(const SbBool enable);
106
 
  SbBool getAlphaChannel(void) const;
107
 
 
108
 
  void setOverlayRender(const SbBool onoff);
109
 
  SbBool isOverlayRender(void) const;
110
 
 
111
 
  void setStealFocus(SbBool enable);
112
 
  SbBool isStealFocus(void) const;
113
 
 
114
 
  QWidget * getGLWidget(void) const;
115
 
  QWidget * getNormalWidget(void) const;
116
 
  QWidget * getOverlayWidget(void) const;
117
 
 
118
 
  SbBool hasOverlayGLArea(void) const;
119
 
  SbBool hasNormalGLArea(void) const;
120
 
 
121
 
  unsigned long getOverlayTransparentPixel(void);
122
 
 
123
 
  // OpenGL query functions.
124
 
  void getPointSizeLimits(SbVec2f & range, float & granularity);
125
 
  void getLineWidthLimits(SbVec2f & range, float & granularity);
126
 
 
127
 
protected:
128
 
  SoQtGLWidget(QWidget * const parent = NULL,
129
 
                  const char * const name = NULL,
130
 
                  const SbBool embed = TRUE,
131
 
                  const int glmodes = SO_GL_RGB,
132
 
                  const SbBool build = TRUE);
133
 
  ~SoQtGLWidget();
134
 
 
135
 
  virtual void processEvent(QEvent * event);
136
 
 
137
 
  QWidget * buildWidget(QWidget * parent);
138
 
 
139
 
  virtual void redraw(void) = 0;
140
 
  virtual void redrawOverlay(void);
141
 
 
142
 
  virtual void initGraphic(void);
143
 
  virtual void initOverlayGraphic(void);
144
 
 
145
 
  virtual void sizeChanged(const SbVec2s & size);
146
 
  virtual void widgetChanged(QWidget * w);
147
 
 
148
 
  void setGLSize(const SbVec2s size);
149
 
  SbVec2s getGLSize(void) const;
150
 
  float getGLAspectRatio(void) const;
151
 
 
152
 
  // old aliases
153
 
  void setGlxSize(const SbVec2s size) { this->setGLSize(size); }
154
 
  SbVec2s getGlxSize(void) const { return this->getGLSize(); }
155
 
  float getGlxAspectRatio(void) const { return this->getGLAspectRatio(); }
156
 
 
157
 
  void setStereoBuffer(SbBool flag);
158
 
  SbBool isStereoBuffer(void) const;
159
 
 
160
 
  SbBool isRGBMode(void);
161
 
 
162
 
  SbBool waitForExpose;
163
 
  SbBool drawToFrontBuffer;
164
 
 
165
 
  void glLockNormal(void);
166
 
  void glUnlockNormal(void);
167
 
 
168
 
  void glLockOverlay(void);
169
 
  void glUnlockOverlay(void);
170
 
 
171
 
  void glSwapBuffers(void);
172
 
  void glFlushBuffer(void);
173
 
 
174
 
  virtual SbBool glScheduleRedraw(void);
175
 
 
176
 
private:
177
 
  class SoQtGLWidgetP * pimpl;
178
 
  friend class SoGuiGLWidgetP;
179
 
  friend class SoQtGLWidgetP;
180
 
 
181
 
  // FIXME: get rid of toolkit-specific stuff below. 20020613 mortene.
182
 
 
183
 
#ifdef __COIN_SOXT__
184
 
public:
185
 
  GLXContext getNormalContext(void);
186
 
  GLXContext getOverlayContext(void);
187
 
 
188
 
  Window getNormalWindow(void);
189
 
  Window getOverlayWindow(void);
190
 
 
191
 
  int getOverlayColorMapSize(void);
192
 
  int getColorMapSize(void);
193
 
 
194
 
  virtual void setNormalVisual(XVisualInfo * visual);
195
 
  XVisualInfo * getNormalVisual(void);
196
 
  virtual void setOverlayVisual(XVisualInfo * visual);
197
 
  XVisualInfo * getOverlayVisual(void);
198
 
 
199
 
protected:
200
 
  static void eventHandler(Widget, SoXtGLWidget *, XAnyEvent *, Boolean *);
201
 
 
202
 
  int getDisplayListShareGroup(GLXContext context);
203
 
  Widget getGlxMgrWidget(void);
204
 
#endif // __COIN_SOXT__
205
 
 
206
 
#ifdef __COIN_SOGTK__
207
 
protected:
208
 
  virtual SbBool eventFilter(GtkWidget * object, GdkEvent * event);
209
 
#endif // __COIN_SOGTK__
210
 
 
211
 
};
212
 
 
213
 
// *************************************************************************
214
 
 
215
 
#endif // ! SOQT_GLWIDGET_H