From 9a7ba04495cf5472769fa16ef03b69dd442062e3 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 19 Oct 2011 05:44:06 +0000 Subject: added the ability to right-click to get the Pd popup menu svn path=/trunk/externals/flatgui/; revision=15623 --- popup.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/popup.c b/popup.c index 7a9c899..bdf795a 100644 --- a/popup.c +++ b/popup.c @@ -55,6 +55,9 @@ typedef struct _popup t_symbol** x_options; int x_maxoptions; + /* IDs for Tk widgets */ + char *canvas_id; + int initialized; /* 1 when we are allowed to draw, 0 otherwise */ int x_disabled; /* when disabled, graphical chosing is prohibited */ } t_popup; @@ -65,6 +68,40 @@ typedef struct _popup #define DEBUG(x) +/* widget helper functions */ +static void set_tk_widget_ids(t_popup *x, t_canvas *canvas) +{ + char buf[MAXPDSTRING]; + + /* Tk ID for the current canvas that this object is drawn in */ + sprintf(buf,".x%lx.c", (long unsigned int) canvas); + x->canvas_id = getbytes(strlen(buf) + 1); + strcpy(x->canvas_id, buf); +} + +static void bind_button_events(t_popup *x) +{ + /* mouse buttons */ + sys_vgui("bind %s.s%lx