diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2007-11-21 22:19:12 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2007-11-21 22:19:12 +0000 |
commit | 2a320ac2fbd246be7b0844fe00b543bcd1bae271 (patch) | |
tree | 493ed50d285b4f0d04c119d517ab57970455771f /shared/tkwidgets.c | |
parent | 46c8c8f8d8448e72bf384c1de04dcfc7ab44f34a (diff) |
- created functions to generate all the various Tk IDs and tags and ported
text.c to use those functions
- started sketch for checkbutton.c
svn path=/trunk/externals/tkwidgets/; revision=9020
Diffstat (limited to 'shared/tkwidgets.c')
-rw-r--r-- | shared/tkwidgets.c | 111 |
1 files changed, 93 insertions, 18 deletions
diff --git a/shared/tkwidgets.c b/shared/tkwidgets.c index 587f2d8..fd7f9c3 100644 --- a/shared/tkwidgets.c +++ b/shared/tkwidgets.c @@ -33,45 +33,120 @@ t_symbol *canvas_getname(t_canvas *canvas) } -void query_options(t_symbol *receive_name, char *widget_id, int argc, char** argv) +void tkwidgets_query_options(t_symbol *receive_name, t_symbol *widget_id, + int argc, char** argv) { int i; for(i = 0; i < argc; i++) sys_vgui("pd [concat %s query_callback %s [%s cget -%s] \\;]\n", - receive_name->s_name, argv[i], widget_id, argv[i]); + receive_name->s_name, argv[i], widget_id->s_name, argv[i]); } -/* -I think I'll probably have to follow Krzsztof and make structs to make this work -tkwidgets_setcallbackname(void *x, char *widget_name) +void tkwidgets_restore_options(t_symbol *receive_name, t_symbol *widget_id, + int argc, char** argv) +{ + int i; + for(i = 0; i < argc; i++) + { + // TODO parse out -flags and values, and set them here: + sys_vgui("%s configure %s\n", + widget_id->s_name, argv[i]); + } +} + +void tkwidgets_set_ids(t_object *x, t_tkwidgets *tkw, t_canvas *canvas) +{ + + tkw->canvas = canvas; +} + + +t_symbol* tkwidgets_gen_tcl_namespace(t_object* x, t_symbol* widget_name) { char buf[MAXPDSTRING]; + sprintf(buf,"%s%lx", widget_name->s_name, (long unsigned int)x); + return gensym(buf); +} - sprintf(buf,"%s%lx", widget_name, (long unsigned int)x); - x->tcl_namespace = getbytes(strlen(buf)); - strcpy(x->tcl_namespace, buf); +t_symbol* tkwidgets_gen_callback_name(t_symbol* tcl_namespace) +{ + char buf[MAXPDSTRING]; + sprintf(buf,"#%s", tcl_namespace->s_name); + return gensym(buf); +} - sprintf(buf,"#%s", x->tcl_namespace); - x->receive_name = gensym(buf); - pd_bind(&x->x_obj.ob_pd, x->receive_name); +t_symbol* tkwidgets_gen_canvas_id(t_canvas* canvas) +{ + char buf[MAXPDSTRING]; + sprintf(buf,".x%lx.c", (long unsigned int) canvas); + return gensym(buf); } -*/ -void draw_inlets(t_object *x, t_glist *glist, int firsttime, - int total_inlets, int total_outlets) +t_symbol* tkwidgets_gen_frame_id(t_object* x, t_symbol* canvas_id) { - // TODO perhaps I should try to use glist_drawiofor() from g_text.c + char buf[MAXPDSTRING]; + sprintf(buf,"%s.frame%lx", canvas_id->s_name, (long unsigned int)x); + return gensym(buf); } +t_symbol* tkwidgets_gen_widget_id(t_object* x, t_symbol* parent_id) +{ + char buf[MAXPDSTRING]; + sprintf(buf,"%s.widget%lx", parent_id->s_name, (long unsigned int)x); + return gensym(buf); +} +t_symbol* tkwidgets_gen_window_id(t_object* x, t_symbol* canvas_id) +{ + char buf[MAXPDSTRING]; + sprintf(buf,"%s.window%lx", canvas_id->s_name, (long unsigned int)x); + return gensym(buf); +} -void draw_handle() +t_symbol* tkwidgets_gen_handle_id(t_object *x, t_symbol* canvas_id) { - // TODO draw resize handle when selected in editmode + char buf[MAXPDSTRING]; + sprintf(buf,"%s.handle%lx", canvas_id->s_name, (long unsigned int)x); + return gensym(buf); +} + +t_symbol* tkwidgets_gen_scrollbar_id(t_object *x, t_symbol* frame_id) +{ + char buf[MAXPDSTRING]; + sprintf(buf,"%s.scrollbar%lx", frame_id->s_name, (long unsigned int)x); + return gensym(buf); +} + +t_symbol* tkwidgets_gen_all_tag(t_object *x) +{ + char buf[MAXPDSTRING]; + sprintf(buf,"all%lx", (long unsigned int)x); + return gensym(buf); +} + +void tkwidgets_draw_inlets(t_object *x, t_glist *glist, + int total_inlets, int total_outlets) +{ + // TODO perhaps I should try to use glist_drawiofor() from g_text.c } +void tkwidgets_draw_handle() +{ + // TODO draw resize handle when selected in editmode +} -void draw_resize_window() +void tkwidgets_draw_resize_window() { // TODO draw the resize window while resizing } + + +/* +void query_options() +{ + +} + + + +*/ |