2006-05-23 20:01:09 +00:00
|
|
|
/*
|
2020-10-10 15:57:49 -04:00
|
|
|
* Copyright 2000, Georges-Edouard Berenger. All rights reserved.
|
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
|
*/
|
2006-05-30 01:32:41 +00:00
|
|
|
|
2006-05-23 20:01:09 +00:00
|
|
|
#include "AutoIcon.h"
|
2006-05-30 01:32:41 +00:00
|
|
|
#include "Utilities.h"
|
2006-05-23 20:01:09 +00:00
|
|
|
|
|
|
|
|
#include <Bitmap.h>
|
|
|
|
|
#include <Entry.h>
|
2011-09-02 06:02:36 +00:00
|
|
|
#include <MimeType.h>
|
2006-05-23 20:01:09 +00:00
|
|
|
#include <NodeInfo.h>
|
|
|
|
|
#include <Roster.h>
|
|
|
|
|
|
2006-05-30 01:32:41 +00:00
|
|
|
|
|
|
|
|
AutoIcon::~AutoIcon()
|
2006-05-23 20:01:09 +00:00
|
|
|
{
|
2006-05-30 01:32:41 +00:00
|
|
|
delete fBitmap;
|
2006-05-23 20:01:09 +00:00
|
|
|
}
|
|
|
|
|
|
2006-05-30 01:32:41 +00:00
|
|
|
|
|
|
|
|
BBitmap*
|
2008-01-13 21:07:14 +00:00
|
|
|
AutoIcon::Bitmap()
|
2006-05-23 20:01:09 +00:00
|
|
|
{
|
2006-05-30 01:32:41 +00:00
|
|
|
if (fBitmap == NULL) {
|
2008-01-13 21:07:14 +00:00
|
|
|
fBitmap = new BBitmap(BRect(0, 0, 15, 15), B_RGBA32);
|
2015-07-23 11:40:31 -04:00
|
|
|
|
2006-05-30 01:32:41 +00:00
|
|
|
if (fSignature) {
|
2006-05-23 20:01:09 +00:00
|
|
|
entry_ref ref;
|
|
|
|
|
be_roster->FindApp (fSignature, &ref);
|
2011-09-02 06:02:36 +00:00
|
|
|
if (BNodeInfo::GetTrackerIcon(&ref, fBitmap, B_MINI_ICON) != B_OK) {
|
|
|
|
|
BMimeType genericAppType(B_APP_MIME_TYPE);
|
|
|
|
|
genericAppType.GetIcon(fBitmap, B_MINI_ICON);
|
|
|
|
|
}
|
2006-05-23 20:01:09 +00:00
|
|
|
}
|
2008-01-13 21:07:14 +00:00
|
|
|
|
2006-05-23 20:01:09 +00:00
|
|
|
if (fbits)
|
2008-01-13 21:07:14 +00:00
|
|
|
fBitmap->SetBits(fbits, 256, 0, B_CMAP8);
|
2006-05-23 20:01:09 +00:00
|
|
|
}
|
|
|
|
|
return fBitmap;
|
|
|
|
|
}
|