diff options
author | George Hazan <george.hazan@gmail.com> | 2023-12-20 16:43:14 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-12-20 16:43:14 +0300 |
commit | d80970d9b26b5e9b7868ec61349490da5e24dc64 (patch) | |
tree | 4f77d2094176eeaecfb99c9d7ad902124752503c /plugins | |
parent | 633f26707366cca4bd876d8f874f3ed116560e0d (diff) |
libTextControl: contact settings extracted to MTextSetProto
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/ExternalAPI/m_text.h | 9 | ||||
-rw-r--r-- | plugins/Popup/src/popup_wnd2.cpp | 5 |
2 files changed, 8 insertions, 6 deletions
diff --git a/plugins/ExternalAPI/m_text.h b/plugins/ExternalAPI/m_text.h index d6e948b673..4190a56dc5 100644 --- a/plugins/ExternalAPI/m_text.h +++ b/plugins/ExternalAPI/m_text.h @@ -61,7 +61,7 @@ enum MTEXTCONTROL_DLL(HANDLE) MTextRegister(const char *userTitle, uint32_t options);
// allocate text object (unicode)
-MTEXTCONTROL_DLL(HText) MTextCreateW(HANDLE userHandle, const char *szProto, const wchar_t *text);
+MTEXTCONTROL_DLL(HText) MTextCreateW(HANDLE userHandle, const wchar_t *text);
// allocate text object (advanced)
MTEXTCONTROL_DLL(HText) MTextCreateEx(HANDLE userHandle, const void *text, uint32_t flags);
@@ -81,11 +81,14 @@ MTEXTCONTROL_DLL(int) MTextActivate(HText text, bool bActivate = true); // wrapped text size is stored in sz, text
MTEXTCONTROL_DLL(int) MTextMeasure(HDC dc, SIZE *sz, HText text);
-// display text object
+// displays text object
// result = 1 (success), 0 (failure)
MTEXTCONTROL_DLL(int) MTextDisplay(HDC dc, POINT pos, SIZE sz, HText text);
-// set parent window for text object (this is required for mouse handling, etc)
+// sets a contact & protocol (optionally, for hContact == 0) for text object (required for valid stickers' processing)
+MTEXTCONTROL_DLL(int) MTextSetProto(HText text, MCONTACT hContact, const char *szProto = nullptr);
+
+// sets parent window for text object (this is required for mouse handling, etc)
MTEXTCONTROL_DLL(int) MTextSetParent(HText text, HWND hwnd);
// send message to an object
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index b6de298843..8a4c95ce08 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -740,10 +740,9 @@ void PopupWnd2::buildMText() m_mtText = m_mtTitle = nullptr;
if (m_lptzText && m_lptzTitle) {
- auto *szProto = Proto_GetBaseAccountName(m_hContact);
m_textType = TT_MTEXT;
- m_mtText = MTextCreateW(htuText, szProto, m_lptzText);
- m_mtTitle = MTextCreateW(htuTitle, szProto, m_lptzTitle);
+ m_mtText = MTextCreateW(htuText, m_lptzText); MTextSetProto(m_mtText, m_hContact);
+ m_mtTitle = MTextCreateW(htuTitle, m_lptzTitle); MTextSetProto(m_mtTitle, m_hContact);
}
}
|