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

buttons.H

Go to the documentation of this file.
00001 #ifndef GLUE_DEVBTNS_H
00002 #define GLUE_DEVBTNS_H
00003 
00004 #include "event/event.H"
00005 #include "dev/dev.H"
00006 
00007 
00008 class XYpt;
00009 typedef const XYpt cXYpt;
00010 class Wpt;
00011 typedef const Wpt cWpt;
00012 class Wtransf;
00013 typedef const Wtransf cWtransf;
00014 
00015 //
00016 //   EVENTbtn - a button transition event
00017 //
00018 //
00019 MAKE_PTR_SUBC(EVENTbtn, EVENT);
00020 class DllImpExp EVENTbtn : public EVENT {
00021 
00022   protected:
00023     bool   _transition;
00024 
00025     /* ----------- EVENT methods --------------- */
00026     virtual bool compare(cEVENTptr &e) const;
00027     virtual void debug_data(ostream &o)const { o << " " <<
00028                                                  (_transition ? "down":"up"); }
00029 
00030   public:
00031 
00032     EVENTbtn(Cstr_ptr &n, bool t=true)   : EVENT(new EVENTsource(n)),
00033                                            _transition(t) { }
00034     EVENTbtn(cEVENTsource *s, bool t=true): EVENT(s),
00035                                            _transition(t) { }
00036 
00037     bool transition()  const { return _transition; }
00038 
00039 
00040     /* ----------- TYPEDOBJ methods --------------- */
00041     DEFINE_DERIVED_TYPE(EVENTbtn, EVENT, cEVENTptr);
00042    static EVENTbtnptr cast(cEVENTptr &e) { return EVENTbtn::isa(e) ? 
00043                                                  (EVENTbtn *)&*e : 0; }
00044 };
00045 
00046 //
00047 //   EVENTbtn - a button transition event
00048 //
00049 //
00050 MAKE_PTR_SUBC(EVENTbtn_2d, EVENTbtn);
00051 class EVENTbtn_2d : public EVENTbtn {
00052 
00053   protected:
00054     cXYpt   &_cur;
00055 
00056   public:
00057 
00058     EVENTbtn_2d(Cstr_ptr &n, cXYpt &c, bool t=true): 
00059                                               EVENTbtn(n,t),_cur(c) { }
00060     EVENTbtn_2d(cEVENTsource *s, cXYpt &c, bool t=true): 
00061                                               EVENTbtn(s,t),_cur(c) { }
00062 
00063     cXYpt &cur()  const { return _cur; }
00064 
00065 
00066     /* ----------- TYPEDOBJ methods --------------- */
00067     DEFINE_DERIVED_TYPE(EVENTbtn_2d, EVENTbtn, cEVENTptr);
00068    static EVENTbtn_2dptr cast(cEVENTptr &e) { return EVENTbtn_2d::isa(e) ? 
00069                                                  (EVENTbtn_2d *)&*e : 0; }
00070 };
00071 
00072 //
00073 //   EVENTbtn - a button transition event
00074 //
00075 //
00076 MAKE_PTR_SUBC(EVENTbtn_3d, EVENTbtn);
00077 class EVENTbtn_3d : public EVENTbtn {
00078 
00079   protected:
00080     cWpt    &_cur;
00081 
00082   public:
00083 
00084     EVENTbtn_3d(Cstr_ptr &n, cWpt &c, bool t=true): 
00085                                               EVENTbtn(n,t),_cur(c) { }
00086     EVENTbtn_3d(cEVENTsource *s, cWpt &c, bool t=true): 
00087                                               EVENTbtn(s,t),_cur(c) { }
00088 
00089     cXYpt  cur()  const;
00090 
00091 
00092     /* ----------- TYPEDOBJ methods --------------- */
00093     DEFINE_DERIVED_TYPE(EVENTbtn_3d, EVENTbtn, cEVENTptr);
00094    static EVENTbtn_3dptr cast(cEVENTptr &e) { return EVENTbtn_3d::isa(e) ? 
00095                                                  (EVENTbtn_3d *)&*e : 0; }
00096 };
00097 
00098 
00099 //
00100 //   EVENTbtn - a button transition event
00101 //
00102 //
00103 MAKE_PTR_SUBC(EVENTbtn_6d, EVENTbtn);
00104 class EVENTbtn_6d : public EVENTbtn {
00105 
00106   protected:
00107     cWtransf    &_cur;
00108 
00109   public:
00110 
00111     EVENTbtn_6d(Cstr_ptr &n, bool t=true);
00112     EVENTbtn_6d(Cstr_ptr &n, cWtransf &c, bool t=true): 
00113                                               EVENTbtn(n,t),_cur(c) { }
00114     EVENTbtn_6d(cEVENTsource *s, cWtransf &c, bool t=true): 
00115                                               EVENTbtn(s,t),_cur(c) { }
00116 
00117     cWtransf  &cur()  const;
00118 
00119 
00120     /* ----------- TYPEDOBJ methods --------------- */
00121     DEFINE_DERIVED_TYPE(EVENTbtn_6d, EVENTbtn, cEVENTptr);
00122    static EVENTbtn_6dptr cast(cEVENTptr &e) { return EVENTbtn_6d::isa(e) ? 
00123                                                  (EVENTbtn_6d *)&*e : 0; }
00124 };
00125 
00126 //
00127 //   EVENTbtn_vr - a button transition event
00128 //
00129 //
00130 MAKE_PTR_SUBC(EVENTbtn_vr, EVENTbtn);
00131 class DllImpExp EVENTbtn_vr : public EVENTbtn {
00132 
00133   protected:
00134     cWtransf    &_cur;
00135     cWtransf    &_head;
00136 
00137   public:
00138 
00139     EVENTbtn_vr(Cstr_ptr &n, bool t=true);
00140     EVENTbtn_vr(Cstr_ptr &n, cWtransf &h, cWtransf &c, bool t=true): 
00141                                               EVENTbtn(n,t),_cur(c),_head(h){ }
00142     EVENTbtn_vr(cEVENTsource *s, cWtransf &h, cWtransf &c, bool t=true): 
00143                                               EVENTbtn(s,t),_cur(c),_head(h){ }
00144 
00145     cWtransf &cur()  const;
00146     cWtransf &head() const;
00147 
00148 
00149     /* ----------- TYPEDOBJ methods --------------- */
00150     DEFINE_DERIVED_TYPE(EVENTbtn_vr, EVENTbtn, cEVENTptr);
00151    static EVENTbtn_vrptr cast(cEVENTptr &e) { return EVENTbtn_vr::isa(e) ? 
00152                                                  (EVENTbtn_vr *)&*e : 0; }
00153 };
00154 
00155 
00156 //
00157 //   DEVice_btn - a buttons device
00158 //
00159 //
00160 class DllImpExp DEVice_btn : public DEVice {
00161   public :
00162                 DEVice_btn(Cstr_ptr &name, Cstr_ptr &evt_name="");
00163    virtual     ~DEVice_btn()            { }
00164 
00165    virtual void event(bool t)           { distrib(new EVENTbtn(this,t)); }
00166    virtual void event(bool t, cXYpt &c) { distrib(new EVENTbtn_2d(this,c,t));}
00167    virtual void event(bool t, cWpt  &c) { distrib(new EVENTbtn_3d(this,c,t));}
00168    virtual void event(bool t, cWtransf&c){ distrib(new EVENTbtn_6d(this,c,t));}
00169 
00170     /* ----------- TYPEDOBJ methods --------------- */
00171     DEFINE_DERIVED_TYPE(DEVice_btn, DEVice, const DEVice *);
00172 };
00173 
00174 
00175 
00176 #endif

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