Ejemplo n.º 1
0
int CListViewCtrlEx::AppendTitle( LPCTSTR strItem, COLORREF clr, UINT uFlags)
{
//	return Append(strItem, LISTITEM_TITLE);

    int nItem = _super::AddItem(_super::GetItemCount(), 0, _T(""));
    TListItem *pitem = new TListItem;
    pitem->dwFlags = LISTITEM_TITLE | uFlags;
    pitem->clrBg	=RGB(248,248,248);
    pitem->bBold = uFlags & LISTITEM_BOLD;
    pitem->nLeftmargin = 15;

    TListSubItem subItem(strItem, SUBITEM_TEXT);
    subItem.clr = clr;
    pitem->subItems.push_back( subItem );
    m_arrItems.push_back( pitem );
    return nItem;
}
Ejemplo n.º 2
0
// -----------------------------------------------------------------------------
// CMPXClientList::IsMsgSubscribedL
// -----------------------------------------------------------------------------
//
TBool CMPXClientList::IsMsgSubscribedL(TInt aIndex, const CMPXMessage* aMsg)
    {
    // check the subscriptions
    TBool IsSubScribed(EFalse);
    TInt subCount(iClients[aIndex]->iSubscriptions.Count());

    if (subCount)
        {
        const CMPXMediaArray* subscriptionItems =
                                 iClients[aIndex]->iSubscriptions[0]->ItemsL();
        if (1==subCount && (0== subscriptionItems->Count()))
            {// one empty subscription - send everything
            IsSubScribed = ETrue;
            }
        else
            {// have to check the message against the subscriptions.
            MPX_ASSERT(aMsg);
            const TArray<TMPXAttribute> msgAttrs = aMsg->Attributes();
            TInt msgAttrCount(msgAttrs.Count());
            // iterate subscriptions
            for (TInt subIndex = 0; subIndex<subCount && !IsSubScribed; ++subIndex)
                {
                // iterate items for the current subscription
                subscriptionItems =
                            iClients[aIndex]->iSubscriptions[subIndex]->ItemsL();
                TInt itemCount(subscriptionItems->Count());
                for (TInt itemIndex = 0; itemIndex < itemCount; ++itemIndex)
                    {
                    // check the message attributes for the current subscription item
                    TBool subMatch(ETrue);
                    TInt attrMatchCount(0);
                    CMPXSubscriptionItem* subItem(subscriptionItems->AtL(itemIndex));

                    for (TInt msgAttrIndex = 0; msgAttrIndex < msgAttrCount; ++msgAttrIndex)
                        {
                        TBool attrExists(EFalse);
                        TBool attrMatch(EFalse);
                        const TMPXAttribute& msgAttr( msgAttrs[msgAttrIndex] );

                        if ( subItem->IsSupported(msgAttr))
                            {
                            attrExists = ETrue;

                            if ( subItem->Match( *aMsg, msgAttr ))
                                {
                                attrMatch = ETrue;
                                attrMatchCount++;
                                }
                            }

                        if (attrExists && !attrMatch)
                            {
                            subMatch = EFalse;
                            break;
                            }
                        }

                    // send the message if all attributes that exist in both the message and the subscription
                    // have the same values and all subscription attributes match
                    if ( subMatch && ( attrMatchCount == subItem->Count()) )
                        {
                        IsSubScribed = ETrue;
                        break;
                        }
                    }
                }
            }
        } // else subCount = 0, IsSubScribed = EFalse (default)
    return IsSubScribed;
    }