diff options
author | Thomas O Fredericks <mrtof@users.sourceforge.net> | 2010-05-12 19:44:04 +0000 |
---|---|---|
committer | Thomas O Fredericks <mrtof@users.sourceforge.net> | 2010-05-12 19:44:04 +0000 |
commit | 3767b3a53a8f0dc410f097a521a9cd7dbe3783a1 (patch) | |
tree | a5f111f226ab57974c820b8f6aec2b49e0fdb55a /src/pmenu_w.h | |
parent | f6f29377728c80d1e1c72fdc3f9a113712d737f6 (diff) |
Update Makefile so it copies gifs needed by my help files
svn path=/trunk/externals/tof/; revision=13516
Diffstat (limited to 'src/pmenu_w.h')
-rw-r--r-- | src/pmenu_w.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/src/pmenu_w.h b/src/pmenu_w.h new file mode 100644 index 0000000..b1ff496 --- /dev/null +++ b/src/pmenu_w.h @@ -0,0 +1,91 @@ + +#define UPDATE 0 +#define CREATE 1 +#define DESTROY 2 + +#define COLUMNBREAK 30 + +static void pmenu_w_activate(t_pmenu* x){ + //sys_vgui("$%xw activate %i\n", x,x->current_selection); + //if ( x->indicator) { + sys_vgui("set %xradio %i\n",x,x->current_selection); + //} else { + + // sys_vgui("set %xradio %i\n",x,-1); + //} +} + + +static void pmenu_w_clear(t_pmenu* x){ + sys_vgui("$%xw delete 0 end \n", x); + //sys_vgui("set %xradio %i\n",x,-1); + x->current_selection = -1; + pmenu_w_activate(x); +} + +static void pmenu_w_additem(t_pmenu* x, t_symbol *label, int i) { + if ( x->indicator) { + sys_vgui("$%xw add radiobutton -label \"%s\" -command {select%x \"%d\"} -variable %xradio -value %d \n", + x, label->s_name, x, i,x,i); + + } else { + sys_vgui("$%xw add command -label \"%s\" -command {select%x \"%d\"} \n", + x, label->s_name, x, i,x,i); + } + if ( i == COLUMNBREAK ) sys_vgui("$%xw entryconfigure %i -columnbreak true \n",x,i); + +} + +static void pmenu_w_apply_colors(t_pmenu* x) { + + sys_vgui("$%xw configure -background \"%s\" -foreground \"%s\" -activeforeground \"%s\" -activebackground \"%s\" -selectcolor \"%s\"\n", x, + x->bg_color->s_name,x->fg_color->s_name,x->fg_color->s_name,x->hi_color->s_name,x->fg_color->s_name); + + +} + + +static void pmenu_w_menu(t_pmenu *x, int draw) +{ + DEBUG(post("menu start");) + + if ( draw == CREATE ) { + //x->created = 1; + // Create menu + //sys_vgui("set %xw .x%x.c.s%x ; menubutton $%xw -justify left + // Create a variable to store a pointer to the menu, create the menu, create a variable to store the selected item + sys_vgui("set %xw .%x ; menu $%xw -relief solid -tearoff 0; set %xradio -1 \n",x,x,x); + int i; + for(i=0 ; i<x->x_num_options ; i++) + { + // Add menu itmes + pmenu_w_additem(x,x->x_options[i],i); + } + } else if ( draw == DESTROY) { + //x->created = 0; + + + sys_vgui("destroy $%xw \n",x); + + } + + //DEBUG(post("id: .x%x.c.s%x", glist, x);) + DEBUG(post("menu end");) +} + + +static void pmenu_w_pop(t_pmenu *x) { + + if (x->x_num_options > 0) { + //if ( x->created == 0 ) pmenu_w_menu(x, glist, CREATE); + if ( x->current_selection != -1 && x->focusing) { + sys_vgui("tk_popup $%xw [winfo pointerx .] [winfo pointery .] %i\n",x,x->current_selection); + } else { + sys_vgui("tk_popup $%xw [winfo pointerx .] [winfo pointery .] \n",x); + } + } + +} + + + |