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

mouse.H

Go to the documentation of this file.
00001 #ifndef GLUE_DEVMOUSE_H
00002 #define GLUE_DEVMOUSE_H
00003 
00004 #include "dev/dev.H"
00005 #include "dev/dev2d.H"
00006 #include "dev/buttons.H"
00007 
00008 inline str_ptr pstring(Cstr_ptr &p,const char *b) { 
00009    str_ptr d(p + str_ptr(b));
00010    cerr << d << endl; return d; 
00011 }
00012 
00013 //
00014 // DEVmouse - a 2D locator and an integral buttons device
00015 //    A DEVmouse encapsulates the concept of a standard mouse 
00016 // input device with 3-buttons.  The root string passed to the
00017 // DEVmouse constructor is the root of the configuration strings
00018 // that map to the mouse's event names.  So, for example, if
00019 // the root string "Xmouse" is passed, then the DEVmouse will
00020 // look for resources: Xmouse, Xmouse_button0, ... Xmouse_pointer.
00021 // The associated value of each of these configuration resources
00022 // is the tag name that all EVENTs coming from that sub-device
00023 // will have.  
00024 //
00025 class DEVmouse : public DEVice {
00026   protected:
00027    DEVice_2d   _ptr;
00028    DEVice_btn  _btn0;
00029    DEVice_btn  _btn1;
00030    DEVice_btn  _btn2;
00031    DEVice_btn  _btn3; // modified mouse w/ extra button on button0
00032 
00033   public :
00034                DEVmouse(Cstr_ptr &name): 
00035                              DEVice(name, "mouse"),
00036                               _ptr (name),
00037                               _btn0(name+"_0","button0"),
00038                               _btn1(name+"_1","button1"),
00039                               _btn2(name+"_2","button2"),
00040                               _btn3(name+"_3","button3")
00041                                              { _btn0.add_source(this);
00042                                                _btn1.add_source(this);
00043                                                _btn2.add_source(this);
00044                                                _btn3.add_source(this);
00045                                                _ptr .add_source(this); }
00046    virtual     ~DEVmouse()                   { }
00047 
00048    DEVice_2d   *pointer()                    { return &_ptr; }
00049    DEVice_btn  *button0()                    { return &_btn0; }
00050    DEVice_btn  *button1()                    { return &_btn1; }
00051    DEVice_btn  *button2()                    { return &_btn2; }
00052    DEVice_btn  *button3()                    { return &_btn3; }
00053 
00054     /* ----------- TYPEDOBJ methods --------------- */
00055     DEFINE_DERIVED_TYPE(DEVmouse, DEVice, const DEVice *);
00056 };
00057 
00058 
00059 
00060 #endif

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