Many visual fixes to BMenu. Now it's almost undistinguable from the real thing. SeparatorItems were being drawn too dark. Fixed.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10585 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1004,7 +1004,7 @@ BMenu::_show(bool selectFirstItem)
|
|||||||
fCachedMenuWindow = new BMenuWindow(Name());
|
fCachedMenuWindow = new BMenuWindow(Name());
|
||||||
|
|
||||||
fCachedMenuWindow->ChildAt(0)->AddChild(this);
|
fCachedMenuWindow->ChildAt(0)->AddChild(this);
|
||||||
fCachedMenuWindow->ResizeTo(Bounds().Width() + 3, Bounds().Height() + 3);
|
fCachedMenuWindow->ResizeTo(Bounds().Width() + 4, Bounds().Height() + 4);
|
||||||
fCachedMenuWindow->MoveTo(ScreenLocation());
|
fCachedMenuWindow->MoveTo(ScreenLocation());
|
||||||
fCachedMenuWindow->Show();
|
fCachedMenuWindow->Show();
|
||||||
|
|
||||||
@@ -1181,11 +1181,11 @@ BMenu::ComputeLayout(int32 index, bool bestFit, bool moveItems,
|
|||||||
if (item->fModifiers && item->fShortcutChar)
|
if (item->fModifiers && item->fShortcutChar)
|
||||||
iWidth += 25.0f;
|
iWidth += 25.0f;
|
||||||
|
|
||||||
item->fBounds.left = 2.0f;
|
item->fBounds.left = 0.0f;
|
||||||
item->fBounds.top = frame.bottom;
|
item->fBounds.top = frame.bottom;
|
||||||
item->fBounds.bottom = item->fBounds.top + iHeight + fPad.top + fPad.bottom;
|
item->fBounds.bottom = item->fBounds.top + iHeight + fPad.top + fPad.bottom;
|
||||||
|
|
||||||
frame.right = max_c(frame.right, iWidth + fPad.left + fPad.right);
|
frame.right = max_c(frame.right, iWidth + fPad.left + fPad.right) + 20;
|
||||||
frame.bottom = item->fBounds.bottom + 1.0f;
|
frame.bottom = item->fBounds.bottom + 1.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1193,8 +1193,8 @@ BMenu::ComputeLayout(int32 index, bool bestFit, bool moveItems,
|
|||||||
for (int32 i = 0; i < fItems.CountItems(); i++)
|
for (int32 i = 0; i < fItems.CountItems(); i++)
|
||||||
ItemAt(i)->fBounds.right = frame.right;
|
ItemAt(i)->fBounds.right = frame.right;
|
||||||
|
|
||||||
frame.right = (float)ceil(frame.right) + 2.0f;
|
frame.right = (float)ceil(frame.right);
|
||||||
frame.bottom += 1.0f;
|
frame.bottom--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1244,11 +1244,12 @@ BMenu::ComputeLayout(int32 index, bool bestFit, bool moveItems,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is for BMenuBar.
|
||||||
if ((ResizingMode() & B_FOLLOW_LEFT_RIGHT) == B_FOLLOW_LEFT_RIGHT) {
|
if ((ResizingMode() & B_FOLLOW_LEFT_RIGHT) == B_FOLLOW_LEFT_RIGHT) {
|
||||||
if (Parent())
|
if (Parent())
|
||||||
*width = Parent()->Frame().Width();
|
*width = Parent()->Frame().Width() + 1;
|
||||||
else
|
else
|
||||||
*width = Window()->Frame().Width();
|
*width = Window()->Frame().Width() + 1;
|
||||||
|
|
||||||
*height = frame.Height();
|
*height = frame.Height();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -26,8 +26,6 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// TODO: Add scrollers
|
// TODO: Add scrollers
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <MenuWindow.h>
|
#include <MenuWindow.h>
|
||||||
|
|
||||||
@@ -35,10 +33,11 @@
|
|||||||
// this should go to some private header.
|
// this should go to some private header.
|
||||||
const window_feel kMenuWindowFeel = (window_feel)1025;
|
const window_feel kMenuWindowFeel = (window_feel)1025;
|
||||||
|
|
||||||
|
// This draws the frame around the BMenu
|
||||||
class BMenuFrame : public BView {
|
class BMenuFrame : public BView {
|
||||||
public:
|
public:
|
||||||
BMenuFrame() :
|
BMenuFrame() :
|
||||||
BView(BRect(0, 0, 0, 0), "menu frame", B_FOLLOW_ALL_SIDES, B_WILL_DRAW)
|
BView(BRect(0, 0, 1, 1), "menu frame", B_FOLLOW_ALL_SIDES, B_WILL_DRAW)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -57,9 +56,12 @@ public:
|
|||||||
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT));
|
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT));
|
||||||
StrokeLine(BPoint(bounds.left + 2, bounds.bottom - 1),
|
StrokeLine(BPoint(bounds.left + 2, bounds.bottom - 1),
|
||||||
BPoint(bounds.right - 1, bounds.bottom - 1));
|
BPoint(bounds.right - 1, bounds.bottom - 1));
|
||||||
|
StrokeLine(BPoint(bounds.right - 1, bounds.top + 1),
|
||||||
|
BPoint(bounds.right - 1, bounds.bottom - 1));
|
||||||
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_LIGHTEN_2_TINT));
|
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_LIGHTEN_2_TINT));
|
||||||
StrokeLine(BPoint(bounds.left + 1, bounds.top + 1),
|
StrokeLine(BPoint(bounds.left + 1, bounds.top + 1),
|
||||||
BPoint(bounds.right - 2, bounds.top + 1));
|
BPoint(bounds.right - 2, bounds.top + 1));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ BSeparatorItem::Draw()
|
|||||||
case 0:
|
case 0:
|
||||||
// TODO: Check if drawing is pixel perfect
|
// TODO: Check if drawing is pixel perfect
|
||||||
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
|
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
|
||||||
B_DARKEN_2_TINT));
|
B_DARKEN_1_TINT));
|
||||||
menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 4.0f),
|
menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 4.0f),
|
||||||
BPoint(bounds.right - 1.0f, bounds.top + 4.0f));
|
BPoint(bounds.right - 1.0f, bounds.top + 4.0f));
|
||||||
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
|
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
|
||||||
@@ -108,7 +108,7 @@ BSeparatorItem::Draw()
|
|||||||
case 1:
|
case 1:
|
||||||
// TODO: Check if drawing is pixel perfect
|
// TODO: Check if drawing is pixel perfect
|
||||||
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
|
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
|
||||||
B_DARKEN_2_TINT));
|
B_DARKEN_1_TINT));
|
||||||
menu->StrokeLine(BPoint(bounds.left + 9.0f, bounds.top + 4.0f),
|
menu->StrokeLine(BPoint(bounds.left + 9.0f, bounds.top + 4.0f),
|
||||||
BPoint(bounds.right - 9.0f, bounds.top + 4.0f));
|
BPoint(bounds.right - 9.0f, bounds.top + 4.0f));
|
||||||
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
|
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
|
||||||
@@ -120,7 +120,7 @@ BSeparatorItem::Draw()
|
|||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
|
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR),
|
||||||
B_DARKEN_2_TINT));
|
B_DARKEN_1_TINT));
|
||||||
menu->StrokeLine(BPoint(bounds.left + 9.0f, bounds.top + 4.0f),
|
menu->StrokeLine(BPoint(bounds.left + 9.0f, bounds.top + 4.0f),
|
||||||
BPoint(bounds.right - 9.0f, bounds.top + 4.0f));
|
BPoint(bounds.right - 9.0f, bounds.top + 4.0f));
|
||||||
menu->StrokeLine(BPoint(bounds.left + 10.0f, bounds.top + 5.0f),
|
menu->StrokeLine(BPoint(bounds.left + 10.0f, bounds.top + 5.0f),
|
||||||
|
|||||||
Reference in New Issue
Block a user