Mercurial > dwindows
comparison win/dw.c @ 1997:0e354f2edb16
Win: Fixed a number of Visual C warnings show in the IDE.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 24 Oct 2019 23:57:51 +0000 |
parents | 197f9463efa8 |
children | 4e808c4cadfb |
comparison
equal
deleted
inserted
replaced
1996:289a8ca4855b | 1997:0e354f2edb16 |
---|---|
1336 /* This function finds the first widget in the | 1336 /* This function finds the first widget in the |
1337 * layout and moves the current focus to it. | 1337 * layout and moves the current focus to it. |
1338 */ | 1338 */ |
1339 void _initial_focus(HWND handle) | 1339 void _initial_focus(HWND handle) |
1340 { | 1340 { |
1341 Box *thisbox; | 1341 Box *thisbox = NULL; |
1342 TCHAR tmpbuf[100] = {0}; | 1342 TCHAR tmpbuf[100] = {0}; |
1343 | 1343 |
1344 if(!handle) | 1344 if(!handle) |
1345 return; | 1345 return; |
1346 | 1346 |
2772 { | 2772 { |
2773 LRESULT ret; | 2773 LRESULT ret; |
2774 | 2774 |
2775 if(!cinfo || !cinfo->pOldProc) | 2775 if(!cinfo || !cinfo->pOldProc) |
2776 ret = DefWindowProc(hWnd, msg, mp1, mp2); | 2776 ret = DefWindowProc(hWnd, msg, mp1, mp2); |
2777 ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); | 2777 else |
2778 ret = CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); | |
2778 | 2779 |
2779 /* Tell the edit control that a buttonpress has | 2780 /* Tell the edit control that a buttonpress has |
2780 * occured and to update it's window title. | 2781 * occured and to update it's window title. |
2781 */ | 2782 */ |
2782 if(cinfo && cinfo->buddy) | 2783 if(cinfo && cinfo->buddy) |
3123 (!thiscinfo || (thiscinfo && (thiscinfo->back == -1 || thiscinfo->back == DW_RGB_TRANSPARENT)))) | 3124 (!thiscinfo || (thiscinfo && (thiscinfo->back == -1 || thiscinfo->back == DW_RGB_TRANSPARENT)))) |
3124 { | 3125 { |
3125 if(!(msg == WM_CTLCOLORSTATIC && SendMessage((HWND)mp2, STM_GETIMAGE, IMAGE_BITMAP, 0))) | 3126 if(!(msg == WM_CTLCOLORSTATIC && SendMessage((HWND)mp2, STM_GETIMAGE, IMAGE_BITMAP, 0))) |
3126 { | 3127 { |
3127 SetBkColor((HDC)mp1, _dw_transparencykey); | 3128 SetBkColor((HDC)mp1, _dw_transparencykey); |
3128 if(thiscinfo->hbrush) | 3129 if(thiscinfo && thiscinfo->hbrush) |
3129 DeleteObject(thiscinfo->hbrush); | 3130 DeleteObject(thiscinfo->hbrush); |
3130 thiscinfo->hbrush = CreateSolidBrush(_dw_transparencykey); | 3131 thiscinfo->hbrush = CreateSolidBrush(_dw_transparencykey); |
3131 SelectObject((HDC)mp1, thiscinfo->hbrush); | 3132 SelectObject((HDC)mp1, thiscinfo->hbrush); |
3132 return (LRESULT)thiscinfo->hbrush; | 3133 return (LRESULT)thiscinfo->hbrush; |
3133 } | 3134 } |
5138 *height = thisheight + extraheight; | 5139 *height = thisheight + extraheight; |
5139 | 5140 |
5140 /* Free temporary bitmaps */ | 5141 /* Free temporary bitmaps */ |
5141 if(ii.hbmColor) | 5142 if(ii.hbmColor) |
5142 DeleteObject(ii.hbmColor); | 5143 DeleteObject(ii.hbmColor); |
5143 if(ii.hbmMask); | 5144 if(ii.hbmMask) |
5144 DeleteObject(ii.hbmMask); | 5145 DeleteObject(ii.hbmMask); |
5145 } | 5146 } |
5146 | 5147 |
5147 /* | 5148 /* |
5148 * Sets the font used by a specified window (widget) handle. | 5149 * Sets the font used by a specified window (widget) handle. |
5180 strcpy(cinfo->fontname, fontname); | 5181 strcpy(cinfo->fontname, fontname); |
5181 if(!oldfont) | 5182 if(!oldfont) |
5182 oldfont = cinfo->hfont; | 5183 oldfont = cinfo->hfont; |
5183 cinfo->hfont = hfont; | 5184 cinfo->hfont = hfont; |
5184 } | 5185 } |
5185 else | 5186 else if(cinfo = calloc(1, sizeof(ColorInfo))) |
5186 { | 5187 { |
5187 cinfo = calloc(1, sizeof(ColorInfo)); | |
5188 cinfo->fore = cinfo->back = -1; | 5188 cinfo->fore = cinfo->back = -1; |
5189 | 5189 |
5190 strncpy(cinfo->fontname, fontname, 127); | 5190 strncpy(cinfo->fontname, fontname, 127); |
5191 | 5191 |
5192 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); | 5192 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); |
5352 if(cinfo) | 5352 if(cinfo) |
5353 { | 5353 { |
5354 cinfo->fore = fore; | 5354 cinfo->fore = fore; |
5355 cinfo->back = back; | 5355 cinfo->back = back; |
5356 } | 5356 } |
5357 else | 5357 else if(cinfo = calloc(1, sizeof(ColorInfo))) |
5358 { | 5358 { |
5359 cinfo = calloc(1, sizeof(ColorInfo)); | |
5360 | |
5361 cinfo->fore = fore; | 5359 cinfo->fore = fore; |
5362 cinfo->back = back; | 5360 cinfo->back = back; |
5363 | 5361 |
5364 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); | 5362 cinfo->pOldProc = SubclassWindow(handle, _colorwndproc); |
5365 SetWindowLongPtr(handle, GWLP_USERDATA, (LONG_PTR)cinfo); | 5363 SetWindowLongPtr(handle, GWLP_USERDATA, (LONG_PTR)cinfo); |