From b1ffed4b75b42b7e86899b4e8859f3b543418394 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sat, 24 Nov 2007 05:57:15 +0000 Subject: - made selection color change restore previous background color - moved scrollbar handling to tkwidgets.c svn path=/trunk/externals/tkwidgets/; revision=9032 --- shared/tkwidgets.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'shared/tkwidgets.c') diff --git a/shared/tkwidgets.c b/shared/tkwidgets.c index d58f643..a5d1b8c 100644 --- a/shared/tkwidgets.c +++ b/shared/tkwidgets.c @@ -24,14 +24,6 @@ #include #include -/* this should be part of the Pd API */ -t_symbol *canvas_getname(t_canvas *canvas) -{ - char buf[MAXPDSTRING]; - snprintf(buf, MAXPDSTRING, ".x%lx", (unsigned long)glist_getcanvas(canvas)); - return gensym(buf); -} - /* -------------------- options handling ------------------------------------ */ void tkwidgets_query_options(t_symbol *receive_name, t_symbol *widget_id, @@ -207,6 +199,24 @@ void tkwidgets_erase_iolets(t_symbol* canvas_id, t_symbol* iolets_tag) sys_vgui("%s delete %s\n", canvas_id->s_name, iolets_tag->s_name); } +/* -------------------- scrollbars ------------------------------------------ */ + +void tkwidgets_draw_y_scrollbar(t_symbol *widget_id, t_symbol *scrollbar_id) +{ + sys_vgui("scrollbar %s -orient vertical -command {%s yview}\n", + scrollbar_id->s_name, widget_id->s_name); + sys_vgui("pack %s -side right -fill y -before %s \n", + scrollbar_id->s_name, widget_id->s_name); + sys_vgui("%s configure -yscrollcommand {%s set}\n", + widget_id->s_name, scrollbar_id->s_name); +} + +void tkwidgets_erase_y_scrollbar(t_symbol *widget_id, t_symbol *scrollbar_id) +{ + sys_vgui("%s configure -yscrollcommand {}\n", widget_id->s_name); + sys_vgui("pack forget %s \n", scrollbar_id->s_name); + sys_vgui("destroy %s \n", scrollbar_id->s_name); +} /* -------------------- bind to keys and mouse events ----------------------- */ -- cgit v1.2.1