[haiku-commits] r33828 - haiku/trunk/src/kits/interface

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 29 Oct 2009 16:11:46 +0100 (CET)

Author: axeld
Date: 2009-10-29 16:11:46 +0100 (Thu, 29 Oct 2009)
New Revision: 33828
Changeset: http://dev.haiku-os.org/changeset/33828/haiku

Modified:
   haiku/trunk/src/kits/interface/Menu.cpp
Log:
* Also resize the window if it wouldn't fit on screen otherwise.
* Fixes bug #3675.
* Minor cleanup.


Modified: haiku/trunk/src/kits/interface/Menu.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Menu.cpp     2009-10-29 13:55:47 UTC (rev 
33827)
+++ haiku/trunk/src/kits/interface/Menu.cpp     2009-10-29 15:11:46 UTC (rev 
33828)
@@ -2247,6 +2247,7 @@
        BMenuItem* superItem = Superitem();
 
        bool scroll = false;
+
        // TODO: Horrible hack:
        // When added to a BMenuField, a BPopUpMenu is the child of
        // a _BMCMenuBar_ to "fake" the menu hierarchy
@@ -2264,10 +2265,8 @@
                else if (frame.left < screenFrame.left)
                        frame.OffsetBy(-frame.left, 0);
        } else if (superMenu->Layout() == B_ITEMS_IN_COLUMN) {
-               if (frame.right > screenFrame.right) {
-                       frame.OffsetBy(-superItem->Frame().Width() - 
frame.Width() - 2,
-                               0);
-               }
+               if (frame.right > screenFrame.right)
+                       frame.OffsetBy(-superItem->Frame().Width() - 
frame.Width() - 2, 0);
 
                if (frame.left < 0)
                        frame.OffsetBy(-frame.left + 6, 0);
@@ -2703,14 +2702,14 @@
 
                        // If we need scrolling, resize the window to fit the 
screen and
                        // attach scrollers to our cached BMenuWindow.
-                       if (dynamic_cast<BMenuBar*>(Supermenu()) == NULL) {
-                               window->ResizeTo(Bounds().Width(), 
screen.Frame().bottom);
+                       if (dynamic_cast<BMenuBar*>(Supermenu()) == NULL || 
frame.top < 0) {
+                               window->ResizeTo(Bounds().Width(), 
screen.Frame().Height());
                                frame.top = 0;
                        } else {
                                // Or, in case our parent was a BMenuBar enable 
scrolling with
                                // normal size.
-                               window->ResizeTo(Bounds().Width(), 
screen.Frame().bottom
-                                       - frame.top);
+                               window->ResizeTo(Bounds().Width(),
+                                       screen.Frame().bottom - frame.top);
                        }
 
                        window->AttachScrollers();


Other related posts:

  • » [haiku-commits] r33828 - haiku/trunk/src/kits/interface - axeld