summaryrefslogtreecommitdiff
path: root/include/m_icolib.h
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-14 13:17:26 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-14 13:17:26 +0000
commit02ed4455c23e3562d71bfc80a0e2c4fede8708f1 (patch)
tree115a3d24e4a3877cd28bd4ff2d9d4011b790cc5f /include/m_icolib.h
parentc72584d6b934b37dbd18d5f15ffb24a140e1e3f2 (diff)
- all icolib services removed;
- IcoLib_* functions are bound directly to the code git-svn-id: http://svn.miranda-ng.org/main/trunk@14161 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include/m_icolib.h')
-rw-r--r--include/m_icolib.h168
1 files changed, 49 insertions, 119 deletions
diff --git a/include/m_icolib.h b/include/m_icolib.h
index e738df1d89..42f0258ab7 100644
--- a/include/m_icolib.h
+++ b/include/m_icolib.h
@@ -36,17 +36,6 @@ extern int hLangpack;
// are translated by the core, which may lead to double translation.
// Use LPGEN instead which are just dummy wrappers/markers for "lpgen.pl".
-typedef struct {
- MAllStrings section; // section name used to group icons
- MAllStrings description; // description for options dialog
- char *pszName; // name to refer to icon when playing and in db
- MAllStrings defaultFile; // default icon file to use
- int iDefaultIndex; // index of icon in default file
- HICON hDefaultIcon; // handle to default icon
- int cx,cy; // dimensions of icon (if 0 then standard size icon (big and small options available)
- int flags; // combination of SIDF_*
-} SKINICONDESC;
-
#define SIDF_SORTED 0x01 // Icons in section are sorted by name
#define SIDF_UNICODE 0x100 // Section and Description are in UCS-2
#define SIDF_PATH_UNICODE 0x200 // Default File is in UCS-2
@@ -62,142 +51,83 @@ typedef struct {
#define SIDF_ALL_TCHAR 0
#endif
-MIR_APP_DLL(HICON) LoadSkinProtoIcon(const char *szProto, int status, bool big = false);
-MIR_APP_DLL(HICON) LoadSkinIcon(int idx, bool big = false);
-MIR_APP_DLL(HANDLE) GetSkinIconHandle(int idx);
-
-MIR_APP_DLL(HANDLE) IcoLib_AddNewIcon(int hLangpack, SKINICONDESC *sid);
-MIR_APP_DLL(HICON) IcoLib_GetIcon(const char* pszIconName, bool big);
-MIR_APP_DLL(HANDLE) IcoLib_GetIconHandle(const char* pszIconName);
-MIR_APP_DLL(HICON) IcoLib_GetIconByHandle(HANDLE hItem, bool big);
-MIR_APP_DLL(HANDLE) IcoLib_IsManaged(HICON hIcon);
-MIR_APP_DLL(int) IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big = false);
-
-MIR_APP_DLL(void) Button_SetIcon_IcoLib(HWND hDlg, int itemId, int iconId, const char* tooltip);
-MIR_APP_DLL(void) Button_FreeIcon_IcoLib(HWND hDlg, int itemId);
-
-MIR_APP_DLL(void) Window_SetIcon_IcoLib(HWND hWnd, int iconId);
-MIR_APP_DLL(void) Window_SetProtoIcon_IcoLib(HWND hWnd, const char *szProto, int iconId);
-MIR_APP_DLL(void) Window_FreeIcon_IcoLib(HWND hWnd);
-
-///////////////////////////////////////////////////////////////////////////////
-// Adds an icon into options UI
-//
-// wParam = (WPARAM)0
-// lParam = (LPARAM)(SKINICONDESC*)sid;
-// returns a handle to the newly added item
-
-__forceinline HANDLE Skin_AddIcon(SKINICONDESC* si)
-{ return (HANDLE)CallService("Skin2/Icons/AddIcon", hLangpack, (LPARAM)si);
-}
+struct SKINICONDESC
+{
+ MAllStrings section; // section name used to group icons
+ MAllStrings description; // description for options dialog
+ char *pszName; // name to refer to icon when playing and in db
+ MAllStrings defaultFile; // default icon file to use
+ int iDefaultIndex; // index of icon in default file
+ HICON hDefaultIcon; // handle to default icon
+ int cx, cy; // dimensions of icon (if 0 then standard size icon (big and small options available)
+ int flags; // combination of SIDF_*
+};
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
///////////////////////////////////////////////////////////////////////////////
-// Removes an icon from options UI
-//
-// wParam = (WPARAM)(HANDLE)hIcolib (optional)
-// lParam = (LPARAM)(char*)pszName (optional)
-// at least one needs to be specified
+// Adds an icon into the icon library
+// returns a handle to the newly added item
-#define MS_SKIN2_REMOVEICON "Skin2/Icons/RemoveIcon"
+MIR_APP_DLL(HANDLE) IcoLib_AddIcon(SKINICONDESC *sid, int _lang = hLangpack);
-__forceinline void Skin_RemoveIcon(const char* szIconName)
-{ CallService(MS_SKIN2_REMOVEICON, 0, (LPARAM)szIconName);
-}
+///////////////////////////////////////////////////////////////////////////////
+// Removes an icon from icon library by icon's name or handle
-__forceinline void Skin_RemoveIconHandle(HANDLE hIcolib)
-{ CallService(MS_SKIN2_REMOVEICON, (WPARAM)hIcolib, 0);
-}
+MIR_APP_DLL(void) IcoLib_RemoveIcon(const char *pszIconName);
+MIR_APP_DLL(void) IcoLib_RemoveIconByHandle(HANDLE hItem);
///////////////////////////////////////////////////////////////////////////////
-// Retrieves HICON with the name specified in lParam
-//
-// wParam = (WPARAM)0 - small 1 - big
-// lParam = (LPARAM)(char*)pszName
-// Returned HICON SHOULDN'T be destroyed, it is managed by IcoLib
+// Retrieves HICON with the name specified in lParam
+// Returned HICON SHOULDN'T be destroyed, it is managed by IcoLib
-#define MS_SKIN2_GETICON "Skin2/Icons/GetIcon"
-
-#ifdef __cplusplus
-__forceinline HICON Skin_GetIcon(const char* szIconName, int size=0)
-#else
-__forceinline HICON Skin_GetIcon(const char* szIconName, int size)
-#endif
-{ return (HICON)CallService(MS_SKIN2_GETICON, size, (LPARAM)szIconName);
-}
+MIR_APP_DLL(HICON) IcoLib_GetIcon(const char *pszIconName, bool big = false);
+MIR_APP_DLL(HICON) IcoLib_GetIconByHandle(HANDLE hItem, bool big = false);
///////////////////////////////////////////////////////////////////////////////
-// Retrieves an icolib handle by the icon's name specified in lParam
-//
-// wParam = (WPARAM)0
-// lParam = (LPARAM)(char*)pszName
+// Retrieves an icolib handle by the icon's name specified in lParam
-#define MS_SKIN2_GETICONHANDLE "Skin2/Icons/GetIconHandle"
-
-__forceinline HANDLE Skin_GetIconHandle(const char* szIconName)
-{ return (HANDLE)CallService(MS_SKIN2_GETICONHANDLE, 0, (LPARAM)szIconName);
-}
+MIR_APP_DLL(HANDLE) IcoLib_GetIconHandle(const char *pszIconName);
///////////////////////////////////////////////////////////////////////////////
-// Retrieves HICON with HANDLE specified in lParam
-//
-// wParam = (WPARAM)0 - small 1 - big
-// lParam = (LPARAM)(HANDLE)hIcoLibIcon
-// Returned HICON SHOULDN'T be destroyed, it is managed by IcoLib
-
-#define MS_SKIN2_GETICONBYHANDLE "Skin2/Icons/GetIconByHandle"
+// Adds 1 to an icon's ref counter. prevents an icon from being unloaded
-#ifdef __cplusplus
-__forceinline HICON Skin_GetIconByHandle(HANDLE hIcolibIcon, int size=0)
-#else
-__forceinline HICON Skin_GetIconByHandle(HANDLE hIcolibIcon, int size)
-#endif
-{ return (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, size, (LPARAM)hIcolibIcon);
-}
+MIR_APP_DLL(int) IcoLib_AddRef(HICON hIcon);
///////////////////////////////////////////////////////////////////////////////
-// Adds a reference to HICON
-//
-// wParam = (WPARAM)HICON
-// lParam = 0 - small 1 - big
+// Retrieved HICON is not needed anymore (releases a reference; thus helps to optimize GDI usage)
-#define MS_SKIN2_ADDREFICON "Skin2/Icons/AddRef"
+MIR_APP_DLL(int) IcoLib_Release(const char *pszIconName, bool big = false);
+MIR_APP_DLL(int) IcoLib_ReleaseIcon(HICON hIcon, bool big = false);
///////////////////////////////////////////////////////////////////////////////
-// Retrieved HICON is not needed anymore (releases a reference; thus helps to optimize GDI usage)
-//
-// wParam = (WPARAM)HICON (optional)
-// lParam = (LPARAM)(char*)pszName (optional) // at least one needs to be specified
-
-#define MS_SKIN2_RELEASEICON "Skin2/Icons/ReleaseIcon"
-#define MS_SKIN2_RELEASEICONBIG "Skin2/Icons/ReleaseIconBig"
+// Checks whether HICON is managed by IcoLib
-__forceinline void Skin_ReleaseIcon(const char* szIconName)
-{ CallService(MS_SKIN2_RELEASEICON, 0, (LPARAM)szIconName);
-}
+MIR_APP_DLL(HANDLE) IcoLib_IsManaged(HICON hIcon);
-#ifdef __cplusplus
-__forceinline void Skin_ReleaseIcon(const char* szIconName, int big)
-{ CallService((big) ? MS_SKIN2_RELEASEICONBIG : MS_SKIN2_RELEASEICON, 0, (LPARAM)szIconName);
-}
+///////////////////////////////////////////////////////////////////////////////
+// Helper to apply an icolib's icon to a button
-__forceinline void Skin_ReleaseIcon(HICON hIcon)
-#else
-__forceinline void Skin_ReleaseIcon2(HICON hIcon)
-#endif
-{ CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
-}
+MIR_APP_DLL(void) Button_SetIcon_IcoLib(HWND hDlg, int itemId, int iconId, const char* tooltip);
+MIR_APP_DLL(void) Button_FreeIcon_IcoLib(HWND hDlg, int itemId);
///////////////////////////////////////////////////////////////////////////////
-// Checks whether HICON is managed by IcoLib
-//
-// wParam = (WPARAM)HICON
-// lParam = 0
+// Helper to apply an icolib's icon to a window
-#define MS_SKIN2_ISMANAGEDICON "Skin2/Icons/IsManaged"
+MIR_APP_DLL(void) Window_SetIcon_IcoLib(HWND hWnd, int iconId);
+MIR_APP_DLL(void) Window_SetProtoIcon_IcoLib(HWND hWnd, const char *szProto, int iconId);
+MIR_APP_DLL(void) Window_FreeIcon_IcoLib(HWND hWnd);
///////////////////////////////////////////////////////////////////////////////
-// Icons' change notification
+// Icons' change notification event
#define ME_SKIN2_ICONSCHANGED "Skin2/IconsChanged"
+#if defined(__cplusplus)
+}
+#endif
+
#endif /* M_ICOLIB_H__ */