Create a SetMaxItemWidth() method and set it in horizontal mode on update
This commit is contained in:
parent
03f7c11ece
commit
e83b2f0b9c
@ -509,6 +509,11 @@ TBarView::PlaceApplicationBar()
|
||||
fExpandoMenuBar->MoveTo(0, 0);
|
||||
fExpandoMenuBar->ResizeTo(expandoFrame.Width(), expandoFrame.Height());
|
||||
|
||||
if (!fVertical) {
|
||||
// Set the max item width based on icon size
|
||||
fExpandoMenuBar->SetMaxItemWidth();
|
||||
}
|
||||
|
||||
fExpandoMenuBar->BuildItems();
|
||||
if (fVertical)
|
||||
ExpandItems();
|
||||
|
@ -94,15 +94,7 @@ TExpandoMenuBar::TExpandoMenuBar(BRect frame, const char* name,
|
||||
{
|
||||
SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
SetFont(be_plain_font);
|
||||
if (fVertical)
|
||||
SetMaxContentWidth(sMinimumWindowWidth);
|
||||
else {
|
||||
// Make more room for the icon in horizontal mode
|
||||
int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize();
|
||||
float maxContentWidth = sMinimumWindowWidth + iconSize
|
||||
- kMinimumIconSize;
|
||||
SetMaxContentWidth(maxContentWidth);
|
||||
}
|
||||
SetMaxItemWidth();
|
||||
|
||||
// top or bottom mode, add deskbar menu and sep for menubar tracking
|
||||
// consistency
|
||||
@ -913,6 +905,20 @@ TExpandoMenuBar::CheckForSizeOverrun()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TExpandoMenuBar::SetMaxItemWidth()
|
||||
{
|
||||
if (fVertical)
|
||||
SetMaxContentWidth(sMinimumWindowWidth);
|
||||
else {
|
||||
// Make more room for the icon in horizontal mode
|
||||
int32 iconSize = static_cast<TBarApp*>(be_app)->IconSize();
|
||||
SetMaxContentWidth(sMinimumWindowWidth + iconSize
|
||||
- kMinimumIconSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TExpandoMenuBar::SizeWindow(int32 delta)
|
||||
{
|
||||
|
@ -87,6 +87,8 @@ public:
|
||||
|
||||
menu_layout MenuLayout() const;
|
||||
|
||||
void SetMaxItemWidth();
|
||||
|
||||
void SizeWindow(int32 delta);
|
||||
bool CheckForSizeOverrun();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user