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
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 #ifndef VRS_SELECTOR_H
00072 #define VRS_SELECTOR_H
00073
00074 #include <vrs/sg/manipulator.h>
00075 #include <vrs/sg/inputevent.h>
00076 #include <vrs/sg/canvas.h>
00077 #include <vrs/callback.h>
00078 #include <vrs/rayrequest.h>
00079 #include <vrs/engine.h>
00080
00081 namespace VRS {
00082
00084 class VRS_CORE_API Selector : public Manipulator {
00085
00086 public:
00087 Selector(
00088 InputEvent::Button button,
00089 InputEvent::Modifier must_modifier=InputEvent::NoModifier,
00090 InputEvent::Modifier must_not_modifier=InputEvent::NoModifier,
00091
00092 RayRequest* startRequest = (RayRequest*)0,
00093 RayRequest* motionRequest = (RayRequest*)0,
00094 RayRequest* endRequest = (RayRequest*)0,
00095
00096 Callback* startCallback = (Callback*)0,
00097 Callback* motionCallback = (Callback*)0,
00098 Callback* endCallback = (Callback*)0
00099 );
00103 void setStartRequest(RayRequest* rayreq);
00104 RayRequest* getStartRequest() const;
00105
00106 void setMotionRequest(RayRequest* rayreq);
00107 RayRequest* getMotionRequest() const;
00108
00109 void setEndRequest(RayRequest* rayreq);
00110 RayRequest* getEndRequest() const;
00111
00112 virtual BehaviorNode::InvalidationHint dragStart(int x, int y, ButtonEvent* e);
00113 virtual BehaviorNode::InvalidationHint dragMotion(int x, int y, MotionEvent* e);
00114 virtual BehaviorNode::InvalidationHint dragEnd(int x, int y, ButtonEvent* e);
00115 void dragRedraw(int flag);
00116 InputEvent* dragEvent() const;
00128 VRS_TYPEINFO(Selector, Manipulator);
00129
00130 private:
00131 SO<RayRequest> startRequest_;
00132 SO<RayRequest> motionRequest_;
00133 SO<RayRequest> endRequest_;
00134 SO<Engine> engine_;
00135
00136 InputEvent* dragEvent_;
00137 BehaviorNode::InvalidationHint dragRedraw_;
00138
00139 void performRayRequest(int, int, Canvas*, RayRequest*);
00140 };
00141
00142 inline void Selector::dragRedraw(int f) { dragRedraw_ = static_cast<BehaviorNode::InvalidationHint>(f); }
00143 inline InputEvent* Selector::dragEvent() const { return dragEvent_; }
00144
00145 inline void Selector::setStartRequest(RayRequest* r) { startRequest_ = r; modified(); }
00146 inline void Selector::setMotionRequest(RayRequest* r) { motionRequest_ = r; modified(); }
00147 inline void Selector::setEndRequest(RayRequest* r) { endRequest_ = r; modified(); }
00148
00149 inline RayRequest* Selector::getStartRequest() const { return startRequest_; }
00150 inline RayRequest* Selector::getMotionRequest() const { return motionRequest_; }
00151 inline RayRequest* Selector::getEndRequest() const { return endRequest_; }
00152
00153 }
00154
00155 #endif // VRS_SELECTOR_H