11 #include <Inventor/actions/SoHandleEventAction.h>
12 #include <Inventor/lists/SoCallbackList.h>
13 #include <Inventor/SoPickedPoint.h>
14 #include <Inventor/events/SoMouseButtonEvent.h>
28 [[maybe_unused]]
static const bool needsinit = [&]() {
43 : SoSelection(nChildren)
58 setNodeType(EXTENSION);
66 if (this->mouseDownPickPath)
67 this->mouseDownPickPath->unref();
74 for (
int i = 0;
i <
path->getLength(); ++
i) {
75 if (
path->getNodeFromTail(
i)->getTypeId().isDerivedFrom(SoCooperativeSelection::getClassTypeId())) {
77 if (
sel->activePolicy.getValue() ==
ACTIVE)
100 SoSeparator::handleEvent(
action);
105 const SoEvent *
event =
action->getEvent();
107 SbBool haltaction =
FALSE;
108 if (SO_MOUSE_PRESS_EVENT(
event, BUTTON1)) {
109 if (this->mouseDownPickPath) {
110 this->mouseDownPickPath->unref();
111 this->mouseDownPickPath = NULL;
113 const SoPickedPoint * pp =
action->getPickedPoint();
117 SoPath * selectionpath = pp->getPath();
121 if (this->pickCBFunc && (!this->callPickCBOnlyIfSelectable ||
122 selectionpath->findNode(
this) >= 0)) {
123 selectionpath = this->pickCBFunc(this->pickCBData, pp);
128 if (lastsoselectionfrompath==
this) {
130 this->mouseDownPickPath = selectionpath;
131 this->mouseDownPickPath->ref();
136 else if (SO_MOUSE_RELEASE_EVENT(
event, BUTTON1)) {
138 SbBool ignorepick =
FALSE;
143 if (
action->isHandled()) {
152 if (haltaction)
action->setHandled();
155 if (selpath) selpath->ref();
156 this->startCBList->invokeCallbacks(
this);
157 this->invokeSelectionPolicy(selpath,
event->wasShiftDown());
158 this->finishCBList->invokeCallbacks(
this);
159 if (selpath) selpath->unref();
162 if (this->mouseDownPickPath) {
163 this->mouseDownPickPath->unref();
164 this->mouseDownPickPath = NULL;
183 if (this->pickMatching && this->mouseDownPickPath == NULL) {
186 const SoPickedPoint * pp =
action->getPickedPoint();
187 SoPath * selectionpath = NULL;
189 selectionpath = pp->getPath();
192 if (this->pickMatching && !this->pickCBFunc) {
193 if (*(this->mouseDownPickPath) != *selectionpath) {
200 if (this->pickCBFunc && (!this->callPickCBOnlyIfSelectable ||
201 selectionpath->findNode(
this) >= 0)) {
202 selectionpath = this->pickCBFunc(this->pickCBData, pp);
211 if (selectionpath->getLength() == 1 &&
212 selectionpath->getNode(0) ==
this) {
213 selectionpath->ref();
214 selectionpath->unref();
215 selectionpath = NULL;
217 else if (selectionpath->findNode(
this) >= 0) {
218 if (*(this->mouseDownPickPath) == *selectionpath) {
225 selectionpath->ref();
226 selectionpath->unref();
231 selectionpath->ref();
232 selectionpath->unref();
233 selectionpath = NULL;
245 else if (this->mouseDownPickPath) {
248 return selectionpath;