Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

pen.H

Go to the documentation of this file.
00001 #ifndef PEN_H_IS_INCLUDED
00002 #define PEN_H_IS_INCLUDED
00003 
00004 /*!
00005  *  \file pen.H
00006  *  \brief Contains the definition of the Pen class.
00007  *
00008  *  \sa pen.C
00009  *
00010  */
00011 
00012 #include "disp/view.H"
00013 #include "geom/world.H"
00014 #include "manip/manip.H"
00015 #include "mesh/bface.H"
00016 #include "std/stop_watch.H"
00017 
00018 #include "gest/gest_int.H"
00019 #include "gest/gest_guards.H"
00020 #include "gest/mode_name.H"
00021 
00022 /******************************************************************
00023  * Pen:
00024  ******************************************************************/
00025 class Pen : public Simple_int, public GestObs {
00026  protected:
00027    
00028    // ******** MEMBERS ********
00029    GEST_INTptr  _gest_int;
00030    State       *_shift_fsa;
00031    State       *_ctrl_fsa;
00032    str_ptr      _pen_name;
00033    VIEWptr      _view;
00034    DrawState    _draw_start;
00035    DrawFSA      _fsa;
00036 
00037    // ******** INTERNAL METHODS ********
00038    typedef int (Pen::*callback_meth_t)(CEvent&, State *&);
00039    State  *create_fsa(CEvent &d, CEvent &m, CEvent &u,
00040                       callback_meth_t down, callback_meth_t move,
00041                       callback_meth_t up);
00042    int     check_interactive(CEvent &e, State *&s);
00043 
00044  public:
00045    //******** MANAGERS ********
00046    Pen(Cstr_ptr& pen_name,
00047        CGEST_INTptr &gest_int = GEST_INTptr(),
00048        CEvent &d = Event(), CEvent &m = Event(), CEvent &u = Event(),
00049        CEvent &shift_d = Event(), CEvent &shift_u  = Event(),
00050        CEvent &ctrl_d  = Event(),  CEvent &ctrl_u  = Event());
00051 
00052    // ******** CONVENIENCE ********
00053    str_ptr pen_name()           const { return _pen_name; }
00054    mlib::XYpt    get_ptr_position ()  const { return DEVice_2d::last->cur(); }
00055    mlib::XYpt    get_last_position()  const { return DEVice_2d::last->old(); }
00056 
00057    VIEWptr view() const { return _view; }
00058 
00059    // ******** PEN ACTIVATION ********
00060    virtual void activate(State *);
00061    //A false return prohibits a pen change
00062    //Some WORLD msg should say how to alleviate the challenge
00063    virtual bool deactivate(State *);
00064 
00065    // ******** GESTURE RECOGNITION ********
00066    virtual void notify_gesture(GEST_INT*, CGESTUREptr&);
00067 
00068    // ******** KEY PRESSES ********
00069    virtual void key(CEvent &) { return; }
00070 
00071    // ******** ERASER METHODS ********
00072    virtual int erase_down  (CEvent &,State *&);
00073    virtual int erase_move  (CEvent &,State *&);
00074    virtual int erase_up    (CEvent &,State *&);
00075 
00076    // ******** CONTROL-KEY METHODS ********
00077    virtual int ctrl_down(CEvent &,State *&)  {return 0;}
00078    virtual int ctrl_move(CEvent &,State *&)  {return 0;}
00079    virtual int ctrl_up  (CEvent &,State *&)  {return 0;}   
00080 
00081    // ******** Simple_int METHODS ********
00082    virtual int down(CEvent &,State *&);
00083    virtual int move(CEvent &,State *&);
00084    virtual int up  (CEvent &,State *&);
00085 };
00086 
00087 #endif  // PEN_H_IS_INCLUDED
00088 
00089 /* end of file pen.H */

Generated on Mon Sep 18 11:39:32 2006 for jot by  doxygen 1.4.4