SoXt  1.4.1
Coin3D GUI toolkit binding
Loading...
Searching...
No Matches
SoXtRenderArea.h
1#ifndef SOXT_RENDERAREA_H
2#define SOXT_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/Xt/SoXtGLWidget.h>
47
48class SbColor;
49class SoNode;
50class SoSelection;
51
52class SoXtDevice;
53// SoXtRenderAreaP 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 SoXtRenderAreaP;
57
58typedef SbBool SoXtRenderAreaEventCB(void * closure, XAnyEvent* event);
59
60// *************************************************************************
61
62class SOXT_DLL_API SoXtRenderArea : public SoXtGLWidget {
63 SOXT_OBJECT_HEADER(SoXtRenderArea, SoXtGLWidget);
64
65public:
66 SoXtRenderArea(Widget 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(SoXtRenderAreaEventCB * 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(SoXtDevice * device);
125 void unregisterDevice(SoXtDevice * device);
126
127
128protected:
129 SoXtRenderArea(Widget 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(XAnyEvent* event);
143 virtual void initGraphic(void);
144 virtual void initOverlayGraphic(void);
145 virtual void sizeChanged(const SbVec2s & size);
146 virtual void widgetChanged(Widget widget);
147 virtual void afterRealizeHook(void);
148
149 Widget buildWidget(Widget 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 SoXtRenderAreaP * pimpl;
159 friend class SoXtRenderAreaP;
160};
161
162// *************************************************************************
163
164#endif // ! SOXT_RENDERAREA_H
virtual void afterRealizeHook(void)
Definition SoXtComponent.cpp:667
virtual const char * getDefaultTitle(void) const
Definition SoXtComponentCommon.cpp:312
virtual const char * getDefaultWidgetName(void) const
Definition SoXtComponentCommon.cpp:299
virtual const char * getDefaultIconTitle(void) const
Definition SoXtComponentCommon.cpp:324
The SoXtDevice class is the base class for the translation devices.
Definition SoXtDevice.h:77
The SoXtGLWidget class manages OpenGL contexts.
Definition SoXtGLWidget.h:93
virtual void initOverlayGraphic(void)
Definition SoXtGLWidget.cpp:565
virtual void sizeChanged(const SbVec2s &size)
Definition SoXtGLWidget.cpp:604
virtual void widgetChanged(Widget w)
Definition SoXtGLWidget.cpp:621
virtual void processEvent(XAnyEvent *event)
Definition SoXtGLWidget.cpp:496
virtual void redrawOverlay(void)
Definition SoXtGLWidget.cpp:482
Widget buildWidget(Widget parent)
Definition SoXtGLWidget.cpp:792
virtual SbBool glScheduleRedraw(void)
Definition SoXtGLWidget.cpp:579
virtual void initGraphic(void)
Definition SoXtGLWidget.cpp:535
virtual void redraw(void)=0
The SoXtRenderArea class adds scene graph handling and event management.
Definition SoXtRenderArea.h:62