k generates sensible values for the %D field in <MouseWheel> events.
#
# On Windows, %D must be scaled by a factor of 120.
# In addition, Tk redirects mousewheel events to the window with
# keyboard focus instead of sending them to the window under the pointer.
# We do not attempt to fix that here, see also TIP#171.
#
# OSX conventionally uses Shift+MouseWheel for horizontal scrolling,
# and Option+MouseWheel for accelerated scrolling.
#
# The Shift+MouseWheel behavior is not conventional on Windows or most
# X11 toolkits, but it's useful.
#
# MouseWheel scrolling is accelerated on X11, which is conventional
# for Tk and appears to be conventional for other toolkits (although
# Gtk+ and Qt do not appear to use as large a factor).
#

## ttk::bindMouseWheel $bindtag $command...
#	Adds basic mousewheel support to $bindtag.
#	$command will be passed one additional argument
#	specifying the mousewheel direction (-1: up, +1: down).
#

proc ttk::bindMouseWheel {bindtag callback} {
    switch -- [tk windowingsystem] {
	x11 {
	    bind $bindtag <ButtonPress-4> "$callback -1"
	    bind $bindtag <ButtonPress-5> "$callback +1"
	}
	win32 {
	    bind $bindtag <MouseWheel> [append callback { [expr {-(%D/120)}]}]
	}
	aqua {
	    bind $bindtag <MouseWheel> [append callback { [expr {-(%D)}]} ]
	}
    }
}

## Mousewheel bindings for standard scrollable widgets.
#
# Usage: [ttk::copyBindings TtkScrollable $bindtag]
#
# $bindtag should be for a widget that supports the
# standard scrollbar protocol.
#

switch -- [tk windowingsystem] {
    x11 {
	bind TtkScrollable <ButtonPress-4>       { %W yview scroll -5 units }
	bind TtkScrollable <ButtonPress-5>       { %W yview scroll  5 units }
	bind TtkScrollable <Shift-ButtonPress-4> { %W xview scroll -5 units }
	bind TtkScrollable <Shift-ButtonPress-5> { %W xview scroll  5 units }
    }
    win32 {
	bind TtkScrollable <MouseWheel> \
	    { %W yview scroll [expr {-(%D/120)}] units }
	bind TtkScrollable <Shift-MouseWheel> \
	    { %W xview scroll [expr {-(%D/120)}] units }
    }
    aqua {
	bi