Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

CallbackHandlers.h

Go to the documentation of this file.
00001 
00048 #ifndef _AMIRE_COMPONENT_CALLBACK_HANDLERS_H
00049 #define _AMIRE_COMPONENT_CALLBACK_HANDLERS_H
00050 
00051 #include <amire/common/Defines.h>
00052 #include <amire/common/Vector.h>
00053 #include <amire/property/PropertyTypeManager.h>
00054 #include <amire/component/Component.h>
00055 #include <amire/component/ComponentState.h>
00056 
00057 namespace amire {
00058   namespace component {
00075     typedef enum {
00076       SETTING_MODE = 0,
00077       OPAQUE_RENDER_MODE,
00078       SHADOW_RENDER_MODE,
00079       BLENDING_RENDER_MODE,
00080       FOREGROUND_RENDER_MODE
00081     } RenderMode;
00082 
00090     class AMIRE_EXPORT_API RenderingHandler : public virtual Handler {
00091     public:
00092       virtual ~RenderingHandler();
00093 
00098       virtual bool getZRange(double &zNear, double &zFar);
00099     };
00100 
00107     class AMIRE_EXPORT_API OccluderHandler : public virtual RenderingHandler {
00108     public:
00109       virtual ~OccluderHandler();
00110 
00120       virtual void occluderCallback(MREngine *engine) = 0;
00121     };
00122 
00129     class AMIRE_EXPORT_API DisplayHandler : public virtual RenderingHandler {
00130     public:
00131       virtual ~DisplayHandler();
00132 
00140       virtual void displayCallback(MREngine *engine, RenderMode mode) = 0;
00141     };
00142 
00163     typedef enum {
00164       NORMAL_PICK               = 1 <<  1,
00165       BUTTON1_PRESS_PICK        = 1 <<  2,
00166       BUTTON2_PRESS_PICK        = 1 <<  3,
00167       BUTTON3_PRESS_PICK        = 1 <<  4,
00168       BUTTON1_PRESSED_PICK      = 1 <<  5,
00169       BUTTON2_PRESSED_PICK      = 1 <<  6,
00170       BUTTON3_PRESSED_PICK      = 1 <<  7,
00171       BUTTON1_RELEASE_PICK      = 1 <<  8,
00172       BUTTON2_RELEASE_PICK      = 1 <<  9,
00173       BUTTON3_RELEASE_PICK      = 1 << 10,
00174       BUTTON1_CLICK_PICK        = 1 << 11,
00175       BUTTON2_CLICK_PICK        = 1 << 12,
00176       BUTTON3_CLICK_PICK        = 1 << 13,
00177       BUTTON1_DOUBLE_CLICK_PICK = 1 << 14,
00178       BUTTON2_DOUBLE_CLICK_PICK = 1 << 15,
00179       BUTTON3_DOUBLE_CLICK_PICK = 1 << 16,
00180       WHEEL_UP_PICK             = 1 << 17,
00181       WHEEL_DOWN_PICK           = 1 << 18,
00182       SELECT_PICK               = 1 << 19
00183     } PickingMode;
00184 
00191     typedef enum {
00192       PICK_NOTHING             = 0,
00193       PICK_EVERYTHING          = -1,
00194       PICK_BUTTON1_EVERYTHING  = BUTTON1_PRESS_PICK | BUTTON1_PRESSED_PICK | BUTTON1_CLICK_PICK | BUTTON1_DOUBLE_CLICK_PICK,
00195       PICK_BUTTON2_EVERYTHING  = BUTTON2_PRESS_PICK | BUTTON2_PRESSED_PICK | BUTTON2_CLICK_PICK | BUTTON2_DOUBLE_CLICK_PICK,
00196       PICK_BUTTON3_EVERYTHING  = BUTTON3_PRESS_PICK | BUTTON3_PRESSED_PICK | BUTTON3_CLICK_PICK | BUTTON3_DOUBLE_CLICK_PICK,
00197       PICK_BUTTON_PRESS        = BUTTON1_PRESS_PICK | BUTTON2_PRESS_PICK | BUTTON3_PRESS_PICK,
00198       PICK_BUTTON_PRESSED      = BUTTON1_PRESSED_PICK | BUTTON2_PRESSED_PICK | BUTTON3_PRESSED_PICK,
00199       PICK_BUTTON_RELEASE      = BUTTON1_RELEASE_PICK | BUTTON2_RELEASE_PICK | BUTTON3_RELEASE_PICK,
00200       PICK_BUTTON_CLICK        = BUTTON1_CLICK_PICK | BUTTON2_CLICK_PICK | BUTTON3_CLICK_PICK,
00201       PICK_BUTTON_DOUBLE_CLICK = BUTTON1_DOUBLE_CLICK_PICK | BUTTON2_DOUBLE_CLICK_PICK | BUTTON3_DOUBLE_CLICK_PICK,
00202       PICK_WHEEL_EVERYTHING    = WHEEL_UP_PICK | WHEEL_DOWN_PICK
00203     } PickingMask;
00204 
00213     class Action : public virtual osg::Referenced {
00214     private:
00215       const char *command;
00216 
00217     public:
00218       inline Action(const char *command) {
00219         this->command = command;
00220       }
00221 
00222       virtual ~Action();
00223 
00227       inline const char *getCommand() const {
00228         return command;
00229       }
00230     };
00231 
00237     class Position2DAction : public virtual Action {
00238     protected:
00239       double x;
00240       double y;
00241       long pickingMode;
00242 
00243     public:
00244       inline Position2DAction(double x, double y, long pickingMode)
00245           : Action("Position2DAction") {
00246         this->x = x;
00247         this->y = y;
00248         this->pickingMode = pickingMode;
00249       }
00250 
00251       virtual ~Position2DAction();
00252 
00256       inline double getX() const {
00257         return x;
00258       }
00259 
00263       inline double getY() const {
00264         return y;
00265       }
00266 
00271       inline long getPickingMode() const {
00272         return pickingMode;
00273       }
00274     };
00275 
00281     class Position3DAction : public virtual Action {
00282     protected:
00283       amire::common::Vector position;
00284       long pickingMode;
00285 
00286     public:
00287       Position3DAction(const amire::common::Vector &pposition, long pickingMode)
00288           : Action("Position3DAction"), position(pposition) {
00289         this->pickingMode = pickingMode;
00290       }
00291 
00292       virtual ~Position3DAction();
00293 
00297       inline const amire::common::Vector &getPosition() const {
00298         return position;
00299       }
00300 
00305       inline long getPickingMode() const {
00306         return pickingMode;
00307       }
00308     };
00309 
00316     class DirectionPointerAction : public virtual Action {
00317     protected:
00318       amire::common::Vector position;
00319       amire::common::Vector direction;
00320       long pickingMode;
00321 
00322     public:
00323       DirectionPointerAction(const amire::common::Vector &pposition, const amire::common::Vector &pdirection, long pickingMode)
00324           : Action("DirectionPointerAction"), position(pposition), direction(pdirection) {
00325         this->pickingMode = pickingMode;
00326       }
00327 
00328       virtual ~DirectionPointerAction();
00329 
00333       inline const amire::common::Vector &getPosition() const {
00334         return position;
00335       }
00336 
00340       inline const amire::common::Vector &getDirection() const {
00341         return direction;
00342       }
00343 
00348       inline long getPickingMode() const {
00349         return pickingMode;
00350       }
00351     };
00352 
00357     class AMIRE_EXPORT_API MouseHandler : public virtual Handler {
00358     public:
00359       virtual ~MouseHandler();
00360 
00366       virtual void mouseDrag(MREngine *engine, int x, int y) = 0;
00367 
00372       virtual void mouseMotion(MREngine *engine, int x, int y) = 0;
00373 
00378       virtual void mouseButton(MREngine *engine, int button, int state, int x, int y) = 0;
00379     };
00380 
00386     class AMIRE_EXPORT_API ActionHandler : public virtual Handler {
00387     public:
00388       virtual ~ActionHandler();
00389 
00396       virtual void actionPerformed(const osg::ref_ptr<Action> &action) = 0;
00397     };
00398 
00402     class AMIRE_EXPORT_API KeyHandler : public virtual ActionHandler {
00403     public:
00404       virtual ~KeyHandler();
00405 
00411       virtual bool keyPressed(MREngine *engine, long modifier, int key) const = 0;
00412     };
00413 
00417     class AMIRE_EXPORT_API Position2DPickingHandler : public virtual ActionHandler {
00418     public:
00419       virtual ~Position2DPickingHandler();
00420 
00427       virtual bool pickingCallback(MREngine *engine, double x, double y, long pickingMode, double &distance) const = 0;
00428     };
00429 
00433     class AMIRE_EXPORT_API Position3DPickingHandler : public virtual ActionHandler {
00434     public:
00435       virtual ~Position3DPickingHandler();
00436 
00443       virtual bool pickingCallback(MREngine *engine, const amire::common::Vector &point, long pickingMode, double &distance) const = 0;
00444     };
00445 
00449     class AMIRE_EXPORT_API DirectionPointerPickingHandler : public virtual ActionHandler {
00450     public:
00451       virtual ~DirectionPointerPickingHandler();
00452 
00459       virtual bool pickingCallback(MREngine *engine, const amire::common::Vector &point, const amire::common::Vector &direction, long pickingMode, double &distance) const = 0;
00460     };
00461   }
00462 }
00463 
00464 #endif

Generated on Tue May 20 17:23:52 2003 for AMIRE-Framework by doxygen1.3