Debian Codegraph @

lib/database/src/so/elements/SoWindowElement.c++

raw
1 /*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37 /*
38 * Copyright (C) 1995-96 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | $Revision: 1.1.1.1 $
44 |
45 | Classes:
46 | SoWindowElement
47 |
48 | Author(s) : Alain Dumesny
49 |
50 ______________ S I L I C O N G R A P H I C S I N C . ____________
51 _______________________________________________________________________
52 */
53
54 #include <Inventor/elements/SoWindowElement.h>
55 #include <Inventor/errors/SoDebugError.h>
56
57 SO_ELEMENT_SOURCE(SoWindowElement);
58
59 ////////////////////////////////////////////////////////////////////////
60 //
61 // Description:
62 // Destructor.
63 //
64 // Use: private
65
66 SoWindowElement::~SoWindowElement()
67 //
68 ////////////////////////////////////////////////////////////////////////
69 {
70 }
71
72 ////////////////////////////////////////////////////////////////////////
73 //
74 // Description:
75 // Initializes element.
76 //
77 // Use: public
78
79 void
80 SoWindowElement::init(SoState *)
81 //
82 ////////////////////////////////////////////////////////////////////////
83 {
84 window = 0;
85 context = NULL;
86 display = NULL;
87 glRenderAction = NULL;
88 }
89
90 ////////////////////////////////////////////////////////////////////////
91 //
92 // Description:
93 // Sets the window attributes
94 //
95 // Use: public, static
96
97 void
98 SoWindowElement::set(SoState *state, Window w, GLXContext ctx,
99 Display *d, SoGLRenderAction *glAc)
100 //
101 ////////////////////////////////////////////////////////////////////////
102 {
103 SoWindowElement *elt;
104
105 // Get an instance we can change (pushing if necessary)
106 elt = (SoWindowElement *) getElement(state, classStackIndex);
107
108 elt->window = w;
109 elt->context = ctx;
110 elt->display = d;
111 elt->glRenderAction = glAc;
112 }
113
114 ////////////////////////////////////////////////////////////////////////
115 //
116 // Description:
117 // Returns the window information from the state
118 //
119 // Use: public, static
120
121 void
122 SoWindowElement::get(SoState *state, Window &w, GLXContext &ctx,
123 Display *&d, SoGLRenderAction *&glAc)
124 //
125 ////////////////////////////////////////////////////////////////////////
126 {
127 const SoWindowElement *elt;
128
129 elt = (const SoWindowElement *) getConstElement(state, classStackIndex);
130
131 w = elt->window;
132 ctx = elt->context;
133 d = elt->display;
134 glAc = elt->glRenderAction;
135 }
136
137 ////////////////////////////////////////////////////////////////////////
138 //
139 // Description:
140 // this should NOT be called - for anything but the very first depth
141 // (since depth 0 elements are supposed to be read only).
142 //
143 // Use: public virtual
144
145 void
146 SoWindowElement::push(SoState *state)
147 //
148 ////////////////////////////////////////////////////////////////////////
149 {
150 #ifdef DEBUG
151 if (state->getDepth() > 1)
152 SoDebugError::post("SoWindowElement::push",
153 "must not set this element");
154 #endif
155 }
156
157 ////////////////////////////////////////////////////////////////////////
158 //
159 // Description:
160 // Overrides this method to always return TRUE. This element
161 // should never have anything to do with cache invalidation.
162 //
163 // Use: public
164
165 SbBool
166 SoWindowElement::matches(const SoElement *) const
167 //
168 ////////////////////////////////////////////////////////////////////////
169 {
170 SoDebugError::post("SoWindowElement::matches",
171 "This method should never be called!");
172
173 return TRUE;
174 }
175
176 ////////////////////////////////////////////////////////////////////////
177 //
178 // Description:
179 // Override method to return NULL; it should never be called.
180 //
181 // Use: protected
182
183 SoElement *
184 SoWindowElement::copyMatchInfo() const
185 //
186 ////////////////////////////////////////////////////////////////////////
187 {
188 SoDebugError::post("SoWindowElement::copyMatchInfo",
189 "This method should never be called!");
190
191 SoWindowElement *elt = new SoWindowElement;
192 elt->window = window;
193 elt->context = context;
194 elt->display = display;
195 elt->glRenderAction = glRenderAction;
196
197 return elt;
198 }
199