Added a new method RelayoutIfNeeded(), which does the real Layout invalidation, it's called by menubar and menu. This fixes the menufields not being resized. Note that a problem still remains, will be fixed shortly (hopefully)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17405 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -194,6 +194,7 @@ virtual void _ReservedMenu6();
|
|||||||
int32 count,
|
int32 count,
|
||||||
BMenuItem *item,
|
BMenuItem *item,
|
||||||
bool del = false);
|
bool del = false);
|
||||||
|
bool RelayoutIfNeeded();
|
||||||
void LayoutItems(int32 index);
|
void LayoutItems(int32 index);
|
||||||
void ComputeLayout(int32 index, bool bestFit, bool moveItems,
|
void ComputeLayout(int32 index, bool bestFit, bool moveItems,
|
||||||
float* width, float* height);
|
float* width, float* height);
|
||||||
|
|||||||
@@ -744,10 +744,7 @@ BMenu::KeyDown(const char *bytes, int32 numBytes)
|
|||||||
void
|
void
|
||||||
BMenu::Draw(BRect updateRect)
|
BMenu::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
if (!fUseCachedMenuLayout) {
|
if (RelayoutIfNeeded()) {
|
||||||
fUseCachedMenuLayout = true;
|
|
||||||
CacheFontInfo();
|
|
||||||
LayoutItems(0);
|
|
||||||
Invalidate();
|
Invalidate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1374,6 +1371,19 @@ BMenu::RemoveItems(int32 index, int32 count, BMenuItem *item, bool deleteItems)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BMenu::RelayoutIfNeeded()
|
||||||
|
{
|
||||||
|
if (!fUseCachedMenuLayout) {
|
||||||
|
fUseCachedMenuLayout = true;
|
||||||
|
CacheFontInfo();
|
||||||
|
LayoutItems(0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BMenu::LayoutItems(int32 index)
|
BMenu::LayoutItems(int32 index)
|
||||||
{
|
{
|
||||||
@@ -1725,10 +1735,12 @@ BMenu::ItemMarked(BMenuItem *item)
|
|||||||
{
|
{
|
||||||
if (IsRadioMode()) {
|
if (IsRadioMode()) {
|
||||||
for (int32 i = 0; i < CountItems(); i++)
|
for (int32 i = 0; i < CountItems(); i++)
|
||||||
if (ItemAt(i) != item)
|
if (ItemAt(i) != item)
|
||||||
ItemAt(i)->SetMarked(false);
|
ItemAt(i)->SetMarked(false);
|
||||||
|
InvalidateLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (IsLabelFromMarked() && Superitem())
|
if (IsLabelFromMarked() && Superitem())
|
||||||
Superitem()->SetLabel(item->Label());
|
Superitem()->SetLabel(item->Label());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,6 +119,11 @@ BMenuBar::Border() const
|
|||||||
void
|
void
|
||||||
BMenuBar::Draw(BRect updateRect)
|
BMenuBar::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
|
if (RelayoutIfNeeded()) {
|
||||||
|
Invalidate();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: implement additional border styles
|
// TODO: implement additional border styles
|
||||||
rgb_color color = HighColor();
|
rgb_color color = HighColor();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user