diff options
author | mescalinum <mescalinum@users.sourceforge.net> | 2009-09-15 21:57:00 +0000 |
---|---|---|
committer | mescalinum <mescalinum@users.sourceforge.net> | 2009-09-15 21:57:00 +0000 |
commit | 5b7b433329d8bd25fe95e3222cbe2b3148fe64dd (patch) | |
tree | a26de342f8361fc0f016a3025b0ee5bb050a92a1 /tcl_widgetbehavior.cxx | |
parent | 789b8a365a24e2ee5d7029e2df9f06712b0c01b8 (diff) |
add support for glist_grab() and motionfn
svn path=/trunk/externals/tclpd/; revision=12359
Diffstat (limited to 'tcl_widgetbehavior.cxx')
-rw-r--r-- | tcl_widgetbehavior.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tcl_widgetbehavior.cxx b/tcl_widgetbehavior.cxx index 8167803..818e9a4 100644 --- a/tcl_widgetbehavior.cxx +++ b/tcl_widgetbehavior.cxx @@ -1,6 +1,39 @@ #include "tcl_extras.h" #include <string.h> +void tclpd_guiclass_motion(t_tcl* x, t_floatarg dx, t_floatarg dy) { + Tcl_Obj* av[5]; InitArray(av, 5, NULL); + int tmp[4], i, length; + av[0] = x->self; + Tcl_IncrRefCount(av[0]); + av[1] = Tcl_NewStringObj("widgetbehavior", -1); + Tcl_IncrRefCount(av[1]); + av[2] = Tcl_NewStringObj("motion", -1); + Tcl_IncrRefCount(av[2]); + av[3] = Tcl_NewDoubleObj(dx); + Tcl_IncrRefCount(av[3]); + av[4] = Tcl_NewDoubleObj(dy); + Tcl_IncrRefCount(av[4]); + int result = Tcl_EvalObjv(tcl_for_pd, 5, av, 0); + if(result != TCL_OK) { + tclpd_interp_error(result); + goto error; + } + goto cleanup; +error: +cleanup: + Tcl_DecrRefCount(av[0]); + Tcl_DecrRefCount(av[1]); + Tcl_DecrRefCount(av[2]); + Tcl_DecrRefCount(av[3]); + Tcl_DecrRefCount(av[4]); +} + +void tclpd_guiclass_grab(t_tcl* x, t_glist* glist, int xpix, int ypix) { + glist_grab(glist, &x->o.te_g, (t_glistmotionfn)tclpd_guiclass_motion, 0, \ + (t_floatarg)xpix, (t_floatarg)ypix); +} + int tclpd_guiclass_click(t_gobj* z, t_glist* glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { Tcl_Obj* av[9]; InitArray(av, 9, NULL); Tcl_Obj* o = NULL; @@ -52,6 +85,8 @@ cleanup: Tcl_DecrRefCount(av[6]); Tcl_DecrRefCount(av[7]); Tcl_DecrRefCount(av[8]); + + // return value (BOOL) means 'object wants to be clicked' (g_editor.c:1270) return i; } |