1 #ifndef COIN_SOACTION_H
2 #define COIN_SOACTION_H
27 #include <Inventor/SbBasic.h>
28 #include <Inventor/SoType.h>
29 #include <Inventor/misc/SoTempPath.h>
34 #include <Inventor/lists/SoActionMethodList.h>
35 #include <Inventor/lists/SoEnabledElementsList.h>
38 #ifdef COIN_UNDEF_IN_PATH_HACK
39 #include <sys/unistd.h>
52 #define SO_ENABLE(action, element) \
54 assert(!element::getClassTypeId().isBad()); \
55 action::enableElement(element::getClassTypeId(), \
56 element::getClassStackIndex()); \
70 enum PathCode { NO_PATH = 0, IN_PATH = 1, BELOW_PATH = 2, OFF_PATH = 3 };
74 static void initClass(
void);
75 static void initClasses(
void);
77 static SoType getClassTypeId(
void);
78 virtual SoType getTypeId(
void)
const = 0;
79 virtual SbBool isOfType(
SoType type)
const;
82 virtual void apply(
SoNode * root);
83 virtual void apply(
SoPath * path);
84 virtual void apply(
const SoPathList & pathlist, SbBool obeysrules = FALSE);
86 virtual void invalidateState(
void);
90 AppliedCode getWhatAppliedTo(
void)
const;
91 SoNode * getNodeAppliedTo(
void)
const;
92 SoPath * getPathAppliedTo(
void)
const;
93 const SoPathList * getPathListAppliedTo(
void)
const;
94 const SoPathList * getOriginalPathListAppliedTo(
void)
const;
96 SbBool isLastPathListAppliedTo(
void)
const;
98 PathCode getPathCode(
int & numindices,
const int * & indices);
100 void traverse(
SoNode *
const node);
101 SbBool hasTerminated(
void)
const;
103 const SoPath * getCurPath(
void);
104 SoState * getState(
void)
const;
106 PathCode getCurPathCode(
void)
const;
107 virtual SoNode * getCurPathTail(
void);
108 void usePathCode(
int & numindices,
const int * & indices);
110 void pushCurPath(
const int childindex,
SoNode * node = NULL);
111 void popCurPath(
const PathCode prevpathcode);
112 void pushCurPath(
void);
114 void popPushCurPath(
const int childindex,
SoNode * node = NULL);
115 void popCurPath(
void);
118 void switchToPathTraversal(
SoPath * path);
119 void switchToNodeTraversal(
SoNode * node);
125 virtual void beginTraversal(
SoNode * node);
126 virtual void endTraversal(
SoNode * node);
127 void setTerminated(
const SbBool flag);
130 virtual SbBool shouldCompactPathList(
void)
const;
142 static SoType classTypeId;
147 static void atexit_cleanup(
void);
150 SoTempPath currentpath;
161 return this->currentpathcode;
167 this->currentpath.pop();
168 this->currentpathcode = prevpathcode;
171 #endif // !COIN_SOACTION_H