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

dev2d.H

Go to the documentation of this file.
00001 #ifndef GLUE_DEV2D_H
00002 #define GLUE_DEV2D_H
00003 
00004 #include "event/event.H"
00005 #include "dev/dev.H"
00006 
00007 class XYvec;
00008 typedef const XYvec cXYvec;
00009 class XYpt;
00010 typedef const XYpt cXYpt;
00011 class Wpt;
00012 typedef const Wpt cWpt;
00013 class Wtransf;
00014 typedef const Wtransf cWtransf;
00015 typedef Greal RAWmat[4][4];
00016 
00017 //
00018 //   DEVice_2d - a 2 DOF device such as a mouse or a tablet
00019 //
00020 //   
00021 //
00022 class DllImpExp DEVice_2d : public DEVice {
00023   protected:
00024    XYpt      &_cur;
00025 
00026   public :
00027                 DEVice_2d(Cstr_ptr &devname, Cstr_ptr &evtname="pointer");
00028    virtual     ~DEVice_2d()                 { }
00029 
00030    cXYpt       &cur       ()          const { return _cur; }
00031    void         set_cur   (cXYpt &p);
00032 
00033    virtual void event_delta(cXYvec &v);
00034    virtual void event(cXYpt &);
00035 
00036     /* ----------- TYPEDOBJ methods --------------- */
00037     DEFINE_DERIVED_TYPE(DEVice_2d, DEVice, const DEVice *);
00038 };
00039 
00040 MAKE_PTR_SUBC(EVENT2d, EVENT);
00041 class DllImpExp EVENT2d : public EVENT {
00042  public:
00043 
00044    EVENT2d(Cstr_ptr    &n);
00045    EVENT2d(Cstr_ptr    &n, cXYpt &o, cXYpt &c);
00046    EVENT2d(EVENTsource *s);
00047    EVENT2d(DEVice_2d *s, cXYpt &o, cXYpt &c):EVENT(s),_old(o),_cur(c),_dev(s){}
00048 
00049    cXYpt        &cur    ()            const  { return _cur; }
00050    cXYpt        &old    ()            const  { return _old; }
00051    XYvec         delta  ()            const;
00052  
00053    void          set_cur(cXYpt &p)    const  { assert(_dev != NULL);_dev->set_cur(p); }
00054 
00055     /* ------------ TYPEDOBJ methods ---------------- */
00056 
00057    DEFINE_DERIVED_TYPE(EVENT2d, EVENT, cEVENTptr);
00058    static EVENT2dptr cast(cEVENTptr &e) { return EVENT2d::isa(e) ? 
00059                                                  (EVENT2d *)&*e : 0; }
00060 
00061 
00062  protected:
00063     /* ------------ EVENT methods ---------------- */
00064    virtual bool compare(cEVENTptr &e) const { return true; }
00065 
00066    cXYpt      &_old;
00067    cXYpt      &_cur;
00068 
00069    DEVice_2d *_dev;
00070 };
00071 
00072 MAKE_PTR_SUBC(EVENT2d_6d, EVENT2d);
00073 class DllImpExp EVENT2d_6d : public EVENT2d {
00074  public:
00075 
00076    EVENT2d_6d(Cstr_ptr    &n);
00077    EVENT2d_6d(EVENTsource *s);
00078    EVENT2d_6d(DEVice_2d *s, cXYpt &o, cXYpt &c, cWtransf &tracker);
00079 
00080   cWtransf  &tracker() const{return _tracker;}
00081 
00082 
00083     /* ------------ TYPEDOBJ methods ---------------- */
00084 
00085    DEFINE_DERIVED_TYPE(EVENT2d_6d, EVENT2d, cEVENTptr);
00086    static EVENT2d_6dptr cast(cEVENTptr &e) { return EVENT2d_6d::isa(e) ? 
00087                                                  (EVENT2d_6d *)&*e : 0; }
00088   protected:
00089     cWtransf    &_tracker;
00090 };
00091 
00092 
00093 
00094 #endif

Generated on Mon Sep 15 16:25:56 2003 for gluebase by doxygen1.2.18