summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2004-02-04 00:25:13 (GMT)
committerhobbs <hobbs>2004-02-04 00:25:13 (GMT)
commitfce8017005bddb2d73de1dfbbd04832aee6b9f79 (patch)
tree91021c52219ef6493caa59f9d1cbfdec3183600d
parent71039329de42d6a7cb67e58f6d440a4aab1e24b0 (diff)
downloadtk-fce8017005bddb2d73de1dfbbd04832aee6b9f79.zip
tk-fce8017005bddb2d73de1dfbbd04832aee6b9f79.tar.gz
tk-fce8017005bddb2d73de1dfbbd04832aee6b9f79.tar.bz2
* doc/menubutton.n:
* library/menu.tcl (::tk::MbPost): make menubuttons that post above or below reverse direction when not enough space is available.
-rw-r--r--ChangeLog24
-rw-r--r--doc/menubutton.n6
-rw-r--r--library/menu.tcl13
3 files changed, 29 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 24db4f5..54c883c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-02-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/menubutton.n:
+ * library/menu.tcl (::tk::MbPost): make menubuttons that post
+ above or below reverse direction when not enough space is available.
+
2004-02-01 David Gravereaux <davygrvy@pobox.com>
* win/lamp.bmp (deleted): using win/rc/lamp.bmp instead.
@@ -18,14 +24,14 @@
2004-01-27 Daniel Steffen <das@users.sourceforge.net>
- * generic/tkTextIndex.c: added '#include <tclInt.h>' since the
- code uses the TclUtfToUniChar macro from that file. [Bug 874745]
+ * generic/tkTextIndex.c: added '#include <tclInt.h>' since the
+ code uses the TclUtfToUniChar macro from that file. [Bug 874745]
- * macosx/Wish.pbproj/project.pbxproj: removed erroneous reference
- to mkpsenc.tcl in bundle resources phase (mkpsenc.tcl is already
- part of the copy files phase to Resources/Scripts).
+ * macosx/Wish.pbproj/project.pbxproj: removed erroneous reference
+ to mkpsenc.tcl in bundle resources phase (mkpsenc.tcl is already
+ part of the copy files phase to Resources/Scripts).
- * macosx/Makefile: added support for 'xcodebuild' on Mac OS X 10.3.
+ * macosx/Makefile: added support for 'xcodebuild' on Mac OS X 10.3.
2004-01-25 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
@@ -174,9 +180,9 @@
2003-12-31 Daniel Steffen <das@users.sourceforge.net>
- * macosx/Wish.pbproj/project.pbxproj: added missing private headers
- to installed Tk.framework, so that tkInt.h can be included
- sucessfully from Tk.framework/PrivateHeaders.
+ * macosx/Wish.pbproj/project.pbxproj: added missing private headers
+ to installed Tk.framework, so that tkInt.h can be included
+ sucessfully from Tk.framework/PrivateHeaders.
* generic/tkPort.h: corrected include of tkMacOSXPort.h
2003-12-28 Mo DeJong <mdejong@users.sourceforge.net>
diff --git a/doc/menubutton.n b/doc/menubutton.n
index 64cb5d7..8ae4fcf 100644
--- a/doc/menubutton.n
+++ b/doc/menubutton.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: menubutton.n,v 1.4 2001/05/21 14:07:32 tmh Exp $
+'\" RCS: @(#) $Id: menubutton.n,v 1.5 2004/02/04 00:25:13 hobbs Exp $
'\"
.so man.macros
.TH menubutton n 4.0 Tk "Tk Built-In Commands"
@@ -34,14 +34,14 @@ Valid values for this option are \fBbottom\fR, \fBcenter\fR,
is \fBnone\fR, meaning that the menubutton will display either an image or
text, depending on the values of the \fB\-image\fR and \fB\-bitmap\fR
options.
-.VS
.OP \-direction direction Height
Specifies where the menu is going to be popup up. \fBabove\fR tries to
pop the menu above the menubutton. \fBbelow\fR tries to pop the menu
below the menubutton. \fBleft\fR tries to pop the menu to the left of
the menubutton. \fBright\fR tries to pop the menu to the right of the
menu button. \fBflush\fR pops the menu directly over the menubutton.
-.VE
+In the case of \fBabove\fR or \fBbelow\fR, the direction will be
+reversed if the menu would show offscreen.
.OP \-height height Height
Specifies a desired height for the menubutton.
If an image or bitmap is being displayed in the menubutton then the value is in
diff --git a/library/menu.tcl b/library/menu.tcl
index c291ce3..41c51fd 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -4,7 +4,7 @@
# It also implements keyboard traversal of menus and implements a few
# other utility procedures related to menus.
#
-# RCS: @(#) $Id: menu.tcl,v 1.19 2003/06/26 17:15:48 vincentdarley Exp $
+# RCS: @(#) $Id: menu.tcl,v 1.20 2004/02/04 00:25:13 hobbs Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -280,11 +280,20 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
above {
set x [winfo rootx $w]
set y [expr {[winfo rooty $w] - [winfo reqheight $menu]}]
+ # if we go offscreen to the top, show as 'below'
+ if {$y < 0} {
+ set y [expr {[winfo rooty $w] + [winfo height $w]}]
+ }
PostOverPoint $menu $x $y
}
below {
set x [winfo rootx $w]
set y [expr {[winfo rooty $w] + [winfo height $w]}]
+ # if we go offscreen to the bottom, show as 'above'
+ set mh [winfo reqheight $menu]
+ if {($y + $mh) > [winfo screenheight $w]} {
+ set y [expr {[winfo rooty $w] - $mh}]
+ }
PostOverPoint $menu $x $y
}
left {
@@ -336,7 +345,7 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
PostOverPoint $menu $x $y [MenuFindName $menu [$w cget -text]]
} else {
PostOverPoint $menu [winfo rootx $w] [expr {[winfo rooty $w]+[winfo height $w]}]
- }
+ }
}
}
} msg]} {