* IconMenuItem now falls back to the icon of the super type, if a MIME type
didn't have one. * Whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27144 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
206c62f036
commit
d125d984a6
@ -142,10 +142,10 @@ void
|
|||||||
ModelMenuItem::DrawIcon()
|
ModelMenuItem::DrawIcon()
|
||||||
{
|
{
|
||||||
Menu()->PushState();
|
Menu()->PushState();
|
||||||
|
|
||||||
BPoint where(ContentLocation());
|
BPoint where(ContentLocation());
|
||||||
// center icon with text.
|
// center icon with text.
|
||||||
|
|
||||||
float deltaHeight = fHeightDelta < 0 ? -fHeightDelta : 0;
|
float deltaHeight = fHeightDelta < 0 ? -fHeightDelta : 0;
|
||||||
where.y += ceil(deltaHeight / 2);
|
where.y += ceil(deltaHeight / 2);
|
||||||
|
|
||||||
@ -181,12 +181,12 @@ ModelMenuItem::GetContentSize(float *width, float *height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ModelMenuItem::Invoke(BMessage *message)
|
ModelMenuItem::Invoke(BMessage *message)
|
||||||
{
|
{
|
||||||
if (!Menu())
|
if (!Menu())
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
if (!IsEnabled())
|
if (!IsEnabled())
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ SpecialModelMenuItem::SpecialModelMenuItem(const Model *model, BMenu *menu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SpecialModelMenuItem::DrawContent()
|
SpecialModelMenuItem::DrawContent()
|
||||||
{
|
{
|
||||||
Menu()->PushState();
|
Menu()->PushState();
|
||||||
@ -289,7 +289,7 @@ IconMenuItem::IconMenuItem(const char *label, BMessage *message,
|
|||||||
fDeviceIcon(NULL),
|
fDeviceIcon(NULL),
|
||||||
fHeightDelta(0)
|
fHeightDelta(0)
|
||||||
{
|
{
|
||||||
BMimeType mime(iconType);
|
BMimeType mime(iconType);
|
||||||
#ifdef __HAIKU__
|
#ifdef __HAIKU__
|
||||||
fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_RGBA32);
|
fDeviceIcon = new BBitmap(BRect(0, 0, which - 1, which - 1), B_RGBA32);
|
||||||
#else
|
#else
|
||||||
@ -297,8 +297,12 @@ IconMenuItem::IconMenuItem(const char *label, BMessage *message,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mime.GetIcon(fDeviceIcon, which) != B_OK) {
|
if (mime.GetIcon(fDeviceIcon, which) != B_OK) {
|
||||||
delete fDeviceIcon;
|
BMimeType super;
|
||||||
fDeviceIcon = NULL;
|
mime.GetSupertype(&super);
|
||||||
|
if (super.GetIcon(fDeviceIcon, which) != B_OK) {
|
||||||
|
delete fDeviceIcon;
|
||||||
|
fDeviceIcon = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IconMenuItem is used in synchronously invoked menus, make sure
|
// IconMenuItem is used in synchronously invoked menus, make sure
|
||||||
@ -321,8 +325,12 @@ IconMenuItem::IconMenuItem(BMenu *submenu, BMessage *message,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mime.GetIcon(fDeviceIcon, which) != B_OK) {
|
if (mime.GetIcon(fDeviceIcon, which) != B_OK) {
|
||||||
delete fDeviceIcon;
|
BMimeType super;
|
||||||
fDeviceIcon = NULL;
|
mime.GetSupertype(&super);
|
||||||
|
if (super.GetIcon(fDeviceIcon, which) != B_OK) {
|
||||||
|
delete fDeviceIcon;
|
||||||
|
fDeviceIcon = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// IconMenuItem is used in synchronously invoked menus, make sure
|
// IconMenuItem is used in synchronously invoked menus, make sure
|
||||||
@ -374,12 +382,12 @@ IconMenuItem::DrawContent()
|
|||||||
Menu()->SetDrawingMode(B_OP_ALPHA);
|
Menu()->SetDrawingMode(B_OP_ALPHA);
|
||||||
Menu()->SetHighColor(0, 0, 0, 64);
|
Menu()->SetHighColor(0, 0, 0, 64);
|
||||||
Menu()->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY);
|
Menu()->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Menu()->SetDrawingMode(B_OP_OVER);
|
Menu()->SetDrawingMode(B_OP_OVER);
|
||||||
else
|
else
|
||||||
Menu()->SetDrawingMode(B_OP_BLEND);
|
Menu()->SetDrawingMode(B_OP_BLEND);
|
||||||
#endif
|
#endif
|
||||||
Menu()->DrawBitmapAsync(fDeviceIcon, where);
|
Menu()->DrawBitmapAsync(fDeviceIcon, where);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user