コード例 #1
0
ファイル: skinicons.cpp プロジェクト: ybznek/miranda-ng
// load small icon from hInstance
HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared)
{
	HICON hResIcon = bShared ? LoadSmallIconShared(hInstance, lpIconName) : LoadSmallIcon(hInstance, lpIconName);
	if (hResIcon == NULL && g_hInst != hInstance) // Icon not found in hInstance, let's try to load it from core
		hResIcon = bShared ? LoadSmallIconShared(g_hInst, lpIconName) : LoadSmallIcon(g_hInst, lpIconName);

	return hResIcon;
}
コード例 #2
0
// load small icon from hInstance
HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared)
{
	HICON hResIcon = bShared ? LoadSmallIcon(hInstance,lpIconName) : LoadSmallIconShared(hInstance,lpIconName);
	if ( !hResIcon ) { //Icon not found in hInstance lets try to load it from core
		HINSTANCE hCoreInstance=hMirandaInst;
		if ( hCoreInstance != hInstance )
			hResIcon = bShared ? LoadSmallIcon(hCoreInstance,lpIconName) : LoadSmallIconShared(hCoreInstance,lpIconName);
	}
	return hResIcon;
}
コード例 #3
0
int CJabberProto::LoadAdvancedIcons(int iID)
{
	char *proto = TransportProtoTable[iID].proto;
	char defFile[MAX_PATH] = {0};
	TCHAR Group[255];
	char Uname[255];
	int first=-1;
	HICON empty=LoadSmallIcon(NULL,MAKEINTRESOURCE(102));

	mir_sntprintf(Group, SIZEOF(Group), _T("Status Icons/%s/%S %s"), m_tszUserName, proto, TranslateT("transport"));
	mir_snprintf(defFile, SIZEOF(defFile), "proto_%s.dll",proto);
	if (!hAdvancedStatusIcon)
		hAdvancedStatusIcon=(HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0);

	mir_cslock lck(m_csModeMsgMutex);
	for (int i=0; i < ID_STATUS_ONTHEPHONE-ID_STATUS_OFFLINE; i++) {
		BOOL needFree;
		int n = skinStatusToJabberStatus[i];
		TCHAR *descr = pcli->pfnGetStatusModeDescription(n+ID_STATUS_OFFLINE, 0);
		mir_snprintf(Uname, SIZEOF(Uname), "%s_Transport_%s_%d", m_szModuleName, proto, n);
		HICON hicon = LoadTransportIcon(defFile,-skinIconStatusToResourceId[i],Uname,Group,descr,-(n+ID_STATUS_OFFLINE),&needFree);
		int index = (m_transportProtoTableStartIndex[iID] == -1)?-1:m_transportProtoTableStartIndex[iID]+n;
		int added = ImageList_ReplaceIcon(hAdvancedStatusIcon,index,hicon?hicon:empty);
		if (first == -1)
			first = added;
		if (hicon && needFree)
			DestroyIcon(hicon);
	}

	if (m_transportProtoTableStartIndex[iID] == -1)
		m_transportProtoTableStartIndex[iID] = first;
	return 0;
}
コード例 #4
0
static int LoadAdvancedIcons(int iID)
{
	int i;
	char * proto=TransportProtoTable[iID].proto;    
	char * defFile[MAX_PATH]={0};
	char * Group[255];
	char * Uname[255];
	int first=-1;
	HICON empty=LoadSmallIcon(NULL,MAKEINTRESOURCE(102));

	_snprintf((char *)Group, sizeof(Group),"%s/%s/%s %s",Translate("Status Icons"), jabberModuleName, proto, Translate("transport"));
	_snprintf((char *)defFile, sizeof(defFile),"proto_%s.dll",proto);
	if (!hAdvancedStatusIcon)
		hAdvancedStatusIcon=(HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0);
	
	EnterCriticalSection( &modeMsgMutex );
	for (i=0; i<ID_STATUS_ONTHEPHONE-ID_STATUS_OFFLINE; i++) {
		HICON hicon;        
		BOOL needFree;
		int n=skinStatusToJabberStatus[i];
		char * descr=(char*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,n+ID_STATUS_OFFLINE,0);
		_snprintf((char *)Uname, sizeof(Uname),"%s_Transport_%s_%d",jabberProtoName,proto,n);
		hicon=(HICON)LoadTransportIcon((char*)defFile,-skinIconStatusToResourceId[i],(char*)Uname,(char*)Group,(char*)descr,-(n+ID_STATUS_OFFLINE),&needFree);
		int index=(TransportProtoTable[iID].startIndex==-1)?-1:TransportProtoTable[iID].startIndex+n;
		int added=ImageList_ReplaceIcon(hAdvancedStatusIcon,index,hicon?hicon:empty);          
		if (first==-1) first=added;
		if (hicon && needFree) DestroyIcon(hicon);
	}

	if (TransportProtoTable[iID].startIndex == -1)
		TransportProtoTable[iID].startIndex = first;
	LeaveCriticalSection( &modeMsgMutex );
	return 0;
}
コード例 #5
0
ファイル: trayicon.cpp プロジェクト: 0xff80ff/recaps
void AddTrayIcon(HWND hWnd, UINT uID, UINT uCallbackMsg, UINT uIcon, LPTSTR pszToolTip)
{
    NOTIFYICONDATA  nid     = {0};
    nid.cbSize              = sizeof(nid);
    nid.hWnd                = hWnd;
    nid.uID                 = uID;
    nid.uFlags              = NIF_ICON | NIF_MESSAGE | NIF_TIP;
    nid.uCallbackMessage    = uCallbackMsg;
    nid.hIcon               = LoadSmallIcon(GetModuleHandle(NULL), uIcon);
    wcscpy_s(nid.szTip, sizeof(WCHAR)*64, pszToolTip);
    Shell_NotifyIcon(NIM_ADD, &nid);
}
コード例 #6
0
ファイル: trayicon.cpp プロジェクト: 0xff80ff/recaps
void ModifyTrayIcon( HWND hWnd, UINT uID, UINT uIcon, LPTSTR pszToolTip )
{
    NOTIFYICONDATA  nid = {0};
    nid.cbSize  = sizeof(nid);
    nid.hWnd    = hWnd;
    nid.uID     = uID;

    if (uIcon != (UINT)-1) 
    {
        nid.hIcon = LoadSmallIcon(GetModuleHandle( NULL ), uIcon);
        nid.uFlags |= NIF_ICON;
    }

    if (pszToolTip) 
    {
        wcscpy_s(nid.szTip, sizeof(WCHAR)*64, pszToolTip);
        nid.uFlags |= NIF_TIP;
    }

    if (uIcon != (UINT)-1 || pszToolTip)
        Shell_NotifyIcon(NIM_MODIFY, &nid);
}
コード例 #7
0
void ExtraImage_ReloadExtraIcons()
{
	int count,i;
	PROTOACCOUNT **accs;
	HICON hicon;
	BOOL needFree;

	SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNSSPACE,ModernGetSettingByte(NULL,"CLUI","ExtraColumnSpace",18),0);					
	SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGELIST,0,(LPARAM)NULL);		
	if (hExtraImageList){ImageList_Destroy(hExtraImageList);};
	if (hWideExtraImageList){ImageList_Destroy(hWideExtraImageList);};

	hExtraImageList=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256);
	hWideExtraImageList=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256);

	if (!HasExtraIconsService())
	{
		HICON hIcon;

		//loading icons
		hIcon = LoadSkinnedIcon(SKINICON_OTHER_SENDEMAIL);
		ExtraImageIconsIndex[0]=ImageList_AddIcon(hExtraImageList, hIcon);
		CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
		hIcon = LoadSkinnedIcon(SKINICON_OTHER_SMS);
		ExtraImageIconsIndex[1]=ImageList_AddIcon(hExtraImageList, hIcon);
		CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
		hIcon = LoadSkinnedIcon(SKINICON_EVENT_URL);
		ExtraImageIconsIndex[2]=ImageList_AddIcon(hExtraImageList, hIcon);
		CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
		
		//calc only needed protocols
		//adding protocol icons
		ProtoEnumAccounts( &count, &accs );
		for(i=0;i<count;i++)
		{
            if (!IsAccountEnabled(accs[i]) || CallProtoService(accs[i]->szModuleName, PS_GETCAPS,PFLAGNUM_2, 0 )== 0) 
				continue;
			
			hIcon = LoadSkinnedProtoIcon(accs[i]->szModuleName,ID_STATUS_ONLINE);
			ImageList_AddIcon(hExtraImageList, hIcon);
			CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
		}

		hicon=CLUI_LoadIconFromExternalFile("clisticons.dll",5,TRUE,TRUE,"AlwaysVis","Contact List",Translate("Always Visible"),-IDI_ALWAYSVIS,&needFree);
		if (!hicon) {hicon=LoadSmallIcon(g_hInst, MAKEINTRESOURCE(IDI_ALWAYSVIS));needFree=TRUE;}
		ExtraImageIconsIndex[3]=ImageList_AddIcon(hExtraImageList,hicon );
		if (needFree) DestroyIcon_protect(hicon);

		hicon=CLUI_LoadIconFromExternalFile("clisticons.dll",6,TRUE,TRUE,"NeverVis","Contact List",Translate("Never Visible"),-IDI_NEVERVIS,&needFree);
		if (!hicon) {hicon=LoadSmallIcon(g_hInst, MAKEINTRESOURCE(IDI_NEVERVIS));needFree=TRUE;}
		ExtraImageIconsIndex[4]=ImageList_AddIcon(hExtraImageList,hicon );
		if (needFree) DestroyIcon_protect(hicon);

		hicon=CLUI_LoadIconFromExternalFile("clisticons.dll",7,TRUE,TRUE,"ChatActivity","Contact List",Translate("Chat Activity"),-IDI_CHAT,&needFree);
		if (!hicon) {hicon=LoadSmallIcon(g_hInst, MAKEINTRESOURCE(IDI_CHAT));needFree=TRUE;}
		ExtraImageIconsIndex[5]=ImageList_AddIcon(hExtraImageList,hicon );
		if (needFree) DestroyIcon_protect(hicon);
	}

	SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGELIST,(WPARAM)hWideExtraImageList,(LPARAM)hExtraImageList);		
	//ExtraImage_SetAllExtraIcons(hImgList);
	SetNewExtraColumnCount();
	NotifyEventHooks(g_CluiData.hEventExtraImageListRebuilding,0,0);
	ImageCreated=TRUE;
}