summaryrefslogtreecommitdiff
path: root/plugins/Quotes/src/IconLib.cpp
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/Quotes/src/IconLib.cpp
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/Quotes/src/IconLib.cpp')
-rw-r--r--plugins/Quotes/src/IconLib.cpp66
1 files changed, 16 insertions, 50 deletions
diff --git a/plugins/Quotes/src/IconLib.cpp b/plugins/Quotes/src/IconLib.cpp
index e7caa1fd36..ce7ad5cddc 100644
--- a/plugins/Quotes/src/IconLib.cpp
+++ b/plugins/Quotes/src/IconLib.cpp
@@ -3,7 +3,6 @@
#include <m_icolib.h>
#include "resource.h"
#include "EconomicRateInfo.h"
-// #include <newpluginapi.h>
#include <m_langpack.h>
#include <sstream>
#pragma warning (disable:4996)
@@ -11,52 +10,24 @@
#pragma warning (default:4996)
#include "ModuleInfo.h"
-// extern HMODULE g_hInstance;
-
-namespace
+static IconItem iconList[] =
{
- struct CIconList
- {
- char* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIconLibItem;
- };
-
- CIconList iconList[] =
- {
- { LPGEN("Protocol icon"), ICON_STR_MAIN, IDI_ICON_MAIN },
- { LPGEN("Quote/Rate up"), ICON_STR_QUOTE_UP, IDI_ICON_UP },
- { LPGEN("Quote/Rate down"), ICON_STR_QUOTE_DOWN, IDI_ICON_DOWN },
- { LPGEN("Quote/Rate not changed"), ICON_STR_QUOTE_NOT_CHANGED, IDI_ICON_NOTCHANGED },
- { LPGEN("Quote Section"), ICON_STR_SECTION, IDI_ICON_SECTION },
- { LPGEN("Quote"), ICON_STR_QUOTE, IDI_ICON_QUOTE },
- { LPGEN("Currency Converter"), ICON_STR_CURRENCY_CONVERTER, IDI_ICON_CURRENCY_CONVERTER },
- { LPGEN("Refresh"), ICON_STR_REFRESH, IDI_ICON_REFRESH },
- { LPGEN("Export"), ICON_STR_EXPORT, IDI_ICON_EXPORT },
- { LPGEN("Swap button"), ICON_STR_SWAP, IDI_ICON_SWAP },
- { LPGEN("Import"), ICON_STR_IMPORT, IDI_ICON_IMPORT }
- };
-}
+ { LPGEN("Protocol icon"), ICON_STR_MAIN, IDI_ICON_MAIN },
+ { LPGEN("Quote/Rate up"), ICON_STR_QUOTE_UP, IDI_ICON_UP },
+ { LPGEN("Quote/Rate down"), ICON_STR_QUOTE_DOWN, IDI_ICON_DOWN },
+ { LPGEN("Quote/Rate not changed"), ICON_STR_QUOTE_NOT_CHANGED, IDI_ICON_NOTCHANGED },
+ { LPGEN("Quote Section"), ICON_STR_SECTION, IDI_ICON_SECTION },
+ { LPGEN("Quote"), ICON_STR_QUOTE, IDI_ICON_QUOTE },
+ { LPGEN("Currency Converter"), ICON_STR_CURRENCY_CONVERTER, IDI_ICON_CURRENCY_CONVERTER },
+ { LPGEN("Refresh"), ICON_STR_REFRESH, IDI_ICON_REFRESH },
+ { LPGEN("Export"), ICON_STR_EXPORT, IDI_ICON_EXPORT },
+ { LPGEN("Swap button"), ICON_STR_SWAP, IDI_ICON_SWAP },
+ { LPGEN("Import"), ICON_STR_IMPORT, IDI_ICON_IMPORT }
+};
void Quotes_IconsInit()
{
- TCHAR szFile[MAX_PATH];
- ::GetModuleFileName(g_hInstance, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.cx = sid.cy = 16;
- sid.flags = SIDF_PATH_TCHAR;
- sid.pszSection = QUOTES_PROTOCOL_NAME;
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- std::string sName = Quotes_MakeIconName( iconList[i].szName);
- sid.pszName = const_cast<char*>(sName.c_str());
- sid.pszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIconLibItem = Skin_AddIcon(&sid);
- }
+ ::Icon_Register(g_hInstance, QUOTES_PROTOCOL_NAME, iconList, SIZEOF(iconList), QUOTES_PROTOCOL_NAME);
}
std::string Quotes_MakeIconName(const char* name)
@@ -78,14 +49,9 @@ HICON Quotes_LoadIconEx(const char* name,bool bBig /*= false*/)
HANDLE Quotes_GetIconHandle(int iconId)
{
- for(int i=0;i < SIZEOF(iconList);i++)
- {
+ for (int i=0; i < SIZEOF(iconList); i++)
if(iconList[i].defIconID == iconId)
- {
- return iconList[i].hIconLibItem;
- }
- }
+ return iconList[i].hIcolib;
return NULL;
}
-