Bwidget Source Code
Check-in [307eeef2b7]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:theme related mod's done
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 307eeef2b7dfd978567b9e4b1e08fc1fe75a2596
User & Date: oberdorfer 2009-09-06 21:13:55
Context
2009-09-06
21:28
theme related mod's done check-in: 85325e23c6 user: oberdorfer tags: trunk
21:13
theme related mod's done check-in: 307eeef2b7 user: oberdorfer tags: trunk
21:03
theme related mod's done check-in: 2303975b87 user: oberdorfer tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to entry.tcl.

1
2
3
4
5
6
7
8
9
10
11
..
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
..
74
75
76
77
78
79
80




81
82
83
84
85
86
87
...
130
131
132
133
134
135
136



137
138
139
140
141
142
143
...
466
467
468
469
470
471
472

















# ------------------------------------------------------------------------------
#  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
................................................................................
    # 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 {}}
................................................................................

    bind BwEntry <<Copy>> {}
    bind BwEditableEntry <<Copy>> [bind Entry <<Copy>>]

    bind BwEntry <Return>          [list Entry::invoke %W]
    bind BwEntry <Destroy>         [list Entry::_destroy %W]
    bind BwDisabledEntry <Destroy> [list Entry::_destroy %W]




}


# ------------------------------------------------------------------------------
#  Command Entry::create
# ------------------------------------------------------------------------------
proc Entry::create { path args } {
................................................................................
	}
    }

    DragSite::setdrag $path $path Entry::_init_drag_cmd Entry::_end_drag_cmd 1
    DropSite::setdrop $path $path Entry::_over_cmd Entry::_drop_cmd 1
    DynamicHelp::sethelp $path $path 1




    Widget::create Entry $path
    proc ::$path { cmd args } \
    	"return \[Entry::_path_command [list $path] \$cmd \$args\]"
    return $path
}


................................................................................
# ------------------------------------------------------------------------------
proc Entry::_destroy { path } {
    variable $path
    upvar 0 $path data
    Widget::destroy $path
    unset data
}



















|







 







|
|
>
>
>












<
<
<
<
<
<
<
<
<
<
<







 







>
>
>
>







 







>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
..
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
..
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
...
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
...
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
# ------------------------------------------------------------------------------
#  entry.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: entry.tcl,v 1.23 2009/09/06 21:13:55 oberdorfer Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - Entry::create
#     - Entry::configure
#     - Entry::cget
#     - Entry::_destroy
#     - Entry::_init_drag_cmd
................................................................................
    # 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   Color       "SystemWindow"       0] \
	    [list -foreground   Color       "SystemWindowText"   0] \
            [list -disabledbackground Color "SystemButtonFace"   0] \
            [list -disabledforeground Color "SystemDisabledText" 0] \
	    [list -highlightcolor     Color "SystemHighlight"    0] \
	    [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] \
	]












    Widget::declare Entry $declare
    Widget::addmap Entry "" :cmd { -textvariable {} }

    DynamicHelp::include Entry balloon
    DragSite::include    Entry "" 3
    DropSite::include    Entry {
        TEXT    {move {}}
................................................................................

    bind BwEntry <<Copy>> {}
    bind BwEditableEntry <<Copy>> [bind Entry <<Copy>>]

    bind BwEntry <Return>          [list Entry::invoke %W]
    bind BwEntry <Destroy>         [list Entry::_destroy %W]
    bind BwDisabledEntry <Destroy> [list Entry::_destroy %W]

    if {[lsearch [bindtags .] EntryThemeChanged] < 0} {
        bindtags . [linsert [bindtags .] 1 EntryThemeChanged]
    }
}


# ------------------------------------------------------------------------------
#  Command Entry::create
# ------------------------------------------------------------------------------
proc Entry::create { path args } {
................................................................................
	}
    }

    DragSite::setdrag $path $path Entry::_init_drag_cmd Entry::_end_drag_cmd 1
    DropSite::setdrop $path $path Entry::_over_cmd Entry::_drop_cmd 1
    DynamicHelp::sethelp $path $path 1

    bind EntryThemeChanged <<ThemeChanged>> \
	   "+ [namespace current]::_themechanged $path"

    Widget::create Entry $path
    proc ::$path { cmd args } \
    	"return \[Entry::_path_command [list $path] \$cmd \$args\]"
    return $path
}


................................................................................
# ------------------------------------------------------------------------------
proc Entry::_destroy { path } {
    variable $path
    upvar 0 $path data
    Widget::destroy $path
    unset data
}

# ----------------------------------------------------------------------------
#  Command ListBox::_themechanged
# ----------------------------------------------------------------------------
proc Entry::_themechanged { path } {

    if { ![winfo exists $path] } { return }
    BWidget::set_themedefaults
       $path configure \
           -foreground         $BWidget::colors(SystemWindowText) \
           -background         $BWidget::colors(SystemWindow) \
	   -selectforeground   $BWidget::colors(SystemHighlightText) \
	   -selectbackground   $BWidget::colors(SystemHighlight) \
           -disabledbackground $BWidget::colors(SystemButtonFace) \
	   -disabledforeground $BWidget::colors(SystemDisabledText) \
	   -highlightcolor     $BWidget::colors(SystemHighlight)
}

Changes to font.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
...
100
101
102
103
104
105
106




107
108
109
110
111
112
113
...
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
...
161
162
163
164
165
166
167
168






169
170
171
172
173
174
175
...
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
...
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
...
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
...
353
354
355
356
357
358
359

360
361
362
363
364
365

366
367
368
369
370
371
372
...
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
...
560
561
562
563
564
565
566










# ----------------------------------------------------------------------------
#  font.tcl
#  This file is part of Unifix BWidget Toolkit

# ----------------------------------------------------------------------------
#  Index of commands:
#     - SelectFont::create
#     - SelectFont::configure
#     - SelectFont::cget
#     - SelectFont::_draw
#     - SelectFont::_destroy
#     - SelectFont::_modstyle
#     - SelectFont::_update
#     - SelectFont::_getfont
#     - SelectFont::_init

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

namespace eval SelectFont {
    Widget::define SelectFont font Dialog LabelFrame ScrolledWindow

    Widget::declare SelectFont {
        {-title		String		"Font selection" 0}
        {-parent	String		"" 0}
        {-background	TkResource	"" 0 frame}




        {-type		Enum		dialog        0 {dialog toolbar}}
        {-font		TkResource	""            0 label}
	{-initialcolor	String		""            0}
	{-families	String		"all"         1}
	{-querysystem	Boolean		1             0}
	{-nosizes	Boolean		0             1}
	{-styles	String		"bold italic underline overstrike" 1}
................................................................................
		]
    }
    array set _families [list \
	    presetvariable	$presetVariable	\
	    presetfixed		$presetFixed	\
	    presetall		$presetAll	\
	    ]





    variable _widget
}


# ----------------------------------------------------------------------------
#  Command SelectFont::create
................................................................................
    if { [Widget::getoption "$path#SelectFont" -querysystem] } {
        loadfont [Widget::getoption "$path#SelectFont" -families]
    }

    set bg [Widget::getoption "$path#SelectFont" -background]
    set _styles [Widget::getoption "$path#SelectFont" -styles]
    if { [Widget::getoption "$path#SelectFont" -type] == "dialog" } {

        Dialog::create $path -modal local -anchor e -default 0 -cancel 1 \
	    -background $bg \
            -title  [Widget::getoption "$path#SelectFont" -title] \
            -parent [Widget::getoption "$path#SelectFont" -parent]



        set frame [Dialog::getframe $path]


        set topf  [frame $frame.topf -relief flat -borderwidth 0 -background $bg]


        set labf1 [LabelFrame::create $topf.labf1 -text "Font" -name font \
                       -side top -anchor w -relief flat -background $bg]
        set sw    [ScrolledWindow::create [LabelFrame::getframe $labf1].sw \
                       -background $bg]
        set lbf   [listbox $sw.lb \

                       -height 5 -width 25 -exportselection false -selectmode browse]





        ScrolledWindow::setwidget $sw $lbf
        LabelFrame::configure $labf1 -focus $lbf
	if { [Widget::getoption "$path#SelectFont" -querysystem] } {
	    set fam [Widget::getoption "$path#SelectFont" -families]
	} else {
	    set fam "preset"
	    append fam [Widget::getoption "$path#SelectFont" -families]
................................................................................
        pack $sw -fill both -expand yes

        set labf2 [LabelFrame::create $topf.labf2 -text "Size" -name size \
                       -side top -anchor w -relief flat -background $bg]
        set sw    [ScrolledWindow::create [LabelFrame::getframe $labf2].sw \
                       -scrollbar vertical -background $bg]
        set lbs   [listbox $sw.lb \
                       -height 5 -width 6 -exportselection false -selectmode browse]






        ScrolledWindow::setwidget $sw $lbs
        LabelFrame::configure $labf2 -focus $lbs
        eval [list $lbs insert end] $_sizes
        set script "set [list SelectFont::${path}(size)] \[%W curselection\];\
			SelectFont::_update [list $path]"
        bind $lbs <ButtonRelease-1> $script
        bind $lbs <space>           $script
................................................................................
                       -side top -anchor w -relief sunken -bd 1 -background $bg]
        set subf  [LabelFrame::getframe $labf3]
        foreach st $_styles {
            set name [lindex [BWidget::getname $st] 0]
            if { $name == "" } {
                set name [string toupper $name 0]
            }






            checkbutton $subf.$st -text $name \
                -variable   SelectFont::$path\($st\) \
                -background $bg \
                -command    [list SelectFont::_update $path]


            bind $subf.$st <Return> break
            pack $subf.$st -anchor w
        }
        LabelFrame::configure $labf3 -focus $subf.[lindex $_styles 0]

        pack $labf1 -side left -anchor n -fill both -expand yes
	if { ![Widget::getoption "$path#SelectFont" -nosizes] } {
	        pack $labf2 -side left -anchor n -fill both -expand yes -padx 8
	}
        pack $labf3 -side left -anchor n -fill both -expand yes

        set botf [frame $frame.botf -width 100 -height 50 \
                      -bg white -bd 0 -relief flat \
                      -highlightthickness 1 -takefocus 0 \

                      -highlightbackground black \
                      -highlightcolor black]

        set lab  [label $botf.label \
                      -background white -foreground black \


                      -borderwidth 0 -takefocus 0 -highlightthickness 0 \
                      -text [Widget::getoption "$path#SelectFont" -sampletext]]
        place $lab -relx 0.5 -rely 0.5 -anchor c

	pack $topf -pady 4 -fill both -expand yes

	if { [Widget::getoption "$path#SelectFont" -initialcolor] != ""} {
		set thecolor [Widget::getoption "$path#SelectFont" -initialcolor]
		set colf [frame $frame.colf]
			

		set frc [frame $colf.frame -width 50 -height 20 -bg $thecolor -bd 0 -relief flat\
			-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
		
		set data(frc) $frc
................................................................................
    } else {
	if { [Widget::getoption "$path#SelectFont" -querysystem] } {
	    set fams [Widget::getoption "$path#SelectFont" -families]
	} else {
	    set fams "preset"
	    append fams [Widget::getoption "$path#SelectFont" -families]
	}
	if {[Widget::theme]} {
	    ttk::frame $path
	    set lbf [ttk::combobox $path.font \
			 -takefocus 0 -exportselection 0 \
			 -values   $_families($fams) \
			 -textvariable SelectFont::${path}(family) \
			 -state readonly]
	    set lbs [ttk::combobox $path.size \
................................................................................
	} 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 \
		    -highlightthickness 0 -takefocus 0 -padx 0 -pady 0 \
		    -background $bg \
		    -image [Bitmap::get $st] \
		    -command [list SelectFont::_modstyle $path $st]
	    }
            pack $path.$st -side left -anchor w
        }
        set data(label) ""
        set data(lbf)   $lbf
        set data(lbs)   $lbs
        _getfont $path




	return [Widget::create SelectFont $path]
    }

    return $path
}

................................................................................
                LabelFrame::configure $topf.labf3 -background $bg
                set subf [LabelFrame::getframe $topf.labf3]
                foreach w [winfo children $subf] {
                    $w configure -background $bg
                }
            }
            toolbar {

                $path configure -background $bg
                ComboBox::configure $path.font -background $bg
                ComboBox::configure $path.size -background $bg
                foreach st $_styles {
                    $path.$st configure -background $bg
                }

            }
        }
    }
    return $res
}


................................................................................
        set idxf [lsearch $_families($fams) $font(-family)]
        set idxs [lsearch $_sizes    $font(-size)]
        set data(family) [expr {$idxf >= 0 ? $idxf : 0}]
        set data(size)   [expr {$idxs >= 0 ? $idxs : 0}]
    } else {
	set data(family) $font(-family)
	set data(size)   $font(-size)
	if {![Widget::theme]} {
	    foreach st $_styles {
		$path.$st configure \
		    -relief [expr {$data($st) ? "sunken":"raised"}]
	    }
	}
    }
}
................................................................................
# ----------------------------------------------------------------------------
proc SelectFont::_destroy { path } {
    variable $path
    upvar 0  $path data
    unset data
    Widget::destroy "$path#SelectFont"
}












>











>








|
<
>
>
>







 







>
>
>
>







 







>

<
|
|

>
>

>
>
|
>






>
|
>
>
>
>
>







 







|
>
>
>
>
>
>







 







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

|












>
|
|


<
>
>








<
|
>
|



|
|
>
>
|

|
|
|







 







|







 







|
>






|
>





|

<


|
>













>
>
>







 







>
|
|
|
|
|
|
>







 







|







 







>
>
>
>
>
>
>
>
>
>
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
...
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
...
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
...
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
...
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
...
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
...
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
...
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
...
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
...
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
# ----------------------------------------------------------------------------
#  font.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: font.tcl,v 1.17 2009/09/06 21:14:46 oberdorfer Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - SelectFont::create
#     - SelectFont::configure
#     - SelectFont::cget
#     - SelectFont::_draw
#     - SelectFont::_destroy
#     - SelectFont::_modstyle
#     - SelectFont::_update
#     - SelectFont::_getfont
#     - SelectFont::_init
#     - SelectFont::_themechanged
# ----------------------------------------------------------------------------

namespace eval SelectFont {
    Widget::define SelectFont font Dialog LabelFrame ScrolledWindow

    Widget::declare SelectFont {
        {-title		String		"Font selection" 0}
        {-parent	String		"" 0}
        {-foreground       Color        "SystemWindowText"    0}

        {-background       Color        "SystemWindow"        0}
        {-selectbackground Color        "SystemHighlight"     0}
        {-selectforeground Color        "SystemHighlightText" 0}
        {-type		Enum		dialog        0 {dialog toolbar}}
        {-font		TkResource	""            0 label}
	{-initialcolor	String		""            0}
	{-families	String		"all"         1}
	{-querysystem	Boolean		1             0}
	{-nosizes	Boolean		0             1}
	{-styles	String		"bold italic underline overstrike" 1}
................................................................................
		]
    }
    array set _families [list \
	    presetvariable	$presetVariable	\
	    presetfixed		$presetFixed	\
	    presetall		$presetAll	\
	    ]

    if {[lsearch [bindtags .] SelectFontThemeChanged] < 0} {
        bindtags . [linsert [bindtags .] 1 SelectFontThemeChanged]
    }

    variable _widget
}


# ----------------------------------------------------------------------------
#  Command SelectFont::create
................................................................................
    if { [Widget::getoption "$path#SelectFont" -querysystem] } {
        loadfont [Widget::getoption "$path#SelectFont" -families]
    }

    set bg [Widget::getoption "$path#SelectFont" -background]
    set _styles [Widget::getoption "$path#SelectFont" -styles]
    if { [Widget::getoption "$path#SelectFont" -type] == "dialog" } {

        Dialog::create $path -modal local -anchor e -default 0 -cancel 1 \

                -title  [Widget::getoption "$path#SelectFont" -title] \
                -parent [Widget::getoption "$path#SelectFont" -parent]

        $path configure -background $bg

        set frame [Dialog::getframe $path]

        set topf  [frame \
	               $frame.topf -relief flat -borderwidth 0 \
		       -background $bg]

        set labf1 [LabelFrame::create $topf.labf1 -text "Font" -name font \
                       -side top -anchor w -relief flat -background $bg]
        set sw    [ScrolledWindow::create [LabelFrame::getframe $labf1].sw \
                       -background $bg]
        set lbf   [listbox $sw.lb \
                       -height 5 -width 25 \
		       -exportselection false -selectmode browse \
                       -foreground $BWidget::colors(SystemWindowText) \
		       -background $BWidget::colors(SystemWindow) \
                       -selectforeground $BWidget::colors(SystemHighlightText) \
		       -selectbackground $BWidget::colors(SystemHighlight)]

        ScrolledWindow::setwidget $sw $lbf
        LabelFrame::configure $labf1 -focus $lbf
	if { [Widget::getoption "$path#SelectFont" -querysystem] } {
	    set fam [Widget::getoption "$path#SelectFont" -families]
	} else {
	    set fam "preset"
	    append fam [Widget::getoption "$path#SelectFont" -families]
................................................................................
        pack $sw -fill both -expand yes

        set labf2 [LabelFrame::create $topf.labf2 -text "Size" -name size \
                       -side top -anchor w -relief flat -background $bg]
        set sw    [ScrolledWindow::create [LabelFrame::getframe $labf2].sw \
                       -scrollbar vertical -background $bg]
        set lbs   [listbox $sw.lb \
                       -height 5 -width 6 -exportselection false \
		       -selectmode browse \
                       -foreground $BWidget::colors(SystemWindowText) \
		       -background $BWidget::colors(SystemWindow) \
                       -selectforeground $BWidget::colors(SystemHighlightText) \
		       -selectbackground $BWidget::colors(SystemHighlight)]

        ScrolledWindow::setwidget $sw $lbs
        LabelFrame::configure $labf2 -focus $lbs
        eval [list $lbs insert end] $_sizes
        set script "set [list SelectFont::${path}(size)] \[%W curselection\];\
			SelectFont::_update [list $path]"
        bind $lbs <ButtonRelease-1> $script
        bind $lbs <space>           $script
................................................................................
                       -side top -anchor w -relief sunken -bd 1 -background $bg]
        set subf  [LabelFrame::getframe $labf3]
        foreach st $_styles {
            set name [lindex [BWidget::getname $st] 0]
            if { $name == "" } {
                set name [string toupper $name 0]
            }

            if { [BWidget::using ttk] } {
                ttk::checkbutton $subf.$st -text $name \
                    -variable   SelectFont::$path\($st\) \
                    -command    [list SelectFont::_update $path]
            } else {
                checkbutton $subf.$st -text $name \
                    -variable   SelectFont::$path\($st\) \
                    -background $bg \
                    -command    [list SelectFont::_update $path]
	    }

            bind $subf.$st <Return> break
            pack $subf.$st -anchor w -padx 5
        }
        LabelFrame::configure $labf3 -focus $subf.[lindex $_styles 0]

        pack $labf1 -side left -anchor n -fill both -expand yes
	if { ![Widget::getoption "$path#SelectFont" -nosizes] } {
	        pack $labf2 -side left -anchor n -fill both -expand yes -padx 8
	}
        pack $labf3 -side left -anchor n -fill both -expand yes

        set botf [frame $frame.botf -width 100 -height 50 \
                      -bg white -bd 0 -relief flat \
                      -highlightthickness 1 -takefocus 0 \
                      -background $BWidget::colors(SystemWindow) \
                      -highlightbackground $BWidget::colors(SystemWindowText) \
		      -highlightcolor $BWidget::colors(SystemWindowText)]

        set lab  [label $botf.label \

                      -foreground $BWidget::colors(SystemWindowText) \
                      -background $BWidget::colors(SystemWindow) \
                      -borderwidth 0 -takefocus 0 -highlightthickness 0 \
                      -text [Widget::getoption "$path#SelectFont" -sampletext]]
        place $lab -relx 0.5 -rely 0.5 -anchor c

	pack $topf -pady 4 -fill both -expand yes

	if { [Widget::getoption "$path#SelectFont" -initialcolor] != ""} {
		set thecolor [Widget::getoption "$path#SelectFont" -initialcolor]


                set colf [frame $frame.colf]
                set frc [frame $colf.frame -width 50 -height 20 -bg $thecolor -bd 0 -relief flat\
			-highlightthickness 1 -takefocus 0 \
			-highlightbackground black \
			-highlightcolor black]

		set script "set [list SelectFont::${path}(fontcolor)] \
		              \[SelectColor::dialog $colf.coldlg -parent $colf.button \
			          -color \[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
		
		set data(frc) $frc
................................................................................
    } else {
	if { [Widget::getoption "$path#SelectFont" -querysystem] } {
	    set fams [Widget::getoption "$path#SelectFont" -families]
	} else {
	    set fams "preset"
	    append fams [Widget::getoption "$path#SelectFont" -families]
	}
	if { [BWidget::using ttk] } {
	    ttk::frame $path
	    set lbf [ttk::combobox $path.font \
			 -takefocus 0 -exportselection 0 \
			 -values   $_families($fams) \
			 -textvariable SelectFont::${path}(family) \
			 -state readonly]
	    set lbs [ttk::combobox $path.size \
................................................................................
	} 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] \
			 -hottrack 1]
	    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] \
			 -hottrack 1]
	}
	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 { [BWidget::using ttk] } {
		ttk::checkbutton $path.$st -takefocus 0 \

		    -image [Bitmap::get $st] \
		    -variable SelectFont::${path}($st) \
		    -command [list SelectFont::_update $path] \
		    -style "BWSlimCB.Toolbutton"
	    } else {
		button $path.$st \
		    -highlightthickness 0 -takefocus 0 -padx 0 -pady 0 \
		    -background $bg \
		    -image [Bitmap::get $st] \
		    -command [list SelectFont::_modstyle $path $st]
	    }
            pack $path.$st -side left -anchor w
        }
        set data(label) ""
        set data(lbf)   $lbf
        set data(lbs)   $lbs
        _getfont $path

        bind SelectFontThemeChanged <<ThemeChanged>> \
	        "+ [namespace current]::_themechanged $path"

	return [Widget::create SelectFont $path]
    }

    return $path
}

................................................................................
                LabelFrame::configure $topf.labf3 -background $bg
                set subf [LabelFrame::getframe $topf.labf3]
                foreach w [winfo children $subf] {
                    $w configure -background $bg
                }
            }
            toolbar {
                if { ![BWidget::using ttk] } {
                    $path:cmd configure -background $bg
                    ComboBox::configure $path.font -background $bg
                    ComboBox::configure $path.size -background $bg
                    foreach st $_styles {
                        $path.$st configure -background $bg
                    }
		}
            }
        }
    }
    return $res
}


................................................................................
        set idxf [lsearch $_families($fams) $font(-family)]
        set idxs [lsearch $_sizes    $font(-size)]
        set data(family) [expr {$idxf >= 0 ? $idxf : 0}]
        set data(size)   [expr {$idxs >= 0 ? $idxs : 0}]
    } else {
	set data(family) $font(-family)
	set data(size)   $font(-size)
	if { ![BWidget::using ttk] } {
	    foreach st $_styles {
		$path.$st configure \
		    -relief [expr {$data($st) ? "sunken":"raised"}]
	    }
	}
    }
}
................................................................................
# ----------------------------------------------------------------------------
proc SelectFont::_destroy { path } {
    variable $path
    upvar 0  $path data
    unset data
    Widget::destroy "$path#SelectFont"
}

# ----------------------------------------------------------------------------
#  Command SelectFont::_themechanged
# ----------------------------------------------------------------------------
proc SelectFont::_themechanged { path } {
    if { ![winfo exists $path] } { return }
    BWidget::set_themedefaults
    $path configure -background $BWidget::colors(SystemWindowFrame)
}

Changes to label.tcl.

1
2
3
4
5
6
7
8
9
10
11
..
21
22
23
24
25
26
27
28

29
30
31
32
33
34
35
36
37
38
..
52
53
54
55
56
57
58


59

60
61
62
63
64
65
66
# ------------------------------------------------------------------------------
#  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
................................................................................

    Widget::declare Label {
        {-name               String     ""     0}
        {-text               String     ""     0}
        {-textvariable       String     ""     0}
        {-underline          Int        -1     0 "%d >= -1"}
        {-focus              String     ""     0}
        {-foreground         TkResource ""     0 label}

        {-disabledforeground TkResource ""     0 button}
        {-state              Enum       normal 0  {normal disabled}}

        {-fg                 Synonym    -foreground}
    }

    DynamicHelp::include Label balloon
    DragSite::include    Label "" 1
    DropSite::include    Label {
        TEXT    {move {}}
................................................................................

# ------------------------------------------------------------------------------
#  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 {


|







 







|
>
|

<







 







>
>
|
>







1
2
3
4
5
6
7
8
9
10
11
..
21
22
23
24
25
26
27
28
29
30
31

32
33
34
35
36
37
38
..
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# ------------------------------------------------------------------------------
#  label.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: label.tcl,v 1.11 2009/09/06 21:15:25 oberdorfer Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - Label::create
#     - Label::configure
#     - Label::cget
#     - Label::setfocus
#     - Label::_drag_cmd
................................................................................

    Widget::declare Label {
        {-name               String     ""     0}
        {-text               String     ""     0}
        {-textvariable       String     ""     0}
        {-underline          Int        -1     0 "%d >= -1"}
        {-focus              String     ""     0}
	{-foreground         Color      "SystemWindow"       0}
        {-background         Color      "SystemWindowFrame"  0}
        {-disabledforeground Color      "SystemDisabledText" 0}
        {-state              Enum       normal 0  {normal disabled}}

        {-fg                 Synonym    -foreground}
    }

    DynamicHelp::include Label balloon
    DragSite::include    Label "" 1
    DropSite::include    Label {
        TEXT    {move {}}
................................................................................

# ------------------------------------------------------------------------------
#  Command Label::create
# ------------------------------------------------------------------------------
proc Label::create { path args } {
    array set maps [list Label {} .l {}]
    array set maps [Widget::parseArgs Label $args]
    
    BWidget::wrap 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 {

Changes to labelentry.tcl.

1
2
3
4
5
6
7
8
9
10
11
..
35
36
37
38
39
40
41

42
43

44
45
46
47
48
49
50
# ------------------------------------------------------------------------------
#  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
# ------------------------------------------------------------------------------
................................................................................
# ------------------------------------------------------------------------------
#  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)]



|







 







>
|
|
>







1
2
3
4
5
6
7
8
9
10
11
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# ------------------------------------------------------------------------------
#  labelentry.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: labelentry.tcl,v 1.61 2009/09/06 21:17:15 oberdorfer Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - LabelEntry::create
#     - LabelEntry::configure
#     - LabelEntry::cget
#     - LabelEntry::bind
# ------------------------------------------------------------------------------
................................................................................
# ------------------------------------------------------------------------------
#  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 BWidget::wrap 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)]

Changes to labelframe.tcl.

1
2
3
4
5
6
7
8
9
10
11
..
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
# ------------------------------------------------------------------------------
#  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
................................................................................
    Widget::declare LabelFrame {
        {-relief      TkResource flat 0 frame}
        {-borderwidth TkResource 0    0 frame}
        {-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"}
    }


|







 







>
|
|
>
>
>







 







>
|
|
|

|
>
|
|
>
>
|
|







1
2
3
4
5
6
7
8
9
10
11
..
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
# ------------------------------------------------------------------------------
#  labelframe.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: labelframe.tcl,v 1.61 2009/09/06 21:19:09 oberdorfer Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - LabelFrame::create
#     - LabelFrame::getframe
#     - LabelFrame::configure
#     - LabelFrame::cget
#     - LabelFrame::align
................................................................................
    Widget::declare LabelFrame {
        {-relief      TkResource flat 0 frame}
        {-borderwidth TkResource 0    0 frame}
        {-side        Enum       left 1 {left right top bottom}}
        {-bd          Synonym    -borderwidth}
    }

    if { ![BWidget::using ttk] } {
        Widget::addmap LabelFrame "" :cmd {-background {}}
        Widget::addmap LabelFrame "" .f   {-background {} -relief {} -borderwidth {}}
    } else {
        Widget::addmap LabelFrame "" .f   {-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 BWidget::wrap 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 BWidget::wrap 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 listbox.tcl.

1
2
3
4
5
6
7
8
9
10
11
..
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
..
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
...
103
104
105
106
107
108
109




110
111
112
113
114
115
116
...
164
165
166
167
168
169
170

171

172
173
174
175
176
177
178



179
180
181
182
183
184
185
...
225
226
227
228
229
230
231


232
233
234
235
236
237
238
....
1687
1688
1689
1690
1691
1692
1693
























# ----------------------------------------------------------------------------
#  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
................................................................................
#     - ListBox::_redraw_idle
#     - ListBox::_resize
#     - ListBox::_init_drag_cmd
#     - ListBox::_drop_cmd
#     - ListBox::_over_cmd
#     - ListBox::_auto_scroll
#     - ListBox::_scroll

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

namespace eval ListBox {
    Widget::define ListBox listbox DragSite DropSite DynamicHelp

    namespace eval Item {
        Widget::declare ListBox::Item {
            {-indent     Int        0   0 "%d >= 0"}
            {-text       String     ""  0}
            {-font       String     ""  0}
            {-foreground String     ""  0}
            {-image      TkResource ""  0 label}
            {-window     String     ""  0}
            {-data       String     ""  0}

            {-fill       Synonym    -foreground}
            {-fg         Synonym    -foreground}
        }
................................................................................
        LISTBOX_ITEM {copy {} move {}}
    }

    Widget::declare ListBox {
        {-deltax           Int 10 0 "%d >= 0"}
        {-deltay           Int 15 0 "%d >= 0"}
        {-padx             Int 20 0 "%d >= 0"}
        {-foreground       TkResource "" 0 listbox}
        {-background       TkResource "" 0 listbox}
        {-selectbackground TkResource "" 0 listbox}
        {-selectforeground TkResource "" 0 listbox}
        {-font             TkResource "" 0 listbox}
        {-width            TkResource "" 0 listbox}
        {-height           TkResource "" 0 listbox}
        {-redraw           Boolean 1  0}
        {-multicolumn      Boolean 0  0}
        {-dropovermode     Flag    "wpi" 0 "wpi"}
        {-selectmode       Enum none 0 {none single multiple}}
        {-fg               Synonym -foreground}
................................................................................

    bind ListBox <FocusIn>   [list after idle {BWidget::refocus %W %W.c}]
    bind ListBox <Destroy>   [list ListBox::_destroy %W]
    bind ListBox <Configure> [list ListBox::_resize  %W]
    bind ListBoxFocus <1>    [list focus %W]
    bind ListBox <Key-Up>    [list ListBox::_keyboard_navigation %W -1]
    bind ListBox <Key-Down>  [list ListBox::_keyboard_navigation %W  1]





    variable _edit
}


# ----------------------------------------------------------------------------
#  Command ListBox::create
................................................................................
    set bindtags [bindtags $path.c]
    set bindtags [linsert $bindtags 1 $path]
    # Let any click within the canvas focus on the canvas so that
    # MouseWheel scroll events will be properly handled by the canvas.
    if {[Widget::cget $path -autofocus]} {
	lappend bindtags ListBoxFocus
	BWidget::bindMouseWheel $path.c

    }

    bindtags $path.c $bindtags

    # Add slightly modified up/down bindings to the canvas, in case
    # it gets the focus (like with -autofocus).
    bind $path.c <Key-Up> {ListBox::_keyboard_navigation [winfo parent %W] -1}
    bind $path.c <Key-Down> {ListBox::_keyboard_navigation [winfo parent %W] 1}




    _configureSelectmode $path [Widget::getoption $path -selectmode]

    return $path
}


# ----------------------------------------------------------------------------
................................................................................
        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]

................................................................................
	incr sel -1
	if {$sel < 0} { return }
    }
    set item [lindex $data(items) $sel]
    $path see $item
    _mouse_select $path set $item
}


























|







 







>










|







 







|
|
|
|
|







 







>
>
>
>







 







>

>







>
>
>







 







>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
..
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
..
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
...
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
...
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
....
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
# ----------------------------------------------------------------------------
#  listbox.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: listbox.tcl,v 1.30 2009/09/06 21:21:35 oberdorfer Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - ListBox::create
#     - ListBox::configure
#     - ListBox::cget
#     - ListBox::insert
#     - ListBox::itemconfigure
................................................................................
#     - ListBox::_redraw_idle
#     - ListBox::_resize
#     - ListBox::_init_drag_cmd
#     - ListBox::_drop_cmd
#     - ListBox::_over_cmd
#     - ListBox::_auto_scroll
#     - ListBox::_scroll
#     - ListBox::_themechanged
# ----------------------------------------------------------------------------

namespace eval ListBox {
    Widget::define ListBox listbox DragSite DropSite DynamicHelp

    namespace eval Item {
        Widget::declare ListBox::Item {
            {-indent     Int        0   0 "%d >= 0"}
            {-text       String     ""  0}
            {-font       String     ""  0}
            {-foreground Color      "SystemWindowText"  0}
            {-image      TkResource ""  0 label}
            {-window     String     ""  0}
            {-data       String     ""  0}

            {-fill       Synonym    -foreground}
            {-fg         Synonym    -foreground}
        }
................................................................................
        LISTBOX_ITEM {copy {} move {}}
    }

    Widget::declare ListBox {
        {-deltax           Int 10 0 "%d >= 0"}
        {-deltay           Int 15 0 "%d >= 0"}
        {-padx             Int 20 0 "%d >= 0"}
        {-foreground       Color      "SystemWindowText"    0}
        {-background       Color      "SystemWindow"        0}
        {-selectbackground Color      "SystemHighlight"     0}
        {-selectforeground Color      "SystemHighlightText" 0}
        {-font             String     "TkTextFont"          0}
        {-width            TkResource "" 0 listbox}
        {-height           TkResource "" 0 listbox}
        {-redraw           Boolean 1  0}
        {-multicolumn      Boolean 0  0}
        {-dropovermode     Flag    "wpi" 0 "wpi"}
        {-selectmode       Enum none 0 {none single multiple}}
        {-fg               Synonym -foreground}
................................................................................

    bind ListBox <FocusIn>   [list after idle {BWidget::refocus %W %W.c}]
    bind ListBox <Destroy>   [list ListBox::_destroy %W]
    bind ListBox <Configure> [list ListBox::_resize  %W]
    bind ListBoxFocus <1>    [list focus %W]
    bind ListBox <Key-Up>    [list ListBox::_keyboard_navigation %W -1]
    bind ListBox <Key-Down>  [list ListBox::_keyboard_navigation %W  1]

    if {[lsearch [bindtags .] ListBoxThemeChanged] < 0} {
        bindtags . [linsert [bindtags .] 1 ListBoxThemeChanged]
    }

    variable _edit
}


# ----------------------------------------------------------------------------
#  Command ListBox::create
................................................................................
    set bindtags [bindtags $path.c]
    set bindtags [linsert $bindtags 1 $path]
    # Let any click within the canvas focus on the canvas so that
    # MouseWheel scroll events will be properly handled by the canvas.
    if {[Widget::cget $path -autofocus]} {
	lappend bindtags ListBoxFocus
	BWidget::bindMouseWheel $path.c
        BWidget::bindMiddleMouseMovement $path.c
    }

    bindtags $path.c $bindtags

    # Add slightly modified up/down bindings to the canvas, in case
    # it gets the focus (like with -autofocus).
    bind $path.c <Key-Up> {ListBox::_keyboard_navigation [winfo parent %W] -1}
    bind $path.c <Key-Down> {ListBox::_keyboard_navigation [winfo parent %W] 1}

    bind ListBoxThemeChanged <<ThemeChanged>> \
	   "+ [namespace current]::_themechanged $path"

    _configureSelectmode $path [Widget::getoption $path -selectmode]

    return $path
}


# ----------------------------------------------------------------------------
................................................................................
        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]

................................................................................
	incr sel -1
	if {$sel < 0} { return }
    }
    set item [lindex $data(items) $sel]
    $path see $item
    _mouse_select $path set $item
}


# ----------------------------------------------------------------------------
#  Command ListBox::_themechanged
# ----------------------------------------------------------------------------
proc ListBox::_themechanged { path } {

    if { ![winfo exists $path] } { return }
    BWidget::set_themedefaults
    
    $path configure \
           -background $BWidget::colors(SystemWindow) \
           -foreground $BWidget::colors(SystemWindowText) \
           -selectbackground $BWidget::colors(SystemHighlight) \
           -selectforeground $BWidget::colors(SystemHighlightText)

    # make sure, existing items appear in the same color as well:	     
    foreach item [$path items] {
        $path itemconfigure $item \
	         -foreground $BWidget::colors(SystemWindowText)
    }
    _redraw_idle $path 2
}

Changes to mainframe.tcl.

1
2
3
4
5
6
7
8
9
10
11
..
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
..
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
...
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
...
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
...
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
...
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
# ----------------------------------------------------------------------------
#  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
................................................................................
#     - MainFrame::_parse_accelerator
# ----------------------------------------------------------------------------

namespace eval MainFrame {
    Widget::define MainFrame mainframe ProgressBar

    Widget::bwinclude MainFrame ProgressBar .status.prg \
	    remove {
	-fg -bg -bd -troughcolor -background -borderwidth
	-relief -orient -width -height
    } \
	    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}
................................................................................

# ----------------------------------------------------------------------------
#  Command MainFrame::create
# ----------------------------------------------------------------------------
proc MainFrame::create { path args } {
    global   tcl_platform
    variable _widget

    if {[Widget::theme]} {
	set path [ttk::frame $path]
    } else {
	set path [frame $path -takefocus 0 -highlightthickness 0]
    }
    set top  [winfo parent $path]
    if { ![string equal [winfo toplevel $path] $top] } {
        destroy $path
        return -code error "parent must be a toplevel"
    }
    Widget::init MainFrame $path $args

................................................................................
    if { $tcl_platform(platform) == "unix" } {
        set relief raised
        set bd     1
    } else {
        set relief flat
        set bd     0
    }
    if {[Widget::theme]} {
	set userframe [eval [list ttk::frame $path.frame] \
			   [Widget::subcget $path .frame]]
	set topframe  [ttk::frame $path.topf]
	set botframe  [ttk::frame $path.botf]
    } else {
	set userframe [eval [list frame $path.frame] \
			   [Widget::subcget $path .frame] \
			   -relief $relief -borderwidth $bd]

	set topframe  [eval [list frame $path.topf] \
			   [Widget::subcget $path .topf]]

	set botframe  [eval [list frame $path.botf] \
			   -relief $relief -borderwidth $bd \
			   [Widget::subcget $path .botf]]
    }

    pack $topframe -fill x
    grid columnconfigure $topframe 0 -weight 1

    if {![Widget::theme]} {
	set bg [Widget::cget $path -background]
	$path configure -background $bg
    }
    if { $tcl_platform(platform) != "unix" } {
        set sepopt [Widget::getoption $path -separator]
        if { $sepopt == "both" || $sepopt == "top" } {
	    if {[Widget::theme]} {
		set sep [ttk::separator $path.sep -orient horizontal]
	    } else {
		set sep [Separator::create $path.sep -orient horizontal -background $bg]
	    }
            pack $sep -fill x
        }
        if { $sepopt == "both" || $sepopt == "bottom" } {
	    if {[Widget::theme]} {
		set sep [ttk::separator $botframe.sep -orient horizontal]
	    } else {
		set sep [Separator::create $botframe.sep -orient horizontal -background $bg]
	    }
            pack $sep -fill x
        }
    }
................................................................................
    # --- status bar ---------------------------------------------------------
    if {[string length [Widget::getoption $path -statusbarfont]]} {
	set sbfnt [list -font [Widget::getoption $path -statusbarfont]]
    } else {
	set sbfnt ""
    }

    if {[Widget::theme]} {
	set status   [ttk::frame $path.status]
	set label    [eval [list ttk::label $status.label \
				-textvariable [Widget::getoption $path -textvariable]] $sbfnt]
	set indframe [ttk::frame $status.indf]
	set prgframe [ttk::frame $status.prgf]
    } else {
	set status   [frame $path.status -background $bg]
................................................................................
    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]]
................................................................................
    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]} {
	set toolbar [ttk::frame $toolbar -padding 2]
    } else {
	set toolbar [frame $toolbar -relief flat -borderwidth 2 \
			 -takefocus 0 -highlightthickness 0 -background $bg]
    }
    pack $toolbar -in $toolframe -anchor w -expand yes -fill x
    incr _widget($path,ntoolbar)
................................................................................
	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


|







 







|
|
|
|
|
|
|
|
|





|







 







|
|
<
<
|
|







 







<
|
<
<
<
<
|


>
|

>
|


<




|






|







|







 







|







 







|







 







|






|









|







 







|







1
2
3
4
5
6
7
8
9
10
11
..
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
..
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
...
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
...
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
...
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
...
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
# ----------------------------------------------------------------------------
#  mainframe.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: mainframe.tcl,v 1.25 2009/09/06 21:22:36 oberdorfer Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - MainFrame::create
#     - MainFrame::configure
#     - MainFrame::cget
#     - MainFrame::getframe
#     - MainFrame::addtoolbar
................................................................................
#     - MainFrame::_parse_accelerator
# ----------------------------------------------------------------------------

namespace eval MainFrame {
    Widget::define MainFrame mainframe ProgressBar

    Widget::bwinclude MainFrame ProgressBar .status.prg \
        remove {
	    -fg -bg -bd -troughcolor -background -borderwidth
	    -relief -orient -width -height
        } \
	rename {
	    -maximum    -progressmax
	    -variable   -progressvar
	    -type       -progresstype
	    -foreground -progressfg
    }

    Widget::declare MainFrame {
	{-width        TkResource 0      0 frame}
	{-height       TkResource 0      0 frame}
	{-background   Color      "SystemWindowFrame" 0}
	{-textvariable String     ""     0}
	{-menu         String     {}     1}
	{-separator    Enum       both   1 {none top bottom both}}
	{-bg           Synonym    -background}

	{-menubarfont   String     ""  0}
	{-menuentryfont String     ""  0}
................................................................................

# ----------------------------------------------------------------------------
#  Command MainFrame::create
# ----------------------------------------------------------------------------
proc MainFrame::create { path args } {
    global   tcl_platform
    variable _widget
    
    set path [BWidget::wrap frame $path \


                  -class MainFrame -takefocus 0 -highlightthickness 0]

    set top  [winfo parent $path]
    if { ![string equal [winfo toplevel $path] $top] } {
        destroy $path
        return -code error "parent must be a toplevel"
    }
    Widget::init MainFrame $path $args

................................................................................
    if { $tcl_platform(platform) == "unix" } {
        set relief raised
        set bd     1
    } else {
        set relief flat
        set bd     0
    }

    set userframe [eval \




          [list BWidget::wrap frame $path.frame] \
			   [Widget::subcget $path .frame] \
			   -relief $relief -borderwidth $bd]
    set topframe [eval \
          [list BWidget::wrap frame $path.topf] \
			   [Widget::subcget $path .topf]]
    set botframe [eval \
          [list BWidget::wrap frame $path.botf] \
			   -relief $relief -borderwidth $bd \
			   [Widget::subcget $path .botf]]


    pack $topframe -fill x
    grid columnconfigure $topframe 0 -weight 1

    if { ![BWidget::using ttk] } {
	set bg [Widget::cget $path -background]
	$path configure -background $bg
    }
    if { $tcl_platform(platform) != "unix" } {
        set sepopt [Widget::getoption $path -separator]
        if { $sepopt == "both" || $sepopt == "top" } {
	    if { [BWidget::using ttk] } {
		set sep [ttk::separator $path.sep -orient horizontal]
	    } else {
		set sep [Separator::create $path.sep -orient horizontal -background $bg]
	    }
            pack $sep -fill x
        }
        if { $sepopt == "both" || $sepopt == "bottom" } {
	    if { [BWidget::using ttk] } {
		set sep [ttk::separator $botframe.sep -orient horizontal]
	    } else {
		set sep [Separator::create $botframe.sep -orient horizontal -background $bg]
	    }
            pack $sep -fill x
        }
    }
................................................................................
    # --- status bar ---------------------------------------------------------
    if {[string length [Widget::getoption $path -statusbarfont]]} {
	set sbfnt [list -font [Widget::getoption $path -statusbarfont]]
    } else {
	set sbfnt ""
    }

    if { [BWidget::using ttk] } {
	set status   [ttk::frame $path.status]
	set label    [eval [list ttk::label $status.label \
				-textvariable [Widget::getoption $path -textvariable]] $sbfnt]
	set indframe [ttk::frame $status.indf]
	set prgframe [ttk::frame $status.prgf]
    } else {
	set status   [frame $path.status -background $bg]
................................................................................
    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 { ![BWidget::using ttk]  && [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]]
................................................................................
    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 { [BWidget::using ttk] } {
	    ttk::frame $toolframe -padding 1
	} else {
	    frame $toolframe -relief raised -borderwidth 1 \
		-takefocus 0 -highlightthickness 0 -background $bg
	}
    } else {
	if { [BWidget::using ttk] } {
	    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 { [BWidget::using ttk] } {
	set toolbar [ttk::frame $toolbar -padding 2]
    } else {
	set toolbar [frame $toolbar -relief flat -borderwidth 2 \
			 -takefocus 0 -highlightthickness 0 -background $bg]
    }
    pack $toolbar -in $toolframe -anchor w -expand yes -fill x
    incr _widget($path,ntoolbar)
................................................................................
	if {[string length [Widget::getoption $path $x]]} {
	    set $v [list -font [Widget::getoption $path $x]]
	} else {
	    set $v ""
	}
    }

    if { ![BWidget::using ttk] && $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

Changes to messagedlg.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
# ------------------------------------------------------------------------------
#  messagedlg.tcl
#  This file is part of Unifix BWidget Toolkit

# ------------------------------------------------------------------------------
#  Index of commands:
#     - MessageDlg::create
# ------------------------------------------------------------------------------

namespace eval MessageDlg {
    Widget::define MessageDlg messagedlg Dialog









    Widget::tkinclude MessageDlg message .frame.msg \
	    remove [list -cursor -highlightthickness		\
		-highlightbackground -highlightcolor		\
		-relief -borderwidth -takefocus -textvariable	\
		] \
	    rename [list -text -message]			\
	    initialize [list -aspect 800 -anchor c -justify center]


    Widget::bwinclude MessageDlg Dialog :cmd \
	    remove [list -modal -image -bitmap -side -anchor -separator \
		-homogeneous -padx -pady -spacing]

    Widget::declare MessageDlg {
        {-icon       Enum   info 0 {none error info question warning}}
        {-type       Enum   user 0 {abortretryignore ok okcancel \
		retrycancel yesno yesnocancel user}}
        {-buttons     String "" 0}
        {-buttonwidth String 0  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
33
34
35
36
37
38
39
# ------------------------------------------------------------------------------
#  messagedlg.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: messagedlg.tcl,v 1.91 2009/09/06 21:23:06 oberdorfer Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - MessageDlg::create
# ------------------------------------------------------------------------------

namespace eval MessageDlg {
    Widget::define MessageDlg messagedlg Dialog

    if {[BWidget::using ttk]} {
        Widget::tkinclude MessageDlg ttk::label .frame.msg \
            rename {
                -text -message
            } initialize {
                 -aspect 800 -anchor c -justify center
            }
    } else {
        Widget::tkinclude MessageDlg message .frame.msg \
	    remove [list -cursor -highlightthickness \
		-highlightbackground -highlightcolor \
		-relief -borderwidth -takefocus -textvariable \
		] \
	    rename [list -text -message] \
	    initialize [list -aspect 800 -anchor c -justify center]
    }

    Widget::bwinclude MessageDlg Dialog :cmd \
	    remove [list -modal -image -bitmap -side -anchor -separator \
		         -homogeneous -padx -pady -spacing]

    Widget::declare MessageDlg {
        {-icon       Enum   info 0 {none error info question warning}}
        {-type       Enum   user 0 {abortretryignore ok okcancel \
		retrycancel yesno yesnocancel user}}
        {-buttons     String "" 0}
        {-buttonwidth String 0  0}