00001 #ifndef PEN_H_IS_INCLUDED
00002 #define PEN_H_IS_INCLUDED
00003
00004
00005
00006
00007
00008
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
00024
00025 class Pen : public Simple_int, public GestObs {
00026 protected:
00027
00028
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
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
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
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
00060 virtual void activate(State *);
00061
00062
00063 virtual bool deactivate(State *);
00064
00065
00066 virtual void notify_gesture(GEST_INT*, CGESTUREptr&);
00067
00068
00069 virtual void key(CEvent &) { return; }
00070
00071
00072 virtual int erase_down (CEvent &,State *&);
00073 virtual int erase_move (CEvent &,State *&);
00074 virtual int erase_up (CEvent &,State *&);
00075
00076
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
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