bool do_set_contact_extra_icon(MCONTACT hContact, const CTendency& tendency) { CTendency::EResult nComparison = tendency.Compare(); if (CTendency::NotChanged == nComparison) return SetContactExtraImage(hContact, eiNotChanged); if (CTendency::Up == nComparison) return SetContactExtraImage(hContact, eiUp); if (CTendency::Down == nComparison) return SetContactExtraImage(hContact, eiDown); return false; }
bool show_popup(const IQuotesProvider* pProvider, MCONTACT hContact, const CTendency& tendency, const tstring& rsFormat, const CPopupSettings& ps) { if (!ServiceExists(MS_POPUP_ADDPOPUPT)) return false; POPUPDATAT ppd; memset(&ppd, 0, sizeof(ppd)); ppd.lchContact = hContact; if (tendency.IsValid()) { CTendency::EResult nComparison = tendency.Compare(); if (CTendency::NotChanged == nComparison) ppd.lchIcon = Quotes_LoadIconEx(IDI_ICON_NOTCHANGED); else if (CTendency::Up == nComparison) ppd.lchIcon = Quotes_LoadIconEx(IDI_ICON_UP); else if (CTendency::Down == nComparison) ppd.lchIcon = Quotes_LoadIconEx(IDI_ICON_DOWN); } CQuotesProviderVisitorFormater visitor(hContact, _T('s'), 0); pProvider->Accept(visitor); const tstring& sTitle = visitor.GetResult(); mir_tstrncpy(ppd.lptzContactName, sTitle.c_str(), MAX_CONTACTNAME); { ptrT ss(variables_parsedup((TCHAR*)rsFormat.c_str(), 0, hContact)); tstring sText = format_rate(pProvider, hContact, tstring(ss)); mir_tstrncpy(ppd.lptzText, sText.c_str(), MAX_SECONDLINE); } if (CPopupSettings::colourDefault == ps.GetColourMode()) { ppd.colorText = CPopupSettings::GetDefColourText(); ppd.colorBack = CPopupSettings::GetDefColourBk(); } else { ppd.colorText = ps.GetColourText(); ppd.colorBack = ps.GetColourBk(); } switch (ps.GetDelayMode()) { default: assert(!"Unknown popup delay mode"); case CPopupSettings::delayFromPopup: ppd.iSeconds = 0; break; case CPopupSettings::delayPermanent: ppd.iSeconds = -1; break; case CPopupSettings::delayCustom: ppd.iSeconds = ps.GetDelayTimeout(); break; } LPARAM lp = 0; if (false == ps.GetHistoryFlag()) lp |= 0x08; return (0 == CallService(MS_POPUP_ADDPOPUPT, reinterpret_cast<WPARAM>(&ppd), lp)); }