summaryrefslogtreecommitdiff
path: root/plugins/OpenFolder/src
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/OpenFolder/src
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/OpenFolder/src')
-rw-r--r--plugins/OpenFolder/src/openFolder.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/plugins/OpenFolder/src/openFolder.cpp b/plugins/OpenFolder/src/openFolder.cpp
index 2fb3a4c8ae..98673b4c06 100644
--- a/plugins/OpenFolder/src/openFolder.cpp
+++ b/plugins/OpenFolder/src/openFolder.cpp
@@ -2,7 +2,7 @@
int hLangpack = 0;
HINSTANCE hInst;
-HANDLE hServiceOpenFolder, hButtonTopToolbar, hIconOpenFolder;
+HANDLE hServiceOpenFolder, hButtonTopToolbar;
PLUGININFOEX pluginInfoEx =
{
@@ -18,6 +18,8 @@ PLUGININFOEX pluginInfoEx =
MIID_OPENFOLDER // {10896143-7249-4b36-A408-6501A6B6035A}
};
+static IconItem icon = { LPGEN("Open Folder"), "open", IDI_FOLDER };
+
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
{
hInst = hinstDLL;
@@ -45,7 +47,7 @@ static int ToptoolBarHook(WPARAM wParam, LPARAM lParam)
{
TTBButton ttbb = { 0 };
ttbb.cbSize = sizeof( ttbb );
- ttbb.hIconHandleUp = hIconOpenFolder;
+ ttbb.hIconHandleUp = icon.hIcolib;
ttbb.pszService = MS_OPENFOLDER_OPEN;
ttbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttbb.name = LPGEN("Open Folder");
@@ -56,22 +58,9 @@ static int ToptoolBarHook(WPARAM wParam, LPARAM lParam)
static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
HookEvent(ME_TTB_MODULELOADED,ToptoolBarHook);
- TCHAR szFile[MAX_PATH];
- GetModuleFileName( hInst, szFile, MAX_PATH );
-
- char szSettingName[64];
- mir_snprintf(szSettingName, sizeof( szSettingName ), "%s_%s", OPENFOLDER_MODULE_NAME, "open");
-
+
// icolib (0.7+)
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_ALL_TCHAR;
- sid.cx = sid.cy = 16;
- sid.ptszSection = LPGENT("Open Folder");
- sid.pszName = szSettingName;
- sid.ptszDescription = LPGENT("Open Folder");
- sid.iDefaultIndex = -IDI_FOLDER;
- hIconOpenFolder = Skin_AddIcon(&sid);
+ Icon_Register(hInst, LPGEN("Open Folder"), &icon, 1, OPENFOLDER_MODULE_NAME);
// hotkeys service (0.8+)
HOTKEYDESC hotkey = { 0 };
@@ -87,7 +76,7 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 0x7FFFFFFF;
mi.flags = CMIF_ICONFROMICOLIB|CMIF_TCHAR;
- mi.icolibItem = hIconOpenFolder;
+ mi.icolibItem = icon.hIcolib;
mi.ptszName = LPGENT("Open Folder");
mi.pszService = MS_OPENFOLDER_OPEN;
Menu_AddMainMenuItem(&mi);