From 1b705ec5e2e005c1d7c8503f6f914b232ece7484 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Mon, 25 Mar 2002 00:01:31 +0000 Subject: [PATCH] (from ) - use windowcolors settings for text backgroud/foreground color --- win/win32/mhtext.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/win/win32/mhtext.c b/win/win32/mhtext.c index 11c5ed214..0119918b9 100644 --- a/win/win32/mhtext.c +++ b/win/win32/mhtext.c @@ -14,6 +14,8 @@ typedef struct mswin_nethack_text_window { } NHTextWindow, *PNHTextWindow; static WNDPROC editControlWndProc = 0; +#define DEFAULT_COLOR_BG_TEXT COLOR_WINDOW +#define DEFAULT_COLOR_FG_TEXT COLOR_WINDOWTEXT BOOL CALLBACK NHTextWndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK NHEditHookWndProc(HWND, UINT, WPARAM, LPARAM); @@ -135,6 +137,21 @@ BOOL CALLBACK NHTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara } break; + case WM_CTLCOLORSTATIC: { /* sent by edit control before it is drawn */ + HDC hdcEdit = (HDC) wParam; + HWND hwndEdit = (HWND) lParam; + if( hwndEdit == GetDlgItem(hWnd, IDC_TEXT_CONTROL) ) { + SetBkColor(hdcEdit, + text_bg_brush ? text_bg_color : (COLORREF)GetSysColor(DEFAULT_COLOR_BG_TEXT) + ); + SetTextColor(hdcEdit, + text_fg_brush ? text_fg_color : (COLORREF)GetSysColor(DEFAULT_COLOR_FG_TEXT) + ); + return (BOOL)(text_bg_brush + ? text_bg_brush : SYSCLR_TO_BRUSH(DEFAULT_COLOR_BG_TEXT)); + } + } return FALSE; + case WM_DESTROY: if( data ) { if( data->window_text ) free(data->window_text);