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
00303 class SoSelection : public SoSeparator {
00304
00305 SO_NODE_HEADER(SoSelection);
00306 SO_PIMPL_PUBLIC_HEADER( SoSelection );
00307
00308 public:
00312 SoSelection();
00316 SoSelection(int nChildren);
00317
00318
00319
00320
00321
00322
00323 enum Policy {
00329 SINGLE,
00330
00335 TOGGLE,
00336
00341 SHIFT,
00342
00346 DISABLE
00347 };
00348
00349
00355 SoSFEnum policy;
00356
00357
00358
00359
00360
00368 void select(const SoPath *path);
00375 void select(SoNode *node);
00376
00380 void deselect(const SoPath *path);
00385 void deselect(int which);
00392 void deselect(SoNode *node);
00393
00398 void toggle(const SoPath *path);
00404 void toggle(SoNode *node);
00405
00410 SbBool isSelected(const SoPath *path) const;
00417 SbBool isSelected(SoNode *node) const;
00423 SbBool isSelected(const SoNode *node) const;
00424
00428 void deselectAll();
00429
00433 int getNumSelected() const;
00437 const SoPathList* getList() const;
00441 SoPath *getPath(int index) const;
00442
00446 SoPath * operator [](int i) const
00447 { return getPath(i); }
00448
00455 void setPickRadius( float radiusInPixels );
00456
00461 float getPickRadius() const;
00462
00463
00464
00465
00466
00467
00468
00469
00477 void addSelectionCallback(SoSelectionPathCB *f, void *userData = NULL);
00485 void removeSelectionCallback(SoSelectionPathCB *f, void *userData = NULL);
00486
00494 void addDeselectionCallback(SoSelectionPathCB *f, void *userData = NULL);
00502 void removeDeselectionCallback(SoSelectionPathCB *f, void *userData = NULL);
00503
00514 void addStartCallback(SoSelectionClassCB *f, void *userData = NULL);
00525 void removeStartCallback(SoSelectionClassCB *f, void *userData = NULL);
00526
00536 void addFinishCallback(SoSelectionClassCB *f, void *userData = NULL);
00546 void removeFinishCallback(SoSelectionClassCB *f, void *userData = NULL);
00547
00586 void setPickFilterCallback(
00587 SoSelectionPickCB *f,
00588 void *userData = NULL,
00589 SbBool callOnlyIfSelectable = TRUE);
00590
00599 void setPickMatching( SbBool pickTwice );
00603 SbBool isPickMatching() const;
00604
00605 private:
00606
00607
00608 virtual void handleEvent(SoHandleEventAction *action);
00609
00610 private:
00611
00612 virtual void notify(SoNotList *list);
00613
00614
00615
00616 void addChangeCallback(SoSelectionClassCB *f, void *userData = NULL);
00617 void removeChangeCallback(SoSelectionClassCB *f, void *userData = NULL);
00618
00619 SbBool getPickMatching() const;
00620
00621
00622 static void initClass();
00623 static void exitClass();
00624
00625
00626 void addPaths( const SoPathList &in );
00627
00628 private:
00629
00630
00631 virtual ~SoSelection();
00632
00633 private:
00634
00635
00636 void constructorCommon();
00637 };
00638
00639 #endif
00640