Create a SetMaxItemWidth() method and set it in horizontal mode on update
This commit is contained in:
@@ -509,6 +509,11 @@ TBarView::PlaceApplicationBar()
|
|||||||
fExpandoMenuBar->MoveTo(0, 0);
|
fExpandoMenuBar->MoveTo(0, 0);
|
||||||
fExpandoMenuBar->ResizeTo(expandoFrame.Width(), expandoFrame.Height());
|
fExpandoMenuBar->ResizeTo(expandoFrame.Width(), expandoFrame.Height());
|
||||||
|
|
||||||
|
if (!fVertical) {
|
||||||
|
// Set the max item width based on icon size
|
||||||
|
fExpandoMenuBar->SetMaxItemWidth();
|
||||||
|
}
|
||||||
|
|
||||||
fExpandoMenuBar->BuildItems();
|
fExpandoMenuBar->BuildItems();
|
||||||
if (fVertical)
|
if (fVertical)
|
||||||
ExpandItems();
|
ExpandItems();
|
||||||
|
|||||||
@@ -94,15 +94,7 @@ TExpandoMenuBar::TExpandoMenuBar(BRect frame, const char* name,
|
|||||||
{
|
{
|
||||||
SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
|
SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
SetFont(be_plain_font);
|
SetFont(be_plain_font);
|
||||||
if (fVertical)
|
SetMaxItemWidth();
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// top or bottom mode, add deskbar menu and sep for menubar tracking
|
// top or bottom mode, add deskbar menu and sep for menubar tracking
|
||||||
// consistency
|
// 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
|
void
|
||||||
TExpandoMenuBar::SizeWindow(int32 delta)
|
TExpandoMenuBar::SizeWindow(int32 delta)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ public:
|
|||||||
|
|
||||||
menu_layout MenuLayout() const;
|
menu_layout MenuLayout() const;
|
||||||
|
|
||||||
|
void SetMaxItemWidth();
|
||||||
|
|
||||||
void SizeWindow(int32 delta);
|
void SizeWindow(int32 delta);
|
||||||
bool CheckForSizeOverrun();
|
bool CheckForSizeOverrun();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user