summaryrefslogtreecommitdiff
path: root/libs/mTextControl/src/textcontrol.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-20 16:43:14 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-20 16:43:14 +0300
commitd80970d9b26b5e9b7868ec61349490da5e24dc64 (patch)
tree4f77d2094176eeaecfb99c9d7ad902124752503c /libs/mTextControl/src/textcontrol.cpp
parent633f26707366cca4bd876d8f874f3ed116560e0d (diff)
libTextControl: contact settings extracted to MTextSetProto
Diffstat (limited to 'libs/mTextControl/src/textcontrol.cpp')
-rw-r--r--libs/mTextControl/src/textcontrol.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/libs/mTextControl/src/textcontrol.cpp b/libs/mTextControl/src/textcontrol.cpp
index f261094307..abc05f65e2 100644
--- a/libs/mTextControl/src/textcontrol.cpp
+++ b/libs/mTextControl/src/textcontrol.cpp
@@ -18,12 +18,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
+#include "FormattedTextDraw.h"
struct TextControlData
{
HANDLE htu;
wchar_t *text;
- struct TextObject *mtext;
+ TextObject *mtext;
COLORREF clBack = -1;
};
@@ -106,15 +107,21 @@ static LRESULT CALLBACK MTextControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case MTM_UPDATE:
if (data->text) delete[] data->text;
- if (data->mtext) MTextDestroy(data->mtext);
{
+ MCONTACT hContact = INVALID_CONTACT_ID;
+ if (data->mtext) {
+ hContact = data->mtext->hContact;
+ MTextDestroy(data->mtext);
+ }
+
int textLength = GetWindowTextLengthW(hwnd);
data->text = new wchar_t[textLength + 1];
GetWindowTextW(hwnd, data->text, textLength + 1);
- }
- data->mtext = MTextCreateW(data->htu, 0, data->text);
- MTextSetParent(data->mtext, hwnd);
+ data->mtext = MTextCreateW(data->htu, data->text);
+ MTextSetParent(data->mtext, hwnd);
+ MTextSetProto(data->mtext, hContact);
+ }
InvalidateRect(hwnd, nullptr, TRUE);
return TRUE;