summaryrefslogtreecommitdiffstats
path: root/library/comdlg.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/comdlg.tcl')
-rw-r--r--library/comdlg.tcl110
1 files changed, 58 insertions, 52 deletions
diff --git a/library/comdlg.tcl b/library/comdlg.tcl
index 1ba0769..cb2af18 100644
--- a/library/comdlg.tcl
+++ b/library/comdlg.tcl
@@ -3,7 +3,7 @@
# Some functions needed for the common dialog boxes. Probably need to go
# in a different file.
#
-# RCS: @(#) $Id: comdlg.tcl,v 1.7 2000/04/08 06:59:28 hobbs Exp $
+# RCS: @(#) $Id: comdlg.tcl,v 1.8 2001/08/01 16:21:11 dgp Exp $
#
# Copyright (c) 1996 Sun Microsystems, Inc.
#
@@ -112,94 +112,99 @@ proc tclListValidFlags {v} {
#----------------------------------------------------------------------
-# tkFocusGroup_Create --
+# ::tk::FocusGroup_Create --
#
# Create a focus group. All the widgets in a focus group must be
# within the same focus toplevel. Each toplevel can have only
# one focus group, which is identified by the name of the
# toplevel widget.
#
-proc tkFocusGroup_Create {t} {
- global tkPriv
+proc ::tk::FocusGroup_Create {t} {
+ variable ::tk::Priv
if {[string compare [winfo toplevel $t] $t]} {
error "$t is not a toplevel window"
}
- if {![info exists tkPriv(fg,$t)]} {
- set tkPriv(fg,$t) 1
- set tkPriv(focus,$t) ""
- bind $t <FocusIn> [list tkFocusGroup_In $t %W %d]
- bind $t <FocusOut> [list tkFocusGroup_Out $t %W %d]
- bind $t <Destroy> [list tkFocusGroup_Destroy $t %W]
+ if {![info exists Priv(fg,$t)]} {
+ set Priv(fg,$t) 1
+ set Priv(focus,$t) ""
+ bind $t <FocusIn> [list tk::FocusGroup_In $t %W %d]
+ bind $t <FocusOut> [list tk::FocusGroup_Out $t %W %d]
+ bind $t <Destroy> [list tk::FocusGroup_Destroy $t %W]
}
}
-# tkFocusGroup_BindIn --
+# ::tk::FocusGroup_BindIn --
#
# Add a widget into the "FocusIn" list of the focus group. The $cmd will be
# called when the widget is focused on by the user.
#
-proc tkFocusGroup_BindIn {t w cmd} {
- global tkFocusIn tkPriv
- if {![info exists tkPriv(fg,$t)]} {
+proc ::tk::FocusGroup_BindIn {t w cmd} {
+ variable FocusIn
+ variable ::tk::Priv
+ if {![info exists Priv(fg,$t)]} {
error "focus group \"$t\" doesn't exist"
}
- set tkFocusIn($t,$w) $cmd
+ set FocusIn($t,$w) $cmd
}
-# tkFocusGroup_BindOut --
+# ::tk::FocusGroup_BindOut --
#
# Add a widget into the "FocusOut" list of the focus group. The
# $cmd will be called when the widget loses the focus (User
# types Tab or click on another widget).
#
-proc tkFocusGroup_BindOut {t w cmd} {
- global tkFocusOut tkPriv
- if {![info exists tkPriv(fg,$t)]} {
+proc ::tk::FocusGroup_BindOut {t w cmd} {
+ variable FocusOut
+ variable ::tk::Priv
+ if {![info exists Priv(fg,$t)]} {
error "focus group \"$t\" doesn't exist"
}
- set tkFocusOut($t,$w) $cmd
+ set FocusOut($t,$w) $cmd
}
-# tkFocusGroup_Destroy --
+# ::tk::FocusGroup_Destroy --
#
# Cleans up when members of the focus group is deleted, or when the
# toplevel itself gets deleted.
#
-proc tkFocusGroup_Destroy {t w} {
- global tkPriv tkFocusIn tkFocusOut
+proc ::tk::FocusGroup_Destroy {t w} {
+ variable FocusIn
+ variable FocusOut
+ variable ::tk::Priv
if {[string equal $t $w]} {
- unset tkPriv(fg,$t)
- unset tkPriv(focus,$t)
+ unset Priv(fg,$t)
+ unset Priv(focus,$t)
- foreach name [array names tkFocusIn $t,*] {
- unset tkFocusIn($name)
+ foreach name [array names FocusIn $t,*] {
+ unset FocusIn($name)
}
- foreach name [array names tkFocusOut $t,*] {
- unset tkFocusOut($name)
+ foreach name [array names FocusOut $t,*] {
+ unset FocusOut($name)
}
} else {
- if {[info exists tkPriv(focus,$t)] && \
- [string equal $tkPriv(focus,$t) $w]} {
- set tkPriv(focus,$t) ""
+ if {[info exists Priv(focus,$t)] && \
+ [string equal $Priv(focus,$t) $w]} {
+ set Priv(focus,$t) ""
}
catch {
- unset tkFocusIn($t,$w)
+ unset FocusIn($t,$w)
}
catch {
- unset tkFocusOut($t,$w)
+ unset FocusOut($t,$w)
}
}
}
-# tkFocusGroup_In --
+# ::tk::FocusGroup_In --
#
# Handles the <FocusIn> event. Calls the FocusIn command for the newly
# focused widget in the focus group.
#
-proc tkFocusGroup_In {t w detail} {
- global tkPriv tkFocusIn
+proc ::tk::FocusGroup_In {t w detail} {
+ variable FocusIn
+ variable ::tk::Priv
if {[string compare $detail NotifyNonlinear] && \
[string compare $detail NotifyNonlinearVirtual]} {
@@ -207,56 +212,57 @@ proc tkFocusGroup_In {t w detail} {
# ordinary keypresses some window managers (ie: CDE [Bug: 2960]).
return
}
- if {![info exists tkFocusIn($t,$w)]} {
- set tkFocusIn($t,$w) ""
+ if {![info exists FocusIn($t,$w)]} {
+ set FocusIn($t,$w) ""
return
}
- if {![info exists tkPriv(focus,$t)]} {
+ if {![info exists Priv(focus,$t)]} {
return
}
- if {[string equal $tkPriv(focus,$t) $w]} {
+ if {[string equal $Priv(focus,$t) $w]} {
# This is already in focus
#
return
} else {
- set tkPriv(focus,$t) $w
- eval $tkFocusIn($t,$w)
+ set Priv(focus,$t) $w
+ eval $FocusIn($t,$w)
}
}
-# tkFocusGroup_Out --
+# ::tk::FocusGroup_Out --
#
# Handles the <FocusOut> event. Checks if this is really a lose
# focus event, not one generated by the mouse moving out of the
# toplevel window. Calls the FocusOut command for the widget
# who loses its focus.
#
-proc tkFocusGroup_Out {t w detail} {
- global tkPriv tkFocusOut
+proc ::tk::FocusGroup_Out {t w detail} {
+ variable FocusOut
+ variable ::tk::Priv
if {[string compare $detail NotifyNonlinear] && \
[string compare $detail NotifyNonlinearVirtual]} {
# This is caused by mouse moving out of the window
return
}
- if {![info exists tkPriv(focus,$t)]} {
+ if {![info exists Priv(focus,$t)]} {
return
}
- if {![info exists tkFocusOut($t,$w)]} {
+ if {![info exists FocusOut($t,$w)]} {
return
} else {
- eval $tkFocusOut($t,$w)
- set tkPriv(focus,$t) ""
+ eval $FocusOut($t,$w)
+ set Priv(focus,$t) ""
}
}
-# tkFDGetFileTypes --
+# ::tk::FDGetFileTypes --
#
# Process the string given by the -filetypes option of the file
# dialogs. Similar to the C function TkGetFileFilters() on the Mac
# and Windows platform.
#
-proc tkFDGetFileTypes {string} {
+proc ::tk::FDGetFileTypes {string} {
foreach t $string {
if {[llength $t] < 2 || [llength $t] > 3} {
error "bad file type \"$t\", should be \"typeName {extension ?extensions ...?} ?{macType ?macTypes ...?}?\""