Bwidget Source Code
Check-in [841c3caa6f]
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:ScrolledWindow theming support
Timelines: family | ancestors | descendants | both | bwidget
Files: files | file ages | folders
SHA1: 841c3caa6f5590f8eb25b9d110b2c8984912599d
User & Date: oehhar 2010-11-23 08:21:17
Context
2010-12-05
16:11
BWidget 1.9.3 Tagged check-in: d38f04ddb9 user: oehhar tags: bwidget
2010-11-23
08:21
ScrolledWindow theming support check-in: 841c3caa6f user: oehhar tags: bwidget
2010-11-21
19:35
Add theming support for label widget check-in: 927ec26cfe user: oehhar tags: bwidget
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to BWman/ScrolledWindow.html.

7
8
9
10
11
12
13

14
15
16
17
18
19
20










21
22
23
24
25
26
27
..
96
97
98
99
100
101
102
103

104
105
106
107
108
109
110
</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>
................................................................................
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>






>







>
>
>
>
>
>
>
>
>
>







 







|
>







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
...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
</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>
................................................................................
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 ChangeLog.






1
2
3
4
5
6
7




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

>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
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]>

Changes to scrollw.tcl.

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

80
81
82
83
84

85
86
87
88
89
90
91
...
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# -----------------------------------------------------------------------------
#  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
................................................................................
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)
    }
................................................................................
# -----------------------------------------------------------------------------
#  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 }


|







 







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







 







>
|
|
|
|
|
>







 







|
|
|
|







1
2
3
4
5
6
7
8
9
10
11
..
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
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
...
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# -----------------------------------------------------------------------------
#  scrollw.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: scrollw.tcl,v 1.13.2.1 2010/11/23 08:21:17 oehhar Exp $
# -----------------------------------------------------------------------------
#  Index of commands:
#     - ScrolledWindow::create
#     - ScrolledWindow::getframe
#     - ScrolledWindow::setwidget
#     - ScrolledWindow::configure
#     - ScrolledWindow::cget
................................................................................
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 {
        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 { ! $::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)
    }
................................................................................
# -----------------------------------------------------------------------------
#  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 }