Import Tk 8.6.11
This commit is contained in:
@@ -5,12 +5,12 @@
|
||||
#
|
||||
# Pulldown: Press menubutton, drag over menu, release to activate menu entry
|
||||
# Popdown: Click menubutton to post menu
|
||||
# Keyboard: <Key-space> or accelerator key to post menu
|
||||
# Keyboard: <space> or accelerator key to post menu
|
||||
#
|
||||
# (In addition, when menu system is active, "dropdown" -- menu posts
|
||||
# on mouse-over. Ttk menubuttons don't implement this).
|
||||
#
|
||||
# For keyboard and popdown mode, we hand off to tk_popup and let
|
||||
# For keyboard and popdown mode, we hand off to tk_popup and let
|
||||
# the built-in Tk bindings handle the rest of the interaction.
|
||||
#
|
||||
# ON X11:
|
||||
@@ -19,16 +19,16 @@
|
||||
# This won't work for Ttk menubuttons in pulldown mode,
|
||||
# since we need to process the final <ButtonRelease> event,
|
||||
# and this might be delivered to the menu. So instead we
|
||||
# rely on the passive grab that occurs on <ButtonPress> events,
|
||||
# rely on the passive grab that occurs on <Button> events,
|
||||
# and transition to popdown mode when the mouse is released
|
||||
# or dragged outside the menubutton.
|
||||
#
|
||||
#
|
||||
# ON WINDOWS:
|
||||
#
|
||||
# I'm not sure what the hell is going on here. [$menu post] apparently
|
||||
# I'm not sure what the hell is going on here. [$menu post] apparently
|
||||
# sets up some kind of internal grab for native menus.
|
||||
# On this platform, just use [tk_popup] for all menu actions.
|
||||
#
|
||||
#
|
||||
# ON MACOS:
|
||||
#
|
||||
# Same probably applies here.
|
||||
@@ -46,15 +46,15 @@ namespace eval ttk {
|
||||
|
||||
bind TMenubutton <Enter> { %W instate !disabled {%W state active } }
|
||||
bind TMenubutton <Leave> { %W state !active }
|
||||
bind TMenubutton <Key-space> { ttk::menubutton::Popdown %W }
|
||||
bind TMenubutton <space> { ttk::menubutton::Popdown %W }
|
||||
bind TMenubutton <<Invoke>> { ttk::menubutton::Popdown %W }
|
||||
|
||||
if {[tk windowingsystem] eq "x11"} {
|
||||
bind TMenubutton <ButtonPress-1> { ttk::menubutton::Pulldown %W }
|
||||
bind TMenubutton <Button-1> { ttk::menubutton::Pulldown %W }
|
||||
bind TMenubutton <ButtonRelease-1> { ttk::menubutton::TransferGrab %W }
|
||||
bind TMenubutton <B1-Leave> { ttk::menubutton::TransferGrab %W }
|
||||
} else {
|
||||
bind TMenubutton <ButtonPress-1> \
|
||||
bind TMenubutton <Button-1> \
|
||||
{ %W state pressed ; ttk::menubutton::Popdown %W }
|
||||
bind TMenubutton <ButtonRelease-1> \
|
||||
{ if {[winfo exists %W]} { %W state !pressed } }
|
||||
@@ -97,7 +97,7 @@ if {[tk windowingsystem] eq "aqua"} {
|
||||
}
|
||||
below {
|
||||
set entry ""
|
||||
incr y $bh
|
||||
incr y $bh
|
||||
}
|
||||
left {
|
||||
incr y $menuPad
|
||||
@@ -105,7 +105,7 @@ if {[tk windowingsystem] eq "aqua"} {
|
||||
}
|
||||
right {
|
||||
incr y $menuPad
|
||||
incr x $bw
|
||||
incr x $bw
|
||||
}
|
||||
default {
|
||||
incr y $bbh
|
||||
@@ -182,7 +182,7 @@ proc ttk::menubutton::Popdown {mb} {
|
||||
|
||||
# Pulldown (X11 only) --
|
||||
# Called when Button1 is pressed on a menubutton.
|
||||
# Posts the menu; a subsequent ButtonRelease
|
||||
# Posts the menu; a subsequent ButtonRelease
|
||||
# or Leave event will set a grab on the menu.
|
||||
#
|
||||
proc ttk::menubutton::Pulldown {mb} {
|
||||
@@ -224,11 +224,11 @@ proc ttk::menubutton::TransferGrab {mb} {
|
||||
# FindMenuEntry --
|
||||
# Hack to support tk_optionMenus.
|
||||
# Returns the index of the menu entry with a matching -label,
|
||||
# -1 if not found.
|
||||
# "" if not found.
|
||||
#
|
||||
proc ttk::menubutton::FindMenuEntry {menu s} {
|
||||
set last [$menu index last]
|
||||
if {$last eq "none"} {
|
||||
if {$last eq "none" || $last eq ""} {
|
||||
return ""
|
||||
}
|
||||
for {set i 0} {$i <= $last} {incr i} {
|
||||
|
||||
Reference in New Issue
Block a user