comparison win/dw.c @ 369:39983df2b93d

Updated the license information, and copyrights. Code to do background color text drawing on Windows. dw_color_background_set(DW_CLR_DEFAULT) will set background color to transparent.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 27 Apr 2003 18:34:48 +0000
parents 3a71623fc219
children e5156e7e5f19
comparison
equal deleted inserted replaced
368:72fbd1ee8150 369:39983df2b93d
2 /* 2 /*
3 * Dynamic Windows: 3 * Dynamic Windows:
4 * A GTK like implementation of the Win32 GUI 4 * A GTK like implementation of the Win32 GUI
5 * 5 *
6 * (C) 2000-2003 Brian Smith <dbsoft@technologist.com> 6 * (C) 2000-2003 Brian Smith <dbsoft@technologist.com>
7 * (C) 2003 Mark Hessling <m.hessling@qut.edu.au>
7 * 8 *
8 */ 9 */
9 #define _WIN32_IE 0x0500 10 #define _WIN32_IE 0x0500
10 #define WINVER 0x400 11 #define WINVER 0x400
11 #include <windows.h> 12 #include <windows.h>
414 } 415 }
415 416
416 /* Convert to our internal color scheme */ 417 /* Convert to our internal color scheme */
417 ULONG _internal_color(ULONG color) 418 ULONG _internal_color(ULONG color)
418 { 419 {
420 if(color == DW_CLR_DEFAULT)
421 return DW_RGB_TRANSPARENT;
419 if(color < 18) 422 if(color < 18)
420 return DW_RGB(_red[color], _green[color], _blue[color]); 423 return DW_RGB(_red[color], _green[color], _blue[color]);
421 return color; 424 return color;
422 } 425 }
423 426
3052 dwComctlVer = GetDllVersion(TEXT("comctl32.dll")); 3055 dwComctlVer = GetDllVersion(TEXT("comctl32.dll"));
3053 3056
3054 for(z=0;z<THREAD_LIMIT;z++) 3057 for(z=0;z<THREAD_LIMIT;z++)
3055 { 3058 {
3056 _foreground[z] = RGB(128,128,128); 3059 _foreground[z] = RGB(128,128,128);
3057 _background[z] = 0; 3060 _background[z] = DW_RGB_TRANSPARENT;
3058 _hPen[z] = CreatePen(PS_SOLID, 1, _foreground[z]); 3061 _hPen[z] = CreatePen(PS_SOLID, 1, _foreground[z]);
3059 _hBrush[z] = CreateSolidBrush(_foreground[z]); 3062 _hBrush[z] = CreateSolidBrush(_foreground[z]);
3060 } 3063 }
3061 3064
3062 return 0; 3065 return 0;
6856 mustdelete = 1; 6859 mustdelete = 1;
6857 } 6860 }
6858 } 6861 }
6859 oldFont = SelectObject(hdc, hFont); 6862 oldFont = SelectObject(hdc, hFont);
6860 SetTextColor(hdc, _foreground[threadid]); 6863 SetTextColor(hdc, _foreground[threadid]);
6861 SetBkMode(hdc, TRANSPARENT); 6864 if(_background[threadid] == DW_RGB_TRANSPARENT)
6865 SetBkMode(hdc, TRANSPARENT);
6866 else
6867 {
6868 SetBkMode(hdc, OPAQUE);
6869 SetBkColor(hdc, _background[threadid]);
6870 }
6862 TextOut(hdc, x, y, text, strlen(text)); 6871 TextOut(hdc, x, y, text, strlen(text));
6863 SelectObject(hdc, oldFont); 6872 SelectObject(hdc, oldFont);
6864 if(mustdelete) 6873 if(mustdelete)
6865 DeleteObject(hFont); 6874 DeleteObject(hFont);
6866 if(!pixmap) 6875 if(!pixmap)