comparison os2/dw.c @ 1658:6fe1e91da477

Added DW_POINTER() macro for casting parameters to (void *) Fixed issues with calculating buttons sizes with icons instead of bitmaps on OS/2 and Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 16 Apr 2012 15:43:43 +0000
parents 3d4066aab4e0
children fc135161f2b1
comparison
equal deleted inserted replaced
1657:f7db576f6d17 1658:6fe1e91da477
5000 else 5000 else
5001 { 5001 {
5002 /* Handle bitmap buttons */ 5002 /* Handle bitmap buttons */
5003 if(dw_window_get_data(handle, "_dw_bitmapbutton")) 5003 if(dw_window_get_data(handle, "_dw_bitmapbutton"))
5004 { 5004 {
5005 WNDPARAMS wp; 5005 HPOINTER hpr = (HPOINTER)dw_window_get_data(handle, "_dw_button_icon");
5006 BTNCDATA bcd; 5006 HBITMAP hbm = 0;
5007 5007
5008 wp.fsStatus = WPM_CTLDATA; 5008 /* Handle case of icon resource */
5009 wp.cbCtlData = sizeof(BTNCDATA); 5009 if(hpr)
5010 wp.pCtlData = &bcd; 5010 {
5011 5011 POINTERINFO pi;
5012 /* Query the button's bitmap */ 5012
5013 if(WinSendMsg(handle, WM_QUERYWINDOWPARAMS, (MPARAM)&wp, MPVOID) && bcd.hImage) 5013 /* Get the internal HBITMAP handles */
5014 if(WinQueryPointerInfo(hpr, &pi))
5015 hbm = pi.hbmColor ? pi.hbmColor : pi.hbmPointer;
5016 }
5017
5018 /* If we didn't load it from the icon... */
5019 if(!hbm)
5020 {
5021 WNDPARAMS wp;
5022 BTNCDATA bcd;
5023
5024 wp.fsStatus = WPM_CTLDATA;
5025 wp.cbCtlData = sizeof(BTNCDATA);
5026 wp.pCtlData = &bcd;
5027
5028 /* Query the button's bitmap */
5029 if(WinSendMsg(handle, WM_QUERYWINDOWPARAMS, (MPARAM)&wp, MPVOID) && bcd.hImage)
5030 hbm = bcd.hImage;
5031 }
5032
5033 /* If we got a bitmap handle */
5034 if(hbm)
5014 { 5035 {
5015 BITMAPINFOHEADER2 bmp; 5036 BITMAPINFOHEADER2 bmp;
5016 bmp.cbFix = sizeof(BITMAPINFOHEADER2); 5037 bmp.cbFix = sizeof(BITMAPINFOHEADER2);
5017 /* Get the parameters of the bitmap */ 5038 /* Get the parameters of the bitmap */
5018 if(GpiQueryBitmapInfoHeader(bcd.hImage, &bmp)) 5039 if(GpiQueryBitmapInfoHeader(hbm, &bmp))
5019 { 5040 {
5020 thiswidth = bmp.cx; 5041 thiswidth = bmp.cx;
5021 thisheight = bmp.cy; 5042 thisheight = bmp.cy;
5022 } 5043 }
5023 } 5044 }