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