1
/**************************************************************************\
3
* This file is part of the Coin 3D visualization library.
4
* Copyright (C) 1998-2005 by Systems in Motion. All rights reserved.
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* ("GPL") version 2 as published by the Free Software Foundation.
9
* See the file LICENSE.GPL at the root directory of this source
10
* distribution for additional information about the GNU GPL.
12
* For using Coin with software that can not be combined with the GNU
13
* GPL, and for taking advantage of the additional benefits of our
14
* support services, please contact Systems in Motion about acquiring
15
* a Coin Professional Edition License.
17
* See <URL:http://www.coin3d.org/> for more information.
19
* Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
20
* <URL:http://www.sim.no/>.
22
\**************************************************************************/
24
#include <Inventor/Qt/engines/SoGuiRadioGroup.h>
27
SO_ENGINE_SOURCE(SoGuiRadioGroup);
30
SoGuiRadioGroup::initClass(void)
32
SO_ENGINE_INIT_CLASS(SoGuiRadioGroup, SoEngine, "Engine");
35
SoGuiRadioGroup::SoGuiRadioGroup(void)
39
SO_ENGINE_CONSTRUCTOR(SoGuiRadioGroup);
41
SO_ENGINE_ADD_INPUT(in0, (FALSE));
42
SO_ENGINE_ADD_INPUT(in1, (FALSE));
43
SO_ENGINE_ADD_INPUT(in2, (FALSE));
44
SO_ENGINE_ADD_INPUT(in3, (FALSE));
45
SO_ENGINE_ADD_INPUT(in4, (FALSE));
46
SO_ENGINE_ADD_INPUT(in5, (FALSE));
47
SO_ENGINE_ADD_INPUT(in6, (FALSE));
48
SO_ENGINE_ADD_INPUT(in7, (FALSE));
50
SO_ENGINE_ADD_OUTPUT(out0, SoSFBool);
51
SO_ENGINE_ADD_OUTPUT(out1, SoSFBool);
52
SO_ENGINE_ADD_OUTPUT(out2, SoSFBool);
53
SO_ENGINE_ADD_OUTPUT(out3, SoSFBool);
54
SO_ENGINE_ADD_OUTPUT(out4, SoSFBool);
55
SO_ENGINE_ADD_OUTPUT(out5, SoSFBool);
56
SO_ENGINE_ADD_OUTPUT(out6, SoSFBool);
57
SO_ENGINE_ADD_OUTPUT(out7, SoSFBool);
60
SoGuiRadioGroup::~SoGuiRadioGroup(void)
65
SoGuiRadioGroup::inputChanged(SoField * which)
67
SoSFBool * fields[] = {
79
for ( i = 0; which != fields[i] && fields[i] != NULL; i++ ) { }
80
assert(fields[i] != NULL );
81
if ( ((SoSFBool *)which)->getValue() != FALSE ) {
84
if ( this->index == i ) this->index = -1;
89
SoGuiRadioGroup::evaluate(void)
91
if ( this->index == -1 ) return; // avoid update
92
SoSFBool * fields[] = {
93
&(this->in0), &(this->in1), &(this->in2), &(this->in3),
94
&(this->in4), &(this->in5), &(this->in6), &(this->in7),
97
SoEngineOutput * outputs[] = {
98
&(this->out0), &(this->out1), &(this->out2), &(this->out3),
99
&(this->out4), &(this->out5), &(this->out6), &(this->out7),
103
for ( i = 0; i < 8; i++ ) {
104
if ( i == this->index ) {
105
SO_ENGINE_OUTPUT((*outputs[i]), SoSFBool, setValue(TRUE));
107
SO_ENGINE_OUTPUT((*outputs[i]), SoSFBool, setValue(FALSE));