示例#1
0
int OnIconChange(WPARAM, LPARAM)
{
	mir_cslock lck(csButtonsHook);
	for (int i = 0; i < Buttons.getCount(); i++) {
		TopButtonInt *b = Buttons[i];
		if (!b->hIconHandleUp && !b->hIconHandleDn)
			continue;

		if (b->hIconHandleUp) {
			IcoLib_ReleaseIcon(b->hIconUp);
			b->hIconUp = IcoLib_GetIconByHandle(b->hIconHandleUp);
		}
		if (b->hIconHandleDn) {
			IcoLib_ReleaseIcon(b->hIconDn);
			b->hIconDn = IcoLib_GetIconByHandle(b->hIconHandleDn);
		}
		DestroyWindow(b->hwnd);
		b->CreateWnd();
	}

	if (g_ctrl->hWnd) {
		g_ctrl->bOrderChanged = true;
		PostMessage(g_ctrl->hWnd, TTB_UPDATEFRAMEVISIBILITY, 0, 0);
	}

	return 0;
}
示例#2
0
INT_PTR CSkypeProto::EventGetIcon(WPARAM wParam, LPARAM lParam)
{
	DBEVENTINFO* dbei = (DBEVENTINFO*)lParam;
	HICON icon = NULL;

	switch (dbei->eventType)
	{
	case SKYPE_DB_EVENT_TYPE_CALL_INFO:
	case SKYPE_DB_EVENT_TYPE_INCOMING_CALL:
		{
			icon = IcoLib_GetIconByHandle(GetIconHandle("inc_call"));
			break;
		}
	case SKYPE_DB_EVENT_TYPE_ACTION:
		{
			icon = IcoLib_GetIconByHandle(GetIconHandle("me_action"));
			break;
		}
	default:
		{
			icon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
			break;
		}
	}

	return (INT_PTR)((wParam & LR_SHARED) ? icon : CopyIcon(icon));
}
示例#3
0
HICON __fastcall CreateIconFromIndexes(short base, short overlay, short overlay2, short overlay3, short overlay4)
{
	HICON hIcon = NULL;	// returned HICON
	HICON hTmp = NULL;
	HICON icMain = NULL;
	HICON icOverlay = NULL;
	HICON icOverlay2 = NULL;
	HICON icOverlay3 = NULL;
	HICON icOverlay4 = NULL;

	KN_FP_MASK* mainMask = &(def_kn_fp_mask[base]);
	icMain = IcoLib_GetIconByHandle(mainMask->hIcolibItem);

	if (icMain) {
		KN_FP_MASK* overlayMask = (overlay != -1) ? &(def_kn_fp_overlays_mask[overlay]) : NULL;
		KN_FP_MASK* overlay2Mask = (overlay2 != -1) ? &(def_kn_fp_overlays2_mask[overlay2]) : NULL;
		KN_FP_MASK* overlay3Mask = (overlay3 != -1) ? &(def_kn_fp_overlays3_mask[overlay3]) : NULL;
		KN_FP_MASK* overlay4Mask = (overlay4 != -1) ? &(def_kn_fp_overlays4_mask[overlay4]) : NULL;
		icOverlay = (overlayMask == NULL) ? NULL : IcoLib_GetIconByHandle(overlayMask->hIcolibItem);
		icOverlay2 = (overlay2Mask == NULL) ? NULL : IcoLib_GetIconByHandle(overlay2Mask->hIcolibItem);
		icOverlay3 = (overlay3Mask == NULL) ? NULL : IcoLib_GetIconByHandle(overlay3Mask->hIcolibItem);
		icOverlay4 = (overlay4Mask == NULL) ? NULL : IcoLib_GetIconByHandle(overlay4Mask->hIcolibItem);

		hIcon = icMain;

		if (overlayMask)
			hTmp = hIcon = CreateJoinedIcon(hIcon, icOverlay);

		if (overlay2Mask) {
			hIcon = CreateJoinedIcon(hIcon, icOverlay2);
			if (hTmp) DestroyIcon(hTmp);
			hTmp = hIcon;
		}

		if (overlay3Mask) {
			hIcon = CreateJoinedIcon(hIcon, icOverlay3);
			if (hTmp) DestroyIcon(hTmp);
			hTmp = hIcon;
		}

		if (overlay4Mask) {
			hIcon = CreateJoinedIcon(hIcon, icOverlay4);
			if (hTmp) DestroyIcon(hTmp);
		}
	}

	if (hIcon == icMain)
		hIcon = CopyIcon(icMain);

	IcoLib_ReleaseIcon(icMain);
	IcoLib_ReleaseIcon(icOverlay);
	IcoLib_ReleaseIcon(icOverlay2);
	IcoLib_ReleaseIcon(icOverlay3);
	IcoLib_ReleaseIcon(icOverlay4);
	return hIcon;
}
示例#4
0
void CJabberInfoFrame::PaintCompact(HDC hdc)
{
    RECT rc;
    GetClientRect(m_hwnd, &rc);
    char *glyphs[] = { "Main,ID=ProtoInfo", "Main,ID=EventArea", "Main,ID=StatusBar", NULL };
    PaintSkinGlyph(hdc, &rc, glyphs, m_clBack);

    HFONT hfntSave = (HFONT)SelectObject(hdc, m_hfntTitle);
    SetBkMode(hdc, TRANSPARENT);
    SetTextColor(hdc, m_clTitle);

    int cx_icon = GetSystemMetrics(SM_CXSMICON);
    int cy_icon = GetSystemMetrics(SM_CYSMICON);

    int cx = rc.right - cx_icon - SZ_FRAMEPADDING;
    for (int i = m_pItems.getCount(); i--;) {
        CJabberInfoFrameItem &item = m_pItems[i];

        SetRect(&item.m_rcItem, 0, 0, 0, 0);
        if (!item.m_bShow) continue;
        if (!item.m_bCompact) continue;

        int depth = 0;
        for (char *p = item.m_pszName; p = strchr(p+1, '/'); ++depth) ;

        if (depth == 0) {
            if (item.m_hIcolibIcon) {
                HICON hIcon = IcoLib_GetIconByHandle(item.m_hIcolibIcon);
                if (hIcon) {
                    DrawIconEx(hdc, SZ_FRAMEPADDING, (rc.bottom-cy_icon)/2, hIcon, cx_icon, cy_icon, 0, NULL, DI_NORMAL);
                    IcoLib_ReleaseIcon(hIcon);
                }
            }

            RECT rcText;
            SetRect(&rcText, cx_icon + SZ_FRAMEPADDING + SZ_ICONSPACING, 0, rc.right - SZ_FRAMEPADDING, rc.bottom);
            DrawText(hdc, item.m_pszText, -1, &rcText, DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS);
        }
        else {
            if (item.m_hIcolibIcon) {
                HICON hIcon = IcoLib_GetIconByHandle(item.m_hIcolibIcon);
                if (hIcon) {
                    SetRect(&item.m_rcItem, cx, (rc.bottom-cy_icon)/2, cx+cx_icon, (rc.bottom-cy_icon)/2+cy_icon);
                    DrawIconEx(hdc, cx, (rc.bottom-cy_icon)/2, hIcon, cx_icon, cy_icon, 0, NULL, DI_NORMAL);
                    cx -= cx_icon;

                    IcoLib_ReleaseIcon(hIcon);

                    SetToolTip(item.m_tooltipId, &item.m_rcItem, item.m_pszText);
                }
            }
        }
    }

    SelectObject(hdc, hfntSave);
}
示例#5
0
static HTREEITEM AddLine(HWND hTree,TopButtonInt *b, HTREEITEM hItem, HIMAGELIST il)
{
	TVINSERTSTRUCT tvis = { 0 };
	tvis.hInsertAfter = hItem;
	tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;

	int index;
	TCHAR* tmp;

	if (b->dwFlags & TTBBF_ISSEPARATOR) {
		tvis.item.pszText = _T("------------------");
		index = -1;
	}
	else {
		if (b->hIconHandleUp) {
			HICON hIcon = IcoLib_GetIconByHandle(b->hIconHandleUp);
			index = ImageList_AddIcon(il, hIcon);
			IcoLib_ReleaseIcon(hIcon);
		}
		else index = ImageList_AddIcon(il, b->hIconUp);

		tmp = mir_a2t( b->pszName );
		tvis.item.pszText = TranslateTS(tmp);
	}
	tvis.item.iImage = tvis.item.iSelectedImage = index;

	tvis.item.lParam = (LPARAM)b;
	HTREEITEM hti = TreeView_InsertItem(hTree, &tvis);

	if (!(b->dwFlags & TTBBF_ISSEPARATOR))
		mir_free(tmp);

	TreeView_SetCheckState(hTree, hti, b->isVisible());
	return hti;
}
示例#6
0
int ImageList_AddIconFromIconLib(HIMAGELIST hIml, int i)
{
	HICON icon = IcoLib_GetIconByHandle(iconList[i].hIcolib);
	int res = ImageList_AddIcon(hIml, icon);
	IcoLib_ReleaseIcon(icon);
	return res;
}
示例#7
0
void FillNotificationData(POPUPDATA2 *ppd, DWORD *disableWhen)
{
	if (!IsValidNotification(ppd->lchNotification)) {
		*disableWhen = 0;
		return;
	}

	POPUPTREEDATA *ptd = (POPUPTREEDATA *)ppd->lchNotification;

	ppd->iSeconds = ptd->timeoutValue;
	*disableWhen = ptd->enabled ? ptd->disableWhen : 0xFFFFFFFF;

	LOGFONTA lf; // dummy to make FS happy (use LOGFONTA coz we use MS_FONT_GET)
	FontID fontid = { 0 }; // use ansi version of fontID coz POPUPNOTIFICATION use char
	fontid.cbSize = sizeof(fontid);
	mir_snprintf(fontid.group, PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup);
	mir_snprintf(fontid.name, "%s (colors only)", ptd->notification.lpzName);
	ppd->colorText = (COLORREF)CallService(MS_FONT_GET, (WPARAM)&fontid, (LPARAM)&lf);

	ColourID colourid = { 0 }; // use ansi version of ColourID coz POPUPNOTIFICATION use char
	colourid.cbSize = sizeof(colourid);
	mir_snprintf(colourid.group, PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup);
	mir_snprintf(colourid.name, "%s (colors only)", ptd->notification.lpzName);
	ppd->colorBack = (COLORREF)CallService(MS_COLOUR_GET, (WPARAM)&colourid, 0);

	ppd->lchIcon = IcoLib_GetIconByHandle(ptd->hIcoLib);
}
示例#8
0
/**
 * Sets statusbar text of hContact with last read time (from facy.readers map)
 */
void FacebookProto::MessageRead(MCONTACT hContact)
{
	/*std::map<MCONTACT, time_t>::iterator it = facy.readers.find(hContact);
	if (it == facy.readers.end())
	return;*/

	// We may use this instead of checing map as we have this info already in memory (this value is resident)
	time_t time = getDword(hContact, FACEBOOK_KEY_MESSAGE_READ, 0);
	if (!time)
		return;

	TCHAR ttime[64];
	_tcsftime(ttime, _countof(ttime), _T("%X"), localtime(&time));

	StatusTextData st = { 0 };
	st.cbSize = sizeof(st);
	st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("read"));

	if (isChatRoom(hContact)) {
		// Load readers names
		ptrT treaders(getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS));
		mir_sntprintf(st.tszText, TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : _T("???"));
		CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
	} else if (!ServiceExists(MS_MESSAGESTATE_UPDATE)){
		mir_sntprintf(st.tszText, TranslateT("Message read: %s"), ttime);
		CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
	}
}
示例#9
0
static void Icon2button(TTBButton *but, HANDLE &hIcoLib, HICON &hIcon, bool bIsUp)
{
	HANDLE hSrc = bIsUp ? but->hIconHandleUp : but->hIconHandleDn;
	if (hSrc == NULL) {
		hIcoLib = NULL, hIcon = NULL;
		return;
	}

	hIcoLib = IcoLib_IsManaged((HICON)hSrc);
	if (!hIcoLib) {
		char buf[256];
		mir_snprintf(buf, "toptoolbar_%s%s", but->name, bIsUp ? (but->hIconDn ? "%s_up" : "%s") : "%s_dn");

		SKINICONDESC sid = { 0 };
		sid.section.a = "Toolbar";
		sid.pszName = buf;
		sid.defaultFile.a = NULL;
		mir_snprintf(buf, "%s%s", but->name, bIsUp ? "" : " (pressed)");
		sid.description.a = buf;
		sid.hDefaultIcon = bIsUp ? but->hIconUp : but->hIconDn;
		hIcoLib = IcoLib_AddIcon(&sid);
	}

	hIcon = IcoLib_GetIconByHandle(hIcoLib);
}
示例#10
0
void CVkProto::InitPopups(void)
{
	TCHAR desc[256];
	char name[256];
	POPUPCLASS ppc = { sizeof(ppc) };
	ppc.flags = PCF_TCHAR;

	mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Errors"));
	mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
	ppc.ptszDescription = desc;
	ppc.pszName = name;
	ppc.hIcon = Skin_LoadIcon(SKINICON_ERROR);
	ppc.colorBack = RGB(191, 0, 0); //Red
	ppc.colorText = RGB(255, 245, 225); //Yellow
	ppc.iSeconds = 60;
	m_hPopupClassError = Popup_RegisterClass(&ppc);

	mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Notification"));
	mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
	ppc.ptszDescription = desc;
	ppc.pszName = name;
	ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_NOTIFICATION));
	ppc.colorBack = RGB(190, 225, 255); //Blue
	ppc.colorText = RGB(255, 255, 255); //White
	ppc.iSeconds = 4;
	m_hPopupClassNotification = Popup_RegisterClass(&ppc);
}
示例#11
0
void Nudge_ShowPopup(CNudgeElement*, MCONTACT hContact, TCHAR * Message)
{
	hContact = db_mc_tryMeta(hContact);
	TCHAR *lpzContactName = (TCHAR*)pcli->pfnGetContactDisplayName(hContact, 0);

	if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
		POPUPDATACLASS NudgePopup = { 0 };
		NudgePopup.cbSize = sizeof(NudgePopup);
		NudgePopup.hContact = hContact;
		NudgePopup.ptszText = Message;
		NudgePopup.ptszTitle = lpzContactName;
		NudgePopup.pszClassName = "nudge";
		CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&NudgePopup);
	}
	else if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
		POPUPDATAT NudgePopup = { 0 };
		NudgePopup.lchContact = hContact;
		NudgePopup.lchIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib);
		NudgePopup.colorBack = 0;
		NudgePopup.colorText = 0;
		NudgePopup.iSeconds = 0;
		NudgePopup.PluginWindowProc = NudgePopupProc;
		NudgePopup.PluginData = (void *)1;

		_tcscpy_s(NudgePopup.lptzText, Message);
		_tcscpy_s(NudgePopup.lptzContactName, lpzContactName);

		CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&NudgePopup, 0);
	}
	else MessageBox(NULL, Message, lpzContactName, 0);
}
示例#12
0
HICON GetIcon(int iconId)
{
	for (size_t i = 0; i < _countof(Icons); i++)
		if (Icons[i].defIconID == iconId)
			return IcoLib_GetIconByHandle(Icons[i].hIcolib);

	return NULL;
}
示例#13
0
HICON LoadIconEx(int iconId, bool big)
{
	for (int i = 0; i < _countof(iconList); i++)
		if (iconList[i].defIconID == iconId)
			return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);

	return NULL;
}
示例#14
0
HICON GetIcolibIcon(int iconId)
{
	HANDLE handle = GetIconHandle(iconId);
	if (handle != NULL)
		return IcoLib_GetIconByHandle(handle);

	return NULL;
}
示例#15
0
HICON GetIcon(int iIconId, bool size)
{
	for (int i = 0; i < _countof(iconList); i++)
		if (iconList[i].defIconID == iIconId)
			return IcoLib_GetIconByHandle(iconList[i].hIcolib, size);

	return NULL;
}
示例#16
0
void ShowPopupMessage(const TCHAR *title, const TCHAR *message, HANDLE icon)
{
	POPUPDATAT pd = { 0 };
	pd.lchIcon = IcoLib_GetIconByHandle(icon);
	_tcsncpy_s(pd.lptzContactName, title, _TRUNCATE);
	_tcsncpy_s(pd.lptzText, message, _TRUNCATE);
	pd.colorText = commonData.foreground;
	pd.colorBack = commonData.background;
	PUAddPopupT(&pd);
}
示例#17
0
void ShowPopupMessage(TCHAR *title, TCHAR *message, HANDLE icon)
{
	POPUPDATAT pd = { 0 };
	pd.lchIcon = IcoLib_GetIconByHandle(icon);
	_tcsncpy(pd.lptzContactName, title, MAX_CONTACTNAME - 1);
	_tcsncpy(pd.lptzText, message, MAX_SECONDLINE - 1);
	pd.colorText = commonData.foreground;
	pd.colorBack = commonData.background;
	PUAddPopupT(&pd);
}
示例#18
0
void CSWindow::initButtons()
{
	for (int i = 0; i < _countof(forms); i++) {
		if (forms[i].idc < 0)
			continue;

		SendDlgItemMessage(m_handle, forms[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(forms[i].hIcoLibItem));
		SendDlgItemMessage(m_handle, forms[i].idc, BUTTONSETASFLATBTN, TRUE, 0); //maybe set as BUTTONSETDEFAULT?
		SendDlgItemMessage(m_handle, forms[i].idc, BUTTONADDTOOLTIP, (WPARAM)TranslateW(forms[i].ptszTitle), BATF_UNICODE);
	}
}
示例#19
0
static int MO_ReloadIcon(TMO_IntMenuItem *pmi, void*)
{
	if (pmi->hIcolibItem) {
		HICON newIcon = IcoLib_GetIconByHandle(pmi->hIcolibItem, false);
		if (newIcon)
			ImageList_ReplaceIcon(pmi->parent->m_hMenuIcons, pmi->iconId, newIcon);

		IcoLib_ReleaseIcon(newIcon);
	}

	return FALSE;
}
示例#20
0
void CJabberInfoFrame::PaintNormal(HDC hdc)
{
    RECT rc;
    GetClientRect(m_hwnd, &rc);
    char *glyphs[] = { "Main,ID=ProtoInfo", "Main,ID=EventArea", "Main,ID=StatusBar", NULL };
    PaintSkinGlyph(hdc, &rc, glyphs, m_clBack);

    HFONT hfntSave = (HFONT)SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
    SetBkMode(hdc, TRANSPARENT);

    int cx_icon = GetSystemMetrics(SM_CXSMICON);
    int cy_icon = GetSystemMetrics(SM_CYSMICON);
    int line_height = cy_icon + SZ_LINEPADDING;
    int cy = SZ_FRAMEPADDING;

    for (int i=0; i < m_pItems.getCount(); i++) {
        CJabberInfoFrameItem &item = m_pItems[i];

        if (!item.m_bShow) {
            SetRect(&item.m_rcItem, 0, 0, 0, 0);
            continue;
        }

        int cx = SZ_FRAMEPADDING;
        int depth = 0;
        for (char *p = item.m_pszName; p = strchr(p+1, '/'); cx += cx_icon) ++depth;

        SetRect(&item.m_rcItem, cx, cy, rc.right - SZ_FRAMEPADDING, cy + line_height);

        if (item.m_hIcolibIcon) {
            HICON hIcon = IcoLib_GetIconByHandle(item.m_hIcolibIcon);
            if (hIcon) {
                DrawIconEx(hdc, cx, cy + (line_height-cy_icon)/2, hIcon, cx_icon, cy_icon, 0, NULL, DI_NORMAL);
                cx += cx_icon + SZ_ICONSPACING;

                IcoLib_ReleaseIcon(hIcon);
            }
        }

        SelectObject(hdc, depth ? m_hfntText : m_hfntTitle);
        SetTextColor(hdc, depth ? m_clText : m_clTitle);

        RECT rcText;
        SetRect(&rcText, cx, cy, rc.right - SZ_FRAMEPADDING, cy + line_height);
        DrawText(hdc, item.m_pszText, -1, &rcText, DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);

        RemoveTooltip(item.m_tooltipId);

        cy += line_height + SZ_LINESPACING;
    }

    SelectObject(hdc, hfntSave);
}
示例#21
0
MIR_APP_DLL(HICON) Skin_LoadIcon(int idx, bool big)
{
	// Query for global status icons
	if (idx < SKINICON_EVENT_MESSAGE) {
		if (idx >= _countof(statusIcons))
			return NULL;

		return Skin_LoadProtoIcon(NULL, statusIcons[idx].id, big);
	}

	return IcoLib_GetIconByHandle(Skin_GetIconHandle(idx), big);
}
示例#22
0
MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi, void *pUserData)
{
	if (!bIsGenMenuInited || pmi == NULL)
		return NULL;

	mir_cslock lck(csMenuHook);
	TIntMenuObject *pmo = GetMenuObjbyId(hMenuObject);
	if (pmo == NULL)
		return NULL;

	TMO_IntMenuItem* p = (TMO_IntMenuItem*)mir_calloc(sizeof(TMO_IntMenuItem));
	p->parent = pmo;
	p->signature = MENUITEM_SIGNATURE;
	p->iCommand = GetNextObjectMenuItemId();
	p->mi = *pmi;
	p->iconId = -1;
	p->originalPosition = pmi->position;
	p->pUserData = pUserData;

	if (pmi->flags & CMIF_UNICODE)
		p->mi.name.t = mir_tstrdup(pmi->name.t);
	else
		p->mi.name.t = mir_a2u(pmi->name.a);

	if (pmi->hIcon != NULL && !bIconsDisabled) {
		HANDLE hIcolibItem = IcoLib_IsManaged(pmi->hIcon);
		if (hIcolibItem != NULL) {
			HICON hIcon = IcoLib_GetIconByHandle(hIcolibItem, false);
			p->iconId = ImageList_AddIcon(pmo->m_hMenuIcons, hIcon);
			p->hIcolibItem = hIcolibItem;
			IcoLib_ReleaseIcon(hIcon);
		}
		else p->iconId = ImageList_AddIcon(pmo->m_hMenuIcons, pmi->hIcon);
	}

	TMO_IntMenuItem *pRoot = (p->mi.root != NULL) ? MO_GetIntMenuItem(p->mi.root) : NULL;
	if (pRoot) {
		p->owner = &pRoot->submenu;

		if (pRoot->iconId == -1)
			pRoot->iconId = p->iconId;
	}
	else p->owner = &pmo->m_items;

	if (!p->owner->first)
		p->owner->first = p;
	if (p->owner->last)
		p->owner->last->next = p;
	p->owner->last = p;
	return p;
}
示例#23
0
void CSkypeProto::InitPopups()
{
	TCHAR desc[256];
	char name[256];
	POPUPCLASS ppc = { sizeof(ppc) };
	ppc.flags = PCF_TCHAR;

	mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Calls"));
	mir_snprintf(name, "%s_%s", m_szModuleName, "Call");
	ppc.ptszDescription = desc;
	ppc.pszName = name;
	ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("inc_call"));
	ppc.colorBack = RGB(255, 255, 255);
	ppc.colorText = RGB(0, 0, 0);
	ppc.iSeconds = 30;
	ppc.PluginWindowProc = PopupDlgProcCall;
	m_hPopupClassCall = Popup_RegisterClass(&ppc);

	mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Notifications"));
	mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
	ppc.ptszDescription = desc;
	ppc.pszName = name;
	ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("notify"));
	ppc.colorBack = RGB(255, 255, 255);
	ppc.colorText = RGB(0, 0, 0);
	ppc.iSeconds = 5;
	m_hPopupClassNotify = Popup_RegisterClass(&ppc);

	mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Errors"));
	mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
	ppc.ptszDescription = desc;
	ppc.pszName = name;
	ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("error"));
	ppc.colorBack = RGB(255, 255, 255);
	ppc.colorText = RGB(0, 0, 0);
	ppc.iSeconds = -1;
	m_hPopupClassNotify = Popup_RegisterClass(&ppc);
}
示例#24
0
HICON LoadSkinIcon( int idx, bool big )
{
	//
	//  Query for global status icons
	//
	if ( idx < SKINICON_EVENT_MESSAGE ) {
		if ( idx >= SIZEOF( statusIcons ))
			return NULL;

		return LoadSkinProtoIcon( NULL, statusIcons[ idx ].id, big );
	}

	return IcoLib_GetIconByHandle( GetSkinIconHandle( idx ), big );
}
示例#25
0
void LoadPopupClass()
{
	POPUPCLASS ppc = { sizeof(ppc) };
	ppc.flags = PCF_TCHAR;
	ppc.pszName = "Nudge";
	ppc.ptszDescription = LPGENT("Show Nudge");
	ppc.hIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib);
	ppc.colorBack = NULL;
	ppc.colorText = NULL;
	ppc.iSeconds = 0;
	ppc.PluginWindowProc = NudgePopupProc;
	if (hPopupClass = Popup_RegisterClass(&ppc))
		HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
}
示例#26
0
int FacebookProto::OnToolbarInit(WPARAM, LPARAM)
{
	TTBButton ttb = { 0 };
	ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE;

	char service[100];
	mir_snprintf(service, "%s%s", m_szModuleName, "/Mind");

	ttb.pszService = service;
	ttb.pszTooltipUp = ttb.name = LPGEN("Share status...");
	ttb.hIconHandleUp = IcoLib_GetIconByHandle(GetIconHandle("mind"));
	TopToolbar_AddButton(&ttb);

	return 0;
}
示例#27
0
void LoadMsgLogIcons(void)
{
	HBRUSH hBkgBrush = CreateSolidBrush(db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR));

	BITMAPINFOHEADER bih = { sizeof(bih) };
	bih.biBitCount = 24;
	bih.biCompression = BI_RGB;
	bih.biHeight = 10;
	bih.biPlanes = 1;
	bih.biWidth = 10;
	int widthBytes = ((bih.biWidth * bih.biBitCount + 31) >> 5) * 4;

	RECT rc;
	rc.top = rc.left = 0;
	rc.right = bih.biWidth;
	rc.bottom = bih.biHeight;

	HDC hdc = GetDC(NULL);
	HBITMAP hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
	HDC hdcMem = CreateCompatibleDC(hdc);
	PBYTE pBmpBits = (PBYTE)mir_alloc(widthBytes * bih.biHeight);

	for (int i = 0; i < _countof(pLogIconBmpBits); i++) {
		HICON hIcon = IcoLib_GetIconByHandle(iconList[i].hIcolib);
		size_t size = RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2;
		pLogIconBmpBits[i] = (char*)mir_alloc(size);
		size_t rtfHeaderSize = mir_snprintf(pLogIconBmpBits[i], size, "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight);
		HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
		FillRect(hdcMem, &rc, hBkgBrush);
		DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL);
		IcoLib_ReleaseIcon(hIcon);

		SelectObject(hdcMem, hoBmp);
		GetDIBits(hdc, hBmp, 0, bih.biHeight, pBmpBits, (BITMAPINFO*)&bih, DIB_RGB_COLORS);

		char *szDest = pLogIconBmpBits[i] + rtfHeaderSize;
		bin2hex(&bih, sizeof(bih), szDest); szDest += sizeof(bih) * 2;
		bin2hex(pBmpBits, widthBytes * bih.biHeight, szDest); szDest += widthBytes * bih.biHeight * 2;
		mir_strcpy(szDest, "}");

		logIconBmpSize[i] = size_t(szDest - pLogIconBmpBits[i]) + 1;
	}
	mir_free(pBmpBits);
	DeleteDC(hdcMem);
	DeleteObject(hBmp);
	ReleaseDC(NULL, hdc);
	DeleteObject(hBkgBrush);
}
示例#28
0
void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &)
{
	//std::string displayname = body["displayName"].as_string();
	//std::string cuid = body["callerId"].as_string();
	std::string uid = body["conversationId"].as_string();
	std::string gp = body["gp"].as_string();
	int evt = body["evt"].as_int();

	switch (evt)
	{
	case 100: //incoming call
		{
			std::string callId = body["convoCallId"].as_string();
			if (!uid.empty())
			{
				MCONTACT hContact = AddContact(uid.c_str(), true);

				MEVENT hEvent = AddDbEvent(SKYPE_DB_EVENT_TYPE_INCOMING_CALL, hContact, time(NULL), DBEF_READ, gp.c_str(), callId.c_str());
				SkinPlaySound("skype_inc_call");

				CLISTEVENT cle = { sizeof(cle) };
				cle.flags |= CLEF_TCHAR;
				cle.hContact = hContact;
				cle.hDbEvent = hEvent;
				cle.lParam = SKYPE_DB_EVENT_TYPE_INCOMING_CALL;
				cle.hIcon = IcoLib_GetIconByHandle(GetIconHandle("inc_call"));

				CMStringA service(FORMAT, "%s/IncomingCallCLE", GetContactProto(hContact));
				cle.pszService = service.GetBuffer();

				CMString tooltip(FORMAT, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
				cle.ptszTooltip = tooltip.GetBuffer();

				CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);

				ShowNotification(pcli->pfnGetContactDisplayName(hContact, 0), TranslateT("Incoming call"), hContact, SKYPE_DB_EVENT_TYPE_INCOMING_CALL);
			}
		}
		break;

	case 104: //call canceled: callerId=""; conversationId=NULL; callId=call id
		// std::string callId = body["callId"].as_string();
		SkinPlaySound("skype_call_canceled");
		break;
	}
}
示例#29
0
void ShowPopup(LPCTSTR ptszTitle, LPCTSTR ptszText, int Number)
{
	if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) {
		char setting[100];
		mir_snprintf(setting, "Popups%d", Number);
		if (db_get_b(NULL, MODNAME, setting, DEFAULT_POPUP_ENABLED)) {
			POPUPDATAT pd = { 0 };
			pd.lchContact = NULL;
#if MIRANDA_VER >= 0x0A00
			pd.lchIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib);
#else
			pd.lchIcon = IcoLib_GetIcon("check_update");
#endif
			if (Number == POPUP_TYPE_MSG) {
				pd.PluginWindowProc = PopupDlgProcRestart;
				pd.iSeconds = -1;
			}
			else {
				pd.PluginWindowProc = PopupDlgProc;
				pd.iSeconds = PopupOptions.Timeout;
			}

			lstrcpyn(pd.lptzText, ptszText, MAX_SECONDLINE);
			lstrcpyn(pd.lptzContactName, ptszTitle, MAX_CONTACTNAME);

			switch (PopupOptions.DefColors) {
			case byCOLOR_WINDOWS:
				pd.colorBack = GetSysColor(COLOR_BTNFACE);
				pd.colorText = GetSysColor(COLOR_WINDOWTEXT);
				break;
			case byCOLOR_OWN:
				pd.colorBack = PopupsList[Number].colorBack;
				pd.colorText = PopupsList[Number].colorText;
				break;
			case byCOLOR_POPUP:
				pd.colorBack = pd.colorText = 0;
				break;
			}
			PUAddPopupT(&pd);
			return;
		}
	}

	if (Number == POPUP_TYPE_ERROR)
		MessageBox(0, ptszText, ptszTitle, MB_ICONINFORMATION);
}
示例#30
0
MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HANDLE hIcolib, int iFlags)
{
	if (!bIsGenMenuInited)
		return -1;

	mir_cslock lck(csMenuHook);

	TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
	if (pimi == NULL)
		return -1;

	if (ptszName != NULL)
		replaceStrT(pimi->mi.name.t, ptszName);

	if (iFlags != -1) {
		// we allow to set only first 3 bits
		int oldflags = (pimi->mi.flags & 0xFFFFFFF8);
		pimi->mi.flags = (iFlags & 0x07) | oldflags;
	}

	if (hIcolib != INVALID_HANDLE_VALUE && !bIconsDisabled) {
		HANDLE hIcolibItem = IcoLib_IsManaged((HICON)hIcolib);
		if (hIcolibItem) {
			HICON hIcon = IcoLib_GetIconByHandle(hIcolibItem, false);
			if (hIcon != NULL) {
				pimi->hIcolibItem = hIcolibItem;
				pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, hIcon);
				IcoLib_ReleaseIcon(hIcon);
			}
			else pimi->iconId = -1, pimi->hIcolibItem = NULL;
		}
		else {
			pimi->mi.hIcon = (HICON)hIcolib;
			if (hIcolib != NULL)
				pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, (HICON)hIcolib);
			else
				pimi->iconId = -1;	  //fixme, should remove old icon & shuffle all iconIds
		}
		if (pimi->hBmp) {
			DeleteObject(pimi->hBmp);
			pimi->hBmp = NULL;
		}
	}

	return 0;
}