Changeset 601 for trunk/src/user32/new/oslibres.cpp
- Timestamp:
- Aug 20, 1999, 10:09:51 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/oslibres.cpp
r397 r601 1 /* $Id: oslibres.cpp,v 1. 4 1999-07-26 09:01:33sandervl Exp $ */1 /* $Id: oslibres.cpp,v 1.5 1999-08-20 20:09:51 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 18 18 19 19 #include <misc.h> 20 #include < oslibwin.h>21 #include "oslib style.h"20 #include <winconst.h> 21 #include "oslibwin.h" 22 22 #include "oslibutil.h" 23 23 #include "oslibmsg.h" … … 51 51 } 52 52 //****************************************************************************** 53 // todo: save mask handle somewhere54 //****************************************************************************** 55 HANDLE OSLibWin SetIcon(HWND hwnd, HANDLE hIcon,PVOID iconbitmap)53 //TODO: handle single icons 54 //****************************************************************************** 55 HANDLE OSLibWinCreateIcon(PVOID iconbitmap) 56 56 { 57 57 POINTERINFO pointerInfo = {0}; … … 60 60 BITMAPFILEHEADER2 *bfh; 61 61 HPS hps; 62 HANDLE hIcon; 62 63 63 64 if(iconbitmap == NULL) { 64 dprintf(("OSLibWin SetIcon %x %x: iconbitmap == NULL!!", hwnd, hIcon));65 dprintf(("OSLibWinCreateIcon iconbitmap == NULL!!")); 65 66 return 0; 66 67 } 67 if(hIcon == 0) { 68 //skip xor/and mask 69 bfh = (BITMAPFILEHEADER2 *)((char *)&bafh->bfh2 + sizeof(RGB2)*2 + sizeof(BITMAPFILEHEADER2)); 70 hps = WinGetPS(hwnd); 71 hbmColor = GpiCreateBitmap(hps, &bfh->bmp2, CBM_INIT, 72 (char *)bafh + bfh->offBits, 73 (BITMAPINFO2 *)&bfh->bmp2); 74 if(hbmColor == GPI_ERROR) { 75 dprintf(("OSLibWinSetIcon: GpiCreateBitmap failed!")); 76 WinReleasePS(hps); 77 return 0; 78 } 79 hbmMask = GpiCreateBitmap(hps, &bafh->bfh2.bmp2, CBM_INIT, 80 (char *)bafh + bafh->bfh2.offBits, 81 (BITMAPINFO2 *)&bafh->bfh2.bmp2); 82 if(hbmMask == GPI_ERROR) { 83 dprintf(("OSLibWinSetIcon: GpiCreateBitmap hbmMask failed!")); 84 WinReleasePS(hps); 85 return 0; 86 } 87 88 pointerInfo.fPointer = FALSE; //icon 89 pointerInfo.xHotspot = bfh->xHotspot; 90 pointerInfo.yHotspot = bfh->yHotspot; 91 pointerInfo.hbmColor = hbmColor; 92 pointerInfo.hbmPointer = hbmMask; 93 hIcon = WinCreatePointerIndirect(HWND_DESKTOP, &pointerInfo); 94 if(hIcon == NULL) { 95 dprintf(("WinSetIcon: WinCreatePointerIndirect failed!")); 96 GpiDeleteBitmap(hbmMask); 97 GpiDeleteBitmap(hbmColor); 98 WinReleasePS(hps); 99 } 100 } 101 WinSendMsg(hwnd, WM_SETICON, (MPARAM)hIcon, 0); 68 //skip xor/and mask 69 bfh = (BITMAPFILEHEADER2 *)((char *)&bafh->bfh2 + sizeof(RGB2)*2 + sizeof(BITMAPFILEHEADER2)); 70 hps = WinGetPS(HWND_DESKTOP); 71 hbmColor = GpiCreateBitmap(hps, &bfh->bmp2, CBM_INIT, 72 (char *)bafh + bfh->offBits, 73 (BITMAPINFO2 *)&bfh->bmp2); 74 if(hbmColor == GPI_ERROR) { 75 dprintf(("OSLibWinCreateIcon: GpiCreateBitmap failed!")); 76 WinReleasePS(hps); 77 return 0; 78 } 79 hbmMask = GpiCreateBitmap(hps, &bafh->bfh2.bmp2, CBM_INIT, 80 (char *)bafh + bafh->bfh2.offBits, 81 (BITMAPINFO2 *)&bafh->bfh2.bmp2); 82 if(hbmMask == GPI_ERROR) { 83 dprintf(("OSLibWinCreateIcon: GpiCreateBitmap hbmMask failed!")); 84 GpiDeleteBitmap(hbmColor); 85 WinReleasePS(hps); 86 return 0; 87 } 88 89 pointerInfo.fPointer = FALSE; //icon 90 pointerInfo.xHotspot = bfh->xHotspot; 91 pointerInfo.yHotspot = bfh->yHotspot; 92 pointerInfo.hbmColor = hbmColor; 93 pointerInfo.hbmPointer = hbmMask; 94 hIcon = WinCreatePointerIndirect(HWND_DESKTOP, &pointerInfo); 95 if(hIcon == NULL) { 96 dprintf(("OSLibWinCreateIcon: WinCreatePointerIndirect failed!")); 97 } 98 GpiDeleteBitmap(hbmMask); 99 GpiDeleteBitmap(hbmColor); 102 100 WinReleasePS(hps); 103 101 return hIcon; … … 105 103 //****************************************************************************** 106 104 //****************************************************************************** 107 105 HANDLE OSLibWinCreatePointer(PVOID cursorbitmap) 106 { 107 POINTERINFO pointerInfo = {0}; 108 HBITMAP hbmColor; 109 BITMAPFILEHEADER2 *bfh = (BITMAPFILEHEADER2 *)cursorbitmap; 110 HPS hps; 111 HANDLE hPointer; 112 113 if(cursorbitmap == NULL) { 114 dprintf(("OSLibWinCreatePointer cursorbitmap == NULL!!")); 115 return 0; 116 } 117 //skip xor/and mask 118 hps = WinGetPS(HWND_DESKTOP); 119 hbmColor = GpiCreateBitmap(hps, &bfh->bmp2, CBM_INIT, 120 (char *)bfh + bfh->offBits, 121 (BITMAPINFO2 *)&bfh->bmp2); 122 if(hbmColor == GPI_ERROR) { 123 dprintf(("OSLibWinCreatePointer: GpiCreateBitmap failed!")); 124 WinReleasePS(hps); 125 return 0; 126 } 127 128 pointerInfo.fPointer = TRUE; 129 pointerInfo.xHotspot = bfh->xHotspot; 130 pointerInfo.yHotspot = bfh->yHotspot; 131 pointerInfo.hbmColor = 0; 132 pointerInfo.hbmPointer = hbmColor; 133 hPointer = WinCreatePointerIndirect(HWND_DESKTOP, &pointerInfo); 134 if(hPointer == NULL) { 135 dprintf(("OSLibWinCreatePointer: WinCreatePointerIndirect failed!")); 136 } 137 GpiDeleteBitmap(hbmColor); 138 WinReleasePS(hps); 139 return hPointer; 140 } 141 //****************************************************************************** 142 //****************************************************************************** 143 HANDLE OSLibWinQuerySysIcon(ULONG type) 144 { 145 ULONG os2type = 0; 146 147 switch(type) { 148 case IDI_APPLICATION_W: 149 os2type = SPTR_PROGRAM; 150 break; 151 case IDI_HAND_W: 152 os2type = SPTR_ICONWARNING; 153 break; 154 case IDI_QUESTION_W: 155 os2type = SPTR_ICONQUESTION; 156 break; 157 case IDI_EXCLAMATION_W: 158 os2type = SPTR_ICONWARNING; 159 break; 160 case IDI_ASTERISK_W: 161 os2type = SPTR_ICONINFORMATION; 162 break; 163 default: 164 return 0; 165 } 166 167 return WinQuerySysPointer(HWND_DESKTOP, os2type, TRUE); 168 } 169 //****************************************************************************** 170 //****************************************************************************** 171 HANDLE OSLibWinQuerySysPointer(ULONG type) 172 { 173 ULONG os2type = 0; 174 175 switch(type) { 176 case IDC_ARROW_W: 177 os2type = SPTR_ARROW; 178 break; 179 case IDC_UPARROW_W: 180 os2type = SPTR_ARROW; 181 break; 182 case IDC_IBEAM_W: 183 os2type = SPTR_TEXT; 184 break; 185 case IDC_ICON_W: 186 os2type = SPTR_PROGRAM; 187 break; 188 case IDC_NO_W: 189 os2type = SPTR_ILLEGAL; 190 break; 191 case IDC_CROSS_W: 192 os2type = SPTR_MOVE; 193 break; 194 case IDC_SIZE_W: 195 os2type = SPTR_MOVE; 196 break; 197 case IDC_SIZEALL_W: 198 os2type = SPTR_MOVE; 199 break; 200 case IDC_SIZENESW_W: 201 os2type = SPTR_SIZENESW; 202 break; 203 case IDC_SIZENS_W: 204 os2type = SPTR_SIZENS; 205 break; 206 case IDC_SIZENWSE_W: 207 os2type = SPTR_SIZENWSE; 208 break; 209 case IDC_SIZEWE_W: 210 os2type = SPTR_SIZEWE; 211 break; 212 case IDC_WAIT_W: 213 os2type = SPTR_WAIT; 214 break; 215 case IDC_APPSTARTING_W: 216 os2type = SPTR_WAIT; 217 break; 218 case IDC_HELP_W: //TODO: Create a cursor for this one 219 os2type = SPTR_WAIT; 220 break; 221 default: 222 return 0; 223 } 224 return WinQuerySysPointer(HWND_DESKTOP, os2type, TRUE); 225 } 226 //****************************************************************************** 227 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.