Skip to content

Commit

Permalink
BMenuField: style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jscipione committed Apr 24, 2014
1 parent c884d01 commit 58a3b20
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/kits/interface/BMCPrivate.cpp
Expand Up @@ -262,7 +262,6 @@ _BMCMenuBar_::MinSize()
{
BSize size;
BMenuBar::GetPreferredSize(&size.width, &size.height);

if (fShowPopUpMarker) {
// account for popup indicator + a few pixels margin
size.width += kPopUpIndicatorWidth;
Expand All @@ -279,6 +278,7 @@ _BMCMenuBar_::MaxSize()
// limited.
BSize size;
BMenuBar::GetPreferredSize(&size.width, &size.height);

return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size);
}

Expand Down
20 changes: 17 additions & 3 deletions src/kits/interface/MenuField.cpp
Expand Up @@ -845,6 +845,7 @@ BMenuField::CreateMenuBarLayoutItem()
B_ALIGN_VERTICAL_UNSET));
fLayoutData->menu_bar_layout_item = new MenuBarLayoutItem(this);
}

return fLayoutData->menu_bar_layout_item;
}

Expand All @@ -857,22 +858,27 @@ BMenuField::Perform(perform_code code, void* _data)
((perform_data_min_size*)_data)->return_value
= BMenuField::MinSize();
return B_OK;

case PERFORM_CODE_MAX_SIZE:
((perform_data_max_size*)_data)->return_value
= BMenuField::MaxSize();
return B_OK;

case PERFORM_CODE_PREFERRED_SIZE:
((perform_data_preferred_size*)_data)->return_value
= BMenuField::PreferredSize();
return B_OK;

case PERFORM_CODE_LAYOUT_ALIGNMENT:
((perform_data_layout_alignment*)_data)->return_value
= BMenuField::LayoutAlignment();
return B_OK;

case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH:
((perform_data_has_height_for_width*)_data)->return_value
= BMenuField::HasHeightForWidth();
return B_OK;

case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH:
{
perform_data_get_height_for_width* data
Expand All @@ -881,37 +887,40 @@ BMenuField::Perform(perform_code code, void* _data)
&data->preferred);
return B_OK;
}

case PERFORM_CODE_SET_LAYOUT:
{
perform_data_set_layout* data = (perform_data_set_layout*)_data;
BMenuField::SetLayout(data->layout);
return B_OK;
}

case PERFORM_CODE_LAYOUT_INVALIDATED:
{
perform_data_layout_invalidated* data
= (perform_data_layout_invalidated*)_data;
BMenuField::LayoutInvalidated(data->descendants);
return B_OK;
}

case PERFORM_CODE_DO_LAYOUT:
{
BMenuField::DoLayout();
return B_OK;
}

case PERFORM_CODE_ALL_UNARCHIVED:
{
perform_data_all_unarchived* data
= (perform_data_all_unarchived*)_data;

data->return_value = BMenuField::AllUnarchived(data->archive);
return B_OK;
}

case PERFORM_CODE_ALL_ARCHIVED:
{
perform_data_all_archived* data
= (perform_data_all_archived*)_data;

data->return_value = BMenuField::AllArchived(data->archive);
return B_OK;
}
Expand Down Expand Up @@ -952,6 +961,7 @@ BMenuField::DoLayout()
BSize size(Bounds().Size());
if (size.width < fLayoutData->min.width)
size.width = fLayoutData->min.width;

if (size.height < fLayoutData->min.height)
size.height = fLayoutData->min.height;

Expand Down Expand Up @@ -1104,6 +1114,7 @@ BMenuField::_DrawMenuBar(BRect updateRect)
uint32 flags = 0;
if (!IsEnabled())
flags |= BControlLook::B_DISABLED;

if (IsFocus() && Window()->IsActive())
flags |= BControlLook::B_FOCUSED;

Expand Down Expand Up @@ -1307,6 +1318,7 @@ BMenuField::_ValidateLayoutData()

if (divider > 0)
min.width += divider;

if (fLayoutData->label_height > min.height)
min.height = fLayoutData->label_height;

Expand Down Expand Up @@ -1415,7 +1427,7 @@ BMenuField::LabelLayoutItem::BaseMinSize()
{
fParent->_ValidateLayoutData();

if (!fParent->Label())
if (fParent->Label() == NULL)
return BSize(-1, -1);

return BSize(fParent->fLayoutData->label_width + 5,
Expand Down Expand Up @@ -1462,6 +1474,7 @@ BMenuField::LabelLayoutItem::Instantiate(BMessage* from)
{
if (validate_instantiation(from, "BMenuField::LabelLayoutItem"))
return new LabelLayoutItem(from);

return NULL;
}

Expand Down Expand Up @@ -1551,6 +1564,7 @@ BMenuField::MenuBarLayoutItem::BaseMaxSize()
{
BSize size(BaseMinSize());
size.width = B_SIZE_UNLIMITED;

return size;
}

Expand Down

0 comments on commit 58a3b20

Please sign in to comment.