summaryrefslogtreecommitdiff
path: root/plugins/Gender
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-12-02 18:19:49 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-12-02 18:19:49 +0000
commitc4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 (patch)
tree17a8627550b202d62df8e1df76d2585d3d0cdeaa /plugins/Gender
parent5ea5feb7e052ca45af7bc9ed76e4a252bd71950d (diff)
new easy standard way of registering icons: Icon_Register
git-svn-id: http://svn.miranda-ng.org/main/trunk@2601 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Gender')
-rw-r--r--plugins/Gender/src/commonheaders.h1
-rw-r--r--plugins/Gender/src/main.cpp45
2 files changed, 16 insertions, 30 deletions
diff --git a/plugins/Gender/src/commonheaders.h b/plugins/Gender/src/commonheaders.h
index 1971484888..2d588792e5 100644
--- a/plugins/Gender/src/commonheaders.h
+++ b/plugins/Gender/src/commonheaders.h
@@ -48,6 +48,7 @@
#include <m_genmenu.h>
#include <m_icolib.h>
#include <m_cluiframes.h>
+#include <win2k.h>
//Gender SDK
#include "m_gender.h"
diff --git a/plugins/Gender/src/main.cpp b/plugins/Gender/src/main.cpp
index 391a0d4722..fa662d172c 100644
--- a/plugins/Gender/src/main.cpp
+++ b/plugins/Gender/src/main.cpp
@@ -31,7 +31,6 @@ static HANDLE hContactMenu = NULL, hContactMenuMale = NULL, hContactMenuFemale =
static HANDLE hSetMale = NULL, hSetFemale = NULL, hSetUndef = NULL, hGenderGetIcon = NULL;
HANDLE g_hExtraIcon = NULL;
-HANDLE g_hIconMale, g_hIconFemale, g_hIconMenu;
byte bEnableClistIcon = 1; // do we need clist icon?
byte bDrawNoGenderIcon = 0; // enable icon when no info?
@@ -54,6 +53,13 @@ sizeof(PLUGININFOEX),
{0xfb1c17e0, 0x77fc, 0x45a7, {0x9c, 0x8b, 0xe2, 0xbe, 0xf4, 0xf5, 0x6b, 0x28}} /* FB1C17E0-77FC-45A7-9C8B-E2BEF4F56B28 */
};
+static IconItem iconList[] =
+{
+ { LPGEN("Male"), "male_icon", IDI_MALE },
+ { LPGEN("Female"), "female_icon", IDI_FEMALE },
+ { LPGEN("No info"), "menu_icon", IDI_UNDEF }
+};
+
extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
g_hInst = hinstDLL;
@@ -112,9 +118,9 @@ INT_PTR GetIcon(WPARAM wParam, LPARAM lParam)
if (gender > 0) {
if (gender == 77)
- return (INT_PTR)Skin_GetIconByHandle(g_hIconMale);
+ return (INT_PTR)Skin_GetIconByHandle(iconList[0].hIcolib);
if (gender == 70)
- return (INT_PTR)Skin_GetIconByHandle(g_hIconFemale);
+ return (INT_PTR)Skin_GetIconByHandle(iconList[1].hIcolib);
}
return 0;
@@ -209,29 +215,8 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam)
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onPrebuildContactMenu);
bMetaAvail = (ServiceExists(MS_MC_GETMETACONTACT) != 0);
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInst, szFile, MAX_PATH);
-
//IcoLib support
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.pszSection = LPGEN("Gender");
- sid.ptszDefaultFile = szFile;
-
- sid.pszDescription = LPGEN("Male");
- sid.pszName = "male_icon";
- sid.iDefaultIndex = -IDI_MALE;
- g_hIconMale = Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("Female");
- sid.pszName = "female_icon";
- sid.iDefaultIndex = -IDI_FEMALE;
- g_hIconFemale = Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("No info");
- sid.pszName = "menu_icon";
- sid.iDefaultIndex = -IDI_UNDEF;
- g_hIconMenu = Skin_AddIcon(&sid);
+ Icon_Register(g_hInst, "Gender", iconList, SIZEOF(iconList));
// Adding clist extra icon
g_hExtraIcon = ExtraIcon_Register("gender", "Gender", "menu_icon");
@@ -249,7 +234,7 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam)
{
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- mi.icolibItem = g_hIconMenu;
+ mi.icolibItem = iconList[2].hIcolib;
mi.pszPopupName = (char*)-1;
mi.position = 203;
mi.ptszName = LPGENT("Set Gender");
@@ -261,12 +246,12 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam)
mi.pszPopupName = (char*)hContactMenu;
mi.ptszName = LPGENT("Male");
- mi.icolibItem = g_hIconMale;
+ mi.icolibItem = iconList[0].hIcolib;
mi.pszService = "Gender/MenuItemSetMale";
hContactMenuMale = Menu_AddContactMenuItem(&mi);
mi.ptszName = LPGENT("Female");
- mi.icolibItem = g_hIconFemale;
+ mi.icolibItem = iconList[1].hIcolib;
mi.pszService = "Gender/MenuItemSetFemale";
hContactMenuFemale = Menu_AddContactMenuItem(&mi);
@@ -281,14 +266,14 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam)
mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.position = 1001;
mi.ptszName = LPGENT("Set Male");
- mi.icolibItem = g_hIconMale;
+ mi.icolibItem = iconList[0].hIcolib;
mi.pszService = "Gender/MenuItemSetMale";
hContactMenuMale = Menu_AddContactMenuItem(&mi);
mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.position = 1002;
mi.ptszName = LPGENT("Set Female");
- mi.icolibItem = g_hIconFemale;
+ mi.icolibItem = iconList[1].hIcolib;
mi.pszService = "Gender/MenuItemSetFemale";
hContactMenuFemale = Menu_AddContactMenuItem(&mi);