aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-11-24 05:57:15 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-11-24 05:57:15 +0000
commitb1ffed4b75b42b7e86899b4e8859f3b543418394 (patch)
treeed75215a72de21fab9011089132de99791db7014
parent380823b3bcbf0f5112308d1975f51e06e836b212 (diff)
- made selection color change restore previous background color
- moved scrollbar handling to tkwidgets.c svn path=/trunk/externals/tkwidgets/; revision=9032
-rw-r--r--shared/tkwidgets.c26
-rw-r--r--shared/tkwidgets.h20
-rw-r--r--text-help.pd307
-rw-r--r--text.c51
4 files changed, 226 insertions, 178 deletions
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 <stdio.h>
#include <string.h>
-/* 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 ----------------------- */
diff --git a/shared/tkwidgets.h b/shared/tkwidgets.h
index 0bc3996..e234ccd 100644
--- a/shared/tkwidgets.h
+++ b/shared/tkwidgets.h
@@ -37,6 +37,8 @@
#define TOTAL_INLETS 1
#define TOTAL_OUTLETS 2
+#define TKW_SELECTION_COLOR "#bdbddd"
+
/* size and offset for the resizing handle */
#define TKW_HANDLE_HEIGHT 15
#define TKW_HANDLE_WIDTH 15
@@ -60,18 +62,6 @@ typedef struct _tkwidgets
int selected; /* flag for when widget is selected */
} t_tkwidgets;
-/* query a tk widget for the state of all its options */
-void tkwidgets_query_options(t_symbol* receive_name, t_symbol *widget_id,
- int argc, char** argv);
-/* initialize things on new widget */
-void tkwidgets_new(t_tkwidgets* tkw);
-
-
-/* this should be part of the Pd API */
-t_symbol* canvas_getname(t_canvas *canvas);
-
-void tkwidgets_setcallbackname(void *x, char *widget_name);
-
/* handle options */
void tkwidgets_store_options(t_symbol *receive_name, t_symbol *tcl_namespace,
t_symbol *widget_id, int argc, char **argv);
@@ -98,10 +88,16 @@ void tkwidgets_draw_iolets(t_object *x, t_glist *glist, t_symbol *canvas_id,
t_symbol *iolets_tag, t_symbol *all_tag,
int width, int height);
void tkwidgets_erase_iolets(t_symbol* canvas_id, t_symbol* iolets_tag);
+void tkwidgets_draw_y_scrollbar(t_symbol *widget_id, t_symbol *scrollbar_id);
+void tkwidgets_erase_y_scrollbar(t_symbol *widget_id, t_symbol *scrollbar_id);
void tkwidgets_draw_handle(); // TODO draw resize handle when selected in editmode
void tkwidgets_draw_resize_window(); // TODO draw the resize window while resizing
+/* selection */
+
+
+
/* bind this widget to Cmd/Ctrl keys and mouse events to support things like
* then standard keys and right-click to bring up the Properties/Open/Help
* menu when the Tk widgets have focus */
diff --git a/text-help.pd b/text-help.pd
index 245d7d0..838bf34 100644
--- a/text-help.pd
+++ b/text-help.pd
@@ -1,101 +1,146 @@
#N canvas 343 45 785 704 10;
-#X obj 52 -48 text 130 60 0;
-#X obj 53 -198 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+#X obj 52 -43 text 130 60 0;
+#X obj 53 -193 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
-#X obj 12 60 print;
-#X msg 89 -183 clear;
-#X msg 107 -162 set one two three four five six;
-#X obj 36 137 text 130 60 0;
-#X obj 231 -2 select return;
-#X obj 59 61 pddp/print;
-#X obj 198 -91 trigger bang bang;
-#X msg 198 -70 clear;
-#X symbolatom 196 63 10 0 0 1 last_key_typed - -;
-#X text 235 19 ^-- hit return to output;
-#X msg 118 -139 append seven eight nine;
-#X msg 122 -119 append ten eleven.;
-#X obj 554 -176 text 130 60 0;
-#X obj 581 -218 symbol;
-#X msg 479 -245 flat;
-#X msg 514 -245 groove;
-#X msg 561 -245 raised;
-#X msg 609 -246 ridge;
-#X msg 650 -246 solid;
-#X msg 691 -246 sunken;
-#X obj 653 276 symbol;
-#X obj 557 278 symbol;
-#X msg 540 254 on;
-#X msg 574 253 off;
-#X msg 634 251 normal;
-#X msg 680 251 disabled;
-#X msg 26 105 size 100 50;
-#X text 633 231 disable editing;
-#X obj 582 -39 text 130 60 0;
-#X obj 581 -84 symbol;
-#X obj 513 147 text 130 60 0;
-#X obj 577 102 symbol;
-#X msg 539 -109 none;
-#X msg 574 -109 char;
-#X msg 611 -109 word;
-#X text 628 -85 word wrapping;
-#X msg 612 70 purple;
-#X msg 659 70 orange;
-#X msg 707 69 magenta;
-#X obj 452 40 pddp/pddplink http://en.wikipedia.org/wiki/X11_color_names
+#X obj 12 65 print;
+#X msg 89 -178 clear;
+#X msg 107 -157 set one two three four five six;
+#X obj 36 142 text 130 60 0;
+#X obj 231 3 select return;
+#X obj 59 66 pddp/print;
+#X obj 198 -86 trigger bang bang;
+#X msg 198 -65 clear;
+#X symbolatom 196 68 10 0 0 1 last_key_typed - -;
+#X text 235 24 ^-- hit return to output;
+#X msg 118 -134 append seven eight nine;
+#X msg 122 -114 append ten eleven.;
+#X obj 554 -171 text 130 60 0 -autoseparators 1 -background white -borderwidth
+2 -cursor xterm -exportselection 1 -font {Courier 12} -foreground Black
+-height 24 -highlightbackground systemWindowBody -highlightcolor Black
+-highlightthickness 1 -insertbackground Black -insertborderwidth 0
+-insertofftime 300 -insertontime 600 -insertwidth 1 -maxundo 0 -padx
+1 -pady 1 -relief sunken -selectbackground systemHighlightSecondary
+-selectborderwidth 1 -selectforeground systemHighlightText -setgrid
+0 -spacing1 0 -spacing2 0 -spacing3 0 -state normal -undo 0 -width
+80 -wrap char;
+#X obj 581 -213 symbol;
+#X msg 479 -240 flat;
+#X msg 514 -240 groove;
+#X msg 561 -240 raised;
+#X msg 609 -241 ridge;
+#X msg 650 -241 solid;
+#X msg 691 -241 sunken;
+#X obj 653 281 symbol;
+#X obj 557 283 symbol;
+#X msg 540 259 on;
+#X msg 574 258 off;
+#X msg 634 256 normal;
+#X msg 680 256 disabled;
+#X msg 26 110 size 100 50;
+#X text 633 236 disable editing;
+#X obj 582 -34 text 130 60 0;
+#X obj 581 -79 symbol;
+#X obj 597 107 symbol;
+#X msg 539 -104 none;
+#X msg 574 -104 char;
+#X msg 611 -104 word;
+#X text 628 -80 word wrapping;
+#X msg 612 75 purple;
+#X msg 659 75 orange;
+#X msg 707 74 magenta;
+#X obj 452 45 pddp/pddplink http://en.wikipedia.org/wiki/X11_color_names
;
-#X obj 394 -39 text 130 60 0;
-#X obj 396 -89 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 10 -262144
+#X obj 394 -34 text 130 60 0 -autoseparators 1 -background grey70 -borderwidth
+1 -cursor xterm -exportselection 1 -font {Courier 12} -foreground Black
+-height 24 -highlightbackground systemWindowBody -highlightcolor Black
+-highlightthickness 1 -insertbackground Black -insertborderwidth 0
+-insertofftime 300 -insertontime 600 -insertwidth 0 -maxundo 0 -padx
+1 -pady 1 -relief sunken -selectbackground systemHighlightSecondary
+-selectborderwidth 1 -selectforeground systemHighlightText -setgrid
+0 -spacing1 0 -spacing2 0 -spacing3 0 -state normal -undo 0 -width
+80 -wrap char;
+#X obj 331 -90 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 10 -262144
-1 -1 0 1;
-#X obj 62 345 text 130 60 0;
-#X obj 61 300 symbol;
-#X obj 49 409 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/cursors.htm
+#X obj 59 330 text 130 60 0 -autoseparators 1 -background grey70 -borderwidth
+1 -cursor gobbler -exportselection 1 -font {Courier 12} -foreground
+Black -height 24 -highlightbackground systemWindowBody -highlightcolor
+Black -highlightthickness 1 -insertbackground Black -insertborderwidth
+0 -insertofftime 300 -insertontime 600 -insertwidth 1 -maxundo 0 -padx
+1 -pady 1 -relief sunken -selectbackground systemHighlight -selectborderwidth
+1 -selectforeground systemHighlightText -setgrid 0 -spacing1 0 -spacing2
+0 -spacing3 0 -state normal -undo 0 -width 80 -wrap char;
+#X obj 58 285 symbol;
+#X obj 46 394 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/cursors.htm
;
-#X msg 59 265 boat;
-#X msg 19 265 clock;
-#X msg 162 265 gumby;
-#X msg 205 265 gobbler;
-#X obj 404 -217 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 10 -262144
--1 -1 0 1;
-#X obj 471 99 tgl 15 0 empty empty empty 0 -6 0 10 -262144 -1 -1 0
+#X msg 56 250 boat;
+#X msg 16 250 clock;
+#X msg 159 250 gumby;
+#X msg 202 250 gobbler;
+#X obj 404 -212 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 10 -262144
+-1 -1 200 1;
+#X obj 470 -90 tgl 15 0 empty empty empty 0 -6 0 10 -262144 -1 -1 0
1;
-#X msg 109 -85 key a;
-#X msg 150 -85 key 32;
-#X obj 352 254 keyup;
-#X msg 352 293 key \$1;
-#X floatatom 369 275 5 0 0 0 - - -;
-#X msg 249 -46 key 3322;
-#X obj 560 330 text 130 60 0;
-#X obj 352 328 text 130 60 0;
-#X text 347 232 type single chars:;
-#X msg 421 279 key a;
-#X msg 422 301 key 9;
-#X text 204 387 for more cursors:;
-#X text 337 393 for more keynums:;
-#X msg 413 260 key 65228;
-#X msg 94 265 coffee_mug;
-#X msg 62 321 cursor \$1;
-#X msg 578 123 selectbackground \$1;
-#X msg 401 -197 borderwidth \$1;
-#X msg 582 -197 relief \$1;
-#X msg 582 -63 wrap \$1;
-#X msg 394 -62 insertwidth \$1;
-#X msg 557 300 undo \$1;
-#X msg 652 299 state \$1;
-#X msg 113 105 size 200 100;
-#X msg 577 70 #00f;
-#X text 528 231 turn off undo;
-#X obj 261 152 text 130 60 0;
-#X msg 285 128 font "Lucida Sans" 18 bold;
-#X msg 261 103 font Arial 16;
-#X obj 339 407 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/keysyms.htm
+#X msg 109 -80 key a;
+#X msg 150 -80 key 32;
+#X obj 352 259 keyup;
+#X msg 352 298 key \$1;
+#X floatatom 369 280 5 0 0 0 - - -;
+#X msg 249 -41 key 3322;
+#X obj 560 335 text 130 60 0;
+#X obj 352 333 text 130 60 0;
+#X text 347 237 type single chars:;
+#X msg 421 284 key a;
+#X msg 422 306 key 9;
+#X text 201 372 for more cursors:;
+#X text 337 398 for more keynums:;
+#X msg 413 265 key 65228;
+#X msg 91 250 coffee_mug;
+#X msg 59 306 cursor \$1;
+#X msg 401 -192 borderwidth \$1;
+#X msg 582 -192 relief \$1;
+#X msg 582 -58 wrap \$1;
+#X msg 328 -70 insertwidth \$1;
+#X msg 557 305 undo \$1;
+#X msg 652 304 state \$1;
+#X msg 113 110 size 200 100;
+#X msg 577 75 #00f;
+#X text 528 236 turn off undo;
+#X obj 261 157 text 130 60 0 -autoseparators 1 -background grey70 -borderwidth
+1 -cursor xterm -exportselection 1 -font {"Lucida Sans" 18 bold} -foreground
+Black -height 24 -highlightbackground systemWindowBody -highlightcolor
+Black -highlightthickness 1 -insertbackground Black -insertborderwidth
+0 -insertofftime 300 -insertontime 600 -insertwidth 1 -maxundo 0 -padx
+1 -pady 1 -relief sunken -selectbackground systemHighlightSecondary
+-selectborderwidth 1 -selectforeground systemHighlightText -setgrid
+0 -spacing1 0 -spacing2 0 -spacing3 0 -state normal -undo 0 -width
+80 -wrap char;
+#X msg 285 133 font "Lucida Sans" 18 bold;
+#X msg 261 108 font Arial 16;
+#X obj 339 412 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/keysyms.htm
;
-#X obj 140 -258 pddp/pddplink http://puredata.info/dev/TkWidget -text
+#X obj 140 -253 pddp/pddplink http://puredata.info/dev/TkWidget -text
TkWidget library;
-#X text 22 -258 This is part of the;
-#X obj 186 -234 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/text.htm
+#X text 22 -253 This is part of the;
+#X obj 186 -229 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/text.htm
-text text;
-#X text 37 -234 This object is based on:;
-#X msg 471 119 scrollbars \$1;
+#X text 37 -229 This object is based on:;
+#X msg 470 -70 scrollbars \$1;
+#X msg 598 128 background \$1;
+#X obj 469 160 text 300 60 0 -autoseparators 1 -background orange -borderwidth
+1 -cursor xterm -exportselection 1 -font {Courier 12} -foreground magenta
+-height 24 -highlightbackground systemWindowBody -highlightcolor Black
+-highlightthickness 1 -insertbackground Black -insertborderwidth 0
+-insertofftime 300 -insertontime 600 -insertwidth 1 -maxundo 0 -padx
+1 -pady 1 -relief sunken -selectbackground systemHighlightSecondary
+-selectborderwidth 1 -selectforeground systemHighlightText -setgrid
+0 -spacing1 0 -spacing2 0 -spacing3 0 -state normal -undo 0 -width
+80 -wrap char;
+#X obj 479 107 symbol;
+#X msg 519 74 magenta;
+#X msg 480 128 foreground \$1;
+#X msg 399 75 #ff0;
+#X msg 435 75 grey;
+#X msg 471 75 black;
#X connect 0 0 2 0;
#X connect 0 0 7 0;
#X connect 0 1 6 0;
@@ -109,56 +154,62 @@ TkWidget library;
#X connect 9 0 0 0;
#X connect 12 0 0 0;
#X connect 13 0 0 0;
-#X connect 15 0 71 0;
+#X connect 15 0 69 0;
#X connect 16 0 15 0;
#X connect 17 0 15 0;
#X connect 18 0 15 0;
#X connect 19 0 15 0;
#X connect 20 0 15 0;
#X connect 21 0 15 0;
-#X connect 22 0 75 0;
-#X connect 23 0 74 0;
+#X connect 22 0 73 0;
+#X connect 23 0 72 0;
#X connect 24 0 23 0;
#X connect 25 0 23 0;
#X connect 26 0 22 0;
#X connect 27 0 22 0;
#X connect 28 0 5 0;
-#X connect 31 0 72 0;
-#X connect 33 0 69 0;
+#X connect 31 0 70 0;
+#X connect 32 0 86 0;
+#X connect 33 0 31 0;
#X connect 34 0 31 0;
#X connect 35 0 31 0;
-#X connect 36 0 31 0;
-#X connect 38 0 33 0;
-#X connect 39 0 33 0;
-#X connect 40 0 33 0;
-#X connect 43 0 73 0;
-#X connect 45 0 68 0;
-#X connect 47 0 45 0;
-#X connect 48 0 45 0;
-#X connect 49 0 45 0;
-#X connect 50 0 45 0;
-#X connect 51 0 70 0;
-#X connect 52 0 87 0;
+#X connect 37 0 32 0;
+#X connect 38 0 32 0;
+#X connect 39 0 32 0;
+#X connect 42 0 71 0;
+#X connect 44 0 67 0;
+#X connect 46 0 44 0;
+#X connect 47 0 44 0;
+#X connect 48 0 44 0;
+#X connect 49 0 44 0;
+#X connect 50 0 68 0;
+#X connect 51 0 85 0;
+#X connect 52 0 0 0;
#X connect 53 0 0 0;
-#X connect 54 0 0 0;
-#X connect 55 0 56 0;
-#X connect 55 0 57 0;
-#X connect 56 0 60 0;
-#X connect 58 0 0 0;
-#X connect 62 0 60 0;
-#X connect 63 0 60 0;
-#X connect 66 0 60 0;
-#X connect 67 0 45 0;
-#X connect 68 0 44 0;
-#X connect 69 0 32 0;
-#X connect 70 0 14 0;
-#X connect 71 0 14 0;
-#X connect 72 0 30 0;
-#X connect 73 0 42 0;
-#X connect 74 0 59 0;
-#X connect 75 0 59 0;
-#X connect 76 0 5 0;
-#X connect 77 0 33 0;
-#X connect 80 0 79 0;
-#X connect 81 0 79 0;
-#X connect 87 0 32 0;
+#X connect 54 0 55 0;
+#X connect 54 0 56 0;
+#X connect 55 0 59 0;
+#X connect 57 0 0 0;
+#X connect 61 0 59 0;
+#X connect 62 0 59 0;
+#X connect 65 0 59 0;
+#X connect 66 0 44 0;
+#X connect 67 0 43 0;
+#X connect 68 0 14 0;
+#X connect 69 0 14 0;
+#X connect 70 0 30 0;
+#X connect 71 0 41 0;
+#X connect 72 0 58 0;
+#X connect 73 0 58 0;
+#X connect 74 0 5 0;
+#X connect 75 0 32 0;
+#X connect 78 0 77 0;
+#X connect 79 0 77 0;
+#X connect 85 0 41 0;
+#X connect 86 0 87 0;
+#X connect 88 0 90 0;
+#X connect 89 0 88 0;
+#X connect 90 0 87 0;
+#X connect 91 0 88 0;
+#X connect 92 0 88 0;
+#X connect 93 0 88 0;
diff --git a/text.c b/text.c
index 0580a4e..aa66ab8 100644
--- a/text.c
+++ b/text.c
@@ -27,11 +27,9 @@
/* TODO: set message doesnt work with a loadbang */
/* TODO: window name "handle1376fc00" already exists in parent */
/* TODO: figure out window vs. text width/height */
-/* TODO: handle bg color on select/deselect */
-
-
-#define DEFAULT_COLOR "grey70"
+/* TODO: add x scrollbar */
+#define TEXT_DEFAULT_COLOR "grey90"
#define TEXT_DEFAULT_WIDTH 200
#define TEXT_DEFAULT_HEIGHT 60
#define TEXT_MIN_WIDTH 40
@@ -159,19 +157,6 @@ static void set_tkwidgets_ids(t_textwidget *x, t_canvas *canvas)
x->handle_id = tkwidgets_gen_handle_id((t_object *)x, x->canvas_id);
}
-static void draw_scrollbar(t_textwidget *x)
-{
- sys_vgui("pack %s -side right -fill y -before %s \n",
- x->scrollbar_id->s_name, x->widget_id->s_name);
- x->have_scrollbars = 1;
-}
-
-static void erase_scrollbar(t_textwidget *x)
-{
- sys_vgui("pack forget %s \n", x->scrollbar_id->s_name);
- x->have_scrollbars = 0;
-}
-
static void create_widget(t_textwidget *x)
{
DEBUG(post("create_widget"););
@@ -181,11 +166,8 @@ static void create_widget(t_textwidget *x)
/* Seems we have to delete the widget in case it already exists (Provided by Guenter)*/
sys_vgui("destroy %s\n", x->frame_id->s_name);
sys_vgui("frame %s \n", x->frame_id->s_name);
- sys_vgui("text %s -border 1 \
- -highlightthickness 1 -relief sunken -bg \"%s\" -yscrollcommand {%s set} \n",
- x->widget_id->s_name, DEFAULT_COLOR, x->scrollbar_id->s_name);
- sys_vgui("scrollbar %s -command {%s yview}\n",
- x->scrollbar_id->s_name, x->widget_id->s_name);
+ sys_vgui("text %s -bd 1 -highlightbackground grey70 -highlightthickness 1 -bg %s\n",
+ x->widget_id->s_name, TEXT_DEFAULT_COLOR);
sys_vgui("pack %s -side left -fill both -expand 1 \n", x->widget_id->s_name);
sys_vgui("pack %s -side bottom -fill both -expand 1 \n", x->frame_id->s_name);
@@ -204,7 +186,8 @@ static void drawme(t_textwidget *x, t_glist *glist)
tkwidgets_draw_iolets((t_object*)x, glist,
x->canvas_id, x->iolets_tag, x->all_tag,
x->width, x->height);
- if(x->have_scrollbars) draw_scrollbar(x);
+ if(x->have_scrollbars)
+ tkwidgets_draw_y_scrollbar(x->widget_id, x->scrollbar_id);
sys_vgui("%s create window %d %d -anchor nw -window %s \
-tags {%s %s} -width %d -height %d \n", x->canvas_id->s_name,
text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
@@ -259,15 +242,17 @@ static void textwidget_select(t_gobj *z, t_glist *glist, int state)
if( (state) && (!x->x_selected))
{
- sys_vgui("%s configure -bg #bdbddd -state disabled -cursor $cursor_editmode_nothing\n",
- x->widget_id->s_name);
+ sys_vgui("set ::%s::bg [%s cget -bg]\n",
+ x->tcl_namespace->s_name, x->widget_id->s_name);
+ sys_vgui("%s configure -bg %s -state disabled -cursor $cursor_editmode_nothing\n",
+ x->widget_id->s_name, TKW_SELECTION_COLOR);
x->x_selected = 1;
}
else if (!state)
{
- sys_vgui("%s configure -bg grey -state normal -cursor xterm\n",
- x->widget_id->s_name);
- /* activatefn never gets called with 0, so destroy here */
+ sys_vgui("%s configure -bg $::%s::bg -state normal -cursor xterm\n",
+ x->widget_id->s_name, x->tcl_namespace->s_name);
+ /* activatefn never gets called with 0, so destroy handle here */
sys_vgui("destroy %s\n", x->handle_id->s_name);
x->x_selected = 0;
}
@@ -489,9 +474,15 @@ static void textwidget_scrollbars(t_textwidget *x, t_float f)
{
int value = (int) f;
if(value > 0)
- draw_scrollbar(x);
+ {
+ x->have_scrollbars = 1;
+ tkwidgets_draw_y_scrollbar(x->widget_id, x->scrollbar_id);
+ }
else
- erase_scrollbar(x);
+ {
+ x->have_scrollbars = 0;
+ tkwidgets_erase_y_scrollbar(x->widget_id, x->scrollbar_id);
+ }
}
static void textwidget_size(t_textwidget *x, t_float width, t_float height)