SoWx  0.1.0
Coin3D GUI toolkit binding
Loading...
Searching...
No Matches
SoWxRenderArea.h
1#ifndef SOWX_RENDERAREA_H
2#define SOWX_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/Wx/SoWxGLWidget.h>
47
48class SbColor;
49class SoNode;
50class SoSelection;
51
52class SoWxDevice;
53// SoWxRenderAreaP 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 SoWxRenderAreaP;
57
58typedef SbBool SoWxRenderAreaEventCB(void * closure, wxEvent& event);
59
60// *************************************************************************
61
62class SOWX_DLL_API SoWxRenderArea : public SoWxGLWidget {
63 SOWX_OBJECT_HEADER(SoWxRenderArea, SoWxGLWidget);
64
65public:
66 SoWxRenderArea(wxWindow* 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(SoWxRenderAreaEventCB * 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(SoWxDevice * device);
125 void unregisterDevice(SoWxDevice * device);
126
127
128protected:
129 SoWxRenderArea(wxWindow* 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(wxEvent& event);
143 virtual void initGraphic(void);
144 virtual void initOverlayGraphic(void);
145 virtual void sizeChanged(const SbVec2s & size);
146 virtual void widgetChanged(wxWindow* widget);
147 virtual void afterRealizeHook(void);
148
149 wxWindow* buildWidget(wxWindow* 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 SoWxRenderAreaP * pimpl;
159 friend class SoWxRenderAreaP;
160};
161
162// *************************************************************************
163
164#endif // ! SOWX_RENDERAREA_H
virtual const char * getDefaultTitle(void) const
Definition SoWxComponentCommon.cpp:312
virtual const char * getDefaultIconTitle(void) const
Definition SoWxComponentCommon.cpp:324
virtual const char * getDefaultWidgetName(void) const
Definition SoWxComponentCommon.cpp:299
virtual void afterRealizeHook(void)
Definition SoWxComponent.cpp:127
The SoWxDevice class is the base class for the translation devices.
Definition SoWxDevice.h:77
The SoWxGLWidget class manages OpenGL contexts.
Definition SoWxGLWidget.h:93
virtual void initGraphic(void)
Definition SoWxGLWidget.cpp:325
virtual void redrawOverlay(void)
Definition SoWxGLWidget.cpp:320
virtual void redraw(void)=0
virtual void widgetChanged(wxWindow *w)
Definition SoWxGLWidget.cpp:351
virtual SbBool glScheduleRedraw(void)
Definition SoWxGLWidget.cpp:176
wxWindow * buildWidget(wxWindow *parent)
Definition SoWxGLWidget.cpp:313
virtual void sizeChanged(const SbVec2s &size)
Definition SoWxGLWidget.cpp:339
virtual void initOverlayGraphic(void)
Definition SoWxGLWidget.cpp:334
virtual void processEvent(wxEvent &event)
Definition SoWxGLWidget.cpp:306
The SoWxRenderArea class adds scene graph handling and event management.
Definition SoWxRenderArea.h:62