1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
|
<!DOCTYPE html>
<html>
<head>
<title>Commands Related to Tile Themes</title>
<meta name="Author" content="Csaba Nemethi">
<meta name="Keywords" content="mentry, theme, tile">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<div>
<h1>Commands Related to Tile Themes</h1>
<h2>For Mentry Version 4.3</h2>
<h3>by</h3>
<h2>Csaba Nemethi</h2>
<address>
<a href="mailto:csaba.nemethi@t-online.de">csaba.nemethi@t-online.de</a>
</address>
</div>
<hr>
<h2 id="contents">Contents</h2>
<ul>
<li><a href="#overview">Overview</a></li>
<li><a href="#setTheme">The <code><b>mentry::setTheme</b></code>
Command</a></li>
<li><a href="#getCurrentTheme">The
<code><b>mentry::getCurrentTheme</b></code> Command</a></li>
<li><a href="#getThemes">The <code><b>mentry::getThemes</b></code>
Command</a></li>
<li><a href="#setThemeDefaults">The
<code><b>mentry::setThemeDefaults</b></code> Command</a></li>
</ul>
<div>
<p><a href="index.html">Start page</a></p>
</div>
<hr>
<h2 id="overview">Overview</h2>
<p>The commands described in this reference page should only be invoked when
using the package Mentry_tile. They enable you to set and query the
current theme, to retrieve a list of the available themes, and to make sure
that your widgets will have a theme-specific appearance.</p>
<div>
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="setTheme">The <code><b>mentry::setTheme</b></code> Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>mentry::setTheme</code> – Set the current theme</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>mentry::setTheme</b> <i>theme</i>
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>This command sets the current theme to <code><i>theme</i></code>,
loading it if necessary. It is simply an alias for
<code><b>ttk::setTheme</b></code> or <code><b>tile::setTheme</b></code>,
depending on the tile version loaded into the interpreter. (The
<code><b>tile::setTheme</b></code> command was renamed to
<code><b>ttk::setTheme</b></code> in tile version 0.8.)</dd>
<dd class="tm">Being just an alias for a tile library procedure, the
<code><b>mentry::setTheme</b></code> command does exactly the same as the
original one: It loads the package implementing the given theme if needed,
sets the theme to the specified one, and saves the latter in the variable
<code><b>ttk::currentTheme</b></code> or
<code><b>tile::currentTheme</b></code>, depending on the current tile
version.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>mentry, theme, tile</dd>
</dl>
<div>
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="getCurrentTheme">The <code><b>mentry::getCurrentTheme</b></code>
Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>mentry::getCurrentTheme</code> – Get the current theme</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>mentry::getCurrentTheme</b>
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>This command returns the name of the current theme by invoking
the <code><b>ttk::style theme use</b></code> command. If
an old tile version is being used which doesn't yet support this method
then the command returns the value of the variable
<code><b>ttk::currentTheme</b></code> or
<code><b>tile::currentTheme</b></code>, depending on the tile
version. (The namespace containing the variable
<code><b>currentTheme</b></code> was changed in tile version 0.8 from
<code><b>tile</b></code> to <code><b>ttk</b></code>.)</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>mentry, theme, tile</dd>
</dl>
<div>
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="getThemes">The <code><b>mentry::getThemes</b></code> Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>mentry::getThemes</code> – Get the themes registered in the
package database</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>mentry::getThemes</b>
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>This command returns a list of the themes registered in the package
database. It is simply an alias for <code><b>ttk::themes</b></code>
or <code><b>tile::availableThemes</b></code>, depending on the tile version
loaded into the interpreter. (The
<code><b>tile::availableThemes</b></code> command was renamed to
<code><b>ttk::themes</b></code> in tile version 0.8.)</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>mentry, theme, tile</dd>
</dl>
<div>
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
<hr>
<h2 id="setThemeDefaults">The <code><b>mentry::setThemeDefaults</b></code>
Command</h2>
<dl>
<dt><b>NAME</b></dt>
<dd><code>mentry::setThemeDefaults</code> – Set theme-specific
default values of some mentry configuration options</dd>
<dt class="tm"><b>SYNOPSIS</b></dt>
<dd>
<pre>
<b>mentry::setThemeDefaults</b>
</pre>
</dd>
<dt><b>DESCRIPTION</b></dt>
<dd>This command populates the array
<code><b>mentry::themeDefaults</b></code> with theme-specific default
values of a series of Mentry configuration options. The array names
are the command-line names of the options, and the corresponding array
values are the default values of these configuration options for the
currently set tile theme.</dd>
<dd class="tm">The options whose names and values are written into the
array <code><b>mentry::themeDefaults</b></code> are:
<code><b>-background</b></code>, <code><b>-foreground</b></code>, and
<code><b>-font</b></code>. In addition, the command sets some other
array elements to theme-specific default values, needed for internal
purposes, like updating the background and foreground colors of the label
components of a mentry widget in <code><b>disabled</b></code> or
<code><b>readonly</b></code> state; the corresponding array names are:
<code><b>-disabledbackground</b></code>,
<code><b>-disabledforeground</b></code>, and
<code><b>-readonlybackground</b></code>. Finally, the array values
associated with the names <code><b>-selectbackground</b></code>,
<code><b>-selectforeground</b></code>, and
<code><b>-selectborderwidth</b></code> are not used by Mentry_tile, but
might prove useful for other purposes, as described below.</dd>
<dd class="tm">The <code><b>mentry::setThemeDefaults</b></code> command is
invoked by Mentry_tile automatically at application start time and when the
<code><b><<ThemeChanged>></b></code> virtual event is sent to
the main window. It is also invoked on Mac OS 10.14 (Mojave) and
later whenever the main window receives a
<code><b><<LightAqua>></b></code> or
<code><b><<DarkAqua>></b></code> virtual event, if the current
theme is <code>aqua</code>. In these cases, after invoking the
<code><b>mentry::setThemeDefaults</b></code> command, Mentry_tile sends the
virtual event
<code><b><<MentryThemeDefaultsChanged>></b></code> to the main
window and reconfigures all mentry widgets of the application, using the
new default values of those options that were not set explicitly to values
different from the corresponding defaults.</dd>
<dd class="tm">On Mac OS 10.14 (Mojave) and later, the virtual events
<code><b><<LightAqua>></b></code> and
<code><b><<DarkAqua>></b></code> are sent by Tk 8.6.10 and
later to all toplevel widgets whenever the system appearance toggles
between Light Mode and Dark Mode or the Accent Color in the General
Preferences changes. Tk versions 8.6.11 and later send these events
on Mac OS 10.15 (Catalina) and later also when changing the Highlight Color
in the General Preferences.</dd>
<dd class="tm">Besides being used by Mentry_tile, this command can also be
invoked in application code, although with current Mentry_tile versions
there is no need for calling it explicitly.</dd>
<dd class="tm">By using the default values contained in the array
<code><b>mentry::themeDefaults</b></code>, you can make sure that classical
Tk widgets, e.g., text, will have a theme-specific appearance, just like
the tile widgets. For example, you can add some common configuration
options to the option database as follows:</dd>
<dd>
<blockquote>
<pre>
if {[tk windowingsystem] eq "x11"} {
option add *Text.background $mentry::themeDefaults(-background)
option add *Text.foreground $mentry::themeDefaults(-foreground)
option add *selectBackground $mentry::themeDefaults(-selectbackground)
option add *selectForeground $mentry::themeDefaults(-selectforeground)
}
option add *selectBorderWidth $mentry::themeDefaults(-selectborderwidth)
option add *Font $mentry::themeDefaults(-font)
</pre>
</blockquote>
</dd>
<dd>You can also make use of the virtual event
<code><b><<MentryThemeDefaultsChanged>></b></code> to update
the appearance of your Tk widgets according to the new values contained in
the array <code><b>mentry::themeDefaults</b></code>, by binding to the
dedicated binding tag <code><b>MentryMain</b></code> associated with the
main window:</dd>
<dd>
<blockquote>
<pre>
bind MentryMain <<MentryThemeDefaultsChanged>> ...
</pre>
</blockquote>
</dd>
<dd>The binding tag <code><b>MentryMain</b></code> is assigned by
Mentry_tile to the main window and used internally for handling the virtual
events <code><b><<ThemeChanged>></b></code>,
<code><b><<LightAqua>></b></code>, and
<code><b><<DarkAqua>></b></code>. As shown above,
applications can make use of it, e.g., to handle the virtual event
<code><b><<MentryThemeDefaultsChanged>></b></code>.</dd>
<dt class="tm"><b>KEYWORDS</b></dt>
<dd>mentry, theme, tile</dd>
</dl>
<div>
<p><a href="#contents">Contents</a> <a href=
"index.html">Start page</a></p>
</div>
</body>
</html>
|