SoWin  1.6.2
Coin3D GUI toolkit binding
Loading...
Searching...
No Matches
SoWinRenderArea.h
1#ifndef SOWIN_RENDERAREA_H
2#define SOWIN_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/Win/SoWinGLWidget.h>
47
48class SbColor;
49class SoNode;
50class SoSelection;
51
52class SoWinDevice;
53// SoWinRenderAreaP 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 SoWinRenderAreaP;
57
58typedef SbBool SoWinRenderAreaEventCB(void * closure, MSG* event);
59
60// *************************************************************************
61
62class SOWIN_DLL_API SoWinRenderArea : public SoWinGLWidget {
63 SOWIN_OBJECT_HEADER(SoWinRenderArea, SoWinGLWidget);
64
65public:
66 SoWinRenderArea(HWND 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(SoWinRenderAreaEventCB * 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(SoWinDevice * device);
125 void unregisterDevice(SoWinDevice * device);
126
127
128protected:
129 SoWinRenderArea(HWND 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(MSG* event);
143 virtual void initGraphic(void);
144 virtual void initOverlayGraphic(void);
145 virtual void sizeChanged(const SbVec2s & size);
146 virtual void widgetChanged(HWND widget);
147 virtual void afterRealizeHook(void);
148
149 HWND buildWidget(HWND 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 SoWinRenderAreaP * pimpl;
159 friend class SoWinRenderAreaP;
160};
161
162// *************************************************************************
163
164#endif // ! SOWIN_RENDERAREA_H
virtual const char * getDefaultIconTitle(void) const
Definition SoWinComponentCommon.cpp:324
virtual const char * getDefaultWidgetName(void) const
Definition SoWinComponentCommon.cpp:299
virtual const char * getDefaultTitle(void) const
Definition SoWinComponentCommon.cpp:312
virtual void afterRealizeHook(void)
Definition SoWinComponent.cpp:604
The SoWinDevice class is the base class for the translation devices.
Definition SoWinDevice.h:77
The SoWinGLWidget class manages OpenGL contexts.
Definition SoWinGLWidget.h:93
virtual void widgetChanged(HWND w)
Definition SoWinGLWidget.cpp:372
virtual void redrawOverlay(void)
Definition SoWinGLWidget.cpp:328
virtual void sizeChanged(const SbVec2s &size)
Definition SoWinGLWidget.cpp:365
virtual void initOverlayGraphic(void)
Definition SoWinGLWidget.cpp:358
virtual SbBool glScheduleRedraw(void)
Definition SoWinGLWidget.cpp:314
virtual void initGraphic(void)
Definition SoWinGLWidget.cpp:349
virtual void redraw(void)=0
Definition SoWinGLWidget.cpp:321
HWND buildWidget(HWND parent)
Definition SoWinGLWidget.cpp:437
virtual void processEvent(MSG *event)
Definition SoWinGLWidget.cpp:335
The SoWinRenderArea class adds scene graph handling and event management.
Definition SoWinRenderArea.h:62