Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Tsw: Updated for version 1.2. See the ChangeLog for details. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
be1246b673ff5362f0b4909bb0a6ae57 |
User & Date: | csaba 2025-07-01 11:15:48.782 |
Context
2025-07-02
| ||
09:03 | Tablelist: Minor improvements in tablelistThemes.tcl. check-in: 01f87a1b5b user: csaba tags: trunk | |
2025-07-01
| ||
11:15 | Tsw: Updated for version 1.2. See the ChangeLog for details. check-in: be1246b673 user: csaba tags: trunk | |
10:45 | Tablelist: Updated for version 7.7. See the ChangeLog for details. check-in: d5678570dd user: csaba tags: trunk | |
Changes
Changes to examples/tsw/EditingOpts.tcl.
︙ | ︙ | |||
271 272 273 274 275 276 277 | -showeditcursor } { lassign [$tbl configure $opt] option dbName dbClass default current set defaultStr [expr {$default ? "on" : "off"}] set l [ttk::label $tf.l$row -text "$opt ($defaultStr)"] if {$current != $default} { | | | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | -showeditcursor } { lassign [$tbl configure $opt] option dbName dbClass default current set defaultStr [expr {$default ? "on" : "off"}] set l [ttk::label $tf.l$row -text "$opt ($defaultStr)"] if {$current != $default} { $l configure -foreground red2 } grid $l -row $row -column 0 -sticky w -padx 9p -pady {0 3p} set sw [tsw::toggleswitch $tf.sw$row] $sw switchstate $current ;# sets the switch state to $current $sw attrib default $default ;# saves $default as attribute value $sw configure -command [list applySwitchState $sw $tbl $opt $l] |
︙ | ︙ | |||
308 309 310 311 312 313 314 | # color of the ttk::label l according to the switch state of the toggleswitch # widget sw. #------------------------------------------------------------------------------ proc applySwitchState {sw tbl opt l} { set switchState [$sw switchstate] $tbl configure $opt $switchState | | | 308 309 310 311 312 313 314 315 316 317 | # color of the ttk::label l according to the switch state of the toggleswitch # widget sw. #------------------------------------------------------------------------------ proc applySwitchState {sw tbl opt l} { set switchState [$sw switchstate] $tbl configure $opt $switchState set fgColor [expr {$switchState == [$sw attrib default] ? "" : "red2"}] $l configure -foreground $fgColor } |
Changes to examples/tsw/TswDemo.tcl.
︙ | ︙ | |||
72 73 74 75 76 77 78 | #------------------------------------------------------------------------------ proc setTheme theme { ttk::setTheme $theme global mb l1 l2 l3 l4 $mb configure -text $theme set bg [ttk::style lookup . -background] | | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | #------------------------------------------------------------------------------ proc setTheme theme { ttk::setTheme $theme global mb l1 l2 l3 l4 $mb configure -text $theme set bg [ttk::style lookup . -background] set fg [ttk::style lookup . -foreground {} black] $mb.m configure -background $bg -foreground $fg foreach opt {-activebackground -activeborderwidth -activeforeground -borderwidth -relief} { set defaultVal [lindex [$mb.m configure $opt] 3] $mb.m configure $opt $defaultVal } foreach w [list $l1 $l2 $l3 $l4] { $w configure -background "" -foreground "" } |
︙ | ︙ |
Changes to modules/tsw/CHANGES.txt.
|
| | > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | What is new in Tsw 1.2? ----------------------- 1. Added explicit support for the "droid" theme, which is the default in AndroWish, as well as for the themes "awarc", "awbreeze", "awbreezedark", "awdark", "awlight", and "plastik" (which "droid" is derived from). 2. Made sure that on Android the widget's behavior is adapted to the touchscreen as input device. 3. Improved the support for older macOS versions. What was new in Tsw 1.1? ------------------------ 1. For compatibility with the (ttk::)checkbutton, toggling the widget's switch state by changing the value of the variable specified by the "-variable" option will no longer cause the script specified by the "-command" option to get executed. 2. For further compatibility with the (ttk::)checkbutton, invoking the |
︙ | ︙ |
Changes to modules/tsw/COPYRIGHT.txt.
|
| | | 1 2 3 4 5 6 7 8 | Toggle switch widget package Tsw 1.2 Copyright (c) 2025 Csaba Nemethi (E-mail: [email protected]) This library is free software; you can use, modify, and redistribute it for any purpose, provided that existing copyright notices are retained in all copies and that this notice is included verbatim in any distributions. |
︙ | ︙ |
Changes to modules/tsw/ChangeLog.
1 2 3 4 5 6 7 | 2025-06-10 Csaba Nemethi <[email protected]> * Released Tsw 1.1. 2025-05-17 Csaba Nemethi <[email protected]> * *.tcl: Bumped the version number to 1.1. | > > > > > > > > > > > > > > > > > > > > > > | 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 | 2025-07-01 Csaba Nemethi <[email protected]> * *.tcl: Bumped the version number to 1.2. * COPYRIGHT.txt: * README.txt: * CHANGES.txt: Updated to reflect the changes. * doc/*.html: * scripts/*.tcl: Added explicit support for the themes "awarc", "awbreeze", "awbreezedark", "awdark", "awlight", "droid", and "plastik"; made sure that on Android the widget's behavior is adapted to the touchscreen as input device; improved the support for older macOS versions. * scripts/tclIndex: Newly generated. * doc/EditingOpts.png: Updated screenshot. * ../../examples/tsw/EditingOpts.tcl: Improvements in the demo scripts. * ../../examples/tsw/TswDemo.tcl: 2025-06-10 Csaba Nemethi <[email protected]> * Released Tsw 1.1. 2025-05-17 Csaba Nemethi <[email protected]> * *.tcl: Bumped the version number to 1.1. |
︙ | ︙ |
Changes to modules/tsw/README.txt.
︙ | ︙ | |||
40 41 42 43 44 45 46 | How to Get It? -------------- Tsw is available for free download from the Web page https://www.nemethi.de | | | | | | | | 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 | How to Get It? -------------- Tsw is available for free download from the Web page https://www.nemethi.de The distribution file is "tsw1.2.tar.gz" for UNIX and "tsw1_2.zip" for Windows. These files contain the same information, except for the additional carriage return character preceding the linefeed at the end of each line in the text files for Windows. Tsw is also included in tklib, which has the address https://core.tcl.tk/tklib How to Install It? ------------------ Install the package as a subdirectory of one of the directories given by the "auto_path" variable. For example, you can install it as a subdirectory of the "lib" directory within your Tcl/Tk installation (at the same level as the tk8.X or tk9.X subdirectory). To install Tsw on UNIX, "cd" to the desired directory and unpack the distribution file "tsw1.2.tar.gz": gunzip -c tsw1.2.tar.gz | tar -xf - On most UNIX systems this can be replaced with tar -zxf tsw1.2.tar.gz Both commands will create a directory named "tsw1.2", with the subdirectories "demos", "doc", and "scripts". On Windows, use WinZip or some other program capable of unpacking the distribution file "tsw1_2.zip" into the directory "tsw1.2", with the subdirectories "demos", "doc", and "scripts". How to Use It? -------------- To be able to access the commands and variables of the Tsw package, your scripts must contain one of the lines |
︙ | ︙ |
Changes to modules/tsw/doc/EditingOpts.png.
cannot compute difference between binary files
Changes to modules/tsw/doc/index.html.
1 2 3 | <!DOCTYPE html> <html> <head> | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <!DOCTYPE html> <html> <head> <title>The Toggle Switch Widget Package Tsw 1.2</title> <meta name="Author" content="Csaba Nemethi"> <meta name="Keywords" content="toggleswitch, widget"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div> <h1>The Toggle Switch Widget Package Tsw 1.2</h1> <h3>by</h3> <h2>Csaba Nemethi</h2> <address> <a href="mailto:[email protected]">[email protected]</a> |
︙ | ︙ |
Changes to modules/tsw/doc/toggleswitch.html.
︙ | ︙ | |||
9 10 11 12 13 14 15 | <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div> <h1>The <code><b>tsw::toggleswitch</b></code> Command</h1> | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div> <h1>The <code><b>tsw::toggleswitch</b></code> Command</h1> <h2>For Tsw Version 1.2</h2> <h3>by</h3> <h2>Csaba Nemethi</h2> <address> <a href="mailto:[email protected]">[email protected]</a> |
︙ | ︙ | |||
192 193 194 195 196 197 198 | <dd class="tm">The colors used when drawing the trough and the slider in the various widget states (such as <code><b>active</b></code>, <code><b>background</b></code>, <code><b>disabled</b></code>, <code><b>pressed</b></code>, and <code><b>selected</b></code>) depend on the current theme. The implementation contains procedures that create these elements for the themes <code><b>aqua</b></code>, | > > > | > > | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | <dd class="tm">The colors used when drawing the trough and the slider in the various widget states (such as <code><b>active</b></code>, <code><b>background</b></code>, <code><b>disabled</b></code>, <code><b>pressed</b></code>, and <code><b>selected</b></code>) depend on the current theme. The implementation contains procedures that create these elements for the themes <code><b>aqua</b></code>, <code><b>awarc</b></code>, <code><b>awbreeze</b></code>, <code><b>awbreezedark</b></code>, <code><b>awdark</b></code>, <code><b>awlight</b></code>, <code><b>clam</b></code>, <code><b>default</b></code>, <code><b>droid</b></code> (which is the default in AndroWish), <code><b>plastik</b></code> (which <code><b>droid</b></code> is derived from), and <code><b>vista</b></code>. The trough and slider specific to the <code><b>vista</b></code> theme are also used for the themes <code><b>winnative</b></code> and <code><b>xpnative</b></code>. Likewise, the elements specific to the <code><b>default</b></code> theme are also used for all the other themes not mentioned above (including the third-party ones), except that in dark themes the colors of these elements are adapted to the dark background. If the theme is |
︙ | ︙ |
Changes to modules/tsw/doc/tsw.html.
︙ | ︙ | |||
9 10 11 12 13 14 15 | <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div> <h1>Tsw Programmer's Guide</h1> | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div> <h1>Tsw Programmer's Guide</h1> <h2>For Tsw Version 1.2</h2> <h3>by</h3> <h2>Csaba Nemethi</h2> <address> <a href="mailto:[email protected]">[email protected]</a> |
︙ | ︙ | |||
102 103 104 105 106 107 108 | <blockquote> <address> <a href="https://www.nemethi.de">https://www.nemethi.de</a> </address> </blockquote> | | | | | | | | | | 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 | <blockquote> <address> <a href="https://www.nemethi.de">https://www.nemethi.de</a> </address> </blockquote> <p>The distribution file is <code>tsw1.2.tar.gz</code> for UNIX and <code>tsw1_2.zip</code> for Windows. These files contain the same information, except for the additional carriage return character preceding the linefeed at the end of each line in the text files for Windows.</p> <p>Tsw is also included in tklib, which has the address</p> <blockquote> <address> <a href="https://core.tcl.tk/tklib">https://core.tcl.tk/tklib</a> </address> </blockquote> <h3 id="ov_install">How to Install It?</h3> <p>Install the package as a subdirectory of one of the directories given by the <code>auto_path</code> variable. For example, you can install it as a subdirectory of the <code>lib</code> directory within your Tcl/Tk installation (at the same level as the <code>tk8.X</code> or <code>tk9.X</code> subdirectory).</p> <p>To install Tsw <i>on UNIX</i>, <code>cd</code> to the desired directory and unpack the distribution file <code>tsw1.2.tar.gz</code>:</p> <blockquote> <pre> gunzip -c tsw1.2.tar.gz | tar -xf - </pre> </blockquote> <p>On most UNIX systems this can be replaced with</p> <blockquote> <pre> tar -zxf tsw1.2.tar.gz </pre> </blockquote> <p>Both commands will create a directory named <code>tsw1.2</code>, with the subdirectories <code>demos</code>, <code>doc</code>, and <code>scripts</code>.</p> <p><i>On Windows</i>, use WinZip or some other program capable of unpacking the distribution file <code>tsw1_2.zip</code> into the directory <code>tsw1.2</code>, with the subdirectories <code>demos</code>, <code>doc</code>, and <code>scripts</code>.</p> <p>Notice that in tklib the Tsw <code>demos</code> directory is replaced with the subdirectory <code>tsw</code> of the <code>examples</code> directory. Please take this into account when reading the <a href= "#examples">examples</a> below.</p> |
︙ | ︙ | |||
408 409 410 411 412 413 414 | -showeditcursor } { lassign [$tbl configure $opt] option dbName dbClass default current set defaultStr [expr {$default ? "on" : "off"}] set l [ttk::label $tf.l$row -text "$opt ($defaultStr)"] if {$current != $default} { | | | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | -showeditcursor } { lassign [$tbl configure $opt] option dbName dbClass default current set defaultStr [expr {$default ? "on" : "off"}] set l [ttk::label $tf.l$row -text "$opt ($defaultStr)"] if {$current != $default} { $l configure -foreground red2 } grid $l -row $row -column 0 -sticky w -padx 9p -pady {0 3p} <span class="red">set sw [tsw::toggleswitch $tf.sw$row] $sw switchstate $current</span> ;<span class="cmt"># sets the switch state to $current</span> <span class="red">$sw attrib default $default</span> ;<span class="cmt"># saves $default as attribute value</span> <span class="red">$sw configure -command [list applySwitchState $sw $tbl $opt $l]</span> |
︙ | ︙ | |||
436 437 438 439 440 441 442 | corresponding toggleswitch widget to the option's current value. In addition, it invokes the <code><a href= "toggleswitch.html#attrib">attrib</a></code> subcommand of the Tcl command associated with the toggleswitch to save the default as the value of the widget's attribute of name <code>default</code>. In this way, the widget "remembers" the default value in an object-oriented manner and can retrieve it later without needing any external resources. For increased | | | | 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 | corresponding toggleswitch widget to the option's current value. In addition, it invokes the <code><a href= "toggleswitch.html#attrib">attrib</a></code> subcommand of the Tcl command associated with the toggleswitch to save the default as the value of the widget's attribute of name <code>default</code>. In this way, the widget "remembers" the default value in an object-oriented manner and can retrieve it later without needing any external resources. For increased user-friendliness, the label is displayed in the <code>red2</code> foreground color if the option's current value is different from the default one.</p> <p>Whenever the toggleswitch widget's switch state gets toggled, the script specified as the value of its <code><a href= "toggleswitch.html#command">-command</a></code> option invokes the <code>applySwitchState</code> procedure shown below:</p> <blockquote> <pre> <span class="cmt">#------------------------------------------------------------------------------ # applySwitchState # # Sets the configuration option opt of the tablelist tbl and the foreground # color of the ttk::label l according to the switch state of the toggleswitch # widget sw. #------------------------------------------------------------------------------</span> proc applySwitchState {sw tbl opt l} { <span class="red">set switchState [$sw switchstate]</span> $tbl configure $opt $switchState <span class="red">set fgColor [expr {$switchState == [$sw attrib default] ? "" : "red2"}]</span> $l configure -foreground $fgColor } </pre> </blockquote> <p>We set the specified tablelist option to the toggleswitch widget's switch state, and also the label's foreground color, depending on the switch state |
︙ | ︙ |
Changes to modules/tsw/pkgIndex.tcl.
1 2 3 4 5 6 7 8 9 | #============================================================================== # Tsw package index file. # # Copyright (c) 2025 Csaba Nemethi (E-mail: [email protected]) #============================================================================== # # Regular package: # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #============================================================================== # Tsw package index file. # # Copyright (c) 2025 Csaba Nemethi (E-mail: [email protected]) #============================================================================== # # Regular package: # package ifneeded tsw 1.2 [list source [file join $dir tsw.tcl]] # # Alias: # package ifneeded Tsw 1.2 { package require -exact tsw 1.2 } |
Changes to modules/tsw/scripts/elements.tcl.
︙ | ︙ | |||
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | <circle cx="10" cy="8" r="8" fill="#ffffff"/> </svg>} set sliderData(3) { <svg width="24" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="10" r="10" fill="#ffffff"/> </svg>} foreach n {1 2 3} { # troughOffImg set imgData $troughData($n) append imgData "fill='#c3c3c3'/>\n</svg>" set troughOffImg [createSvgImg -data $imgData] # troughOffActiveImg set imgData $troughData($n) | > > | > | | > > > > > > > > > > | 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 | <circle cx="10" cy="8" r="8" fill="#ffffff"/> </svg>} set sliderData(3) { <svg width="24" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="10" r="10" fill="#ffffff"/> </svg>} variable onAndroid foreach n {1 2 3} { # troughOffImg set imgData $troughData($n) append imgData "fill='#c3c3c3'/>\n</svg>" set troughOffImg [createSvgImg -data $imgData] # troughOffActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#c3c3c3" : "#b3b3b3"}] append imgData "fill='$fill'/>\n</svg>" set troughOffActiveImg [createSvgImg -data $imgData] # troughOffPressedImg set imgData $troughData($n) append imgData "fill='#a3a3a3'/>\n</svg>" set troughOffPressedImg [createSvgImg -data $imgData] # troughOffDisabledImg set imgData $troughData($n) append imgData "fill='#cecece'/>\n</svg>" set troughOffDisabledImg [createSvgImg -data $imgData] # troughOnImg set imgData $troughData($n) append imgData "fill='#4a6984'/>\n</svg>" set troughOnImg [createSvgImg -data $imgData] # troughOnActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#4a6984" : "#587d9e"}] append imgData "fill='$fill'/>\n</svg>" set troughOnActiveImg [createSvgImg -data $imgData] # troughOnPressedImg set imgData $troughData($n) append imgData "fill='#6792b7'/>\n</svg>" set troughOnPressedImg [createSvgImg -data $imgData] # troughOnDisabledImg set imgData $troughData($n) append imgData "fill='#a9d7ff'/>\n</svg>" set troughOnDisabledImg [createSvgImg -data $imgData] ttk::style element create Switch$n.trough image [list $troughOffImg \ {selected disabled} $troughOnDisabledImg \ {selected pressed} $troughOnPressedImg \ {selected active} $troughOnActiveImg \ selected $troughOnImg \ disabled $troughOffDisabledImg \ pressed $troughOffPressedImg \ active $troughOffActiveImg \ ] # sliderImg set sliderImg [createSvgImg -data $sliderData($n)] ttk::style element create Switch$n.slider image $sliderImg ttk::style layout Toggleswitch$n [list \ Switch.focus -sticky nswe -children [list \ Switch.padding -sticky nswe -children [list \ Switch$n.trough -sticky {} -children [list \ Switch$n.slider -side left -sticky {} ] ] ] ] } set elemInfoArr(default) 1 } #------------------------------------------------------------------------------ # tsw::createElements_default-dark |
︙ | ︙ | |||
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | set sliderData(2) { <svg width="20" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="10" cy="8" r="8" } set sliderData(3) { <svg width="24" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="10" r="10" } foreach n {1 2 3} { # troughOffImg set imgData $troughData($n) append imgData "fill='#585858'/>\n</svg>" set troughOffImg [createSvgImg -data $imgData] # troughOffActiveImg set imgData $troughData($n) | > > | | > | | | | 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 | set sliderData(2) { <svg width="20" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="10" cy="8" r="8" } set sliderData(3) { <svg width="24" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="10" r="10" } variable onAndroid foreach n {1 2 3} { # troughOffImg set imgData $troughData($n) append imgData "fill='#585858'/>\n</svg>" set troughOffImg [createSvgImg -data $imgData] # troughOffActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#585858" : "#676767"}] append imgData "fill='$fill'/>\n</svg>" set troughOffActiveImg [createSvgImg -data $imgData] # troughOffPressedImg set imgData $troughData($n) append imgData "fill='#787878'/>\n</svg>" set troughOffPressedImg [createSvgImg -data $imgData] # troughOffDisabledImg set imgData $troughData($n) append imgData "fill='#4a4a4a'/>\n</svg>" set troughOffDisabledImg [createSvgImg -data $imgData] # troughOnImg set imgData $troughData($n) append imgData "fill='#4a6984'/>\n</svg>" set troughOnImg [createSvgImg -data $imgData] # troughOnActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#4a6984" : "#587d9e"}] append imgData "fill='$fill'/>\n</svg>" set troughOnActiveImg [createSvgImg -data $imgData] # troughOnPressedImg set imgData $troughData($n) append imgData "fill='#6792b7'/>\n</svg>" set troughOnPressedImg [createSvgImg -data $imgData] # troughOnDisabledImg set imgData $troughData($n) append imgData "fill='#3c556b'/>\n</svg>" set troughOnDisabledImg [createSvgImg -data $imgData] ttk::style element create DarkSwitch$n.trough image [list \ $troughOffImg \ {selected disabled} $troughOnDisabledImg \ {selected pressed} $troughOnPressedImg \ {selected active} $troughOnActiveImg \ |
︙ | ︙ | |||
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | <circle cx="10" cy="8" r="8" fill="#ffffff"/> </svg>} set sliderData(3) { <svg width="24" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="10" r="10" fill="#ffffff"/> </svg>} foreach n {1 2 3} { # troughOffImg set imgData $troughData($n) append imgData "fill='#bab5ab'/>\n</svg>" set troughOffImg [createSvgImg -data $imgData] # troughOffActiveImg set imgData $troughData($n) | > > | | > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 622 623 624 625 626 627 628 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 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 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 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 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 976 977 978 979 980 981 982 983 984 985 986 987 988 989 | <circle cx="10" cy="8" r="8" fill="#ffffff"/> </svg>} set sliderData(3) { <svg width="24" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="10" r="10" fill="#ffffff"/> </svg>} variable onAndroid foreach n {1 2 3} { # troughOffImg set imgData $troughData($n) append imgData "fill='#bab5ab'/>\n</svg>" set troughOffImg [createSvgImg -data $imgData] # troughOffActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#bab5ab" : "#aca79e"}] append imgData "fill='$fill'/>\n</svg>" set troughOffActiveImg [createSvgImg -data $imgData] # troughOffPressedImg set imgData $troughData($n) append imgData "fill='#9e9a91'/>\n</svg>" set troughOffPressedImg [createSvgImg -data $imgData] # troughOffDisabledImg set imgData $troughData($n) append imgData "fill='#cfc9be'/>\n</svg>" set troughOffDisabledImg [createSvgImg -data $imgData] # troughOnImg set imgData $troughData($n) append imgData "fill='#4a6984'/>\n</svg>" set troughOnImg [createSvgImg -data $imgData] # troughOnActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#4a6984" : "#587d9e"}] append imgData "fill='$fill'/>\n</svg>" set troughOnActiveImg [createSvgImg -data $imgData] # troughOnPressedImg set imgData $troughData($n) append imgData "fill='#6792b7'/>\n</svg>" set troughOnPressedImg [createSvgImg -data $imgData] # troughOnDisabledImg set imgData $troughData($n) append imgData "fill='#a9d7ff'/>\n</svg>" set troughOnDisabledImg [createSvgImg -data $imgData] ttk::style element create Switch$n.trough image [list $troughOffImg \ {selected disabled} $troughOnDisabledImg \ {selected pressed} $troughOnPressedImg \ {selected active} $troughOnActiveImg \ selected $troughOnImg \ disabled $troughOffDisabledImg \ pressed $troughOffPressedImg \ active $troughOffActiveImg \ ] # sliderImg set sliderImg [createSvgImg -data $sliderData($n)] ttk::style element create Switch$n.slider image $sliderImg } } #------------------------------------------------------------------------------ # tsw::createElements_droid #------------------------------------------------------------------------------ proc tsw::createElements_droid {} { set troughData(1) { <svg width="32" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="32" height="16" rx="8" } set troughData(2) { <svg width="40" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="40" height="20" rx="10" } set troughData(3) { <svg width="48" height="24" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="48" height="24" rx="12" } set sliderData(1) { <svg width="16" height="12" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="8" cy="6" r="6" fill="#ffffff"/> </svg>} set sliderData(2) { <svg width="20" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="10" cy="8" r="8" fill="#ffffff"/> </svg>} set sliderData(3) { <svg width="24" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="10" r="10" fill="#ffffff"/> </svg>} foreach n {1 2 3} { # troughOffImg set imgData $troughData($n) append imgData "fill='#c3c3c3'/>\n</svg>" set troughOffImg [createSvgImg -data $imgData] # troughOffPressedImg set imgData $troughData($n) append imgData "fill='#a3a3a3'/>\n</svg>" set troughOffPressedImg [createSvgImg -data $imgData] # troughOffDisabledImg set imgData $troughData($n) append imgData "fill='#cecece'/>\n</svg>" set troughOffDisabledImg [createSvgImg -data $imgData] # troughOnImg set imgData $troughData($n) append imgData "fill='#657a9e'/>\n</svg>" set troughOnImg [createSvgImg -data $imgData] # troughOnPressedImg set imgData $troughData($n) append imgData "fill='#86a1d1'/>\n</svg>" set troughOnPressedImg [createSvgImg -data $imgData] # troughOnDisabledImg set imgData $troughData($n) append imgData "fill='#bcd5ff'/>\n</svg>" set troughOnDisabledImg [createSvgImg -data $imgData] ttk::style element create Switch$n.trough image [list $troughOffImg \ {selected disabled} $troughOnDisabledImg \ {selected pressed} $troughOnPressedImg \ selected $troughOnImg \ disabled $troughOffDisabledImg \ pressed $troughOffPressedImg \ ] # sliderImg set sliderImg [createSvgImg -data $sliderData($n)] ttk::style element create Switch$n.slider image $sliderImg } } #------------------------------------------------------------------------------ # tsw::createElements_plastik #------------------------------------------------------------------------------ proc tsw::createElements_plastik {} { set troughData(1) { <svg width="32" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="32" height="16" rx="8" } set troughData(2) { <svg width="40" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="40" height="20" rx="10" } set troughData(3) { <svg width="48" height="24" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="48" height="24" rx="12" } set sliderData(1) { <svg width="16" height="12" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="8" cy="6" r="6" fill="#ffffff"/> </svg>} set sliderData(2) { <svg width="20" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="10" cy="8" r="8" fill="#ffffff"/> </svg>} set sliderData(3) { <svg width="24" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="10" r="10" fill="#ffffff"/> </svg>} foreach n {1 2 3} { # troughOffImg set imgData $troughData($n) append imgData "fill='#d7d7d7'/>\n</svg>" set troughOffImg [createSvgImg -data $imgData] # troughOffPressedImg set imgData $troughData($n) append imgData "fill='#b7b7b7'/>\n</svg>" set troughOffPressedImg [createSvgImg -data $imgData] # troughOffDisabledImg set imgData $troughData($n) append imgData "fill='#e2e2e2'/>\n</svg>" set troughOffDisabledImg [createSvgImg -data $imgData] # troughOnImg set imgData $troughData($n) append imgData "fill='#657a9e'/>\n</svg>" set troughOnImg [createSvgImg -data $imgData] # troughOnPressedImg set imgData $troughData($n) append imgData "fill='#86a1d1'/>\n</svg>" set troughOnPressedImg [createSvgImg -data $imgData] # troughOnDisabledImg set imgData $troughData($n) append imgData "fill='#bcd5ff'/>\n</svg>" set troughOnDisabledImg [createSvgImg -data $imgData] ttk::style element create Switch$n.trough image [list $troughOffImg \ {selected disabled} $troughOnDisabledImg \ {selected pressed} $troughOnPressedImg \ selected $troughOnImg \ disabled $troughOffDisabledImg \ pressed $troughOffPressedImg \ ] # sliderImg set sliderImg [createSvgImg -data $sliderData($n)] ttk::style element create Switch$n.slider image $sliderImg } } #------------------------------------------------------------------------------ # tsw::createElements_awarc #------------------------------------------------------------------------------ proc tsw::createElements_awarc {} { set troughData(1) { <svg width="32" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="32" height="16" rx="8" } set troughData(2) { <svg width="40" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="40" height="20" rx="10" } set troughData(3) { <svg width="48" height="24" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="48" height="24" rx="12" } set sliderData(1) { <svg width="16" height="12" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="8" cy="6" r="6" fill="#ffffff"/> </svg>} set sliderData(2) { <svg width="20" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="10" cy="8" r="8" fill="#ffffff"/> </svg>} set sliderData(3) { <svg width="24" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="10" r="10" fill="#ffffff"/> </svg>} variable onAndroid foreach n {1 2 3} { # troughOffImg set imgData $troughData($n) append imgData "fill='#d7d7d7'/>\n</svg>" set troughOffImg [createSvgImg -data $imgData] # troughOffActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#d7d7d7" : "#c7c7c7"}] append imgData "fill='$fill'/>\n</svg>" set troughOffActiveImg [createSvgImg -data $imgData] # troughOffPressedImg set imgData $troughData($n) append imgData "fill='#b7b7b7'/>\n</svg>" set troughOffPressedImg [createSvgImg -data $imgData] # troughOffDisabledImg set imgData $troughData($n) append imgData "fill='#e2e2e2'/>\n</svg>" set troughOffDisabledImg [createSvgImg -data $imgData] # troughOnImg set imgData $troughData($n) append imgData "fill='#5294e2'/>\n</svg>" set troughOnImg [createSvgImg -data $imgData] # troughOnActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#5294e2" : "#4982c8"}] append imgData "fill='$fill'/>\n</svg>" set troughOnActiveImg [createSvgImg -data $imgData] # troughOnPressedImg set imgData $troughData($n) append imgData "fill='#3f72af'/>\n</svg>" set troughOnPressedImg [createSvgImg -data $imgData] # troughOnDisabledImg set imgData $troughData($n) append imgData "fill='#a9d0ff'/>\n</svg>" set troughOnDisabledImg [createSvgImg -data $imgData] ttk::style element create Switch$n.trough image [list $troughOffImg \ {selected disabled} $troughOnDisabledImg \ {selected pressed} $troughOnPressedImg \ {selected active} $troughOnActiveImg \ selected $troughOnImg \ disabled $troughOffDisabledImg \ pressed $troughOffPressedImg \ active $troughOffActiveImg \ ] # sliderImg set sliderImg [createSvgImg -data $sliderData($n)] ttk::style element create Switch$n.slider image $sliderImg } } #------------------------------------------------------------------------------ # tsw::createElements_awbreeze #------------------------------------------------------------------------------ proc tsw::createElements_awbreeze {} { set troughData(1) { <svg width="32" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="32" height="16" rx="8" } set troughData(2) { <svg width="40" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="40" height="20" rx="10" } set troughData(3) { <svg width="48" height="24" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="48" height="24" rx="12" } set sliderData(1) { <svg width="16" height="12" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="8" cy="6" r="6" fill="#ffffff"/> </svg>} set sliderData(2) { <svg width="20" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="10" cy="8" r="8" fill="#ffffff"/> </svg>} set sliderData(3) { <svg width="24" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="10" r="10" fill="#ffffff"/> </svg>} variable onAndroid foreach n {1 2 3} { # troughOffImg set imgData $troughData($n) append imgData "fill='#d7d7d7'/>\n</svg>" set troughOffImg [createSvgImg -data $imgData] # troughOffActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#d7d7d7" : "#c7c7c7"}] append imgData "fill='$fill'/>\n</svg>" set troughOffActiveImg [createSvgImg -data $imgData] # troughOffPressedImg set imgData $troughData($n) append imgData "fill='#b7b7b7'/>\n</svg>" set troughOffPressedImg [createSvgImg -data $imgData] # troughOffDisabledImg set imgData $troughData($n) append imgData "fill='#e2e2e2'/>\n</svg>" set troughOffDisabledImg [createSvgImg -data $imgData] # troughOnImg set imgData $troughData($n) append imgData "fill='#3daee9'/>\n</svg>" set troughOnImg [createSvgImg -data $imgData] # troughOnActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#3daee9" : "#369ad0"}] append imgData "fill='$fill'/>\n</svg>" set troughOnActiveImg [createSvgImg -data $imgData] # troughOnPressedImg set imgData $troughData($n) append imgData "fill='#3087b6'/>\n</svg>" set troughOnPressedImg [createSvgImg -data $imgData] # troughOnDisabledImg set imgData $troughData($n) append imgData "fill='#a9e1ff'/>\n</svg>" set troughOnDisabledImg [createSvgImg -data $imgData] ttk::style element create Switch$n.trough image [list $troughOffImg \ {selected disabled} $troughOnDisabledImg \ {selected pressed} $troughOnPressedImg \ {selected active} $troughOnActiveImg \ selected $troughOnImg \ disabled $troughOffDisabledImg \ pressed $troughOffPressedImg \ active $troughOffActiveImg \ ] # sliderImg set sliderImg [createSvgImg -data $sliderData($n)] ttk::style element create Switch$n.slider image $sliderImg } } #------------------------------------------------------------------------------ # tsw::createElements_awbreezedark #------------------------------------------------------------------------------ proc tsw::createElements_awbreezedark {} { set troughData(1) { <svg width="32" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="32" height="16" rx="8" } set troughData(2) { <svg width="40" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="40" height="20" rx="10" } set troughData(3) { <svg width="48" height="24" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="48" height="24" rx="12" } set sliderData(1) { <svg width="16" height="12" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="8" cy="6" r="6" } set sliderData(2) { <svg width="20" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="10" cy="8" r="8" } set sliderData(3) { <svg width="24" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="10" r="10" } variable onAndroid foreach n {1 2 3} { # troughOffImg set imgData $troughData($n) append imgData "fill='#585858'/>\n</svg>" set troughOffImg [createSvgImg -data $imgData] # troughOffActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#585858" : "#676767"}] append imgData "fill='$fill'/>\n</svg>" set troughOffActiveImg [createSvgImg -data $imgData] # troughOffPressedImg set imgData $troughData($n) append imgData "fill='#787878'/>\n</svg>" set troughOffPressedImg [createSvgImg -data $imgData] # troughOffDisabledImg set imgData $troughData($n) append imgData "fill='#4a4a4a'/>\n</svg>" set troughOffDisabledImg [createSvgImg -data $imgData] # troughOnImg set imgData $troughData($n) append imgData "fill='#3984ac'/>\n</svg>" set troughOnImg [createSvgImg -data $imgData] # troughOnActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#3984ac" : "#4197c6"}] append imgData "fill='$fill'/>\n</svg>" set troughOnActiveImg [createSvgImg -data $imgData] # troughOnPressedImg set imgData $troughData($n) append imgData "fill='#4aabdf'/>\n</svg>" set troughOnPressedImg [createSvgImg -data $imgData] # troughOnDisabledImg set imgData $troughData($n) append imgData "fill='#317093'/>\n</svg>" set troughOnDisabledImg [createSvgImg -data $imgData] ttk::style element create Switch$n.trough image [list $troughOffImg \ {selected disabled} $troughOnDisabledImg \ {selected pressed} $troughOnPressedImg \ {selected active} $troughOnActiveImg \ selected $troughOnImg \ disabled $troughOffDisabledImg \ pressed $troughOffPressedImg \ active $troughOffActiveImg \ ] # sliderOffImg set imgData $sliderData($n) append imgData "fill='#d3d3d3'/>\n</svg>" set sliderOffImg [createSvgImg -data $imgData] # sliderOffDisabledImg set imgData $sliderData($n) append imgData "fill='#888888'/>\n</svg>" set sliderOffDisabledImg [createSvgImg -data $imgData] # sliderOnDisabledImg set imgData $sliderData($n) append imgData "fill='#9f9f9f'/>\n</svg>" set sliderOnDisabledImg [createSvgImg -data $imgData] # sliderImg set imgData $sliderData($n) append imgData "fill='#ffffff'/>\n</svg>" set sliderImg [createSvgImg -data $imgData] ttk::style element create Switch$n.slider image [list $sliderOffImg \ {selected disabled} $sliderOnDisabledImg \ selected $sliderImg \ disabled $sliderOffDisabledImg \ pressed $sliderImg \ active $sliderImg \ ] } } #------------------------------------------------------------------------------ # tsw::createElements_awlight #------------------------------------------------------------------------------ proc tsw::createElements_awlight {} { set troughData(1) { <svg width="32" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="32" height="16" rx="8" } set troughData(2) { <svg width="40" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="40" height="20" rx="10" } set troughData(3) { <svg width="48" height="24" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="48" height="24" rx="12" } set sliderData(1) { <svg width="16" height="12" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="8" cy="6" r="6" fill="#ffffff"/> </svg>} set sliderData(2) { <svg width="20" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="10" cy="8" r="8" fill="#ffffff"/> </svg>} set sliderData(3) { <svg width="24" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="10" r="10" fill="#ffffff"/> </svg>} variable onAndroid foreach n {1 2 3} { # troughOffImg set imgData $troughData($n) append imgData "fill='#d7d7d7'/>\n</svg>" set troughOffImg [createSvgImg -data $imgData] # troughOffActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#d7d7d7" : "#c7c7c7"}] append imgData "fill='$fill'/>\n</svg>" set troughOffActiveImg [createSvgImg -data $imgData] # troughOffPressedImg set imgData $troughData($n) append imgData "fill='#b7b7b7'/>\n</svg>" set troughOffPressedImg [createSvgImg -data $imgData] # troughOffDisabledImg set imgData $troughData($n) append imgData "fill='#e2e2e2'/>\n</svg>" set troughOffDisabledImg [createSvgImg -data $imgData] # troughOnImg set imgData $troughData($n) append imgData "fill='#1a497c'/>\n</svg>" set troughOnImg [createSvgImg -data $imgData] # troughOnActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#1a497c" : "#1f5895"}] append imgData "fill='$fill'/>\n</svg>" set troughOnActiveImg [createSvgImg -data $imgData] # troughOnPressedImg set imgData $troughData($n) append imgData "fill='#2568af'/>\n</svg>" set troughOnPressedImg [createSvgImg -data $imgData] # troughOnDisabledImg set imgData $troughData($n) append imgData "fill='#b5d9ff'/>\n</svg>" set troughOnDisabledImg [createSvgImg -data $imgData] ttk::style element create Switch$n.trough image [list $troughOffImg \ {selected disabled} $troughOnDisabledImg \ {selected pressed} $troughOnPressedImg \ {selected active} $troughOnActiveImg \ selected $troughOnImg \ disabled $troughOffDisabledImg \ pressed $troughOffPressedImg \ active $troughOffActiveImg \ ] # sliderImg set sliderImg [createSvgImg -data $sliderData($n)] ttk::style element create Switch$n.slider image $sliderImg } } #------------------------------------------------------------------------------ # tsw::createElements_awdark #------------------------------------------------------------------------------ proc tsw::createElements_awdark {} { set troughData(1) { <svg width="32" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="32" height="16" rx="8" } set troughData(2) { <svg width="40" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="40" height="20" rx="10" } set troughData(3) { <svg width="48" height="24" version="1.1" xmlns="http://www.w3.org/2000/svg"> <rect x="0" y="0" width="48" height="24" rx="12" } set sliderData(1) { <svg width="16" height="12" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="8" cy="6" r="6" } set sliderData(2) { <svg width="20" height="16" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="10" cy="8" r="8" } set sliderData(3) { <svg width="24" height="20" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle cx="12" cy="10" r="10" } variable onAndroid foreach n {1 2 3} { # troughOffImg set imgData $troughData($n) append imgData "fill='#585858'/>\n</svg>" set troughOffImg [createSvgImg -data $imgData] # troughOffActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#585858" : "#676767"}] append imgData "fill='$fill'/>\n</svg>" set troughOffActiveImg [createSvgImg -data $imgData] # troughOffPressedImg set imgData $troughData($n) append imgData "fill='#787878'/>\n</svg>" set troughOffPressedImg [createSvgImg -data $imgData] # troughOffDisabledImg set imgData $troughData($n) append imgData "fill='#4a4a4a'/>\n</svg>" set troughOffDisabledImg [createSvgImg -data $imgData] # troughOnImg set imgData $troughData($n) append imgData "fill='#215d9c'/>\n</svg>" set troughOnImg [createSvgImg -data $imgData] # troughOnActiveImg set imgData $troughData($n) set fill [expr {$onAndroid ? "#215d9c" : "#266cb6"}] append imgData "fill='$fill'/>\n</svg>" set troughOnActiveImg [createSvgImg -data $imgData] # troughOnPressedImg set imgData $troughData($n) append imgData "fill='#2c7bcf'/>\n</svg>" set troughOnPressedImg [createSvgImg -data $imgData] # troughOnDisabledImg set imgData $troughData($n) append imgData "fill='#1c4d83'/>\n</svg>" set troughOnDisabledImg [createSvgImg -data $imgData] ttk::style element create Switch$n.trough image [list $troughOffImg \ {selected disabled} $troughOnDisabledImg \ {selected pressed} $troughOnPressedImg \ {selected active} $troughOnActiveImg \ selected $troughOnImg \ disabled $troughOffDisabledImg \ pressed $troughOffPressedImg \ active $troughOffActiveImg \ ] # sliderOffImg set imgData $sliderData($n) append imgData "fill='#d3d3d3'/>\n</svg>" set sliderOffImg [createSvgImg -data $imgData] # sliderOffDisabledImg set imgData $sliderData($n) append imgData "fill='#888888'/>\n</svg>" set sliderOffDisabledImg [createSvgImg -data $imgData] # sliderOnDisabledImg set imgData $sliderData($n) append imgData "fill='#9f9f9f'/>\n</svg>" set sliderOnDisabledImg [createSvgImg -data $imgData] # sliderImg set imgData $sliderData($n) append imgData "fill='#ffffff'/>\n</svg>" set sliderImg [createSvgImg -data $imgData] ttk::style element create Switch$n.slider image [list $sliderOffImg \ {selected disabled} $sliderOnDisabledImg \ selected $sliderImg \ disabled $sliderOffDisabledImg \ pressed $sliderImg \ active $sliderImg \ ] } } #------------------------------------------------------------------------------ # tsw::createElements_vista #------------------------------------------------------------------------------ proc tsw::createElements_vista {} { variable elemInfoArr if {[info exists elemInfoArr(vista)]} { return "" } if {$::tcl_platform(osVersion) >= 11.0} { ;# Win 11+ createElements_win11 } else { ;# Win 10- createElements_win10 } foreach n {1 2 3} { ttk::style layout Toggleswitch$n [list \ Switch.focus -sticky nswe -children [list \ Switch.padding -sticky nswe -children [list \ Switch$n.trough -sticky {} -children [list \ Switch$n.slider -side left -sticky {} ] ] ] ] } set elemInfoArr(vista) 1 } #------------------------------------------------------------------------------ # tsw::createElements_win11 #------------------------------------------------------------------------------ |
︙ | ︙ | |||
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 | if {$darkMode} { # For the colors blue, purple, pink, red, orange, yellow, green, # and graphite replace $fill with its counterpart for LightAqua array set tmpArr { #0059d1 #0064e1 #803482 #7d2a7e #c93379 #d93b86 #d13539 #c4262b #c96003 #d96b0a #d19e00 #e1ac15 #43932a #4da033 #696969 #808080 } if {[info exists tmpArr($fill)]} { set fill $tmpArr($fill) } array unset tmpArr } append imgData "fill='$fill'/>\n</svg>" $troughImgArr(on$n) configure -data $imgData # troughImgArr(onPressed$n) set imgData $troughOnData($n) set fill [expr {$darkMode ? "systemControlAccentColor" : "systemSelectedContentBackgroundColor"}] set fill [mwutil::normalizeColor $fill] if {$darkMode} { # For the colors purple, red, yellow, and graphite # replace $fill with its counterpart for LightAqua array set tmpArr { #a550a7 #953d96 #ff5257 #e0383e #ffc600 #ffc726 #8c8c8c #989898 } if {[info exists tmpArr($fill)]} { set fill $tmpArr($fill) } array unset tmpArr } append imgData "fill='$fill'/>\n</svg>" $troughImgArr(onPressed$n) configure -data $imgData | > > > > > > > | 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 | if {$darkMode} { # For the colors blue, purple, pink, red, orange, yellow, green, # and graphite replace $fill with its counterpart for LightAqua array set tmpArr { #0059d1 #0064e1 #803482 #7d2a7e #c93379 #d93b86 #d13539 #c4262b #c96003 #d96b0a #d19e00 #e1ac15 #43932a #4da033 #696969 #808080 #0058d0 #007aff #7f3280 #953d96 #c83179 #f74f9e #d03439 #e0383e #c86003 #f7821b #cd8f0e #fcb827 #42912a #62ba46 #686868 #989898 } if {[info exists tmpArr($fill)]} { set fill $tmpArr($fill) } array unset tmpArr } append imgData "fill='$fill'/>\n</svg>" $troughImgArr(on$n) configure -data $imgData # troughImgArr(onPressed$n) set imgData $troughOnData($n) set fill [expr {$darkMode ? "systemControlAccentColor" : "systemSelectedContentBackgroundColor"}] set fill [mwutil::normalizeColor $fill] if {$darkMode} { # For the colors purple, red, yellow, and graphite # replace $fill with its counterpart for LightAqua array set tmpArr { #a550a7 #953d96 #ff5257 #e0383e #ffc600 #ffc726 #8c8c8c #989898 #a550a7 #7d2a7e #f74f9e #d93b85 #fcb827 #de9e15 #8c8c8c #808080 } if {[info exists tmpArr($fill)]} { set fill $tmpArr($fill) } array unset tmpArr } append imgData "fill='$fill'/>\n</svg>" $troughImgArr(onPressed$n) configure -data $imgData |
︙ | ︙ |
Changes to modules/tsw/scripts/tclIndex.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Tcl autoload index file, version 2.0 # This file is generated by the "auto_mkindex" command # and sourced to set up indexing information for one or # more commands. Typically each line is a command that # sets an element in the auto_index array, where the # element name is the name of a command and the value is # a script that loads the command. set auto_index(::tsw::svgFormat) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_default) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_default-dark) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_clam) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_vista) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_win11) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_win10) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_aqua) [list source [file join $dir elements.tcl]] set auto_index(::tsw::updateElements_aqua) [list source [file join $dir elements.tcl]] set auto_index(::tsw::condMakeLayouts) [list source [file join $dir toggleswitch.tcl]] set auto_index(::tsw::createBindings) [list source [file join $dir toggleswitch.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 | # Tcl autoload index file, version 2.0 # This file is generated by the "auto_mkindex" command # and sourced to set up indexing information for one or # more commands. Typically each line is a command that # sets an element in the auto_index array, where the # element name is the name of a command and the value is # a script that loads the command. set auto_index(::tsw::svgFormat) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_default) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_default-dark) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_clam) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_droid) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_plastik) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_awarc) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_awbreeze) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_awbreezedark) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_awlight) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_awdark) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_vista) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_win11) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_win10) [list source [file join $dir elements.tcl]] set auto_index(::tsw::createElements_aqua) [list source [file join $dir elements.tcl]] set auto_index(::tsw::updateElements_aqua) [list source [file join $dir elements.tcl]] set auto_index(::tsw::condMakeLayouts) [list source [file join $dir toggleswitch.tcl]] set auto_index(::tsw::createBindings) [list source [file join $dir toggleswitch.tcl]] |
︙ | ︙ |
Changes to modules/tsw/scripts/toggleswitch.tcl.
︙ | ︙ | |||
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | # scaleutil::scalingPercentage [tk windowingsystem] set scaled4 [scaleutil::scale 4 $::scaleutil::scalingPct] } else { ;# Tk 8.7b1/9 or later set scaled4 [tk::ScaleNum 4] } # # Make the layouts # proc condMakeLayouts {} { variable theme set themeMod $theme set mod "" | > > | | > | > | 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 | # scaleutil::scalingPercentage [tk windowingsystem] set scaled4 [scaleutil::scale 4 $::scaleutil::scalingPct] } else { ;# Tk 8.7b1/9 or later set scaled4 [tk::ScaleNum 4] } variable onAndroid [expr {[info exists ::tk::android] && $::tk::android}] # # Make the layouts # proc condMakeLayouts {} { variable theme set themeMod $theme set mod "" if {$theme eq "default"} { set fg [ttk::style lookup . -foreground] if {[mwutil::isColorLight $fg]} { set themeMod default-dark set mod "Dark" } } variable elemInfoArr if {[info exists elemInfoArr($themeMod)]} { if {$theme eq "aqua"} { updateElements_$theme } return "" } switch $themeMod { default - default-dark - clam - droid - plastik - awarc - awbreeze - awbreezedark - awlight - awdark - vista - aqua { createElements_$themeMod } winnative - xpnative { ttk::style theme settings vista { createElements_vista } foreach n {1 2 3} { ttk::style element create Switch$n.trough from vista ttk::style element create Switch$n.slider from vista } } default { set fg [ttk::style lookup . -foreground {} black] if {[mwutil::isColorLight $fg] || [string match -nocase *dark* $theme]} { set createCmd createElements_default-dark set mod "Dark" } else { set createCmd createElements_default } ttk::style theme settings default { $createCmd } foreach n {1 2 3} { ttk::style element create ${mod}Switch$n.trough from default ttk::style element create ${mod}Switch$n.slider from default } } } |
︙ | ︙ | |||
193 194 195 196 197 198 199 | } # # Define the binding tag ToggleswitchKeyNav # mwutil::defineKeyNav Toggleswitch | > > | | > | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | } # # Define the binding tag ToggleswitchKeyNav # mwutil::defineKeyNav Toggleswitch variable onAndroid if {!$onAndroid} { bind TswScale <Enter> { %W instate !disabled {%W state active} } bind TswScale <Leave> { %W state !active } } bind TswScale <B1-Leave> { # Preserves the "active" state. } bind TswScale <Button-1> { tsw::onButton1 %W %x %y } bind TswScale <B1-Motion> { tsw::onB1Motion %W %x %y } bind TswScale <ButtonRelease-1> { tsw::onButtonRel1 %W } bind TswScale <space> { tsw::onSpace %W } } |
︙ | ︙ |
Changes to modules/tsw/tsw.tcl.
︙ | ︙ | |||
12 13 14 15 16 17 18 | if {$::tk_version == 8.6} { package require tksvg } # # Public variables: # | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | if {$::tk_version == 8.6} { package require tksvg } # # Public variables: # variable version 1.2 variable library [file dirname [file normalize [info script]]] # # Creates a new toggleswitch widget: # namespace export toggleswitch } |
︙ | ︙ |