summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/delphi/m_api.pas12
-rw-r--r--include/delphi/m_helpers.inc31
-rw-r--r--include/delphi/m_iconheader.inc54
-rw-r--r--include/delphi/m_skin.inc3
-rw-r--r--include/m_extraicons.h4
-rw-r--r--include/m_icolib.h6
-rw-r--r--include/m_iconheader.h79
-rw-r--r--include/m_jabber.h4
-rw-r--r--include/m_skin.h1
-rw-r--r--include/newpluginapi.h13
10 files changed, 30 insertions, 177 deletions
diff --git a/include/delphi/m_api.pas b/include/delphi/m_api.pas
index 66cefac276..6237eaaa56 100644
--- a/include/delphi/m_api.pas
+++ b/include/delphi/m_api.pas
@@ -142,13 +142,19 @@ type
type
PCMPlugin = ^CMPlugin;
- CMPlugin = record
+ CMPlugin = packed record
vft : pointer; // virtual function table
+
m_hInst : THANDLE;
m_szModule : PAnsiChar;
m_pInfo : PPLUGININFOEX;
m_hLogger : THANDLE;
- m_hLang : int;
+
+ blabla1 : pointer; // emulator of icon's list
+ blabla2 : integer;
+ blabla3 : integer;
+ blabla4 : integer;
+ blabla5 : pointer;
end;
//----- Fork enchancement -----
@@ -219,7 +225,6 @@ var
{$include m_history.inc}
{$include m_hotkeys.inc}
{$include m_icolib.inc}
- {$include m_iconheader.inc}
{$include m_ignore.inc}
{$include m_imgsrvc.inc}
{$include m_json.inc}
@@ -253,6 +258,7 @@ implementation
initialization
g_plugin.m_hInst := hInstance;
g_plugin.m_pInfo := @PluginInfo;
+ g_plugin.blabla4 := 10;
RegisterPlugin(g_plugin);
finalization
diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc
index 1b1d95c378..d240073501 100644
--- a/include/delphi/m_helpers.inc
+++ b/include/delphi/m_helpers.inc
@@ -57,9 +57,6 @@ function TopToolbar_AddButton(pButton:PTTBButton):THANDLE;
function Options_Open(group,page,tab:PWideChar):int_ptr;
-procedure MIcoTab_AddItem (hwnd:HWND; lptzName:PAnsiChar; hIcon:HICON; data:LPARAM; bSharedIcon:bool);
-procedure MIcoTab_AddItemW(hwnd:HWND; lptzName:PWideChar; hIcon:HICON; data:LPARAM; bSharedIcon:bool);
-
{$ELSE}
function _Srmm_AddButton(bbdi:pBBButton; pPlugin:Pointer) : integer; stdcall;
@@ -335,34 +332,6 @@ begin
result:=_Options_Open(group,page,tab,@g_plugin);
end;
-procedure MIcoTab_AddItem(hwnd:HWND; lptzName:PAnsiChar; hIcon:HICON; data:LPARAM; bSharedIcon:bool);
-var
- mit:tMIcoTab;
-begin
- if bSharedIcon then
- mit.flag := MITCF_SHAREDICON
- else
- mit.flag := 0;
- mit.hIcon := hIcon;
- mit.szName.a := lptzName;
- mit.data := data;
- SendMessage(hwnd, ITCM_ADDITEM, WPARAM(@mit), 0);
-end;
-
-procedure MIcoTab_AddItemW(hwnd:HWND; lptzName:PWideChar; hIcon:HICON; data:LPARAM; bSharedIcon:bool);
-var
- mit:tMIcoTab;
-begin
- if bSharedIcon then
- mit.flag := MITCF_SHAREDICON or MITCF_UNICODE
- else
- mit.flag := MITCF_UNICODE;
- mit.hIcon := hIcon;
- mit.szName.w := lptzName;
- mit.data := data;
- SendMessage(hwnd, ITCM_ADDITEM, WPARAM(@mit), 0);
-end;
-
procedure Srmm_AddButton(bbdi:pBBButton);
begin
_Srmm_AddButton(bbdi,@g_plugin);
diff --git a/include/delphi/m_iconheader.inc b/include/delphi/m_iconheader.inc
deleted file mode 100644
index ad1633d6b6..0000000000
--- a/include/delphi/m_iconheader.inc
+++ /dev/null
@@ -1,54 +0,0 @@
-{
-Miranda IM: the free IM client for Microsoft* Windows*
-
-Copyright 2007 Artem Shpynov
-Copyright 2000-2007 Miranda ICQ/IM project,
-
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-}
-
-{$IFNDEF M_ICONHEADER}
-{$DEFINE M_ICONHEADER}
-
-const
- MIRANDAICOTABCLASS = 'MirandaIcoTabClass';
-
- MITCF_SHAREDICON = $01;
- MITCF_UNICODE = $02;
-
- ITCM_FIRST = (WM_USER+1024);
- ITCM_LAST = (ITCM_FIRST+64);
-
- ITCM_SETBACKGROUND = (ITCM_FIRST+1); //LPARAM is HBITMAP
- ITCM_ADDITEM = (ITCM_FIRST+2); //LPARAM is pointer to MIcoTab
- ITCM_SETSEL = (ITCM_FIRST+3); //WPARAM is new selected index
- ITCM_GETSEL = (ITCM_FIRST+4); //result is selected item index
- ITCM_GETITEMDATA = (ITCM_FIRST+5); //WPARAM is item index, result is custom data
-
- ITCN_SELCHANGED = 1;
- ITCN_SELCHANGEDKBD = 2;
-// structure is used for storing info about single tab
-type
- TMIcoTab = record
- hIcon :HICON;
- szName:TChar;
- flag :dword;
- data :LPARAM;
- end;
-
-{$ENDIF}
diff --git a/include/delphi/m_skin.inc b/include/delphi/m_skin.inc
index b1cf7e3acc..27c3d8a86e 100644
--- a/include/delphi/m_skin.inc
+++ b/include/delphi/m_skin.inc
@@ -95,9 +95,6 @@ function Skin_LoadIcon(iconId:int; big:byte) : HICON; stdcall;
function Skin_GetIconHandle(iconId:int) : THANDLE; stdcall;
external AppDLL name 'Skin_GetIconHandle';
-function Skin_GetIconName(iconId:int) : PAnsiChar; stdcall;
- external AppDLL name 'Skin_GetIconName';
-
// status mode icons. NOTE: These are deprecated in favour of LoadSkinnedProtoIcon()
const
SKINICON_STATUS_OFFLINE = 0;
diff --git a/include/m_extraicons.h b/include/m_extraicons.h
index 30f306b1f4..d5a4c39ee9 100644
--- a/include/m_extraicons.h
+++ b/include/m_extraicons.h
@@ -109,10 +109,10 @@ EXTERN_C MIR_APP_DLL(void) KillModuleExtraIcons(HPLUGIN pPlugin);
#define EIF_DISABLED_BY_DEFAULT 0x0001
-EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const char *description, const char *descIcon,
+EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const char *description, HANDLE descIcon,
MIRANDAHOOK RebuildIcons, MIRANDAHOOK ApplyIcon, MIRANDAHOOKPARAM OnClick = nullptr, LPARAM onClickParam = 0, int flags = 0);
-EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const char *description, const char *descIcon = nullptr,
+EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const char *description, HANDLE descIcon = nullptr,
MIRANDAHOOKPARAM OnClick = nullptr, LPARAM onClickParam = 0, int flags = 0);
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/include/m_icolib.h b/include/m_icolib.h
index b63fc4abf0..e8a0ec3704 100644
--- a/include/m_icolib.h
+++ b/include/m_icolib.h
@@ -111,6 +111,12 @@ MIR_APP_DLL(void) Window_SetProtoIcon_IcoLib(HWND hWnd, const char *szProto, i
MIR_APP_DLL(void) Window_FreeIcon_IcoLib(HWND hWnd);
///////////////////////////////////////////////////////////////////////////////
+// Helper to add an icolib's icon to a HIMAGELIST
+
+MIR_APP_DLL(int) ImageList_AddSkinIcon(HIMAGELIST hIml, int iconId);
+MIR_APP_DLL(int) ImageList_AddProtoIcon(HIMAGELIST hIml, const char *szProto, int iconId);
+
+///////////////////////////////////////////////////////////////////////////////
// Icons' change notification event
#define ME_SKIN_ICONSCHANGED "Skin/IconsChanged"
diff --git a/include/m_iconheader.h b/include/m_iconheader.h
deleted file mode 100644
index 48355c2ef5..0000000000
--- a/include/m_iconheader.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (C) 2012-19 Miranda NG team (https://miranda-ng.org)
-Copyright (c) 2000-2007 Miranda ICQ/IM project,
-Copyright (c) 2007 Artem Shpynov
-
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#ifndef M_ICONHEADER_H__
-#define M_ICONHEADER_H__ 1
-
-#define MIRANDAICOTABCLASS L"MirandaIcoTabClass"
-
-#define MITCF_SHAREDICON 0x01
-#define MITCF_UNICODE 0x02
-
-#define ITCM_FIRST (WM_USER+1024)
-#define ITCM_LAST (ITCM_FIRST+64)
-
-#define ITCM_SETBACKGROUND (ITCM_FIRST+1) //LPARAM is HBITMAP
-#define ITCM_ADDITEM (ITCM_FIRST+2) //LPARAM is pointer to MIcoTab
-#define ITCM_SETSEL (ITCM_FIRST+3) //WPARAM is new selected index
-#define ITCM_GETSEL (ITCM_FIRST+4) //result is selected item index
-#define ITCM_GETITEMDATA (ITCM_FIRST+5) //WPARAM is item index, result is custom data
-
-#define ITCN_SELCHANGED 1
-#define ITCN_SELCHANGEDKBD 2
-
-// structure is used for storing info about single tab
-typedef struct {
- HICON hIcon;
- union {
- wchar_t *tcsName;
- wchar_t *lptzName;
- char *lpzName;
- wchar_t *lpwzName;
- };
- DWORD flag;
- LPARAM data;
-} MIcoTab;
-
-#define MIcoTab_SetBackground(hwnd, hBmp) \
- (SendMessage((hwnd), ITCM_SETBACKGROUND, 0, (LPARAM)(hBmp)))
-#define MIcoTab_SetSel(hwnd, idx) \
- (SendMessage((hwnd), ITCM_SETSEL, (idx), 0))
-#define MIcoTab_GetSel(hwnd) \
- (SendMessage((hwnd), ITCM_GETSEL, 0, 0))
-#define MIcoTab_GetItemData(hwnd, idx) \
- (SendMessage((hwnd), ITCM_GETITEMDATA, (idx), 0))
-
-static __forceinline void MIcoTab_AddItem(HWND hwnd, wchar_t *lptzName, HICON hIcon, LPARAM data, BOOL bSharedIcon)
-{
- MIcoTab mit = {0};
- mit.flag = (bSharedIcon?MITCF_SHAREDICON:0)| MITCF_UNICODE;
- mit.hIcon = hIcon;
- mit.tcsName = lptzName;
- mit.data = data;
- SendMessage(hwnd, ITCM_ADDITEM, (WPARAM)&mit, 0);
-}
-
-#endif // M_ICONHEADER_H__
diff --git a/include/m_jabber.h b/include/m_jabber.h
index fdb865ec6b..c2e91e9833 100644
--- a/include/m_jabber.h
+++ b/include/m_jabber.h
@@ -129,10 +129,6 @@ struct IJabberInterface
// Registers incoming <iq/> handler. iIqTypes is a combination of JABBER_IQ_TYPE_* flags. Returns handler handle on success or NULL on error.
virtual HJHANDLER STDMETHODCALLTYPE AddIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, LPCSTR szXmlns, LPCSTR szTag, void *pUserData = nullptr, int iPriority = JH_PRIORITY_DEFAULT) = 0;
- // Registers temporary handler for incoming <iq/> stanza of type iIqType with id iIqId. iIqTypes is a combination of JABBER_IQ_TYPE_* flags. Returns handler handle on success or NULL on error.
- // If dwTimeout milliseconds pass and no Iq stanza with the specified iIqId is received, Jabber plugin will call Func() with NULL node.
- virtual HJHANDLER STDMETHODCALLTYPE AddTemporaryIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, int iIqId, void *pUserData = nullptr, DWORD dwTimeout = 30000, int iPriority = JH_PRIORITY_DEFAULT) = 0;
-
// Registers handler for outgoing nodes. Returns handler handle on success or NULL on error.
// Return FALSE in the handler to continue, or TRUE to abort sending.
virtual HJHANDLER STDMETHODCALLTYPE AddSendHandler(JABBER_HANDLER_FUNC Func, void *pUserData = nullptr, int iPriority = JH_PRIORITY_DEFAULT) = 0;
diff --git a/include/m_skin.h b/include/m_skin.h
index 33f110e017..5d0e7f05bb 100644
--- a/include/m_skin.h
+++ b/include/m_skin.h
@@ -96,7 +96,6 @@
EXTERN_C MIR_APP_DLL(HICON) Skin_LoadIcon(int idx, bool big = false);
EXTERN_C MIR_APP_DLL(HANDLE) Skin_GetIconHandle(int idx);
-EXTERN_C MIR_APP_DLL(char*) Skin_GetIconName(int idx);
// status mode icons. NOTE: These are deprecated in favour of LoadSkinProtoIcon()
#define SKINICON_STATUS_OFFLINE 0
diff --git a/include/newpluginapi.h b/include/newpluginapi.h
index 32ed951999..153da7936e 100644
--- a/include/newpluginapi.h
+++ b/include/newpluginapi.h
@@ -25,6 +25,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef M_NEWPLUGINAPI_H__
#define M_NEWPLUGINAPI_H__
+#if !defined(HIMAGELIST)
+typedef struct _IMAGELIST* HIMAGELIST;
+#endif
+
#include <m_core.h>
#include <m_database.h>
@@ -151,6 +155,8 @@ typedef int(*pfnUninitProto)(PROTO_INTERFACE*);
#pragma warning(push)
#pragma warning(disable:4275)
+struct IcolibItem;
+
class MIR_APP_EXPORT CMPluginBase : public MNonCopyable
{
void tryOpenLog();
@@ -160,6 +166,7 @@ protected:
const char *m_szModuleName;
const PLUGININFOEX &m_pInfo;
HANDLE m_hLogger = nullptr;
+ LIST<IcolibItem> m_arIcons;
CMPluginBase(const char *moduleName, const PLUGININFOEX &pInfo);
~CMPluginBase();
@@ -172,6 +179,12 @@ public:
void debugLogA(LPCSTR szFormat, ...);
void debugLogW(LPCWSTR wszFormat, ...);
+ __forceinline void addIcolib(HANDLE hIcolib) { m_arIcons.insert((IcolibItem*)hIcolib); }
+ int addImgListIcon(HIMAGELIST himl, int iconId);
+ HICON getIcon(int iconId, bool big = false);
+ HANDLE getIconHandle(int iconId);
+ void releaseIcon(int iconId, bool big = false);
+
__forceinline const PLUGININFOEX& getInfo() const { return m_pInfo; }
__forceinline const char* getModule() const { return m_szModuleName; }