STR #973: popup menus now pop up fully visible in the current screen if possible and useful. In detail, menus in a menubar will pop up above the title if they would cut into the screen bottom. Submenus will show the *last* item to the right of the parent instead of the first. Finally, Pulldowns with title will simply apppera over the title instead of under the title.

There are two exceptions:

Menus that have a selected item will not be modified, so the selected item is visible. Hence an Fl_Choice will never have a 'fixed' menu.

If putting the menu high would intersect the top frame of the screen, we leave the menu at the bottom.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4584 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2005-09-25 19:04:04 +00:00
parent ba56eeaad5
commit 60812b2ecc
2 changed files with 18 additions and 1 deletions

View File

@ -3,6 +3,7 @@ CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #571, STR #648, STR #692, STR
#730, STR #744, STR #745, STR #931, STR #942, STR #960,
STR #969)
- Menus now pop up fully inside the screen if possible (STR #973)
- Fixed illegal acces in Preferenes (STR #1025)
- Fixed x-offset problem in Help_Widget (STR #998)
- Clipboard will persist if owner window is hidden (STR #1019)

View File

@ -306,8 +306,24 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
h((numitems ? itemheight*numitems-LEADING : 0)+2*BW+3);
if (selected >= 0)
Y = Y+(Hp-itemheight)/2-selected*itemheight-BW;
else
else {
Y = Y+Hp;
// if the menu hits the bottom of the screen, we try to draw
// it above the menubar instead. We will not adjust any menu
// that has a selected item.
if (Y+h()>scr_y+scr_h && Y-h()>=scr_y) {
if (Hp>1)
// if we know the height of the Fl_Menu_, use it
Y = Y-Hp-h();
else if (t)
// assume that the menubar item height relates to the first
// menuitem as well
Y = Y-itemheight-h()-Fl::box_dh(box());
else
// draw the menu to the right
Y = Y-h()+itemheight+Fl::box_dy(box());
}
}
if (m) y(Y); else {y(Y-2); w(1); h(1);}
if (t) {