SoQt  1.6.2
Coin3D GUI toolkit binding
Loading...
Searching...
No Matches
SoQtRenderArea.h
1#ifndef SOQT_RENDERAREA_H
2#define SOQT_RENDERAREA_H
3
4//
5
6/**************************************************************************\
7 * Copyright (c) Kongsberg Oil & Gas Technologies AS
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are
12 * met:
13 *
14 * Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * Neither the name of the copyright holder nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36\**************************************************************************/
37
38#include <Inventor/SbColor.h>
39#include <Inventor/SbViewportRegion.h>
40#include <Inventor/actions/SoGLRenderAction.h>
41#include <Inventor/SoSceneManager.h>
42#if HAVE_SOSCENEMANAGER_GETBACKGROUNDCOLORRGBA
43#include <Inventor/SbColorRGBA.h>
44#endif
45
46#include <Inventor/Qt/SoQtGLWidget.h>
47
48class SbColor;
49class SoNode;
50class SoSelection;
51
52class SoQtDevice;
53// SoQtRenderAreaP is only used in the "friend class" statement in
54// the class definition, so this shouldn't really be necessary. But
55// the OSF1/cxx compiler complains if it's left out.
56class SoQtRenderAreaP;
57
58typedef SbBool SoQtRenderAreaEventCB(void * closure, QEvent* event);
59
60// *************************************************************************
61
62class SOQT_DLL_API SoQtRenderArea : public SoQtGLWidget {
63 SOQT_OBJECT_HEADER(SoQtRenderArea, SoQtGLWidget);
64
65public:
66 SoQtRenderArea(QWidget* parent = NULL,
67 const char * name = NULL,
68 SbBool embed = TRUE,
69 SbBool mouseInput = TRUE,
70 SbBool keyboardInput = TRUE);
72
73 virtual void setSceneGraph(SoNode * scene);
74 virtual SoNode * getSceneGraph(void);
75 void setOverlaySceneGraph(SoNode * scene);
76 SoNode * getOverlaySceneGraph(void);
77
78 void setBackgroundColor(const SbColor & color);
79 const SbColor & getBackgroundColor(void) const;
80#if HAVE_SOSCENEMANAGER_GETBACKGROUNDCOLORRGBA
81 void setBackgroundColorRGBA(const SbColorRGBA & color);
82 const SbColorRGBA & getBackgroundColorRGBA(void) const;
83#endif
84 void setBackgroundIndex(int idx);
85 int getBackgroundIndex(void) const;
86 void setOverlayBackgroundIndex(int idx);
87 int getOverlayBackgroundIndex(void) const;
88 void setColorMap(int start, int num, const SbColor * colors);
89 void setOverlayColorMap(int start, int num, const SbColor * colors);
90 void setViewportRegion(const SbViewportRegion & newRegion);
91 const SbViewportRegion & getViewportRegion(void) const;
92 void setTransparencyType(SoGLRenderAction::TransparencyType type);
93 SoGLRenderAction::TransparencyType getTransparencyType(void) const;
94 void setAntialiasing(SbBool smoothing, int numPasses);
95 void getAntialiasing(SbBool & smoothing, int & numPasses) const;
96 void setClearBeforeRender(SbBool enable, SbBool zbEnable = TRUE);
97 SbBool isClearBeforeRender(void) const;
98 SbBool isClearZBufferBeforeRender(void) const;
99 void setClearBeforeOverlayRender(SbBool enable);
100 SbBool isClearBeforeOverlayRender(void) const;
101 void setAutoRedraw(SbBool enable);
102 SbBool isAutoRedraw(void) const;
103 void setRedrawPriority(uint32_t priority);
104 uint32_t getRedrawPriority(void) const;
105 static uint32_t getDefaultRedrawPriority(void);
106 void render(void);
107 void renderOverlay(void);
108 void scheduleRedraw(void);
109 void scheduleOverlayRedraw(void);
110 void redrawOnSelectionChange(SoSelection * selection);
111 void redrawOverlayOnSelectionChange(SoSelection * selection);
112 void setEventCallback(SoQtRenderAreaEventCB * func, void * user = NULL);
113 void setSceneManager(SoSceneManager * manager);
114 SoSceneManager * getSceneManager(void) const;
115 void setOverlaySceneManager(SoSceneManager * manager);
116 SoSceneManager * getOverlaySceneManager(void) const;
117 void setGLRenderAction(SoGLRenderAction * action);
118 SoGLRenderAction * getGLRenderAction(void) const;
119 void setOverlayGLRenderAction(SoGLRenderAction * action);
120 SoGLRenderAction * getOverlayGLRenderAction(void) const;
121
122 SbBool sendSoEvent(const SoEvent * event);
123
124 void registerDevice(SoQtDevice * device);
125 void unregisterDevice(SoQtDevice * device);
126
127
128protected:
129 SoQtRenderArea(QWidget* parent,
130 const char * name,
131 SbBool embed,
132 SbBool mouseInput,
133 SbBool keyboardInput,
134 SbBool build);
135
136 virtual void redraw(void);
137 virtual void actualRedraw(void);
138 virtual void redrawOverlay(void);
139 virtual void actualOverlayRedraw(void);
140
141 virtual SbBool processSoEvent(const SoEvent * const event);
142 virtual void processEvent(QEvent* event);
143 virtual void initGraphic(void);
144 virtual void initOverlayGraphic(void);
145 virtual void sizeChanged(const SbVec2s & size);
146 virtual void widgetChanged(QWidget* widget);
147 virtual void afterRealizeHook(void);
148
149 QWidget* buildWidget(QWidget* parent);
150
151 virtual const char * getDefaultWidgetName(void) const;
152 virtual const char * getDefaultTitle(void) const;
153 virtual const char * getDefaultIconTitle(void) const;
154
155 virtual SbBool glScheduleRedraw(void);
156
157private:
158 class SoQtRenderAreaP * pimpl;
159 friend class SoQtRenderAreaP;
160};
161
162// *************************************************************************
163
164#endif // ! SOQT_RENDERAREA_H
virtual const char * getDefaultTitle(void) const
Definition SoQtComponentCommon.cpp:312
virtual const char * getDefaultWidgetName(void) const
Definition SoQtComponentCommon.cpp:299
virtual const char * getDefaultIconTitle(void) const
Definition SoQtComponentCommon.cpp:324
virtual void afterRealizeHook(void)
Definition SoQtComponent.cpp:913
The SoQtDevice class is the base class for the translation devices.
Definition SoQtDevice.h:77
The SoQtGLWidget class manages OpenGL contexts.
Definition SoQtGLWidget.h:93
QWidget * buildWidget(QWidget *parent)
Definition SoQtGLWidget.cpp:272
virtual void processEvent(QEvent *event)
Definition SoQtGLWidget.cpp:658
virtual SbBool glScheduleRedraw(void)
Definition SoQtGLWidget.cpp:823
virtual void widgetChanged(QWidget *w)
Definition SoQtGLWidget.cpp:651
virtual void initGraphic(void)
Definition SoQtGLWidget.cpp:797
virtual void redrawOverlay(void)
Definition SoQtGLWidget.cpp:790
virtual void sizeChanged(const SbVec2s &size)
Definition SoQtGLWidget.cpp:817
virtual void initOverlayGraphic(void)
Definition SoQtGLWidget.cpp:809
virtual void redraw(void)=0
The SoQtRenderArea class adds scene graph handling and event management.
Definition SoQtRenderArea.h:62