1 /* 2 * Copyright 2000, Georges-Edouard Berenger. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #include "AutoIcon.h" 7 #include "Utilities.h" 8 9 #include <Bitmap.h> 10 #include <Entry.h> 11 #include <MimeType.h> 12 #include <NodeInfo.h> 13 #include <Roster.h> 14 15 16 AutoIcon::~AutoIcon() 17 { 18 delete fBitmap; 19 } 20 21 22 BBitmap* 23 AutoIcon::Bitmap() 24 { 25 if (fBitmap == NULL) { 26 fBitmap = new BBitmap(BRect(0, 0, 15, 15), B_RGBA32); 27 28 if (fSignature) { 29 entry_ref ref; 30 be_roster->FindApp (fSignature, &ref); 31 if (BNodeInfo::GetTrackerIcon(&ref, fBitmap, B_MINI_ICON) != B_OK) { 32 BMimeType genericAppType(B_APP_MIME_TYPE); 33 genericAppType.GetIcon(fBitmap, B_MINI_ICON); 34 } 35 } 36 37 if (fbits) 38 fBitmap->SetBits(fbits, 256, 0, B_CMAP8); 39 } 40 return fBitmap; 41 } 42