BMenuItem: Style fixes

* explict NULL check
* explicit boolean comparison and pointer style fixes
This commit is contained in:
John Scipione
2016-08-09 16:08:59 -07:00
parent b0a7a75ab1
commit bd4ea6563f
+5 -5
View File
@@ -285,7 +285,7 @@ BMenuItem::SetShortcut(char shortcut, uint32 modifiers)
if (fShortcutChar != 0 && (fModifiers & B_COMMAND_KEY) && fWindow)
fWindow->AddShortcut(fShortcutChar, fModifiers, this);
if (fSuper) {
if (fSuper != NULL) {
fSuper->InvalidateLayout();
if (fSuper->LockLooper()) {
@@ -740,28 +740,28 @@ BMenuItem::_DrawShortcutSymbol()
// TODO: It would be nice to draw these taking into account the text (low)
// color.
if (fModifiers & B_COMMAND_KEY) {
if ((fModifiers & B_COMMAND_KEY) != 0) {
const BBitmap* command = MenuPrivate::MenuItemCommand();
const BRect &rect = command->Bounds();
where.x -= rect.Width() + 1;
fSuper->DrawBitmap(command, where);
}
if (fModifiers & B_CONTROL_KEY) {
if ((fModifiers & B_CONTROL_KEY) != 0) {
const BBitmap* control = MenuPrivate::MenuItemControl();
const BRect &rect = control->Bounds();
where.x -= rect.Width() + 1;
fSuper->DrawBitmap(control, where);
}
if (fModifiers & B_OPTION_KEY) {
if ((fModifiers & B_OPTION_KEY) != 0) {
const BBitmap* option = MenuPrivate::MenuItemOption();
const BRect &rect = option->Bounds();
where.x -= rect.Width() + 1;
fSuper->DrawBitmap(option, where);
}
if (fModifiers & B_SHIFT_KEY) {
if ((fModifiers & B_SHIFT_KEY) != 0) {
const BBitmap* shift = MenuPrivate::MenuItemShift();
const BRect &rect = shift->Bounds();
where.x -= rect.Width() + 1;