BMenuField: style fixes
This commit is contained in:
@@ -262,7 +262,6 @@ _BMCMenuBar_::MinSize()
|
|||||||
{
|
{
|
||||||
BSize size;
|
BSize size;
|
||||||
BMenuBar::GetPreferredSize(&size.width, &size.height);
|
BMenuBar::GetPreferredSize(&size.width, &size.height);
|
||||||
|
|
||||||
if (fShowPopUpMarker) {
|
if (fShowPopUpMarker) {
|
||||||
// account for popup indicator + a few pixels margin
|
// account for popup indicator + a few pixels margin
|
||||||
size.width += kPopUpIndicatorWidth;
|
size.width += kPopUpIndicatorWidth;
|
||||||
@@ -279,6 +278,7 @@ _BMCMenuBar_::MaxSize()
|
|||||||
// limited.
|
// limited.
|
||||||
BSize size;
|
BSize size;
|
||||||
BMenuBar::GetPreferredSize(&size.width, &size.height);
|
BMenuBar::GetPreferredSize(&size.width, &size.height);
|
||||||
|
|
||||||
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size);
|
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -845,6 +845,7 @@ BMenuField::CreateMenuBarLayoutItem()
|
|||||||
B_ALIGN_VERTICAL_UNSET));
|
B_ALIGN_VERTICAL_UNSET));
|
||||||
fLayoutData->menu_bar_layout_item = new MenuBarLayoutItem(this);
|
fLayoutData->menu_bar_layout_item = new MenuBarLayoutItem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fLayoutData->menu_bar_layout_item;
|
return fLayoutData->menu_bar_layout_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -857,22 +858,27 @@ BMenuField::Perform(perform_code code, void* _data)
|
|||||||
((perform_data_min_size*)_data)->return_value
|
((perform_data_min_size*)_data)->return_value
|
||||||
= BMenuField::MinSize();
|
= BMenuField::MinSize();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
case PERFORM_CODE_MAX_SIZE:
|
case PERFORM_CODE_MAX_SIZE:
|
||||||
((perform_data_max_size*)_data)->return_value
|
((perform_data_max_size*)_data)->return_value
|
||||||
= BMenuField::MaxSize();
|
= BMenuField::MaxSize();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
case PERFORM_CODE_PREFERRED_SIZE:
|
case PERFORM_CODE_PREFERRED_SIZE:
|
||||||
((perform_data_preferred_size*)_data)->return_value
|
((perform_data_preferred_size*)_data)->return_value
|
||||||
= BMenuField::PreferredSize();
|
= BMenuField::PreferredSize();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
case PERFORM_CODE_LAYOUT_ALIGNMENT:
|
case PERFORM_CODE_LAYOUT_ALIGNMENT:
|
||||||
((perform_data_layout_alignment*)_data)->return_value
|
((perform_data_layout_alignment*)_data)->return_value
|
||||||
= BMenuField::LayoutAlignment();
|
= BMenuField::LayoutAlignment();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH:
|
case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH:
|
||||||
((perform_data_has_height_for_width*)_data)->return_value
|
((perform_data_has_height_for_width*)_data)->return_value
|
||||||
= BMenuField::HasHeightForWidth();
|
= BMenuField::HasHeightForWidth();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH:
|
case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH:
|
||||||
{
|
{
|
||||||
perform_data_get_height_for_width* data
|
perform_data_get_height_for_width* data
|
||||||
@@ -881,12 +887,14 @@ BMenuField::Perform(perform_code code, void* _data)
|
|||||||
&data->preferred);
|
&data->preferred);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PERFORM_CODE_SET_LAYOUT:
|
case PERFORM_CODE_SET_LAYOUT:
|
||||||
{
|
{
|
||||||
perform_data_set_layout* data = (perform_data_set_layout*)_data;
|
perform_data_set_layout* data = (perform_data_set_layout*)_data;
|
||||||
BMenuField::SetLayout(data->layout);
|
BMenuField::SetLayout(data->layout);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PERFORM_CODE_LAYOUT_INVALIDATED:
|
case PERFORM_CODE_LAYOUT_INVALIDATED:
|
||||||
{
|
{
|
||||||
perform_data_layout_invalidated* data
|
perform_data_layout_invalidated* data
|
||||||
@@ -894,24 +902,25 @@ BMenuField::Perform(perform_code code, void* _data)
|
|||||||
BMenuField::LayoutInvalidated(data->descendants);
|
BMenuField::LayoutInvalidated(data->descendants);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PERFORM_CODE_DO_LAYOUT:
|
case PERFORM_CODE_DO_LAYOUT:
|
||||||
{
|
{
|
||||||
BMenuField::DoLayout();
|
BMenuField::DoLayout();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PERFORM_CODE_ALL_UNARCHIVED:
|
case PERFORM_CODE_ALL_UNARCHIVED:
|
||||||
{
|
{
|
||||||
perform_data_all_unarchived* data
|
perform_data_all_unarchived* data
|
||||||
= (perform_data_all_unarchived*)_data;
|
= (perform_data_all_unarchived*)_data;
|
||||||
|
|
||||||
data->return_value = BMenuField::AllUnarchived(data->archive);
|
data->return_value = BMenuField::AllUnarchived(data->archive);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PERFORM_CODE_ALL_ARCHIVED:
|
case PERFORM_CODE_ALL_ARCHIVED:
|
||||||
{
|
{
|
||||||
perform_data_all_archived* data
|
perform_data_all_archived* data
|
||||||
= (perform_data_all_archived*)_data;
|
= (perform_data_all_archived*)_data;
|
||||||
|
|
||||||
data->return_value = BMenuField::AllArchived(data->archive);
|
data->return_value = BMenuField::AllArchived(data->archive);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -952,6 +961,7 @@ BMenuField::DoLayout()
|
|||||||
BSize size(Bounds().Size());
|
BSize size(Bounds().Size());
|
||||||
if (size.width < fLayoutData->min.width)
|
if (size.width < fLayoutData->min.width)
|
||||||
size.width = fLayoutData->min.width;
|
size.width = fLayoutData->min.width;
|
||||||
|
|
||||||
if (size.height < fLayoutData->min.height)
|
if (size.height < fLayoutData->min.height)
|
||||||
size.height = fLayoutData->min.height;
|
size.height = fLayoutData->min.height;
|
||||||
|
|
||||||
@@ -1104,6 +1114,7 @@ BMenuField::_DrawMenuBar(BRect updateRect)
|
|||||||
uint32 flags = 0;
|
uint32 flags = 0;
|
||||||
if (!IsEnabled())
|
if (!IsEnabled())
|
||||||
flags |= BControlLook::B_DISABLED;
|
flags |= BControlLook::B_DISABLED;
|
||||||
|
|
||||||
if (IsFocus() && Window()->IsActive())
|
if (IsFocus() && Window()->IsActive())
|
||||||
flags |= BControlLook::B_FOCUSED;
|
flags |= BControlLook::B_FOCUSED;
|
||||||
|
|
||||||
@@ -1307,6 +1318,7 @@ BMenuField::_ValidateLayoutData()
|
|||||||
|
|
||||||
if (divider > 0)
|
if (divider > 0)
|
||||||
min.width += divider;
|
min.width += divider;
|
||||||
|
|
||||||
if (fLayoutData->label_height > min.height)
|
if (fLayoutData->label_height > min.height)
|
||||||
min.height = fLayoutData->label_height;
|
min.height = fLayoutData->label_height;
|
||||||
|
|
||||||
@@ -1415,7 +1427,7 @@ BMenuField::LabelLayoutItem::BaseMinSize()
|
|||||||
{
|
{
|
||||||
fParent->_ValidateLayoutData();
|
fParent->_ValidateLayoutData();
|
||||||
|
|
||||||
if (!fParent->Label())
|
if (fParent->Label() == NULL)
|
||||||
return BSize(-1, -1);
|
return BSize(-1, -1);
|
||||||
|
|
||||||
return BSize(fParent->fLayoutData->label_width + 5,
|
return BSize(fParent->fLayoutData->label_width + 5,
|
||||||
@@ -1462,6 +1474,7 @@ BMenuField::LabelLayoutItem::Instantiate(BMessage* from)
|
|||||||
{
|
{
|
||||||
if (validate_instantiation(from, "BMenuField::LabelLayoutItem"))
|
if (validate_instantiation(from, "BMenuField::LabelLayoutItem"))
|
||||||
return new LabelLayoutItem(from);
|
return new LabelLayoutItem(from);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1551,6 +1564,7 @@ BMenuField::MenuBarLayoutItem::BaseMaxSize()
|
|||||||
{
|
{
|
||||||
BSize size(BaseMinSize());
|
BSize size(BaseMinSize());
|
||||||
size.width = B_SIZE_UNLIMITED;
|
size.width = B_SIZE_UNLIMITED;
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user