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
+9 -9
View File
@@ -285,7 +285,7 @@ BMenuItem::SetShortcut(char shortcut, uint32 modifiers)
if (fShortcutChar != 0 && (fModifiers & B_COMMAND_KEY) && fWindow) if (fShortcutChar != 0 && (fModifiers & B_COMMAND_KEY) && fWindow)
fWindow->AddShortcut(fShortcutChar, fModifiers, this); fWindow->AddShortcut(fShortcutChar, fModifiers, this);
if (fSuper) { if (fSuper != NULL) {
fSuper->InvalidateLayout(); fSuper->InvalidateLayout();
if (fSuper->LockLooper()) { if (fSuper->LockLooper()) {
@@ -740,29 +740,29 @@ BMenuItem::_DrawShortcutSymbol()
// TODO: It would be nice to draw these taking into account the text (low) // TODO: It would be nice to draw these taking into account the text (low)
// color. // color.
if (fModifiers & B_COMMAND_KEY) { if ((fModifiers & B_COMMAND_KEY) != 0) {
const BBitmap *command = MenuPrivate::MenuItemCommand(); const BBitmap* command = MenuPrivate::MenuItemCommand();
const BRect &rect = command->Bounds(); const BRect &rect = command->Bounds();
where.x -= rect.Width() + 1; where.x -= rect.Width() + 1;
fSuper->DrawBitmap(command, where); fSuper->DrawBitmap(command, where);
} }
if (fModifiers & B_CONTROL_KEY) { if ((fModifiers & B_CONTROL_KEY) != 0) {
const BBitmap *control = MenuPrivate::MenuItemControl(); const BBitmap* control = MenuPrivate::MenuItemControl();
const BRect &rect = control->Bounds(); const BRect &rect = control->Bounds();
where.x -= rect.Width() + 1; where.x -= rect.Width() + 1;
fSuper->DrawBitmap(control, where); fSuper->DrawBitmap(control, where);
} }
if (fModifiers & B_OPTION_KEY) { if ((fModifiers & B_OPTION_KEY) != 0) {
const BBitmap *option = MenuPrivate::MenuItemOption(); const BBitmap* option = MenuPrivate::MenuItemOption();
const BRect &rect = option->Bounds(); const BRect &rect = option->Bounds();
where.x -= rect.Width() + 1; where.x -= rect.Width() + 1;
fSuper->DrawBitmap(option, where); fSuper->DrawBitmap(option, where);
} }
if (fModifiers & B_SHIFT_KEY) { if ((fModifiers & B_SHIFT_KEY) != 0) {
const BBitmap *shift = MenuPrivate::MenuItemShift(); const BBitmap* shift = MenuPrivate::MenuItemShift();
const BRect &rect = shift->Bounds(); const BRect &rect = shift->Bounds();
where.x -= rect.Width() + 1; where.x -= rect.Width() + 1;
fSuper->DrawBitmap(shift, where); fSuper->DrawBitmap(shift, where);