summaryrefslogtreecommitdiffstats
path: root/library/palette.tcl
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2001-08-01 16:21:11 (GMT)
committerdgp <dgp@users.sourceforge.net>2001-08-01 16:21:11 (GMT)
commit98ea3cb2214b51432f38f6ea50c1c429397281cc (patch)
tree38846cbe94cc8aac068898282ced4624f130770e /library/palette.tcl
parent7e9aececf720b6f0e20157366f8e977ad2378ddd (diff)
downloadtk-98ea3cb2214b51432f38f6ea50c1c429397281cc.zip
tk-98ea3cb2214b51432f38f6ea50c1c429397281cc.tar.gz
tk-98ea3cb2214b51432f38f6ea50c1c429397281cc.tar.bz2
Merged changes from feature branch dgp-privates-into-namespace,
implementing TIP 44. All Tk commands and variables matching tk[A-Z]* are now in the ::tk namespace.
Diffstat (limited to 'library/palette.tcl')
-rw-r--r--library/palette.tcl31
1 files changed, 14 insertions, 17 deletions
diff --git a/library/palette.tcl b/library/palette.tcl
index de34604..f278268 100644
--- a/library/palette.tcl
+++ b/library/palette.tcl
@@ -3,7 +3,7 @@
# This file contains procedures that change the color palette used
# by Tk.
#
-# RCS: @(#) $Id: palette.tcl,v 1.5 1999/09/02 17:02:53 hobbs Exp $
+# RCS: @(#) $Id: palette.tcl,v 1.6 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
#
@@ -11,7 +11,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# tk_setPalette --
+# ::tk_setPalette --
# Changes the default color scheme for a Tk application by setting
# default colors in the option database and by modifying all of the
# color options for existing widgets that have the default value.
@@ -23,14 +23,12 @@
# option names and values. The name for an option is the one used
# for the option database, such as activeForeground, not -activeforeground.
-proc tk_setPalette {args} {
+proc ::tk_setPalette {args} {
if {[winfo depth .] == 1} {
# Just return on monochrome displays, otherwise errors will occur
return
}
- global tkPalette
-
# Create an array that has the complete new palette. If some colors
# aren't specified, compute them from other colors that are specified.
@@ -108,7 +106,7 @@ proc tk_setPalette {args} {
# Walk the widget hierarchy, recoloring all existing windows.
# The option database must be set according to what we do here,
# but it breaks things if we set things in the database while
- # we are changing colors...so, tkRecolorTree now returns the
+ # we are changing colors...so, ::tk::RecolorTree now returns the
# option database changes that need to be made, and they
# need to be evalled here to take effect.
# We have to walk the whole widget tree instead of just
@@ -117,7 +115,7 @@ proc tk_setPalette {args} {
# of widgets that we don't currently know about, so we'll
# walk the whole hierarchy just in case.
- eval [tkRecolorTree . new]
+ eval [tk::RecolorTree . new]
catch {destroy .___tk_set_palette}
@@ -128,13 +126,13 @@ proc tk_setPalette {args} {
option add *$option $new($option) widgetDefault
}
- # Save the options in the global variable tkPalette, for use the
+ # Save the options in the variable ::tk::Palette, for use the
# next time we change the options.
- array set tkPalette [array get new]
+ array set ::tk::Palette [array get new]
}
-# tkRecolorTree --
+# ::tk::RecolorTree --
# This procedure changes the colors in a window and all of its
# descendants, according to information provided by the colors
# argument. This looks at the defaults provided by the option
@@ -149,8 +147,7 @@ proc tk_setPalette {args} {
# is named after a widget configuration option, and
# each value is the value for that option.
-proc tkRecolorTree {w colors} {
- global tkPalette
+proc ::tk::RecolorTree {w colors} {
upvar $colors c
set result {}
foreach dbOption [array names c] {
@@ -176,12 +173,12 @@ proc tkRecolorTree {w colors} {
}
}
foreach child [winfo children $w] {
- append result ";\n[tkRecolorTree $child c]"
+ append result ";\n[::tk::RecolorTree $child c]"
}
return $result
}
-# tkDarken --
+# ::tk::Darken --
# Given a color name, computes a new color value that darkens (or
# brightens) the given color by a given percent.
#
@@ -191,7 +188,7 @@ proc tkRecolorTree {w colors} {
# percent: 50 means darken by 50%, 110 means brighten
# by 10%.
-proc tkDarken {color percent} {
+proc ::tk::Darken {color percent} {
foreach {red green blue} [winfo rgb . $color] {
set red [expr {($red/256)*$percent/100}]
set green [expr {($green/256)*$percent/100}]
@@ -210,13 +207,13 @@ proc tkDarken {color percent} {
return [format "#%02x%02x%02x" $red $green $blue]
}
-# tk_bisque --
+# ::tk_bisque --
# Reset the Tk color palette to the old "bisque" colors.
#
# Arguments:
# None.
-proc tk_bisque {} {
+proc ::tk_bisque {} {
tk_setPalette activeBackground #e6ceb1 activeForeground black \
background #ffe4c4 disabledForeground #b0b0b0 foreground black \
highlightBackground #ffe4c4 highlightColor black \