00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef _SO_SELECTION_
00052 #define _SO_SELECTION_
00053
00054 #include <Inventor/SoLists.h>
00055 #include <Inventor/SbColor.h>
00056 #include <Inventor/misc/SoCallbackList.h>
00057 #include <Inventor/nodes/SoSeparator.h>
00058
00059 #include <Inventor/STL/list>
00060
00061 class SoCallbackList;
00062 class SoEvent;
00063 class SoHandleEventAction;
00064 class SoSearchAction;
00065 class SoPickedPoint;
00066 class SoPickedPointList;
00067 class SoTypeList;
00068 class SoSelection;
00069 class SoPath;
00070
00071
00072
00076 typedef void SoSelectionPathCB(void *userData, SoPath *path);
00080 typedef void SoSelectionClassCB(void *userData, SoSelection *sel);
00084 typedef SoPath * SoSelectionPickCB(void *userData, const SoPickedPoint *pick);
00085
00087
00088
00089
00090
00091
00093
00094 SO_PIMPL_PUBLIC_DECLARATION( SoSelection )
00095
00096
00299 class SoSelection : public SoSeparator {
00300
00301 SO_NODE_HEADER(SoSelection);
00302 SO_PIMPL_PUBLIC_HEADER( SoSelection );
00303
00304 public:
00308 SoSelection();
00312 SoSelection(int nChildren);
00313
00314
00315
00316
00317
00318
00319 enum Policy {
00325 SINGLE,
00326
00331 TOGGLE,
00332
00337 SHIFT,
00338
00342 DISABLE
00343 };
00344
00345
00351 SoSFEnum policy;
00352
00353
00354
00355
00356
00364 void select(const SoPath *path);
00371 void select(SoNode *node);
00372
00376 void deselect(const SoPath *path);
00381 void deselect(int which);
00388 void deselect(SoNode *node);
00389
00394 void toggle(const SoPath *path);
00400 void toggle(SoNode *node);
00401
00406 SbBool isSelected(const SoPath *path) const;
00413 SbBool isSelected(SoNode *node) const;
00419 SbBool isSelected(const SoNode *node) const;
00420
00424 void deselectAll();
00425
00429 int getNumSelected() const;
00433 const SoPathList* getList() const;
00437 SoPath *getPath(int index) const;
00438
00442 SoPath * operator [](int i) const
00443 { return getPath(i); }
00444
00451 void setPickRadius( float radiusInPixels );
00452
00457 float getPickRadius() const;
00458
00459
00460
00461
00462
00463
00464
00465
00473 void addSelectionCallback(SoSelectionPathCB *f, void *userData = NULL);
00481 void removeSelectionCallback(SoSelectionPathCB *f, void *userData = NULL);
00482
00490 void addDeselectionCallback(SoSelectionPathCB *f, void *userData = NULL);
00498 void removeDeselectionCallback(SoSelectionPathCB *f, void *userData = NULL);
00499
00510 void addStartCallback(SoSelectionClassCB *f, void *userData = NULL);
00521 void removeStartCallback(SoSelectionClassCB *f, void *userData = NULL);
00522
00532 void addFinishCallback(SoSelectionClassCB *f, void *userData = NULL);
00542 void removeFinishCallback(SoSelectionClassCB *f, void *userData = NULL);
00543
00582 void setPickFilterCallback(
00583 SoSelectionPickCB *f,
00584 void *userData = NULL,
00585 SbBool callOnlyIfSelectable = TRUE);
00586
00595 void setPickMatching( SbBool pickTwice );
00599 SbBool isPickMatching() const;
00600
00601 private:
00602
00603
00604 virtual void handleEvent(SoHandleEventAction *action);
00605
00606 private:
00607
00608 virtual void notify(SoNotList *list);
00609
00610
00611
00612 void addChangeCallback(SoSelectionClassCB *f, void *userData = NULL);
00613 void removeChangeCallback(SoSelectionClassCB *f, void *userData = NULL);
00614
00615 SbBool getPickMatching() const;
00616
00617
00618 static void initClass();
00619 static void exitClass();
00620
00621
00622 void addPaths( const SoPathList &in );
00623
00624 private:
00625
00626
00627 virtual ~SoSelection();
00628
00629 private:
00630
00631
00632 void constructorCommon();
00633 };
00634
00635 #endif
00636