Use a static_cast when removing menu item from BarMenuBar

... instead of a C-style cast. Also some minor style fixes.

Might fix #9151 although since I can't reproduce the bug here I have
no way of knowing.
This commit is contained in:
John Scipione
2012-11-14 14:00:25 -05:00
parent 963d68a632
commit cb7c5f05bb
+10 -8
View File
@@ -109,11 +109,12 @@ TBarMenuBar::AddTeamMenu()
return;
BRect frame(Frame());
delete fAppListMenuItem;
delete fAppListMenuItem;
fAppListMenuItem = new TBarMenuTitle(0.0f, 0.0f,
AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_TeamIcon), new TTeamMenu());
AddItem(fAppListMenuItem);
SmartResize(frame.Width() - 1.0f, frame.Height());
}
@@ -124,13 +125,13 @@ TBarMenuBar::RemoveTeamMenu()
if (CountItems() < 2)
return;
if (fAppListMenuItem) {
RemoveItem((BMenuItem*)fAppListMenuItem);
if (fAppListMenuItem != NULL) {
RemoveItem(static_cast<BMenuItem*>(fAppListMenuItem));
delete fAppListMenuItem;
fAppListMenuItem = NULL;
}
BRect frame = Frame();
BRect frame(Frame());
SmartResize(frame.Width(), frame.Height());
}
@@ -142,12 +143,13 @@ TBarMenuBar::AddSeperatorItem()
return;
BRect frame(Frame());
delete fSeparatorItem;
delete fSeparatorItem;
fSeparatorItem = new TTeamMenuItem(kSepItemWidth,
frame.Height() - 2, false);
AddItem(fSeparatorItem);
fSeparatorItem->SetEnabled(false);
SmartResize(frame.Width() - 1.0f, frame.Height());
}
@@ -158,13 +160,13 @@ TBarMenuBar::RemoveSeperatorItem()
if (CountItems() < 2)
return;
if (fSeparatorItem) {
RemoveItem((BMenuItem*)fSeparatorItem);
if (fSeparatorItem != NULL) {
RemoveItem(static_cast<BMenuItem*>(fSeparatorItem));
delete fSeparatorItem;
fSeparatorItem = NULL;
}
BRect frame = Frame();
BRect frame(Frame());
SmartResize(frame.Width(), frame.Height());
}