Refactor BMenuField::DrawLabel()
also use std::max() instead of max_c()
This commit is contained in:
parent
2bf1592a70
commit
4e1b19207a
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <MenuField.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -987,7 +988,10 @@ BMenuField::DrawLabel(BRect bounds, BRect updateRect)
|
|||
_ValidateLayoutData();
|
||||
font_height& fh = fLayoutData->font_info;
|
||||
|
||||
if (Label()) {
|
||||
const char* label = Label();
|
||||
if (label == NULL)
|
||||
return;
|
||||
|
||||
SetLowColor(ViewColor());
|
||||
|
||||
// horizontal alignment
|
||||
|
@ -1014,8 +1018,7 @@ BMenuField::DrawLabel(BRect bounds, BRect updateRect)
|
|||
|
||||
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||
IsEnabled() ? B_DARKEN_MAX_TINT : B_DISABLED_LABEL_TINT));
|
||||
DrawString(Label(), BPoint(x, y));
|
||||
}
|
||||
DrawString(label, BPoint(x, y));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1228,7 +1231,7 @@ BMenuField::_ValidateLayoutData()
|
|||
float
|
||||
BMenuField::_MenuBarOffset() const
|
||||
{
|
||||
return max_c(kVMargin, fDivider + kVMargin);
|
||||
return std::max(fDivider + kVMargin, kVMargin);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue