diff options
author | George Hazan <george.hazan@gmail.com> | 2012-12-02 18:19:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-12-02 18:19:49 +0000 |
commit | c4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 (patch) | |
tree | 17a8627550b202d62df8e1df76d2585d3d0cdeaa /protocols/FacebookRM/src | |
parent | 5ea5feb7e052ca45af7bc9ed76e4a252bd71950d (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 'protocols/FacebookRM/src')
-rw-r--r-- | protocols/FacebookRM/src/theme.cpp | 76 |
1 files changed, 16 insertions, 60 deletions
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index 78e21a18f1..e29f5f727d 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -24,85 +24,41 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. extern OBJLIST<FacebookProto> g_Instances;
-struct
+static IconItem icons[] =
{
- const char* name;
- char* descr;
- int defIconID;
- const char* section;
-}
-static const icons[] =
-{
- { "facebook", LPGEN("Facebook Icon"), IDI_FACEBOOK },
- { "mind", LPGEN("Mind"), IDI_MIND },
+ { LPGEN("Facebook Icon"), "facebook", IDI_FACEBOOK },
+ { LPGEN("Mind"), "mind", IDI_MIND },
- { "authRevoke", LPGEN("Cancel friendship"), IDI_AUTH_REVOKE },
- { "authRevokeReq", LPGEN("Cancel friendship request"), IDI_AUTH_REVOKE },
- { "authAsk", LPGEN("Request friendship"), IDI_AUTH_ASK },
- { "authGrant", LPGEN("Approve friendship"), IDI_AUTH_GRANT },
+ { LPGEN("Cancel friendship"), "authRevoke", IDI_AUTH_REVOKE },
+ { LPGEN("Cancel friendship request"), "authRevokeReq", IDI_AUTH_REVOKE },
+ { LPGEN("Request friendship"), "authAsk", IDI_AUTH_ASK },
+ { LPGEN("Approve friendship"), "authGrant", IDI_AUTH_GRANT },
- { "homepage", LPGEN("Visit Profile"), 0, "core_main_2" },
+ { LPGEN("Visit Profile"), "homepage", 0 },
};
-static HANDLE hIconLibItem[SIZEOF(icons)];
-
// TODO: uninit
void InitIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInstance, szFile, SIZEOF(szFile));
-
- char setting_name[100];
- char section_name[100];
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.cx = sid.cy = 16;
- sid.pszName = setting_name;
- sid.pszSection = section_name;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i=0; i<SIZEOF(icons); i++)
- {
- if(icons[i].defIconID)
- {
- mir_snprintf(setting_name,sizeof(setting_name),"%s_%s","Facebook",icons[i].name);
-
- if (icons[i].section)
- {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s/%s",LPGEN("Protocols"),
- LPGEN("Facebook"), icons[i].section);
- } else {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s",LPGEN("Protocols"),
- LPGEN("Facebook"));
- }
-
- sid.pszDescription = (char*)icons[i].descr;
- sid.iDefaultIndex = -icons[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- } else { // External icons
- hIconLibItem[i] = Skin_GetIconHandle(icons[i].section);
- }
- }
+ Icon_Register(g_hInstance, "Protocols/Facebook", icons, SIZEOF(icons)-1, "Facebook");
+ icons[ SIZEOF(icons)-1 ].hIcolib = Skin_GetIconHandle("core_main_2");
}
HANDLE GetIconHandle(const char* name)
{
for(size_t i=0; i<SIZEOF(icons); i++)
- {
- if(strcmp(icons[i].name,name) == 0)
- return hIconLibItem[i];
- }
+ if(strcmp(icons[i].szName, name) == 0)
+ return icons[i].hIcolib;
+
return 0;
}
char *GetIconDescription(const char* name)
{
for(size_t i=0; i<SIZEOF(icons); i++)
- {
- if(strcmp(icons[i].name,name) == 0)
- return icons[i].descr;
- }
+ if(strcmp(icons[i].szName, name) == 0)
+ return icons[i].szDescr;
+
return "";
}
|