ArpDocumentButton::ArpDocumentButton(BRect frame, const char *name, BBitmap* icon, BMessage* pressMsg, uint32 resizeMask, uint32 flags) : BControl(frame, name, "", pressMsg, resizeMask, flags), mDocIcon(icon), mSmallIcon(0), mAction(Inactive), mPressed(false), mMenued(false), mDropped(false) { SetHandlerForReply(this); if( mDocIcon == 0 ) { app_info ai; BFile file; BAppFileInfo afi; be_app->GetAppInfo(&ai); file.SetTo(&ai.ref, B_READ_ONLY); afi.SetTo(&file); mDocIcon = new BBitmap(BRect(0,0,15,15), B_CMAP8); if( afi.GetIcon(mDocIcon, B_MINI_ICON) != B_OK ) { delete mDocIcon; mDocIcon = 0; } } mSmallIcon = BTranslationUtils::GetBitmap('bmp ', 1); }
void get_app_info(team_id team, BBitmap **icon, char **name) { app_info info; if (be_roster->GetRunningAppInfo(team, &info) == B_BAD_TEAM_ID) { *icon = NULL; *name = NULL; return; } *name = strdup(info.ref.name); BFile file; BAppFileInfo afi; file.SetTo(&info.ref, B_READ_ONLY); afi.SetTo(&file); *icon = new BBitmap(BRect(0.0,0.0,15.0,15.0), B_CMAP8); if (!*icon) {return;} if (afi.GetIcon(*icon, B_MINI_ICON) != B_NO_ERROR) {*icon = NULL; return;} }