summaryrefslogtreecommitdiff
path: root/plugins/Popup/src/icons.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/Popup/src/icons.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/Popup/src/icons.cpp')
-rw-r--r--plugins/Popup/src/icons.cpp102
1 files changed, 31 insertions, 71 deletions
diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp
index b1ee0142c0..7ea5b9d0fb 100644
--- a/plugins/Popup/src/icons.cpp
+++ b/plugins/Popup/src/icons.cpp
@@ -32,49 +32,40 @@ Last change by : $Author: Merlin_de $
#include "headers.h"
-struct
-{
- LPSTR pszName;
- LPSTR ptszDesc;
- LPSTR ptszSection;
- WORD idResource;
- LPSTR pszIcon;
- int size;
-}
-static icoDesc[] =
+static IconItem iconList[] =
{
//toolbar
- { ICO_TB_POPUP_ON, "Popups are enabled", SECT_TOLBAR, IDI_POPUP, NULL, 0 },
- { ICO_TB_POPUP_OFF, "Popups are disabled", SECT_TOLBAR, IDI_NOPOPUP, NULL, 0 },
+ { ICO_TB_POPUP_ON, "Popups are enabled", IDI_POPUP },
+ { ICO_TB_POPUP_OFF, "Popups are disabled", IDI_NOPOPUP },
//common popup
- { ICO_POPUP_ON, "Popups are enabled", SECT_POPUP, IDI_POPUP, NULL, 0 },
- { ICO_POPUP_OFF, "Popups are disabled", SECT_POPUP, IDI_NOPOPUP, NULL, 0 },
- { ICO_FAV, "With \"favourite\" overlay", SECT_POPUP, IDI_PU_FAVOURITE, NULL, 0 },
- { ICO_FULLSCREEN, "With \"fullscreen\" overlay", SECT_POPUP, IDI_PU_FULLSCREEN, NULL, 0 },
- { ICO_HISTORY, "Popup History", SECT_POPUP, IDI_HISTORY, NULL, -1 },
+ { ICO_POPUP_ON, "Popups are enabled", IDI_POPUP },
+ { ICO_POPUP_OFF, "Popups are disabled", IDI_NOPOPUP },
+ { ICO_FAV, "With \"favourite\" overlay", IDI_PU_FAVOURITE },
+ { ICO_FULLSCREEN, "With \"fullscreen\" overlay", IDI_PU_FULLSCREEN },
+ { ICO_HISTORY, "Popup History", IDI_HISTORY },
//option
- { ICO_OPT_RELOAD, "Refresh skin list", SECT_POPUP SECT_POPUP_OPT, IDI_RELOAD, NULL, 0 },
- { ICO_OPT_RESIZE, "Popup Placement", SECT_POPUP SECT_POPUP_OPT, IDI_RESIZE, NULL, 0 },
- { ICO_OPT_OK, "OK", SECT_POPUP SECT_POPUP_OPT, IDI_ACT_OK, NULL, 0 },
- { ICO_OPT_CANCEL, "Cancel", SECT_POPUP SECT_POPUP_OPT, IDI_ACT_CLOSE, NULL, 0 },
- { ICO_OPT_GROUP, "Popup Group", SECT_POPUP SECT_POPUP_OPT, IDI_OPT_GROUP, NULL, 0 },
- { ICO_OPT_DEF, "Show default", SECT_POPUP SECT_POPUP_OPT, IDI_ACT_OK, NULL, 0 },
- { ICO_OPT_FAV, "Favorite Contact", SECT_POPUP SECT_POPUP_OPT, IDI_OPT_FAVORITE, NULL, 0 },
- { ICO_OPT_FULLSCREEN, "Show in Fullscreen", SECT_POPUP SECT_POPUP_OPT, IDI_OPT_FULLSCREEN, NULL, 0 },
- { ICO_OPT_BLOCK, "Blocked Contact", SECT_POPUP SECT_POPUP_OPT, IDI_OPT_BLOCK, NULL, 0 },
+ { ICO_OPT_RELOAD, "Refresh skin list", IDI_RELOAD },
+ { ICO_OPT_RESIZE, "Popup Placement", IDI_RESIZE },
+ { ICO_OPT_OK, "OK", IDI_ACT_OK },
+ { ICO_OPT_CANCEL, "Cancel", IDI_ACT_CLOSE },
+ { ICO_OPT_GROUP, "Popup Group", IDI_OPT_GROUP },
+ { ICO_OPT_DEF, "Show default", IDI_ACT_OK },
+ { ICO_OPT_FAV, "Favorite Contact", IDI_OPT_FAVORITE },
+ { ICO_OPT_FULLSCREEN, "Show in Fullscreen", IDI_OPT_FULLSCREEN },
+ { ICO_OPT_BLOCK, "Blocked Contact", IDI_OPT_BLOCK },
//action
- { ICO_ACT_REPLY, "Quick Reply", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_REPLY, NULL, -1 },
- { ICO_ACT_PIN, "Pin Popup", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_PIN, NULL, -1 },
- { ICO_ACT_PINNED, "Pinned Popup", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_PINNED, NULL, -1 },
- { ICO_ACT_MESS, "Send Message", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_MESSAGE, NULL, -1 },
- { ICO_ACT_INFO, "User Details", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_INFO, NULL, -1 },
- { ICO_ACT_MENU, "Contact Menu", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_MENU, NULL, -1 },
- { ICO_ACT_ADD, "Add Contact Permanently", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_ADD, NULL, -1 },
- { ICO_ACT_CLOSE, "Dismiss Popup", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_CLOSE, NULL, -1 },
- { ICO_ACT_COPY, "Copy to clipboard", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_COPY, NULL, -1 }
+ { ICO_ACT_REPLY, "Quick Reply", IDI_ACT_REPLY },
+ { ICO_ACT_PIN, "Pin Popup", IDI_ACT_PIN },
+ { ICO_ACT_PINNED, "Pinned Popup", IDI_ACT_PINNED },
+ { ICO_ACT_MESS, "Send Message", IDI_ACT_MESSAGE },
+ { ICO_ACT_INFO, "User Details", IDI_ACT_INFO },
+ { ICO_ACT_MENU, "Contact Menu", IDI_ACT_MENU },
+ { ICO_ACT_ADD, "Add Contact Permanently", IDI_ACT_ADD },
+ { ICO_ACT_CLOSE, "Dismiss Popup", IDI_ACT_CLOSE },
+ { ICO_ACT_COPY, "Copy to clipboard", IDI_ACT_COPY }
};
@@ -84,6 +75,7 @@ static icoDesc[] =
* @param big - bool big icon (default = false)
* @return: HICON if the icon is loaded, NULL otherwise
**/
+
HICON IcoLib_GetIcon(LPCSTR pszIcon, bool big)
{
return (pszIcon) ? Skin_GetIcon(pszIcon, big) : NULL;
@@ -91,40 +83,8 @@ HICON IcoLib_GetIcon(LPCSTR pszIcon, bool big)
void InitIcons()
{
- TCHAR selfDLL[MAX_PATH];
- GetModuleFileName(hInst, selfDLL, SIZEOF(selfDLL));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.ptszDefaultFile = selfDLL;
-
- for(int i=0; i < SIZEOF(icoDesc); i++) {
- sid.pszName = icoDesc[i].pszName;
- sid.pszDescription = icoDesc[i].ptszDesc; // [TRANSLATED-BY-CORE]
- sid.pszSection = icoDesc[i].ptszSection; //must be always untranslatet !!!!!
- sid.iDefaultIndex = -icoDesc[i].idResource;
-
- switch (icoDesc[i].size){
- // small and big icons
- case -1:
- sid.cx = sid.cy = 0;
- break;
-
- // small icons (16x16)
- case 0:
- sid.cx = sid.cy = 16;
- break;
-
- // normal icons (32x32)
- case 1:
- sid.cx = sid.cy = 32;
- break;
-
- // custom icon size
- default:
- sid.cx = sid.cy = icoDesc[i].size;
- break;
- }
- Skin_AddIcon(&sid);
- }
+ Icon_Register(hInst, SECT_TOLBAR, iconList, 2);
+ Icon_Register(hInst, SECT_POPUP, iconList+2, 5);
+ Icon_Register(hInst, SECT_POPUP SECT_POPUP_OPT, iconList+7, 9);
+ Icon_Register(hInst, SECT_POPUP SECT_POPUP_ACT, iconList+16, 9);
}