From 16143e784b1697c4b5349bc888c97f7160cf4534 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 30 Oct 2023 14:26:08 +0300 Subject: mTextControl: code cleaning + stronger types --- plugins/ExternalAPI/m_text.h | 13 +++---------- plugins/Popup/src/popup_wnd2.h | 16 ++++++++-------- 2 files changed, 11 insertions(+), 18 deletions(-) (limited to 'plugins') diff --git a/plugins/ExternalAPI/m_text.h b/plugins/ExternalAPI/m_text.h index bc3fc25237..d6607e2eb1 100644 --- a/plugins/ExternalAPI/m_text.h +++ b/plugins/ExternalAPI/m_text.h @@ -6,12 +6,12 @@ #define MTM_SETUSER WM_USER #define MTM_UPDATE WM_USER+1 +typedef struct TextObject *HText; + #ifdef MTEXTCONTROL_EXPORTS #define MTEXTCONTROL_EXPORT __declspec(dllexport) - typedef struct TextObject *HText; #else #define MTEXTCONTROL_EXPORT __declspec(dllimport) - typedef HANDLE HText; #endif #define MTEXTCONTROL_DLL(T) MTEXTCONTROL_EXPORT T __stdcall @@ -46,13 +46,6 @@ enum MTEXT_FLG_RTF = 0x00000004, }; -struct MRtfProvider -{ - virtual CMStringA CreateRtfHeader() = 0; - virtual CMStringA CreateRtfBody() = 0; - virtual CMStringA CreateRtfFooter() = 0; -}; - // subscribe to MText services MTEXTCONTROL_DLL(HANDLE) MTextRegister(const char *userTitle, uint32_t options); @@ -60,7 +53,7 @@ MTEXTCONTROL_DLL(HANDLE) MTextRegister(const char *userTitle, uint32_t options); MTEXTCONTROL_DLL(HText) MTextCreateW(HANDLE userHandle, const char *szProto, const wchar_t *text); // allocate text object (advanced) -MTEXTCONTROL_DLL(HText) MTextCreateEx(HANDLE userHandle, void *text, uint32_t flags); +MTEXTCONTROL_DLL(HText) MTextCreateEx(HANDLE userHandle, const void *text, uint32_t flags); // destroys text object MTEXTCONTROL_DLL(int) MTextDestroy(HText text); diff --git a/plugins/Popup/src/popup_wnd2.h b/plugins/Popup/src/popup_wnd2.h index 7f381684ac..b72f2e3920 100644 --- a/plugins/Popup/src/popup_wnd2.h +++ b/plugins/Popup/src/popup_wnd2.h @@ -54,13 +54,13 @@ private: // content TextType m_textType; - wchar_t *m_lptzTitle, *m_lptzText; - HANDLE m_mtTitle, m_mtText; + wchar_t *m_lptzTitle, *m_lptzText; + HText m_mtTitle, m_mtText; bool m_bTextEmpty, m_bIcoLib; HFONT m_hfnTitle, m_hfnText; HICON m_hIcon; HBITMAP m_hbmAvatar; - wchar_t m_time[2 + 1 + 2 + 1]; + wchar_t m_time[2 + 1 + 2 + 1]; ActionInfo* m_actions; int m_actionCount; HANDLE m_hNotification; @@ -146,15 +146,15 @@ public: bool isTextEmpty() { return m_bTextEmpty; } bool isIcolib() { return m_bIcoLib; } TextType getTextType() { return m_textType; } - wchar_t *getText() { return m_lptzText; } - HANDLE getTextM() { return m_mtText; } - wchar_t *getTitle() { return m_lptzTitle; } - HANDLE getTitleM() { return m_mtTitle; } + wchar_t *getText() { return m_lptzText; } + HText getTextM() { return m_mtText; } + wchar_t *getTitle() { return m_lptzTitle; } + HText getTitleM() { return m_mtTitle; } int getActionCount() { return m_actionCount; } ActionInfo *getActions() { return m_actions; } - wchar_t *getTime() { return m_time; } + wchar_t *getTime() { return m_time; } HICON getIcon() { return m_hIcon; } MCONTACT getContact() { return m_hContact; } MCONTACT getContactPassed() { return m_hContactPassed; } -- cgit v1.2.3