37 #ifdef G4VIS_BUILD_OI_DRIVER
42 #include <Inventor/SoPickedPoint.h>
43 #include <Inventor/nodes/SoSeparator.h>
44 #include <Inventor/nodes/SoPickStyle.h>
45 #include <Inventor/nodes/SoDrawStyle.h>
46 #include <Inventor/nodes/SoSwitch.h>
47 #include <Inventor/nodes/SoMaterial.h>
48 #include <Inventor/nodes/SoUnits.h>
49 #include <Inventor/nodes/SoTransform.h>
50 #include <Inventor/nodes/SoEventCallback.h>
51 #include <Inventor/nodekits/SoSeparatorKit.h>
52 #include <Inventor/nodekits/SoShapeKit.h>
53 #include <Inventor/nodekits/SoAppearanceKit.h>
54 #include <Inventor/nodekits/SoNodeKitListPart.h>
55 #include <Inventor/nodekits/SoBaseKit.h>
56 #include <Inventor/nodes/SoTexture2Transform.h>
57 #include <Inventor/events/SoMouseButtonEvent.h>
58 #include <Inventor/actions/SoHandleEventAction.h>
78 SO_KIT_ADD_CATALOG_ENTRY ( topSeparator, SoSeparator,
FALSE,
this,\0,
FALSE);
79 SO_KIT_ADD_CATALOG_ENTRY ( pickStyle, SoSeparator,
TRUE , topSeparator,\0,
TRUE);
80 SO_KIT_ADD_CATALOG_ENTRY ( appearance, SoAppearanceKit,
TRUE, topSeparator ,\0,
TRUE);
81 SO_KIT_ADD_CATALOG_ENTRY ( units, SoUnits,
TRUE, topSeparator ,\0,
TRUE);
83 SO_KIT_ADD_CATALOG_ENTRY (texture2Transform, SoTexture2Transform,
TRUE, topSeparator ,\0,
TRUE);
84 SO_KIT_ADD_CATALOG_ENTRY ( childList, SoSwitch,
FALSE, topSeparator,\0,
FALSE);
85 SO_KIT_ADD_CATALOG_ENTRY ( previewSeparator, SoSeparator,
FALSE, childList,\0,
TRUE);
86 SO_KIT_ADD_CATALOG_ENTRY ( fullSeparator, SoSeparator,
FALSE, childList,\0,
TRUE);
88 SO_KIT_INIT_INSTANCE();
103 SoEventCallback *myCallback =
new SoEventCallback();
104 myCallback->addEventCallback(SoMouseButtonEvent::getClassTypeId(),
107 myCallback->addEventCallback(SoMouseButtonEvent::getClassTypeId(),
110 if(setPart(
"callbackList[0]",myCallback)==
FALSE) myCallback->unref();
112 SoSwitch *theChildList = (SoSwitch *) childList.getValue();
113 theChildList->whichChild.setValue(0);
120 if (eventCB->isHandled())
return;
121 const SoMouseButtonEvent *
event= (SoMouseButtonEvent *) eventCB->getEvent();
122 if (!SoMouseButtonEvent::isButtonPressEvent(event,SoMouseButtonEvent::BUTTON1))
return;
123 if (!event->wasCtrlDown())
return;
124 if (event->wasShiftDown())
return;
131 SoHandleEventAction *handleEventAction = eventCB->getAction();
132 const SoPickedPoint *pickedPoint = handleEventAction->getPickedPoint();
133 if (!pickedPoint)
return;
135 SoFullPath* path = (SoFullPath*)pickedPoint->getPath();
136 SoNode *ancestorNode=NULL;
137 for (
int i=0;i<path->getLength();i++) {
138 ancestorNode = path->getNodeFromTail(i);
139 if (ancestorNode->isOfType(SoDetectorTreeKit::getClassTypeId()))
break;
141 if (This!=ancestorNode)
return;
146 eventCB->setHandled();
153 if (eventCB->isHandled())
return;
154 const SoMouseButtonEvent *
event= (SoMouseButtonEvent *) eventCB->getEvent();
155 if (!SoMouseButtonEvent::isButtonPressEvent(event,SoMouseButtonEvent::BUTTON1))
return;
156 if (event->wasCtrlDown())
return;
157 if (!event->wasShiftDown())
return;
163 SoHandleEventAction *handleEventAction = eventCB->getAction();
164 const SoPickedPoint *pickedPoint = handleEventAction->getPickedPoint();
165 if (!pickedPoint)
return;
169 SoFullPath* path = (SoFullPath*)pickedPoint->getPath();
170 SoNode *ancestorNode=NULL;
171 SbBool firstTreeFound=
FALSE;
172 for (
int i=0;i<path->getLength();i++) {
173 ancestorNode = path->getNodeFromTail(i);
174 if (ancestorNode->isOfType(SoDetectorTreeKit::getClassTypeId())) {
175 if (!firstTreeFound) {
176 if (This!=ancestorNode)
return;
182 eventCB->setHandled();
190 SoSwitch *theChildList = (SoSwitch *) childList.getValue();
192 theChildList->whichChild.setValue(0);
195 theChildList->whichChild.setValue(1);
200 SoSwitch *theChildList = (SoSwitch *) childList.getValue();
201 if (theChildList->whichChild.getValue()==0)
return TRUE;
207 SoSwitch *theChildList = (SoSwitch *) childList.getValue();
208 theChildList->whichChild.setValue(SO_SWITCH_ALL);
212 return (SoSeparator *) previewSeparator.getValue();
216 return (SoSeparator *) fullSeparator.getValue();