Bwidget Source Code
Changes On Branch bwidget
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch bwidget Excluding Merge-Ins

This is equivalent to a diff from 94ff035b54 to 26b04efb02

2023-05-23
06:43
Restored "" in documentation. Thanks, Rolf ! Leaf check-in: 26b04efb02 user: oehhar tags: bwidget
2023-05-22
12:34
TCL9.0/Tk8.7 compatibility issues found by Paul Obermeier. https://wiki.tcl-lang.org/page/Porting+extensions+to+Tcl+9 Ticket [1bee17b353] check-in: c2f71bcc58 user: oehhar tags: bwidget
2009-08-10
11:23
Branched to BWidget Scope: Package BWidget compatible to tcl/tk >=8.1 and tk (e.g. no tile/ttk) check-in: 1c12194ca8 user: oehhar tags: bwidget
2009-08-04
16:39
* notebook.tcl (NoteBook::delete) Method delete destroyframe=1 and reinsertion -> raise failed - state variables were deleted [Bug 2831785] by kjnash * tree.tcl (Tree::_keynav) Fire virtual event <<TreeSelect>> also on keyboard navigation [Patch 2828086] by Kevin Walzer * combobox.tcl Replaced aqua conditional code check by $Widget::_aqua check-in: 66f7bd69b2 user: oehhar tags: trunk
2009-07-24
17:44
Synthetic commit. Leaf check-in: 92b00e0e2d user: cvs2fossil tags: bwidget-1-9-0-synthetic, bwidget-1-9-0
17:44
Changed page version from 1.8 to 1.9 check-in: 94ff035b54 user: oehhar tags: trunk
16:01
* tree.tcl (Tree::_set_help), Tree.html DynamicHelp -helpcmd added to tree node help * tree.tcl (Tree::_draw_subnodes) a vertical line to a virtual root node above the widget is only drawn when there are multiple child nodes. This reverts the modification dated 2004-04-21 for this case. [Patch 2825354] by Koen Danckaert check-in: 55b962c054 user: oehhar tags: trunk

Changes to BWman/BWidget.html.

170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
</DD></DL>
<DL><DT><A NAME="place">BWidget::<B>place</B></A>
 <I>path</I>
 <I>w</I>
 <I>h</I>
 ?<I>arg...</I>?
</DT><DD>
Used to position and resise the widget specified by
<I>path</I>. <I>w</I> and <I>h</I> are used to specify the requested
width and height of the <I>path</I> widget for use by <B>wm
geometry</B>. The placement of the widget relative to other widgets or
the screen is controlled by additional arguments:
<DL>
 <DT><B>at</B> <I>x</I> <I>y</I></DT>
 <DD>Place the widget specified by the <I>path</I> argument at screen
 position x,y. See <B>wm geometry</B> for information about window
 placement values.</DD>








|


|







170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
</DD></DL>
<DL><DT><A NAME="place">BWidget::<B>place</B></A>
 <I>path</I>
 <I>w</I>
 <I>h</I>
 ?<I>arg...</I>?
</DT><DD>
Used to position and resize the widget specified by
<I>path</I>. <I>w</I> and <I>h</I> are used to specify the requested
width and height of the <I>path</I> widget for use by <B>wm
geometry</B> (set to 0 to use current values). The placement of the widget relative to other widgets or
the screen is controlled by additional arguments:
<DL>
 <DT><B>at</B> <I>x</I> <I>y</I></DT>
 <DD>Place the widget specified by the <I>path</I> argument at screen
 position x,y. See <B>wm geometry</B> for information about window
 placement values.</DD>

Changes to BWman/Button.html.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
<HTML>
<HEAD><TITLE>Button</TITLE></HEAD>
<BODY BGCOLOR=white>
<DL><DT><I><A HREF="#descr">NAME</A></I></DT>
<DD><B>Button</B>
 - Button widget with enhanced options
</DD></DL>
<DL>
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>Button</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I>STANDARD OPTIONS</I></DT>

<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-activebackground">-activebackground</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-activeforeground">-activeforeground</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-anchor">-anchor</A></TD>













>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<HTML>
<HEAD><TITLE>Button</TITLE></HEAD>
<BODY BGCOLOR=white>
<DL><DT><I><A HREF="#descr">NAME</A></I></DT>
<DD><B>Button</B>
 - Button widget with enhanced options
</DD></DL>
<DL>
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>Button</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I>STANDARD OPTIONS</I></DT>
<DT><I>Not themed</I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-activebackground">-activebackground</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-activeforeground">-activeforeground</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-anchor">-anchor</A></TD>
55
56
57
58
59
60
61





















62
63
64
65
66
67
68
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-wraplength">-wraplength</A></TD>
</TABLE></DD>





















</DL>
<DL>
<DT><I><A HREF="#wso">WIDGET-SPECIFIC OPTIONS</A></I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-armcommand">-armcommand</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-command">-command</A></TD>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-wraplength">-wraplength</A></TD>
</TABLE></DD>
<DT><I>Themed</I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-compound">-compound</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-cursor">-cursor</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-image">-image</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-style">-style</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-repeatdelay">-repeatdelay</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-repeatinterval">-repeatinterval</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-takefocus">-takefocus</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TD>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wso">WIDGET-SPECIFIC OPTIONS</A></I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-armcommand">-armcommand</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-command">-command</A></TD>
157
158
159
160
161
162
163
164

165
166
167
168
169
170
171
<DD>

Specifies a desired height for the Button.
If an image or bitmap is being displayed in the Button then the value is in
screen units;
for text it is in lines of text.
If this option isn't specified, the Button's desired height is computed
from the size of the image or bitmap or text being displayed in it.

</DD>
</DL>
<DL><DT><A NAME="-helptext"><B>-helptext</B></A></DT>
<DD>

Text for dynamic help. If empty, no help is available for this widget.
See also <A HREF="DynamicHelp.html">DynamicHelp</A>.







|
>







179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<DD>

Specifies a desired height for the Button.
If an image or bitmap is being displayed in the Button then the value is in
screen units;
for text it is in lines of text.
If this option isn't specified, the Button's desired height is computed
from the size of the image or bitmap or text being displayed in it.<BR>
Option not available when widget is <I>themed</I>.
</DD>
</DL>
<DL><DT><A NAME="-helptext"><B>-helptext</B></A></DT>
<DD>

Text for dynamic help. If empty, no help is available for this widget.
See also <A HREF="DynamicHelp.html">DynamicHelp</A>.
193
194
195
196
197
198
199
200


201
202
203
204
205
206
207
</DD>
</DL>
<DL><DT><A NAME="-relief"><B>-relief</B></A></DT>
<DD>

Specifies the 3-D effect desired for the widget. Acceptable values are standard values for
button relief (<B>raised</B>, <B>sunken</B>, <B>flat</B>, <B>ridge</B>, <B>solid</B>, and <B>groove</B>) and <B>link</B>, which specifies that button relief is <B>flat</B> when pointer
is outside the button and <B>raised</B> when pointer is inside.


</DD>
</DL>
<DL><DT><A NAME="-state"><B>-state</B></A></DT>
<DD>

Specifies one of three states for the Button:  <B>normal</B>, <B>active</B>,
or <B>disabled</B>.  In normal state the Button is displayed using the







|
>
>







216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
</DD>
</DL>
<DL><DT><A NAME="-relief"><B>-relief</B></A></DT>
<DD>

Specifies the 3-D effect desired for the widget. Acceptable values are standard values for
button relief (<B>raised</B>, <B>sunken</B>, <B>flat</B>, <B>ridge</B>, <B>solid</B>, and <B>groove</B>) and <B>link</B>, which specifies that button relief is <B>flat</B> when pointer
is outside the button and <B>raised</B> when pointer is inside.<BR>
This option has only the following effect if the widget is <I>themed</I>:
The value <B>link</B> used a style <B>Toolbutton</B> while any other value uses the standard effect.
</DD>
</DL>
<DL><DT><A NAME="-state"><B>-state</B></A></DT>
<DD>

Specifies one of three states for the Button:  <B>normal</B>, <B>active</B>,
or <B>disabled</B>.  In normal state the Button is displayed using the
265
266
267
268
269
270
271

272








273

If Button <B>state</B> is not disabled, this invoke the commands of the Button.
Button is redisplayed with active color and sunken relief, and
<B>armcommand</B> is called. Then Button is redisplayed with
normal color and its defined relief, and <B>disarmcommand</B> then <B>command</B>
are called.
<P><B>invoke</B> is called when Button has input focus and user press the space bar.

</DD></DL>








</BODY></HTML>







>

>
>
>
>
>
>
>
>

290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307

If Button <B>state</B> is not disabled, this invoke the commands of the Button.
Button is redisplayed with active color and sunken relief, and
<B>armcommand</B> is called. Then Button is redisplayed with
normal color and its defined relief, and <B>disarmcommand</B> then <B>command</B>
are called.
<P><B>invoke</B> is called when Button has input focus and user press the space bar.

</DD></DL>
<HR WIDTH="50%"><BR>
<B><A NAME="wc">BINDINGS</A></B><BR>
<DL><DT><A NAME="Invoke"><I>&lt;&lt;Invoke&gt;&gt;</I></A>
</DT><DD>

Invoke the <B>invoke</B> widget command.
</DD></DL>
<HR WIDTH="50%"><BR>
</BODY></HTML>

Changes to BWman/ButtonBox.html.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<DT><I><A HREF="#wso">WIDGET-SPECIFIC OPTIONS</A></I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-background">-background or -bg</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-default">-default</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-homogeneous">-homogeneous</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-orient">-orient</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-padx">-padx</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-pady">-pady</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-spacing">-spacing</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-state">-state</A></TR>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wc">WIDGET COMMAND</A></I></DT>
<DD><I>pathName</I> <A HREF="#add"><B>add</B></A>
 ?<I>option value...</I>?







|



|



|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<DT><I><A HREF="#wso">WIDGET-SPECIFIC OPTIONS</A></I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-background">-background or -bg</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-default">-default</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-homogeneous">-homogeneous</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-orient">-orient</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-padx">-padx</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-pady">-pady</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-spacing">-spacing</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-state">-state</A></TR>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wc">WIDGET COMMAND</A></I></DT>
<DD><I>pathName</I> <A HREF="#add"><B>add</B></A>
 ?<I>option value...</I>?
99
100
101
102
103
104
105
106

107
108
109
110
111
112
113

</P>
<BR><HR WIDTH="50%"><BR>
<B><A NAME="wso">WIDGET-SPECIFIC OPTIONS</A></B><BR>
<DL><DT><A NAME="-background"><B>-background</B></A></DT>
<DD>

Specifies a default background color for all added buttons and for the frame.


</DD>
</DL>
<DL><DT><A NAME="-default"><B>-default</B></A></DT>
<DD>

Specifies the default button of the button box. The value is an integer







|
>







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

</P>
<BR><HR WIDTH="50%"><BR>
<B><A NAME="wso">WIDGET-SPECIFIC OPTIONS</A></B><BR>
<DL><DT><A NAME="-background"><B>-background</B></A></DT>
<DD>

Specifies a default background color for all added buttons and for the frame.<BR>
For <I>themed</I> wigets, the button color is not set.

</DD>
</DL>
<DL><DT><A NAME="-default"><B>-default</B></A></DT>
<DD>

Specifies the default button of the button box. The value is an integer
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149

150
151
152
153
154
155
156
If this option is <B>vertical</B>, buttons are added from left to right.

</DD>
</DL>
<DL><DT><A NAME="-padx"><B>-padx</B></A></DT>
<DD>

Specifies a default value for the -padx option of all added buttons.

</DD>
</DL>
<DL><DT><A NAME="-pady"><B>-pady</B></A></DT>
<DD>

Specifies a default value for the -pady option of all added buttons.


</DD>
</DL>
<DL><DT><A NAME="-spacing"><B>-spacing</B></A></DT>
<DD>

Specifies the default spacing between buttons. This value can be changed before each







|
|





|
>







136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
If this option is <B>vertical</B>, buttons are added from left to right.

</DD>
</DL>
<DL><DT><A NAME="-padx"><B>-padx</B></A></DT>
<DD>

Specifies a default value for the -padx option of all added buttons.<BR>
Option has no effect for <I>themed</I> wigets.
</DD>
</DL>
<DL><DT><A NAME="-pady"><B>-pady</B></A></DT>
<DD>

Specifies a default value for the -pady option of all added buttons.<BR>
Option has no effect for <I>themed</I> wigets.

</DD>
</DL>
<DL><DT><A NAME="-spacing"><B>-spacing</B></A></DT>
<DD>

Specifies the default spacing between buttons. This value can be changed before each

Changes to BWman/ComboBox.html.

141
142
143
144
145
146
147

148
149
150
151
152
153
154
</DD>
<DD><I>pathName</I> <A HREF="#clearvalue"><B>clearvalue</B></A>
</DD>
<DD><I>pathName</I> <A HREF="#configure"><B>configure</B></A>
 ?<I>option</I>? ?<I>value</I> <I>option</I> <I>value</I> ...?
</DD>
<DD><I>pathName</I> <A HREF="#get"><B>get</B></A></DD>

<DD><I>pathName</I> <A HREF="#getlistbox"><B>getlistbox</B></A></DD>
<DD><I>pathName</I> <A HREF="#getvalue"><B>getvalue</B></A></DD>
<DD><I>pathName</I> <A HREF="#icursor"><B>icursor</B></A>
<I>index</I>
</DD>
<DD><I>pathName</I> <A HREF="#post"><B>post</B></A></DD>
<DD><I>pathName</I> <A HREF="#setvalue"><B>setvalue</B></A>







>







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
</DD>
<DD><I>pathName</I> <A HREF="#clearvalue"><B>clearvalue</B></A>
</DD>
<DD><I>pathName</I> <A HREF="#configure"><B>configure</B></A>
 ?<I>option</I>? ?<I>value</I> <I>option</I> <I>value</I> ...?
</DD>
<DD><I>pathName</I> <A HREF="#get"><B>get</B></A></DD>
<DD><I>pathName</I> <A HREF="#getentry"><B>getentry</B></A></DD>
<DD><I>pathName</I> <A HREF="#getlistbox"><B>getlistbox</B></A></DD>
<DD><I>pathName</I> <A HREF="#getvalue"><B>getvalue</B></A></DD>
<DD><I>pathName</I> <A HREF="#icursor"><B>icursor</B></A>
<I>index</I>
</DD>
<DD><I>pathName</I> <A HREF="#post"><B>post</B></A></DD>
<DD><I>pathName</I> <A HREF="#setvalue"><B>setvalue</B></A>
309
310
311
312
313
314
315







316
317
318
319
320
321
322
</DD></DL>

<DL><DT><A NAME="get"><I>pathName</I> <B>get</B></A>
</DT><DD>

Returns the current contents of the entry.








</DD></DL>

<DL><DT><A NAME="getlistbox"><I>pathName</I> <B>getlistbox</B></A>
</DT><DD>

Returns the path to the listbox in the drop down.








>
>
>
>
>
>
>







310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
</DD></DL>

<DL><DT><A NAME="get"><I>pathName</I> <B>get</B></A>
</DT><DD>

Returns the current contents of the entry.

</DD></DL>

<DL><DT><A NAME="getentry"><I>pathName</I> <B>getentry</B></A>
</DT><DD>

Returns the path to the contained entry widget.

</DD></DL>

<DL><DT><A NAME="getlistbox"><I>pathName</I> <B>getlistbox</B></A>
</DT><DD>

Returns the path to the listbox in the drop down.

Changes to BWman/Dialog.html.

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-anchor">-anchor</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-bitmap">-bitmap</A></TR>
</TR>
<TR>

<TD>&nbsp;&nbsp;<A HREF="#-buttonwidth">-buttonwidth</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-cancel">-cancel</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-default">-default</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-geometry">-geometry</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-image">-image</A></TR>







<
|







29
30
31
32
33
34
35

36
37
38
39
40
41
42
43
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-anchor">-anchor</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-bitmap">-bitmap</A></TR>
</TR>
<TR>


<TD>&nbsp;&nbsp;<A HREF="#-cancel">-cancel</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-default">-default</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-geometry">-geometry</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-image">-image</A></TR>
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153


154
155
156
157
158
159
160
</DL>
<DL><DT><A NAME="-bitmap"><B>-bitmap (read-only)</B></A></DT>
<DD>

Specifies a bitmap to display at the left of the user frame.
<B>image</B> option override <B>bitmap</B>.
</DD>
</DL>
<DL><DT><A NAME="-buttonwidth"><B>-buttonwidth (read-only)</B></A></DT>
<DD>

Specifies the width of the buttons as specified for the option <B>width</B>
of the <B>button</b> widget.
</DD>
</DL>
<DL><DT><A NAME="-cancel"><B>-cancel</B></A></DT>
<DD>

Specifies the number of the cancel button of the Dialog. When user press Esc in the Dialog,
this button is invoked.


</DD>
</DL>
<DL><DT><A NAME="-default"><B>-default</B></A></DT>
<DD>

Specifies the number of the default button of the Dialog.
When user press Return in the Dialog, this button is invoked.







<
<
<
<
<
<
<




|
|
>
>







133
134
135
136
137
138
139







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
</DL>
<DL><DT><A NAME="-bitmap"><B>-bitmap (read-only)</B></A></DT>
<DD>

Specifies a bitmap to display at the left of the user frame.
<B>image</B> option override <B>bitmap</B>.
</DD>







</DL>
<DL><DT><A NAME="-cancel"><B>-cancel</B></A></DT>
<DD>

Specifies the number of the cancel button of the Dialog. When user presses Esc or the windows close button,
this button is invoked.<BR>
If set to <B>-1</B>, Esc does not invoke anything.
The window close button <I>destroys</I> the dialog in this case and returns <B>-1</B>.
</DD>
</DL>
<DL><DT><A NAME="-default"><B>-default</B></A></DT>
<DD>

Specifies the number of the default button of the Dialog.
When user press Return in the Dialog, this button is invoked.

Changes to BWman/Entry.html.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
<HTML>
<HEAD><TITLE>Entry</TITLE></HEAD>
<BODY BGCOLOR=white>
<DL><DT><I><A HREF="#descr">NAME</A></I></DT>
<DD><B>Entry</B>
 - Entry widget with <B>state</B> option, dynamic help and drag and drop facilities
</DD></DL>
<DL>
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>Entry</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I>STANDARD OPTIONS</I></DT>

<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-background">-background or -bg</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-borderwidth">-borderwidth or -bd</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-disabledbackground">-disabledbackground</A></TD>













>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<HTML>
<HEAD><TITLE>Entry</TITLE></HEAD>
<BODY BGCOLOR=white>
<DL><DT><I><A HREF="#descr">NAME</A></I></DT>
<DD><B>Entry</B>
 - Entry widget with <B>state</B> option, dynamic help and drag and drop facilities
</DD></DL>
<DL>
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>Entry</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I>STANDARD OPTIONS</I></DT>
<DT><I>Not themed</I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-background">-background or -bg</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-borderwidth">-borderwidth or -bd</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-disabledbackground">-disabledbackground</A></TD>
48
49
50
51
52
53
54
























55
56
57
58
59
60
61
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-relief">-relief</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectbackground">-selectbackground</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectborderwidth">-selectborderwidth</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectforeground">-selectforeground</A></TD>
</TR>
























<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-takefocus">-takefocus</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-xscrollcommand">-xscrollcommand</A></TD>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-relief">-relief</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectbackground">-selectbackground</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectborderwidth">-selectborderwidth</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectforeground">-selectforeground</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-takefocus">-takefocus</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-xscrollcommand">-xscrollcommand</A></TD>
</TABLE></DD>
</DL>
<DL>
<DT><I>Themed</I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-exportselection">-exportselection</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-font">-font</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-insertofftime">-insertofftime</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-insertontime">-insertontime</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-insertwidth">-insertwidth</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-justify">-justify</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-takefocus">-takefocus</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-xscrollcommand">-xscrollcommand</A></TD>

Changes to BWman/Label.html.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
<HTML>
<HEAD><TITLE>Label</TITLE></HEAD>
<BODY BGCOLOR=white>
<DL><DT><I><A HREF="#descr">NAME</A></I></DT>
<DD><B>Label</B>
 - Label widget with <B>state</B> option, dynamic help and drag and drop facilities
</DD></DL>
<DL>
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>Label</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I>STANDARD OPTIONS</I></DT>

<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-anchor">-anchor</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-background">-background or -bg</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-bitmap">-bitmap</A></TR>













>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<HTML>
<HEAD><TITLE>Label</TITLE></HEAD>
<BODY BGCOLOR=white>
<DL><DT><I><A HREF="#descr">NAME</A></I></DT>
<DD><B>Label</B>
 - Label widget with <B>state</B> option, dynamic help and drag and drop facilities
</DD></DL>
<DL>
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>Label</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I>STANDARD OPTIONS</I></DT>
<DT><I>Not themed</I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-anchor">-anchor</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-background">-background or -bg</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-bitmap">-bitmap</A></TR>
40
41
42
43
44
45
46





























47
48
49
50
51
52
53
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-justify">-justify</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-padx">-padx</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-pady">-pady</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-relief">-relief</A></TR>
</TR>





























<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-takefocus">-takefocus</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-wraplength">-wraplength</A></TR>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-justify">-justify</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-padx">-padx</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-pady">-pady</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-relief">-relief</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-takefocus">-takefocus</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-wraplength">-wraplength</A></TR>
</TR>
</TABLE></DD>
<DT><I>Themed</I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-anchor">-anchor</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-background">-background or -bg</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-cursor">-cursor</A></TD></TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-font">-font</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-foreground">-foreground or -fg</A></TD>
</TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-image">-image</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-justify">-justify</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-relief">-relief</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-takefocus">-takefocus</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-text">-text</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-wraplength">-wraplength</A></TR>
233
234
235
236
237
238
239
240

241
242
243
244
245
246
247
<DL><DT><A NAME="-height"><B>-height</B></A></DT>
<DD>

Specifies a desired height for the label.
If an image or bitmap is being displayed in the label then the value is in
screen units, for text it is in lines of text.
If this option isn't specified, the label's desired height is computed
from the size of the image or bitmap or text being displayed in it.

</DD>
</DL>
<DL><DT><A NAME="-helptext"><B>-helptext</B></A></DT>
<DD>

Text for dynamic help. If empty, no help is available for this widget.
See also <A HREF="DynamicHelp.html">DynamicHelp</A>.







|
>







263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<DL><DT><A NAME="-height"><B>-height</B></A></DT>
<DD>

Specifies a desired height for the label.
If an image or bitmap is being displayed in the label then the value is in
screen units, for text it is in lines of text.
If this option isn't specified, the label's desired height is computed
from the size of the image or bitmap or text being displayed in it.<BR>
Option not available for <I>themed</I> widgets.
</DD>
</DL>
<DL><DT><A NAME="-helptext"><B>-helptext</B></A></DT>
<DD>

Text for dynamic help. If empty, no help is available for this widget.
See also <A HREF="DynamicHelp.html">DynamicHelp</A>.

Changes to BWman/ListBox.html.

166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<B>insert</B> command). The ListBox can have one or more columns, depending on
<B>multicolumn</B> option. The user do not handle columns; the number of columns
is determined following the height of the ListBox in order to see each item vertically.

</P>
<BR><HR WIDTH="50%"><BR>
<B><A NAME="wso">WIDGET-SPECIFIC OPTIONS</A></B><BR>
<DL><DT><A NAME="-autofocus"><B>-autofocus</B></A></DT>
<DD>
    If this option is true, the listbox will take focus any time the user
    clicks in it.  Without focus, the listbox's mouse wheel bindings will
    not work properly.  The default is true.
</DD>
</DL>








|







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<B>insert</B> command). The ListBox can have one or more columns, depending on
<B>multicolumn</B> option. The user do not handle columns; the number of columns
is determined following the height of the ListBox in order to see each item vertically.

</P>
<BR><HR WIDTH="50%"><BR>
<B><A NAME="wso">WIDGET-SPECIFIC OPTIONS</A></B><BR>
<DL><DT><A NAME="-autofocus"><B>-autofocus (read-only)</B></A></DT>
<DD>
    If this option is true, the listbox will take focus any time the user
    clicks in it.  Without focus, the listbox's mouse wheel bindings will
    not work properly.  The default is true.
</DD>
</DL>

355
356
357
358
359
360
361
362
363
364
365
366
367
368
369

Specifies wether or not the listbox should be redrawn when entering idle.
Set it to false if you call <B>update</B> while modifying the listbox.

</DD>
</DL>

<DL><DT><A NAME="-selectfill"><B>-selectfill</B></A></DT>
<DD>
    If true, the listbox will draw a selection rectangle that fills the
    listbox from left-to-right instead of just drawing a box around the
    selected item.  This more closely mimics the standard Tk listbox.
</DD>
</DL>








|







355
356
357
358
359
360
361
362
363
364
365
366
367
368
369

Specifies wether or not the listbox should be redrawn when entering idle.
Set it to false if you call <B>update</B> while modifying the listbox.

</DD>
</DL>

<DL><DT><A NAME="-selectfill"><B>-selectfill (read-only)</B></A></DT>
<DD>
    If true, the listbox will draw a selection rectangle that fills the
    listbox from left-to-right instead of just drawing a box around the
    selected item.  This more closely mimics the standard Tk listbox.
</DD>
</DL>

661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
</DD></DL>


<b>BINDINGS</b>

<p>
A <b>&lt;&lt;ListboxSelect&gt;&gt;</b> virtual event is generated any time the
selection in the listbox changes.  This is the default behavior of an
item in the listbox, but it can be overridden with the bindText or
bindImage command.  If the button 1 binding is overridden, this event may
not be generated.
</p>

<p>
The listbox has all the standard mouse wheel bindings when it has focus.
</p>
</p>
</BODY></HTML>







|
<
<
<







661
662
663
664
665
666
667
668



669
670
671
672
673
674
675
</DD></DL>


<b>BINDINGS</b>

<p>
A <b>&lt;&lt;ListboxSelect&gt;&gt;</b> virtual event is generated any time the
selection in the listbox changes.



</p>

<p>
The listbox has all the standard mouse wheel bindings when it has focus.
</p>
</p>
</BODY></HTML>

Changes to BWman/MainFrame.html.

18
19
20
21
22
23
24

25
26
27
28
29
30
31

32
33
34






35




36
37
38
39

40
41
42
43
44
45
46
</TR>
<TR>
<TD>&nbsp;&nbsp;-progressmax (see <B>-maximum</B>)</TD>
<TD>&nbsp;&nbsp;-progresstype (see <B>-type</B>)</TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;-progressvar (see <B>-variable</B>)</TD>

</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wso">WIDGET-SPECIFIC OPTIONS</A></I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-height">-height</A></TR>

<TD>&nbsp;&nbsp;<A HREF="#-menu">-menu</A></TR>
</TR>
<TR>






<TD>&nbsp;&nbsp;<A HREF="#-separator">-separator</A></TR>




<TD>&nbsp;&nbsp;<A HREF="#-textvariable">-textvariable</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-width">-width</A></TR>

</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wc">WIDGET COMMAND</A></I></DT>
<DD><I>pathName</I> <A HREF="#addindicator"><B>addindicator</B></A>
 ?<I>arg...</I>?
</DD>







>






|
>
|


>
>
>
>
>
>
|
>
>
>
>
|


|
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
</TR>
<TR>
<TD>&nbsp;&nbsp;-progressmax (see <B>-maximum</B>)</TD>
<TD>&nbsp;&nbsp;-progresstype (see <B>-type</B>)</TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;-progressvar (see <B>-variable</B>)</TD>
</TR>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wso">WIDGET-SPECIFIC OPTIONS</A></I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-height">-height</A></TD></TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-menu">-menu</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-menubarfont">-menubarfont</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-menuentryfont">-menuentryfont</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-separator">-separator</A></TD></TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-statusbarfont">-statusbarfont</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-textvariable">-textvariable</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-width">-width</A></TD></TR>
<TD>&nbsp;&nbsp;<A HREF="#-sizegrip">-sizegrip</A></TR>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wc">WIDGET COMMAND</A></I></DT>
<DD><I>pathName</I> <A HREF="#addindicator"><B>addindicator</B></A>
 ?<I>arg...</I>?
</DD>
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<BR><HR WIDTH="100%"><BR>
<B><A NAME="descr"></A>DESCRIPTION</B><BR>
<P>

MainFrame manage toplevel to have:<BR>
<UL>
<LI>simple menu creation, with automatic accelerator bindings and
<A HREF="DynamicHelp.html">DynamicHelp</A> association,
<LI>one or more toolbars that user can hide,
<LI>a status bar, displaying a user message or a menu description, and optionally a 
<A HREF="ProgressBar.html">ProgressBar</A>.
</UL>
</P>
<BR><HR WIDTH="50%"><BR>
<B><A NAME="wso">WIDGET-SPECIFIC OPTIONS</A></B><BR>
<DL><DT><A NAME="-height"><B>-height</B></A></DT>
<DD>








|
|
|
|







91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<BR><HR WIDTH="100%"><BR>
<B><A NAME="descr"></A>DESCRIPTION</B><BR>
<P>

MainFrame manage toplevel to have:<BR>
<UL>
<LI>simple menu creation, with automatic accelerator bindings and
<A HREF="DynamicHelp.html">DynamicHelp</A> association,</LI>
<LI>one or more toolbars that user can hide,</LI>
<LI>a status bar, displaying a user message or a menu description, and optionally a
<A HREF="ProgressBar.html">ProgressBar</A>.</LI>
</UL>
</P>
<BR><HR WIDTH="50%"><BR>
<B><A NAME="wso">WIDGET-SPECIFIC OPTIONS</A></B><BR>
<DL><DT><A NAME="-height"><B>-height</B></A></DT>
<DD>

103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132


133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166








167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185




186
187
188
189
190
191
192
193





194
195
196
197
198
199
200

This option describes the menu. This is a list whose each five elements describe
one cascade menu. It has the following form:
{<I>menuname</I> <I>tags</I> <I>menuId</I> <I>tearoff</I> <I>menuentries</I>...}
where <I>menuentries</I> is a list where each element describe one menu entry, which can be:
<UL>
<LI>for a separator:<BR>
  {<B>separator</B>}
<LI>for a command:<BR>
  {<B>command</B> <I>menuname</I> ?<I>tags</I>? ?<I>description</I>? ?<I>accelerator</I>? ?<I>option</I> <I>value</I>? ...}
<LI>for a check button:<BR>
  {<B>checkbutton</B> <I>menuname</I> ?<I>tags</I>? ?<I>description</I>? ?<I>accelerator</I>? ?<I>option</I> <I>value</I>? ...}
<LI>for a radio button:<BR>
  {<B>radiobutton</B> <I>menuname</I> ?<I>tags</I>? ?<I>description</I>? ?<I>accelerator</I> ?<I>option</I> <I>value</I>? ...}
<LI>for a cascade menu:<BR>
  {<B>cascade</B> <I>menuname</I> <I>tags</I> <I>menuId</I> <I>tearoff</I> <I>menuentries</I>}
</UL>
where:
<UL>
<LI><I>menuname</I> is the name of the menu. If it contains a &amp;, the following character
is automatically converted to the corresponding <B>-underline</B> option of <B>menu add</B>
command.
<LI><I>tags</I> is the tags list for the entry, used for enabling or disabling menu
entries with <B>MainFrame::setmenustate</B>.
<LI><I>menuId</I> is an id for the menu, from which you can get menu pathname with
 <B>MainFrame::getmenu</B>.
<LI><I>tearoff</I> specifies if menu has tearoff entry.
<LI><I>description</I> specifies a string for <A HREF=\"DynamicHelp.html\">DynamicHelp</A>.
<LI><I>accelerator</I> specifies a key sequence. It is a list of two elements, where the first
is one of <B>Ctrl</B>, <B>Alt</B> or <B>CtrlAlt</B>, and the second as letter or a digit.


An accelerator string is build and corresponding binding set on the toplevel to invoke the
menu entry.
<LI><I>option value</I> specifies additionnal options for the entry (see <B>menu add</B>
command).
</UL>
Each value enclosed by ? are optional and defaulted to empty string, but must be
provided if one or more following options is not empty.
<BR>Example:
<PRE>
set descmenu {
    "&File" {} {} 0 {
        {command "&New"     {} "Create a new document"     {Ctrl n} -command Menu::new}
        {command "&Open..." {} "Open an existing document" {Ctrl o} -command Menu::open}
        {command "&Save"    open "Save the document" {Ctrl s} -command Menu::save}
        {cascade  "&Export"  {} export 0 {
            {command "Format &1" open "Export document to format 1" {} -command {Menu::export 1}}
            {command "Format &2" open "Export document to format 2" {} -command {Menu::export 2}}
        }}
        {separator}
        {cascade "&Recent files" {} recent 0 {}}
        {separator}
        {command "E&xit" {} "Exit the application" {} -command Menu::exit}
    }
    "&Options" {} {} 0 {
        {checkbutton "Toolbar" {} "Show/hide toolbar" {} 
            -variable Menu::_drawtoolbar
            -command  {$Menu::_mainframe showtoolbar toolbar $Menu::_drawtoolbar}
        }
    }
}
</PRE>

</DD>
</DL>








<DL><DT><A NAME="-separator"><B>-separator (read-only)</B></A></DT>
<DD>

Specifies if separator should be drawn at the top and/or at the bottom of the user window.
Must be one of the values <B>none</B>, <B>top</B>, <B>bottom</B> or <B>both</B>.
It depends on the relief of subwidgets of user window.
</DD>
</DL>
<DL><DT><A NAME="-textvariable"><B>-textvariable</B></A></DT>
<DD>

Specifies the textvariable option for the label of the status bar.
<A HREF="DynamicHelp.html">DynamicHelp</A> description
of menu entries are mapped to this variable at the creation of the MainFrame.
If this variable is changed by MainFrame::configure, menu description will
not be available.
<BR>You change the text of the label by modifying the value of the variable.
</DD>
</DL>




<DL><DT><A NAME="-width"><B>-width</B></A></DT>
<DD>

Specifies the desired width for the user frame in any of the forms acceptable to
Tk_GetPixels. If this option is less than or equal to zero (the default) then the window
will not request any size at all.
</DD>
</DL>





<HR WIDTH="50%"><BR>
<B><A NAME="wc">WIDGET COMMAND</A></B><BR>
<DL><DT><A NAME="addindicator"><I>pathName</I> <B>addindicator</B></A>
 ?<I>arg...</I>?
</DT><DD>

Add an indicator box at the right of the status bar. Each indicator are added from left







|

|

|

|

|





|

|

|
|
|

|
>
>

|

|




















|









>
>
>
>
>
>
>
>



















>
>
>
>








>
>
>
>
>







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232

This option describes the menu. This is a list whose each five elements describe
one cascade menu. It has the following form:
{<I>menuname</I> <I>tags</I> <I>menuId</I> <I>tearoff</I> <I>menuentries</I>...}
where <I>menuentries</I> is a list where each element describe one menu entry, which can be:
<UL>
<LI>for a separator:<BR>
  {<B>separator</B>}</LI>
<LI>for a command:<BR>
  {<B>command</B> <I>menuname</I> ?<I>tags</I>? ?<I>description</I>? ?<I>accelerator</I>? ?<I>option</I> <I>value</I>? ...}</LI>
<LI>for a check button:<BR>
  {<B>checkbutton</B> <I>menuname</I> ?<I>tags</I>? ?<I>description</I>? ?<I>accelerator</I>? ?<I>option</I> <I>value</I>? ...}</LI>
<LI>for a radio button:<BR>
  {<B>radiobutton</B> <I>menuname</I> ?<I>tags</I>? ?<I>description</I>? ?<I>accelerator</I> ?<I>option</I> <I>value</I>? ...}</LI>
<LI>for a cascade menu:<BR>
  {<B>cascade</B> <I>menuname</I> <I>tags</I> <I>menuId</I> <I>tearoff</I> <I>menuentries</I>}</LI>
</UL>
where:
<UL>
<LI><I>menuname</I> is the name of the menu. If it contains a &amp;, the following character
is automatically converted to the corresponding <B>-underline</B> option of <B>menu add</B>
command.</LI>
<LI><I>tags</I> is the tags list for the entry, used for enabling or disabling menu
entries with <B>MainFrame::setmenustate</B>.</LI>
<LI><I>menuId</I> is an id for the menu, from which you can get menu pathname with
 <B>MainFrame::getmenu</B>.</LI>
<LI><I>tearoff</I> specifies if menu has tearoff entry.</LI>
<LI><I>description</I> specifies a string for <A HREF=\"DynamicHelp.html\">DynamicHelp</A>.</LI>
<LI><I>accelerator</I> specifies a key sequence. It is a list of two elements, where the first
is one of <B>Shift</B>, <B>Ctrl</B>, <B>Alt</B>, <B>CtrlAlt</B>, <B>Cmd</B>,  or <B>ShiftCmd</B>, and the second as letter
(see <A HREF="#-casesensitive">-casesensitive</A> option for interpretation),  digit or
a special key name.
An accelerator string is build and corresponding binding set on the toplevel to invoke the
menu entry.</LI>
<LI><I>option value</I> specifies additionnal options for the entry (see <B>menu add</B>
command).</LI>
</UL>
Each value enclosed by ? are optional and defaulted to empty string, but must be
provided if one or more following options is not empty.
<BR>Example:
<PRE>
set descmenu {
    "&File" {} {} 0 {
        {command "&New"     {} "Create a new document"     {Ctrl n} -command Menu::new}
        {command "&Open..." {} "Open an existing document" {Ctrl o} -command Menu::open}
        {command "&Save"    open "Save the document" {Ctrl s} -command Menu::save}
        {cascade  "&Export"  {} export 0 {
            {command "Format &1" open "Export document to format 1" {} -command {Menu::export 1}}
            {command "Format &2" open "Export document to format 2" {} -command {Menu::export 2}}
        }}
        {separator}
        {cascade "&Recent files" {} recent 0 {}}
        {separator}
        {command "E&xit" {} "Exit the application" {} -command Menu::exit}
    }
    "&Options" {} {} 0 {
        {checkbutton "Toolbar" {} "Show/hide toolbar" {}
            -variable Menu::_drawtoolbar
            -command  {$Menu::_mainframe showtoolbar toolbar $Menu::_drawtoolbar}
        }
    }
}
</PRE>

</DD>
</DL>
<DL><DT><A NAME="-menubarfont"><B>-menubarfont</B></A></DT>
<DD>
Font for the top menu bar.
</DD>
<DL><DT><A NAME="-menuentryfont"><B>-menuentryfont</B></A></DT>
<DD>
Font for the submenus.
</DD>
<DL><DT><A NAME="-separator"><B>-separator (read-only)</B></A></DT>
<DD>

Specifies if separator should be drawn at the top and/or at the bottom of the user window.
Must be one of the values <B>none</B>, <B>top</B>, <B>bottom</B> or <B>both</B>.
It depends on the relief of subwidgets of user window.
</DD>
</DL>
<DL><DT><A NAME="-textvariable"><B>-textvariable</B></A></DT>
<DD>

Specifies the textvariable option for the label of the status bar.
<A HREF="DynamicHelp.html">DynamicHelp</A> description
of menu entries are mapped to this variable at the creation of the MainFrame.
If this variable is changed by MainFrame::configure, menu description will
not be available.
<BR>You change the text of the label by modifying the value of the variable.
</DD>
</DL>
<DL><DT><A NAME="-statusbarfont"><B>-statusbarfont</B></A></DT>
<DD>
Font for the status bar.
</DD>
<DL><DT><A NAME="-width"><B>-width</B></A></DT>
<DD>

Specifies the desired width for the user frame in any of the forms acceptable to
Tk_GetPixels. If this option is less than or equal to zero (the default) then the window
will not request any size at all.
</DD>
</DL>
<DL><DT><A NAME="-sizegrip"><B>-sizegrip (themed, read-only)</B></A></DT>
<DD>

If bool argument is true and themed mode, show a ttk sizegrip widget in the lower-right corner.
</DD>
<HR WIDTH="50%"><BR>
<B><A NAME="wc">WIDGET COMMAND</A></B><BR>
<DL><DT><A NAME="addindicator"><I>pathName</I> <B>addindicator</B></A>
 ?<I>arg...</I>?
</DT><DD>

Add an indicator box at the right of the status bar. Each indicator are added from left

Changes to BWman/MessageDlg.html.

82
83
84
85
86
87
88

89
90
91
92
93
94
95
be as wide as it is tall, 200 means the text should
be twice as wide as it is tall, 50 means the text should
be twice as tall as it is wide, and so on.
Used to choose line length for text if <B>width</B> option
isn't specified.
Defaults to 150.


</DD>
</DL>
<DL><DT><A NAME="-buttons"><B>-buttons</B></A></DT>
<DD>

Specifies a list of buttons to display when <B>type</B> option is <I>user</I>.
If a button has a symbolic name, its associated text will be displayed.







>







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
be as wide as it is tall, 200 means the text should
be twice as wide as it is tall, 50 means the text should
be twice as tall as it is wide, and so on.
Used to choose line length for text if <B>width</B> option
isn't specified.
Defaults to 150.

The options <B>-width</B> and <B>-aspect</B> are directly heritated from the Tk message widget.
</DD>
</DL>
<DL><DT><A NAME="-buttons"><B>-buttons</B></A></DT>
<DD>

Specifies a list of buttons to display when <B>type</B> option is <I>user</I>.
If a button has a symbolic name, its associated text will be displayed.
194
195
196
197
198
199
200
201
202
203



204
205
206
207
208
209
210
211
Displays three buttons whose symbolic names are <B>yes</B>, <B>no</B>
and <B>cancel</B>.
<P>
<DT>
<B>user</B>
<DD>
Displays buttons of <B>-buttons</B> option.<P>
<DT>
</DL COMPACT>




</DD>
</DL>
<DL><DT><A NAME="-width"><B>-width</B></A></DT>
<DD>

Specifies the length of lines in the window.
If this option has a value greater than zero then the <B>aspect</B>
option is ignored and the <B>width</B> option determines the line







<
|

>
>
>
|







195
196
197
198
199
200
201

202
203
204
205
206
207
208
209
210
211
212
213
214
Displays three buttons whose symbolic names are <B>yes</B>, <B>no</B>
and <B>cancel</B>.
<P>
<DT>
<B>user</B>
<DD>
Displays buttons of <B>-buttons</B> option.<P>

</DD>

<P>
For any <B>-type</B> but <B>user</B>, the native Tk widget <B>tk_messageBox</B> is used.
In this case, only the following options are considered: <B>-default</B>, <B>-icon</B>, <B>-message</B>, <B>-title</B> and <B>-type</B>.
</P>
</DL>
<DL><DT><A NAME="-width"><B>-width</B></A></DT>
<DD>

Specifies the length of lines in the window.
If this option has a value greater than zero then the <B>aspect</B>
option is ignored and the <B>width</B> option determines the line

Changes to BWman/NoteBook.html.

42
43
44
45
46
47
48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-arcradius">-arcradius</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-height">-height</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-homogeneous">-homogeneous</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-side">-side</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-tabbevelsize">-tabbevelsize</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-tabpady">-tabpady</A></TD>
</TR>
<TR>

<TD>&nbsp;&nbsp;<A HREF="#-width">-width</A></TD>
</TR>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wc">WIDGET COMMAND</A></I></DT>
<DD><I>pathName</I> <A HREF="#bindtabs"><B>bindtabs</B></A>







|


|
|


>







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-arcradius">-arcradius</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-height">-height</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-homogeneous">-homogeneous</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-internalborderwidth">-internalborderwidth or -ibd</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-side">-side</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-tabbevelsize">-tabbevelsize</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-tabpady">-tabpady</A></TD>
<TD>&nbsp;&nbsp;<A HREF="#-width">-width</A></TD>
</TR>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wc">WIDGET COMMAND</A></I></DT>
<DD><I>pathName</I> <A HREF="#bindtabs"><B>bindtabs</B></A>
113
114
115
116
117
118
119
120




121
122
123
124
125
126
127
 <I>page</I>
</DD>
</DL>
<BR><HR WIDTH="100%"><BR>
<B><A NAME="descr"></A>DESCRIPTION</B><BR>
<P>

NoteBook widget manage a set of pages and displays one of them.





</P>
<BR><HR WIDTH="50%"><BR>
<B><A NAME="wso">WIDGET-SPECIFIC OPTIONS</A></B><BR>
<DL><DT><A NAME="-arcradius"><B>-arcradius</B></A></DT>
<DD>








|
>
>
>
>







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
 <I>page</I>
</DD>
</DL>
<BR><HR WIDTH="100%"><BR>
<B><A NAME="descr"></A>DESCRIPTION</B><BR>
<P>

The NoteBook widget manages a set of pages and displays one of them.  A page
is a <B>frame</B> or <B>ttk::frame</B> that is included in the NoteBook by its
<A HREF="#insert"><B>insert</B></A> command.  Each page is associated with a tab;
the tabs are displayed in a band either above or below the pages, depending on
the value of the option <A HREF="#-side">-side</A>.

</P>
<BR><HR WIDTH="50%"><BR>
<B><A NAME="wso">WIDGET-SPECIFIC OPTIONS</A></B><BR>
<DL><DT><A NAME="-arcradius"><B>-arcradius</B></A></DT>
<DD>

138
139
140
141
142
143
144
145








146
147
148


149
150
151
152
153
154
155
In this case, user may want to call NoteBook::<B>compute_size</B> to make NoteBook larger
enough to contains the largest page.
</DD>
</DL>
<DL><DT><A NAME="-homogeneous"><B>-homogeneous</B></A></DT>
<DD>

Specifies wether or not the label of the pages must have the same width.









</DD>
</DL>


<DL><DT><A NAME="-side"><B>-side</B></A></DT>
<DD>

Specifies the side where to place the label of the pages. Must be one
of <B>top</B> or <B>bottom</B>.

</DD>







|
>
>
>
>
>
>
>
>



>
>







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
In this case, user may want to call NoteBook::<B>compute_size</B> to make NoteBook larger
enough to contains the largest page.
</DD>
</DL>
<DL><DT><A NAME="-homogeneous"><B>-homogeneous</B></A></DT>
<DD>

Specifies whether or not the label of the pages must have the same width.

</DD>
</DL>

<DL><DT><A NAME="-internalborderwidth"><B>-internalborderwidth</B> or <B>-ibd</B></A></DT>
<DD>

Value that is applied to each page in the NoteBook as its <B>-borderwidth</B> or <B>-bd</B>.

</DD>
</DL>


<DL><DT><A NAME="-side"><B>-side</B></A></DT>
<DD>

Specifies the side where to place the label of the pages. Must be one
of <B>top</B> or <B>bottom</B>.

</DD>
247
248
249
250
251
252
253
254
255


256
257





















258
259
260
261
262
















































263
264
265
266
267
268
269
270
271
272
273
274
275
276
277







278
279
280
281
282
283
284
















285
286
287
288
289
290
291
</DD></DL>
<DL><DT><A NAME="insert"><I>pathName</I> <B>insert</B></A>
 <I>index</I>
 <I>page</I>
 ?<I>option value...</I>?
</DT><DD>

Insert a new page idendified by <I>page</I> at position <I>index</I> in the pages list.
<I>index</I> must be numeric or <B>end</B>. The pathname of the new page is returned.



<P>





















<DL><DT><A NAME="Page-createcmd"><B>-createcmd</B></A></DT>
<DD>

Specifies a command to be called the first time the page is raised.

















































</DD>
</DL>
<DL><DT><A NAME="Page-image"><B>-image</B></A></DT>
<DD>

Specifies an image to display for the page at the left of the label

</DD>
</DL>
<DL><DT><A NAME="Page-leavecmd"><B>-leavecmd</B></A></DT>
<DD>

Specifies a command to be called when a page is about to be leaved.
The command must return 0 if the page can not be leaved, or 1 if it can.








</DD>
</DL>
<DL><DT><A NAME="Page-raisecmd"><B>-raisecmd</B></A></DT>
<DD>

Specifies a command to be called each time the page is raised.

















</DD>
</DL>
<DL><DT><A NAME="Page-state"><B>-state</B></A></DT>
<DD>

Specifies the state of the page. Must be <B>normal</B> or <B>disabled</B>.








|

>
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>















>
>
>
>
>
>
>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
</DD></DL>
<DL><DT><A NAME="insert"><I>pathName</I> <B>insert</B></A>
 <I>index</I>
 <I>page</I>
 ?<I>option value...</I>?
</DT><DD>

Insert a new page identified by <I>page</I> at position <I>index</I> in the pages list.
<I>index</I> must be numeric or <B>end</B>. The pathname of the new page is returned.
Dynamic help, if it is specified by the options, is
displayed when the pointer hovers over the tab that belongs to the page.

<P>
<DL><DT><A NAME="Page-activebackground"><B>-activebackground</B></A></DT>
<DD>

Background color for the tab when it is active.

</DD>
</DL>
<DL><DT><A NAME="Page-activeforeground"><B>-activeforeground</B></A></DT>
<DD>

Color used for the tab's text when the tab is active.

</DD>
</DL>
<DL><DT><A NAME="Page-background"><B>-background</B></A></DT>
<DD>

Background color for the tab when it is not active.

</DD>
</DL>
<DL><DT><A NAME="Page-createcmd"><B>-createcmd</B></A></DT>
<DD>

Specifies a command to be called the first time the page is raised.

</DD>
</DL>
<DL><DT><A NAME="Page-disabledforeground"><B>-disabledforeground</B></A></DT>
<DD>

Color used for the tab's text when the tab is disabled.

</DD>
</DL>

<DL><DT><A NAME="Page-foreground"><B>-foreground</B></A></DT>
<DD>

Color used for the tab's text when the tab is neither active nor disabled.

</DD>
</DL>
<DL><DT><A NAME="Page-helpcmd"><B>-helpcmd</B></A></DT>
<DD>

Has no effect.
See also <A HREF="DynamicHelp.html">DynamicHelp</A>.

</DD>
</DL>
<DL><DT><A NAME="Page-helptext"><B>-helptext</B></A></DT>
<DD>

Text for dynamic help. If empty, no help is available for this page.
See also <A HREF="DynamicHelp.html">DynamicHelp</A>.

</DD>
</DL>
<DL><DT><A NAME="Page-helptype"><B>-helptype</B></A></DT>
<DD>

Type of dynamic help. Use <I>balloon</I> (the default for a NoteBook
page) or <I>variable</I>.
See also <A HREF="DynamicHelp.html">DynamicHelp</A>.

</DD>
</DL>
<DL><DT><A NAME="Page-helpvar"><B>-helpvar</B></A></DT>
<DD>

Variable to use when <B>-helptype</B> option is <I>variable</I>.
See also <A HREF="DynamicHelp.html">DynamicHelp</A>.

</DD>
</DL>
<DL><DT><A NAME="Page-image"><B>-image</B></A></DT>
<DD>

Specifies an image to display for the page at the left of the label

</DD>
</DL>
<DL><DT><A NAME="Page-leavecmd"><B>-leavecmd</B></A></DT>
<DD>

Specifies a command to be called when a page is about to be leaved.
The command must return 0 if the page can not be leaved, or 1 if it can.

</DD>
</DL>
<DL><DT><A NAME="Page-ractiveimage"><B>-ractiveimage</B></A></DT>
<DD>

Image to show on the right of the tab when the tab is active.

</DD>
</DL>
<DL><DT><A NAME="Page-raisecmd"><B>-raisecmd</B></A></DT>
<DD>

Specifies a command to be called each time the page is raised.

</DD>
</DL>
<DL><DT><A NAME="Page-rimage"><B>-rimage</B></A></DT>
<DD>

Image to show on the right of the tab when the tab is not active.

</DD>
</DL>
<DL><DT><A NAME="Page-rimagecmd"><B>-rimagecmd</B></A></DT>
<DD>

Specifies a command to be evaluated, with two arguments appended, when the
image shown on the right of the tab is clicked.  The first appended argument
is the Tk window path of the NoteBook, the second is the name of the page.

</DD>
</DL>
<DL><DT><A NAME="Page-state"><B>-state</B></A></DT>
<DD>

Specifies the state of the page. Must be <B>normal</B> or <B>disabled</B>.

Changes to BWman/ScrolledWindow.html.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20










21
22
23
24
25
26
27
<HTML>
<HEAD><TITLE>ScrolledWindow</TITLE></HEAD>
<BODY BGCOLOR=white>
<DL><DT><I><A HREF="#descr">NAME</A></I></DT>
<DD><B>ScrolledWindow</B>
 - Generic scrolled widget
</DD></DL>
<DL>
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>ScrolledWindow</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I>STANDARD OPTIONS</I></DT>

<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-background">-background or -bg</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-borderwidth">-borderwidth or -bd</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-relief">-relief</A></TR>










</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wso">WIDGET-SPECIFIC OPTIONS</A></I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-auto">-auto</A></TR>













>







>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<HTML>
<HEAD><TITLE>ScrolledWindow</TITLE></HEAD>
<BODY BGCOLOR=white>
<DL><DT><I><A HREF="#descr">NAME</A></I></DT>
<DD><B>ScrolledWindow</B>
 - Generic scrolled widget
</DD></DL>
<DL>
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>ScrolledWindow</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I>STANDARD OPTIONS</I></DT>
<DT><I>Not themed</I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-background">-background or -bg</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-borderwidth">-borderwidth or -bd</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-relief">-relief</A></TR>
</TABLE></DD>
<DT><I>Themed</I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-borderwidth">-borderwidth or -bd</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-relief">-relief</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;(<B>-bg</B> has no effect)</TD>
</TR>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wso">WIDGET-SPECIFIC OPTIONS</A></I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-auto">-auto</A></TR>
96
97
98
99
100
101
102
103

104
105
106
107
108
109
110
Possible values are: <B>ne</B>, <B>en</B>, <B>nw</B>, <B>wn</B>, <B>se</B> (default value), <B>es</B>, <B>sw</B>, <B>ws</B>.
</DD>
</DL>
<DL><DT><A NAME="-size"><B>-size (read-only)</B></A></DT>
<DD>

Size of the scrollbars in pixels.
Use </B>0</B> for standard size (default value).

</DD>
</DL>
<HR WIDTH="50%"><BR>
<B><A NAME="wc">WIDGET COMMAND</A></B><BR>
<DL><DT><A NAME="cget"><I>pathName</I> <B>cget</B></A>
 <I>option</I>
</DT><DD>







|
>







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
Possible values are: <B>ne</B>, <B>en</B>, <B>nw</B>, <B>wn</B>, <B>se</B> (default value), <B>es</B>, <B>sw</B>, <B>ws</B>.
</DD>
</DL>
<DL><DT><A NAME="-size"><B>-size (read-only)</B></A></DT>
<DD>

Size of the scrollbars in pixels.
Use </B>0</B> for standard size (default value).<BR>
This option has no effect if widget is <I>themed</I>.
</DD>
</DL>
<HR WIDTH="50%"><BR>
<B><A NAME="wc">WIDGET COMMAND</A></B><BR>
<DL><DT><A NAME="cget"><I>pathName</I> <B>cget</B></A>
 <I>option</I>
</DT><DD>

Changes to BWman/SelectColor.html.

9
10
11
12
13
14
15

16



17
18
19
20
21
22
23

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43




44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59







60
61
62



63



















64
65
66
67
68
69
70
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>SelectColor</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I><A HREF="#wso">WIDGET-SPECIFIC OPTIONS</A></I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>

<TD>&nbsp;&nbsp;<A HREF="#-color">-color</A></td>



<TD>&nbsp;&nbsp;<A HREF="#-parent">-parent</A></td>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-placement">-placement</A></td>
<TD>&nbsp;&nbsp;<A HREF="#-title">-title</A></td>
</TR>
<TR>

<TD>&nbsp;&nbsp;<A HREF="#-type">-type</A></td>
</TR>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wc">WIDGET COMMAND</A></I></DT>
<DD><I>pathName</I> <A HREF="#cget"><B>cget</B></A>
 <I>option</I>
</DD>
<DD><I>pathName</I> <A HREF="#configure"><B>configure</B></A>
 ?<I>option</I>? ?<I>value</I> <I>option</I> <I>value</I> ...?
</DD>
<DD>SelectColor::<A HREF="#dialog"><B>dialog</B></A>
 <I>pathName</I>
 <I>?option value ...?</I>
</DD>
<DD>SelectColor::<A HREF="#menu"><B>menu</B></A>
 <I>pathName</I>
 <I>placement</I>
 <I>?option value ...?</I>




</DD>
<DD>SelectColor::<A HREF="#setcolor"><B>setcolor</B></A>
 <I>index</I>
 <I>color</I>
</DD>
</DL>
<BR><HR WIDTH="100%"><BR>
<B><A NAME="descr"></A>DESCRIPTION</B><BR>
<P>

SelectColor provides a simple way to select color. It can be displayed
as a dialog box or as a menubutton.

</P>
<BR><HR WIDTH="50%"><BR>
<B><A NAME="wso">WIDGET-SPECIFIC OPTIONS</A></B><BR>







<DL><DT><A NAME="-color"><B>-color</B></A></DT>
<DD>




Specifies the color value of the widget.




















</DD>
</DL>
<DL><DT><A NAME="-parent"><B>-parent</B></A></DT>
<DD>

Parent of the Dialog. Dialog is centered in its parent. If empty, it is centered in







>

>
>
>
|


|
|


>




















>
>
>
>
















>
>
>
>
>
>
>



>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>SelectColor</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I><A HREF="#wso">WIDGET-SPECIFIC OPTIONS</A></I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-background">-background</A></td>
<TD>&nbsp;&nbsp;<A HREF="#-color">-color</A></td>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-command">-command</A></td>
<TD>&nbsp;&nbsp;<A HREF="#-help">-help</A></td>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-parent">-parent</A></td>
<TD>&nbsp;&nbsp;<A HREF="#-placement">-placement</A></td>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-title">-title</A></td>
<TD>&nbsp;&nbsp;<A HREF="#-type">-type</A></td>
</TR>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wc">WIDGET COMMAND</A></I></DT>
<DD><I>pathName</I> <A HREF="#cget"><B>cget</B></A>
 <I>option</I>
</DD>
<DD><I>pathName</I> <A HREF="#configure"><B>configure</B></A>
 ?<I>option</I>? ?<I>value</I> <I>option</I> <I>value</I> ...?
</DD>
<DD>SelectColor::<A HREF="#dialog"><B>dialog</B></A>
 <I>pathName</I>
 <I>?option value ...?</I>
</DD>
<DD>SelectColor::<A HREF="#menu"><B>menu</B></A>
 <I>pathName</I>
 <I>placement</I>
 <I>?option value ...?</I>
</DD>
<DD>SelectColor::<A HREF="#setbasecolor"><B>setbasecolor</B></A>
 <I>index</I>
 <I>color</I>
</DD>
<DD>SelectColor::<A HREF="#setcolor"><B>setcolor</B></A>
 <I>index</I>
 <I>color</I>
</DD>
</DL>
<BR><HR WIDTH="100%"><BR>
<B><A NAME="descr"></A>DESCRIPTION</B><BR>
<P>

SelectColor provides a simple way to select color. It can be displayed
as a dialog box or as a menubutton.

</P>
<BR><HR WIDTH="50%"><BR>
<B><A NAME="wso">WIDGET-SPECIFIC OPTIONS</A></B><BR>
<DL><DT><A NAME="-background"><B>-background</B></A></DT>
<DD>

Specifies the background color of the widget. 
 
</DD>
</DL>
<DL><DT><A NAME="-color"><B>-color</B></A></DT>
<DD>

Specifies the initial color used in the widget's color selectors.  When modifying a
color that is used in the GUI, the value supplied is typically the existing value of
that color.

</DD>
</DL>
<DL><DT><A NAME="-command"><B>-command</B></A></DT>
<DD>

Specifies a command to be evaluated, with a color value appended, whenever
the color selected in the dialog changes.  This facility can be used to modify
a color in the calling GUI and preview the change before deciding whether or not
to accept it.  If the user selects "Cancel" in the dialog, the command is called
a final time to restore the initial color (supplied by option <B>-color</B>) that was
used before the dialog was opened.

</DD>
</DL>
<DL><DT><A NAME="-help"><B>-help</B></A></DT>
<DD>

This option takes a Boolean value.  If the value is Boolean true, the SelectColor
dialog will include a balloon help for text entry and mouse operation.

</DD>
</DL>
<DL><DT><A NAME="-parent"><B>-parent</B></A></DT>
<DD>

Parent of the Dialog. Dialog is centered in its parent. If empty, it is centered in
147
148
149
150
151
152
153









154
155
156
157
158
159
160
161
162
163
164
<i>placement</i> can be any of <b>at</b>, <b>center</b>, <b>left</b>,
<b>right</b>, <b>above</b>, or <b>below</b>.  If <i>-parent</i> is specified,
placement will be in relation to the parent widget.
</p>

</DD></DL>










</DD></DL>
<DL><DT><A NAME="setcolor">SelectColor::<B>setcolor</B></A>
 <I>index</I>
 <I>color</I>
</DT><DD>

Set the value of user predefined color at index <I>index</I> to <I>color</I>.
<I>index</I> must be between 0 and 10.

</DD></DL>
</BODY></HTML>







>
>
>
>
>
>
>
>
>











185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<i>placement</i> can be any of <b>at</b>, <b>center</b>, <b>left</b>,
<b>right</b>, <b>above</b>, or <b>below</b>.  If <i>-parent</i> is specified,
placement will be in relation to the parent widget.
</p>

</DD></DL>

</DD></DL>
<DL><DT><A NAME="setbasecolor">SelectColor::<B>setbasecolor</B></A>
 <I>index</I>
 <I>color</I>
</DT><DD>

Set the value of user predefined base color at index <I>index</I> to <I>color</I>.
<I>index</I> must be between 0 and 10.

</DD></DL>
<DL><DT><A NAME="setcolor">SelectColor::<B>setcolor</B></A>
 <I>index</I>
 <I>color</I>
</DT><DD>

Set the value of user predefined color at index <I>index</I> to <I>color</I>.
<I>index</I> must be between 0 and 10.

</DD></DL>
</BODY></HTML>

Changes to BWman/SpinBox.html.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<DD><A HREF="#descr"><B>SpinBox</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I><A HREF="ArrowButton.html">OPTIONS from <B>ArrowButton</B></A></I></DT>
<DD><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;-background or -bg</TD>
<TD>&nbsp;&nbsp;-disabledforeground</TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;-foreground or -fg</TD>
<TD>&nbsp;&nbsp;-repeatdelay</TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;-repeatinterval</TD>
<TD>&nbsp;&nbsp;-state</TD>
</TR>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="Entry.html">OPTIONS from <B>Entry</B></A></I></DT>
<DD><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;-command</TD>
<TD>&nbsp;&nbsp;-disabledforeground</TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;-dragenabled</TD>
<TD>&nbsp;&nbsp;-dragendcmd</TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;-dragevent</TD>







|
















|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<DD><A HREF="#descr"><B>SpinBox</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I><A HREF="ArrowButton.html">OPTIONS from <B>ArrowButton</B></A></I></DT>
<DD><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;-background or -bg</TD>
<TD>&nbsp;&nbsp;-disabledforeground (not themed)</TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;-foreground or -fg</TD>
<TD>&nbsp;&nbsp;-repeatdelay</TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;-repeatinterval</TD>
<TD>&nbsp;&nbsp;-state</TD>
</TR>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="Entry.html">OPTIONS from <B>Entry</B></A></I></DT>
<DD><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;-command</TD>
<TD>&nbsp;&nbsp;-disabledforeground (not themed)</TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;-dragenabled</TD>
<TD>&nbsp;&nbsp;-dragendcmd</TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;-dragevent</TD>

Changes to BWman/Tree.html.

482
483
484
485
486
487
488
489
490
491





492
493
494
495
496
497
498
</DD>
</DL>
<HR WIDTH="50%"><BR>

<B><A NAME="nodes">NODE NAMES</A></B><BR>
<p>
Certain special characters in node names are automatically substituted
by the tree during operation.  These characters are <b>&amp; | ^ !</b>.
They are all substituted with a <b>_</b> character.  This is only to
avoid errors because the characters are special to the tree widget.





</p>

<B><A NAME="wc">WIDGET COMMAND</A></B><BR>
<DL><DT><A NAME="bindArea"><I>pathName</I> <B>bindArea</B></A>
 <I>event</I>
 <I>script</I>
</DT><DD>







|
|
|
>
>
>
>
>







482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
</DD>
</DL>
<HR WIDTH="50%"><BR>

<B><A NAME="nodes">NODE NAMES</A></B><BR>
<p>
Certain special characters in node names are automatically substituted
by the tree during operation.  These characters are <b>&amp; | ^ ! :</b>.
They are internally substituted by non printable characters \1 to \5.
This is only to avoid errors because the characters are special to the tree widget.
In consequence, the characters \1 to \5 are not unique in node names and should be avoided.
</p>
<p>Note: until BWidget 1.9.16, a double colon ("::") was substituded by \5 and the
single colon (":") lead to an error. This change is incompatible in the sense, that
the generated node name changed between the versions.
</p>

<B><A NAME="wc">WIDGET COMMAND</A></B><BR>
<DL><DT><A NAME="bindArea"><I>pathName</I> <B>bindArea</B></A>
 <I>event</I>
 <I>script</I>
</DT><DD>

Changes to BWman/Widget.html.

333
334
335
336
337
338
339



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
    usually the first command executed in a new widget definition.
    </p>

<ul>
    <li><i>class</i> is the name of the new widget class.</li>
    <li><i>filename</i> is the name of the file (without extension) in the
    BWidget distribution that defines this class.</li>



</ul>

    <p>
    Each class defined after the filename is a class that this widget
    depends on.  The ::use command will be called for each of these
    classes after the new widget has been defined.
    </p>

    <p>
    This command does several things to setup the new class.  First, it
    creates an alias in the global namespace for the name of the class
    that points to the class's ::create subcommand.  Second, it defines
    a ::use subcommand for the class which other classes can use to load
    this class on the fly.  Lastly, it creates a default binding to the
    &lt;Destroy&gt; event for the class that calls Widget::destroy on
    the path.  This is the default setup for almost all widgets in the
    BWidget package.
    </p>

</DD></DL>

<DL><DT><A NAME="destroy">Widget::<B>destroy</B></A>
 <I>path</I>
</DT><DD>







>
>
>









|
|
|
|
|
|
|
|







333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
    usually the first command executed in a new widget definition.
    </p>

<ul>
    <li><i>class</i> is the name of the new widget class.</li>
    <li><i>filename</i> is the name of the file (without extension) in the
    BWidget distribution that defines this class.</li>
    <li><i>?-classonly?</i> If present, the class is not setup.</li>
    <li><i>?-namespace ns?</i> The namespace where the widget's procedures live
    in; defaults to the class name.</li>
</ul>

    <p>
    Each class defined after the filename is a class that this widget
    depends on.  The ::use command will be called for each of these
    classes after the new widget has been defined.
    </p>

    <p>
    If <i>-classonly</i> option is not given this command does several things to
    setup the new class.  First, it creates an alias in the global namespace for
    the name of the class that points to the class's ::create subcommand.
    Second, it defines a ::use subcommand for the class which other classes can
    use to load this class on the fly.  Lastly, it creates a default binding to
    the &lt;Destroy&gt; event for the class that calls Widget::destroy on the
    path.  This is the default setup for almost all widgets in the BWidget
    package.
    </p>

</DD></DL>

<DL><DT><A NAME="destroy">Widget::<B>destroy</B></A>
 <I>path</I>
</DT><DD>

Changes to BWman/contents.html.

77
78
79
80
81
82
83











84
<TR><TD><A HREF="DragSite.html">DragSite</A></TD>
<TD>Commands set for Drag facilities</TD></TR>
<TR><TD><A HREF="DropSite.html">DropSite</A></TD>
<TD>Commands set for Drop facilities</TD></TR>
<TR><TD><A HREF="BWidget.html">BWidget</A></TD>
<TD>Description text</TD></TR>
</TABLE>











</DD></BODY></HTML>







>
>
>
>
>
>
>
>
>
>
>
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<TR><TD><A HREF="DragSite.html">DragSite</A></TD>
<TD>Commands set for Drag facilities</TD></TR>
<TR><TD><A HREF="DropSite.html">DropSite</A></TD>
<TD>Commands set for Drop facilities</TD></TR>
<TR><TD><A HREF="BWidget.html">BWidget</A></TD>
<TD>Description text</TD></TR>
</TABLE>
</DD>

<BR><HR><BR><B>Load BWidget</B><BR><BR>

Possible load sequence:
<pre>
# If package msgcat is available, its locale is used for BWidget
package require msgcat
# load BWidget
package require BWidget
</pre>
</BODY></HTML>

Changes to ChangeLog.























































































































































































































































































































































































































































































































































































1
2
3
4
5
6
7






















































































































































































































































































































































































































































































































































































2009-07-24 Harald Oehlmann  <[email protected]>

	**** BWidget 1.9.0 tagged ****

	* pkgIndex.tcl, README.txt: updated to BWidget 1.9

2009-07-23 Harald Oehlmann  <[email protected]>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
2023-05-22 Harald Oehlmann <[email protected]>
	TCL9.0/Tk8.7 compatibility issues found by Paul Obermeier.
	https://wiki.tcl-lang.org/page/Porting+extensions+to+Tcl+9
	* dropsite.tcl: Replaced "$tcl_platform" with "$::tcl_platform"
	  in namespaces.
	* widget.tcl: Replaced "package require Tcl 8.1.1" with
	  "package require Tcl 8.1.1-".
	Ticket [1bee17b353] 

2023-05-22 Harald Oehlmann <[email protected]>
	tree.tcl: Bug: node names with leading colons gave error.
	The node name solution was changed, that ":" is now
	substituded by "\5", and not "::". Ticket [d075175ade].
	Thanks to Rolf Ade for the ticket.

2022-12-25 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.16 tagged ****

2022-10-12 Wolfgang Kechel <[email protected]>
	dropsite.tcl: Prevent multiple drops, when movement
	while drop is processed. Ticket  [1ef1f56cd1]


2021-12-03 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.15 tagged ****

2021-12-03 Harald Oehlmann <[email protected]>
	mainframe.tcl: Recalculate status bar height if the
	text size is changed by a change of a used named font.
	Ticket [acbd67752a]

2021-08-05 Harald Oehlmann <[email protected]>
	notebook.tcl: Repaint tabs if the text size is changed
	by a change of a used named font. Ticket [acbd67752a]

2019-12-03 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.14 tagged ****

2019-11-12 Harald Oehlmann <[email protected]>
	spinbox.tcl: fix error about unsupported option
	-disabledforeground when using themed widgets.
	Thanks to Gerhard Reithofer and Christian Werner.
	Ticket [071fc80f14]

2019-05-06 Harald Oehlmann <[email protected]>
	mainframe.tcl: Add optional parameter "Top" to internal
	function "MainFrame::_create_menubar" to allow to use
	a menu button for the main menu (Hack).
	The mainframe may be initialized with "- menu {}".
	Then, the menubutton may be created and the menu may
	by added by:
	MainFrame::_create_menubar .mf $mitems $menubutton.
	Allow to skip a main menu level by empty menu label.
	Purpose: support commands/checkboxes at first level.

2018-12-11 Harald Oehlmann <[email protected]>
	scrollframe.tcl: use Tk8.7 TIP 518 virtual event
	<<NoManagedChild>> to resize client frame to 1x1 when
	last child is unmapped.

2018-12-06 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.13 tagged ****

2018-11-26 Harald Oehlmann <[email protected]>
	dialog.c: For Unix, also Bind KP_Enter for default dialog
	button invokation. Ticket [3e31f04367].
	Thanks to Jos for the proposal.

2018-01-09 Harald Oehlmann <[email protected]>
	Spanish translation enhanced by Neko.
	Ticket [a947e33526]

2018-01-10 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.12 tagged ****

2018-01-10 Harald Oehlmann <[email protected]>
	color.tcl: replace the help widget by balloons bound to the
	widgets. Ticket [2cc70ce1cb]

2018-01-09 Harald Oehlmann <[email protected]>
	color.tcl: New option -command allows to get a callback
	when the user does an unvalidated choice.
	New option -background and command SelectColor for
	window background.
	TitleFrames, Dynamic help and Aqua native buttons used.
	Show current choice by highlighting, not focus, to avoid
	conflict with keyboard traversal.
	Shows entry widget for numerical color input/output.
	New option -help to show a help area.
	Patch by Keith J. Nash
	Ticket [75101bf5ce]
	Translators: Jima (es), Vogel (fr), Marcus (nl), Ian (da)
	Ticket [a947e33526]

2017-11-03 Harald Oehlmann
	notebook.tcl (+man,demo): Add possibility to NoteBook
	to add an image at the right of each tab.
	Ticket [15e19fe9ec]. Patch by Keith J. Nash.

2017-08-25 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.11 tagged ****

2017-05-08 Harald Oehlmann
	MessageDlg.html: Documented the use of the native widget for
	"MessageDlg -type !user" and the limited set of recognized
	options. Ticket [8edade3cea] by Gerhard Reithofer

2016-10-31 Harald Oehlmann
	scrollframe.tcl: Eric advised to check for unmapped window,
	as the <Map> event may be executed in the unmapped state.

2016-10-31 Harald Oehlmann
	scrollframe.tcl: width changed when unmapped and mapped.
	Checkge the Configure vound proc to not be active when
	currently unmapped. Ticket [72a5727d1b]. Thanks to
	Alexandru for the ticket and patch.

2016-10-31 Harald Oehlmann
	button.tcl: Reverted last change, Eric underlined to
	not use ttk widgets as a base due to the option
	data base. Did traditional fix to exclude all options
	known by button and not known by ttk::button.
	Ticket [845613e5590ae7cf]

2016-08-23 Harald Oehlmann
	button.tcl: configure option of a ::Button gave error in
	themed mode. Ticket [845613e5590ae7cf]. Report by Adrian.

2016-07-21 Harald Oehlmann
	util.tcl: BWidget::place moved away from visible screens
	if the current window is on a virtual screen outside of
	the main screen (Windows multi-screen configuration).
	Ticket [5919a0ec2d]

2016-07-15 Adrian Madrano Calvo
	pckIndex.tcl: auto-load commands also from global namespace
	and not only from BWidget namespace. Ticket [c86207db01]

2016-03-22 Harald Oehlmann <[email protected]>
	Only support themed packages Tile 0.8 or Ttk.
	Repair the button spacing in themed font toolbar.
	Ticket [d7ea07c40a]

2016-03-15 Harald Oehlmann <[email protected]>
	mainframe.tcl: "Mainframe configure" caused error in themed
	mode. Ticket [52273c0a4e]

2016-03-08 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.10 tagged ****

2016-01-07 Adrian Medrano Calvo
	listbox.tcl: Listbox did not scroll to current item on
	startup. Ticket [ae238d5a7]

2016-01-07 Harald Oehlmann <[email protected]>
	lang/da.rc, lang/es.rc, lang/fr.rc, lang/no.rc:
	Translations non portable on utf-8 systems.
	File encoding changed to utf-8. Ticket [6c91e43d76]

2016-01-07 Harald Oehlmann <[email protected]>
	tree.tcl: Tree lines are black by default even if background
	is black. Ticket [ed4c1dab46]

2015-12-08 Harald Oehlmann <[email protected]>
	listbox.tcl: 8.4 compatibility was broken due to the use of
	min/max math functions. Ticket [0aef856302]

2015-11-04 Harald Oehlmann <[email protected]>
	dynhelp.tcl: Drop the assumption that all windows
	screen are the same size (of fix dated 2009-06-26)
	and use the virtual screen information to place the bubble
	help. Ticket [b64e03e548].

2015-10-18 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.9 tagged ****

2015-03-18 Harald Oehlmann <[email protected]>

	widget.tcl: Widget::define got new parameter -namespace,
	allowing megawidget namespace be different to
	class name. This allows lower case namespace names.
	Patch by Adrian Medrano Calvo. Ticket [023a631b20]

2014-09-10 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.8 tagged ****

2014-09-05 Harald Oehlmann <[email protected]>

	widget.tcl: Widget::which errors when option not present.
	Ticket [397db23424]

2014-05-21 Harald Oehlmann <[email protected]>

	widget.tcl: Don't invoke unqualified upvar in callers
	scope. Patch by Adrian Medrano Calvo. Ticket [046fa04231]

	widget.tcl: Don't double creation of temporary widget for
	default values retrieval. Use result of _get_tkwidget_options
	instead. By Adrian Medrano Calvo. Ticket [393b67ab19]

	widget.tcl: New procedure Widget::which (as in [namespace which]),
	that returns the fully qualified name for a widget option or
	widget variable. By Adrian Medrano Calvo. Ticket [a8705e5fd9]

	widget.tcl: Remove unneeded upvar. By Adrian Medrano Calvo.
	Ticket [43f93e0a97]

	widget.tcl et al: remove apparently unused procedure
	Widget::syncoptions and all calls. By Adrian Medrano Calvo.
	Ticket [3c2b8eafc6]


2013-12-13 Harald Oehlmann <[email protected]>

	scrollframe.tcl: Make -constrainedwidth 1 and
	-constrainedheight 1 work together.
	Patch by Simon Bachmann. Ticket [2fa44401d5]

	2013-10-17 Harald Oehlmann <[email protected]>
	widget.tcl: Remove temporary widget.
	By Wolfgang S. Kechel. Ticket [6cd041bcc1]

2013-10-15 Harald Oehlmann <[email protected]>
	combobox.tcl: Themed ComboBox color specifications
	are honored. By Wolfgang S. Kechel. Ticket [6c6704e40f]

2013-10-14 Harald Oehlmann <[email protected]>
	combobox.tcl: Fails in themed mode with "unknown
	option -bg". Patch solves this but listbox items
	are white on white when "-foreground" is specified.
	By Wolfgang S. Kechel. Ticket [6632134ce9]
	
	listbox.tcl: Update on option -deltay added.
	Set x0 to 2 to make highlight work and look nice for
	listbox with image.
	Take image into account to show selection.
	By Wolfgang S. Kechel. Ticket [ff1787af9c]

	scrollw.tcl: Raise scrolled window if it is below in
	the window hierarchy. By Wolfgang S. Kechel.
	Ticket [ff1787af9c]

2013-10-07 Harald Oehlmann <[email protected]>
	dynhelp.tcl: Sometimes the tooltip does not occur under
	gnome/metacity on ubuntu. By Wolfgang S. Kechel.
	Ticket [a588d2f800]

2013-09-15 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.7 tagged ****

2013-09-11 Harald Oehlmann <[email protected]>

	xpm2image.tcl: many issues fixed in xpm import
	by Mattias Hembruch. Ticket [9a8b2ee42e]
	
2013-08-14 Harald Oehlmann <[email protected]>

	* notebook.tcl: cured error in _resize, that
	data($p,width) is not (jet) present. Ticket [a4cbba655d].

2013-06-28 Harald Oehlmann <[email protected]>

	* mainframe.tcl: Included Patch [9f67a66609]
	curing issues of Shift-Accellerators with Shift-Lock
	on Mac. By Keith Nash, Ticket [83ce3e84e7].

2013-06-26 Harald Oehlmann <[email protected]>

	* mainframe.tcl: Reverted Patch [1977644]
	(-casesensitive for accellerators). It has
	issues with shift-lock.

2013-06-21 Harald Oehlmann <[email protected]>

	* labelentry.tcl: Bug fixed:
	Methods from Tk entry widget restored [Bug 1002844].
	
	* mainframe.tcl: Allow case sensitive accelerators
	by new option -casesensitive.
	Patch by cmard [Patch 1977644]
	
	* mainframe.tcl: Allow new modifiers Shift, Cmd and ShiftCmd
	for accelerators. Patch by K.J.Nash [Patch-83ce3e84e7]

	* mainframe.tcl: When changing MainFrame -background, do
	not change menu colors on Aqua.
	Fix by Keith J.Nash [Bug-a81b7afc1e]
	
	* init.tcl: Make loadable in save interpreter.
	Fix by Keith J.Nash [Bug-4365a23bd3]

	* combobox.tcl: Add method getentry to return entry
	widget path for bind purposes.
	Patch by Michael [Patch-2340355]
	
2013-01-09 Harald Oehlmann <[email protected]>

	* widget.tcl: Bug fixed:
	Error 'invalid command name ".#BWidget.#ttk::entry"'
	arises in themed mode when an Entry widget should get
	focus by the tab key.
	The temporary widget creation fails due to the "::" in
	the command name of ttk widgets.
	Any "::" is replaced by "__" [Bug 3599955].
	
2011-07-27 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.6 tagged ****

2012-04-12 Harald Oehlmann <[email protected]>

	* listbox.tcl ListBox::selection Only redraw if
	selection changed. Patch by Wolfgang S. Kechel [Bug 3517145]

2012-04-02 Harald Oehlmann <[email protected]>

	* entry.tcl, BWMan/entry.tcl checkbox.tcl Themed mode:
	Invoking "configure" without arguments results in errors
	that non-ttk options are not present.
	Removed Entry options: -background -foreground -relief
	-borderwidth -fg -bg -bd. Reported by Wolfgang S. Kechel
	[Bug 3513263]
	* entry.tcl mapped entry option -state to ttk::entry
	state in themed mode to make state change visible.

2012-03-06 Harald Oehlmann <[email protected]>

	* BWMan/ListBox.html documented options -selectfill and
	-autofocus as read-only. Reported by Wolfgang S. Kechel
	[Bug 3497592]

2011-11-14 Harald Oehlmann <[email protected]>

	* widget.tcl (Widget::focusOK) fixed list with update.
	Arises, if a ttk widget with a widget path with spaces
	is the next widget. Reported by jaspertheperson
	[Bug 3437761]

2011-06-24 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.5 tagged ****

2011-06-23 Harald Oehlmann <[email protected]>

	* listbox.tcl (listbox::generate_data) fixed last patch
	by ryotakatsuki [Bug 3324610]

2011-06-23 Harald Oehlmann <[email protected]>

	* listbox.tcl Fix of Bug 3000293 broke listbox tags.
	The bindImage subcommand did not report right tag.
	Patch by ryotakatsuki [Bug 3324610]

2011-06-23 Harald Oehlmann <[email protected]>

	* listbox.tcl, tree.tcl (_update_scrollregion) the linewise
	scrolling did not always scroll up to the end on windows 7.
	Report and patch by Wojciech Kocjan, review and modification
	by Koen Danckaert [Bug 3317772]

2011-05-25 Harald Oehlmann <[email protected]>

	*mainframe.tcl: Add a boolean readonly option -sizegrip
	to show a sizegrip widget in themed mode.

2011-05-24 Harald Oehlmann <[email protected]>

	*lang/pl.rc updated by Wojciech Kocjan.

2011-04-26 Harald Oehlmann <[email protected]>

	*notebook.tcl The user frame of the notebook is now a themed
	frame in themed mode. The set background color does not apply
	to the user frame in this case.

2011-04-26 Harald Oehlmann <[email protected]>

	label.tcl configuring foreground color caused error when
	themed [Bug 3292977]

2011-04-20 Harald Oehlmann <[email protected]>

	lang/hu.rc by Rezso updated

2011-04-20 Harald Oehlmann <[email protected]>

	* font.tcl, lang/*.rc: Add translation possibility
	for color picker button of font dialog.
	Used google translater to translate "Color" to all languages.
	Please check if this is correct. [Bug 3289573] reported by Rezso

2011-04-19 Harald Oehlmann <[email protected]>

	* lang/*.rc [Bug 3289573] : Add translation (templates) for the
	Color picker widget text "Base colors" and "User colors".
	Only german and english locals are provided so far.

2011-02-14 Harald Oehlmann <[email protected]>

	* combobox.tcl: [Bug 3182287] : ComboBox failes in themed mode
	due to the use of the themed entry widget. The following options
	are not supported (and thus called) any more: -relief
	-highlightbackground -highlightforeground

2011-02-14 Harald Oehlmann <[email protected]>

	* entry.tcl, labelentry.tcl, labelframe.tcl, mainframe.tcl,
	pagesmgr.tcl, scrollw.tcl: [Bug 3168761]:
	entry failes when themed support activated with:
	unknown option "-highlightthickness" (reported by George
	on clt 27 Jan., 16:55).
	The patch by Wojciech Kocjan fixes this and enhances
	labelentry, labelframe and pagesmgr to also use themed frames.
	Within scrollw.tcl, a bug for empty background handling is fixed.
	The scrollbar background is not set any more for not-themed widget.

2011-01-17 Harald Oehlmann <[email protected]>

	* pkgIndex.tcl: corrected package version in package provide

2010-12-14 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.4 tagged ****

2010-12-14  Andreas Kupries  <[email protected]>

	* tree.tcl [Bug 3106208]: Followup. Moved the fixed code of the
	last entry I did (2010-11-09) into a new command Tree::MergeFlag
	and call this from both Tree::itemconfigure and Tree::insert.
	Missing the place in Tree::insert caused another problem, found by
	Dustin Littau.

2010-11-05 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.3 tagged ****

2010-11-23 Harald Oehlmann <[email protected]>

	* scrollw.tcl Add theming support for ScrolledWindow widget.
	* ScrolledWindow.html Themed mode documented.

2010-11-21 Harald Oehlmann <[email protected]>

	* label.tcl Add theming support for Label widget.
	* label.html Themed mode documented.

2010-11-16 Harald Oehlmann <[email protected]>

	* button.tcl Add theming support for Button widget.
	Option "-relief link" is mapped to "Toolbutton style.
	Option -height is not available when themed.
	Thanks to Kevin Walzer for the test on MacOS.
	* buttonbox.tcl When themed, only set themed button options.
	The widget itself is not jet themed.
	* Dialog.html Removed documentation of unavailable option -buttonwidth.

2010-11-09  Andreas Kupries  <[email protected]>

	* tree.tcl (Tree::itemconfigure): Fix intermingling of node names
	and flag values which can cause an lsearch to fail, by mistaking a
	flag value as the node searched for, and then treating a node name
	as flags. As the upd,nodes value is a dictionary it should not be
	search as a list. Now using a temporary array for quicker check
	and append/replace [Bug 3106208].

2010-11-09 Harald Oehlmann <[email protected]>

	* mainframe.tcl Menu text shows white on white on Mac aqua
	[Bug 3105665] reported by Scott Smedley fixed by Kevin Walzer.

2010-10-15 Harald Oehlmann <[email protected]>

	* label.tcl The frame surround the label gets under
	unknown conditions a -padx 5. A pad of 0 is now
	hard coded (Bug 3087955)

2010-08-04 Harald Oehlmann <[email protected]>

	* dialog.tcl Changed behaviour of window close button.
	If -cancel is given, this button is invoked.
	The cancel option may now be changed using the configure
	method.

	* init.tcl If msgcat is available use its locale to load
	a lang/*.rc file instead always using en.rc.

2010-06-09 Harald Oehlmann <[email protected]>

	* Included lang/pl.rc from HEAD.

2010-06-07 Harald Oehlmann <[email protected]>

	**** BWidget 1.9.2 tagged ****
	Version 1.9.1 was skipped.
	This was released in ActiveTCL and thus may exist on many
	installations.

2010-05-31 Harald Oehlmann <[email protected]>

	* listbox.html Reflected patch 2010-05-12 in documentation.
	The selection may not be disabled any more by binding button 1.

2010-05-12 Harald Oehlmann <[email protected]>

	* listbox.tcl(ListBox::bindText and ListBox::bindImage)
	Method bindText and bindImage overwrote internal selection
	bindings [Bug 3000293] reported by Robert Karen.

2010-05-11 Harald Oehlmann <[email protected]>

	* listbox.tcl(ListBox::see) Method see shifts image out of
	view. Showed up, by a selection click on a long item with icon
	[Bug 2999764] reported by Robert Karen.

2010-05-05 Harald Oehlmann <[email protected]>

	* listbox.tcl(ListBox::_configureSelectmode) Drag modifies
	multiple selection [Bug 2995969] reported by Robert Karen.
	Bound events on ButtonRelease-1 instead Button-1 for multiple
	selections to avoid bug.
	* listbox.tcl(ListBox::_drag_and_drop) The default drag and drop
	routine only handled single drag and drop.
	It was extended to handle also drag and drop of multiple entries.

2009-09-03 Harald Oehlmann  <[email protected]>

	* util.tcl(BWidget::place), BWidget.html Widget placed incorrectly,
	when bigger than current screen [Bug 2850031] by Thomas Grausgruber
	Possible incompatibility: BWidget::place w h -> w,h are reduced to
	screen width.

2009-08-12 Harald Oehlmann  <[email protected]>

	* dynhelp.tcl Use balloon help font TkTooltipFont if tk <= 8.5.
	Otherwise use helvetica 11 on Aqua [Patch 2835180] for Kevin Walzer
	* dynhelp.tcl(DynamicHelp::_show_help)Replaced aqua conditional code
	check by $Widget::_aqua

2009-08-10 Harald Oehlmann  <[email protected]>

	* notebook.tcl (NoteBook::delete) Method delete destroyframe=1 and
	reinsertion -> raise failed - state variables were deleted.
	[Bug 2831785] by kjnash
	* tree.tcl (Tree::_keynav) Fire virtual event <<TreeSelect>> also on
	keyboard navigation [Patch 2828086] by Kevin Walzer
	* combobox.tcl Replaced aqua conditional code check by $Widget::_aqua

2009-08-10 Harald Oehlmann  <[email protected]>

	**** Branched to bwidget ****

	This is the bwidget branch of module bwidget of tcllib
	Use "-r bwidget" for all cvs operations
	Scope: Package BWidget compatible to tcl/tk 8.1 and tk
	(e.g. no tile/ttk).

2009-07-24 Harald Oehlmann  <[email protected]>

	**** BWidget 1.9.0 tagged ****

	* pkgIndex.tcl, README.txt: updated to BWidget 1.9

2009-07-23 Harald Oehlmann  <[email protected]>

Changes to README.txt.

1
2
3
4
5
6
7
8
BWidget ToolKit 1.9.0				July 2009
Copyright (c) 1998-1999 UNIFIX.
Copyright (c) 2001-2002 ActiveState Corp. 

See the file LICENSE.txt for license info (uses Tcl's BSD-style license).

--------------------------------------------------------------------------

|







1
2
3
4
5
6
7
8
BWidget ToolKit 1.9.15				December 2021
Copyright (c) 1998-1999 UNIFIX.
Copyright (c) 2001-2002 ActiveState Corp. 

See the file LICENSE.txt for license info (uses Tcl's BSD-style license).

--------------------------------------------------------------------------

Changes to button.tcl.

20
21
22
23
24
25
26






27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
64
65



66

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94












95
96
97
98
99
100
101
namespace eval Button {
    Widget::define Button button DynamicHelp

    set remove [list -command -relief -text -textvariable -underline -state]
    if {[info tclversion] > 8.3} {
	lappend remove -repeatdelay -repeatinterval
    }






    Widget::tkinclude Button button :cmd remove $remove

    Widget::declare Button {
        {-name            String "" 0}
        {-text            String "" 0}
        {-textvariable    String "" 0}
        {-underline       Int    -1 0 "%d >= -1"}
        {-armcommand      String "" 0}
        {-disarmcommand   String "" 0}
        {-command         String "" 0}
        {-state           TkResource "" 0 button}
        {-repeatdelay     Int    0  0 "%d >= 0"}
        {-repeatinterval  Int    0  0 "%d >= 0"}
        {-relief          Enum   raised  0 {raised sunken flat ridge solid groove link}}
    }

    DynamicHelp::include Button balloon

    Widget::syncoptions Button "" :cmd {-text {} -underline {}}

    variable _current ""
    variable _pressed ""

    bind BwButton <Enter>           {Button::_enter %W}
    bind BwButton <Leave>           {Button::_leave %W}
    bind BwButton <ButtonPress-1>   {Button::_press %W}
    bind BwButton <ButtonRelease-1> {Button::_release %W}
    bind BwButton <Key-space>       {Button::invoke %W; break}
    bind BwButton <Return>          {Button::invoke %W; break}

    bind BwButton <Destroy>         {Widget::destroy %W}
}


# ----------------------------------------------------------------------------
#  Command Button::create
# ----------------------------------------------------------------------------
proc Button::create { path args } {
    array set maps [list Button {} :cmd {}]
    array set maps [Widget::parseArgs Button $args]



    eval [concat [list button $path] $maps(:cmd)]

    Widget::initFromODB Button $path $maps(Button)

    # Do some extra configuration on the button
    set relief [Widget::getMegawidgetOption $path -relief]
    if { [string equal $relief "link"] } {
        set relief "flat"
    }
    set var [Widget::getMegawidgetOption $path -textvariable]
    set st [Widget::getMegawidgetOption $path -state]
    if {  ![string length $var] } {
        set desc [BWidget::getname [Widget::getMegawidgetOption $path -name]]
        if { [llength $desc] } {
            set text  [lindex $desc 0]
            set under [lindex $desc 1]
            Widget::configure $path [list -text $text]
            Widget::configure $path [list -underline $under]
        } else {
            set text  [Widget::getMegawidgetOption $path -text]
            set under [Widget::getMegawidgetOption $path -underline]
        }
    } else {
        set under -1
        set text  ""
        Widget::configure $path [list -underline $under]
    }

    $path configure -relief $relief -text $text -underline $under \
	    -textvariable $var -state $st












    bindtags $path [list $path BwButton [winfo toplevel $path] all]

    set accel1 [string tolower [string index $text $under]]
    set accel2 [string toupper $accel1]
    if { $accel1 != "" } {
        bind [winfo toplevel $path] <Alt-$accel1> [list Button::invoke $path]
        bind [winfo toplevel $path] <Alt-$accel2> [list Button::invoke $path]







>
>
>
>
>
>


















<
<









>










>
>
>
|
>



<
<
<
<



















|
|
>
>
>
>
>
>
>
>
>
>
>
>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50


51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78




79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
namespace eval Button {
    Widget::define Button button DynamicHelp

    set remove [list -command -relief -text -textvariable -underline -state]
    if {[info tclversion] > 8.3} {
	lappend remove -repeatdelay -repeatinterval
    }
    if {$::Widget::_theme} {
        lappend remove -activebackground -activeforeground -anchor -background\
                -bitmap -borderwidth -disabledforeground -font -foreground\
                -height -highlightbackground -highlightcolor -highlightthickness\
                -justify -overrelief -padx -pady -relief -wraplength
    }
    Widget::tkinclude Button button :cmd remove $remove

    Widget::declare Button {
        {-name            String "" 0}
        {-text            String "" 0}
        {-textvariable    String "" 0}
        {-underline       Int    -1 0 "%d >= -1"}
        {-armcommand      String "" 0}
        {-disarmcommand   String "" 0}
        {-command         String "" 0}
        {-state           TkResource "" 0 button}
        {-repeatdelay     Int    0  0 "%d >= 0"}
        {-repeatinterval  Int    0  0 "%d >= 0"}
        {-relief          Enum   raised  0 {raised sunken flat ridge solid groove link}}
    }

    DynamicHelp::include Button balloon



    variable _current ""
    variable _pressed ""

    bind BwButton <Enter>           {Button::_enter %W}
    bind BwButton <Leave>           {Button::_leave %W}
    bind BwButton <ButtonPress-1>   {Button::_press %W}
    bind BwButton <ButtonRelease-1> {Button::_release %W}
    bind BwButton <Key-space>       {Button::invoke %W; break}
    bind BwButton <Return>          {Button::invoke %W; break}
    bind BwButton <<Invoke>> 	    {Button::invoke %W; break}
    bind BwButton <Destroy>         {Widget::destroy %W}
}


# ----------------------------------------------------------------------------
#  Command Button::create
# ----------------------------------------------------------------------------
proc Button::create { path args } {
    array set maps [list Button {} :cmd {}]
    array set maps [Widget::parseArgs Button $args]
    if {$::Widget::_theme} {
        eval [concat [list ttk::button $path] $maps(:cmd)]
    } else {
        eval [concat [list button $path] $maps(:cmd)]
    }
    Widget::initFromODB Button $path $maps(Button)

    # Do some extra configuration on the button




    set var [Widget::getMegawidgetOption $path -textvariable]
    set st [Widget::getMegawidgetOption $path -state]
    if {  ![string length $var] } {
        set desc [BWidget::getname [Widget::getMegawidgetOption $path -name]]
        if { [llength $desc] } {
            set text  [lindex $desc 0]
            set under [lindex $desc 1]
            Widget::configure $path [list -text $text]
            Widget::configure $path [list -underline $under]
        } else {
            set text  [Widget::getMegawidgetOption $path -text]
            set under [Widget::getMegawidgetOption $path -underline]
        }
    } else {
        set under -1
        set text  ""
        Widget::configure $path [list -underline $under]
    }

    $path configure -text $text -underline $under \
        -textvariable $var -state $st
    # Map relief flat on Toolbutton for ttk
    set relief [Widget::getMegawidgetOption $path -relief]
    if {$::Widget::_theme} {
        if { [string equal $relief "link"] } {
            $path configure -style Toolbutton
        }
    } else {
        if { [string equal $relief "link"] } {
            set relief "flat"
        }
        $path configure -relief $relief
    }
    bindtags $path [list $path BwButton [winfo toplevel $path] all]

    set accel1 [string tolower [string index $text $under]]
    set accel2 [string toupper $accel1]
    if { $accel1 != "" } {
        bind [winfo toplevel $path] <Alt-$accel1> [list Button::invoke $path]
        bind [winfo toplevel $path] <Alt-$accel2> [list Button::invoke $path]
119
120
121
122
123
124
125
126
127
128
129

130






131
132
133
134
135
136
137
138

139

140
141
142
143
144
145
146
147
148
149
150
        set oldaccel1 ""
        set oldaccel2 ""
    }
    set res [Widget::configure $path $args]

    # Extract all the modified bits we're interested in
    foreach {cr cs cv cn ct cu} [Widget::hasChangedX $path \
	    -relief -state -textvariable -name -text -underline] break
    if { $cr || $cs } {
	set relief [Widget::cget $path -relief]
	set state  [Widget::cget $path -state]

        if { [string equal $relief "link"] } {






            if { [string equal $state "active"] } {
                set relief "raised"
            } else {
                set relief "flat"
            }
        }
        $path:cmd configure -relief $relief -state $state
    }



    if { $cv || $cn || $ct || $cu } {
	set var		[Widget::cget $path -textvariable]
	set text	[Widget::cget $path -text]
	set under	[Widget::cget $path -underline]
        if {  ![string length $var] } {
            set desc [BWidget::getname [Widget::cget $path -name]]
            if { [llength $desc] } {
                set text  [lindex $desc 0]
                set under [lindex $desc 1]
            }
        } else {







|

|
|
>
|
>
>
>
>
>
>
|
|
|
|
|
|
|
|
>
|
>

|
|
|







136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
        set oldaccel1 ""
        set oldaccel2 ""
    }
    set res [Widget::configure $path $args]

    # Extract all the modified bits we're interested in
    foreach {cr cs cv cn ct cu} [Widget::hasChangedX $path \
        -relief -state -textvariable -name -text -underline] break
    if { $cr || $cs } {
        set relief [Widget::cget $path -relief]
        set state  [Widget::cget $path -state]
        if { $::Widget::_theme} {
			if { [string equal $relief "link"] } {
				$path:cmd configure -style Toolbutton
			} else {
				$path:cmd configure -style ""
			}
		} else {
			if { [string equal $relief "link"] } {
				if { [string equal $state "active"] } {
					set relief "raised"
				} else {
					set relief "flat"
				}
			}
			$path:cmd configure -relief $relief
		}
		$path:cmd configure -state $state
    }

    if { $cv || $cn || $ct || $cu } {
        set var		[Widget::cget $path -textvariable]
        set text	[Widget::cget $path -text]
        set under	[Widget::cget $path -underline]
        if {  ![string length $var] } {
            set desc [BWidget::getname [Widget::cget $path -name]]
            if { [llength $desc] } {
                set text  [lindex $desc 0]
                set under [lindex $desc 1]
            }
        } else {
173
174
175
176
177
178
179
























180
181
182
183
184
185




186

187
188
189
190
191
192




193
194
195
196
197
198
199

200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221



222
223
224
225

226
227
228
229
230
231
232
233
234
235
236
237
238
239
240


241
242
243
244
245
246
247
248

249
250
251
252
253
254
255
256
257
258
259
260
261




262

263
264
265
266
267
268
269
270
# ----------------------------------------------------------------------------
#  Command Button::cget
# ----------------------------------------------------------------------------
proc Button::cget { path option } {
    Widget::cget $path $option
}


























# ----------------------------------------------------------------------------
#  Command Button::invoke
# ----------------------------------------------------------------------------
proc Button::invoke { path } {
    if { ![string equal [$path:cmd cget -state] "disabled"] } {




	$path:cmd configure -state active -relief sunken

	update idletasks
	set cmd [Widget::getMegawidgetOption $path -armcommand]
        if { $cmd != "" } {
            uplevel \#0 $cmd
        }
	after 100




        set relief [Widget::getMegawidgetOption $path -relief]
        if { [string equal $relief "link"] } {
            set relief flat
        }
	$path:cmd configure \
            -state  [Widget::getMegawidgetOption $path -state] \
            -relief $relief

	set cmd [Widget::getMegawidgetOption $path -disarmcommand]
        if { $cmd != "" } {
            uplevel \#0 $cmd
        }
	set cmd [Widget::getMegawidgetOption $path -command]
        if { $cmd != "" } {
            uplevel \#0 $cmd
        }
    }
}


# ----------------------------------------------------------------------------
#  Command Button::_enter
# ----------------------------------------------------------------------------
proc Button::_enter { path } {
    variable _current
    variable _pressed

    set _current $path
    if { ![string equal [$path:cmd cget -state] "disabled"] } {
        $path:cmd configure -state active



        if { $_pressed == $path } {
            $path:cmd configure -relief sunken
        } elseif { [string equal [Widget::cget $path -relief] "link"] } {
            $path:cmd configure -relief raised

        }
    }
}


# ----------------------------------------------------------------------------
#  Command Button::_leave
# ----------------------------------------------------------------------------
proc Button::_leave { path } {
    variable _current
    variable _pressed

    set _current ""
    if { ![string equal [$path:cmd cget -state] "disabled"] } {
        $path:cmd configure -state [Widget::cget $path -state]


        set relief [Widget::cget $path -relief]
        if { $_pressed == $path } {
            if { [string equal $relief "link"] } {
                set relief raised
            }
            $path:cmd configure -relief $relief
        } elseif { [string equal $relief "link"] } {
            $path:cmd configure -relief flat

        }
    }
}


# ----------------------------------------------------------------------------
#  Command Button::_press
# ----------------------------------------------------------------------------
proc Button::_press { path } {
    variable _pressed

    if { ![string equal [$path:cmd cget -state] "disabled"] } {
        set _pressed $path




	$path:cmd configure -relief sunken

	set cmd [Widget::getMegawidgetOption $path -armcommand]
        if { $cmd != "" } {
            uplevel \#0 $cmd
	    set repeatdelay [Widget::getMegawidgetOption $path -repeatdelay]
	    set repeatint [Widget::getMegawidgetOption $path -repeatinterval]
            if { $repeatdelay > 0 } {
                after $repeatdelay "Button::_repeat $path"
            } elseif { $repeatint > 0 } {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






>
>
>
>
|
>
|
|



|
>
>
>
>
|
|
|
|
|
<
<
>
|



|





<











>
>
>
|
|
|
|
>















>
>
|
|
|
|
|
|
|
|
>













>
>
>
>
|
>
|







199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256


257
258
259
260
261
262
263
264
265
266
267

268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# ----------------------------------------------------------------------------
#  Command Button::cget
# ----------------------------------------------------------------------------
proc Button::cget { path option } {
    Widget::cget $path $option
}


# ----------------------------------------------------------------------------
#  Command Button::identify
# ----------------------------------------------------------------------------
proc Button::identify { path args } {
    eval $path:cmd identify $args
}


# ----------------------------------------------------------------------------
#  Command Button::instate
# ----------------------------------------------------------------------------
proc Button::instate { path args } {
    eval $path:cmd instate $args
}


# ----------------------------------------------------------------------------
#  Command Button::state
# ----------------------------------------------------------------------------
proc Button::state { path args } {
    eval $path:cmd state $args
}


# ----------------------------------------------------------------------------
#  Command Button::invoke
# ----------------------------------------------------------------------------
proc Button::invoke { path } {
    if { ![string equal [$path:cmd cget -state] "disabled"] } {
        if { $::Widget::_theme} {
            $path:cmd configure -state active
			$path:cmd state pressed
        } else {
            $path:cmd configure -state active -relief sunken
        }
        update idletasks
        set cmd [Widget::getMegawidgetOption $path -armcommand]
        if { $cmd != "" } {
            uplevel \#0 $cmd
        }
        after 100
        $path:cmd configure -state [Widget::getMegawidgetOption $path -state]
        if { $::Widget::_theme} {
            $path:cmd state !pressed
        } else {
            set relief [Widget::getMegawidgetOption $path -relief]
            if { [string equal $relief "link"] } {
                set relief flat
            }
            $path:cmd configure -relief $relief


        }
        set cmd [Widget::getMegawidgetOption $path -disarmcommand]
        if { $cmd != "" } {
            uplevel \#0 $cmd
        }
        set cmd [Widget::getMegawidgetOption $path -command]
        if { $cmd != "" } {
            uplevel \#0 $cmd
        }
    }
}


# ----------------------------------------------------------------------------
#  Command Button::_enter
# ----------------------------------------------------------------------------
proc Button::_enter { path } {
    variable _current
    variable _pressed

    set _current $path
    if { ![string equal [$path:cmd cget -state] "disabled"] } {
        $path:cmd configure -state active
        if { $::Widget::_theme } {
            # $path:cmd state active
        } else {
            if { $_pressed == $path } {
                $path:cmd configure -relief sunken
            } elseif { [string equal [Widget::cget $path -relief] "link"] } {
                $path:cmd configure -relief raised
            }
        }
    }
}


# ----------------------------------------------------------------------------
#  Command Button::_leave
# ----------------------------------------------------------------------------
proc Button::_leave { path } {
    variable _current
    variable _pressed

    set _current ""
    if { ![string equal [$path:cmd cget -state] "disabled"] } {
        $path:cmd configure -state [Widget::cget $path -state]
        if { $::Widget::_theme } {
        } else {
            set relief [Widget::cget $path -relief]
            if { $_pressed == $path } {
                if { [string equal $relief "link"] } {
                    set relief raised
                }
                $path:cmd configure -relief $relief
            } elseif { [string equal $relief "link"] } {
                $path:cmd configure -relief flat
            }
        }
    }
}


# ----------------------------------------------------------------------------
#  Command Button::_press
# ----------------------------------------------------------------------------
proc Button::_press { path } {
    variable _pressed

    if { ![string equal [$path:cmd cget -state] "disabled"] } {
        set _pressed $path
        if { $::Widget::_theme} {
            ttk::clickToFocus $path
            $path state pressed
        } else {
            $path:cmd configure -relief sunken
        }
        set cmd [Widget::getMegawidgetOption $path -armcommand]
        if { $cmd != "" } {
            uplevel \#0 $cmd
	    set repeatdelay [Widget::getMegawidgetOption $path -repeatdelay]
	    set repeatint [Widget::getMegawidgetOption $path -repeatinterval]
            if { $repeatdelay > 0 } {
                after $repeatdelay "Button::_repeat $path"
            } elseif { $repeatint > 0 } {
280
281
282
283
284
285
286
287
288




289
290
291
292

293
294
295
296
297
298
299
# ----------------------------------------------------------------------------
proc Button::_release { path } {
    variable _current
    variable _pressed

    if { $_pressed == $path } {
        set _pressed ""
        set relief [Widget::getMegawidgetOption $path -relief]
	after cancel "Button::_repeat $path"




        if { [string equal $relief "link"] } {
            set relief raised
        }
        $path:cmd configure -relief $relief

	set cmd [Widget::getMegawidgetOption $path -disarmcommand]
        if { $cmd != "" } {
            uplevel \#0 $cmd
        }
        if { $_current == $path &&
             ![string equal [$path:cmd cget -state] "disabled"] && \
	     [set cmd [Widget::getMegawidgetOption $path -command]] != "" } {







<

>
>
>
>
|
|
|
|
>







349
350
351
352
353
354
355

356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# ----------------------------------------------------------------------------
proc Button::_release { path } {
    variable _current
    variable _pressed

    if { $_pressed == $path } {
        set _pressed ""

	after cancel "Button::_repeat $path"
        if { $::Widget::_theme} {
            $path state !pressed
        } else {
            set relief [Widget::getMegawidgetOption $path -relief]
            if { [string equal $relief "link"] } {
                set relief raised
            }
            $path:cmd configure -relief $relief
        }
	set cmd [Widget::getMegawidgetOption $path -disarmcommand]
        if { $cmd != "" } {
            uplevel \#0 $cmd
        }
        if { $_current == $path &&
             ![string equal [$path:cmd cget -state] "disabled"] && \
	     [set cmd [Widget::getMegawidgetOption $path -command]] != "" } {

Changes to buttonbox.tcl.

141
142
143
144
145
146
147




148
149
150
151
152

153
154
155
156
157
158
159
    set tags ""
    if { [info exists flags(-tags)] } {
	set tags $flags(-tags)
	unset flags(-tags)
	set args [array get flags]
    }





    eval [list Button::create $but \
	      -background [Widget::getoption $path -background]\
	      -padx       [Widget::getoption $path -padx] \
	      -pady       [Widget::getoption $path -pady]] \
        $args [list -default $style]


    # [email protected]:  set up tags, just like the menu items
    foreach tag $tags {
	lappend data(tags,$tag) $but
	if { ![info exists data(tagstate,$tag)] } {
	    set data(tagstate,$tag) 0
	}







>
>
>
>
|
|
|
|
|
>







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
    set tags ""
    if { [info exists flags(-tags)] } {
	set tags $flags(-tags)
	unset flags(-tags)
	set args [array get flags]
    }

    if { $::Widget::_theme} {
        eval [list Button::create $but] \
            $args [list -default $style]
	} else {
        eval [list Button::create $but \
    	      -background [Widget::getoption $path -background]\
	          -padx       [Widget::getoption $path -padx] \
	          -pady       [Widget::getoption $path -pady]] \
            $args [list -default $style]
	}

    # [email protected]:  set up tags, just like the menu items
    foreach tag $tags {
	lappend data(tags,$tag) $but
	if { ![info exists data(tagstate,$tag)] } {
	    set data(tagstate,$tag) 0
	}

Changes to color.tcl.

1
2
3
4
5

6

7
8
9

10
11
12
13
14
15
16
namespace eval SelectColor {
    Widget::define SelectColor color Dialog

    Widget::declare SelectColor {
        {-title     String     "Select a color" 0}

        {-parent    String     ""               0}

        {-color     TkResource ""               0 {label -background}}
	{-type      Enum       "dialog"         1 {dialog popup}}
	{-placement String     "center"         1}

    }

    variable _baseColors {
        \#0000ff \#00ff00 \#00ffff \#ff0000 \#ff00ff \#ffff00
        \#000099 \#009900 \#009999 \#990000 \#990099 \#999900
        \#000000 \#333333 \#666666 \#999999 \#cccccc \#ffffff
    }




|
>
|
>
|
|
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
namespace eval SelectColor {
    Widget::define SelectColor color Dialog

    Widget::declare SelectColor {
        {-title      String     "Select a color" 0}
        {-parent     String     ""               0}
        {-command    String     ""               0}
        {-help       Boolean    0                1}
        {-color      TkResource ""               0 {label -background}}
	{-type       Enum       "dialog"         1 {dialog popup}}
	{-placement  String     "center"         1}
        {-background TkResource ""               0 {label -background}}
    }

    variable _baseColors {
        \#0000ff \#00ff00 \#00ffff \#ff0000 \#ff00ff \#ffff00
        \#000099 \#009900 \#009999 \#990000 \#990099 \#999900
        \#000000 \#333333 \#666666 \#999999 \#cccccc \#ffffff
    }
27
28
29
30
31
32
33








34
35
36
37
38
39
40
    }

    variable _selectype
    variable _selection
    variable _wcolor
    variable _image
    variable _hsv








}

proc SelectColor::create { path args } {
    Widget::init SelectColor $path $args

    set type [Widget::cget $path -type]








>
>
>
>
>
>
>
>







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
    }

    variable _selectype
    variable _selection
    variable _wcolor
    variable _image
    variable _hsv

    variable _command
    variable _unsavedSelection
    variable _oldColor
    variable _entryColor
    variable _bgColor
    variable _fgColor
    variable _rounds
}

proc SelectColor::create { path args } {
    Widget::init SelectColor $path $args

    set type [Widget::cget $path -type]

66
67
68
69
70
71
72



73
74
75
76
77
78
79
80




81
82
83
84
85
86
87

proc SelectColor::menu {path placement args} {
    variable _baseColors
    variable _userColors
    variable _wcolor
    variable _selectype
    variable _selection




    Widget::init SelectColor $path $args
    set top [toplevel $path]
    set parent [winfo toplevel [winfo parent $top]]
    wm withdraw  $top
    wm transient $top $parent
    wm overrideredirect $top 1
    catch { wm attributes $top -topmost 1 }





    set frame [frame $top.frame \
                   -highlightthickness 0 \
                   -relief raised -borderwidth 2]
    set col    0
    set row    0
    set count  0







>
>
>








>
>
>
>







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

proc SelectColor::menu {path placement args} {
    variable _baseColors
    variable _userColors
    variable _wcolor
    variable _selectype
    variable _selection
    variable _command
    variable _bgColor
    variable _rounds

    Widget::init SelectColor $path $args
    set top [toplevel $path]
    set parent [winfo toplevel [winfo parent $top]]
    wm withdraw  $top
    wm transient $top $parent
    wm overrideredirect $top 1
    catch { wm attributes $top -topmost 1 }

    set _command  [Widget::cget $path -command]
    set _bgColor  [Widget::cget $path -background]
    set _rounds   {}

    set frame [frame $top.frame \
                   -highlightthickness 0 \
                   -relief raised -borderwidth 2]
    set col    0
    set row    0
    set count  0
111
112
113
114
115
116
117








118
119
120
121
122
123
124
    bind $f <Enter> {focus %W}
    pack $frame

    bind $top <1>      {set SelectColor::_selection -1}
    bind $top <Escape> {set SelectColor::_selection -2}
    bind $top <FocusOut> [subst {if {"%W" == "$top"} \
				     {set SelectColor::_selection -2}}]








    eval [list BWidget::place $top 0 0] $placement

    wm deiconify $top
    raise $top
    if {$::tcl_platform(platform) == "unix"} {
	tkwait visibility $top
	update







>
>
>
>
>
>
>
>







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
    bind $f <Enter> {focus %W}
    pack $frame

    bind $top <1>      {set SelectColor::_selection -1}
    bind $top <Escape> {set SelectColor::_selection -2}
    bind $top <FocusOut> [subst {if {"%W" == "$top"} \
				     {set SelectColor::_selection -2}}]

    # set background color for menu
    $f     configure -bg $_bgColor
    $frame configure -bg $_bgColor
    foreach w [winfo children $frame] {
        $w configure -highlightcolor $_bgColor -highlightbackground $_bgColor
    }

    eval [list BWidget::place $top 0 0] $placement

    wm deiconify $top
    raise $top
    if {$::tcl_platform(platform) == "unix"} {
	tkwait visibility $top
	update
141
142
143
144
145
146
147

148
149
150

151
152




153




154












155
156
157
158
159
160
161
162
163
164








165
166
167
168
169
170
171
172
173
174
175
176











177
178
179
180
181
182
183
		if {![info exists opts($key)]} {
		    set native 0
		    break
		}
		lappend nativecmd $opts($key) $val
	    }
	    if {$native} {

		return [eval $nativecmd]
	    }
	}

	return [eval [list dialog $path] $args]
    } else {




        return [lindex $colors $_selection]




    }












}


proc SelectColor::dialog {path args} {
    variable _baseColors
    variable _userColors
    variable _widget
    variable _selection
    variable _image
    variable _hsv









    Widget::init SelectColor $path:SelectColor $args
    set top   [Dialog::create $path \
                   -title  [Widget::cget $path:SelectColor -title]  \
                   -parent [Widget::cget $path:SelectColor -parent] \
                   -separator 1 -default 0 -cancel 1 -anchor e]
    wm resizable $top 0 0
    set dlgf  [$top getframe]
    set fg    [frame $dlgf.fg]
    set desc  [list \
                   base _baseColors "Base colors" \
                   user _userColors "User colors"]











    set count 0
    foreach {type varcol defTitle} $desc {
        set col   0
        set lin   0
        set title [lindex [BWidget::getname "${type}Colors"] 0]
        if {![string length $title]} {
            set title $defTitle







>



>


>
>
>
>
|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>










>
>
>
>
>
>
>
>





|






>
>
>
>
>
>
>
>
>
>
>







167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
		if {![info exists opts($key)]} {
		    set native 0
		    break
		}
		lappend nativecmd $opts($key) $val
	    }
	    if {$native} {
		# Call native dialog
		return [eval $nativecmd]
	    }
	}
	# Call BWidget dialog
	return [eval [list dialog $path] $args]
    } else {
	# The user has either selected one of the palette colors, or has
	# cancelled.  The full BWidget/native dialog was not called.
	# Unless the user has cancelled, pass the selected
	# color to _userCommand.
	set tmpCol [lindex $colors $_selection]
	if {[string equal $tmpCol ""]} {
	    # User has cancelled - no need to call _userCommand.
	} else {
	    _userCommand $tmpCol
	}
	return $tmpCol
    }
}


proc SelectColor::_userCommand {color} {
    variable _command
    if {[string equal $_command {}]} {
        return
    }
    uplevel #0 $_command [list $color]
    return
}


proc SelectColor::dialog {path args} {
    variable _baseColors
    variable _userColors
    variable _widget
    variable _selection
    variable _image
    variable _hsv
    variable _command
    variable _unsavedSelection
    variable _oldColor
    variable _entryColor
    variable _bgColor
    variable _fgColor
    variable _rounds


    Widget::init SelectColor $path:SelectColor $args
    set top   [Dialog::create $path \
                   -title  [Widget::cget $path:SelectColor -title]  \
                   -parent [Widget::cget $path:SelectColor -parent] \
                   -separator 0 -default 0 -cancel 1 -anchor e]
    wm resizable $top 0 0
    set dlgf  [$top getframe]
    set fg    [frame $dlgf.fg]
    set desc  [list \
                   base _baseColors "Base colors" \
                   user _userColors "User colors"]

    set help    [Widget::cget $path:SelectColor -help]
    set _command [Widget::cget $path:SelectColor -command]
    set _bgColor [Widget::cget $path:SelectColor -background]
    set _rounds  {}
    set mouseHelpText ""
    if {$help} {
        append mouseHelpText [subst -nocommands -novariables\
                [lindex [BWidget::getname mouseHelpText] 0]]
    }

    set count 0
    foreach {type varcol defTitle} $desc {
        set col   0
        set lin   0
        set title [lindex [BWidget::getname "${type}Colors"] 0]
        if {![string length $title]} {
            set title $defTitle
193
194
195
196
197
198
199



200
201
202
203
204



205
206
207
208
209
210
211
212
213










































214
215
216
217
218
219
220
221
222
223



224

225
226
227
228
229
230
231
232
233
234
235
236
237
238

239
240
241
242
243
244
245
                            -relief flat -borderwidth 0 \
                            -background $color]
            pack $fcolor -in $fround
            grid $fround -in $subf -row $lin -column $col -padx 1 -pady 1

            bind $fround <ButtonPress-1> [list SelectColor::_select_rgb $count]
            bind $fcolor <ButtonPress-1> [list SelectColor::_select_rgb $count]




	    bind $fround <Double-1> \
	    	"SelectColor::_select_rgb [list $count]; [list $top] invoke 0"
	    bind $fcolor <Double-1> \
	    	"SelectColor::_select_rgb [list $count]; [list $top] invoke 0"




            incr count
            if {[incr col] == 6} {
                incr lin
                set  col 0
            }
        }
        pack $titf -anchor w -pady 2
    }










































    set fround [frame $fg.round \
                    -highlightthickness 0 \
                    -relief sunken -borderwidth 2]
    set fcolor [frame $fg.color \
                    -width 50 \
                    -highlightthickness 0 \
                    -relief flat -borderwidth 0]
    pack $fcolor -in $fround -fill y -expand yes
    pack $fround -anchor e -pady 2 -fill y -expand yes




    set fd  [frame $dlgf.fd]

    set f1  [frame $fd.f1 -relief sunken -borderwidth 2]
    set f2  [frame $fd.f2 -relief sunken -borderwidth 2]
    set c1  [canvas $f1.c -width 200 -height 200 -bd 0 -highlightthickness 0]
    set c2  [canvas $f2.c -width 15  -height 200 -bd 0 -highlightthickness 0]

    for {set val 0} {$val < 40} {incr val} {
        $c2 create rectangle 0 [expr {5*$val}] 15 [expr {5*$val+5}] -tags val[expr {39-$val}]
    }
    $c2 create polygon 0 0 10 5 0 10 -fill black -outline white -tags target

    pack $c1 $c2
    pack $f1 $f2 -side left -padx 10 -anchor n

    pack $fg $fd -side left -anchor n -fill y


    bind $c1 <ButtonPress-1> [list SelectColor::_select_hue_sat %x %y]
    bind $c1 <B1-Motion>     [list SelectColor::_select_hue_sat %x %y]

    bind $c2 <ButtonPress-1> [list SelectColor::_select_value %x %y]
    bind $c2 <B1-Motion>     [list SelectColor::_select_value %x %y]








>
>
>





>
>
>









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








|

>
>
>
|
>













|
>







260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
                            -relief flat -borderwidth 0 \
                            -background $color]
            pack $fcolor -in $fround
            grid $fround -in $subf -row $lin -column $col -padx 1 -pady 1

            bind $fround <ButtonPress-1> [list SelectColor::_select_rgb $count]
            bind $fcolor <ButtonPress-1> [list SelectColor::_select_rgb $count]
            
            DynamicHelp::add $fround -text $mouseHelpText
            DynamicHelp::add $fcolor -text $mouseHelpText

	    bind $fround <Double-1> \
	    	"SelectColor::_select_rgb [list $count]; [list $top] invoke 0"
	    bind $fcolor <Double-1> \
	    	"SelectColor::_select_rgb [list $count]; [list $top] invoke 0"

	    # Record list of $fround values in _rounds
	    lappend _rounds $fround

            incr count
            if {[incr col] == 6} {
                incr lin
                set  col 0
            }
        }
        pack $titf -anchor w -pady 2
    }

    # Record these colors for later use
    set _fgColor [$fg.round0 cget -highlightcolor]

    # Add a TitleFrame $titf to wrap $fg.round and $fg.value
    set name [lindex [BWidget::getname yourSelection] 0]
    set titf [TitleFrame $fg.choice -text $name]
    set subf [$titf getframe]
    pack $titf -anchor w -pady 2 -expand yes -fill both

    # Add an entry widget $fg.value for the #RRGGBB value
    if {$::tk_version > 8.4} {
	set fixedFont TkFixedFont
    } else {
	set fixedFont Courier
    }
    set subf2 $fg.vround
    frame $subf2 -highlightthickness 0 -relief sunken -borderwidth 2
    entry $fg.value -width 8 -relief sunken -bd 0 -highlightthickness 0 \
            -bg white -textvariable ::SelectColor::_entryColor -font $fixedFont
    pack  $subf2    -in $subf  -anchor w -side left
    pack  $fg.value -in $subf2 -anchor w -side left
    
    if {$help} {
        DynamicHelp::add $fg.value -text [subst -nocommands -novariables\
                    [lindex [BWidget::getname keyboardHelpText] 0]]
    }

    # Remove focus from the entry widget by clicking anywhere...
    bind $top <1> [list ::SelectColor::_CheckFocus %W]

    # ... or by pressing Return/Escape.
    bind $fg.value <Return> [list ::SelectColor::_CheckFocus .]
    bind $fg.value <Escape> [list ::SelectColor::_CheckFocus .]
    bind $fg.value <Return> {+break}
    bind $fg.value <Escape> {+break}
    # Break so that the bindings to these events on the toplevel are not
    # executed.

    # MODS - record the Tk window path for the entry widget.
    set _widget(en) $fg.value

    set fround [frame $fg.round \
                    -highlightthickness 0 \
                    -relief sunken -borderwidth 2]
    set fcolor [frame $fg.color \
                    -width 50 \
                    -highlightthickness 0 \
                    -relief flat -borderwidth 0]
    pack $fcolor -in $fround -fill y -expand yes
    pack $fround -in $subf -side right -anchor e -pady 2 -fill y -expand yes

    # Add a TitleFrame $dlgf.fd to wrap the canvas selectors.  The
    # labels are referenced by the DynamicHelp tooltip.
    set name [lindex [BWidget::getname colorSelectors] 0]
    set fd0 [TitleFrame $dlgf.fd -text $name]
    set fd  [$fd0 getframe]
    set f1  [frame $fd.f1 -relief sunken -borderwidth 2]
    set f2  [frame $fd.f2 -relief sunken -borderwidth 2]
    set c1  [canvas $f1.c -width 200 -height 200 -bd 0 -highlightthickness 0]
    set c2  [canvas $f2.c -width 15  -height 200 -bd 0 -highlightthickness 0]

    for {set val 0} {$val < 40} {incr val} {
        $c2 create rectangle 0 [expr {5*$val}] 15 [expr {5*$val+5}] -tags val[expr {39-$val}]
    }
    $c2 create polygon 0 0 10 5 0 10 -fill black -outline white -tags target

    pack $c1 $c2
    pack $f1 $f2 -side left -padx 10 -anchor n

    pack $fg $fd0 -side left -anchor n -fill y
    pack configure $fd0 -pady 2 -padx {4 0}

    bind $c1 <ButtonPress-1> [list SelectColor::_select_hue_sat %x %y]
    bind $c1 <B1-Motion>     [list SelectColor::_select_hue_sat %x %y]

    bind $c2 <ButtonPress-1> [list SelectColor::_select_value %x %y]
    bind $c2 <B1-Motion>     [list SelectColor::_select_value %x %y]

265
266
267
268
269
270
271































272

273



274
275
276
277



278
279



280
281
282
283















284
285
286
287
288
289
290
291
292
293
294



295
296



297
298
299

300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318





319
320
321
322
323
324
325
326
327

328
329
330





331
332
333
334
335
336
337
    set _widget(cv)     $c2
    set rgb             [winfo rgb $path [Widget::cget $path:SelectColor -color]]
    set _hsv            [eval rgbToHsv $rgb]
    _set_rgb     [eval [list format "\#%04x%04x%04x"] $rgb]
    _set_hue_sat [lindex $_hsv 0] [lindex $_hsv 1]
    _set_value   [lindex $_hsv 2]
































    $top add -name ok

    $top add -name cancel



    set res [$top draw]
    if {$res == 0} {
        set color [$fg.color cget -background]
    } else {



        set color ""
    }



    destroy $top
    return $color
}
















proc SelectColor::setcolor { idx color } {
    variable _userColors
    set _userColors [lreplace $_userColors $idx $idx $color]
}

proc SelectColor::_select_rgb {count} {
    variable _baseColors
    variable _userColors
    variable _selection
    variable _widget
    variable _hsv




    set frame $_widget(fcolor)



    if {$_selection >= 0} {
        $frame.round$_selection configure \
            -relief sunken -highlightthickness 1 -borderwidth 2

    }
    $frame.round$count configure \
        -relief flat -highlightthickness 2 -borderwidth 1
    focus $frame.round$count
    set _selection $count
    set bg   [$frame.color$count cget -background]
    set user [expr {$_selection-[llength $_baseColors]}]
    if {$user >= 0 &&
        [string equal \
              [winfo rgb $frame.color$_selection $bg] \
              [winfo rgb $frame.color$_selection white]]} {
        set bg [$frame.color cget -bg]
        $frame.color$_selection configure -background $bg
        set _userColors [lreplace $_userColors $user $user $bg]
    } else {
        set _hsv [eval rgbToHsv [winfo rgb $frame.color$count $bg]]
        _set_hue_sat [lindex $_hsv 0] [lindex $_hsv 1]
        _set_value   [lindex $_hsv 2]
        $frame.color configure -background $bg





    }
}


proc SelectColor::_set_rgb {rgb} {
    variable _selection
    variable _baseColors
    variable _userColors
    variable _widget


    set frame $_widget(fcolor)
    $frame.color configure -background $rgb





    set user [expr {$_selection-[llength $_baseColors]}]
    if {$user >= 0} {
        $frame.color$_selection configure -background $rgb
        set _userColors [lreplace $_userColors $user $user $rgb]
    }
}








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
>
>
>




>
>
>


>
>
>




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>











>
>
>


>
>
>


|
>


|
|















>
>
>
>
>









>



>
>
>
>
>







385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
    set _widget(cv)     $c2
    set rgb             [winfo rgb $path [Widget::cget $path:SelectColor -color]]
    set _hsv            [eval rgbToHsv $rgb]
    _set_rgb     [eval [list format "\#%04x%04x%04x"] $rgb]
    _set_hue_sat [lindex $_hsv 0] [lindex $_hsv 1]
    _set_value   [lindex $_hsv 2]

    # Initialize _oldColor which is used to reset the color supplied to
    # _userCommand if the user cancels.
    set _oldColor [set _unsavedSelection]
    set tmp24     [::SelectColor::_24BitRgb $_oldColor]
    if {[_ValidateColorEntry forced $tmp24]} {
        set ::SelectColor::_entryColor $tmp24
    } else {
        # Value $tmp24 does not pass entry widget validation and if used
        # would disable validation.  Use this default instead.
        set _entryColor #
    }

    # Validate input to the entry field.
    # To avoid conflict with the entry -variable (_entryColor), do not set the
    # latter directly (because a failed validation will switch off subsequent
    # validations).  Either call _SetEntryValue, or set _unsavedSelection which
    # triggers the trace.

    $fg.value configure -validate all -validatecommand \
            [list SelectColor::_ValidateColorEntry %V %P]

    # Trace _unsavedSelection
    # Subsequent modifications to _unsavedSelection will update the entry
    # widget, if the value is valid.
    # From now on, this is the only way that:
    # (1) ::SelectColor::_SetEntryValue is called
    # (2) ::SelectColor::_entryColor is modified (except by the user typing in
    #     the entry widget)

    trace add variable ::SelectColor::_unsavedSelection write ::SelectColor::_SetEntryValue

    $top add -text [lindex [BWidget::getname ok] 0]
    $top add -text [lindex [BWidget::getname cancel] 0]

    # Override background color
    ReColor $path $_bgColor

    set res [$top draw]
    if {$res == 0} {
        set color [$fg.color cget -background]
    } else {
        # User has cancelled - call _userCommand to undo any changes made
        # in the caller.
        _userCommand $_oldColor
        set color ""
    }

    trace remove variable ::SelectColor::_unsavedSelection write ::SelectColor::_SetEntryValue

    destroy $top
    return $color
}


# ----------------------------------------------------------------------------
# Command SelectColor::setbasecolor
# ----------------------------------------------------------------------------
# Exported command, to allow the caller to set the base colors of the palette.

proc SelectColor::setbasecolor { idx color } {
    variable _baseColors
    set _baseColors [lreplace $_baseColors $idx $idx $color]
}

# ----------------------------------------------------------------------------
# Command SelectColor::setcolor
# ----------------------------------------------------------------------------

proc SelectColor::setcolor { idx color } {
    variable _userColors
    set _userColors [lreplace $_userColors $idx $idx $color]
}

proc SelectColor::_select_rgb {count} {
    variable _baseColors
    variable _userColors
    variable _selection
    variable _widget
    variable _hsv
    variable _unsavedSelection
    variable _bgColor
    variable _fgColor

    set frame $_widget(fcolor)

    # Use highlight color instead of focus to identify the selected
    # palette color. Tab traversal of focus now works correctly.
    if {$_selection >= 0} {
        $frame.round$_selection configure \
            -relief sunken -highlightthickness 1 -borderwidth 2 \
            -highlightbackground $_bgColor
    }
    $frame.round$count configure \
        -relief flat -highlightthickness 2 -borderwidth 1 \
        -highlightbackground $_fgColor
    set _selection $count
    set bg   [$frame.color$count cget -background]
    set user [expr {$_selection-[llength $_baseColors]}]
    if {$user >= 0 &&
        [string equal \
              [winfo rgb $frame.color$_selection $bg] \
              [winfo rgb $frame.color$_selection white]]} {
        set bg [$frame.color cget -bg]
        $frame.color$_selection configure -background $bg
        set _userColors [lreplace $_userColors $user $user $bg]
    } else {
        set _hsv [eval rgbToHsv [winfo rgb $frame.color$count $bg]]
        _set_hue_sat [lindex $_hsv 0] [lindex $_hsv 1]
        _set_value   [lindex $_hsv 2]
        $frame.color configure -background $bg

        # Display selected color in entry widget (via trace on
        # ::SelectColor::_unsavedSelection), and notify caller.
        set ::SelectColor::_unsavedSelection $bg
        _userCommand $bg
    }
}


proc SelectColor::_set_rgb {rgb} {
    variable _selection
    variable _baseColors
    variable _userColors
    variable _widget
    variable _unsavedSelection

    set frame $_widget(fcolor)
    $frame.color configure -background $rgb

    # Display selected color in entry widget (via trace on
    # ::SelectColor::_unsavedSelection), and notify caller.
    set ::SelectColor::_unsavedSelection $rgb
    _userCommand $rgb
    set user [expr {$_selection-[llength $_baseColors]}]
    if {$user >= 0} {
        $frame.color$_selection configure -background $rgb
        set _userColors [lreplace $_userColors $user $user $rgb]
    }
}

487
488
489
490
491
492
493







































































































































































































































	if {$hue < 0.0} {
	    set hue [expr {$hue + 1.0}]
	}
    }
    return [list $hue $sat [expr {$max/65535}]]
}















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
	if {$hue < 0.0} {
	    set hue [expr {$hue + 1.0}]
	}
    }
    return [list $hue $sat [expr {$max/65535}]]
}

# ------------------------------------------------------------------------------
#  Command SelectColor::ReColor
# ------------------------------------------------------------------------------
# Command to change the background color for the dialog.
#
# FIXME Ideally this would be called by "$w configure -background $value".
# Currently a "configure -background" command is passed to Dialog and Widget
# but does not change SelectColor.
# HaO: it might also be possible that this is controled by the option data base.
# ------------------------------------------------------------------------------

proc SelectColor::ReColor {path newColor} {
    variable _bgColor
    variable _rounds

    set _bgColor $newColor

    $path configure -bg $_bgColor

    # Use the internal names of the dialog widget - it would be nicer to
    # use a colored dialog widget.
    foreach child {
        fd      fd.f.f1  fd.f.f2
        fg      fg.base  fg.choice
        fg.user fg.round fg.vround
    } {
        $path.frame.$child configure -background $_bgColor
    }

    # Special treatment for Aqua native buttons.
    # FIXME implement a general fix for BWidget Button/ButtonBox/Dialog
    if {[string equal [tk windowingsystem] "aqua"]} {
        $path.bbox.b0 configure -highlightbackground $_bgColor \
                -highlightthickness 0
        $path.bbox.b1 configure -highlightbackground $_bgColor \
                -highlightthickness 0
    } else {
        $path.bbox.b0 configure -bg $_bgColor -activebackground $_bgColor \
                -highlightbackground $_bgColor
        $path.bbox.b1 configure -bg $_bgColor -activebackground $_bgColor \
                -highlightbackground $_bgColor
    }

    foreach fround $_rounds {
        $fround configure -highlightbackground $_bgColor -bg $_bgColor
    }
    
    return
}


# ------------------------------------------------------------------------------
# Command SelectColor::_24BitRgb
# ------------------------------------------------------------------------------
# Command to convert a hex 12n-bit RGB color to 24-bit, n > 0.
# Convert anything else to {}.
# Used to process the display in the entry widget.
# ------------------------------------------------------------------------------

proc SelectColor::_24BitRgb {col} {
    set  lenny [string length $col]
    incr lenny -1

    if {    ($lenny % 3)
         || ($lenny == 0)
         || (![regexp {^#[a-fA-F0-9]*$} $col])
    } {
        # Not a multiple of 3, or not leading #, or nothing after #,
        # or non-HEX digits.
        return {}
    } elseif {$lenny == 3} {
        # 12-bit, pad to 24-bit
        set val $col
        set val [string replace $val 3 3 "[string index $val 3]0"]
        set val [string replace $val 2 2 "[string index $val 2]0"]
        set val [string replace $val 1 1 "[string index $val 1]0"]
        return $val
    } elseif {$lenny == 6} {
        # 24-bit, return unchanged
        return $col
    } else {
        # Truncate to 24-bit
        set delta  [expr {$lenny / 3}]
        set delta2 [expr {$delta * 2}]
        set deltaP1  [incr delta]
        set deltaP2  [incr delta]
        set delta2P1 [incr delta2]
        set delta2P2 [incr delta2]
        set result #
        append result [string range $col 1 2]
        append result [string range $col $deltaP1  $deltaP2]
        append result [string range $col $delta2P1 $delta2P2]
        return $result
    }
}


# ------------------------------------------------------------------------------
# Command SelectColor::_SetEntryValue
# ------------------------------------------------------------------------------
# Command to update the (hexadecimal color displayed in the) entry widget
# when there is a change in the color currently selected in the GUI, which is
# stored in _unsavedSelection.
#
# This command is called by a write trace on _unsavedSelection; if the
# value of this variable is a valid color (i.e. "#" followed by 3N hex digits),
# this command converts the value to 24 bits and sets ::SelectColor::_entryColor
# to the result, thereby displaying it in the entry widget.  Therefore,
# when the user chooses a color by means other than the entry widget, this
# command updates the entry widget.
#
# This command does not update the GUI when the user changes the value in the
# entry widget: that is done instead by the -vcmd of the entry widget, which
# is SelectColor::_ValidateColorEntry.  When the user chooses a color by typing
# in the entry widget, the command _ValidateColorEntry copies the value to
# _unsavedSelection if a keystroke in the widget makes its contents 3N hex
# digits long.
# ------------------------------------------------------------------------------

proc SelectColor::_SetEntryValue {argVarName var2 op} {
    variable _entryColor
    variable _unsavedSelection

    if {[string equal $argVarName ::SelectColor::_unsavedSelection] &&
            [string equal $var2 {}] && [string equal $op "write"]} {
        # OK
    } else {
        # Unexpected call
        return -code error "Unexpected trace of variable\
                \"$argVarName\", \"$var2\", \"$op\""
    }

    set col24bit [::SelectColor::_24BitRgb [set $argVarName]]

    if {[_ValidateColorEntry forced $col24bit]} {
        set ::SelectColor::_entryColor $col24bit
    } else {
        # Value is invalid, and if written to _entryColor this would disable
        # validation.
    }

    return
}


# ------------------------------------------------------------------------------
# Command SelectColor::_CheckFocus
# ------------------------------------------------------------------------------
# This command is called with argument %W as a binding to <1> on the toplevel.
# It is also called with argument {.}, by bindings on the entry widget to
# <Escape>, <Return>.
#
# The command does something only if the entry widget has focus, and the
# argument (the clicked window) is the Tk window path of somewhere else.  Then,
# the command removes focus from the entry widget to the default button.
# ------------------------------------------------------------------------------

proc SelectColor::_CheckFocus {w} {
    variable _widget

    if {    (! [string equal $w $_widget(en)]) &&
            ([string equal [focus]  $_widget(en)])} {
        set top [winfo toplevel $_widget(en)]
        $top setfocus default
    }

    return
}


# ------------------------------------------------------------------------------
# Command SelectColor::_ValidateColorEntry
# ------------------------------------------------------------------------------
# This command is the "-validate all -vcmd" of the entry widget.
# It is also called by SelectColor::dialog and SelectColor::_SetEntryValue to
# check values assigned to _entryColor.
#
# When the user chooses a color by typing in the entry widget, this command
# copies the value to _unsavedSelection if a keystroke in the widget makes its
# contents 3N hex digits long.
# ------------------------------------------------------------------------------

proc SelectColor::_ValidateColorEntry {percentV percentP} {
    variable _unsavedSelection

    set result [regexp -- {^#[0-9a-fA-F]*$} $percentP]
    set lenny  [string length $percentP]

    if {$result} {
        if {[string equal $percentV "forced"]} {
            # Validation only.  Don't want a loop.
        } elseif {[string equal $percentV "key"]} {
            # Copy to GUI if a valid color.
            if {($lenny - 1) % 3 || $lenny == 1} {
                # Not a valid color, which needs 3n+1 characters, n > 0
            } else {
                after idle [list SelectColor::_SetWithoutTrace $percentP]
            }
        } elseif {[string equal $percentV "focusout"]} {
            # If the color is valid it will already have been copied to the GUI
            # and to _userCommand by the "key" validation above.
            #
            # The code below only needs to reset the value in the entry widget.
            # Remove an invalid value, convert a valid one to 24-bit.
            # Ignore $percentP, just fire the trace on _unsavedSelection.
            set color $_unsavedSelection
            after idle [list set ::SelectColor::_unsavedSelection $color]
        }
    }

    return $result
}


# ------------------------------------------------------------------------------
# Command SelectColor::_SetWithoutTrace
# ------------------------------------------------------------------------------
# This command sets _unsavedSelection (using _set_rgb) without firing the trace
# that copies the value to _entryColor.
# The command is called by SelectColor::_ValidateColorEntry to avoid a loop.
# ------------------------------------------------------------------------------

proc SelectColor::_SetWithoutTrace {value} {
    trace remove variable ::SelectColor::_unsavedSelection write ::SelectColor::_SetEntryValue
    _set_rgb $value
    set _hsv [eval rgbToHsv [winfo rgb . $value]]
    _set_hue_sat [lindex $_hsv 0] [lindex $_hsv 1]
    _set_value   [lindex $_hsv 2]
    trace add variable ::SelectColor::_unsavedSelection write ::SelectColor::_SetEntryValue
    return
}

Changes to combobox.tcl.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29



30
31
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

49




50
51
52
53
54
55
56
57
58
59
60
61
# ----------------------------------------------------------------------------
#  combobox.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: combobox.tcl,v 1.42 2009/07/07 17:28:14 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - ComboBox::create
#     - ComboBox::configure
#     - ComboBox::cget
#     - ComboBox::setvalue
#     - ComboBox::getvalue
#     - ComboBox::clearvalue

#     - ComboBox::_create_popup
#     - ComboBox::_mapliste
#     - ComboBox::_unmapliste
#     - ComboBox::_select
#     - ComboBox::_modify_value
# ----------------------------------------------------------------------------

# ComboBox uses the 8.3 -listvariable listbox option
package require Tk 8.3

namespace eval ComboBox {
    Widget::define ComboBox combobox ArrowButton Entry ListBox

    Widget::tkinclude ComboBox frame :cmd \
	include {-relief -borderwidth -bd -background} \
	initialize {-relief sunken -borderwidth 2}




    Widget::bwinclude ComboBox Entry .e \
	remove {-relief -bd -borderwidth -bg} \
	rename {-background -entrybg}


    Widget::declare ComboBox {
	{-height       TkResource 0    0 listbox}
	{-values       String	  ""   0}
	{-images       String	  ""   0}
	{-indents      String	  ""   0}
	{-modifycmd    String	  ""   0}
	{-postcommand  String	  ""   0}
	{-expand       Enum	  none 0 {none tab}}
	{-autocomplete Boolean	  0    0}
        {-autopost     Boolean    0    0}
        {-bwlistbox    Boolean    0    0}
        {-listboxwidth Int        0    0}
        {-hottrack     Boolean    0    0}
    }


    Widget::addmap ComboBox ArrowButton .a {




	-background {} -foreground {} -disabledforeground {} -state {}
    }

    Widget::syncoptions ComboBox Entry .e {-text {}}

    ::bind BwComboBox <FocusIn> [list after idle {BWidget::refocus %W %W.e}]
    ::bind BwComboBox <Destroy> [list ComboBox::_destroy %W]

    ::bind ListBoxHotTrack <Motion> {
        %W selection clear 0 end
        %W activate @%x,%y
        %W selection set @%x,%y



|








>

















>
>
>
|
|
|
>
















>
|
>
>
>
>
|
|
|
<








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

63
64
65
66
67
68
69
70
# ----------------------------------------------------------------------------
#  combobox.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: combobox.tcl,v 1.42.2.3 2012/04/02 09:53:41 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - ComboBox::create
#     - ComboBox::configure
#     - ComboBox::cget
#     - ComboBox::setvalue
#     - ComboBox::getvalue
#     - ComboBox::clearvalue
#     - ComboBox::getentry
#     - ComboBox::_create_popup
#     - ComboBox::_mapliste
#     - ComboBox::_unmapliste
#     - ComboBox::_select
#     - ComboBox::_modify_value
# ----------------------------------------------------------------------------

# ComboBox uses the 8.3 -listvariable listbox option
package require Tk 8.3

namespace eval ComboBox {
    Widget::define ComboBox combobox ArrowButton Entry ListBox

    Widget::tkinclude ComboBox frame :cmd \
	include {-relief -borderwidth -bd -background} \
	initialize {-relief sunken -borderwidth 2}

    if {[Widget::theme]} {
	Widget::bwinclude ComboBox Entry .e
    } else {
	Widget::bwinclude ComboBox Entry .e \
	    remove {-relief -bd -borderwidth -bg} \
	    rename {-background -entrybg}
    }

    Widget::declare ComboBox {
	{-height       TkResource 0    0 listbox}
	{-values       String	  ""   0}
	{-images       String	  ""   0}
	{-indents      String	  ""   0}
	{-modifycmd    String	  ""   0}
	{-postcommand  String	  ""   0}
	{-expand       Enum	  none 0 {none tab}}
	{-autocomplete Boolean	  0    0}
        {-autopost     Boolean    0    0}
        {-bwlistbox    Boolean    0    0}
        {-listboxwidth Int        0    0}
        {-hottrack     Boolean    0    0}
    }

    if {[Widget::theme]} {
	Widget::addmap ComboBox ArrowButton .a {
	    -background {} -state {}
	}
    } else {
	Widget::addmap ComboBox ArrowButton .a {
	    -background {} -foreground {} -disabledforeground {} -state {}
	}
    }


    ::bind BwComboBox <FocusIn> [list after idle {BWidget::refocus %W %W.e}]
    ::bind BwComboBox <Destroy> [list ComboBox::_destroy %W]

    ::bind ListBoxHotTrack <Motion> {
        %W selection clear 0 end
        %W activate @%x,%y
        %W selection set @%x,%y
82
83
84
85
86
87
88

89



90

91
92
93
94
95
96
97

    eval [list frame $path] $maps(:cmd) \
	[list -highlightthickness 0 -takefocus 0 -class ComboBox]
    Widget::initFromODB ComboBox $path $maps(ComboBox)

    bindtags $path [list $path BwComboBox [winfo toplevel $path] all]


    set entry [eval [list Entry::create $path.e] $maps(.e) \



		   [list -relief flat -borderwidth 0 -takefocus 1]]


    ::bind $path.e <FocusOut>      [list $path _focus_out]
    ::bind $path   <<TraverseIn>>  [list $path _traverse_in]

    if {[Widget::cget $path -autocomplete]} {
	::bind $path.e <KeyRelease> [list $path _auto_complete %K]
    }







>
|
>
>
>
|
>







91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

    eval [list frame $path] $maps(:cmd) \
	[list -highlightthickness 0 -takefocus 0 -class ComboBox]
    Widget::initFromODB ComboBox $path $maps(ComboBox)

    bindtags $path [list $path BwComboBox [winfo toplevel $path] all]

    if {[Widget::theme]} {
        set entry [eval [list Entry::create $path.e] $maps(.e) \
            [list -takefocus 1]]
    } else {
        set entry [eval [list Entry::create $path.e] $maps(.e) \
            [list -relief flat -borderwidth 0 -takefocus 1]]
    }

    ::bind $path.e <FocusOut>      [list $path _focus_out]
    ::bind $path   <<TraverseIn>>  [list $path _traverse_in]

    if {[Widget::cget $path -autocomplete]} {
	::bind $path.e <KeyRelease> [list $path _auto_complete %K]
    }
280
281
282
283
284
285
286

287
288

289
290

291
292
293
294
295
296
297
    }

    # if the dropdown listbox is shown, simply force the actual entry
    #  colors into it. If it is not shown, the next time the dropdown
    #  is shown it'll get the actual colors anyway
    if {[winfo exists $path.shell.listb]} {
	$path.shell.listb configure \

		-bg [Widget::cget $path -entrybg] \
		-fg [Widget::cget $path -foreground] \

		-selectbackground [Widget::cget $path -selectbackground] \
		-selectforeground [Widget::cget $path -selectforeground]

    }

    return $res
}


# ----------------------------------------------------------------------------







>
|
|
>


>







294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
    }

    # if the dropdown listbox is shown, simply force the actual entry
    #  colors into it. If it is not shown, the next time the dropdown
    #  is shown it'll get the actual colors anyway
    if {[winfo exists $path.shell.listb]} {
	$path.shell.listb configure \
	    -bg [_getbg $path] \
	    -fg [_getfg $path]
	if {![Widget::theme]} {
	    $path.shell.listb configure \
		-selectbackground [Widget::cget $path -selectbackground] \
		-selectforeground [Widget::cget $path -selectforeground]
	}
    }

    return $res
}


# ----------------------------------------------------------------------------
431
432
433
434
435
436
437






























438
439
440
441
442
443
444
# ----------------------------------------------------------------------------
#  Command ComboBox::clearvalue
# ----------------------------------------------------------------------------
proc ComboBox::clearvalue { path } {
    Entry::configure $path.e -text ""
}































# ----------------------------------------------------------------------------
#  Command ComboBox::_create_popup
# ----------------------------------------------------------------------------
proc ComboBox::_create_popup { path } {
    set shell $path.shell

    if {[winfo exists $shell]} { return }







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
# ----------------------------------------------------------------------------
#  Command ComboBox::clearvalue
# ----------------------------------------------------------------------------
proc ComboBox::clearvalue { path } {
    Entry::configure $path.e -text ""
}

# ----------------------------------------------------------------------------
#  Command ComboBox::getentry
# ----------------------------------------------------------------------------
proc ComboBox::getentry { path } {
    return $path.e
}

proc ComboBox::_getfg {path} {
    # First try to retrieve option
    set fg [Widget::cget $path -foreground];
    if { 0 == [string length $fg] && [Widget::theme] } {
	# fall back to style settings when not configured for widget
	return [::ttk::style lookup TEntry -foreground];
    }
    return $fg;
}
proc ComboBox::_getbg {path} {
    if {[Widget::theme]} {
	# First try to retrieve option
	set bg [Widget::cget $path -background];
	if {0 == [string length $bg]} {
	    # fall back to style settings when not configured for widget
	    return [::ttk::style lookup TEntry -backround];
	}
    } else {
	# fetch the entrybg resource value
	set bg [Widget::cget $path -entrybg]
    }
    return $bg;
}
# ----------------------------------------------------------------------------
#  Command ComboBox::_create_popup
# ----------------------------------------------------------------------------
proc ComboBox::_create_popup { path } {
    set shell $path.shell

    if {[winfo exists $shell]} { return }
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479

480
481
482
483
484





485


486
487

488
489
490
491
492
493
494
495
496
497
498
499
500

501
502
503
504
505


506




507



508
509
510

511
512
513
514
515
516
517
	set sbwidth 15
    }

    toplevel            $shell -relief solid -bd 1
    wm withdraw         $shell
    wm overrideredirect $shell 1
    # these commands cause the combobox to behave strangely on OS X
    if {![string equal [tk windowingsystem] "aqua"]} {
        update idle
        wm transient    $shell [winfo toplevel $path]
        catch { wm attributes $shell -topmost 1 }
    }

    set sw [ScrolledWindow $shell.sw -managed 1 -size $sbwidth -ipad 0]

    if {$bw} {

        set listb  [ListBox $shell.listb \
                -relief flat -borderwidth 0 -highlightthickness 0 \
                -selectmode single -selectfill 1 -autofocus 0 -height $h \
                -font [Widget::cget $path -font]  \
                -bg [Widget::cget $path -entrybg] \





                -fg [Widget::cget $path -foreground] \


                -selectbackground [Widget::cget $path -selectbackground] \
                -selectforeground [Widget::cget $path -selectforeground]]


        set values [Widget::cget $path -values]
        set images [Widget::cget $path -images]
        foreach value $values image $images {
            $listb insert end #auto -text $value -image $image
        }
	$listb bindText  <1> [list ComboBox::_select $path]
	$listb bindImage <1> [list ComboBox::_select $path]
        if {[Widget::cget $path -hottrack]} {
            $listb bindText  <Enter> [list $listb selection set]
            $listb bindImage <Enter> [list $listb selection set]
        }
    } else {

        set listb  [listbox $shell.listb \
                -relief flat -borderwidth 0 -highlightthickness 0 \
                -exportselection false \
                -font	[Widget::cget $path -font]  \
                -height $h \


                -bg [Widget::cget $path -entrybg] \




                -fg [Widget::cget $path -foreground] \



                -selectbackground [Widget::cget $path -selectbackground] \
                -selectforeground [Widget::cget $path -selectforeground] \
                -listvariable [Widget::varForOption $path -values]]

        ::bind $listb <ButtonRelease-1> [list ComboBox::_select $path @%x,%y]

        if {[Widget::cget $path -hottrack]} {
            bindtags $listb [concat [bindtags $listb] ListBoxHotTrack]
        }
    }
    pack $sw -fill both -expand yes







|








>
|
|
|
|
|
>
>
>
>
>
|
>
>
|
|
>













>
|
|
|
|
|
>
>
|
>
>
>
>
|
>
>
>
|
|
|
>







511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
	set sbwidth 15
    }

    toplevel            $shell -relief solid -bd 1
    wm withdraw         $shell
    wm overrideredirect $shell 1
    # these commands cause the combobox to behave strangely on OS X
    if {! $Widget::_aqua } {
        update idle
        wm transient    $shell [winfo toplevel $path]
        catch { wm attributes $shell -topmost 1 }
    }

    set sw [ScrolledWindow $shell.sw -managed 1 -size $sbwidth -ipad 0]

    if {$bw} {
        if {[Widget::theme]} {
            set listb  [ListBox $shell.listb \
                    -relief flat -borderwidth 0 -highlightthickness 0 \
                    -selectmode single -selectfill 1 -autofocus 0 -height $h \
                    -font [Widget::cget $path -font] \
                    -bg [_getbg $path] \
                    -fg [_getfg $path]]
        } else {
            set listb  [ListBox $shell.listb \
                    -relief flat -borderwidth 0 -highlightthickness 0 \
                    -selectmode single -selectfill 1 -autofocus 0 -height $h \
                    -font [Widget::cget $path -font]  \
                    -bg [_getbg $path] \
                    -fg [_getfg $path] \
                    -selectbackground [Widget::cget $path -selectbackground] \
                    -selectforeground [Widget::cget $path -selectforeground]]
        }

        set values [Widget::cget $path -values]
        set images [Widget::cget $path -images]
        foreach value $values image $images {
            $listb insert end #auto -text $value -image $image
        }
	$listb bindText  <1> [list ComboBox::_select $path]
	$listb bindImage <1> [list ComboBox::_select $path]
        if {[Widget::cget $path -hottrack]} {
            $listb bindText  <Enter> [list $listb selection set]
            $listb bindImage <Enter> [list $listb selection set]
        }
    } else {
        if {[Widget::theme]} {
            set listb  [listbox $shell.listb \
                    -relief flat -borderwidth 0 -highlightthickness 0 \
                    -exportselection false \
                    -font	[Widget::cget $path -font]  \
                    -height $h \
                    -bg [_getbg $path] \
                    -fg [_getfg $path] \
                    -listvariable [Widget::varForOption $path -values]]
        } else {
            set listb  [listbox $shell.listb \
                    -relief flat -borderwidth 0 -highlightthickness 0 \
                    -exportselection false \
                    -font	[Widget::cget $path -font]  \
                    -height $h \
                    -bg [_getbg $path] \
                    -fg [_getfg $path] \
                    -selectbackground [Widget::cget $path -selectbackground] \
                    -selectforeground [Widget::cget $path -selectforeground] \
                    -listvariable [Widget::varForOption $path -values]]
        }
        ::bind $listb <ButtonRelease-1> [list ComboBox::_select $path @%x,%y]

        if {[Widget::cget $path -hottrack]} {
            bindtags $listb [concat [bindtags $listb] ListBoxHotTrack]
        }
    }
    pack $sw -fill both -expand yes
562
563
564
565
566
567
568
569
570


571
572

573
574
575
576
577
578
579

    set listb $shell.listb
    destroy $shell.sw
    set sw [ScrolledWindow $shell.sw -managed 1 -size $sbwidth -ipad 0]
    $listb configure \
            -height $h \
            -font   [Widget::cget $path -font] \
            -bg     [Widget::cget $path -entrybg] \
            -fg     [Widget::cget $path -foreground] \


            -selectbackground [Widget::cget $path -selectbackground] \
            -selectforeground [Widget::cget $path -selectforeground]

    pack $sw -fill both -expand yes
    $sw setwidget $listb
    raise $listb
}


# ----------------------------------------------------------------------------







|
|
>
>
|
|
>







629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649

    set listb $shell.listb
    destroy $shell.sw
    set sw [ScrolledWindow $shell.sw -managed 1 -size $sbwidth -ipad 0]
    $listb configure \
            -height $h \
            -font   [Widget::cget $path -font] \
            -bg     [_getbg $path] \
            -fg     [_getfg $path]
    if {![Widget::theme]} {
        $listb configure \
                -selectbackground [Widget::cget $path -selectbackground] \
                -selectforeground [Widget::cget $path -selectforeground]
    }
    pack $sw -fill both -expand yes
    $sw setwidget $listb
    raise $listb
}


# ----------------------------------------------------------------------------
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657

    set width [Widget::cget $path -listboxwidth]
    if {!$width} { set width [winfo width $path] }
    BWidget::place $path.shell $width 0 below $path
    wm deiconify $path.shell
    raise $path.shell
    BWidget::focus set $listb
    if { ! [string equal [tk windowingsystem] "aqua"] } {
        BWidget::grab global $path
    }
}


# ----------------------------------------------------------------------------
#  Command ComboBox::_unmapliste
# ----------------------------------------------------------------------------
proc ComboBox::_unmapliste { path {refocus 1} } {
    # On aqua, state is zoomed, otherwise normal
    if {[winfo exists $path.shell] && \
      ( [string equal [wm state $path.shell] "normal"] ||
	[string equal [wm state $path.shell] "zoomed"] ) } {
        if {![string equal [tk windowingsystem] "aqua"]} {
            BWidget::grab release $path
            BWidget::focus release $path.shell.listb $refocus
            # Update now because otherwise [focus -force...] makes the app hang!
            if {$refocus} {
                update
                focus -force $path.e
            }







|













|







699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727

    set width [Widget::cget $path -listboxwidth]
    if {!$width} { set width [winfo width $path] }
    BWidget::place $path.shell $width 0 below $path
    wm deiconify $path.shell
    raise $path.shell
    BWidget::focus set $listb
    if {! $Widget::_aqua } {
        BWidget::grab global $path
    }
}


# ----------------------------------------------------------------------------
#  Command ComboBox::_unmapliste
# ----------------------------------------------------------------------------
proc ComboBox::_unmapliste { path {refocus 1} } {
    # On aqua, state is zoomed, otherwise normal
    if {[winfo exists $path.shell] && \
      ( [string equal [wm state $path.shell] "normal"] ||
	[string equal [wm state $path.shell] "zoomed"] ) } {
        if {! $Widget::_aqua } {
            BWidget::grab release $path
            BWidget::focus release $path.shell.listb $refocus
            # Update now because otherwise [focus -force...] makes the app hang!
            if {$refocus} {
                update
                focus -force $path.e
            }

Changes to demo/demo.tcl.

23
24
25
26
27
28
29















30
31
32
33
34
35
36
    foreach script {
	manager.tcl basic.tcl select.tcl dnd.tcl tree.tcl tmpldlg.tcl
    } {
	namespace inscope :: source $DEMODIR/$script
    }
}

















proc Demo::create { } {
    global   tk_patchLevel
    variable _wfont
    variable notebook
    variable mainframe
    variable font







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
    foreach script {
	manager.tcl basic.tcl select.tcl dnd.tcl tree.tcl tmpldlg.tcl
    } {
	namespace inscope :: source $DEMODIR/$script
    }
}

image create photo bwidget16 -data {
    R0lGODlhEAAQAOMJABat6IGYffaBCUSku/KCDcCMPomXdgCy//+AANnZ2dnZ2dnZ2dnZ2dnZ2dnZ
    2dnZ2SH5BAEKAA8ALAAAAAAQABAAAAQ58MlJq70U6a0x/9c2iRb5mNmHjmpXuiecIpRA0JWJDEfw
    HIffoWU4AIBBYKuABAoxSGEQ6oxins8IADs=
}

image create photo faded16 -data {
    R0lGODlhEAAQAKEDAAAAAICAgKCgoP///yH5BAEKAAMALAAAAAAQABAAAAIjnI+py+1vQEABsDoH
    blUI+XyAAImk033Zsmng8hoVRNd2XQAAOw==
}

image create photo stop16 -data {
    R0lGODlhEAAQAMIFAAAAAC8DA3gKCpYMDPAUFP///////////yH5BAEKAAcALAAAAAAQABAAAAMm
    SLrc/jDKqYBgAsB8CY/ZMFjTGAzUEACoFI7d83nkUysZpe/8ngAAOw==
}

proc Demo::create { } {
    global   tk_patchLevel
    variable _wfont
    variable notebook
    variable mainframe
    variable font
129
130
131
132
133
134
135








136
137
138
139
140
141
142
143
144
145
146

























147
148
149
150
151
152
153
    set f3b [DemoDlg::create $notebook]
    set prgtext   "Creating Drag and Drop..."
    incr prgindic
    set f4 [DemoDnd::create $notebook]
    set prgtext   "Creating Tree..."
    incr prgindic
    set f5 [DemoTree::create $notebook]









    set prgtext   "Done"
    incr prgindic
    $notebook compute_size
    pack $notebook -fill both -expand yes -padx 4 -pady 4
    $notebook raise [$notebook page 0]

    pack $mainframe -fill both -expand yes
    update idletasks
    destroy .intro
}



























proc Demo::update_font { newfont } {
    variable _wfont
    variable notebook
    variable font
    variable font_name







>
>
>
>
>
>
>
>











>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
    set f3b [DemoDlg::create $notebook]
    set prgtext   "Creating Drag and Drop..."
    incr prgindic
    set f4 [DemoDnd::create $notebook]
    set prgtext   "Creating Tree..."
    incr prgindic
    set f5 [DemoTree::create $notebook]

    foreach page [$notebook pages] {
        $notebook itemconfigure $page \
                -image        bwidget16 \
                -rimage       faded16 \
                -ractiveimage stop16  \
                -rimagecmd    {::Demo::_close_tab}
    }

    set prgtext   "Done"
    incr prgindic
    $notebook compute_size
    pack $notebook -fill both -expand yes -padx 4 -pady 4
    $notebook raise [$notebook page 0]

    pack $mainframe -fill both -expand yes
    update idletasks
    destroy .intro
}

proc Demo::_close_tab { tabSet tabName } {
    after idle [list $tabSet delete $tabName]

    set tabIndex [$tabSet index $tabName]
    set tabList  [$tabSet pages]
    set tabTot   [llength $tabList]

    # Pick another tab to raise.
    if {$tabTot == 1} {
        # No other tabs.
        exit
    } elseif {$tabIndex < $tabTot - 1} {
        # Raise the tab to the right.
        set raiseTabName [lindex $tabList [expr {$tabIndex + 1}]]
    } else {
        # This tab is furthest to the right. Raise the tab to the left.
        set raiseTabName [lindex $tabList [expr {$tabIndex - 1}]]
    }

    $tabSet raise $raiseTabName
    $tabSet see   $raiseTabName
    return
}



proc Demo::update_font { newfont } {
    variable _wfont
    variable notebook
    variable font
    variable font_name
194
195
196
197
198
199
200












201
202
203
204
205
206
207
208
209
210
211
212
    variable DEMODIR

    lappend ::auto_path [file dirname $DEMODIR]
    package require BWidget

    option add *TitleFrame.l.font {helvetica 11 bold italic}













    wm withdraw .
    wm title . "BWidget demo"

    Demo::create
    BWidget::place . 0 0 center
    wm deiconify .
    raise .
    focus -force .
}

Demo::main
wm geom . [wm geom .]







>
>
>
>
>
>
>
>
>
>
>
>












242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
    variable DEMODIR

    lappend ::auto_path [file dirname $DEMODIR]
    package require BWidget

    option add *TitleFrame.l.font {helvetica 11 bold italic}

    if {$::tk_version < 8.5} {
        set helpFont {helvetica 12}
    } else {
        set helpFont {TkDefaultFont 10}
    }

    DynamicHelp::configure      \
            -background #FFFFC0 \
            -foreground #141312 \
            -padx       3       \
            -font       $helpFont

    wm withdraw .
    wm title . "BWidget demo"

    Demo::create
    BWidget::place . 0 0 center
    wm deiconify .
    raise .
    focus -force .
}

Demo::main
wm geom . [wm geom .]

Changes to demo/tmpldlg.tcl.

138
139
140
141
142
143
144
145

146
147
148
149
150
151
152
                   -command DemoDlg::_show_passdlg]

    pack $but0 $but1 $but2 $but3 -side left -padx 5 -anchor w
}

proc DemoDlg::_show_color {w} {
    set color [SelectColor::menu $w.color [list below $w] \
                       -color [$w cget -background]]

    if {[string length $color]} {
        $w configure -background $color
    }
}

proc DemoDlg::_show_tmpldlg { } {
    variable tmpl







|
>







138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
                   -command DemoDlg::_show_passdlg]

    pack $but0 $but1 $but2 $but3 -side left -padx 5 -anchor w
}

proc DemoDlg::_show_color {w} {
    set color [SelectColor::menu $w.color [list below $w] \
                       -color   [$w cget -background]     \
                       -command [list $w configure -background]]
    if {[string length $color]} {
        $w configure -background $color
    }
}

proc DemoDlg::_show_tmpldlg { } {
    variable tmpl

Changes to dialog.tcl.

1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  dialog.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: dialog.tcl,v 1.15 2004/09/24 23:56:59 hobbs Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - Dialog::create
#     - Dialog::configure
#     - Dialog::cget
#     - Dialog::getframe
#     - Dialog::add



|







1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  dialog.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: dialog.tcl,v 1.15.2.1 2010/08/04 13:07:59 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - Dialog::create
#     - Dialog::configure
#     - Dialog::cget
#     - Dialog::getframe
#     - Dialog::add
114
115
116
117
118
119
120

121



122




123
124
125
126
127
128
129
    }
    if { [Widget::getoption $path -separator] } {
	Separator::create $path.sep -orient $orient -background $bg
    }
    set _widget($path,realized) 0
    set _widget($path,nbut)     0


    bind $path <Escape>  [list ButtonBox::invoke $path.bbox [Widget::getoption $path -cancel]]



    bind $path <Return>  [list ButtonBox::invoke $path.bbox default]





    return [Widget::create Dialog $path]
}


# ----------------------------------------------------------------------------
#  Command Dialog::configure







>
|
>
>
>

>
>
>
>







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
    }
    if { [Widget::getoption $path -separator] } {
	Separator::create $path.sep -orient $orient -background $bg
    }
    set _widget($path,realized) 0
    set _widget($path,nbut)     0

    set cancel [Widget::getoption $path -cancel]
    bind $path <Escape>  [list ButtonBox::invoke $path.bbox $cancel]
    if {$cancel != -1} {
        wm protocol $path WM_DELETE_WINDOW [list ButtonBox::invoke $path.bbox $cancel]
    }
    bind $path <Return>  [list ButtonBox::invoke $path.bbox default]
    # Tk8.5 (TIP158) separated numeric keyboard enter and main keyboard
    # enter on Unix. So bind for both. This does not harm on Tk8.4 so no
    # check required. BWidget Ticket [3e31f04367].
    bind $path <KP_Enter>  [list ButtonBox::invoke $path.bbox default]

    return [Widget::create Dialog $path]
}


# ----------------------------------------------------------------------------
#  Command Dialog::configure
137
138
139
140
141
142
143








144
145
146
147
148
149
150
    if { [Widget::hasChanged $path -background bg] } {
        if { [winfo exists $path.label] } {
            $path.label configure -background $bg
        }
        if { [winfo exists $path.sep] } {
            Separator::configure $path.sep -background $bg
        }








    }
    return $res
}


# ----------------------------------------------------------------------------
#  Command Dialog::cget







>
>
>
>
>
>
>
>







145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
    if { [Widget::hasChanged $path -background bg] } {
        if { [winfo exists $path.label] } {
            $path.label configure -background $bg
        }
        if { [winfo exists $path.sep] } {
            Separator::configure $path.sep -background $bg
        }
    }
    if { [Widget::hasChanged $path -cancel cancel] } {
        bind $path <Escape>  [list ButtonBox::invoke $path.bbox $cancel]
        if {$cancel == -1} {
            wm protocol $path WM_DELETE_WINDOW ""
        } else {
            wm protocol $path WM_DELETE_WINDOW [list ButtonBox::invoke $path.bbox $cancel]
        }
    }
    return $res
}


# ----------------------------------------------------------------------------
#  Command Dialog::cget

Changes to dropsite.tcl.

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
        mod,control 4
        mod,alt     24
        ops,copy    1
        ops,move    1
        ops,link    1
    }

    if { $tcl_platform(platform) == "unix" } {
        set _tabops(mod,alt) 8
    } else {
        set _tabops(mod,alt) 16
    }
    array set _defops \
        [list \
             copy,mod  shift   \
             move,mod  control \
             link,mod  alt     \
             copy,img  @[file join $::BWIDGET::LIBRARY "images" "opcopy.xbm"] \
             move,img  @[file join $::BWIDGET::LIBRARY "images" "opmove.xbm"] \
             link,img  @[file join $::BWIDGET::LIBRARY "images" "oplink.xbm"]]

    bind DragTop <KeyPress-Shift_L>     {DropSite::_update_operation [expr %s | 1]}
    bind DragTop <KeyPress-Shift_R>     {DropSite::_update_operation [expr %s | 1]}
    bind DragTop <KeyPress-Control_L>   {DropSite::_update_operation [expr %s | 4]}
    bind DragTop <KeyPress-Control_R>   {DropSite::_update_operation [expr %s | 4]}
    if { $tcl_platform(platform) == "unix" } {
        bind DragTop <KeyPress-Alt_L>       {DropSite::_update_operation [expr %s | 8]}
        bind DragTop <KeyPress-Alt_R>       {DropSite::_update_operation [expr %s | 8]}
    } else {
        bind DragTop <KeyPress-Alt_L>       {DropSite::_update_operation [expr %s | 16]}
        bind DragTop <KeyPress-Alt_R>       {DropSite::_update_operation [expr %s | 16]}
    }

    bind DragTop <KeyRelease-Shift_L>   {DropSite::_update_operation [expr %s & ~1]}
    bind DragTop <KeyRelease-Shift_R>   {DropSite::_update_operation [expr %s & ~1]}
    bind DragTop <KeyRelease-Control_L> {DropSite::_update_operation [expr %s & ~4]}
    bind DragTop <KeyRelease-Control_R> {DropSite::_update_operation [expr %s & ~4]}
    if { $tcl_platform(platform) == "unix" } {
        bind DragTop <KeyRelease-Alt_L>     {DropSite::_update_operation [expr %s & ~8]}
        bind DragTop <KeyRelease-Alt_R>     {DropSite::_update_operation [expr %s & ~8]}
    } else {
        bind DragTop <KeyRelease-Alt_L>     {DropSite::_update_operation [expr %s & ~16]}
        bind DragTop <KeyRelease-Alt_R>     {DropSite::_update_operation [expr %s & ~16]}
    }
}







|

















|











|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
        mod,control 4
        mod,alt     24
        ops,copy    1
        ops,move    1
        ops,link    1
    }

    if { $::tcl_platform(platform) == "unix" } {
        set _tabops(mod,alt) 8
    } else {
        set _tabops(mod,alt) 16
    }
    array set _defops \
        [list \
             copy,mod  shift   \
             move,mod  control \
             link,mod  alt     \
             copy,img  @[file join $::BWIDGET::LIBRARY "images" "opcopy.xbm"] \
             move,img  @[file join $::BWIDGET::LIBRARY "images" "opmove.xbm"] \
             link,img  @[file join $::BWIDGET::LIBRARY "images" "oplink.xbm"]]

    bind DragTop <KeyPress-Shift_L>     {DropSite::_update_operation [expr %s | 1]}
    bind DragTop <KeyPress-Shift_R>     {DropSite::_update_operation [expr %s | 1]}
    bind DragTop <KeyPress-Control_L>   {DropSite::_update_operation [expr %s | 4]}
    bind DragTop <KeyPress-Control_R>   {DropSite::_update_operation [expr %s | 4]}
    if { $::tcl_platform(platform) == "unix" } {
        bind DragTop <KeyPress-Alt_L>       {DropSite::_update_operation [expr %s | 8]}
        bind DragTop <KeyPress-Alt_R>       {DropSite::_update_operation [expr %s | 8]}
    } else {
        bind DragTop <KeyPress-Alt_L>       {DropSite::_update_operation [expr %s | 16]}
        bind DragTop <KeyPress-Alt_R>       {DropSite::_update_operation [expr %s | 16]}
    }

    bind DragTop <KeyRelease-Shift_L>   {DropSite::_update_operation [expr %s & ~1]}
    bind DragTop <KeyRelease-Shift_R>   {DropSite::_update_operation [expr %s & ~1]}
    bind DragTop <KeyRelease-Control_L> {DropSite::_update_operation [expr %s & ~4]}
    bind DragTop <KeyRelease-Control_R> {DropSite::_update_operation [expr %s & ~4]}
    if { $::tcl_platform(platform) == "unix" } {
        bind DragTop <KeyRelease-Alt_L>     {DropSite::_update_operation [expr %s & ~8]}
        bind DragTop <KeyRelease-Alt_R>     {DropSite::_update_operation [expr %s & ~8]}
    } else {
        bind DragTop <KeyRelease-Alt_L>     {DropSite::_update_operation [expr %s & ~16]}
        bind DragTop <KeyRelease-Alt_R>     {DropSite::_update_operation [expr %s & ~16]}
    }
}
439
440
441
442
443
444
445





446
447
448
449
450
451
452
453
454
455
456
    variable _source
    variable _type
    variable _data

    if { $_status & 1 } {
        upvar \#0 DropSite::$_target drop






        set res [uplevel \#0 $drop(dropcmd) [list $_target $_source $X $Y $_curop $_type $_data]]
        DragSite::_end_drag $_source $_target $drop($_type,ops,$_curop) $_type $_data $res
    } else {
        if { $_status & 2 } {
            # notify leave event
            upvar \#0 DropSite::$_target drop
            uplevel \#0 $drop(overcmd) [list $_target $_source leave $X $Y $_curop $_type $_data]
        }
        DragSite::_end_drag $_source "" "" $_type $_data 0
    }
}







>
>
>
>
>











439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
    variable _source
    variable _type
    variable _data

    if { $_status & 1 } {
        upvar \#0 DropSite::$_target drop

        # Ticket [1ef1f56cd1] wke/amc 2022-10-12
        # Prevent motion events to be handled as
        # drop events when handler calls update and causes pending
        # motion events to fire.
        set _status [expr {$_status & ~1}];
        set res [uplevel \#0 $drop(dropcmd) [list $_target $_source $X $Y $_curop $_type $_data]]
        DragSite::_end_drag $_source $_target $drop($_type,ops,$_curop) $_type $_data $res
    } else {
        if { $_status & 2 } {
            # notify leave event
            upvar \#0 DropSite::$_target drop
            uplevel \#0 $drop(overcmd) [list $_target $_source leave $X $Y $_curop $_type $_data]
        }
        DragSite::_end_drag $_source "" "" $_type $_data 0
    }
}

Changes to dynhelp.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21








22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
# ----------------------------------------------------------------------------
#  dynhelp.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: dynhelp.tcl,v 1.20 2009/07/15 16:50:16 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - DynamicHelp::configure
#     - DynamicHelp::include
#     - DynamicHelp::sethelp
#     - DynamicHelp::register
#     - DynamicHelp::_motion_balloon
#     - DynamicHelp::_motion_info
#     - DynamicHelp::_leave_info
#     - DynamicHelp::_menu_info
#     - DynamicHelp::_show_help
#     - DynamicHelp::_init
# ----------------------------------------------------------------------------

namespace eval DynamicHelp {
    Widget::define DynamicHelp dynhelp -classonly









    Widget::declare DynamicHelp {
        {-foreground     TkResource black         0 label}
        {-topbackground  TkResource black         0 {label -foreground}}
        {-background     TkResource "#FFFFC0"     0 label}
        {-borderwidth    TkResource 1             0 label}
        {-justify        TkResource left          0 label}
        {-font           TkResource "helvetica 8" 0 label}
        {-delay          Int        600           0 "%d >= 100 & %d <= 2000"}
	{-state          Enum       "normal"      0 {normal disabled}}
        {-padx           TkResource 1             0 label}
        {-pady           TkResource 1             0 label}
        {-bd             Synonym    -borderwidth}
        {-bg             Synonym    -background}
        {-fg             Synonym    -foreground}
        {-topbg          Synonym    -topbackground}
    }


    proc use {} {}

    variable _registered
    variable _canvases
    variable _texts




|

















>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

45
46
47
48
49
50
51
52
# ----------------------------------------------------------------------------
#  dynhelp.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: dynhelp.tcl,v 1.20.2.1 2009/08/12 07:20:21 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - DynamicHelp::configure
#     - DynamicHelp::include
#     - DynamicHelp::sethelp
#     - DynamicHelp::register
#     - DynamicHelp::_motion_balloon
#     - DynamicHelp::_motion_info
#     - DynamicHelp::_leave_info
#     - DynamicHelp::_menu_info
#     - DynamicHelp::_show_help
#     - DynamicHelp::_init
# ----------------------------------------------------------------------------

namespace eval DynamicHelp {
    Widget::define DynamicHelp dynhelp -classonly

    if {$::tcl_version >= 8.5} {
        set fontdefault TkTooltipFont
    } elseif {$Widget::_aqua} {
        set fontdefault {helvetica 11}
    } else {
        set fontdefault {helvetica 8}
    }

    Widget::declare DynamicHelp [list\
        {-foreground     TkResource black         0 label}\
        {-topbackground  TkResource black         0 {label -foreground}}\
        {-background     TkResource "#FFFFC0"     0 label}\
        {-borderwidth    TkResource 1             0 label}\
        {-justify        TkResource left          0 label}\
        [list -font      TkResource $fontdefault  0 label]\
        {-delay          Int        600           0 "%d >= 100 & %d <= 2000"}\
	{-state          Enum       "normal"      0 {normal disabled}}\
        {-padx           TkResource 1             0 label}\
        {-pady           TkResource 1             0 label}\
        {-bd             Synonym    -borderwidth}\
        {-bg             Synonym    -background}\
        {-fg             Synonym    -foreground}\
        {-topbg          Synonym    -topbackground}\

    ]

    proc use {} {}

    variable _registered
    variable _canvases
    variable _texts

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#  Command DynamicHelp::sethelp
# ----------------------------------------------------------------------------
proc DynamicHelp::sethelp { path subpath {force 0}} {
    foreach {ctype ctext cvar} [Widget::hasChangedX $path \
	    -helptype -helptext -helpvar] break
    if { $force || $ctype || $ctext || $cvar } {
	set htype [Widget::cget $path -helptype]
        switch $htype {
            balloon {
                return [register $subpath balloon \
			[Widget::cget $path -helptext]]
            }
            variable {
                return [register $subpath variable \
			[Widget::cget $path -helpvar] \







|







109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#  Command DynamicHelp::sethelp
# ----------------------------------------------------------------------------
proc DynamicHelp::sethelp { path subpath {force 0}} {
    foreach {ctype ctext cvar} [Widget::hasChangedX $path \
	    -helptype -helptext -helpvar] break
    if { $force || $ctype || $ctext || $cvar } {
	set htype [Widget::cget $path -helptype]
        switch -- $htype {
            balloon {
                return [register $subpath balloon \
			[Widget::cget $path -helptext]]
            }
            variable {
                return [register $subpath variable \
			[Widget::cget $path -helpvar] \
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673

        toplevel $_top -relief flat \
            -bg [Widget::getoption $_top -topbackground] \
            -bd [Widget::getoption $_top -borderwidth] \
            -screen [winfo screen $w]

        wm withdraw $_top
	if {$::tk_version >= 8.4
	    && [string equal [tk windowingsystem] "aqua"]} {
	    ::tk::unsupported::MacWindowStyle style $_top help none
	} else {
	    wm overrideredirect $_top 1
	}

	catch { wm attributes $_top -topmost 1 }








|
<







666
667
668
669
670
671
672
673

674
675
676
677
678
679
680

        toplevel $_top -relief flat \
            -bg [Widget::getoption $_top -topbackground] \
            -bd [Widget::getoption $_top -borderwidth] \
            -screen [winfo screen $w]

        wm withdraw $_top
	if { $Widget::_aqua } {

	    ::tk::unsupported::MacWindowStyle style $_top help none
	} else {
	    wm overrideredirect $_top 1
	}

	catch { wm attributes $_top -topmost 1 }

687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704

705
706
707
708
709

710
711
712
713
714
715
716
717
718
719
720
721



722
723
724
725
726
727
728
	if {![winfo exists $_top]} {return}

        set  scrwidth  [winfo vrootwidth  .]
        set  scrheight [winfo vrootheight .]
        set  width     [winfo reqwidth  $_top]
        set  height    [winfo reqheight $_top]

        # On windows multi screen configurations, coordinates may get outside
        # the main screen. We suppose that all screens have the same size
        # because it is not possible to query the size of the other screens.
        
        set screenx [expr {$x % $scrwidth} ]
        set screeny [expr {$y % $scrheight} ]
        
        # Increment the required size by the deplacement from the passed point
        incr width 8
        incr height 12
        

        if { $screenx+$width > $scrwidth } {
            set x [expr {$x + ($scrwidth - $screenx) - ($width - 8)}]
        } else {
            incr x 8
        }

        if { $screeny+$height > $scrheight } {
            set y [expr {$y - $height}]
        } else {
            incr y 12
        }

        wm geometry  $_top "+$x+$y"
        update idletasks

	if {![winfo exists $_top]} { return }
        wm deiconify $_top
        raise $_top



    }
}

# ----------------------------------------------------------------------------
#  Command DynamicHelp::_unset_help
# ----------------------------------------------------------------------------
proc DynamicHelp::_unset_help { path } {







|
<
<
|
|
|





>
|
|



>
|











>
>
>







694
695
696
697
698
699
700
701


702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
	if {![winfo exists $_top]} {return}

        set  scrwidth  [winfo vrootwidth  .]
        set  scrheight [winfo vrootheight .]
        set  width     [winfo reqwidth  $_top]
        set  height    [winfo reqheight $_top]

        # On windows multi screen configurations, the virtual screen may start


        # at negative positions.
        set scrrootx [winfo vrootx .]
        set scrrooty [winfo vrooty .]
        
        # Increment the required size by the deplacement from the passed point
        incr width 8
        incr height 12
        
        # Put at the right border if going over it
        if { $x+$width > $scrrootx+$scrwidth } {
            set x [expr {$scrwidth + $scrrootx - $width + 8}]
        } else {
            incr x 8
        }
        # Put above widget if below is no space
        if { $y+$height > $scrrooty+$scrheight } {
            set y [expr {$y - $height}]
        } else {
            incr y 12
        }

        wm geometry  $_top "+$x+$y"
        update idletasks

	if {![winfo exists $_top]} { return }
        wm deiconify $_top
        raise $_top
        # Sometimes the tooltip does not occur under
        # gnome/metacity on ubuntu.
        after 5;
    }
}

# ----------------------------------------------------------------------------
#  Command DynamicHelp::_unset_help
# ----------------------------------------------------------------------------
proc DynamicHelp::_unset_help { path } {

Changes to entry.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24




25
26
27
28

29
30
31
32
33
34
35
36





37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60
61
62
63
64
65
66





67
68
69

70
71
72
73
74
75
76
# ------------------------------------------------------------------------------
#  entry.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: entry.tcl,v 1.22 2009/06/10 08:48:06 oehhar Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - Entry::create
#     - Entry::configure
#     - Entry::cget
#     - Entry::_destroy
#     - Entry::_init_drag_cmd
#     - Entry::_end_drag_cmd
#     - Entry::_drop_cmd
#     - Entry::_over_cmd
#     - Entry::_auto_scroll
#     - Entry::_scroll
# ------------------------------------------------------------------------------

namespace eval Entry {
    Widget::define Entry entry DragSite DropSite DynamicHelp

    # Note:  -textvariable is pulled off of the tk entry and put onto the
    # BW Entry so that we avoid the TkResource test for it, which screws up
    # the existance/non-existance bits of the -textvariable.




    Widget::tkinclude Entry entry :cmd \
    	remove { -state -background -foreground -textvariable
    		 -disabledforeground -disabledbackground }


    set declare [list \
	    [list -background   TkResource  ""	   0  entry] \
	    [list -foreground   TkResource  ""	   0  entry] \
	    [list -state        Enum        normal 0  [list normal disabled]] \
	    [list -text         String      ""	   0] \
	    [list -textvariable String      ""     0] \
	    [list -editable     Boolean     1      0] \
	    [list -command      String      ""     0] \





	    [list -relief       TkResource  ""     0  entry] \
	    [list -borderwidth  TkResource  ""     0  entry] \
	    [list -fg           Synonym     -foreground] \
	    [list -bg           Synonym     -background] \
	    [list -bd           Synonym     -borderwidth] \
	]

    if {![package vsatisfies [package provide Tk] 8.4]} {
	## If we're not running version 8.4 or higher, get our
	## disabled resources from the button widget.
	lappend declare [list -disabledforeground TkResource "" 0 button]
	lappend declare [list -disabledbackground TkResource "" 0 \
							{button -background}]
    } else {
	lappend declare [list -disabledforeground TkResource "" 0 entry]
	lappend declare [list -disabledbackground TkResource "" 0 entry]

    }

    Widget::declare Entry $declare
    Widget::addmap Entry "" :cmd { -textvariable {} }

    DynamicHelp::include Entry balloon
    DragSite::include    Entry "" 3
    DropSite::include    Entry {
        TEXT    {move {}}
        FGCOLOR {move {}}
        BGCOLOR {move {}}
        COLOR   {move {}}
    }






    foreach event [bind Entry] {
        bind BwEntry $event [bind Entry $event]
    }


    # Copy is kind of a special event.  It should be enabled when the
    # widget is editable but not disabled, and not when the widget is disabled.
    # To make this a bit easier to manage, we will handle it separately.

    bind BwEntry <<Copy>> {}
    bind BwEditableEntry <<Copy>> [bind Entry <<Copy>>]



|




















>
>
>
>
|
|
|
|
>

<
<





>
>
>
>
>
|
|
|
|
|
|
<
|
|
|
|
|
|
|
|
|
>














>
>
>
>
>
|
|
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# ------------------------------------------------------------------------------
#  entry.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: entry.tcl,v 1.22.2.2 2012/04/02 09:53:41 oehhar Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - Entry::create
#     - Entry::configure
#     - Entry::cget
#     - Entry::_destroy
#     - Entry::_init_drag_cmd
#     - Entry::_end_drag_cmd
#     - Entry::_drop_cmd
#     - Entry::_over_cmd
#     - Entry::_auto_scroll
#     - Entry::_scroll
# ------------------------------------------------------------------------------

namespace eval Entry {
    Widget::define Entry entry DragSite DropSite DynamicHelp

    # Note:  -textvariable is pulled off of the tk entry and put onto the
    # BW Entry so that we avoid the TkResource test for it, which screws up
    # the existance/non-existance bits of the -textvariable.
    if {[Widget::theme]} {
	Widget::tkinclude Entry ttk::entry :cmd \
	    remove { -state -textvariable }
    } else {
	Widget::tkinclude Entry entry :cmd \
	    remove { -state -background -foreground -textvariable
		     -disabledforeground -disabledbackground }
    }

    set declare [list \


	    [list -state        Enum        normal 0  [list normal disabled]] \
	    [list -text         String      ""	   0] \
	    [list -textvariable String      ""     0] \
	    [list -editable     Boolean     1      0] \
	    [list -command      String      ""     0] \
	]
    if {![Widget::theme]} {
	lappend declare \
		[list -background   TkResource  ""	   0  entry] \
		[list -foreground   TkResource  ""	   0  entry] \
		[list -relief       TkResource  ""     0  entry] \
		[list -borderwidth  TkResource  ""     0  entry] \
		[list -fg           Synonym     -foreground] \
		[list -bg           Synonym     -background] \
		[list -bd           Synonym     -borderwidth]


	if {![package vsatisfies [package provide Tk] 8.4]} {
	    ## If we're not running version 8.4 or higher, get our
	    ## disabled resources from the button widget.
	    lappend declare [list -disabledforeground TkResource "" 0 button]
	    lappend declare [list -disabledbackground TkResource "" 0 \
							    {button -background}]
	} else {
	    lappend declare [list -disabledforeground TkResource "" 0 entry]
	    lappend declare [list -disabledbackground TkResource "" 0 entry]
	}
    }

    Widget::declare Entry $declare
    Widget::addmap Entry "" :cmd { -textvariable {} }

    DynamicHelp::include Entry balloon
    DragSite::include    Entry "" 3
    DropSite::include    Entry {
        TEXT    {move {}}
        FGCOLOR {move {}}
        BGCOLOR {move {}}
        COLOR   {move {}}
    }

    if {[Widget::theme]} {
        foreach event [bind TEntry] {
            bind BwEntry $event [bind TEntry $event]
        }
    }  else  {
        foreach event [bind Entry] {
            bind BwEntry $event [bind Entry $event]
        }
     }

    # Copy is kind of a special event.  It should be enabled when the
    # widget is editable but not disabled, and not when the widget is disabled.
    # To make this a bit easier to manage, we will handle it separately.

    bind BwEntry <<Copy>> {}
    bind BwEditableEntry <<Copy>> [bind Entry <<Copy>>]
88
89
90
91
92
93
94



95

96
97
98
99
100
101



102

103
104



105

106
107
108
109
110



111
112
113

114

115
116
117

118
119
120
121
122
123
124
    variable $path
    upvar 0 $path data

    array set maps [list Entry {} :cmd {}]
    array set maps [Widget::parseArgs Entry $args]

    set data(afterid) ""



    eval [list entry $path] $maps(:cmd)

    Widget::initFromODB Entry $path $maps(Entry)
    set state    [Widget::getMegawidgetOption $path -state]
    set editable [Widget::getMegawidgetOption $path -editable]
    set text     [Widget::getMegawidgetOption $path -text]
    if { $editable && [string equal $state "normal"] } {
        bindtags $path [list $path BwEntry [winfo toplevel $path] all]



        $path configure -takefocus 1 -insertontime 600

    } else {
        bindtags $path [list $path BwDisabledEntry [winfo toplevel $path] all]



        $path configure -takefocus 0 -insertontime 0

    }
    if { $editable == 0 } {
        $path configure -cursor left_ptr
    }
    if { [string equal $state "disabled"] } {



        $path configure \
            -foreground [Widget::getMegawidgetOption $path -disabledforeground] \
            -background [Widget::getMegawidgetOption $path -disabledbackground]

    } else {

	$path configure \
                -foreground [Widget::getMegawidgetOption $path -foreground] \
                -background [Widget::getMegawidgetOption $path -background]

	bindtags $path [linsert [bindtags $path] 2 BwEditableEntry]
    }
    if { [string length $text] } {
	set varName [$path cget -textvariable]
	if { ![string equal $varName ""] } {
	    uplevel \#0 [list set $varName [Widget::cget $path -text]]
	} else {







>
>
>
|
>






>
>
>
|
>


>
>
>
|
>





>
>
>
|
|
|
>

>
|
|
|
>







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
    variable $path
    upvar 0 $path data

    array set maps [list Entry {} :cmd {}]
    array set maps [Widget::parseArgs Entry $args]

    set data(afterid) ""
    if {[Widget::theme]} {
        eval [list ttk::entry $path] $maps(:cmd)
    }  else  {
        eval [list entry $path] $maps(:cmd)
    }
    Widget::initFromODB Entry $path $maps(Entry)
    set state    [Widget::getMegawidgetOption $path -state]
    set editable [Widget::getMegawidgetOption $path -editable]
    set text     [Widget::getMegawidgetOption $path -text]
    if { $editable && [string equal $state "normal"] } {
        bindtags $path [list $path BwEntry [winfo toplevel $path] all]
        if {[Widget::theme]} {
            $path configure -takefocus 1
        } else {
            $path configure -takefocus 1 -insertontime 600
        }
    } else {
        bindtags $path [list $path BwDisabledEntry [winfo toplevel $path] all]
        if {[Widget::theme]} {
            $path configure -takefocus 0
        } else {
            $path configure -takefocus 0 -insertontime 0
        }
    }
    if { $editable == 0 } {
        $path configure -cursor left_ptr
    }
    if { [string equal $state "disabled"] } {
        if {[Widget::theme]} {
	    $path state disabled
	} else {
	    $path configure \
		-foreground [Widget::getMegawidgetOption $path -disabledforeground] \
		-background [Widget::getMegawidgetOption $path -disabledbackground]
	}
    } else {
	if {![Widget::theme]} {
	    $path configure \
		    -foreground [Widget::getMegawidgetOption $path -foreground] \
		    -background [Widget::getMegawidgetOption $path -background]
	}
	bindtags $path [linsert [bindtags $path] 2 BwEditableEntry]
    }
    if { [string length $text] } {
	set varName [$path cget -textvariable]
	if { ![string equal $varName ""] } {
	    uplevel \#0 [list set $varName [Widget::cget $path -text]]
	} else {
148
149
150
151
152
153
154




155
156
157

158
159
160
161
162
163
164
165
166
167
168



169

170
171
172
173
174



175

176
177
178
179
180
181








182
183
184
185
186
187
188
189
    # Cheat by setting the -text value to the current contents of the entry
    # This might be better hidden behind a function in ::Widget.
    set Widget::Entry::${path}:opt(-text) [$path:cmd get]

    set res [Widget::configure $path $args]

    # Extract the modified bits that we are interested in.




    set vars [list chstate cheditable chfg chdfg chbg chdbg chtext]
    set opts [list -state -editable -foreground -disabledforeground \
                -background -disabledbackground -text]

    foreach $vars [eval [linsert $opts 0 Widget::hasChangedX $path]] { break }

    if { $chstate || $cheditable } {
	set state [Widget::getMegawidgetOption $path -state]
	set editable [Widget::getMegawidgetOption $path -editable]
        set btags [bindtags $path]
        if { $editable && [string equal $state "normal"] } {
            set idx [lsearch $btags BwDisabledEntry]
            if { $idx != -1 } {
                bindtags $path [lreplace $btags $idx $idx BwEntry]
            }



            $path:cmd configure -takefocus 1 -insertontime 600

        } else {
            set idx [lsearch $btags BwEntry]
            if { $idx != -1 } {
                bindtags $path [lreplace $btags $idx $idx BwDisabledEntry]
            }



            $path:cmd configure -takefocus 0 -insertontime 0

            if { [string equal [focus] $path] } {
                focus .
            }
        }
    }









    if { $chstate || $chfg || $chdfg || $chbg || $chdbg } {
	set state [Widget::getMegawidgetOption $path -state]
        if { [string equal $state "disabled"] } {
            $path:cmd configure \
                -fg [Widget::cget $path -disabledforeground] \
                -bg [Widget::cget $path -disabledbackground]
        } else {
            $path:cmd configure \







>
>
>
>
|
|
|
>











>
>
>
|
>





>
>
>
|
>






>
>
>
>
>
>
>
>
|







180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
    # Cheat by setting the -text value to the current contents of the entry
    # This might be better hidden behind a function in ::Widget.
    set Widget::Entry::${path}:opt(-text) [$path:cmd get]

    set res [Widget::configure $path $args]

    # Extract the modified bits that we are interested in.
    if {[Widget::theme]} {
	set vars [list chstate cheditable chtext]
	set opts [list -state -editable -text]
    } else {
	set vars [list chstate cheditable chfg chdfg chbg chdbg chtext]
	set opts [list -state -editable -foreground -disabledforeground \
		    -background -disabledbackground -text]
    }
    foreach $vars [eval [linsert $opts 0 Widget::hasChangedX $path]] { break }

    if { $chstate || $cheditable } {
	set state [Widget::getMegawidgetOption $path -state]
	set editable [Widget::getMegawidgetOption $path -editable]
        set btags [bindtags $path]
        if { $editable && [string equal $state "normal"] } {
            set idx [lsearch $btags BwDisabledEntry]
            if { $idx != -1 } {
                bindtags $path [lreplace $btags $idx $idx BwEntry]
            }
            if {[Widget::theme]} {
                $path:cmd configure -takefocus 1
            } else {
                $path:cmd configure -takefocus 1 -insertontime 600
            }
        } else {
            set idx [lsearch $btags BwEntry]
            if { $idx != -1 } {
                bindtags $path [lreplace $btags $idx $idx BwDisabledEntry]
            }
            if {[Widget::theme]} {
                $path:cmd configure -takefocus 0
            } else {
                 $path:cmd configure -takefocus 0 -insertontime 0
            }
            if { [string equal [focus] $path] } {
                focus .
            }
        }
    }

    if { [Widget::theme] && $chstate } {
	set state [Widget::getMegawidgetOption $path -state]
        if { [string equal $state "disabled"] } {
            $path:cmd state disabled
        } else {
            $path:cmd state !disabled
        }
    }
    if { ![Widget::theme] && ($chstate || $chfg || $chdfg || $chbg || $chdbg) } {
	set state [Widget::getMegawidgetOption $path -state]
        if { [string equal $state "disabled"] } {
            $path:cmd configure \
                -fg [Widget::cget $path -disabledforeground] \
                -bg [Widget::cget $path -disabledbackground]
        } else {
            $path:cmd configure \
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# ------------------------------------------------------------------------------
proc Entry::_path_command { path cmd larg } {
    switch -exact -- $cmd {
        configure - cget - invoke {
            return [eval [linsert $larg 0 Entry::$cmd $path]]
        }
        default {
            return [eval [linsert $larg 0 $path:cmd $cmd]]
        }
    }
}


# ------------------------------------------------------------------------------
#  Command Entry::_init_drag_cmd







|







316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# ------------------------------------------------------------------------------
proc Entry::_path_command { path cmd larg } {
    switch -exact -- $cmd {
        configure - cget - invoke {
            return [eval [linsert $larg 0 Entry::$cmd $path]]
        }
        default {
            return [uplevel 2 [linsert $larg 0 $path:cmd $cmd]]
        }
    }
}


# ------------------------------------------------------------------------------
#  Command Entry::_init_drag_cmd

Changes to font.tcl.

223
224
225
226
227
228
229




230
231
232
233
234
235
236
237
238
			-highlightthickness 1 -takefocus 0 \
			-highlightbackground black \
			-highlightcolor black]
			
		set script "set [list SelectFont::${path}(fontcolor)] \[tk_chooseColor -parent $colf.button -initialcolor \[set [list SelectFont::${path}(fontcolor)]\]\];\
			SelectFont::_update [list $path]"
		




		set but  [button $colf.button -command $script \
			-text "Color..."]
		
		$lab configure -foreground $thecolor
		$frc configure -bg $thecolor
		
		pack $but -side left
		pack $frc -side left -padx 5
		







>
>
>
>

|







223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
			-highlightthickness 1 -takefocus 0 \
			-highlightbackground black \
			-highlightcolor black]
			
		set script "set [list SelectFont::${path}(fontcolor)] \[tk_chooseColor -parent $colf.button -initialcolor \[set [list SelectFont::${path}(fontcolor)]\]\];\
			SelectFont::_update [list $path]"
		
		set name [lindex [BWidget::getname colorPicker] 0]
		if { $name == "" } {
			set name "Color..."
		}
		set but  [button $colf.button -command $script \
			-text $name]
		
		$lab configure -foreground $thecolor
		$frc configure -bg $thecolor
		
		pack $but -side left
		pack $frc -side left -padx 5
		
276
277
278
279
280
281
282

283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
			 -takefocus 0 -exportselection 0 \
			 -width    4 \
			 -values   $_sizes \
			 -textvariable SelectFont::${path}(size) \
			 -state readonly]
	    bind $lbf <<ComboboxSelected>> [list SelectFont::_update $path]
	    bind $lbs <<ComboboxSelected>> [list SelectFont::_update $path]

	} else {
	    frame $path -background $bg
	    set lbf [ComboBox::create $path.font \
			 -highlightthickness 0 -takefocus 0 -background $bg \
			 -values   $_families($fams) \
			 -textvariable SelectFont::$path\(family\) \
			 -editable 0 \
			 -modifycmd [list SelectFont::_update $path]]
	    set lbs [ComboBox::create $path.size \
			 -highlightthickness 0 -takefocus 0 -background $bg \
			 -width    4 \
			 -values   $_sizes \
			 -textvariable SelectFont::$path\(size\) \
			 -editable 0 \
			 -modifycmd [list SelectFont::_update $path]]
	}
	bind $path <Destroy> [list SelectFont::_destroy $path]
        pack $lbf -side left -anchor w
        pack $lbs -side left -anchor w -padx 4
        foreach st $_styles {
	    if {$::Widget::_theme} {
		ttk::checkbutton $path.$st -takefocus 0 \
		    -style BWSlim.Toolbutton \
		    -image [Bitmap::get $st] \
		    -variable SelectFont::${path}($st) \
		    -command [list SelectFont::_update $path]
	    } else {
		button $path.$st \







>




















|







280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
			 -takefocus 0 -exportselection 0 \
			 -width    4 \
			 -values   $_sizes \
			 -textvariable SelectFont::${path}(size) \
			 -state readonly]
	    bind $lbf <<ComboboxSelected>> [list SelectFont::_update $path]
	    bind $lbs <<ComboboxSelected>> [list SelectFont::_update $path]
	    ttk::style configure BWSlim.Toolbutton -padding 0
	} else {
	    frame $path -background $bg
	    set lbf [ComboBox::create $path.font \
			 -highlightthickness 0 -takefocus 0 -background $bg \
			 -values   $_families($fams) \
			 -textvariable SelectFont::$path\(family\) \
			 -editable 0 \
			 -modifycmd [list SelectFont::_update $path]]
	    set lbs [ComboBox::create $path.size \
			 -highlightthickness 0 -takefocus 0 -background $bg \
			 -width    4 \
			 -values   $_sizes \
			 -textvariable SelectFont::$path\(size\) \
			 -editable 0 \
			 -modifycmd [list SelectFont::_update $path]]
	}
	bind $path <Destroy> [list SelectFont::_destroy $path]
        pack $lbf -side left -anchor w
        pack $lbs -side left -anchor w -padx 4
        foreach st $_styles {
	    if {[Widget::theme]} {
		ttk::checkbutton $path.$st -takefocus 0 \
		    -style BWSlim.Toolbutton \
		    -image [Bitmap::get $st] \
		    -variable SelectFont::${path}($st) \
		    -command [list SelectFont::_update $path]
	    } else {
		button $path.$st \

Changes to init.tcl.

25
26
27
28
29
30
31








32







33
34
35
36
37
38
39
	    option add *MainFrame.relief	raised $prio
	    option add *MainFrame.separator	none   $prio
	}
    }
}
Widget::_opt_defaults









option read [file join $::BWIDGET::LIBRARY "lang" "en.rc"]








## Add a TraverseIn binding to standard Tk widgets to handle some of
## the BWidget-specific things we do.
bind Entry   <<TraverseIn>> { %W selection range 0 end; %W icursor end }
bind Spinbox <<TraverseIn>> { %W selection range 0 end; %W icursor end }

bind all <Key-Tab>       { Widget::traverseTo [Widget::focusNext %W] }







>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
	    option add *MainFrame.relief	raised $prio
	    option add *MainFrame.separator	none   $prio
	}
    }
}
Widget::_opt_defaults

# Try to load lang file corresponding to current msgcat locale
proc Widget::_opt_lang {} {
    if {0 != [llength [info commands ::msgcat::mcpreferences]]} {
        set langs [::msgcat::mcpreferences]
    }
    lappend langs en

    foreach lang $langs {
        set l [file join $::BWIDGET::LIBRARY "lang" "$lang.rc"]
        if {(![catch {file readable $l} result]) && ($result)} {
            option read $l
            break
        }
    }
}
Widget::_opt_lang

## Add a TraverseIn binding to standard Tk widgets to handle some of
## the BWidget-specific things we do.
bind Entry   <<TraverseIn>> { %W selection range 0 end; %W icursor end }
bind Spinbox <<TraverseIn>> { %W selection range 0 end; %W icursor end }

bind all <Key-Tab>       { Widget::traverseTo [Widget::focusNext %W] }

Changes to label.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

19



20

21
22
23
24
25
26
27
# ------------------------------------------------------------------------------
#  label.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: label.tcl,v 1.10 2003/10/20 21:23:52 damonc Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - Label::create
#     - Label::configure
#     - Label::cget
#     - Label::setfocus
#     - Label::_drag_cmd
#     - Label::_drop_cmd
#     - Label::_over_cmd
# ------------------------------------------------------------------------------

namespace eval Label {
    Widget::define Label label DragSite DropSite DynamicHelp


    Widget::tkinclude Label label .l \



        remove { -foreground -text -textvariable -underline }


    Widget::declare Label {
        {-name               String     ""     0}
        {-text               String     ""     0}
        {-textvariable       String     ""     0}
        {-underline          Int        -1     0 "%d >= -1"}
        {-focus              String     ""     0}



|














>
|
>
>
>
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# ------------------------------------------------------------------------------
#  label.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: label.tcl,v 1.10.2.3 2011/04/26 08:24:28 oehhar Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - Label::create
#     - Label::configure
#     - Label::cget
#     - Label::setfocus
#     - Label::_drag_cmd
#     - Label::_drop_cmd
#     - Label::_over_cmd
# ------------------------------------------------------------------------------

namespace eval Label {
    Widget::define Label label DragSite DropSite DynamicHelp

    if {$::Widget::_theme} {
        Widget::tkinclude Label label .l \
            remove { -foreground -text -textvariable -underline -state}
	} else {
        Widget::tkinclude Label label .l \
            remove { -foreground -text -textvariable -underline }
	}

    Widget::declare Label {
        {-name               String     ""     0}
        {-text               String     ""     0}
        {-textvariable       String     ""     0}
        {-underline          Int        -1     0 "%d >= -1"}
        {-focus              String     ""     0}
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61



62
63






64
65
66
67
68


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
        IMAGE   {move {}}
        BITMAP  {move {}}
        FGCOLOR {move {}}
        BGCOLOR {move {}}
        COLOR   {move {}}
    }

    Widget::syncoptions Label "" .l {-text {} -underline {}}

    bind BwLabel <FocusIn> [list Label::setfocus %W]
    bind BwLabel <Destroy> [list Label::_destroy %W]
}


# ------------------------------------------------------------------------------
#  Command Label::create
# ------------------------------------------------------------------------------
proc Label::create { path args } {
    array set maps [list Label {} .l {}]
    array set maps [Widget::parseArgs Label $args]
    frame $path -class Label -borderwidth 0 -highlightthickness 0 -relief flat
    Widget::initFromODB Label $path $maps(Label)




    eval [list label $path.l] $maps(.l)







    if { [Widget::cget $path -state] == "normal" } {
        set fg [Widget::cget $path -foreground]
    } else {
        set fg [Widget::cget $path -disabledforeground]
    }



    set var [Widget::cget $path -textvariable]
    if {  $var == "" &&
          [Widget::cget $path -image] == "" &&
          [Widget::cget $path -bitmap] == ""} {
        set desc [BWidget::getname [Widget::cget $path -name]]
        if { $desc != "" } {
            set text  [lindex $desc 0]
            set under [lindex $desc 1]
        } else {
            set text  [Widget::cget $path -text]
            set under [Widget::cget $path -underline]
        }
    } else {
        set under -1
        set text  ""
    }

    $path.l configure -text $text -textvariable $var \
	    -underline $under -foreground $fg

    set accel [string tolower [string index $text $under]]
    if { $accel != "" } {
        bind [winfo toplevel $path] <Alt-$accel> "Label::setfocus $path"
    }

    bindtags $path   [list BwLabel [winfo toplevel $path] all]







<
<











|


>
>
>
|
|
>
>
>
>
>
>
|
|
|
|
|
>
>




|














|







44
45
46
47
48
49
50


51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
        IMAGE   {move {}}
        BITMAP  {move {}}
        FGCOLOR {move {}}
        BGCOLOR {move {}}
        COLOR   {move {}}
    }



    bind BwLabel <FocusIn> [list Label::setfocus %W]
    bind BwLabel <Destroy> [list Label::_destroy %W]
}


# ------------------------------------------------------------------------------
#  Command Label::create
# ------------------------------------------------------------------------------
proc Label::create { path args } {
    array set maps [list Label {} .l {}]
    array set maps [Widget::parseArgs Label $args]
    frame $path -class Label -borderwidth 0 -highlightthickness 0 -relief flat -padx 0 -pady 0
    Widget::initFromODB Label $path $maps(Label)

    if {$::Widget::_theme} {
        eval [list ttk::label $path.l] $maps(.l)
    } else {
        eval [list label $path.l] $maps(.l)
	}

    if {$::Widget::_theme} {
        if { [Widget::cget $path -state] != "normal" } {
            $path.l state disabled
		}
    } else {
        if { [Widget::cget $path -state] == "normal" } {
            set fg [Widget::cget $path -foreground]
        } else {
            set fg [Widget::cget $path -disabledforeground]
        }
        $path.l configure -foreground $fg
	}

    set var [Widget::cget $path -textvariable]
    if {  $var == "" &&
          [Widget::cget $path -image] == "" &&
          ($::Widget::_theme || [Widget::cget $path -bitmap] == "")} {
        set desc [BWidget::getname [Widget::cget $path -name]]
        if { $desc != "" } {
            set text  [lindex $desc 0]
            set under [lindex $desc 1]
        } else {
            set text  [Widget::cget $path -text]
            set under [Widget::cget $path -underline]
        }
    } else {
        set under -1
        set text  ""
    }

    $path.l configure -text $text -textvariable $var \
	    -underline $under

    set accel [string tolower [string index $text $under]]
    if { $accel != "" } {
        bind [winfo toplevel $path] <Alt-$accel> "Label::setfocus $path"
    }

    bindtags $path   [list BwLabel [winfo toplevel $path] all]
114
115
116
117
118
119
120
121
122
123













124
125
126
127
128
129
130

131
132
133




134

135
136
137
138
139
140
141
        set oldaccel [string tolower [string index [$path.l cget -text] $oldunder]]
    } else {
        set oldaccel ""
    }
    set res [Widget::configure $path $args]

    set cfg  [Widget::hasChanged $path -foreground fg]
    set cdfg [Widget::hasChanged $path -disabledforeground dfg]
    set cst  [Widget::hasChanged $path -state state]














    if { $cst || $cfg || $cdfg } {
        if { $state == "normal" } {
            $path.l configure -fg $fg
        } else {
            $path.l configure -fg $dfg
        }
    }


    set cv [Widget::hasChanged $path -textvariable var]
    set cb [Widget::hasChanged $path -image img]




    set ci [Widget::hasChanged $path -bitmap bmp]

    set cn [Widget::hasChanged $path -name name]
    set ct [Widget::hasChanged $path -text text]
    set cu [Widget::hasChanged $path -underline under]

    if { $cv || $cb || $ci || $cn || $ct || $cu } {
        if {  $var == "" && $img == "" && $bmp == "" } {
            set desc [BWidget::getname $name]







<


>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
>



>
>
>
>
|
>







128
129
130
131
132
133
134

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
        set oldaccel [string tolower [string index [$path.l cget -text] $oldunder]]
    } else {
        set oldaccel ""
    }
    set res [Widget::configure $path $args]

    set cfg  [Widget::hasChanged $path -foreground fg]

    set cst  [Widget::hasChanged $path -state state]

    if {$::Widget::_theme} {
        if { $cfg } {
            $path.l configure -foreground $fg
        }
        if { $cst } {
            if { $state == "normal" } {
                $path.l state !disabled
            } else {
                $path.l state disabled
            }
        }
    } else {
        set cdfg [Widget::hasChanged $path -disabledforeground dfg]
        if { $cst || $cfg || $cdfg } {
            if { $state == "normal" } {
                $path.l configure -fg $fg
            } else {
                $path.l configure -fg $dfg
            }
        }
	}

    set cv [Widget::hasChanged $path -textvariable var]
    set cb [Widget::hasChanged $path -image img]
    if {$::Widget::_theme} {
        set ci 0
        set bmp ""
	} else {
        set ci [Widget::hasChanged $path -bitmap bmp]
	}
    set cn [Widget::hasChanged $path -name name]
    set ct [Widget::hasChanged $path -text text]
    set cu [Widget::hasChanged $path -underline under]

    if { $cv || $cb || $ci || $cn || $ct || $cu } {
        if {  $var == "" && $img == "" && $bmp == "" } {
            set desc [BWidget::getname $name]
170
171
172
173
174
175
176
























177
178
179
180
181
182
183
# ------------------------------------------------------------------------------
#  Command Label::cget
# ------------------------------------------------------------------------------
proc Label::cget { path option } {
    return [Widget::cget $path $option]
}


























# ------------------------------------------------------------------------------
#  Command Label::setfocus
# ------------------------------------------------------------------------------
proc Label::setfocus { path } {
    if { [string equal [Widget::cget $path -state] "normal"] } {
        set w [Widget::cget $path -focus]







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# ------------------------------------------------------------------------------
#  Command Label::cget
# ------------------------------------------------------------------------------
proc Label::cget { path option } {
    return [Widget::cget $path $option]
}


# ----------------------------------------------------------------------------
#  Command Label::identify
# ----------------------------------------------------------------------------
proc Label::identify { path args } {
    eval $path.l identify $args
}


# ----------------------------------------------------------------------------
#  Command Label::instate
# ----------------------------------------------------------------------------
proc Label::instate { path args } {
    eval $path.l instate $args
}


# ----------------------------------------------------------------------------
#  Command Label::state
# ----------------------------------------------------------------------------
proc Label::state { path args } {
    eval $path.l state $args
}


# ------------------------------------------------------------------------------
#  Command Label::setfocus
# ------------------------------------------------------------------------------
proc Label::setfocus { path } {
    if { [string equal [Widget::cget $path -state] "normal"] } {
        set w [Widget::cget $path -focus]

Changes to labelentry.tcl.

1
2
3
4
5
6
7
8
9
10
11
# ------------------------------------------------------------------------------
#  labelentry.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: labelentry.tcl,v 1.6 2003/10/20 21:23:52 damonc Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - LabelEntry::create
#     - LabelEntry::configure
#     - LabelEntry::cget
#     - LabelEntry::bind
# ------------------------------------------------------------------------------



|







1
2
3
4
5
6
7
8
9
10
11
# ------------------------------------------------------------------------------
#  labelentry.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: labelentry.tcl,v 1.6.2.1 2011/02/14 16:56:09 oehhar Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - LabelEntry::create
#     - LabelEntry::configure
#     - LabelEntry::cget
#     - LabelEntry::bind
# ------------------------------------------------------------------------------
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41




42
43

44
45
46
47
48
49
50
51
52
53
54
55
56



57
58
59
60
61
62
63

    Widget::bwinclude LabelEntry Entry .e \
        remove {-fg -bg} \
        rename {-foreground -entryfg -background -entrybg}

    Widget::addmap LabelEntry "" :cmd {-background {}}

    Widget::syncoptions LabelEntry Entry .e {-text {}}
    Widget::syncoptions LabelEntry LabelFrame .labf {-label -text -underline {}}

    ::bind BwLabelEntry <FocusIn> [list focus %W.labf]
    ::bind BwLabelEntry <Destroy> [list LabelEntry::_destroy %W]
}


# ------------------------------------------------------------------------------
#  Command LabelEntry::create
# ------------------------------------------------------------------------------
proc LabelEntry::create { path args } {
    array set maps [list LabelEntry {} :cmd {} .labf {} .e {}]
    array set maps [Widget::parseArgs LabelEntry $args]





    eval [list frame $path] $maps(:cmd) -class LabelEntry \
	    -relief flat -bd 0 -highlightthickness 0 -takefocus 0

    Widget::initFromODB LabelEntry $path $maps(LabelEntry)
	
    set labf  [eval [list LabelFrame::create $path.labf] $maps(.labf) \
                   [list -relief flat -borderwidth 0 -focus $path.e]]
    set subf  [LabelFrame::getframe $labf]
    set entry [eval [list Entry::create $path.e] $maps(.e)]

    pack $entry -in $subf -fill both -expand yes
    pack $labf  -fill both -expand yes

    bindtags $path [list $path BwLabelEntry [winfo toplevel $path] all]

    return [Widget::create LabelEntry $path]



}


# ------------------------------------------------------------------------------
#  Command LabelEntry::configure
# ------------------------------------------------------------------------------
proc LabelEntry::configure { path args } {







<
<
<












>
>
>
>
|
|
>












|
>
>
>







20
21
22
23
24
25
26



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

    Widget::bwinclude LabelEntry Entry .e \
        remove {-fg -bg} \
        rename {-foreground -entryfg -background -entrybg}

    Widget::addmap LabelEntry "" :cmd {-background {}}




    ::bind BwLabelEntry <FocusIn> [list focus %W.labf]
    ::bind BwLabelEntry <Destroy> [list LabelEntry::_destroy %W]
}


# ------------------------------------------------------------------------------
#  Command LabelEntry::create
# ------------------------------------------------------------------------------
proc LabelEntry::create { path args } {
    array set maps [list LabelEntry {} :cmd {} .labf {} .e {}]
    array set maps [Widget::parseArgs LabelEntry $args]

    if {[Widget::theme]} {
        eval [list ttk::frame $path] $maps(:cmd) -class LabelEntry \
            -takefocus 0
    }  else  {
        eval [list frame $path] $maps(:cmd) -class LabelEntry \
            -relief flat -bd 0 -highlightthickness 0 -takefocus 0
    }
    Widget::initFromODB LabelEntry $path $maps(LabelEntry)
	
    set labf  [eval [list LabelFrame::create $path.labf] $maps(.labf) \
                   [list -relief flat -borderwidth 0 -focus $path.e]]
    set subf  [LabelFrame::getframe $labf]
    set entry [eval [list Entry::create $path.e] $maps(.e)]

    pack $entry -in $subf -fill both -expand yes
    pack $labf  -fill both -expand yes

    bindtags $path [list $path BwLabelEntry [winfo toplevel $path] all]

    Widget::create LabelEntry $path
    proc ::$path { cmd args } \
    	"return \[LabelEntry::_path_command [list $path] \$cmd \$args\]"
    return $path
}


# ------------------------------------------------------------------------------
#  Command LabelEntry::configure
# ------------------------------------------------------------------------------
proc LabelEntry::configure { path args } {

Changes to labelframe.tcl.

1
2
3
4
5
6
7
8
9
10
11
# ------------------------------------------------------------------------------
#  labelframe.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: labelframe.tcl,v 1.6 2003/10/20 21:23:52 damonc Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - LabelFrame::create
#     - LabelFrame::getframe
#     - LabelFrame::configure
#     - LabelFrame::cget
#     - LabelFrame::align



|







1
2
3
4
5
6
7
8
9
10
11
# ------------------------------------------------------------------------------
#  labelframe.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: labelframe.tcl,v 1.6.2.1 2011/02/14 16:56:09 oehhar Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - LabelFrame::create
#     - LabelFrame::getframe
#     - LabelFrame::configure
#     - LabelFrame::cget
#     - LabelFrame::align
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48





49
50
51
52

53
54
55




56
57

58
59
60
61
62
63
64
        {-side        Enum       left 1 {left right top bottom}}
        {-bd          Synonym    -borderwidth}
    }

    Widget::addmap LabelFrame "" :cmd {-background {}}
    Widget::addmap LabelFrame "" .f   {-background {} -relief {} -borderwidth {}}

    Widget::syncoptions LabelFrame Label .l {-text {} -underline {}}

    bind BwLabelFrame <FocusIn> [list Label::setfocus %W.l]
    bind BwLabelFrame <Destroy> [list LabelFrame::_destroy %W]
}


# ----------------------------------------------------------------------------
#  Command LabelFrame::create
# ----------------------------------------------------------------------------
proc LabelFrame::create { path args } {
    Widget::init LabelFrame $path $args






    set path  [eval [list frame $path] [Widget::subcget $path :cmd] \
	    -relief flat -bd 0 -takefocus 0 -highlightthickness 0 \
	    -class LabelFrame]


    set label [eval [list Label::create $path.l] [Widget::subcget $path .l] \
                   -takefocus 0 -highlightthickness 0 -relief flat \
		   -borderwidth 0 -dropenabled 0 -dragenabled 0]




    set frame [eval [list frame $path.f] [Widget::subcget $path .f] \
                   -highlightthickness 0 -takefocus 0]


    switch  [Widget::getoption $path -side] {
        left   {set packopt "-side left"}
        right  {set packopt "-side right"}
        top    {set packopt "-side top -fill x"}
        bottom {set packopt "-side bottom -fill x"}
    }







<
<











>
>
>
>
>
|
|
|
|
>

<
|
>
>
>
>
|
|
>







29
30
31
32
33
34
35


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
        {-side        Enum       left 1 {left right top bottom}}
        {-bd          Synonym    -borderwidth}
    }

    Widget::addmap LabelFrame "" :cmd {-background {}}
    Widget::addmap LabelFrame "" .f   {-background {} -relief {} -borderwidth {}}



    bind BwLabelFrame <FocusIn> [list Label::setfocus %W.l]
    bind BwLabelFrame <Destroy> [list LabelFrame::_destroy %W]
}


# ----------------------------------------------------------------------------
#  Command LabelFrame::create
# ----------------------------------------------------------------------------
proc LabelFrame::create { path args } {
    Widget::init LabelFrame $path $args

    if {[Widget::theme]} {
        set path  [eval [list ttk::frame $path] [Widget::subcget $path :cmd] \
            -takefocus 0 \
            -class LabelFrame]
    }  else  {
        set path  [eval [list frame $path] [Widget::subcget $path :cmd] \
            -relief flat -bd 0 -takefocus 0 -highlightthickness 0 \
            -class LabelFrame]
    }

    set label [eval [list Label::create $path.l] [Widget::subcget $path .l] \

        -takefocus 0 -dropenabled 0 -dragenabled 0]
    if {[Widget::theme]} {
        set frame [eval [list ttk::frame $path.f] [Widget::subcget $path .f] \
            -takefocus 0]
    }  else  {
        set frame [eval [list frame $path.f] [Widget::subcget $path .f] \
            -highlightthickness 0 -takefocus 0]
    }

    switch  [Widget::getoption $path -side] {
        left   {set packopt "-side left"}
        right  {set packopt "-side right"}
        top    {set packopt "-side top -fill x"}
        bottom {set packopt "-side bottom -fill x"}
    }

Changes to lang/da.rc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52














! -----------------------------------------------------------------------------
!  da.rc
!  This file is part of Unifix BWidget Toolkit
!  Definition of Danish resources
! -----------------------------------------------------------------------------


! --- symbolic names of buttons -----------------------------------------------

*abortName:   &Annull�r
*retryName:   P&r�v igen
*ignoreName:  &Ignorer
*okName:      &OK
*cancelName:  &Cancel
*yesName:     &Ja
*noName:      &Nej


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:       Fed
*italicName:     Kursiv
*underlineName:  Understreg
*overstrikeName: Overstreg
*fontName:       &Font
*sizeName:       &St�rrelse
*styleName:      St&il



! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Brugernavn
*passwordName: &Password


! --- resource for SelectFont dialog ------------------------------------------

*SelectFont.title:	    Font-valg
*SelectFont.sampletext:	    Eksempeltekst ���


! --- resource for MessageDlg dialog ------------------------------------------

*MessageDlg.noneTitle:      Besked
*MessageDlg.infoTitle:      Information
*MessageDlg.questionTitle:  Sp�rgsm�l
*MessageDlg.warningTitle:   Advarsel
*MessageDlg.errorTitle:     Fejl


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Indtast brugernavn og password























|
|









|
|
|
|
|
|
|
>
>










|






|


<




>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
! -----------------------------------------------------------------------------
!  da.rc
!  This file is part of Unifix BWidget Toolkit
!  Definition of Danish resources
! -----------------------------------------------------------------------------


! --- symbolic names of buttons -----------------------------------------------

*abortName:   &Annullér
*retryName:   P&røv igen
*ignoreName:  &Ignorer
*okName:      &OK
*cancelName:  &Cancel
*yesName:     &Ja
*noName:      &Nej


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:          Fed
*italicName:        Kursiv
*underlineName:     Understreg
*overstrikeName:    Overstreg
*fontName:          &Font
*sizeName:          &Størrelse
*styleName:         St&il
*colorPickerName:   F&arve...


! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Brugernavn
*passwordName: &Password


! --- resource for SelectFont dialog ------------------------------------------

*SelectFont.title:	    Font-valg
*SelectFont.sampletext:	    Eksempeltekst æøå


! --- resource for MessageDlg dialog ------------------------------------------

*MessageDlg.noneTitle:      Besked
*MessageDlg.infoTitle:      Information
*MessageDlg.questionTitle:  Spørgsmål
*MessageDlg.warningTitle:   Advarsel
*MessageDlg.errorTitle:     Fejl


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Indtast brugernavn og password

! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Grundfarver
*userColorsName: Brugerdefinerede farver

*yourSelectionName: Dit valg
*colorSelectorsName: Farvervælger

! --- dynamic help text for SelectColor dialog.  Lines 75 chars max, split by '\n'.

*mouseHelpTextName: Klik eller træk musen i farvervælgeren for at vælge en farve.\nHvis den valgte farve altid er sort, uanset værdierne til venstre,\ntjek intensitetsværdien til højere.\n\nKlik en af "grundfarverne" for at aflæse værdierne fra paletten,\neller for at tildele en, hvis farven er sort.  Hvis du efterfølgende\nbruger farvevælgeren til at ændre en farver, gemmes ændringen under\nbrugerdefinerede farver indtil en ny paletfarve er valgt.

*keyboardHelpTextName: Klik i tekstboksen til venstre i "dit valg" området.\n\nIndtast den ønskede farve i hexadecimalt RGB-format.\nVærdien er gyldig når den består af et antal cifre deleligt med 3,\ni så fald opdateres resten af farvervælgeren.\n\nForlad tekstboksen ved at klikke andetsteds, eller ved at taste\n"Escape" eller "Return". Tekstboksen viser efterfølgende farven i\n24-bit RGB-format, dog arbejder farvevælgeren internt med\n48-bit værdier.\n\nNår tekstboksen ikke har fokus fungerer "Return" og "Escape"\ntasterne lige som henholdsvis "OK" og "Annullér".

Changes to lang/de.rc.

14
15
16
17
18
19
20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
*cancelName:  &Abbrechen
*yesName:     &Ja
*noName:      &Nein


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:       Fett
*italicName:     Kursiv
*underlineName:  Unterstrichen
*overstrikeName: Durchgestrichen
*fontName:       &Schriftart
*sizeName:       S&chriftgrad
*styleName:      Sc&hriftschnitt


! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Login
*passwordName: &Password









|
|
|
|
|
|
|
>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
*cancelName:  &Abbrechen
*yesName:     &Ja
*noName:      &Nein


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:          Fett
*italicName:        Kursiv
*underlineName:     Unterstrichen
*overstrikeName:    Durchgestrichen
*fontName:          &Schriftart
*sizeName:          S&chriftgrad
*styleName:         Sc&hriftschnitt
*colorPickerName:   &Farbe...

! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Login
*passwordName: &Password


46
47
48
49
50
51
52














*MessageDlg.warningTitle:   Warnung
*MessageDlg.errorTitle:     Fehler


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Enter login and password





















>
>
>
>
>
>
>
>
>
>
>
>
>
>
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
*MessageDlg.warningTitle:   Warnung
*MessageDlg.errorTitle:     Fehler


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Enter login and password

! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Grundfarben
*userColorsName: Benutzerdefinierte Farben

*yourSelectionName: Gewählte Farbe
*colorSelectorsName: Farbraum

! --- dynamic help text for SelectColor dialog.  Lines 75 chars max, split by '\n'.

*mouseHelpTextName: Um eine Farbe zu wählen bitte im Farbraum und im Helligkeitsregler\nklicken oder ziehen. Bleibt die gewählte Farbe wieder erwarten schwarz,\nso muß die Helligkeit ganz rechts erhöht werden.\n\nMit einem Klick auf die Grundfarbenpalette kann diese gewählt werden.\n\nEin benutzerdefinierter Farbspeicher kann durch einen Klick selektiert\nwerden. Ab dann wird jede Farbveränderung auch in den Farbspeicher\n geschrieben.

*keyboardHelpTextName: Aktivieren sie das Texteingabefenster mit einem Klick oder mit der\nTabulatortaste. Eine Farbe kann als RGB-Wert eingegeben mit 3 oder 6\nhexadezimalen Ziffern eingegeben werden.\n\nDie Eingabe kann mit der Escape- oder Eingabetaste abgeschlossen werden.\n\nAusserhalb des Eingabefensters wird der Dialog mit der Eingabetaste\nbestätigt und mit der Escapetaste zurückgenommen.

Changes to lang/en.rc.

14
15
16
17
18
19
20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
*cancelName:  &Cancel
*yesName:     &Yes
*noName:      &No


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:       Bold
*italicName:     Italic
*underlineName:  Underline
*overstrikeName: Overstrike
*fontName:       &Font
*sizeName:       &Size
*styleName:      St&yle



! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Login
*passwordName: &Password








|
|
|
|
|
|
|
>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
*cancelName:  &Cancel
*yesName:     &Yes
*noName:      &No


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:          Bold
*italicName:        Italic
*underlineName:     Underline
*overstrikeName:    Overstrike
*fontName:          &Font
*sizeName:          &Size
*styleName:         St&yle
*colorPickerName:   &Color...


! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Login
*passwordName: &Password

46
47
48
49
50
51
52














*MessageDlg.questionTitle:  Question
*MessageDlg.warningTitle:   Warning
*MessageDlg.errorTitle:     Error

! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Enter login and password





















>
>
>
>
>
>
>
>
>
>
>
>
>
>
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
*MessageDlg.questionTitle:  Question
*MessageDlg.warningTitle:   Warning
*MessageDlg.errorTitle:     Error

! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Enter login and password

! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Base colors
*userColorsName: User colors

*yourSelectionName: Your Selection
*colorSelectorsName: Color Selectors

! --- dynamic help text for SelectColor dialog.  Lines 75 chars max, split by '\n'.

*mouseHelpTextName: Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank.  If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.

*keyboardHelpTextName: Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key.  The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.

Changes to lang/es.rc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27

28
29
30
31
32
33

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53














! ------------------------------------------------------------------------------
!  es.rc
!  This file is part of Unifix BWidget Toolkit
!  Definition of spanish resources
!  [email protected]
! ------------------------------------------------------------------------------


! --- symbolic names of buttons ------------------------------------------------

*abortName:    A&bortar
*retryName:    &Reintentar
*ignoreName:   &Ignorar
*okName:       &OK
*cancelName:   &Anular
*yesName:      &S� 
*noName:       &No


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:       &Negrita
*italicName:     &Cursiva
*underlineName:  &Subrayado
*overstrikeName: &Tachado
*fontName:       &Fuente
*sizeName:       &Tama�o
*styleName:      &Estilo



! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    Nombre de &usuario
*passwordName: &Contrase�a 


! --- resource for SelectFont dialog ------------------------------------------

*SelectFont.title:        Selecci�n de fuente
*SelectFont.sampletext:   Texto de Ejemplo


! --- resource for MessageDlg dialog ------------------------------------------

*MessageDlg.noneTitle:      Indicaci�n
*MessageDlg.infoTitle:      Informaci�n
*MessageDlg.questionTitle:  Pregunta
*MessageDlg.warningTitle:   Atenci�n
*MessageDlg.errorTitle:     Error


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Introduzca su nombre de usuario y contrase�a



















|





|



|
|

>



|
|
|
|
|
|
|
>




|
|
>



|





|
|

|

<



|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
! ------------------------------------------------------------------------------
!  es.rc
!  This file is part of Unifix BWidget Toolkit
!  Definition of spanish resources
!  [email protected], jima, neko
! ------------------------------------------------------------------------------


! --- symbolic names of buttons ------------------------------------------------

*abortName:    &Abortar
*retryName:    &Reintentar
*ignoreName:   &Ignorar
*okName:       &OK
*cancelName:   &Cancelar
*yesName:      &Sí
*noName:       &No


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:          Negrita
*italicName:        Cursiva
*underlineName:     Subrayado
*overstrikeName:    Tachado
*fontName:          &Fuente
*sizeName:          &Tamaño
*styleName:         &Estilo
*colorPickerName:   &Color...


! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Usuario
*passwordName: &Contraseña


! --- resource for SelectFont dialog ------------------------------------------

*SelectFont.title:        Selección de fuente
*SelectFont.sampletext:   Texto de Ejemplo


! --- resource for MessageDlg dialog ------------------------------------------

*MessageDlg.noneTitle:      Mensaje
*MessageDlg.infoTitle:      Información
*MessageDlg.questionTitle:  Pregunta
*MessageDlg.warningTitle:   Aviso
*MessageDlg.errorTitle:     Error


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Introduzca su usuario y contraseña

! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Colores base
*userColorsName: Colores de usuario

*yourSelectionName: Su selección
*colorSelectorsName: Selectores de color


! --- dynamic help text for SelectColor dialog.  Lines 75 chars max, split by '\n'.

*mouseHelpTextName: Haga click o arrastre el ratón en los selectores de color para elegir un color.\nSi el color seleccionado permanece negro, sin importar lo que haga en el selector de\ncolor izquierdo (para tono y saturación), compruebe la posición del puntero en el selector\nde color derecho (para brillo).\n\nHaga click en uno de los "Colores base" para leer un valor de esa paleta.\n\nClick en uno de los "Colores de usuario" para leer un valor de esa paleta, o para escribir\nla paleta si el color está vacio.  Si luego usted usa los Selectores de color para cambiar\nel color, su elección se escribirá en ese color de la paleta (de usuario) hasta seleccionar\notro color de la paleta (base o de usuario).

*keyboardHelpTextName: Haga click en la ventana de entrada de texto a la izquierda del área "Su\nSelección".\n\nTeclee el color que desee en formato RGB hexadecimal. Siempre que el número de dígitos\nhexadecimales sea múltiplo de 3, el valor de color es válido y se copiará a las\notras partes del Selector de Color.\n\nSalga de la ventana de entrada de texto haciendo click en otro lugar, o presionando la\ntecla "Escape" o "Enter". La ventana de entrada de texto mostrará entonces el color en\nformato RGB 24-bit, aunque internamente el Selector de Color usa colores de 48-bit.\n\nCuando el control de entrada de texto no tenga el foco de teclado (ej, no muestra un\ncursor), las teclas "Enter" y "Escape" hacen lo mismo que los botones "OK" y "Cancel",\nrespectivamente.

Changes to lang/fr.rc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
















! ------------------------------------------------------------------------------
!  fr.rc
!  This file is part of Unifix BWidget Toolkit
!  Definition of french resources
! ------------------------------------------------------------------------------


! --- symbolic names of buttons ------------------------------------------------

*abortName:    A&bandonner
*retryName:    &R�essayer
*ignoreName:   &Ignorer
*okName:       &OK
*cancelName:   &Annuler
*yesName:      &Oui
*noName:       &Non


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:       &Gras
*italicName:     &Italique
*underlineName:  &Soulign�
*overstrikeName: &Barr�
*fontName:       &Police
*sizeName:       &Taille
*styleName:      St&yle



! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    Nom de l'&utilisateur
*passwordName: Mot de &passe


! --- resource for SelectFont dialog ------------------------------------------

*SelectFont.title:        S�lection d'une police
*SelectFont.sampletext:	  Texte d'exemple


! --- resource for MessageDlg dialog ------------------------------------------

*MessageDlg.noneTitle:      Message
*MessageDlg.infoTitle:      Information
*MessageDlg.questionTitle:  Question
*MessageDlg.warningTitle:   Attention
*MessageDlg.errorTitle:     Erreur


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Entrez le login et le mot de passe


























|





>



|
|
|
|
|
|
|
>










|











<



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
! ------------------------------------------------------------------------------
!  fr.rc
!  This file is part of Unifix BWidget Toolkit
!  Definition of french resources
! ------------------------------------------------------------------------------


! --- symbolic names of buttons ------------------------------------------------

*abortName:    A&bandonner
*retryName:    &Réessayer
*ignoreName:   &Ignorer
*okName:       &OK
*cancelName:   &Annuler
*yesName:      &Oui
*noName:       &Non


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:          &Gras
*italicName:        &Italique
*underlineName:     &Souligné
*overstrikeName:    &Barré
*fontName:          &Police
*sizeName:          &Taille
*styleName:         St&yle
*colorPickerName:   &Couleur...


! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    Nom de l'&utilisateur
*passwordName: Mot de &passe


! --- resource for SelectFont dialog ------------------------------------------

*SelectFont.title:        Sélection d'une police
*SelectFont.sampletext:	  Texte d'exemple


! --- resource for MessageDlg dialog ------------------------------------------

*MessageDlg.noneTitle:      Message
*MessageDlg.infoTitle:      Information
*MessageDlg.questionTitle:  Question
*MessageDlg.warningTitle:   Attention
*MessageDlg.errorTitle:     Erreur


! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Entrez le login et le mot de passe

! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Couleurs de base
*userColorsName: Couleurs utilisateur

*yourSelectionName: Votre sélection
*colorSelectorsName: Sélecteur de couleurs

! --- dynamic help text for SelectColor dialog.  Lines 75 chars max, split by '\n'.


*mouseHelpTextName: Cliquez ou déplacez la souris dans la palette pour choisir une couleur.\nSi la couleur affichée reste noire quelle que soit la sélection dans la palette (teinte et\nsaturation), vérifiez la position du pointeur dans le sélecteur de droite (luminosité).\n\nCliquez sur l'une des "Couleurs de base" pour la sélectionner.\n\nCliquez sur l'une des "Couleurs utilisateurs" pour la sélectionner, ou pour la\nsauver dans la palette utilisateur dans une case blanche. Les modifications via le\nsélecteur de couleurs sont alors propagées dans la case sélectionnée de la palette\nutilisateur jusqu'à ce qu'une autre couleur (de base ou utilisateur) soit sélectionnée.

*keyboardHelpTextName: Cliquez dans la zone de saisie à gauche, dans la zone "Votre sélection".\n\nEntrez la couleur désirée au format RGB hexadécimal.\nLa valeur est validée lorsque le nombre de chiffres hexadécimaux est un multiple de 3.\nElle est alors propagée aux autres zones du sélecteur de couleurs.\n\nLa zone de saisie peut être quittée en cliquant n'importe où ailleurs ou en appuyant sur la\ntouche "Escape" ou "Entrée" du clavier. Bien que le sélecteur de couleurs utilise\n48 bits en interne, la zone de saisie affichera alors la couleur au format RGB en\nhexadécimal sur 24 bits.\n\nLorsque la zone de saisie n'a pas le focus (i.e. ne montre pas le curseur), les touches\n"Entrée" et "Escape" ont la même fonction que les boutons "OK" et "Annuler" respectivement.

Changes to lang/hu.rc.

21
22
23
24
25
26
27

28
29
30
31
32
33
34
*boldName:       Félkövér
*italicName:     DÅ‘lt
*underlineName:  Aláhúzott
*overstrikeName: Felülírás
*fontName:       &Betűtípus
*sizeName:       &Méret
*styleName:      S&tílus



! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Felhasználónév
*passwordName: &Jelszó








>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
*boldName:       Félkövér
*italicName:     DÅ‘lt
*underlineName:  Aláhúzott
*overstrikeName: Felülírás
*fontName:       &Betűtípus
*sizeName:       &Méret
*styleName:      S&tílus
*colorPickerName:   &Szín...


! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Felhasználónév
*passwordName: &Jelszó

46
47
48
49
50
51
52














*MessageDlg.questionTitle:  Kérdés
*MessageDlg.warningTitle:   Figyelmeztetés
*MessageDlg.errorTitle:     Hiba

! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Add meg a felhasználónevet és a jelszót





















>
>
>
>
>
>
>
>
>
>
>
>
>
>
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
*MessageDlg.questionTitle:  Kérdés
*MessageDlg.warningTitle:   Figyelmeztetés
*MessageDlg.errorTitle:     Hiba

! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Add meg a felhasználónevet és a jelszót

! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Alapszínek
*userColorsName: Felhasználói színek

*yourSelectionName: Your Selection
*colorSelectorsName: Color Selectors

! --- dynamic help text for SelectColor dialog.  Lines 75 chars max, split by '\n'.

*mouseHelpTextName: Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank.  If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.

*keyboardHelpTextName: Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key.  The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.

Changes to lang/nl.rc.

14
15
16
17
18
19
20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
*cancelName:  &Annuleren
*yesName:     &Ja
*noName:      &Nee


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:       Vet
*italicName:     Cursief
*underlineName:  Onderstrepen
*overstrikeName: Doorhalen
*fontName:       &Lettertype
*sizeName:       &Grootte
*styleName:      &Stijl



! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Inlognaam
*passwordName: &Wachtwoord








|
|
|
|
|
|
|
>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
*cancelName:  &Annuleren
*yesName:     &Ja
*noName:      &Nee


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:          Vet
*italicName:        Cursief
*underlineName:     Onderstrepen
*overstrikeName:    Doorhalen
*fontName:          &Lettertype
*sizeName:          &Grootte
*styleName:         &Stijl
*colorPickerName:   &Kleur...


! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Inlognaam
*passwordName: &Wachtwoord

46
47
48
49
50
51
52














*MessageDlg.questionTitle:  Vraag
*MessageDlg.warningTitle:   Waarschuwing
*MessageDlg.errorTitle:     Fout

! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Voer inlognaam en wachtwoord in





















>
>
>
>
>
>
>
>
>
>
>
>
>
>
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
*MessageDlg.questionTitle:  Vraag
*MessageDlg.warningTitle:   Waarschuwing
*MessageDlg.errorTitle:     Fout

! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Voer inlognaam en wachtwoord in

! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Basiskleuren
*userColorsName: Aangepaste kleuren

*yourSelectionName: Uw selectie
*colorSelectorsName: Selecteren kleuren

! --- dynamic help text for SelectColor dialog.  Lines 75 chars max, split by '\n'.

*mouseHelpTextName: Klik of sleep de muis in de kleurselectors om een kleur te kiezen.\nAls de geselecteerde kleur zwart blijft, ongeacht wat je doet in het\nlinkerdeel (tint en verzadiging), controleer de positie van de muispointer\nin het rechterdeel (helderheid).\n\nKlik op een van de basiskleuren om een waarde uit dit palet te lezen.\n\nKlik op een van de basiskleuren om een waarde uit dit palet te lezen of\nom een nieuwe waarde in te voeren als het vakje leeg is. Als je dan de\nkleurselectors gebruikt om de kleur te wijzigen, dan wordt die nieuwe\nkeuze naar het aanpasbare kleurvakje geschreven tot je een andere\nbasiskleur of aanpasbare kleur kiest. 

*keyboardHelpTextName: Klik in het invoerveld links van het deel "Uw selectie".\nTyp de gewenste kleur in volgens het hexadecimale RGB-format.\nDe kleurwaarde is acceptabel als het aantal hexadecimale cijfers een\nveelvoud is van 3. De waarde wordt gekopieerd naar andere delen van de\nkleurselector.\n\nVerlaat het invoerveld door ergens anders te klikken of via "Escape" of\n"Return". Het invoerveld toont dan de kleur in 24-bits RGB-format\n(overigens wordt intern een 48-bits RGB-format gebruikt).\n\nAls het invoerveld niet de focus heeft (geen tekstcursor vertoont), dan\nwerken de "Return"- en "Escape"-toetsen net als de "OK"- en\n"Cancel"-buttons.

Changes to lang/no.rc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52














! ------------------------------------------------------------------------------
!  no.rc
!  This file is part of Unifix BWidget Toolkit
!  Definition of norwegian resources
! ------------------------------------------------------------------------------


! --- symbolic names of buttons ------------------------------------------------

*abortName:   &Om
*retryName:   &Pr�v igjen
*ignoreName:  &Ignore
*okName:      &OK
*cancelName:  &Avbryt
*yesName:     &Ja
*noName:      &Nei


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:       Halvfet
*italicName:     Kursiv
*underlineName:  Understreking
*overstrikeName: Overstryke
*fontName:       &Skrift
*sizeName:       &St�rrelse
*styleName:      St&il



! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Logg inn
*passwordName: &Passord


! --- resource for SelectFont dialog ------------------------------------------

*SelectFont.title:	    Skriftvalg
*SelectFont.sampletext:	    Pr�ve tekst


! --- resource for MessageDlg dialog ------------------------------------------

*MessageDlg.noneTitle:      Melding
*MessageDlg.infoTitle:      Informasjon
*MessageDlg.questionTitle:  Sp�rsm�l
*MessageDlg.warningTitle:   Advarsel
*MessageDlg.errorTitle:     Feil

! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Skriv inn logginn og passord
























|









|
|
|
|
|
|
|
>











|






|






>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
! ------------------------------------------------------------------------------
!  no.rc
!  This file is part of Unifix BWidget Toolkit
!  Definition of norwegian resources
! ------------------------------------------------------------------------------


! --- symbolic names of buttons ------------------------------------------------

*abortName:   &Om
*retryName:   &Prøv igjen
*ignoreName:  &Ignore
*okName:      &OK
*cancelName:  &Avbryt
*yesName:     &Ja
*noName:      &Nei


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:          Halvfet
*italicName:        Kursiv
*underlineName:     Understreking
*overstrikeName:    Overstryke
*fontName:          &Skrift
*sizeName:          &Størrelse
*styleName:         St&il
*colorPickerName:   &Color...


! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Logg inn
*passwordName: &Passord


! --- resource for SelectFont dialog ------------------------------------------

*SelectFont.title:	    Skriftvalg
*SelectFont.sampletext:	    Prøve tekst


! --- resource for MessageDlg dialog ------------------------------------------

*MessageDlg.noneTitle:      Melding
*MessageDlg.infoTitle:      Informasjon
*MessageDlg.questionTitle:  Spørsmål
*MessageDlg.warningTitle:   Advarsel
*MessageDlg.errorTitle:     Feil

! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Skriv inn logginn og passord

! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Base colors
*userColorsName: User colors

*yourSelectionName: Your Selection
*colorSelectorsName: Color Selectors

! --- dynamic help text for SelectColor dialog.  Lines 75 chars max, split by '\n'.

*mouseHelpTextName: Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank.  If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.

*keyboardHelpTextName: Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key.  The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.

Added lang/pl.rc.







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
! ------------------------------------------------------------------------------
!  pl.rc
!  This file is part of Unifix BWidget Toolkit
!  Definition of english resources
! ------------------------------------------------------------------------------


! --- symbolic names of buttons ------------------------------------------------

*abortName:   &Porzuć
*retryName:   P&onów
*ignoreName:  &Ignoruj
*okName:      &OK
*cancelName:  &Anyluj
*yesName:     &Tak
*noName:      &Nie


! --- symbolic names of label of SelectFont dialog ----------------------------

*boldName:          Pogrubiona
*italicName:        Kursywa
*underlineName:     Podkreślenie
*overstrikeName:    Przekreślenie
*fontName:          &Czcionka:
*sizeName:          &Rozmiar:
*styleName:         St&yl czcionki:
*colorPickerName:   &Kolor...


! --- symbolic names of label of PasswdDlg dialog -----------------------------

*loginName:    &Login
*passwordName: &Hasło


! --- resource for SelectFont dialog ------------------------------------------

*SelectFont.title:	    Wybór czcionki
*SelectFont.sampletext:	    Przykładowy tekst


! --- resource for MessageDlg dialog ------------------------------------------

*MessageDlg.noneTitle:      Wiadomość
*MessageDlg.infoTitle:      Informacja
*MessageDlg.questionTitle:  Pytanie
*MessageDlg.warningTitle:   Ostrzeżenie
*MessageDlg.errorTitle:     BÅ‚Ä…d

! --- resource for PasswdDlg dialog -------------------------------------------

*PasswdDlg.title:  Wpisz login i hasło

! --- symbolic names of label of SelectColor dialog ----------------------------

*baseColorsName: Kolory podstawowe
*userColorsName: Kolory niestandardowe

*yourSelectionName: Your Selection
*colorSelectorsName: Color Selectors

! --- dynamic help text for SelectColor dialog.  Lines 75 chars max, split by '\n'.

*mouseHelpTextName: Click or drag the mouse in the Color Selectors to choose a color.\nIf the selected color remains black, regardless of what you\ndo in the left-hand Color Selector (for hue and saturation), check\nthe position of the pointer in the right-hand Color Selector\n(for brightness).\n\nClick one of the "Base colors" to read a value from this palette.\n\nClick one of the "User colors" to read a value from this palette,\nor to write to the palette if the color is blank.  If you then\nuse the Color Selectors to change the color, your choice will be\nwritten to this (User) palette color until you select another\n(Base or User) palette color.

*keyboardHelpTextName: Click in the text entry window in the left of the "Your\nSelection" area.\n\nType the color that you want in hexadecimal RGB format.\nWhenever the number of hexadecimal digits is a multiple\nof 3, the color value is valid and will be copied to the\nother parts of the Color Selector.\n\nLeave the text entry window by clicking anywhere else,\nor by pressing the "Escape" or "Return" key.  The text\nentry window will then display the color in 24-bit RGB\nformat, although internally the Color Selector uses\n48-bit colors.\n\nWhen the text entry widget does not have keyboard focus\n(i.e. does not show a cursor), the "Return" and "Escape"\nkeys do the same as the "OK" and "Cancel" buttons,\nrespectively.

Changes to listbox.tcl.

1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  listbox.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: listbox.tcl,v 1.29 2009/06/30 16:17:37 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - ListBox::create
#     - ListBox::configure
#     - ListBox::cget
#     - ListBox::insert
#     - ListBox::itemconfigure



|







1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  listbox.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: listbox.tcl,v 1.29.2.7 2012/04/12 12:46:47 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - ListBox::create
#     - ListBox::configure
#     - ListBox::cget
#     - ListBox::insert
#     - ListBox::itemconfigure
23
24
25
26
27
28
29

30
31
32
33
34
35
36
#     - ListBox::see
#     - ListBox::edit
#     - ListBox::xview
#     - ListBox::yview
#     - ListBox::_update_edit_size
#     - ListBox::_destroy
#     - ListBox::_see

#     - ListBox::_update_scrollregion
#     - ListBox::_draw_item
#     - ListBox::_redraw_items
#     - ListBox::_redraw_selection
#     - ListBox::_redraw_listbox
#     - ListBox::_redraw_idle
#     - ListBox::_resize







>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#     - ListBox::see
#     - ListBox::edit
#     - ListBox::xview
#     - ListBox::yview
#     - ListBox::_update_edit_size
#     - ListBox::_destroy
#     - ListBox::_see
#     - ListBox::_see_item
#     - ListBox::_update_scrollregion
#     - ListBox::_draw_item
#     - ListBox::_redraw_items
#     - ListBox::_redraw_selection
#     - ListBox::_redraw_listbox
#     - ListBox::_redraw_idle
#     - ListBox::_resize
126
127
128
129
130
131
132

133
134
135
136
137
138
139
    # For 8.4+ we don't want to inherit the padding
    catch {$path configure -padx 0 -pady 0}
    # widget informations
    set data(nrows) -1

    # items informations
    set data(items)    {}

    set data(selitems) {}

    # update informations
    set data(upd,level)   0
    set data(upd,afterid) ""
    set data(upd,level)   0
    set data(upd,delete)  {}







>







127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
    # For 8.4+ we don't want to inherit the padding
    catch {$path configure -padx 0 -pady 0}
    # widget informations
    set data(nrows) -1

    # items informations
    set data(items)    {}
    set data(seeitem)  {}
    set data(selitems) {}

    # update informations
    set data(upd,level)   0
    set data(upd,afterid) ""
    set data(upd,level)   0
    set data(upd,delete)  {}
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243

244
245
246
247
248
249
250
251
252

253

254
255
256
257
258
259
260
#  Command ListBox::_configureSelectmode
# ----------------------------------------------------------------------------
# Configure the selectmode
proc ListBox::_configureSelectmode { path selectmode {previous none} } {
    # clear current binding
    switch -exact -- $previous {
        single {
            $path bindText  <Button-1> ""
            $path bindImage <Button-1> ""
        }
        multiple {
            $path bindText <Button-1>          ""
            $path bindText <Shift-Button-1>    ""
            $path bindText <Control-Button-1>  ""

            $path bindImage <Button-1>         ""
            $path bindImage <Shift-Button-1>   ""
            $path bindImage <Control-Button-1> ""
        }
    }
    # set new bindings
    switch -exact -- $selectmode {
        single {
            $path bindText  <Button-1> [list ListBox::_mouse_select $path set]
            $path bindImage <Button-1> [list ListBox::_mouse_select $path set]
            if {1 < [llength [ListBox::selection $path get]]} {
                ListBox::selection $path clear
            }
        }
        multiple {
            set cmd ListBox::_multiple_select
            $path bindText <Button-1>          [list $cmd $path n %x %y]
            $path bindText <Shift-Button-1>    [list $cmd $path s %x %y]
            $path bindText <Control-Button-1>  [list $cmd $path c %x %y]

            $path bindImage <Button-1>         [list $cmd $path n %x %y]
            $path bindImage <Shift-Button-1>   [list $cmd $path s %x %y]
            $path bindImage <Control-Button-1> [list $cmd $path c %x %y]
        }
        default {
            if {0 < [llength [ListBox::selection $path get]]} {
                ListBox::selection $path clear
            }
        }
    }
}
# ----------------------------------------------------------------------------
#  Command ListBox::configure
# ----------------------------------------------------------------------------
proc ListBox::configure { path args } {
    set selectmodePrevious [Widget::getoption $path -selectmode]
    set res [Widget::configure $path $args]

    if { [Widget::hasChanged $path -selectmode selectmode] } {
        _configureSelectmode $path $selectmode $selectmodePrevious
    }

    set ch1 [expr {[Widget::hasChanged $path -deltay dy]  |

                   [Widget::hasChanged $path -padx val]   |
                   [Widget::hasChanged $path -multicolumn val]}]

    set ch2 [expr {[Widget::hasChanged $path -selectbackground val] |
                   [Widget::hasChanged $path -selectforeground val]}]

    set redraw 0
    if { [Widget::hasChanged $path -height h] } {
        $path.c configure -height [expr {$h*$dy}]

        set redraw 1

    }
    if { [Widget::hasChanged $path -width w] } {
        $path.c configure -width [expr {$w*8}]
        set redraw 1
    }

    if { [Widget::hasChanged $path -background bg] } {







|
|


|
|
|

|
|
|





|
|






|
|
|

|
|
|



















|
>







|

>
|
>







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#  Command ListBox::_configureSelectmode
# ----------------------------------------------------------------------------
# Configure the selectmode
proc ListBox::_configureSelectmode { path selectmode {previous none} } {
    # clear current binding
    switch -exact -- $previous {
        single {
            $path _bindText  <Button-1> ""
            $path _bindImage <Button-1> ""
        }
        multiple {
            $path _bindText <ButtonRelease-1>          ""
            $path _bindText <Shift-ButtonRelease-1>    ""
            $path _bindText <Control-ButtonRelease-1>  ""

            $path _bindImage <ButtonRelease-1>         ""
            $path _bindImage <Shift-ButtonRelease-1>   ""
            $path _bindImage <Control-ButtonRelease-1> ""
        }
    }
    # set new bindings
    switch -exact -- $selectmode {
        single {
            $path _bindText  <Button-1> [list ListBox::_mouse_select $path set]
            $path _bindImage <Button-1> [list ListBox::_mouse_select $path set]
            if {1 < [llength [ListBox::selection $path get]]} {
                ListBox::selection $path clear
            }
        }
        multiple {
            set cmd ListBox::_multiple_select
            $path _bindText <ButtonRelease-1>          [list $cmd $path n %x %y]
            $path _bindText <Shift-ButtonRelease-1>    [list $cmd $path s %x %y]
            $path _bindText <Control-ButtonRelease-1>  [list $cmd $path c %x %y]

            $path _bindImage <ButtonRelease-1>         [list $cmd $path n %x %y]
            $path _bindImage <Shift-ButtonRelease-1>   [list $cmd $path s %x %y]
            $path _bindImage <Control-ButtonRelease-1> [list $cmd $path c %x %y]
        }
        default {
            if {0 < [llength [ListBox::selection $path get]]} {
                ListBox::selection $path clear
            }
        }
    }
}
# ----------------------------------------------------------------------------
#  Command ListBox::configure
# ----------------------------------------------------------------------------
proc ListBox::configure { path args } {
    set selectmodePrevious [Widget::getoption $path -selectmode]
    set res [Widget::configure $path $args]

    if { [Widget::hasChanged $path -selectmode selectmode] } {
        _configureSelectmode $path $selectmode $selectmodePrevious
    }

    set ch0 [expr {[Widget::hasChanged $path -deltay dy]}]
    set ch1 [expr {$ch0  |
                   [Widget::hasChanged $path -padx val]   |
                   [Widget::hasChanged $path -multicolumn val]}]

    set ch2 [expr {[Widget::hasChanged $path -selectbackground val] |
                   [Widget::hasChanged $path -selectforeground val]}]

    set redraw 0
    if { [Widget::hasChanged $path -height h] || $ch0 } {
        $path.c configure -height [expr {$h*$dy}]
        if {!$ch0} {
            set redraw 1
        }
    }
    if { [Widget::hasChanged $path -width w] } {
        $path.c configure -width [expr {$w*8}]
        set redraw 1
    }

    if { [Widget::hasChanged $path -background bg] } {
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
            }
        } elseif { [string length $img] } {
            if { [string equal $type "img"] } {
                $path.c itemconfigure $idi -image $img
            } else {
                $path.c delete $idi
                $path.c create image $x0 $y0 -image $img -anchor w \
		    -tags [list img i:$item]
            }
        } else {
            $path.c delete $idi
        }
    }

    if { $cht || $chf || $chfg } {







|







420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
            }
        } elseif { [string length $img] } {
            if { [string equal $type "img"] } {
                $path.c itemconfigure $idi -image $img
            } else {
                $path.c delete $idi
                $path.c create image $x0 $y0 -image $img -anchor w \
		    -tags [list img imgbind i:$item]
            }
        } else {
            $path.c delete $idi
        }
    }

    if { $cht || $chf || $chfg } {
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474





475

476
477
478
479
480
481
482
483
484
485
486
487






488
489
490
491
492
493
494
# ----------------------------------------------------------------------------
proc ListBox::itemcget { path item option } {
    return [Widget::cget $path.$item $option]
}


# ----------------------------------------------------------------------------
#  Command ListBox::bindText
# ----------------------------------------------------------------------------
proc ListBox::bindText { path event script } {
    if { $script != "" } {
        set map [list %W $path]
        set script [string map $map $script]
	append script " \[ListBox::_get_current [list $path]\]"
    }
    $path.c bind "click" $event $script
}








# ----------------------------------------------------------------------------
#  Command ListBox::bindImage
# ----------------------------------------------------------------------------
proc ListBox::bindImage { path event script } {
    if { $script != "" } {
        set map [list %W $path]
        set script [string map $map $script]
	append script " \[ListBox::_get_current [list $path]\]"
    }
    $path.c bind "img" $event $script
}








# ----------------------------------------------------------------------------
#  Command ListBox::delete
# ----------------------------------------------------------------------------
proc ListBox::delete { path args } {
    variable $path
    upvar 0  $path data







|

|





|


>
>
>
>
>
|
>

|

|





|


>
>
>
>
>
>







462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# ----------------------------------------------------------------------------
proc ListBox::itemcget { path item option } {
    return [Widget::cget $path.$item $option]
}


# ----------------------------------------------------------------------------
#  Command ListBox::_bindText
# ----------------------------------------------------------------------------
proc ListBox::_bindText { path event script {tag click} } {
    if { $script != "" } {
        set map [list %W $path]
        set script [string map $map $script]
	append script " \[ListBox::_get_current [list $path]\]"
    }
    $path.c bind $tag $event $script
}

# ----------------------------------------------------------------------------
#  Command ListBox::bindText
# ----------------------------------------------------------------------------
proc ListBox::bindText { path event script } {
    _bindText $path $event $script clickbind
}

# ----------------------------------------------------------------------------
#  Command ListBox::_bindImage
# ----------------------------------------------------------------------------
proc ListBox::_bindImage { path event script {tag img} } {
    if { $script != "" } {
        set map [list %W $path]
        set script [string map $map $script]
	append script " \[ListBox::_get_current [list $path]\]"
    }
    $path.c bind $tag $event $script
}

# ----------------------------------------------------------------------------
#  Command ListBox::bindImage
# ----------------------------------------------------------------------------
proc ListBox::bindImage { path event script } {
    _bindImage $path $event $script imgbind
}

# ----------------------------------------------------------------------------
#  Command ListBox::delete
# ----------------------------------------------------------------------------
proc ListBox::delete { path args } {
    variable $path
    upvar 0  $path data
552
553
554
555
556
557
558

559
560
561
562
563
564
565
# ----------------------------------------------------------------------------
#  Command ListBox::selection
# ----------------------------------------------------------------------------
proc ListBox::selection { path cmd args } {
    variable $path
    upvar 0  $path data


    switch -- $cmd {
        set {
            set data(selitems) {}
            foreach item $args {
                if { [lsearch -exact $data(selitems) $item] == -1 } {
                    if { [lsearch -exact $data(items) $item] != -1 } {
                        lappend data(selitems) $item







>







569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# ----------------------------------------------------------------------------
#  Command ListBox::selection
# ----------------------------------------------------------------------------
proc ListBox::selection { path cmd args } {
    variable $path
    upvar 0  $path data

    set oldsel $data(selitems);
    switch -- $cmd {
        set {
            set data(selitems) {}
            foreach item $args {
                if { [lsearch -exact $data(selitems) $item] == -1 } {
                    if { [lsearch -exact $data(items) $item] != -1 } {
                        lappend data(selitems) $item
592
593
594
595
596
597
598
599
600


601
602
603
604
605
606
607
        includes {
            return [expr {[lsearch -exact $data(selitems) $args] != -1}]
        }
        default {
            return
        }
    }

    _redraw_idle $path 1


}


# ----------------------------------------------------------------------------
#  Command ListBox::exists
# ----------------------------------------------------------------------------
proc ListBox::exists { path item } {







|
|
>
>







610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
        includes {
            return [expr {[lsearch -exact $data(selitems) $args] != -1}]
        }
        default {
            return
        }
    }
    if {[string compare $oldsel $data(selitems)]} {
        _redraw_idle $path 1
    }
    return;
}


# ----------------------------------------------------------------------------
#  Command ListBox::exists
# ----------------------------------------------------------------------------
proc ListBox::exists { path item } {
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
            foreach id [$path.c find overlapping $xi $y $xs $y] {
                set ltags [$path.c gettags $id]
                set item  [lindex $ltags 0]
                if { [string equal $item "item"] ||
                     [string equal $item "img"]  ||
                     [string equal $item "win"] } {
                    # item is the label or image/window of the node
                    set item [string range [lindex $ltags 1] 2 end]
                    set found 1
                    break
                }
            }
            break
        }
        set  xi  $xs







|







671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
            foreach id [$path.c find overlapping $xi $y $xs $y] {
                set ltags [$path.c gettags $id]
                set item  [lindex $ltags 0]
                if { [string equal $item "item"] ||
                     [string equal $item "img"]  ||
                     [string equal $item "win"] } {
                    # item is the label or image/window of the node
                    set item [ListBox::_get_node_name $path $id]
                    set found 1
                    break
                }
            }
            break
        }
        set  xi  $xs
717
718
719
720
721
722
723






724
725
726
727
728
729
730
731
732
733

734
735
736
737
738
739
740

# ----------------------------------------------------------------------------
#  Command ListBox::see
# ----------------------------------------------------------------------------
proc ListBox::see { path item } {
    variable $path
    upvar 0  $path data







    if { [Widget::getoption $path -redraw] && $data(upd,afterid) != "" } {
        after cancel $data(upd,afterid)
        _redraw_listbox $path
    }
    set idn [$path.c find withtag n:$item]
    if { $idn != "" } {
        ListBox::_see $path $idn right
        ListBox::_see $path $idn left
    }

}


# ----------------------------------------------------------------------------
#  Command ListBox::edit
# ----------------------------------------------------------------------------
proc ListBox::edit { path item text {verifycmd ""} {clickres 0} {select 1}} {







>
>
>
>
>
>





<
<
<
<
|
>







737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754




755
756
757
758
759
760
761
762
763

# ----------------------------------------------------------------------------
#  Command ListBox::see
# ----------------------------------------------------------------------------
proc ListBox::see { path item } {
    variable $path
    upvar 0  $path data

    if {$data(nrows) == -1} {
	# Not yet realized.
	set data(seeitem) $item
	return
    }

    if { [Widget::getoption $path -redraw] && $data(upd,afterid) != "" } {
        after cancel $data(upd,afterid)
        _redraw_listbox $path
    }





    _see_item $path $item;
}


# ----------------------------------------------------------------------------
#  Command ListBox::edit
# ----------------------------------------------------------------------------
proc ListBox::edit { path item text {verifycmd ""} {clickres 0} {select 1}} {
934
935
936
937
938
939
940














941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
        set x0  [expr {int([lindex $bbox 0]/$dx)}]
        if { $x0 < $xv0 } {
            $path.c xview scroll [expr {$x0-$xv0}] units
        }
    }
}
















# ----------------------------------------------------------------------------
#  Command ListBox::_update_scrollregion
# ----------------------------------------------------------------------------
proc ListBox::_update_scrollregion { path } {
    set bd   [$path.c cget -borderwidth]
    set ht   [$path.c cget -highlightthickness]
    set bd   [expr {2*($bd + $ht)}]
    set w    [expr {[winfo width  $path] - $bd}]
    set h    [expr {[winfo height $path] - $bd}]
    set xinc [$path.c cget -xscrollincrement]
    set yinc [$path.c cget -yscrollincrement]
    set bbox [$path.c bbox item win img]
    if { [llength $bbox] } {
        set xs [lindex $bbox 2]
        set ys [lindex $bbox 3]

        if { $w < $xs } {
            set w [expr {int($xs)}]
            if { [set r [expr {$w % $xinc}]] } {
                set w [expr {$w+$xinc-$r}]
            }
        }
        if { $h < $ys } {
            set h [expr {int($ys)}]
            if { [set r [expr {$h % $yinc}]] } {
                set h [expr {$h+$yinc-$r}]
            }
        }
    }

    $path.c configure -scrollregion [list 0 0 $w $h]
}









>
>
>
>
>
>
>
>
>
>
>
>
>
>


















<
<
|
|
<

<
<
|
<







957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995


996
997

998


999

1000
1001
1002
1003
1004
1005
1006
        set x0  [expr {int([lindex $bbox 0]/$dx)}]
        if { $x0 < $xv0 } {
            $path.c xview scroll [expr {$x0-$xv0}] units
        }
    }
}


# ----------------------------------------------------------------------------
#  Command ListBox::_see_item
# ----------------------------------------------------------------------------
proc ListBox::_see_item { path item } {
    set idn [$path.c find withtag n:$item]
    if { $idn != "" } {
        set idi [$path.c find withtag i:$item]
        if { $idi == "" } { set idi $idn }
        _see $path $idn right
        _see $path $idi left
    }
}


# ----------------------------------------------------------------------------
#  Command ListBox::_update_scrollregion
# ----------------------------------------------------------------------------
proc ListBox::_update_scrollregion { path } {
    set bd   [$path.c cget -borderwidth]
    set ht   [$path.c cget -highlightthickness]
    set bd   [expr {2*($bd + $ht)}]
    set w    [expr {[winfo width  $path] - $bd}]
    set h    [expr {[winfo height $path] - $bd}]
    set xinc [$path.c cget -xscrollincrement]
    set yinc [$path.c cget -yscrollincrement]
    set bbox [$path.c bbox item win img]
    if { [llength $bbox] } {
        set xs [lindex $bbox 2]
        set ys [lindex $bbox 3]

        if { $w < $xs } {


            set w [expr {$xs + $w % $xinc}]
        }

        if { $h < $ys } {


            set h [expr {$ys + $h % $yinc}]

        }
    }

    $path.c configure -scrollregion [list 0 0 $w $h]
}


995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037

1038
1039
1040
1041
1042
1043
1044
1045
proc ListBox::_draw_item {path item x0 x1 y bg selfill multi ww} {
    set indent  [Widget::getoption $path.$item -indent]
    set i [$path.c create text [expr {$x1+$indent}] $y \
        -text   [Widget::getoption $path.$item -text] \
        -fill   [_getoption        $path $item -foreground] \
        -font   [_getoption        $path $item -font] \
        -anchor w \
        -tags   [list item n:$item click]]

    if { $selfill && !$multi } {
        set bbox  [$path.c bbox n:$item]
        set bbox  [list 0 [lindex $bbox 1] $ww [lindex $bbox 3]]
        set tags  [list box b:$item click]
        $path.c create rect $bbox -fill $bg -width 0 -tags $tags
        $path.c raise $i
    }

    if { [set win [Widget::getoption $path.$item -window]] != "" } {
        $path.c create window [expr {$x0+$indent}] $y \
            -window $win -anchor w -tags [list win i:$item]
    } elseif { [set img [Widget::getoption $path.$item -image]] != "" } {
        $path.c create image [expr {$x0+$indent}] $y \
            -image $img -anchor w -tags [list img i:$item]
    }

    _set_help $path $item
}


# ----------------------------------------------------------------------------
#  Command ListBox::_redraw_items
# ----------------------------------------------------------------------------
proc ListBox::_redraw_items { path } {
    variable $path
    upvar 0  $path data

    set cursor [$path.c cget -cursor]
    $path.c configure -cursor watch
    update idletasks ; # make sure watch cursor is reflected
    set dx   [Widget::getoption $path -deltax]
    set dy   [Widget::getoption $path -deltay]
    set padx [Widget::getoption $path -padx]
    set y0   [expr {$dy/2}]

    set x0   4
    set x1   [expr {$x0+$padx}]
    set nitem 0
    set width 0
    set drawn {}
    set data(xlist) {}
    if { [Widget::cget $path -multicolumn] } {
        set nrows $data(nrows)







|




|









|




















>
|







1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
proc ListBox::_draw_item {path item x0 x1 y bg selfill multi ww} {
    set indent  [Widget::getoption $path.$item -indent]
    set i [$path.c create text [expr {$x1+$indent}] $y \
        -text   [Widget::getoption $path.$item -text] \
        -fill   [_getoption        $path $item -foreground] \
        -font   [_getoption        $path $item -font] \
        -anchor w \
        -tags   [list item n:$item click clickbind]]

    if { $selfill && !$multi } {
        set bbox  [$path.c bbox n:$item]
        set bbox  [list 0 [lindex $bbox 1] $ww [lindex $bbox 3]]
        set tags  [list box b:$item click clickbind]
        $path.c create rect $bbox -fill $bg -width 0 -tags $tags
        $path.c raise $i
    }

    if { [set win [Widget::getoption $path.$item -window]] != "" } {
        $path.c create window [expr {$x0+$indent}] $y \
            -window $win -anchor w -tags [list win i:$item]
    } elseif { [set img [Widget::getoption $path.$item -image]] != "" } {
        $path.c create image [expr {$x0+$indent}] $y \
            -image $img -anchor w -tags [list img imgbind i:$item]
    }

    _set_help $path $item
}


# ----------------------------------------------------------------------------
#  Command ListBox::_redraw_items
# ----------------------------------------------------------------------------
proc ListBox::_redraw_items { path } {
    variable $path
    upvar 0  $path data

    set cursor [$path.c cget -cursor]
    $path.c configure -cursor watch
    update idletasks ; # make sure watch cursor is reflected
    set dx   [Widget::getoption $path -deltax]
    set dy   [Widget::getoption $path -deltay]
    set padx [Widget::getoption $path -padx]
    set y0   [expr {$dy/2}]
    # Changed from 4 to 2 to make highlight work and look nice for listbox with image as well
    set x0   2
    set x1   [expr {$x0+$padx}]
    set nitem 0
    set width 0
    set drawn {}
    set data(xlist) {}
    if { [Widget::cget $path -multicolumn] } {
        set nrows $data(nrows)
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118









1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
    upvar 0  $path data

    set selbg   [Widget::getoption $path -selectbackground]
    set selfg   [Widget::getoption $path -selectforeground]
    set selfill [Widget::getoption $path -selectfill]
    set multi   [Widget::getoption $path -multicolumn]
    foreach id [$path.c find withtag sel] {
        set item [string range [lindex [$path.c gettags $id] 1] 2 end]
        if {-1 == [lsearch -exact $data(upd,delete) $item]} {
            $path.c itemconfigure "n:$item" \
                -fill [_getoption $path $item -foreground]
        }
    }
    $path.c delete sel
    if {$selfill && !$multi} {
	# cache window width for use below
	set width [winfo width $path]
    }
    foreach item $data(selitems) {
        set bbox [$path.c bbox "n:$item"]
        if { [llength $bbox] } {









	    if { $selfill && !$multi } {
		# With -selectfill, make box occupy full width of widget
		set bbox [list 0 [lindex $bbox 1] $width [lindex $bbox 3]]
	    }
            set tags [list sel s:$item click]
            set id [$path.c create rectangle $bbox \
                -fill $selbg -outline $selbg -tags $tags]
	    if {$selfg != ""} {
		# Don't allow an empty fill - that would be transparent
		$path.c itemconfigure "n:$item" -fill $selfg
	    }
            $path.c lower $id







|













>
>
>
>
>
>
>
>
>




|







1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
    upvar 0  $path data

    set selbg   [Widget::getoption $path -selectbackground]
    set selfg   [Widget::getoption $path -selectforeground]
    set selfill [Widget::getoption $path -selectfill]
    set multi   [Widget::getoption $path -multicolumn]
    foreach id [$path.c find withtag sel] {
        set item [ListBox::_get_node_name $path $id]
        if {-1 == [lsearch -exact $data(upd,delete) $item]} {
            $path.c itemconfigure "n:$item" \
                -fill [_getoption $path $item -foreground]
        }
    }
    $path.c delete sel
    if {$selfill && !$multi} {
	# cache window width for use below
	set width [winfo width $path]
    }
    foreach item $data(selitems) {
        set bbox [$path.c bbox "n:$item"]
        if { [llength $bbox] } {
            set imgbox [$path.c bbox i:$item]
            lassign $bbox x0 y0 x1 y1;
            if {[string compare "" $imgbox]} {
                # image may exist and may be higher than text!
                lassign $imgbox ix0 iy0 ix1 iy1;
                set bbox [list $x0 [expr {$iy0<$y0?$iy0:$y0}] $x1 [expr {$iy1<$y1?$iy1:$y1}]];
            } else {
                set bbox [list $x0 [lindex $bbox 1] $x1 [lindex $bbox 3]]
            }
	    if { $selfill && !$multi } {
		# With -selectfill, make box occupy full width of widget
		set bbox [list 0 [lindex $bbox 1] $width [lindex $bbox 3]]
	    }
            set tags [list sel s:$item click clickbind]
            set id [$path.c create rectangle $bbox \
                -fill $selbg -outline $selbg -tags $tags]
	    if {$selfg != ""} {
		# Don't allow an empty fill - that would be transparent
		$path.c itemconfigure "n:$item" -fill $selfg
	    }
            $path.c lower $id
1146
1147
1148
1149
1150
1151
1152



1153
1154

1155
1156
1157
1158
1159
1160
1161
            _redraw_items $path
        }
        _redraw_selection $path
        _update_scrollregion $path
        if {[Widget::cget $path -selectfill]} {
            _update_select_fill $path
        }



        set data(upd,level)   0
        set data(upd,afterid) ""

    }
}


# ----------------------------------------------------------------------------
#  Command ListBox::_redraw_idle
# ----------------------------------------------------------------------------







>
>
>


>







1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
            _redraw_items $path
        }
        _redraw_selection $path
        _update_scrollregion $path
        if {[Widget::cget $path -selectfill]} {
            _update_select_fill $path
        }
	if {![string equal $data(seeitem) ""]} {
	    _see_item $path $data(seeitem);
	}
        set data(upd,level)   0
        set data(upd,afterid) ""
	set data(seeitem) "";
    }
}


# ----------------------------------------------------------------------------
#  Command ListBox::_redraw_idle
# ----------------------------------------------------------------------------
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
proc ListBox::_init_drag_cmd { path X Y top } {
    set path [winfo parent $path]
    set ltags [$path.c gettags current]
    set item  [lindex $ltags 0]
    if { [string equal $item "item"] ||
         [string equal $item "img"]  ||
         [string equal $item "win"] } {
        set item [string range [lindex $ltags 1] 2 end]
        if {[llength [set cmd [Widget::getoption $path -draginitcmd]]]} {
            return [uplevel \#0 $cmd [list $path $item $top]]
        }
        if { [set type [Widget::getoption $path -dragtype]] == "" } {
            set type "LISTBOX_ITEM"
        }
        if { [set img [Widget::getoption $path.$item -image]] != "" } {







|







1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
proc ListBox::_init_drag_cmd { path X Y top } {
    set path [winfo parent $path]
    set ltags [$path.c gettags current]
    set item  [lindex $ltags 0]
    if { [string equal $item "item"] ||
         [string equal $item "img"]  ||
         [string equal $item "win"] } {
        set item [ListBox::_get_node_name $path]
        if {[llength [set cmd [Widget::getoption $path -draginitcmd]]]} {
            return [uplevel \#0 $cmd [list $path $item $top]]
        }
        if { [set type [Widget::getoption $path -dragtype]] == "" } {
            set type "LISTBOX_ITEM"
        }
        if { [set img [Widget::getoption $path.$item -image]] != "" } {
1618
1619
1620
1621
1622
1623
1624
1625












1626
1627

1628









1629
1630
1631
1632
1633
1634
1635
    switch -- $cmd {
        "add" - "clear" - "remove" - "set" {
            event generate $path <<ListboxSelect>>
        }
    }
}














proc ListBox::_get_current { path } {
    set t [$path.c gettags current]

    return [string range [lindex $t 1] 2 end]









}


# ListBox::_drag_and_drop --
#
#	A default command to handle drag-and-drop functions local to this
#       listbox.  With this as the default -dropcmd, the user can simply








>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
|
>
>
>
>
>
>
>
>
>







1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
    switch -- $cmd {
        "add" - "clear" - "remove" - "set" {
            event generate $path <<ListboxSelect>>
        }
    }
}


# ListBox::_get_node_name --
#
#	Given a listbox item, get the name of the node represented by that
#	item.
#
# Arguments:
#	path		listbox to query
#	item		Optional item to examine; if omitted, 
#			defaults to "current"
#
# Results:
#	node	name of the listbox node.
proc ListBox::_get_node_name {path {item current}} {
    set tags [$path.c gettags $item]
    if {[lindex $tags 0] == "img"} {
        set node [string range [lindex $tags 2] 2 end]
    } else {
        set node [string range [lindex $tags 1] 2 end]
    }
    return $node
}


proc ListBox::_get_current { path } {
    return [ListBox::_get_node_name $path]
}


# ListBox::_drag_and_drop --
#
#	A default command to handle drag-and-drop functions local to this
#       listbox.  With this as the default -dropcmd, the user can simply
1660
1661
1662
1663
1664
1665
1666








1667



1668




1669
1670
1671

1672
1673



1674
1675
1676
1677
1678
1679
1680
            set idx [$path index $i]
        }
        "widget" {
            set idx [llength $items]
        }
    }









    if {$idx > [$path index $startItem]} { incr idx -1 }








    if {[string equal $operation "copy"]} {
        set options [Widget::options $path.$startItem]
        eval [linsert $options 0 $path insert $idx $startItem\#auto]

    } else {
        $path move $startItem $idx



    }
}


proc ListBox::_keyboard_navigation { path dir } {
    variable $path
    upvar 0  $path data







>
>
>
>
>
>
>
>
|
>
>
>
|
>
>
>
>
|
|
|
>
|
|
>
>
>







1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
            set idx [$path index $i]
        }
        "widget" {
            set idx [llength $items]
        }
    }

    # Check if startItem is part of the current selection and process the
    # whole selection if so
    set selItems [selection $path get]
    if {-1 != [lsearch -exact $selItems $startItem]} {
        set dragItems $selItems
    } else {
        set dragItems [list $startItem]
    }

    # get drag indexes (to sort them)
	foreach dragItem $dragItems {
        lappend dragIdx [$path index $dragItem]
    }
    foreach pos [lsort -integer -indices $dragIdx] {
        set dragItem [lindex $dragItems $pos]
        set dragIdx [$path index $dragItem]
        if {$idx > $dragIdx} { incr idx -1 }
        if {[string equal $operation "copy"]} {
            set options [Widget::options $path.$dragItem]
            eval [linsert $options 0 $path insert $idx $dragItem\#auto]
            incr idx
        } else {
            $path move $dragItem $idx
            set idx [$path index $dragItem]
            incr idx
        }
    }
}


proc ListBox::_keyboard_navigation { path dir } {
    variable $path
    upvar 0  $path data

Changes to mainframe.tcl.

1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  mainframe.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: mainframe.tcl,v 1.24 2009/07/01 14:41:30 oehhar Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - MainFrame::create
#     - MainFrame::configure
#     - MainFrame::cget
#     - MainFrame::getframe
#     - MainFrame::addtoolbar



|







1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  mainframe.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: mainframe.tcl,v 1.24.2.3 2011/05/25 15:10:07 oehhar Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - MainFrame::create
#     - MainFrame::configure
#     - MainFrame::cget
#     - MainFrame::getframe
#     - MainFrame::addtoolbar
33
34
35
36
37
38
39


40

41













42

43
44
45
46
47
48
49
50
51

52
53
54
55
56
57
58
59
60
61

62
63
64
65
66
67
68
	    rename {
	-maximum    -progressmax
	-variable   -progressvar
	-type       -progresstype
	-foreground -progressfg
    }



    Widget::declare MainFrame {

	{-width        TkResource 0      0 frame}













	{-height       TkResource 0      0 frame}

	{-background   TkResource ""     0 frame}
	{-textvariable String     ""     0}
	{-menu         String     {}     1}
	{-separator    Enum       both   1 {none top bottom both}}
	{-bg           Synonym    -background}

	{-menubarfont   String     ""  0}
	{-menuentryfont String     ""  0}
	{-statusbarfont String     ""  0}

    }

    Widget::addmap MainFrame "" .frame  {-width {} -height {} -background {}}
    Widget::addmap MainFrame "" .topf   {-background {}}
    Widget::addmap MainFrame "" .botf   {-background {}}
    Widget::addmap MainFrame "" .status {-background {}}
    Widget::addmap MainFrame "" .status.label {-background {}}
    Widget::addmap MainFrame "" .status.indf  {-background {}}
    Widget::addmap MainFrame "" .status.prgf  {-background {}}
    Widget::addmap MainFrame ProgressBar .status.prg {-background {} -background -troughcolor}


    variable _widget
}


# ----------------------------------------------------------------------------
#  Command MainFrame::create







>
>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
|
|
|
|

|
|
|
>
|

|
|
|
|
|
|
|
|
>







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	    rename {
	-maximum    -progressmax
	-variable   -progressvar
	-type       -progresstype
	-foreground -progressfg
    }

    if {[Widget::theme]} {
        # No option -background for themed MainFrame
        Widget::declare MainFrame {
            {-width         TkResource 0      0 frame}
            {-height        TkResource 0      0 frame}
            {-textvariable  String     ""     0}
            {-menu          String     {}     1}
            {-separator     Enum       both   1 {none top bottom both}}

            {-menubarfont   String     ""  0}
            {-menuentryfont String     ""  0}
            {-statusbarfont String     ""  0}
            {-sizegrip      Boolean    0   1}
        }

        Widget::addmap MainFrame "" .frame  {-width {} -height {}}
    } else {
        Widget::declare MainFrame {
            {-width         TkResource 0      0 frame}
            {-height        TkResource 0      0 frame}
            {-background    TkResource ""     0 frame}
            {-textvariable  String     ""     0}
            {-menu          String     {}     1}
            {-separator     Enum       both   1 {none top bottom both}}
            {-bg            Synonym    -background}

            {-menubarfont   String     ""  0}
            {-menuentryfont String     ""  0}
            {-statusbarfont String     ""  0}
            {-sizegrip      Boolean    0   1}
        }

        Widget::addmap MainFrame "" .frame  {-width {} -height {} -background {}}
        Widget::addmap MainFrame "" .topf   {-background {}}
        Widget::addmap MainFrame "" .botf   {-background {}}
        Widget::addmap MainFrame "" .status {-background {}}
        Widget::addmap MainFrame "" .status.label {-background {}}
        Widget::addmap MainFrame "" .status.indf  {-background {}}
        Widget::addmap MainFrame "" .status.prgf  {-background {}}
        Widget::addmap MainFrame ProgressBar .status.prg {-background {} -background -troughcolor}
    }

    variable _widget
}


# ----------------------------------------------------------------------------
#  Command MainFrame::create
162
163
164
165
166
167
168



169
170
171
172
173
174
175
176
177
178
179
180
181
182

183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202

203
204
205
206
207
208
209

    set progress [eval [list ProgressBar::create $status.prg] \
		      [Widget::subcget $path .status.prg] \
                      -width       50 \
                      -height      [expr {[winfo reqheight $label]-2}] \
                      -borderwidth 1 \
                      -relief      sunken]



    pack $status    -in $botframe -fill x -pady 2
    pack $botframe  -side bottom -fill x
    pack $userframe -fill both -expand yes

    set _widget($path,top)      $top
    set _widget($path,ntoolbar) 0
    set _widget($path,nindic)   0

    set menu [Widget::getoption $path -menu]
    if { [llength $menu] } {
        _create_menubar $path $menu
    }

    bind $path <Destroy> [list MainFrame::_destroy %W]


    return [Widget::create MainFrame $path]
}


# ----------------------------------------------------------------------------
#  Command MainFrame::configure
# ----------------------------------------------------------------------------
proc MainFrame::configure { path args } {
    variable _widget

    set res [Widget::configure $path $args]

    if { [Widget::hasChanged $path -textvariable newv] } {
        uplevel \#0 $path.status.label configure -textvariable [list $newv]
    }

    # The ttk frame has no -background
    if {![Widget::theme] && [Widget::hasChanged $path -background bg] } {
	if {$::tcl_platform(platform) == "unix"} {

	    set listmenu [$_widget($path,top) cget -menu]
	    while { [llength $listmenu] } {
		set newlist {}
		foreach menu $listmenu {
		    $menu configure -background $bg
		    set newlist [concat $newlist [winfo children $menu]]
		}







>
>
>














>



















|
>







181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233

    set progress [eval [list ProgressBar::create $status.prg] \
		      [Widget::subcget $path .status.prg] \
                      -width       50 \
                      -height      [expr {[winfo reqheight $label]-2}] \
                      -borderwidth 1 \
                      -relief      sunken]
    if {[Widget::theme] && [Widget::getoption $path -sizegrip]} {
	pack [ttk::sizegrip $botframe.sg] -side right -anchor se
    }
    pack $status    -in $botframe -fill x -pady 2
    pack $botframe  -side bottom -fill x
    pack $userframe -fill both -expand yes

    set _widget($path,top)      $top
    set _widget($path,ntoolbar) 0
    set _widget($path,nindic)   0

    set menu [Widget::getoption $path -menu]
    if { [llength $menu] } {
        _create_menubar $path $menu
    }

    bind $path <Destroy> [list MainFrame::_destroy %W]
    bind $path <<TkWorldChanged>> [list MainFrame::_world_changed  %W %d]

    return [Widget::create MainFrame $path]
}


# ----------------------------------------------------------------------------
#  Command MainFrame::configure
# ----------------------------------------------------------------------------
proc MainFrame::configure { path args } {
    variable _widget

    set res [Widget::configure $path $args]

    if { [Widget::hasChanged $path -textvariable newv] } {
        uplevel \#0 $path.status.label configure -textvariable [list $newv]
    }

    # The ttk frame has no -background
    if {![Widget::theme] && [Widget::hasChanged $path -background bg] } {
	if {($::tcl_platform(platform) == "unix")
	        && (0 != [string compare [tk windowingsystem] "aqua"])} {
	    set listmenu [$_widget($path,top) cget -menu]
	    while { [llength $listmenu] } {
		set newlist {}
		foreach menu $listmenu {
		    $menu configure -background $bg
		    set newlist [concat $newlist [winfo children $menu]]
		}
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
	    set sbfnt ""
	}
	for {set index 0} {$index<$_widget($path,nindic)} {incr index} {
	    set indic $path.status.indf.f$index
	    eval [list $indic configure] $sbfnt
	}
	eval [list $path.status.label configure] $sbfnt
	$path.status configure -height [winfo reqheight $path.status.label]

	$path.status.prg configure \
		-height [expr {[winfo reqheight $path.status.label]-2}]
    }

    return $res
}


# ----------------------------------------------------------------------------
#  Command MainFrame::cget
# ----------------------------------------------------------------------------
proc MainFrame::cget { path option } {
    return [Widget::cget $path $option]
}







<
|
<
<




<







287
288
289
290
291
292
293

294


295
296
297
298

299
300
301
302
303
304
305
	    set sbfnt ""
	}
	for {set index 0} {$index<$_widget($path,nindic)} {incr index} {
	    set indic $path.status.indf.f$index
	    eval [list $indic configure] $sbfnt
	}
	eval [list $path.status.label configure] $sbfnt

        _evaluate_status_height $path


    }

    return $res
}


# ----------------------------------------------------------------------------
#  Command MainFrame::cget
# ----------------------------------------------------------------------------
proc MainFrame::cget { path option } {
    return [Widget::cget $path $option]
}
299
300
301
302
303
304
305
306
307
308
309
310

311
312
313
314
315
316
317
318

319
320
321
322
323
324
325
proc MainFrame::addtoolbar { path } {
    global   tcl_platform
    variable _widget

    set index     $_widget($path,ntoolbar)
    set toolframe $path.topf.f$index
    set toolbar   $path.topf.tb$index
    set bg        [Widget::getoption $path -background]
    if { $tcl_platform(platform) == "unix" } {
	if {[Widget::theme]} {
	    ttk::frame $toolframe -padding 1
	} else {

	    frame $toolframe -relief raised -borderwidth 1 \
		-takefocus 0 -highlightthickness 0 -background $bg
	}
    } else {
	if {[Widget::theme]} {
	    ttk::frame $toolframe
	    set sep [ttk::separator $toolframe.sep -orient horizontal]
	} else {

	    frame $toolframe -relief flat -borderwidth 0 -takefocus 0 \
		-highlightthickness 0 -background $bg
	    set sep [Separator::create $toolframe.sep -orient horizontal -background $bg]
	}
        pack $sep -fill x
    }
    if {[Widget::theme]} {







<




>








>







319
320
321
322
323
324
325

326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
proc MainFrame::addtoolbar { path } {
    global   tcl_platform
    variable _widget

    set index     $_widget($path,ntoolbar)
    set toolframe $path.topf.f$index
    set toolbar   $path.topf.tb$index

    if { $tcl_platform(platform) == "unix" } {
	if {[Widget::theme]} {
	    ttk::frame $toolframe -padding 1
	} else {
	    set bg [Widget::getoption $path -background]
	    frame $toolframe -relief raised -borderwidth 1 \
		-takefocus 0 -highlightthickness 0 -background $bg
	}
    } else {
	if {[Widget::theme]} {
	    ttk::frame $toolframe
	    set sep [ttk::separator $toolframe.sep -orient horizontal]
	} else {
	    set bg [Widget::getoption $path -background]
	    frame $toolframe -relief flat -borderwidth 0 -takefocus 0 \
		-highlightthickness 0 -background $bg
	    set sep [Separator::create $toolframe.sep -orient horizontal -background $bg]
	}
        pack $sep -fill x
    }
    if {[Widget::theme]} {
496
497
498
499
500
501
502






















503
504
505
506



507
508
509
510

511

512
513
514
515
516
517
518
519
520
521

522
523
524
525
526
527
528
529
530
531








532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556

557
558
559
560
561
562
563

    # Unset all of the state vars associated with this main frame.
    foreach index [array names _widget $path,*] {
	unset _widget($index)
    }
}
























# ----------------------------------------------------------------------------
#  Command MainFrame::_create_menubar
# ----------------------------------------------------------------------------



proc MainFrame::_create_menubar { path descmenu } {
    variable _widget
    global    tcl_platform


    set top $_widget($path,top)


    foreach {v x} {mbfnt -menubarfont mefnt -menuentryfont} {
	if {[string length [Widget::getoption $path $x]]} {
	    set $v [list -font [Widget::getoption $path $x]]
	} else {
	    set $v ""
	}
    }

    if {![Widget::theme] && $tcl_platform(platform) == "unix"} {

	set menuopts [list -background [Widget::getoption $path -background] \
			  -borderwidth 1]
    } else {
	set menuopts [list]
    }
    set menubar [eval [list menu $top.menubar -tearoff 0] $menuopts $mbfnt]
    $top configure -menu $menubar

    set count 0
    foreach {name tags menuid tearoff entries} $descmenu {








        set opt  [_parse_name $name]
        if {[string length $menuid]
	    && ![info exists _widget($path,menuid,$menuid)] } {
            # menu has identifier
	    # we use it for its pathname, to enable special menu entries
	    # (help, system, ...)
	    set menu $menubar.$menuid
        } else {
	    set menu $menubar.menu$count
	}
        eval [list $menubar add cascade] $opt [list -menu $menu]
        eval [list menu $menu -tearoff $tearoff] $menuopts $mefnt
        foreach tag $tags {
            lappend _widget($path,tags,$tag) $menubar $count
	    # ericm@scriptics:  Add a tagstate tracker
	    if { ![info exists _widget($path,tagstate,$tag)] } {
		set _widget($path,tagstate,$tag) 1
	    }
        }
	# ericm@scriptics:  Add mapping from menu items to tags
	set _widget($path,menutags,[list $menubar $count]) $tags

        if { [string length $menuid] } {
            # menu has identifier
            set _widget($path,menuid,$menuid) $menu

        }
        _create_entries $path $menu $menuopts $entries
        incr count
    }
}









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




>
>
>
|



>
|
>









|
>










>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
>







517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621

    # Unset all of the state vars associated with this main frame.
    foreach index [array names _widget $path,*] {
	unset _widget($index)
    }
}

# -----------------------------------------------------------------------------
#  Command MainFrame::_world_changed
# -----------------------------------------------------------------------------
proc MainFrame::_world_changed { path type} {
    # Check if font changed
    if {$type == "FontChanged"} {
        _evaluate_status_height $path
    }
}

# -----------------------------------------------------------------------------
#  Command MainFrame::_evaluate_status_height
# -----------------------------------------------------------------------------
# Change the status bar height in dependence of the status bar font.
# This is used on configure -statusfont and on world change, where the font
# height may also change.
proc MainFrame::_evaluate_status_height {path} {
    $path.status configure -height [winfo reqheight $path.status.label]

    $path.status.prg configure \
            -height [expr {[winfo reqheight $path.status.label]-2}]
}

# ----------------------------------------------------------------------------
#  Command MainFrame::_create_menubar
# ----------------------------------------------------------------------------
# For Android, a menubutton is more appropriate.
# To support this, the menubutton widget may be passed as 3rd
# parameter.
proc MainFrame::_create_menubar { path descmenu {top ""} } {
    variable _widget
    global    tcl_platform

    if {![string length $top]} {
        set top $_widget($path,top)
    }

    foreach {v x} {mbfnt -menubarfont mefnt -menuentryfont} {
	if {[string length [Widget::getoption $path $x]]} {
	    set $v [list -font [Widget::getoption $path $x]]
	} else {
	    set $v ""
	}
    }

    if { ![Widget::theme] && $tcl_platform(platform) == "unix"
        && [tk windowingsystem] !="aqua" } {
	set menuopts [list -background [Widget::getoption $path -background] \
			  -borderwidth 1]
    } else {
	set menuopts [list]
    }
    set menubar [eval [list menu $top.menubar -tearoff 0] $menuopts $mbfnt]
    $top configure -menu $menubar

    set count 0
    foreach {name tags menuid tearoff entries} $descmenu {
        # Check if only one menu with an empty name is given
        # In this case, remove the top level menu item
        # This allows to also have checkboxes and commands at the top level.
        if {![string length $name] && 5 == [llength $descmenu]} {
            # A single namesless menu - skip the first level to allow other
            # than cascade as first level.
            set menu $menubar
        } else {
            set opt  [_parse_name $name]
            if {[string length $menuid]
                    && ![info exists _widget($path,menuid,$menuid)] } {
                # menu has identifier
                # we use it for its pathname, to enable special menu entries
                # (help, system, ...)
                set menu $menubar.$menuid
            } else {
                set menu $menubar.menu$count
            }
            eval [list $menubar add cascade] $opt [list -menu $menu]
            eval [list menu $menu -tearoff $tearoff] $menuopts $mefnt
            foreach tag $tags {
                lappend _widget($path,tags,$tag) $menubar $count
                # ericm@scriptics:  Add a tagstate tracker
                if { ![info exists _widget($path,tagstate,$tag)] } {
                    set _widget($path,tagstate,$tag) 1
                }
            }
            # ericm@scriptics:  Add mapping from menu items to tags
            set _widget($path,menutags,[list $menubar $count]) $tags

            if { [string length $menuid] } {
                # menu has identifier
                set _widget($path,menuid,$menuid) $menu
            }
        }
        _create_entries $path $menu $menuopts $entries
        incr count
    }
}


617
618
619
620
621
622
623





624




625
626
627
628
629
630
631
            DynamicHelp::register $menu menuentry $count $desc
        }

        # entry accelerator
        set accel [_parse_accelerator [lindex $entry 4]]
        if { [llength $accel] } {
            lappend opt -accelerator [lindex $accel 0]





            bind $_widget($path,top) [lindex $accel 1] [list $menu invoke $count]




        }

        # user options
        set useropt [lrange $entry 5 end]
        if { [string equal $type "command"] ||
             [string equal $type "radiobutton"] ||
             [string equal $type "checkbutton"] } {







>
>
>
>
>
|
>
>
>
>







675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
            DynamicHelp::register $menu menuentry $count $desc
        }

        # entry accelerator
        set accel [_parse_accelerator [lindex $entry 4]]
        if { [llength $accel] } {
            lappend opt -accelerator [lindex $accel 0]
            foreach event [lindex $accel 1] {
                bind $_widget($path,top) $event [list $menu invoke $count]
            }
            foreach event [lindex $accel 2] {
                if {[bind $_widget($path,top) $event] == {}} {
                    bind $_widget($path,top) $event { # do nothing }
                } else {
                    # The existing binding will intercept these events.
                }
            }
        }

        # user options
        set useropt [lrange $entry 5 end]
        if { [string equal $type "command"] ||
             [string equal $type "radiobutton"] ||
             [string equal $type "checkbutton"] } {
653
654
655
656
657
658
659
660
661








662
663
664
665
666

667
668
669
670

671
672



673
674
675
676
677
678

679
680
681
682
683
684
685

686
687
688
689









690
691
692
693


694



















































695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710

711
712
    }
}


# MainFrame::_parse_accelerator --
#
#	Given a key combo description, construct an appropriate human readable
#	string (for display on as a menu accelerator) and the corresponding
#	bind event.








#
# Arguments:
#	desc	a list with the following format:
#			?sequence? key
#		sequence may be None, Ctrl, Alt, or CtrlAlt

#		key may be any key
#
# Results:
#	{accel event}	a list containing the accelerator string and the event


proc MainFrame::_parse_accelerator { desc } {



    if { [llength $desc] == 1 } {
	set seq None
	set key [string tolower [lindex $desc 0]]
	# If the key is an F key (ie, F1, F2, etc), it has to be capitalized
	if {[regexp {^f([1-9]|([12][0-9]|3[0-5]))$} $key]} {
	    set key [string toupper $key]

	}
    } elseif { [llength $desc] == 2 } {
        set seq [lindex $desc 0]
        set key [string tolower [lindex $desc 1]]
	# If the key is an F key (ie, F1, F2, etc), it has to be capitalized
	if {[regexp {^f([1-9]|([12][0-9]|3[0-5]))$} $key]} {
	    set key [string toupper $key]

	}
    } else {
	return {}
    }









    switch -- $seq {
	None {
	    set accel "[string toupper $key]"
	    set event "<Key-$key>"


	}



















































	Ctrl {
	    set accel "Ctrl+[string toupper $key]"
	    set event "<Control-Key-$key>"
	}
	Alt {
	    set accel "Alt+[string toupper $key]"
	    set event "<Alt-Key-$key>"
	}
	CtrlAlt {
	    set accel "Ctrl+Alt+[string toupper $key]"
	    set event "<Control-Alt-Key-$key>"
	}
	default {
	    return -code error "invalid accelerator code $seq"
	}
    }

    return [list $accel $event]
}







|
|
>
>
>
>
>
>
>
>




|
>



|
>


>
>
>






>







>




>
>
>
>
>
>
>
>
>


|
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|
|


|
|


|
|





>
|

720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
    }
}


# MainFrame::_parse_accelerator --
#
#	Given a key combo description, construct an appropriate human readable
#	string (for display on as a menu accelerator), a list of the
#	corresponding bind events, and a separate list of bind events that need
#	to be blocked.
#
# 	When argument $desc does not include "Shift", the bindings to $events
# 	will in some cases also intercept events that have the modifier "Shift",
# 	unless more specific bindings $blockEvents exist to the latter.  This
# 	situation occurs, for example, when a Cmd binding exists without a
# 	corresponding ShiftCmd binding.  The list of events that need to be
#       blocked is returned as the third element of the result.
#
# Arguments:
#	desc	a list with the following format:
#			?sequence? key
#		sequence may be None, Ctrl, Alt, CtrlAlt, Shift, Cmd or
#			ShiftCmd
#		key may be any key
#
# Results:
#	{accel events blockEvents}  a list containing the accelerator string and
#	                            two lists of events

proc MainFrame::_parse_accelerator { desc } {
    variable _widget

    set fKey 0
    if { [llength $desc] == 1 } {
	set seq None
	set key [string tolower [lindex $desc 0]]
	# If the key is an F key (ie, F1, F2, etc), it has to be capitalized
	if {[regexp {^f([1-9]|([12][0-9]|3[0-5]))$} $key]} {
	    set key [string toupper $key]
	    set fKey 1
	}
    } elseif { [llength $desc] == 2 } {
        set seq [lindex $desc 0]
        set key [string tolower [lindex $desc 1]]
	# If the key is an F key (ie, F1, F2, etc), it has to be capitalized
	if {[regexp {^f([1-9]|([12][0-9]|3[0-5]))$} $key]} {
	    set key [string toupper $key]
	    set fKey 1
	}
    } else {
	return {}
    }

    # Plain "Shift" can be used only with F keys, but "ShiftCmd" is allowed.
    if {[string equal $seq "Shift"] && (!$fKey)} {
        return -code error {Shift accelerator can be used only with F keys}
    }

    set blockEvents {}
    set upc [string toupper $key]

    switch -- $seq {
	None {
	    set accel "$upc"
	    set events [list "<Key-$key>"]
	    if {$fKey} {
		set blockEvents [list "<Shift-Key-$key>"]
	    }
	}
	Shift {
	    # Used only with Function keys.
	    set accel "Shift+$upc"
	    set events [list "<Shift-Key-$key>"]
	}
	Cmd {
	    set accel "Cmd+$upc"

	    if {    [string equal [tk windowingsystem] "aqua"] &&
		   ([string first AppKit [winfo server .]] == -1)
	    } {
		# Carbon
	        set events [list "<Command-Key-$key>" \
	                    "<Lock-Command-Key-$upc>" ]
		set blockEvents [list "<Lock-Shift-Command-Key-$upc>"]
		# Both bindings must be included in $events -  the first binding
		# does not fire if "Lock" is set, and this is as bind(n) states
		# because the second binding is NOT a more specialized form of
		# the first.
	    } else {
		# Cocoa and anything else that uses Cmd
	        set events [list "<Command-Key-$key>"]
	        # A binding to "<Lock-Command-Key-$upc>" must not be included
	        # here - both events fire if "Lock" is set.
		set blockEvents [list "<Shift-Command-Key-$key>"]
	    }
	}
	ShiftCmd {
	    if {    [string equal [tk windowingsystem] "aqua"] &&
		    ([string first AppKit [winfo server .]] == -1)
	    } {
		# Carbon
		set accel "Shift+Cmd+$upc"
		set events [list "<Shift-Command-Key-$upc>" \
			    "<Lock-Shift-Command-Key-$upc>"]
		# Both bindings must be included here -  the first binding does
		# not fire if "Lock" is set, even though the second binding
		# should be recognized as a more specialized form of the first.
	    } else {
		# Cocoa and anything else that uses Cmd
		set accel "Shift+Cmd+$upc"
		set events [list "<Shift-Command-Key-$key>"]
		# A binding to "<Lock-Shift-Command-Key-$key>" must not be
		# included here - both events fire if "Lock" is set.
		# Tk/Cocoa fails to recognize
		# <Lock-Shift-Command-Key-$key> as a "more specialized" binding
		# than <Shift-Command-Key-$key>.
		# Perversely, Tk/Carbon (above) makes the opposite error.
	    }
	}
	Ctrl {
	    set accel "Ctrl+$upc"
	    set events [list "<Control-Key-$key>"]
	}
	Alt {
	    set accel "Alt+$upc"
	    set events [list "<Alt-Key-$key>"]
	}
	CtrlAlt {
	    set accel "Ctrl+Alt+$upc"
	    set events [list "<Control-Alt-Key-$key>"]
	}
	default {
	    return -code error "invalid accelerator code $seq"
	}
    }

    return [list $accel $events $blockEvents]
}

Changes to notebook.tcl.

1
2
3
4
5
6
7
8
9
10
11
# ---------------------------------------------------------------------------
#  notebook.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: notebook.tcl,v 1.25 2009/07/01 14:41:30 oehhar Exp $
# ---------------------------------------------------------------------------
#  Index of commands:
#     - NoteBook::create
#     - NoteBook::configure
#     - NoteBook::cget
#     - NoteBook::compute_size
#     - NoteBook::insert



|







1
2
3
4
5
6
7
8
9
10
11
# ---------------------------------------------------------------------------
#  notebook.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: notebook.tcl,v 1.25.2.2 2011/04/26 14:13:24 oehhar Exp $
# ---------------------------------------------------------------------------
#  Index of commands:
#     - NoteBook::create
#     - NoteBook::configure
#     - NoteBook::cget
#     - NoteBook::compute_size
#     - NoteBook::insert
39
40
41
42
43
44
45



46
47
48
49
50
51
52
    namespace eval Page {
        Widget::declare NoteBook::Page {
            {-state      Enum       normal 0 {normal disabled}}
            {-createcmd  String     ""     0}
            {-raisecmd   String     ""     0}
            {-leavecmd   String     ""     0}
            {-image      TkResource ""     0 label}



            {-text       String     ""     0}
            {-foreground         String     ""     0}
            {-background         String     ""     0}
            {-activeforeground   String     ""     0}
            {-activebackground   String     ""     0}
            {-disabledforeground String     ""     0}
        }







>
>
>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
    namespace eval Page {
        Widget::declare NoteBook::Page {
            {-state      Enum       normal 0 {normal disabled}}
            {-createcmd  String     ""     0}
            {-raisecmd   String     ""     0}
            {-leavecmd   String     ""     0}
            {-image      TkResource ""     0 label}
            {-rimage     String     ""     0}
            {-ractiveimage String   ""     0}
            {-rimagecmd  String     ""     0}
            {-text       String     ""     0}
            {-foreground         String     ""     0}
            {-background         String     ""     0}
            {-activeforeground   String     ""     0}
            {-activebackground   String     ""     0}
            {-disabledforeground String     ""     0}
        }
94
95
96
97
98
99
100

101
102
103
104
105
106
107

    Widget::addmap NoteBook "" .c {-background {}}

    variable _warrow 12

    bind NoteBook <Configure> [list NoteBook::_resize  %W]
    bind NoteBook <Destroy>   [list NoteBook::_destroy %W]

}


# ---------------------------------------------------------------------------
#  Command NoteBook::create
# ---------------------------------------------------------------------------
proc NoteBook::create { path args } {







>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

    Widget::addmap NoteBook "" .c {-background {}}

    variable _warrow 12

    bind NoteBook <Configure> [list NoteBook::_resize  %W]
    bind NoteBook <Destroy>   [list NoteBook::_destroy %W]
    bind NoteBook <<TkWorldChanged>> [list NoteBook::_worldchanged  %W %d]
}


# ---------------------------------------------------------------------------
#  Command NoteBook::create
# ---------------------------------------------------------------------------
proc NoteBook::create { path args } {
178
179
180
181
182
183
184

185

186
187
188
189
190
191
192
193
        _compute_width $path
        set redraw 1
    }
    set chibd [Widget::hasChanged $path -internalborderwidth ibd]
    set chbg  [Widget::hasChanged $path -background bg]
    if {$chibd || $chbg} {
        foreach page $data(pages) {

            $path.f$page configure \

                -borderwidth $ibd -background $bg
        }
    }

    if {$chbg} {
        set col [BWidget::get3dcolor $path $bg]
        set data(dbg)  [lindex $col 0]
        set data(lbg)  [lindex $col 1]







>
|
>
|







182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
        _compute_width $path
        set redraw 1
    }
    set chibd [Widget::hasChanged $path -internalborderwidth ibd]
    set chbg  [Widget::hasChanged $path -background bg]
    if {$chibd || $chbg} {
        foreach page $data(pages) {
            if { ! $::Widget::_theme } {
                $path.f$page configure -background $bg
            }
            $path.f$page configure -borderwidth $ibd
        }
    }

    if {$chbg} {
        set col [BWidget::get3dcolor $path $bg]
        set data(dbg)  [lindex $col 0]
        set data(lbg)  [lindex $col 1]
259
260
261
262
263
264
265



266
267
268
269

270

271
272
273

274
275
276
277
278
279
280
281

    set f $path.f$page
    Widget::init NoteBook::Page $f $args

    set data(pages) [linsert $data(pages) $index $page]
    # If the page doesn't exist, create it; if it does reset its bg and ibd
    if { ![winfo exists $f] } {



        frame $f \
	    -relief      flat \
	    -background  [Widget::cget $path -background] \
	    -borderwidth [Widget::cget $path -internalborderwidth]

        set data($page,realized) 0

    } else {
	$f configure \
	    -background  [Widget::cget $path -background] \

	    -borderwidth [Widget::cget $path -internalborderwidth]
    }
    _compute_height $path
    _compute_width  $path
    _draw_page $path $page 1
    _set_help  $path $page
    _redraw $path








>
>
>
|
|
|
|
>

>

|
|
>
|







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293

    set f $path.f$page
    Widget::init NoteBook::Page $f $args

    set data(pages) [linsert $data(pages) $index $page]
    # If the page doesn't exist, create it; if it does reset its bg and ibd
    if { ![winfo exists $f] } {
        if {$::Widget::_theme} {
            ttk::frame $f
        } else {
            frame $f \
                -relief      flat \
                -background  [Widget::cget $path -background] \
                -borderwidth [Widget::cget $path -internalborderwidth]
        }
        set data($page,realized) 0
        set data($page,rimage)   0
    } else {
        if { ! $::Widget::_theme} {
            $f configure -background  [Widget::cget $path -background]
        }
        $f configure -borderwidth [Widget::cget $path -internalborderwidth]
    }
    _compute_height $path
    _compute_width  $path
    _draw_page $path $page 1
    _set_help  $path $page
    _redraw $path

298
299
300
301
302
303
304

305
306
307
308
309
310
311
312
313
314
        set data(select) ""
    }
    if { $pos < $data(base) } {
        incr data(base) -1
    }
    if { $destroyframe } {
        destroy $path.f$page

    }
    _redraw $path
    unset data($page,width) data($page,realized)
}


# ---------------------------------------------------------------------------
#  Command NoteBook::itemconfigure
# ---------------------------------------------------------------------------
proc NoteBook::itemconfigure { path page args } {







>


<







310
311
312
313
314
315
316
317
318
319

320
321
322
323
324
325
326
        set data(select) ""
    }
    if { $pos < $data(base) } {
        incr data(base) -1
    }
    if { $destroyframe } {
        destroy $path.f$page
        unset data($page,width) data($page,realized) data($page,rimage)
    }
    _redraw $path

}


# ---------------------------------------------------------------------------
#  Command NoteBook::itemconfigure
# ---------------------------------------------------------------------------
proc NoteBook::itemconfigure { path page args } {
495
496
497
498
499
500
501



502
503
504
505
506
507
508

    set res [Widget::configure $path.f$page $lres]
    if { [Widget::hasChanged $path.f$page -text foo] } {
        _compute_width $path
    } elseif  { [Widget::hasChanged $path.f$page -image foo] } {
        _compute_height $path
        _compute_width  $path



    }
    if { [Widget::hasChanged $path.f$page -state state] &&
         $state == "disabled" && $data(select) == $page } {
        set data(select) ""
    }
    _set_help $path $page
    return $res







>
>
>







507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523

    set res [Widget::configure $path.f$page $lres]
    if { [Widget::hasChanged $path.f$page -text foo] } {
        _compute_width $path
    } elseif  { [Widget::hasChanged $path.f$page -image foo] } {
        _compute_height $path
        _compute_width  $path
    } elseif  { [Widget::hasChanged $path.f$page -rimage foo] } {
        _compute_height $path
        _compute_width  $path
    }
    if { [Widget::hasChanged $path.f$page -state state] &&
         $state == "disabled" && $data(select) == $page } {
        set data(select) ""
    }
    _set_help $path $page
    return $res
535
536
537
538
539
540
541







542
543
544
545
546
547
548
        set wtext [expr {$x2 - $x1 + 20}]
        if { [set img [Widget::cget $path.f$page -image]] != "" } {
            set wtext [expr {$wtext + [image width $img] + 4}]
            set himg  [expr {[image height $img] + 6}]
            if { $himg > $hmax } {
                set hmax $himg
            }







        }
        set  wmax  [expr {$wtext > $wmax ? $wtext : $wmax}]
        incr wtot  $wtext
        set  data($page,width) $wtext
    }
    if { [Widget::cget $path -homogeneous] } {
        foreach page $data(pages) {







>
>
>
>
>
>
>







550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
        set wtext [expr {$x2 - $x1 + 20}]
        if { [set img [Widget::cget $path.f$page -image]] != "" } {
            set wtext [expr {$wtext + [image width $img] + 4}]
            set himg  [expr {[image height $img] + 6}]
            if { $himg > $hmax } {
                set hmax $himg
            }
        }
        if { [set jmg [Widget::cget $path.f$page -rimage]] != "" } {
            set wtext [expr {$wtext + [image width $jmg] + 4}]
            set hjmg  [expr {[image height $jmg] + 6}]
            if { $hjmg > $hmax } {
                set hmax $hjmg
            }
        }
        set  wmax  [expr {$wtext > $wmax ? $wtext : $wmax}]
        incr wtot  $wtext
        set  data($page,width) $wtext
    }
    if { [Widget::cget $path -homogeneous] } {
        foreach page $data(pages) {
563
564
565
566
567
568
569

570
571
572

573
574
575
576
577
578
579




580
581
582

583
584
585
586
587
588
589
    upvar 0  $path data

    set font    [Widget::cget $path -font]
    set pady0   [Widget::_get_padding $path -tabpady 0]
    set pady1   [Widget::_get_padding $path -tabpady 1]
    set metrics [font metrics $font -linespace]
    set imgh    0

    set lines   1
    foreach page $data(pages) {
        set img  [Widget::cget $path.f$page -image]

        set text [Widget::cget $path.f$page -text]
        set len [llength [split $text \n]]
        if {$len > $lines} { set lines $len}
        if {$img != ""} {
            set h [image height $img]
            if {$h > $imgh} { set imgh $h }
        }




    }
    set height [expr {$metrics * $lines}]
    if {$imgh > $height} { set height $imgh }

    set data(hpage) [expr {$height + $pady0 + $pady1}]
}


# ---------------------------------------------------------------------------
#  Command NoteBook::_get_x_page
# ---------------------------------------------------------------------------







>



>







>
>
>
>



>







585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
    upvar 0  $path data

    set font    [Widget::cget $path -font]
    set pady0   [Widget::_get_padding $path -tabpady 0]
    set pady1   [Widget::_get_padding $path -tabpady 1]
    set metrics [font metrics $font -linespace]
    set imgh    0
    set jmgh    0
    set lines   1
    foreach page $data(pages) {
        set img  [Widget::cget $path.f$page -image]
        set jmg  [Widget::cget $path.f$page -rimage]
        set text [Widget::cget $path.f$page -text]
        set len [llength [split $text \n]]
        if {$len > $lines} { set lines $len}
        if {$img != ""} {
            set h [image height $img]
            if {$h > $imgh} { set imgh $h }
        }
        if {$jmg != ""} {
            set h [image height $jmg]
            if {$h > $jmgh} { set jmgh $h }
        }
    }
    set height [expr {$metrics * $lines}]
    if {$imgh > $height} { set height $imgh }
    if {$jmgh > $height} { set height $jmgh }
    set data(hpage) [expr {$height + $pady0 + $pady1}]
}


# ---------------------------------------------------------------------------
#  Command NoteBook::_get_x_page
# ---------------------------------------------------------------------------
655
656
657
658
659
660
661




















































662
663
664
665
666
667
668
		    -fill [_getoption $path $page -background]
            $path.c itemconfigure "$page:text" \
		    -fill [_getoption $path $page -foreground]
        }
    }
}






















































# ---------------------------------------------------------------------------
#  Command NoteBook::_select
# ---------------------------------------------------------------------------
proc NoteBook::_select { path page } {
    variable $path
    upvar 0  $path data







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
		    -fill [_getoption $path $page -background]
            $path.c itemconfigure "$page:text" \
		    -fill [_getoption $path $page -foreground]
        }
    }
}


# ---------------------------------------------------------------------------
#  Command NoteBook::_rightImage
# ---------------------------------------------------------------------------
proc NoteBook::_rightImage { type path page } {
    variable $path
    upvar 0  $path data

    if { [string equal [Widget::cget $path.f$page -state] "disabled"] } {
        return
    }

    switch -- $type {
        on {
            set data($page,rimage) 1
            set jmg  [Widget::cget $path.f$page -rimage]
            set jamg [Widget::cget $path.f$page -ractiveimage]
            if {    ($jmg  ne {})
                 && ($jamg ne {})
                 && ([image height $jmg] == [image height $jamg])
                 && ([image width  $jmg] == [image width  $jamg])
            } {
            $path.c itemconfigure "$page:jmg" \
		    -image $jamg
            } else {
                # Don't replace the -rimage with the -raimage if they are
                # different sizes.
            }
        }
        off {
            set data($page,rimage) 0
            $path.c itemconfigure "$page:jmg" \
		    -image [Widget::cget $path.f$page -rimage]
        }
        command {
	    set cmd [Widget::cget $path.f$page -rimagecmd]
	    if {$cmd ne {}} {
		after idle [list uplevel #0 [list NoteBook::_rightImage execute $path $page]]
		# Call after idle so that, if the pointer has left the -rimage,
		# the <Leave> event fires and resets data($page,rimage) before
		# NoteBook::_rightImage execute is evaluated.
	    }
        }
        execute {
	    set cmd [Widget::cget $path.f$page -rimagecmd]
	    if {$cmd ne {} && $data($page,rimage)} {
		uplevel #0 [concat $cmd [list $path $page]]
	    }
        }
    }
}


# ---------------------------------------------------------------------------
#  Command NoteBook::_select
# ---------------------------------------------------------------------------
proc NoteBook::_select { path page } {
    variable $path
    upvar 0  $path data
827
828
829
830
831
832
833

834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852









853
854
855
856
857
858
859
		[expr {$xf + 1 - $xBevel}] 		[expr {$top + 1}] \
		[expr {$rightPlusRadius - $xBevel}]	$topPlusRadius \
		$rightPlusRadius			$h \
		]
    }

    set img [Widget::cget $path.f$page -image]


    set ytext $top
    if { $tabsOnBottom } {
	# The "+ 2" below moves the text closer to the bottom of the tab,
	# so it doesn't look so cramped.  I should be able to achieve the
	# same goal by changing the anchor of the text and using this formula:
	# ytext = $top + $h1 - $textOffsetY
	# but that doesn't quite work (I think the linespace from the text
	# gets in the way)
	incr ytext [expr {$h1 - $h + 2}]
    }
    incr ytext $textOffsetY

    set xtext [expr {$xd + $textOffsetX}]
    if { $img != "" } {
	# if there's an image, put it on the left and move the text right
	set ximg $xtext
	incr xtext [expr {[image width $img] + 2}]
    }









	
    if { $data(select) == $page } {
        set bd    [Widget::cget $path -borderwidth]
	if {$bd < 1} { set bd 1 }
        set fg    [_getoption $path $page -foreground]
    } else {
        set bd    1







>



















>
>
>
>
>
>
>
>
>







908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
		[expr {$xf + 1 - $xBevel}] 		[expr {$top + 1}] \
		[expr {$rightPlusRadius - $xBevel}]	$topPlusRadius \
		$rightPlusRadius			$h \
		]
    }

    set img [Widget::cget $path.f$page -image]
    set jmg [Widget::cget $path.f$page -rimage]

    set ytext $top
    if { $tabsOnBottom } {
	# The "+ 2" below moves the text closer to the bottom of the tab,
	# so it doesn't look so cramped.  I should be able to achieve the
	# same goal by changing the anchor of the text and using this formula:
	# ytext = $top + $h1 - $textOffsetY
	# but that doesn't quite work (I think the linespace from the text
	# gets in the way)
	incr ytext [expr {$h1 - $h + 2}]
    }
    incr ytext $textOffsetY

    set xtext [expr {$xd + $textOffsetX}]
    if { $img != "" } {
	# if there's an image, put it on the left and move the text right
	set ximg $xtext
	incr xtext [expr {[image width $img] + 2}]
    }

    if { $jmg != "" } {
	# if there's an image, put it on the right and leave the text
	set xjmg $xtext
	if { $img != "" } {
	    set xjmg $ximg
	}
	incr xjmg [expr {$data($page,width) - [image width $jmg] - 10}]
    }
	
    if { $data(select) == $page } {
        set bd    [Widget::cget $path -borderwidth]
	if {$bd < 1} { set bd 1 }
        set fg    [_getoption $path $page -foreground]
    } else {
        set bd    1
917
918
919
920
921
922
923




















924
925
926
927
928
929
930
        }
        $path.c coords $id $ximg $ytext
        $path.c itemconfigure $id -image $img
        # Sven end
    } else {
        $path.c delete $page:img
    }





















    if { $data(select) == $page } {
        $path.c raise p:$page
    } elseif { $pos == 0 } {
        if { $data(select) == "" } {
            $path.c raise p:$page
        } else {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
        }
        $path.c coords $id $ximg $ytext
        $path.c itemconfigure $id -image $img
        # Sven end
    } else {
        $path.c delete $page:img
    }

    if { $jmg != "" } {
	set id [$path.c find withtag $page:jmg]
	if { [string equal $id ""] } {
	    set id [$path.c create image $xjmg $ytext \
		    -anchor nw    \
		    -tags   [list page p:$page $page:jmg]]
        }
        $path.c coords $id $xjmg $ytext
        $path.c itemconfigure $id -image $jmg

        $path.c bind $page:jmg <Enter> \
		[list NoteBook::_rightImage on  $path $page]
        $path.c bind $page:jmg <Leave> \
		[list NoteBook::_rightImage off $path $page]
        $path.c bind $page:jmg <ButtonRelease-1> \
		[list NoteBook::_rightImage command $path $page]
    } else {
        $path.c delete $page:jmg
    }

    if { $data(select) == $page } {
        $path.c raise p:$page
    } elseif { $pos == 0 } {
        if { $data(select) == "" } {
            $path.c raise p:$page
        } else {
1096
1097
1098
1099
1100
1101
1102






1103

1104
1105



1106

1107
1108
1109
1110
1111
1112
1113
1114
1115
# -----------------------------------------------------------------------------
#  Command NoteBook::_resize
# -----------------------------------------------------------------------------
proc NoteBook::_resize { path } {
    variable $path
    upvar 0  $path data







    if {!$data(realized)} {

	if { [set width  [Widget::cget $path -width]]  == 0 ||
	     [set height [Widget::cget $path -height]] == 0 } {



	    compute_size $path

	}
	set data(realized) 1
    }

    NoteBook::_redraw $path
}


# Tree::_set_help --







>
>
>
>
>
>

>
|
|
>
>
>

>

<







1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229

1230
1231
1232
1233
1234
1235
1236
# -----------------------------------------------------------------------------
#  Command NoteBook::_resize
# -----------------------------------------------------------------------------
proc NoteBook::_resize { path } {
    variable $path
    upvar 0  $path data

    # Check if pages are fully initialized or if we are still initializing
    if { 0 < [llength $data(pages)] &&
	 ![info exists data([lindex $data(pages) end],width)] } {
	return
    }
    
    if {!$data(realized)} {
	set data(realized) 1
	if { [Widget::cget $path -width]  == 0 ||
	     [Widget::cget $path -height] == 0 } {
	    # This does an update allowing other events (resize) to enter
	    # In addition, it does a redraw, so first set the realized and
	    # then exit
	    compute_size $path
	    return
	}

    }

    NoteBook::_redraw $path
}


# Tree::_set_help --
1160
1161
1162
1163
1164
1165
1166















    }
}


proc NoteBook::_get_page_name { path {item current} {tagindex end-1} } {
    return [string range [lindex [$path.c gettags $item] $tagindex] 2 end]
}






















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
    }
}


proc NoteBook::_get_page_name { path {item current} {tagindex end-1} } {
    return [string range [lindex [$path.c gettags $item] $tagindex] 2 end]
}

# -----------------------------------------------------------------------------
#  Command NoteBook::_worldchanged
# -----------------------------------------------------------------------------
proc NoteBook::_worldchanged { path type} {
    # Check if font changed
    if {$type == "FontChanged"} {
        # The tabs are redraws, as the font of the labels may have changed in
        # size. Note: the following operations are the same as "configure -font"
        _compute_height $path
        _compute_width $path
        _redraw $path
    }
}

Changes to pagesmgr.tcl.

1
2
3
4
5
6
7
8
9
10
11
# ------------------------------------------------------------------------------
#  pagesmgr.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: pagesmgr.tcl,v 1.6 2003/10/20 21:23:52 damonc Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - PagesManager::create
#     - PagesManager::configure
#     - PagesManager::cget
#     - PagesManager::compute_size
#     - PagesManager::add



|







1
2
3
4
5
6
7
8
9
10
11
# ------------------------------------------------------------------------------
#  pagesmgr.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: pagesmgr.tcl,v 1.6.2.1 2011/02/14 16:56:09 oehhar Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - PagesManager::create
#     - PagesManager::configure
#     - PagesManager::cget
#     - PagesManager::compute_size
#     - PagesManager::add
106
107
108
109
110
111
112



113
114

115
116
117
118
119
120
121

    if { [lsearch -exact $data(pages) $page] != -1 } {
        return -code error "page \"$page\" already exists"
    }

    lappend data(pages) $page




    frame $path.f$page -relief flat \
	    -background [Widget::cget $path -background] -borderwidth 0


    return $path.f$page
}


# ------------------------------------------------------------------------------
#  Command PagesManager::delete







>
>
>
|
|
>







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

    if { [lsearch -exact $data(pages) $page] != -1 } {
        return -code error "page \"$page\" already exists"
    }

    lappend data(pages) $page

    if {[Widget::theme]} {
        ttk::frame $path.f$page
    }  else  {
        frame $path.f$page -relief flat \
            -background [Widget::cget $path -background] -borderwidth 0
    }

    return $path.f$page
}


# ------------------------------------------------------------------------------
#  Command PagesManager::delete

Changes to pkgIndex.tcl.

1


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
if {[catch {package require Tcl}]} return


package ifneeded BWidget 1.9 "\
    package require Tk 8.1.1;\
    [list tclPkgSetup $dir BWidget 1.9 {
{arrow.tcl source {ArrowButton ArrowButton::create ArrowButton::use}}
{labelframe.tcl source {LabelFrame LabelFrame::create LabelFrame::use}}
{labelentry.tcl source {LabelEntry LabelEntry::create LabelEntry::use}}
{bitmap.tcl source {Bitmap::get Bitmap::use}}
{button.tcl source {Button Button::create Button::use}}
{buttonbox.tcl source {ButtonBox ButtonBox::create ButtonBox::use}}
{combobox.tcl source {ComboBox ComboBox::create ComboBox::use}}
{label.tcl source {Label Label::create Label::use}}
{entry.tcl source {Entry Entry::create Entry::use}}
{pagesmgr.tcl source {PagesManager PagesManager::create PagesManager::use}}
{notebook.tcl source {NoteBook NoteBook::create NoteBook::use}}
{panedw.tcl source {PanedWindow PanedWindow::create PanedWindow::use}}
{scrollw.tcl source {ScrolledWindow ScrolledWindow::create ScrolledWindow::use}}
{scrollview.tcl source {ScrollView ScrollView::create ScrollView::use}}
{scrollframe.tcl source {ScrollableFrame ScrollableFrame::create ScrollableFrame::use}}
{panelframe.tcl source {PanelFrame PanelFrame::create PanelFrame::use}}
{progressbar.tcl source {ProgressBar ProgressBar::create ProgressBar::use}}
{progressdlg.tcl source {ProgressDlg ProgressDlg::create ProgressDlg::use}}
{passwddlg.tcl source {PasswdDlg PasswdDlg::create PasswdDlg::use}}
{dragsite.tcl source {DragSite::register DragSite::include DragSite::use}}
{dropsite.tcl source {DropSite::register DropSite::include DropSite::use}}
{separator.tcl source {Separator Separator::create Separator::use}}
{spinbox.tcl source {SpinBox SpinBox::create SpinBox::use}}
{statusbar.tcl source {StatusBar StatusBar::create StatusBar::use}}
{titleframe.tcl source {TitleFrame TitleFrame::create TitleFrame::use}}
{mainframe.tcl source {MainFrame MainFrame::create MainFrame::use}}
{listbox.tcl source {ListBox ListBox::create ListBox::use}}
{tree.tcl source {Tree Tree::create Tree::use}}
{color.tcl source {SelectColor SelectColor::menu SelectColor::dialog SelectColor::setcolor}}
{dynhelp.tcl source {DynamicHelp::configure DynamicHelp::use DynamicHelp::register DynamicHelp::include DynamicHelp::add DynamicHelp::delete}}
{dialog.tcl source {Dialog Dialog::create Dialog::use}}
{messagedlg.tcl source {MessageDlg MessageDlg::create MessageDlg::use}}
{font.tcl source {SelectFont SelectFont::create SelectFont::use SelectFont::loadfont}}
{widgetdoc.tcl source {Widget::generate-doc Widget::generate-widget-doc}}
{wizard.tcl source {Wizard Wizard::create Wizard::use SimpleWizard ClassicWizard}}
{xpm2image.tcl source {xpm-to-image}}
}]; \
	[list namespace eval ::BWIDGET {}]; \
	[list set ::BWIDGET::LIBRARY $dir]; \
    [list source [file join $dir widget.tcl]]; \
    [list source [file join $dir init.tcl]]; \
    [list source [file join $dir utils.tcl]]; \
"

>
>
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47
48
if {[catch {package require Tcl}]} return
# NOTE: auto_loaded top-level commands shall not be qualified (no leading ::)
# but all others should.  See auto_qualify for details.
package ifneeded BWidget 1.9.16 "\
    package require Tk 8.1.1;\
    [list tclPkgSetup $dir BWidget 1.9.16 {
	{arrow.tcl       source {ArrowButton ::ArrowButton::create ::ArrowButton::use}}
	{labelframe.tcl  source {LabelFrame ::LabelFrame::create ::LabelFrame::use}}
	{labelentry.tcl  source {LabelEntry ::LabelEntry::create ::LabelEntry::use}}
	{bitmap.tcl      source {::Bitmap::get ::Bitmap::use}}
	{button.tcl      source {Button ::Button::create ::Button::use}}
	{buttonbox.tcl   source {ButtonBox ::ButtonBox::create ::ButtonBox::use}}
	{combobox.tcl    source {ComboBox ::ComboBox::create ::ComboBox::use}}
	{label.tcl       source {Label ::Label::create ::Label::use}}
	{entry.tcl       source {Entry ::Entry::create ::Entry::use}}
	{pagesmgr.tcl    source {PagesManager ::PagesManager::create ::PagesManager::use}}
	{notebook.tcl    source {NoteBook ::NoteBook::create ::NoteBook::use}}
	{panedw.tcl      source {PanedWindow ::PanedWindow::create ::PanedWindow::use}}
	{scrollw.tcl     source {ScrolledWindow ::ScrolledWindow::create ::ScrolledWindow::use}}
	{scrollview.tcl  source {ScrollView ::ScrollView::create ::ScrollView::use}}
	{scrollframe.tcl source {ScrollableFrame ::ScrollableFrame::create ::ScrollableFrame::use}}
	{panelframe.tcl  source {PanelFrame ::PanelFrame::create ::PanelFrame::use}}
	{progressbar.tcl source {ProgressBar ::ProgressBar::create ::ProgressBar::use}}
	{progressdlg.tcl source {ProgressDlg ::ProgressDlg::create ::ProgressDlg::use}}
	{passwddlg.tcl   source {PasswdDlg ::PasswdDlg::create ::PasswdDlg::use}}
	{dragsite.tcl    source {::DragSite::register ::DragSite::include ::DragSite::use}}
	{dropsite.tcl    source {::DropSite::register ::DropSite::include ::DropSite::use}}
	{separator.tcl   source {Separator ::Separator::create ::Separator::use}}
	{spinbox.tcl     source {SpinBox ::SpinBox::create ::SpinBox::use}}
	{statusbar.tcl   source {StatusBar ::StatusBar::create ::StatusBar::use}}
	{titleframe.tcl  source {TitleFrame ::TitleFrame::create ::TitleFrame::use}}
	{mainframe.tcl   source {MainFrame ::MainFrame::create ::MainFrame::use}}
	{listbox.tcl     source {ListBox ::ListBox::create ::ListBox::use}}
	{tree.tcl        source {Tree ::Tree::create ::Tree::use}}
	{color.tcl       source {SelectColor ::SelectColor::menu ::SelectColor::dialog ::SelectColor::setcolor ::SelectColor::setbasecolor}}
	{dynhelp.tcl     source {::DynamicHelp::configure ::DynamicHelp::use ::DynamicHelp::register ::DynamicHelp::include ::DynamicHelp::add ::DynamicHelp::delete}}
	{dialog.tcl      source {Dialog ::Dialog::create ::Dialog::use}}
	{messagedlg.tcl  source {MessageDlg ::MessageDlg::create ::MessageDlg::use}}
	{font.tcl        source {SelectFont ::SelectFont::create ::SelectFont::use ::SelectFont::loadfont}}

	{wizard.tcl      source {Wizard ::Wizard::create ::Wizard::use SimpleWizard ClassicWizard}}
	{xpm2image.tcl   source {xpm-to-image}}
    }]; \
    [list namespace eval ::BWIDGET {}]; \
    [list set ::BWIDGET::LIBRARY $dir]; \
    [list source [file join $dir widget.tcl]]; \
    [list source [file join $dir init.tcl]]; \
    [list source [file join $dir utils.tcl]]; \
"

Changes to scrollframe.tcl.

93
94
95
96
97
98
99



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118


119
120
121
122
123
124
125
126
127


128
129
130
131
132
133
134
135
136
137
138
139
    bind $frame <Configure> \
        [list ScrollableFrame::_frameConfigure $canvas]
    # add <unmap> binding: <configure> is not called when frame
    # becomes so small that it suddenly falls outside of currently visible area.
    # but now we need to add a <map> binding too
    bind $frame <Map> \
        [list ScrollableFrame::_frameConfigure $canvas]



    bind $frame <Unmap> \
        [list ScrollableFrame::_frameConfigure $canvas 1]

    bindtags $path [list $path BwScrollableFrame [winfo toplevel $path] all]

    return [Widget::create ScrollableFrame $path]
}


# ----------------------------------------------------------------------------
#  Command ScrollableFrame::configure
# ----------------------------------------------------------------------------
proc ScrollableFrame::configure { path args } {
    set res [Widget::configure $path $args]
    set upd 0

    set modcw [Widget::hasChanged $path -constrainedwidth cw]
    set modw  [Widget::hasChanged $path -areawidth w]
    if { $modcw || (!$cw && $modw) } {


        if { $cw } {
            set w [winfo width $path]
        }
        set upd 1
    }

    set modch [Widget::hasChanged $path -constrainedheight ch]
    set modh  [Widget::hasChanged $path -areaheight h]
    if { $modch || (!$ch && $modh) } {


        if { $ch } {
            set h [winfo height $path]
        }
        set upd 1
    }

    if { $upd } {
        $path:cmd itemconfigure win -width $w -height $h
    }
    return $res
}








>
>
>
|
|
|
















>
>
|
|
|
<
<




>
>
|
|
|
<
<







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126


127
128
129
130
131
132
133
134
135


136
137
138
139
140
141
142
    bind $frame <Configure> \
        [list ScrollableFrame::_frameConfigure $canvas]
    # add <unmap> binding: <configure> is not called when frame
    # becomes so small that it suddenly falls outside of currently visible area.
    # but now we need to add a <map> binding too
    bind $frame <Map> \
        [list ScrollableFrame::_frameConfigure $canvas]

    # Tk 8.7/TIP518 allows to get an event when the last child is removed.
    # In this case, we should resize to 1x1 pixel.
    bind $frame <<NoManagedChild>>\
            [list ScrollableFrame::_frameNoManagedChild $frame]
    
    bindtags $path [list $path BwScrollableFrame [winfo toplevel $path] all]

    return [Widget::create ScrollableFrame $path]
}


# ----------------------------------------------------------------------------
#  Command ScrollableFrame::configure
# ----------------------------------------------------------------------------
proc ScrollableFrame::configure { path args } {
    set res [Widget::configure $path $args]
    set upd 0

    set modcw [Widget::hasChanged $path -constrainedwidth cw]
    set modw  [Widget::hasChanged $path -areawidth w]
    if { $modcw || (!$cw && $modw) } {
        set upd 1
    }
    if { $cw } {
        set w [winfo width $path]
    }



    set modch [Widget::hasChanged $path -constrainedheight ch]
    set modh  [Widget::hasChanged $path -areaheight h]
    if { $modch || (!$ch && $modh) } {
        set upd 1
    }
    if { $ch } {
        set h [winfo height $path]
    }



    if { $upd } {
        $path:cmd itemconfigure win -width $w -height $h
    }
    return $res
}

242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262











}


# ----------------------------------------------------------------------------
#  Command ScrollableFrame::_frameConfigure
# ----------------------------------------------------------------------------
proc ScrollableFrame::_max {a b} {return [expr {$a <= $b ? $b : $a}]}
proc ScrollableFrame::_frameConfigure {canvas {unmap 0}} {
    # This ensures that we don't get funny scrollability in the frame
    # when it is smaller than the canvas space
    # use [winfo] to get height & width of frame

    # [winfo] doesn't work for unmapped frame
    set frameh [expr {$unmap ? 0 : [winfo height $canvas.frame]}]
    set framew [expr {$unmap ? 0 : [winfo width  $canvas.frame]}]

    set height [_max $frameh [winfo height $canvas]]
    set width  [_max $framew [winfo width  $canvas]]

    $canvas:cmd configure -scrollregion [list 0 0 $width $height]
}


















|



|
<
|
|
<
<
<



>
>
>
>
>
>
>
>
>
>
>
245
246
247
248
249
250
251
252
253
254
255
256

257
258



259
260
261
262
263
264
265
266
267
268
269
270
271
272
}


# ----------------------------------------------------------------------------
#  Command ScrollableFrame::_frameConfigure
# ----------------------------------------------------------------------------
proc ScrollableFrame::_max {a b} {return [expr {$a <= $b ? $b : $a}]}
proc ScrollableFrame::_frameConfigure {canvas} {
    # This ensures that we don't get funny scrollability in the frame
    # when it is smaller than the canvas space
    # use [winfo] to get height & width of frame
    if {![winfo ismapped $canvas.frame]} { return }

    set height [_max [winfo height $canvas.frame] [winfo height $canvas]]
    set width  [_max [winfo width  $canvas.frame] [winfo width  $canvas]]




    $canvas:cmd configure -scrollregion [list 0 0 $width $height]
}


# ----------------------------------------------------------------------------
#  Command ScrollableFrame::_frameNoManagedChild
# ----------------------------------------------------------------------------
proc ScrollableFrame::_frameNoManagedChild {frame} {
    # There are no childs mapped any more, so resize frame to 1x1
    $frame configure -width 1 -height 1
    # Do not fix size, so set values to 0
    $frame configure -width 0 -height 0
}

Changes to scrollw.tcl.

1
2
3
4
5
6
7
8
9
10
11
# -----------------------------------------------------------------------------
#  scrollw.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: scrollw.tcl,v 1.13 2009/06/29 13:28:24 oehhar Exp $
# -----------------------------------------------------------------------------
#  Index of commands:
#     - ScrolledWindow::create
#     - ScrolledWindow::getframe
#     - ScrolledWindow::setwidget
#     - ScrolledWindow::configure
#     - ScrolledWindow::cget



|







1
2
3
4
5
6
7
8
9
10
11
# -----------------------------------------------------------------------------
#  scrollw.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: scrollw.tcl,v 1.13.2.2 2011/02/14 16:56:09 oehhar Exp $
# -----------------------------------------------------------------------------
#  Index of commands:
#     - ScrolledWindow::create
#     - ScrolledWindow::getframe
#     - ScrolledWindow::setwidget
#     - ScrolledWindow::configure
#     - ScrolledWindow::cget
43
44
45
46
47
48
49













50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

80
81
82
83
84

85
86
87
88
89
90
91
proc ScrolledWindow::create { path args } {
    Widget::init ScrolledWindow $path $args

    Widget::getVariable $path data

    set bg     [Widget::cget $path -background]
    set sbsize [Widget::cget $path -size]













    set sw     [eval [list frame $path \
			  -relief flat -borderwidth 0 -background $bg \
			  -highlightthickness 0 -takefocus 0] \
		    [Widget::subcget $path :cmd]]

    scrollbar $path.hscroll \
	    -highlightthickness 0 -takefocus 0 \
	    -orient	 horiz	\
	    -relief	 sunken	\
	    -bg	 $bg
    scrollbar $path.vscroll \
	    -highlightthickness 0 -takefocus 0 \
	    -orient	 vert	\
	    -relief	 sunken	\
	    -bg	 $bg


    set data(realized) 0

    _setData $path \
	    [Widget::cget $path -scrollbar] \
	    [Widget::cget $path -auto] \
	    [Widget::cget $path -sides]

    if {[Widget::cget $path -managed]} {
	set data(hsb,packed) $data(hsb,present)
	set data(vsb,packed) $data(vsb,present)
    } else {
	set data(hsb,packed) 0
	set data(vsb,packed) 0
    }

    if {$sbsize} {
	$path.vscroll configure -width $sbsize
	$path.hscroll configure -width $sbsize
    } else {
	set sbsize [$path.vscroll cget -width]

    }
    set data(ipad) [Widget::cget $path -ipad]

    if {$data(hsb,packed)} {
	grid $path.hscroll -column 1 -row $data(hsb,row) \
		-sticky ew -ipady $data(ipad)
    }







>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
<
|
|
|
|
<
|
|
|
|
<
>















>
|
|
|
|
|
>







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

67
68
69
70

71
72
73
74

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
proc ScrolledWindow::create { path args } {
    Widget::init ScrolledWindow $path $args

    Widget::getVariable $path data

    set bg     [Widget::cget $path -background]
    set sbsize [Widget::cget $path -size]

    if { $::Widget::_theme } {
        set sw     [eval [list ttk::frame $path \
                      -relief flat -borderwidth 0 -takefocus 0] \
                        [Widget::subcget $path :cmd]]
        ttk::scrollbar $path.hscroll \
            -takefocus 0 -orient horiz
        ttk::scrollbar $path.vscroll \
            -takefocus 0 -orient vert
    } else {
        if {$bg != ""} {
            set bg [list -background $bg]
        }
        set sw     [eval [list frame $path \
                      -relief flat -borderwidth 0] $bg [list \
                      -highlightthickness 0 -takefocus 0] \
                        [Widget::subcget $path :cmd]]

        scrollbar $path.hscroll \
            -highlightthickness 0 -takefocus 0 \
            -orient	 horiz	\
            -relief	 sunken

        scrollbar $path.vscroll \
            -highlightthickness 0 -takefocus 0 \
            -orient	 vert	\
            -relief	 sunken

    }

    set data(realized) 0

    _setData $path \
	    [Widget::cget $path -scrollbar] \
	    [Widget::cget $path -auto] \
	    [Widget::cget $path -sides]

    if {[Widget::cget $path -managed]} {
	set data(hsb,packed) $data(hsb,present)
	set data(vsb,packed) $data(vsb,present)
    } else {
	set data(hsb,packed) 0
	set data(vsb,packed) 0
    }
    if { ! $::Widget::_theme } {
        if {$sbsize} {
            $path.vscroll configure -width $sbsize
            $path.hscroll configure -width $sbsize
        } else {
            set sbsize [$path.vscroll cget -width]
        }
    }
    set data(ipad) [Widget::cget $path -ipad]

    if {$data(hsb,packed)} {
	grid $path.hscroll -column 1 -row $data(hsb,row) \
		-sticky ew -ipady $data(ipad)
    }
121
122
123
124
125
126
127

128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
    if {[info exists data(widget)] && [winfo exists $data(widget)]
	&& ![string equal $data(widget) $widget]} {
	grid remove $data(widget)
	$data(widget) configure -xscrollcommand "" -yscrollcommand ""
    }
    set data(widget) $widget
    grid $widget -in $path -row 1 -column 1 -sticky news


    $path.hscroll configure -command [list $widget xview]
    $path.vscroll configure -command [list $widget yview]
    $widget configure \
	    -xscrollcommand [list ScrolledWindow::_set_hscroll $path] \
	    -yscrollcommand [list ScrolledWindow::_set_vscroll $path]
}


# -----------------------------------------------------------------------------
#  Command ScrolledWindow::configure
# -----------------------------------------------------------------------------
proc ScrolledWindow::configure { path args } {
    Widget::getVariable $path data

    set res [Widget::configure $path $args]
    if { [Widget::hasChanged $path -background bg] } {
	$path configure -background $bg
	catch {$path.hscroll configure -background $bg}
	catch {$path.vscroll configure -background $bg}
    }

    if {[Widget::hasChanged $path -scrollbar scrollbar] | \
	    [Widget::hasChanged $path -auto	 auto]	| \
	    [Widget::hasChanged $path -sides	 sides]} {
	_setData $path $scrollbar $auto $sides
	foreach {vmin vmax} [$path.hscroll get] { break }







>
















|
|
|
|







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
    if {[info exists data(widget)] && [winfo exists $data(widget)]
	&& ![string equal $data(widget) $widget]} {
	grid remove $data(widget)
	$data(widget) configure -xscrollcommand "" -yscrollcommand ""
    }
    set data(widget) $widget
    grid $widget -in $path -row 1 -column 1 -sticky news
    raise $widget;

    $path.hscroll configure -command [list $widget xview]
    $path.vscroll configure -command [list $widget yview]
    $widget configure \
	    -xscrollcommand [list ScrolledWindow::_set_hscroll $path] \
	    -yscrollcommand [list ScrolledWindow::_set_vscroll $path]
}


# -----------------------------------------------------------------------------
#  Command ScrolledWindow::configure
# -----------------------------------------------------------------------------
proc ScrolledWindow::configure { path args } {
    Widget::getVariable $path data

    set res [Widget::configure $path $args]
    if { ! $::Widget::_theme && [Widget::hasChanged $path -background bg] } {
        $path configure -background $bg
        catch {$path.hscroll configure -background $bg}
        catch {$path.vscroll configure -background $bg}
    }

    if {[Widget::hasChanged $path -scrollbar scrollbar] | \
	    [Widget::hasChanged $path -auto	 auto]	| \
	    [Widget::hasChanged $path -sides	 sides]} {
	_setData $path $scrollbar $auto $sides
	foreach {vmin vmax} [$path.hscroll get] { break }

Changes to spinbox.tcl.

35
36
37
38
39
40
41

42









43
44
45
46
47
48

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67



68

69
70
71
72
73
74
75
        {-modifycmd      String ""  0}
        {-repeatdelay    Int    400 0 {%d >= 0}}
        {-repeatinterval Int    100 0 {%d >= 0}}
	{-foreground     TkResource black 0 {button}}
    }

    Widget::addmap SpinBox "" :cmd {-background {}}

    Widget::addmap SpinBox ArrowButton .arrup {









        -foreground {} -background {} -disabledforeground {} -state {} \
		-repeatinterval {} -repeatdelay {}
    }
    Widget::addmap SpinBox ArrowButton .arrdn {
        -foreground {} -background {} -disabledforeground {} -state {} \
		-repeatinterval {} -repeatdelay {}

    }

    ::bind SpinBox <FocusIn> [list after idle {BWidget::refocus %W %W.e}]
    ::bind SpinBox <Destroy> [list SpinBox::_destroy %W]

    variable _widget
}


# -----------------------------------------------------------------------------
#  Command SpinBox::create
# -----------------------------------------------------------------------------
proc SpinBox::create { path args } {
    array set maps [list SpinBox {} :cmd {} .e {} .arrup {} .arrdn {}]
    array set maps [Widget::parseArgs SpinBox $args]
    eval [list frame $path] $maps(:cmd) \
	[list -highlightthickness 0 -takefocus 0 -class SpinBox]
    Widget::initFromODB SpinBox $path $maps(SpinBox)




    set entry [eval [list Entry::create $path.e] $maps(.e) -relief flat -bd 0]

    bindtags $path.e [linsert [bindtags $path.e] 1 SpinBoxEntry]

    set farr   [frame $path.farr -relief flat -bd 0 -highlightthickness 0]
    set height [expr {[winfo reqheight $path.e]/2-2}]
    set width  11
    set arrup  [eval [list ArrowButton::create $path.arrup -dir top] \
	    $maps(.arrup) \







>
|
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
>



















>
>
>
|
>







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
        {-modifycmd      String ""  0}
        {-repeatdelay    Int    400 0 {%d >= 0}}
        {-repeatinterval Int    100 0 {%d >= 0}}
	{-foreground     TkResource black 0 {button}}
    }

    Widget::addmap SpinBox "" :cmd {-background {}}
    if {$::Widget::_theme} {
        Widget::addmap SpinBox ArrowButton .arrup {
                -foreground {} -background {} -state {} \
                -repeatinterval {} -repeatdelay {}
        }
        Widget::addmap SpinBox ArrowButton .arrdn {
                -foreground {} -background {} -state {} \
                -repeatinterval {} -repeatdelay {}
        }
    } else {
        Widget::addmap SpinBox ArrowButton .arrup {
                -foreground {} -background {} -disabledforeground {} -state {} \
                -repeatinterval {} -repeatdelay {}
        }
        Widget::addmap SpinBox ArrowButton .arrdn {
                -foreground {} -background {} -disabledforeground {} -state {} \
                -repeatinterval {} -repeatdelay {}
        }
    }

    ::bind SpinBox <FocusIn> [list after idle {BWidget::refocus %W %W.e}]
    ::bind SpinBox <Destroy> [list SpinBox::_destroy %W]

    variable _widget
}


# -----------------------------------------------------------------------------
#  Command SpinBox::create
# -----------------------------------------------------------------------------
proc SpinBox::create { path args } {
    array set maps [list SpinBox {} :cmd {} .e {} .arrup {} .arrdn {}]
    array set maps [Widget::parseArgs SpinBox $args]
    eval [list frame $path] $maps(:cmd) \
	[list -highlightthickness 0 -takefocus 0 -class SpinBox]
    Widget::initFromODB SpinBox $path $maps(SpinBox)

    if {$Widget::_theme} {
        set entry [eval [list Entry::create $path.e] $maps(.e)]
    } else {
        set entry [eval [list Entry::create $path.e] $maps(.e) -relief flat -bd 0]
    }
    bindtags $path.e [linsert [bindtags $path.e] 1 SpinBoxEntry]

    set farr   [frame $path.farr -relief flat -bd 0 -highlightthickness 0]
    set height [expr {[winfo reqheight $path.e]/2-2}]
    set width  11
    set arrup  [eval [list ArrowButton::create $path.arrup -dir top] \
	    $maps(.arrup) \

Changes to tests/entry.test.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
	    {unknown color name "non-existent"}}
    {-bd 4 4 bad Value {bad screen distance "badValue"}}
    {-bg #ff0000 #ff0000 non-existent {unknown color name "non-existent"}}
    {-borderwidth 1.3 1 badValue {bad screen distance "badValue"}}
    {-command foo foo {} {}}
    {-disabledforeground blue blue non-existent \
	    {unknown color name "non-existent"}}
    {-editable false false shazbot {expected boolean value but got "shazbot"}}
    {-exportselection yes 1 xyzzy {expected boolean value but got "xyzzy"}}
    {-fg #110022 #110022 bogus {unknown color name "bogus"}}
    {-font {Helvetica 12 italic} {Helvetica 12 italic} {} \
	    {font "" doesn't exist}}
    {-foreground #110022 #110022 bogus {unknown color name "bogus"}}
    {-highlightbackground #123456 #123456 ugly {unknown color name "ugly"}}
    {-highlightcolor #123456 #123456 bogus {unknown color name "bogus"}}







|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
	    {unknown color name "non-existent"}}
    {-bd 4 4 bad Value {bad screen distance "badValue"}}
    {-bg #ff0000 #ff0000 non-existent {unknown color name "non-existent"}}
    {-borderwidth 1.3 1 badValue {bad screen distance "badValue"}}
    {-command foo foo {} {}}
    {-disabledforeground blue blue non-existent \
	    {unknown color name "non-existent"}}
    {-editable false 0 shazbot {expected boolean value but got "shazbot"}}
    {-exportselection yes 1 xyzzy {expected boolean value but got "xyzzy"}}
    {-fg #110022 #110022 bogus {unknown color name "bogus"}}
    {-font {Helvetica 12 italic} {Helvetica 12 italic} {} \
	    {font "" doesn't exist}}
    {-foreground #110022 #110022 bogus {unknown color name "bogus"}}
    {-highlightbackground #123456 #123456 ugly {unknown color name "ugly"}}
    {-highlightcolor #123456 #123456 bogus {unknown color name "bogus"}}
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
    } [list [lindex $test 2] [lindex $test 2]]
    incr i
}
destroy .e

test Entry-2.1 {Entry} {
    list [catch {Entry} msg] $msg
} {1 {no value given for parameter "path" to "Entry"}}
test Entry-2.2 {Entry} {
    list [catch {Entry gorp} msg] $msg
} {1 {bad window path name "gorp"}}
test Entry-2.3 {Entry procedure} {
    Entry .e
    set res [list [winfo exists .e] [winfo class .e] [info commands .e]]
    destroy .e







|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
    } [list [lindex $test 2] [lindex $test 2]]
    incr i
}
destroy .e

test Entry-2.1 {Entry} {
    list [catch {Entry} msg] $msg
} {1 {wrong # args: should be "Entry path ..."}}
test Entry-2.2 {Entry} {
    list [catch {Entry gorp} msg] $msg
} {1 {bad window path name "gorp"}}
test Entry-2.3 {Entry procedure} {
    Entry .e
    set res [list [winfo exists .e] [winfo class .e] [info commands .e]]
    destroy .e

Changes to tree.tcl.

1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  tree.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: tree.tcl,v 1.60 2009/07/24 16:01:55 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - Tree::create
#     - Tree::configure
#     - Tree::cget
#     - Tree::insert
#     - Tree::itemconfigure



|







1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  tree.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: tree.tcl,v 1.60.2.4 2011/06/23 08:28:04 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - Tree::create
#     - Tree::configure
#     - Tree::cget
#     - Tree::insert
#     - Tree::itemconfigure
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
        {-selectbackground TkResource "" 0 listbox}
        {-selectforeground TkResource "" 0 listbox}
	{-selectcommand    String     "" 0}
        {-width            TkResource "" 0 listbox}
        {-height           TkResource "" 0 listbox}
        {-selectfill       Boolean 0  0}
        {-showlines        Boolean 1  0}
        {-linesfill        TkResource black  0 {listbox -foreground}}
        {-linestipple      TkResource ""     0 {label -bitmap}}
	{-crossfill        TkResource black  0 {listbox -foreground}}
        {-redraw           Boolean 1  0}
        {-opencmd          String  "" 0}
        {-closecmd         String  "" 0}
        {-dropovermode     Flag    "wpn" 0 "wpn"}
        {-bg               Synonym -background}

        {-crossopenimage    String  ""  0}







|

|







89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
        {-selectbackground TkResource "" 0 listbox}
        {-selectforeground TkResource "" 0 listbox}
	{-selectcommand    String     "" 0}
        {-width            TkResource "" 0 listbox}
        {-height           TkResource "" 0 listbox}
        {-selectfill       Boolean 0  0}
        {-showlines        Boolean 1  0}
        {-linesfill        TkResource ""  0 {listbox -foreground}}
        {-linestipple      TkResource ""     0 {label -bitmap}}
	{-crossfill        TkResource ""  0 {listbox -foreground}}
        {-redraw           Boolean 1  0}
        {-opencmd          String  "" 0}
        {-closecmd         String  "" 0}
        {-dropovermode     Flag    "wpn" 0 "wpn"}
        {-bg               Synonym -background}

        {-crossopenimage    String  ""  0}
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
    } elseif { [visible $path $parent] } {
        # parent is visible...
        if { [Widget::getMegawidgetOption $path.$parent -open] } {
            # ...and opened -> redraw whole
            _redraw_idle $path 3
        } else {
            # ...and closed -> redraw cross
            lappend data(upd,nodes) $parent 8
            _redraw_idle $path 2
        }
    }

    return $node
}








|







346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
    } elseif { [visible $path $parent] } {
        # parent is visible...
        if { [Widget::getMegawidgetOption $path.$parent -open] } {
            # ...and opened -> redraw whole
            _redraw_idle $path 3
        } else {
            # ...and closed -> redraw cross
            MergeFlag $path $parent 8
            _redraw_idle $path 2
        }
    }

    return $node
}

396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415














416
417
418
419
420
421
422
        }

	if {$data(upd,level) < 3 && [Widget::hasChanged $path.$node -padx x]} {
	    _redraw_idle $path 3
	}

	if { $data(upd,level) < 3 && $flag } {
            if { [set idx [lsearch -exact $data(upd,nodes) $node]] == -1 } {
                lappend data(upd,nodes) $node $flag
            } else {
                incr idx
                set flag [expr {[lindex $data(upd,nodes) $idx] | $flag}]
                set data(upd,nodes) [lreplace $data(upd,nodes) $idx $idx $flag]
            }
            _redraw_idle $path 2
        }
    }
    return $result
}
















# ----------------------------------------------------------------------------
#  Command Tree::itemcget
# ----------------------------------------------------------------------------
proc Tree::itemcget { path node option } {
    # Instead of upvar'ing $path as data for this test, just directly refer to
    # it, as that is faster.







<
|
<
<
<
<
<






>
>
>
>
>
>
>
>
>
>
>
>
>
>







396
397
398
399
400
401
402

403





404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
        }

	if {$data(upd,level) < 3 && [Widget::hasChanged $path.$node -padx x]} {
	    _redraw_idle $path 3
	}

	if { $data(upd,level) < 3 && $flag } {

	    MergeFlag $path $node $flag





            _redraw_idle $path 2
        }
    }
    return $result
}

proc Tree::MergeFlag { path node flag } {
    variable $path
    upvar 0  $path data

    # data(upd,nodes) is a key-val list: emulate a dict by an array
    array set n $data(upd,nodes)
    if {![info exists n($node)]} {
	lappend data(upd,nodes) $node $flag
    } else {
	set n($node) [expr {$n($node) | $flag}]
	set data(upd,nodes) [array get n]
    }
    return
}

# ----------------------------------------------------------------------------
#  Command Tree::itemcget
# ----------------------------------------------------------------------------
proc Tree::itemcget { path node option } {
    # Instead of upvar'ing $path as data for this test, just directly refer to
    # it, as that is faster.
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
    set yinc [$path.c cget -yscrollincrement]
    set bbox [$path.c bbox node]
    if { [llength $bbox] } {
        set xs [lindex $bbox 2]
        set ys [lindex $bbox 3]

        if { $w < $xs } {
            set w [expr {int($xs)}]
            if { [set r [expr {$w % $xinc}]] } {
                set w [expr {$w+$xinc-$r}]
            }
        }
        if { $h < $ys } {
            set h [expr {int($ys)}]
            if { [set r [expr {$h % $yinc}]] } {
                set h [expr {$h+$yinc-$r}]
            }
        }
    }

    $path.c configure -scrollregion [list 0 0 $w $h]

    if {[Widget::getoption $path -selectfill]} {
        _redraw_selection $path







<
<
|
|
<

<
<
|
<







1225
1226
1227
1228
1229
1230
1231


1232
1233

1234


1235

1236
1237
1238
1239
1240
1241
1242
    set yinc [$path.c cget -yscrollincrement]
    set bbox [$path.c bbox node]
    if { [llength $bbox] } {
        set xs [lindex $bbox 2]
        set ys [lindex $bbox 3]

        if { $w < $xs } {


            set w [expr {$xs + $w % $xinc}]
        }

        if { $h < $ys } {


            set h [expr {$ys + $h % $yinc}]

        }
    }

    $path.c configure -scrollregion [list 0 0 $w $h]

    if {[Widget::getoption $path -selectfill]} {
        _redraw_selection $path
1919
1920
1921
1922
1923
1924
1925

1926
1927
1928
1929
1930
1931
1932
1933
1934

1935
1936
1937
1938
1939
1940
1941
1942
1943

1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961

1962
1963
1964
1965
1966
1967
1968
	    }
	    set index [lsearch -exact $nodes $node]
	    incr index -1
	    if { $index >= 0 } {
		$win selection set [lindex $nodes $index]
		_set_current_node $win [lindex $nodes $index]
		$win see [lindex $nodes $index]

		return
	    }
	}
	"down" {
	    # Down goes to the node that is vertically below the current node
	    if { [string equal $node ""] } {
		$win selection set [lindex $nodes 0]
		_set_current_node $win [lindex $nodes 0]
		$win see [lindex $nodes 0]

		return
	    }

	    set index [lsearch -exact $nodes $node]
	    incr index
	    if { $index < [llength $nodes] } {
		$win selection set [lindex $nodes $index]
		_set_current_node $win [lindex $nodes $index]
		$win see [lindex $nodes $index]

		return
	    }
	}
	"right" {
	    # On a right arrow, if the current node is closed, open it.
	    # If the current node is open, go to its first child
	    if { [string equal $node ""] } {
		return
	    }
	    set open [$win itemcget $node -open]
            if { $open } {
                if { [llength [$win nodes $node]] } {
		    set index [lsearch -exact $nodes $node]
		    incr index
		    if { $index < [llength $nodes] } {
			$win selection set [lindex $nodes $index]
			_set_current_node $win [lindex $nodes $index]
			$win see [lindex $nodes $index]

			return
		    }
                }
            } else {
                $win itemconfigure $node -open 1
                if {[llength [set cmd [Widget::getoption $win -opencmd]]]} {
                    uplevel \#0 $cmd [list $node]







>









>









>


















>







1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
	    }
	    set index [lsearch -exact $nodes $node]
	    incr index -1
	    if { $index >= 0 } {
		$win selection set [lindex $nodes $index]
		_set_current_node $win [lindex $nodes $index]
		$win see [lindex $nodes $index]
		event generate $win <<TreeSelect>>
		return
	    }
	}
	"down" {
	    # Down goes to the node that is vertically below the current node
	    if { [string equal $node ""] } {
		$win selection set [lindex $nodes 0]
		_set_current_node $win [lindex $nodes 0]
		$win see [lindex $nodes 0]
		event generate $win <<TreeSelect>>
		return
	    }

	    set index [lsearch -exact $nodes $node]
	    incr index
	    if { $index < [llength $nodes] } {
		$win selection set [lindex $nodes $index]
		_set_current_node $win [lindex $nodes $index]
		$win see [lindex $nodes $index]
		event generate $win <<TreeSelect>>
		return
	    }
	}
	"right" {
	    # On a right arrow, if the current node is closed, open it.
	    # If the current node is open, go to its first child
	    if { [string equal $node ""] } {
		return
	    }
	    set open [$win itemcget $node -open]
            if { $open } {
                if { [llength [$win nodes $node]] } {
		    set index [lsearch -exact $nodes $node]
		    incr index
		    if { $index < [llength $nodes] } {
			$win selection set [lindex $nodes $index]
			_set_current_node $win [lindex $nodes $index]
			$win see [lindex $nodes $index]
			event generate $win <<TreeSelect>>
			return
		    }
                }
            } else {
                $win itemconfigure $node -open 1
                if {[llength [set cmd [Widget::getoption $win -opencmd]]]} {
                    uplevel \#0 $cmd [list $node]
1995
1996
1997
1998
1999
2000
2001

2002
2003
2004
2005
2006
2007
2008
			    break
		        }
                    }
		}
		$win selection set $parent
		_set_current_node $win $parent
		$win see $parent

		return
	    }
	}
	"space" {
	    if { [string equal $node ""] } {
		return
	    }







>







2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
			    break
		        }
                    }
		}
		$win selection set $parent
		_set_current_node $win $parent
		$win see $parent
		event generate $win <<TreeSelect>>
		return
	    }
	}
	"space" {
	    if { [string equal $node ""] } {
		return
	    }
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
            event generate $path <<TreeSelect>>
        }
    }
}

proc Tree::_node_name { path node } {
    # Make sure node names are safe as tags and variable names
    set map [list & \1 | \2 ^ \3 ! \4 :: \5]
    return  [string map $map $node]
}

proc Tree::_node_name_rev { path node } {
    # Allow reverse interpretation of node names
    set map [list \1 & \2 | \3 ^ \4 ! \5 ::]
    return  [string map $map $node]
}


# ----------------------------------------------------------------------------
#  Command Tree::_destroy
# ----------------------------------------------------------------------------







|





|







2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
            event generate $path <<TreeSelect>>
        }
    }
}

proc Tree::_node_name { path node } {
    # Make sure node names are safe as tags and variable names
    set map [list & \1 | \2 ^ \3 ! \4 : \5]
    return  [string map $map $node]
}

proc Tree::_node_name_rev { path node } {
    # Allow reverse interpretation of node names
    set map [list \1 & \2 | \3 ^ \4 ! \5 :]
    return  [string map $map $node]
}


# ----------------------------------------------------------------------------
#  Command Tree::_destroy
# ----------------------------------------------------------------------------

Changes to utils.tcl.

1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  utils.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: utils.tcl,v 1.15 2009/06/10 08:48:06 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - GlobalVar::exists
#     - GlobalVar::setvarvar
#     - GlobalVar::getvarvar
#     - BWidget::assert
#     - BWidget::clonename



|







1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  utils.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: utils.tcl,v 1.15.2.1 2009/09/03 17:29:03 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - GlobalVar::exists
#     - GlobalVar::setvarvar
#     - GlobalVar::getvarvar
#     - BWidget::assert
#     - BWidget::clonename
242
243
244
245
246
247
248
249





250

251









252





253
254
255
256
257
258
259
#  Currently there is no way to ask Tk the extent of the Windows desktop in 
#  a multi monitor system. Nor what the legal co-ordinate range might be.
#
proc BWidget::place { path w h args } {
    variable _top

    update idletasks
    set reqw [winfo reqwidth  $path]





    set reqh [winfo reqheight $path]

    if { $w == 0 } {set w $reqw}









    if { $h == 0 } {set h $reqh}






    set arglen [llength $args]
    if { $arglen > 3 } {
        return -code error "BWidget::place: bad number of argument"
    }

    if { $arglen > 0 } {







|
>
>
>
>
>
|
>
|
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>







242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
#  Currently there is no way to ask Tk the extent of the Windows desktop in 
#  a multi monitor system. Nor what the legal co-ordinate range might be.
#
proc BWidget::place { path w h args } {
    variable _top

    update idletasks

    # If the window is not mapped, it may have any current size.
    # Then use required size, but bound it to the screen width.
    # This is mostly inexact, because any toolbars will still be removed
    # which may reduce size.
    if { $w == 0 && [winfo ismapped $path] } {
        set w [winfo width $path]
    } else {
        if { $w == 0 } {
            set w [winfo reqwidth $path]
        }
        set vsw [winfo vrootwidth  $path]
        if { $w > $vsw } { set w $vsw }
    }

    if { $h == 0 && [winfo ismapped $path] } {
        set h [winfo height $path]
    } else {
        if { $h == 0 } {
            set h [winfo reqheight $path]
        }
        set vsh [winfo vrootheight $path]
        if { $h > $vsh } { set h $vsh }
    }

    set arglen [llength $args]
    if { $arglen > 3 } {
        return -code error "BWidget::place: bad number of argument"
    }

    if { $arglen > 0 } {
302
303
304
305
306
307
308

309



















310









311
312
313
314
315
316
317
            if { $idx == 1 } {
                if { $arglen == 2 } {
                    # center to widget
                    set x0 [expr {[winfo rootx $widget] + ([winfo width  $widget] - $w)/2}]
                    set y0 [expr {[winfo rooty $widget] + ([winfo height $widget] - $h)/2}]
                } else {
                    # center to screen

                    set x0 [expr {([winfo screenwidth  $path] - $w)/2 - [winfo vrootx $path]}]



















                    set y0 [expr {([winfo screenheight $path] - $h)/2 - [winfo vrooty $path]}]









                }
                set x "+$x0"
                set y "+$y0"
                if {$::tcl_platform(platform) != "windows"} {
                    if { $x0+$w > $sw } {set x "-0"; set x0 [expr {$sw-$w}]}
                    if { $x0 < 0 }      {set x "+0"}
                    if { $y0+$h > $sh } {set y "-0"; set y0 [expr {$sh-$h}]}







>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>







322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
            if { $idx == 1 } {
                if { $arglen == 2 } {
                    # center to widget
                    set x0 [expr {[winfo rootx $widget] + ([winfo width  $widget] - $w)/2}]
                    set y0 [expr {[winfo rooty $widget] + ([winfo height $widget] - $h)/2}]
                } else {
                    # center to screen
                    set x [winfo rootx $path]
                    set x0 [expr {($sw - $w)/2}]
                    set vx [winfo vrootx $path]
                    set vw [winfo vrootwidth $path]
                    if {$x < 0 && $vx < 0} {
                        # We are left to the main screen
                        # Start of left screen: vx (negative)
                        # End coordinate of left screen: -1
                        # Width of left screen: vx * -1
                        # x0 = vx + ( -vx - w ) / 2
                        set x0 [expr {($vx - $w)/2}]
                    } elseif {$x > $sw && $vx+$vw > $sw} {
                        # We are right to the main screen
                        # Start of right screen: sw
                        # End of right screen: vx+vw-1
                        # Width of right screen: vx+vw-sw
                        # x0 = sw + ( vx + vw - sw - w ) / 2
                        set x0 [expr {($vx+$vw+$sw-$w)/2}]
                    }
                    # Same for y
                    set y [winfo rooty $path]
                    set y0 [expr {($sh - $h)/2}]
                    set vy [winfo vrooty $path]
                    set vh [winfo vrootheight $path]
                    if {$y < 0 && $vy < 0} {
                        # We are above to the main screen
                        set y0 [expr {($vy - $h)/2}]
                    } elseif {$y > $sh && $vy+$vh > $sh} {
                        # We are below to the main screen
                        set x0 [expr {($vy+$vh-$sh-$h)/2+$sh}]
                    }
                }
                set x "+$x0"
                set y "+$y0"
                if {$::tcl_platform(platform) != "windows"} {
                    if { $x0+$w > $sw } {set x "-0"; set x0 [expr {$sw-$w}]}
                    if { $x0 < 0 }      {set x "+0"}
                    if { $y0+$h > $sh } {set y "-0"; set y0 [expr {$sh-$h}]}

Changes to widget.tcl.

1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  widget.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: widget.tcl,v 1.35 2009/07/02 16:22:18 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - Widget::tkinclude
#     - Widget::bwinclude
#     - Widget::declare
#     - Widget::addmap
#     - Widget::init



|







1
2
3
4
5
6
7
8
9
10
11
# ----------------------------------------------------------------------------
#  widget.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: widget.tcl,v 1.35.2.1 2011/11/14 14:33:29 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - Widget::tkinclude
#     - Widget::bwinclude
#     - Widget::declare
#     - Widget::addmap
#     - Widget::init
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Steps for creating a bwidget megawidget:
# 1. parse args to extract subwidget spec
# 2. Create frame with appropriate class and command line options
# 3. Get initialization options from optionDB, using frame
# 4. create subwidgets

# Uses newer string operations
package require Tcl 8.1.1

namespace eval Widget {
    variable _optiontype
    variable _class
    variable _tk_widget

    # This controls whether we try to use themed widgets from Tile







|







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Steps for creating a bwidget megawidget:
# 1. parse args to extract subwidget spec
# 2. Create frame with appropriate class and command line options
# 3. Get initialization options from optionDB, using frame
# 4. create subwidgets

# Uses newer string operations
package require Tcl 8.1.1-

namespace eval Widget {
    variable _optiontype
    variable _class
    variable _tk_widget

    # This controls whether we try to use themed widgets from Tile
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147

    namespace eval $class {}
    upvar 0 ${class}::opt classopt
    upvar 0 ${class}::map classmap
    upvar 0 ${class}::map$subpath submap
    upvar 0 ${class}::optionExports exports

    set foo [$tkwidget ".ericFoo###"]
    # create resources informations from tk widget resources
    foreach optdesc [_get_tkwidget_options $tkwidget] {
        set option [lindex $optdesc 0]
        if { (![info exists include] || [info exists include($option)]) &&
             ![info exists remove($option)] } {
            if { [llength $optdesc] == 3 } {
                # option is a synonym







<







133
134
135
136
137
138
139

140
141
142
143
144
145
146

    namespace eval $class {}
    upvar 0 ${class}::opt classopt
    upvar 0 ${class}::map classmap
    upvar 0 ${class}::map$subpath submap
    upvar 0 ${class}::optionExports exports


    # create resources informations from tk widget resources
    foreach optdesc [_get_tkwidget_options $tkwidget] {
        set option [lindex $optdesc 0]
        if { (![info exists include] || [info exists include($option)]) &&
             ![info exists remove($option)] } {
            if { [llength $optdesc] == 3 } {
                # option is a synonym
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
		# Store the forward and backward mappings for this
		# option <-> realoption pair
                lappend classmap($option) $subpath "" $realopt
		set submap($realopt) $option
            }
        }
    }
    ::destroy $foo
}


# ----------------------------------------------------------------------------
#  Command Widget::bwinclude
#     Includes BWidget resources to BWidget widget.
#  class    class name of the BWidget







<







184
185
186
187
188
189
190

191
192
193
194
195
196
197
		# Store the forward and backward mappings for this
		# option <-> realoption pair
                lappend classmap($option) $subpath "" $realopt
		set submap($realopt) $option
            }
        }
    }

}


# ----------------------------------------------------------------------------
#  Command Widget::bwinclude
#     Includes BWidget resources to BWidget widget.
#  class    class name of the BWidget
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406


















407
408




















409
410

411
412




413
414
415
416
417
418
419
420
421
422










423
424
425
426
427






428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
	    set optionDbName ".[lindex [_configure_option $option ""] 0]"
	    option add *${class}${optionDbName} $value widgetDefault
	    set exports($option) $optionDbName
            set classopt($option) [list $type $value $ro $arg]
            continue
        }

        # retreive default value for TkResource
        if { [string equal $type "TkResource"] } {
            set tkwidget [lindex $arg 0]
	    set foo [$tkwidget ".ericFoo##"]
            set realopt  [lindex $arg 1]
            if { ![string length $realopt] } {
                set realopt $option
            }
            set tkoptions [_get_tkwidget_options $tkwidget]



            if { ![string length $value] } {
                # We initialize default value
		set ind [lsearch $tkoptions [list $realopt *]]
                set value [lindex [lindex $tkoptions $ind] end]
            }
	    set optionDbName ".[lindex [_configure_option $option ""] 0]"
	    option add *${class}${optionDbName} $value widgetDefault
	    set exports($option) $optionDbName
            set classopt($option) [list TkResource $value $ro \
		    [list $tkwidget $realopt]]
	    set optionClass($option) [lindex [$foo configure $realopt] 1]
	    ::destroy $foo
            continue
        }

	set optionDbName ".[lindex [_configure_option $option ""] 0]"
	option add *${class}${optionDbName} $value widgetDefault
	set exports($option) $optionDbName
        # for any other resource type, we keep original optdesc
        set classopt($option) [list $type $value $ro $arg]
    }
}




















proc Widget::define { class filename args } {
    variable ::BWidget::use




















    set use($class)      $args
    set use($class,file) $filename

    lappend use(classes) $class





    if {[set x [lsearch -exact $args "-classonly"]] > -1} {
	set args [lreplace $args $x $x]
    } else {
	interp alias {} ::${class} {} ${class}::create
	proc ::${class}::use {} {}

	bind $class <Destroy> [list Widget::destroy %W]
    }

    foreach class $args { ${class}::use }










}


proc Widget::create { class path {rename 1} } {
    if {$rename} { rename $path ::$path:cmd }






    proc ::$path { cmd args } \
    	[subst {return \[eval \[linsert \$args 0 ${class}::\$cmd [list $path]\]\]}]
    return $path
}


# ----------------------------------------------------------------------------
#  Command Widget::addmap
# ----------------------------------------------------------------------------
proc Widget::addmap { class subclass subpath options } {
    upvar 0 ${class}::opt classopt
    upvar 0 ${class}::optionExports exports
    upvar 0 ${class}::optionClass optionClass
    upvar 0 ${class}::map classmap
    upvar 0 ${class}::map$subpath submap

    foreach {option realopt} $options {
        if { ![string length $realopt] } {
            set realopt $option
        }







|


<





>
>
>


<
|






|
<












>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>


>
>
>
>
|
<
|
|
|
<



|
>
>
>
>
>
>
>
>
>
>





>
>
>
>
>
>

|










<







365
366
367
368
369
370
371
372
373
374

375
376
377
378
379
380
381
382
383
384

385
386
387
388
389
390
391
392

393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454

455
456
457

458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494

495
496
497
498
499
500
501
	    set optionDbName ".[lindex [_configure_option $option ""] 0]"
	    option add *${class}${optionDbName} $value widgetDefault
	    set exports($option) $optionDbName
            set classopt($option) [list $type $value $ro $arg]
            continue
        }

        # retrieve default value for TkResource
        if { [string equal $type "TkResource"] } {
            set tkwidget [lindex $arg 0]

            set realopt  [lindex $arg 1]
            if { ![string length $realopt] } {
                set realopt $option
            }
            set tkoptions [_get_tkwidget_options $tkwidget]
            set ind [lsearch $tkoptions [list $realopt *]]
            set optdesc [lindex $tkoptions $ind];
            set tkoptions [_get_tkwidget_options $tkwidget]
            if { ![string length $value] } {
                # We initialize default value

                set value [lindex $optdesc end]
            }
	    set optionDbName ".[lindex [_configure_option $option ""] 0]"
	    option add *${class}${optionDbName} $value widgetDefault
	    set exports($option) $optionDbName
            set classopt($option) [list TkResource $value $ro \
		    [list $tkwidget $realopt]]
	    set optionClass($option) [lindex $optdesc 1]

            continue
        }

	set optionDbName ".[lindex [_configure_option $option ""] 0]"
	option add *${class}${optionDbName} $value widgetDefault
	set exports($option) $optionDbName
        # for any other resource type, we keep original optdesc
        set classopt($option) [list $type $value $ro $arg]
    }
}


# ----------------------------------------------------------------------------
#  Command Widget::define
#  	Declares a new class and loads its dependencies.
#
# Arguments:
#	class		megawidget class
#	filename	file where the class resides
#	options    	The following options are supported:
#			-classonly	Prevents megawidget setup: creation of
#					megawidget alias, binding of the
#					<Destroy> event and stubbing of the
#					'use' procedure.
#			-namespace ns	Indicate the namespace where the
#					megawidget's procedures reside. Defaults
#					to ::${class}.
#	dependencies   	classes the class being defined depends on.
#
# ----------------------------------------------------------------------------
proc Widget::define { class filename args } {
    variable ::BWidget::use
    set classonly 0;
    set ns ::${class};
    for {set i 0; set n [llength $args]} {$i < $n} {incr i} {
	set option [lindex $args $i];
	switch -- $option {
	    -classonly {
		set classonly 1;
	    }
	    -namespace {
		incr i;
		set ns [lindex $args $i];
	    }
	    default {
		# stop processing options
		break;
	    }
	}
    }
    set args [lrange $args $i end]

    set use($class)      $args
    set use($class,file) $filename
    set use($class,namespace) $ns;
    lappend use(classes) $class

    # Make sure the class description namespace exists.
    namespace eval $class {}
    # Make sure the megawidget namespace exists.
    namespace eval $ns {}


    if {!$classonly} {
	interp alias {} ${ns} {} ${ns}::create
	proc ${ns}::use {} {}

	bind $class <Destroy> [list Widget::destroy %W]
    }

    foreach dep $args {
	if {![info exists use(${dep},namespace)]} {
	    # Lazy-loaded modules are not yet loaded (actually that seems to be
	    # the whole point of this 'use' mechanism.) so they have not configured
	    # a namespace. Use namespace=class convention. Note that the class MUST
	    # not be prefixed by ::.
	    ${dep}::use;
	} else {
	    $use(${dep},namespace)::use;
	}
    }
}


proc Widget::create { class path {rename 1} } {
    if {$rename} { rename $path ::$path:cmd }

    variable ::BWidget::use;
    set ns [expr {[info exists use(${class},namespace)]
		  ? $use(${class},namespace)
		  : $class}];

    proc ::$path { cmd args } \
	[subst {return \[eval \[linsert \$args 0 ${ns}::\$cmd [list $path]\]\]}]
    return $path
}


# ----------------------------------------------------------------------------
#  Command Widget::addmap
# ----------------------------------------------------------------------------
proc Widget::addmap { class subclass subpath options } {
    upvar 0 ${class}::opt classopt
    upvar 0 ${class}::optionExports exports

    upvar 0 ${class}::map classmap
    upvar 0 ${class}::map$subpath submap

    foreach {option realopt} $options {
        if { ![string length $realopt] } {
            set realopt $option
        }
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
	# Store the forward and backward mappings for this
	# option <-> realoption pair
        lappend classmap($option) $subpath $subclass $realopt
	set submap($realopt) $option
    }
}


# ----------------------------------------------------------------------------
#  Command Widget::syncoptions
# ----------------------------------------------------------------------------
proc Widget::syncoptions { class subclass subpath options } {
    upvar 0 ${class}::sync classync

    foreach {option realopt} $options {
        if { ![string length $realopt] } {
            set realopt $option
        }
        set classync($option) [list $subpath $subclass $realopt]
    }
}


# ----------------------------------------------------------------------------
#  Command Widget::init
# ----------------------------------------------------------------------------
proc Widget::init { class path options } {
    variable _inuse
    variable _class







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







509
510
511
512
513
514
515















516
517
518
519
520
521
522
	# Store the forward and backward mappings for this
	# option <-> realoption pair
        lappend classmap($option) $subpath $subclass $realopt
	set submap($realopt) $option
    }
}

















# ----------------------------------------------------------------------------
#  Command Widget::init
# ----------------------------------------------------------------------------
proc Widget::init { class path options } {
    variable _inuse
    variable _class
768
769
770
771
772
773
774
775






776

777
778
779
780
781
782
783
    }
    if {[info exists pathinit]} {
        unset pathinit
    }

    if {![string equal [info commands $path] ""]} { rename $path "" }

    ## Unset any variables used in this widget.






    foreach var [info vars ::${class}::$path:*] { unset $var }


    unset _class($path)
}


# ----------------------------------------------------------------------------
#  Command Widget::configure







|
>
>
>
>
>
>
|
>







807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
    }
    if {[info exists pathinit]} {
        unset pathinit
    }

    if {![string equal [info commands $path] ""]} { rename $path "" }

    # Unset any variables used in this widget.
    # Guard, as some internal classes (Bitmap, LabelEntry, ListBox::Item,
    # NoteBook::Page, PanedWindow::Pane, ScrollableFrame, ScrollableFrame,
    # ScrollableFrame, Tree::Node, Wizard::Branch, Wizard::Step, Wizard::Widget)
    # are declared but not defined.
    if {[info exists ::BWidget::use(${class},namespace)]} {
	set ns $::BWidget::use(${class},namespace);
	foreach var [info vars ${ns}::${path}:*] { unset $var }
    }

    unset _class($path)
}


# ----------------------------------------------------------------------------
#  Command Widget::configure
825
826
827
828
829
830
831

832
833
834
835
836
837
838
839
840
                    # | ""       | *       | own              | window         | window  |
                    # | *        | :cmd    | own              | window         | current |
                    # | *        | *       | subwidget        | window.subpath | current |
                    if { [string length $subclass] && ! [string equal $subclass ":cmd"] } {
                        if { [string equal $subpath ":cmd"] } {
                            set subpath ""
                        }

                        set curval [${subclass}::cget $window$subpath $realopt]
                        ${subclass}::configure $window$subpath $realopt $newval
                    } else {
                        set curval [$window$subpath cget $realopt]
                        $window$subpath configure $realopt $newval
                    }
                }
            } else {
		set curval $pathopt($option)







>
|
|







871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
                    # | ""       | *       | own              | window         | window  |
                    # | *        | :cmd    | own              | window         | current |
                    # | *        | *       | subwidget        | window.subpath | current |
                    if { [string length $subclass] && ! [string equal $subclass ":cmd"] } {
                        if { [string equal $subpath ":cmd"] } {
                            set subpath ""
                        }
                        set ns $::BWidget::use(${subclass},namespace);
                        set curval [${ns}::cget $window$subpath $realopt]
                        ${ns}::configure $window$subpath $realopt $newval
                    } else {
                        set curval [$window$subpath cget $realopt]
                        $window$subpath configure $realopt $newval
                    }
                }
            } else {
		set curval $pathopt($option)
1096
1097
1098
1099
1100
1101
1102













1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
        }
    } else {
        set optclass [string range $option 1 end]
    }
    return [list $optdb $optclass]
}















# ----------------------------------------------------------------------------
#  Command Widget::_get_tkwidget_options
# ----------------------------------------------------------------------------
proc Widget::_get_tkwidget_options { tkwidget } {
    variable _tk_widget
    variable _optiondb
    variable _optionclass

    set widget ".#BWidget.#$tkwidget"
    # encapsulation frame to not pollute '.' childspace
    if {![winfo exists ".#BWidget"]} { frame ".#BWidget" }
    if { ![winfo exists $widget] || ![info exists _tk_widget($tkwidget)] } {
	set widget [$tkwidget $widget]
	# JDC: Withdraw toplevels, otherwise visible
	if {[string equal $tkwidget "toplevel"]} {
	    wm withdraw $widget







>
>
>
>
>
>
>
>
>
>
>
>
>









|







1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
        }
    } else {
        set optclass [string range $option 1 end]
    }
    return [list $optdb $optclass]
}

# ----------------------------------------------------------------------------
#  Command Widget::_make_tk_widget_name
# ----------------------------------------------------------------------------
# Before, the widget meta name was build as: ".#BWidget.#$tkwidget"
# This does not work for ttk widgets, as they have an "::" in their name.
# Thus replace any "::" by "__" will do the job.
proc Widget::_make_tk_widget_name { tkwidget } {
    set pos 0
    for {set pos 0} {0 <= [set pos [string first "::" $tkwidget $pos]]} {incr pos} {
	set tkwidget [string range $tkwidget 0 [expr {$pos-1}]]__[string range $tkwidget [expr {$pos+2}] end]
    }
    return ".#BWidget.#$tkwidget"
}

# ----------------------------------------------------------------------------
#  Command Widget::_get_tkwidget_options
# ----------------------------------------------------------------------------
proc Widget::_get_tkwidget_options { tkwidget } {
    variable _tk_widget
    variable _optiondb
    variable _optionclass

    set widget [_make_tk_widget_name $tkwidget]
    # encapsulation frame to not pollute '.' childspace
    if {![winfo exists ".#BWidget"]} { frame ".#BWidget" }
    if { ![winfo exists $widget] || ![info exists _tk_widget($tkwidget)] } {
	set widget [$tkwidget $widget]
	# JDC: Withdraw toplevels, otherwise visible
	if {[string equal $tkwidget "toplevel"]} {
	    wm withdraw $widget
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
# ----------------------------------------------------------------------------
#  Command Widget::_test_tkresource
# ----------------------------------------------------------------------------
proc Widget::_test_tkresource { option value arg } {
#    set tkwidget [lindex $arg 0]
#    set realopt  [lindex $arg 1]
    foreach {tkwidget realopt} $arg break
    set path     ".#BWidget.#$tkwidget"
    set old      [$path cget $realopt]
    $path configure $realopt $value
    set res      [$path cget $realopt]
    $path configure $realopt $old

    return $res
}







|







1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
# ----------------------------------------------------------------------------
#  Command Widget::_test_tkresource
# ----------------------------------------------------------------------------
proc Widget::_test_tkresource { option value arg } {
#    set tkwidget [lindex $arg 0]
#    set realopt  [lindex $arg 1]
    foreach {tkwidget realopt} $arg break
    set path     [_make_tk_widget_name $tkwidget]
    set old      [$path cget $realopt]
    $path configure $realopt $value
    set res      [$path cget $realopt]
    $path configure $realopt $old

    return $res
}
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
    }
    if {($code == 0) && ($value != "")} {
	if {$value == 0} {
	    return 0
	} elseif {$value == 1} {
	    return [winfo viewable $w]
	} else {
	    set value [uplevel \#0 $value $w]
            if {$value != ""} {
		return $value
	    }
        }
    }
    if {![winfo viewable $w]} {
	return 0







|







1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
    }
    if {($code == 0) && ($value != "")} {
	if {$value == 0} {
	    return 0
	} elseif {$value == 1} {
	    return [winfo viewable $w]
	} else {
	    set value [uplevel \#0 [list $value $w]]
            if {$value != ""} {
		return $value
	    }
        }
    }
    if {![winfo viewable $w]} {
	return 0
1471
1472
1473
1474
1475
1476
1477

1478























































1479
1480
1481
1482
1483

1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519

1520
1521
1522
1523
1524
1525
1526
1527
1528
	event generate $focus <<TraverseOut>>
    }
    focus $w

    event generate $w <<TraverseIn>>
}


























































# Widget::varForOption --
#
#	Retrieve a fully qualified variable name for the option specified.
#	If the option is not one for which a variable exists, throw an error 
#	(ie, those options that map directly to widget options).

#
# Arguments:
#	path	megawidget to get an option var for.
#	option	option to get a var for.
#
# Results:
#	varname	name of the variable, fully qualified, suitable for tracing.

proc Widget::varForOption {path option} {
    variable _class
    variable _optiontype

    set class $_class($path)
    upvar 0 ${class}::$path:opt pathopt

    if { ![info exists pathopt($option)] } {
	error "unable to find variable for option \"$option\""
    }
    set varname "::Widget::${class}::$path:opt($option)"
    return $varname
}

# Widget::getVariable --
#
#       Get a variable from within the namespace of the widget.
#
# Arguments:
#	path		Megawidget to get the variable for.
#	varName		The variable name to retrieve.
#       newVarName	The variable name to refer to in the calling proc.
#
# Results:
#	Creates a reference to newVarName in the calling proc.
proc Widget::getVariable { path varName {newVarName ""} } {
    variable _class
    set class $_class($path)

    if {![string length $newVarName]} { set newVarName $varName }
    uplevel 1 [list upvar \#0 ${class}::$path:$varName $newVarName]
}

# Widget::options --
#
#       Return a key-value list of options for a widget.  This can
#       be used to serialize the options of a widget and pass them
#       on to a new widget with the same options.







>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




|
>









<
<
|
<
<
<
<
<
<
<
<
















>

|







1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609


1610








1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
	event generate $focus <<TraverseOut>>
    }
    focus $w

    event generate $w <<TraverseIn>>
}

# Widget::which --
#
#	Retrieve a fully qualified variable name for the specified option or
#	widget variable.
#
#	If the option is not one for which a variable exists, throw an error
#	(ie, those options that map directly to widget options).
#
#	For widget variables, return the fully qualified name even if the
#	variable had not been previously set, in order to allow adding variable
#	traces prior to their creation.
#
# Arguments:
#	path	megawidget to get an option var for.
#	type	either -option or -variable.
#	name    name of the option or widget variable.
#
# Results:
#	Fully qualified name of the variable for the option or the widget
#	variable.
#
proc Widget::which {path args} {
    switch -- [llength $args] {
	1 {
	    set type -option;
	    set name [lindex $args 0];
	}
	2 {
	    set type [lindex $args 0];
	    set name [lindex $args 1];
	}
	default {
	    return -code error "incorrect number of arguments";
	}
    }

    variable _class;
    set class $_class($path);

    switch -- $type {
	-option {
	    upvar 0 ${class}::$path:opt pathopt;

	    if { ![info exists pathopt($name)] } {
		error "unable to find variable for option \"$name\"";
	    }

	    return ::Widget::${class}::${path}:opt(${name});
	}
	-variable {
	    set ns $::BWidget::use(${class},namespace);
	    return ${ns}::${path}:${name};
	}
    }
}


# Widget::varForOption --
#
#	Retrieve a fully qualified variable name for the option specified.
#	If the option is not one for which a variable exists, throw an error 
#	(ie, those options that map directly to widget options) Superseded by
#       widget::which.
#
# Arguments:
#	path	megawidget to get an option var for.
#	option	option to get a var for.
#
# Results:
#	varname	name of the variable, fully qualified, suitable for tracing.

proc Widget::varForOption {path option} {


    return [::Widget::which $path -option $option];








}

# Widget::getVariable --
#
#       Get a variable from within the namespace of the widget.
#
# Arguments:
#	path		Megawidget to get the variable for.
#	varName		The variable name to retrieve.
#       newVarName	The variable name to refer to in the calling proc.
#
# Results:
#	Creates a reference to newVarName in the calling proc.
proc Widget::getVariable { path varName {newVarName ""} } {
    variable _class
    set class $_class($path)
    set ns $::BWidget::use(${class},namespace);
    if {![string length $newVarName]} { set newVarName $varName }
    uplevel 1 [list ::upvar \#0 ${ns}::${path}:${varName} $newVarName]
}

# Widget::options --
#
#       Return a key-value list of options for a widget.  This can
#       be used to serialize the options of a widget and pass them
#       on to a new widget with the same options.
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
}

proc Widget::theme {{bool {}}} {
    # Private, *experimental* API that may change at any time - JH
    variable _theme
    if {[llength [info level 0]] == 2} {
	# set theme-ability
	if {[catch {package require Tk 8.5a6}]
	    && [catch {package require tile 0.6}]
	    && [catch {package require tile 1}]} {
	    return -code error "BWidget's theming requires tile 0.6+"
	} else {
	    catch {style default BWSlim.Toolbutton -padding 0}
	}
	set _theme [string is true -strict $bool]
    }
    return $_theme
}







|
<
|
|
<
<





1701
1702
1703
1704
1705
1706
1707
1708

1709
1710


1711
1712
1713
1714
1715
}

proc Widget::theme {{bool {}}} {
    # Private, *experimental* API that may change at any time - JH
    variable _theme
    if {[llength [info level 0]] == 2} {
	# set theme-ability
	if {[catch {package require Ttk}]

	    && [catch {package require tile 0.8}]} {
	    return -code error "BWidget's theming requires ttk/tile 0.8+"


	}
	set _theme [string is true -strict $bool]
    }
    return $_theme
}

Changes to xpm2image.tcl.

1
2
3
4
5
6
7
8
9
10
11
12



































































13
14
15
16
17
18
19
20
21
22





23
24
25
26
27
28
29
# ----------------------------------------------------------------------------
#  xpm2image.tcl
#  Slightly modified xpm-to-image command
#  $Id: xpm2image.tcl,v 1.5 2004/09/09 22:17:03 hobbs Exp $
# ------------------------------------------------------------------------------
#
#  Copyright 1996 by Roger E. Critchlow Jr., San Francisco, California
#  All rights reserved, fair use permitted, caveat emptor.
#  [email protected]
# 
# ----------------------------------------------------------------------------




































































proc xpm-to-image { file } {
    set f [open $file]
    set string [read $f]
    close $f

    #
    # parse the strings in the xpm data
    #
    set xpm {}
    foreach line [split $string "\n"] {





        if {[regexp {^"([^\"]*)"} $line all meat]} {
            if {[string first XPMEXT $meat] == 0} {
                break
            }
            lappend xpm $meat
        }
    }












>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





<




>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# ----------------------------------------------------------------------------
#  xpm2image.tcl
#  Slightly modified xpm-to-image command
#  $Id: xpm2image.tcl,v 1.5 2004/09/09 22:17:03 hobbs Exp $
# ------------------------------------------------------------------------------
#
#  Copyright 1996 by Roger E. Critchlow Jr., San Francisco, California
#  All rights reserved, fair use permitted, caveat emptor.
#  [email protected]
# 
# ----------------------------------------------------------------------------

proc _xpm-to-image_process_line { line } {
    upvar 1 data data
    set line [string map {"\t" " "} $line]

    set idx $data(chars_per_pixel)
    incr idx -1
    set cname [string range $line 0 $idx]


    set lend [string trim [string range $line $data(chars_per_pixel) end]]

    ## now replace multiple spaces with just one..
    while {-1 != [string first  "  " $lend]} {
        set lend [string map {"  " " "} $lend]
    }
    set cl [split $lend " "]

    set idx 0
    set clen [llength $cl]

    ## scan through the line, looking for records of type c, g or m
    while { $idx < $clen } {
        set key [lindex $cl $idx]
        if { [string equal $key {}] } {
            incr idx
            continue
        }

        while { ![string equal $key "c"]
                && ![string equal $key "m"]
                && ![string equal $key "g"]
                && ![string equal $key "g4"]
                && ![string equal $key ""]
        } { 
            incr idx
            set key [lindex $cl $idx]
        }

        incr idx
        set color [string tolower [lindex $cl $idx]]

        ## one file used opaque to mean black
        if { [string equal -nocase $color "opaque"] } {
            set color "black"
        }
        set data(color-$key-$cname) $color
        if { [string equal -nocase $color "none"] } {
            set data(transparent) $cname
        }
        incr idx
    }

    
    foreach key {c g g4 m} {
        if {[info exists data(color-$key-$cname)]} {
            set color $data(color-$key-$cname)
            set data(color-$cname) $color
            set data(cname-$color) $cname
            lappend data(colors) $color
            break
        }
    }
    if { ![info exists data(color-$cname)] } {
        error "color definition {$line} failed to define a color"
    }
}

proc xpm-to-image { file } {
    set f [open $file]
    set string [read $f]
    close $f


    # parse the strings in the xpm data
    #
    set xpm {}
    foreach line [split $string "\n"] {
        ## some files have blank lines in them, skip those
        ## also, some files indent each line with spaces - remove those
        set line [string trim $line]
        if { $line eq "" } { continue }

        if {[regexp {^"([^\"]*)"} $line all meat]} {
            if {[string first XPMEXT $meat] == 0} {
                break
            }
            lappend xpm $meat
        }
    }
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

87
88
89
90
91













92
93
94
95
96
97
98
99
100
101
102



103
104
105
106
107
108
109
110
111
112
113
114
115
	    error "size line {$sizes} in $file did not compute"
    }

    #
    # extract the color definitions in the xpm data
    #
    foreach line [lrange $xpm 1 $data(ncolors)] {
        set colors [split $line \t]
        set cname  [lindex $colors 0]
        lappend data(cnames) $cname
        if { [string length $cname] != $data(chars_per_pixel) } {
            error "color definition {$line} in file $file has a bad size color name"
        }
        foreach record [lrange $colors 1 end] {
            set key [lindex $record 0]
            set color [string tolower [join [lrange $record 1 end] { }]]
            set data(color-$key-$cname) $color
            if { [string equal -nocase $color "none"] } {
                set data(transparent) $cname
            }
        }
        foreach key {c g g4 m} {
            if {[info exists data(color-$key-$cname)]} {
                set color $data(color-$key-$cname)
                set data(color-$cname) $color
                set data(cname-$color) $cname
                lappend data(colors) $color
                break
            }
        }
        if { ![info exists data(color-$cname)] } {
            error "color definition {$line} in $file failed to define a color"
        }
    }

    #
    # extract the image data in the xpm data
    #
    set image [image create photo -width $data(width) -height $data(height)]
    set y 0

    foreach line [lrange $xpm [expr {1+$data(ncolors)}] [expr {1+$data(ncolors)+$data(height)}]] {
        set x 0
        set pixels {}
        while { [string length $line] > 0 } {
            set pixel [string range $line 0 [expr {$data(chars_per_pixel)-1}]]













            set c $data(color-$pixel)
            if { [string equal $c none] } {
                if { [string length $pixels] } {
                    $image put [list $pixels] -to [expr {$x-[llength $pixels]}] $y
                    set pixels {}
                }
            } else {
                lappend pixels $c
            }
            set line [string range $line $data(chars_per_pixel) end]
            incr x



        }
        if { [llength $pixels] } {
            $image put [list $pixels] -to [expr {$x-[llength $pixels]}] $y
        }
        incr y
    }

    #
    # return the image
    #
    return $image
}








|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







>





>
>
>
>
>
>
>
>
>
>
>
>
>











>
>
>












<
118
119
120
121
122
123
124
125

























126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177

	    error "size line {$sizes} in $file did not compute"
    }

    #
    # extract the color definitions in the xpm data
    #
    foreach line [lrange $xpm 1 $data(ncolors)] {
        _xpm-to-image_process_line $line

























    }

    #
    # extract the image data in the xpm data
    #
    set image [image create photo -width $data(width) -height $data(height)]
    set y 0
    set idx 0
    foreach line [lrange $xpm [expr {1+$data(ncolors)}] [expr {1+$data(ncolors)+$data(height)}]] {
        set x 0
        set pixels {}
        while { [string length $line] > 0 } {
            set pixel [string range $line 0 [expr {$data(chars_per_pixel)-1}]]
            ## see if they lied about the number of colors by not counting
            ## "none" in the color count entry
            set none 0
            if { ($idx == 0) && ([info exists data(cname-none)]) &&  \
                ![info exists data(color-$pixel)] } {
                ## it appears that way - process this line as another
                ## color entry
                _xpm-to-image_process_line $line
                incr idx
                set none 1
                break;
            }
            incr idx
            set c $data(color-$pixel)
            if { [string equal $c none] } {
                if { [string length $pixels] } {
                    $image put [list $pixels] -to [expr {$x-[llength $pixels]}] $y
                    set pixels {}
                }
            } else {
                lappend pixels $c
            }
            set line [string range $line $data(chars_per_pixel) end]
            incr x
        }
        if { $none == 1 } {
            continue
        }
        if { [llength $pixels] } {
            $image put [list $pixels] -to [expr {$x-[llength $pixels]}] $y
        }
        incr y
    }

    #
    # return the image
    #
    return $image
}