Added a little bitmap at the left of the avatar in the contact list, that show the icon of the contact's protocol. Added a needed little method in the ContactLinker to get the contact protocol's bitmap as well.

This commit is contained in:
barrett 2012-05-01 19:48:15 +00:00
parent 9f4470c334
commit 9df2b09f45
3 changed files with 21 additions and 0 deletions

View File

@ -172,6 +172,17 @@ ContactLinker::AvatarBitmap() const
}
BBitmap*
ContactLinker::ProtocolBitmap() const
{
CayaProtocol* protocol = fLooper->Protocol();
CayaProtocolAddOn* addOn
= ProtocolManager::Get()->ProtocolAddOn(protocol->Signature());
return addOn->Icon();
}
CayaStatus
ContactLinker::GetNotifyStatus() const
{

View File

@ -42,6 +42,7 @@ public:
ProtocolLooper* GetProtocolLooper() const;
void SetProtocolLooper(ProtocolLooper* looper);
BBitmap* ProtocolBitmap() const;
BString GetName() const;
BBitmap* AvatarBitmap() const;

View File

@ -195,6 +195,15 @@ void RosterItem::DrawItem(BView* owner, BRect frame, bool complete)
rect, B_FILTER_BITMAP_BILINEAR);
}
BBitmap* protocolBitmap = contactLinker->ProtocolBitmap();
float h = frame.Height();
BRect rect(frame.right - h - 20, frame.top + 2,
frame.right - 40, frame.top + h - 20);
owner->SetDrawingMode(B_OP_ALPHA);
owner->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
owner->DrawBitmap(protocolBitmap, protocolBitmap->Bounds(),
rect, B_FILTER_BITMAP_BILINEAR);
owner->SetHighColor(highColor);
owner->SetLowColor(lowColor);
}