diff win/dw.c @ 2240:7f6939857cca

Win: Added dw_window_set_color() support for Rich Edit based MLE controls. Added foreground and background color comboboxes and callbacks to dwtest.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 18 Jan 2021 23:43:54 +0000
parents 3e9c5bff0a57
children 703023e1a644
line wrap: on
line diff
--- a/win/dw.c	Fri Jan 15 19:22:27 2021 +0000
+++ b/win/dw.c	Mon Jan 18 23:43:54 2021 +0000
@@ -5852,6 +5852,25 @@
          thisbox->cinfo.back = back;
       }
    }
+#ifdef RICHEDIT
+   else if (_tcsnicmp(tmpbuf, RICHEDIT_CLASS, _tcslen(RICHEDIT_CLASS)+1) == 0 ||
+            _tcsnicmp(tmpbuf, MSFTEDIT_CLASS, _tcslen(MSFTEDIT_CLASS)+1) == 0)
+   {
+        ULONG _fore = _internal_color(fore);
+        ULONG _back = _internal_color(back);
+        CHARFORMAT cf;
+
+        SendMessage(handle, EM_GETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf);
+        cf.cbSize = sizeof(cf);
+        cf.dwMask = CFM_COLOR;
+        cf.dwEffects = 0;
+        cf.crTextColor = RGB(DW_RED_VALUE(_fore), DW_GREEN_VALUE(_fore), DW_BLUE_VALUE(_fore)); 
+        SendMessage(handle, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf);
+
+        SendMessage(handle, EM_SETBKGNDCOLOR, (back == DW_CLR_DEFAULT || back == DW_RGB_TRANSPARENT) ? 1 : 0, 
+                    RGB(DW_RED_VALUE(_back), DW_GREEN_VALUE(_back), DW_BLUE_VALUE(_back)));
+   }
+#endif
 
    if(cinfo || (cinfo = _dw_window_new_cinfo(handle, TRUE)))
    {