Changeset 1739 for trunk/src/user32
- Timestamp:
- Nov 14, 1999, 5:35:58 PM (26 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/oslibwin.cpp
r1704 r1739 1 /* $Id: oslibwin.cpp,v 1.4 4 1999-11-11 13:17:29sandervl Exp $ */1 /* $Id: oslibwin.cpp,v 1.45 1999-11-14 16:35:54 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 433 433 BOOL OSLibWinEnableWindow(HWND hwnd, BOOL fEnable) 434 434 { 435 return WinEnableWindow(hwnd, fEnable); 435 BOOL rc; 436 HWND hwndClient; 437 438 rc = WinEnableWindow(hwnd, fEnable); 439 hwndClient = WinWindowFromID(hwnd, FID_CLIENT); 440 if(hwndClient) { 441 WinEnableWindow(hwndClient, fEnable); 442 } 443 return rc; 436 444 } 437 445 //****************************************************************************** -
trunk/src/user32/user32.cpp
r1704 r1739 1 /* $Id: user32.cpp,v 1.5 3 1999-11-11 13:17:30sandervl Exp $ */1 /* $Id: user32.cpp,v 1.54 1999-11-14 16:35:55 sandervl Exp $ */ 2 2 3 3 /* … … 1883 1883 DWORD WIN32API GetTabbedTextExtentA( HDC hDC, LPCSTR lpString, int nCount, int nTabPositions, LPINT lpnTabStopPositions) 1884 1884 { 1885 #ifdef DEBUG 1886 WriteLog("USER32: GetTabbedTextExtentA\n"); 1887 #endif 1885 dprintf2(("USER32: GetTabbedTextExtentA %x %s", hDC, lpString)); 1888 1886 return O32_GetTabbedTextExtent(hDC,lpString,nCount,nTabPositions,lpnTabStopPositions); 1889 1887 } … … 1895 1893 DWORD rc; 1896 1894 1897 #ifdef DEBUG 1898 WriteLog("USER32: GetTabbedTextExtentW\n"); 1899 #endif 1895 dprintf2(("USER32: GetTabbedTextExtentW %x %s", hDC, astring)); 1900 1896 rc = O32_GetTabbedTextExtent(hDC,astring,nCount,nTabPositions,lpnTabStopPositions); 1901 1897 FreeAsciiString(astring); … … 1924 1920 FreeAsciiString(astring); 1925 1921 return rc; 1926 }1927 1928 /* Icon Functions */1929 int WIN32API LookupIconIdFromDirectory(PBYTE presbits, BOOL fIcon)1930 {1931 #ifdef DEBUG1932 WriteLog("USER32: LookupIconIdFromDirectory, not implemented\n");1933 #endif1934 return(0);1935 }1936 //******************************************************************************1937 //******************************************************************************1938 int WIN32API LookupIconIdFromDirectoryEx(PBYTE presbits, BOOL fIcon,1939 int cxDesired, int cyDesired,1940 UINT Flags)1941 {1942 #ifdef DEBUG1943 WriteLog("USER32: LookupIconIdFromDirectoryEx, not implemented\n");1944 #endif1945 return(0);1946 1922 } 1947 1923 -
trunk/src/user32/win32dlg.cpp
r1704 r1739 1 /* $Id: win32dlg.cpp,v 1.3 3 1999-11-11 13:17:31sandervl Exp $ */1 /* $Id: win32dlg.cpp,v 1.34 1999-11-14 16:35:56 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Dialog Code for OS/2 … … 639 639 windowNameA = UnicodeToAsciiString((LPWSTR)info.windowName); 640 640 } 641 else windowNameA = (char *)info.windowName; 642 641 643 hwndCtrl = ::CreateWindowExA( info.exStyle | WS_EX_NOPARENTNOTIFY, 642 644 classNameA, … … 652 654 FreeAsciiString(classNameA); 653 655 } 654 if( windowNameA) {656 if(HIWORD(windowNameA)) { 655 657 FreeAsciiString(windowNameA); 656 658 } -
trunk/src/user32/win32wbase.cpp
r1733 r1739 1 /* $Id: win32wbase.cpp,v 1.8 3 1999-11-14 13:07:02sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.84 1999-11-14 16:35:56 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 2763 2763 case GWL_EXSTYLE: 2764 2764 value = dwExStyle; 2765 2765 break; 2766 2766 case GWL_STYLE: 2767 2767 value = dwStyle; 2768 2768 break; 2769 2769 case GWL_WNDPROC: 2770 2770 value = (ULONG)getWindowProc(); 2771 2771 break; 2772 2772 case GWL_HINSTANCE: 2773 2773 value = hInstance; 2774 2774 break; 2775 2775 case GWL_HWNDPARENT: 2776 2776 if(getParent()) { … … 2778 2778 } 2779 2779 else value = 0; 2780 2780 break; 2781 2781 case GWL_ID: 2782 2782 value = getWindowId(); 2783 2783 break; 2784 2784 case GWL_USERDATA: 2785 2785 value = userData; 2786 2786 break; 2787 2787 default: 2788 2788 if(index >= 0 && index/4 < nrUserWindowLong) 2789 2789 { 2790 2790 value = userWindowLong[index/4]; 2791 2791 break; 2792 2792 } 2793 2793 SetLastError(ERROR_INVALID_PARAMETER); -
trunk/src/user32/window.cpp
r1732 r1739 1 /* $Id: window.cpp,v 1.3 5 1999-11-14 12:00:01sandervl Exp $ */1 /* $Id: window.cpp,v 1.36 1999-11-14 16:35:58 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 1263 1263 } 1264 1264 dprintf(("WindowFromPoint (%d,%d) %x->1\n", point.x, point.y, hwndOS2)); 1265 return 1;1265 return windowDesktop->getWindowHandle(); 1266 1266 } 1267 1267 //****************************************************************************** -
trunk/src/user32/windowclass.cpp
r1733 r1739 1 /* $Id: windowclass.cpp,v 1. 5 1999-11-14 13:07:03sandervl Exp $ */1 /* $Id: windowclass.cpp,v 1.6 1999-11-14 16:35:58 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Class Code for OS/2 … … 298 298 Win32BaseWindow *wnd; 299 299 300 dprintf(("USER32: SetClassLongA \n"));300 dprintf(("USER32: SetClassLongA %x %d %x", hwnd, nIndex, lNewVal)); 301 301 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 302 302 if(!wnd) { … … 354 354 Win32BaseWindow *wnd; 355 355 356 dprintf(("USER32: GetClassLongA \n"));356 dprintf(("USER32: GetClassLongA %x %d", hwnd, nIndex)); 357 357 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 358 358 if(!wnd) { -
trunk/src/user32/winicon.cpp
r1576 r1739 1 /* $Id: winicon.cpp,v 1. 2 1999-11-03 19:51:44sandervl Exp $ */1 /* $Id: winicon.cpp,v 1.3 1999-11-14 16:35:58 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Icon Code for OS/2 … … 6 6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl) 7 7 * 8 * LookupIconIdFromDirectory(Ex) (+help functions) ported from Wine (991031) 9 * 10 * Copyright 1995 Alexandre Julliard 11 * 1996 Martin Von Loewis 12 * 1997 Alex Korobka 13 * 1998 Turchanov Sergey 8 14 * 9 15 * Project Odin Software License can be found in LICENSE.TXT … … 12 18 #include <os2win.h> 13 19 #include <winicon.h> 20 #include <win\cursoricon.h> 14 21 15 22 //****************************************************************************** … … 125 132 return O32_GetIconInfo(arg1, arg2); 126 133 } 127 //****************************************************************************** 128 //****************************************************************************** 134 /********************************************************************** 135 * CURSORICON_FindBestIcon 136 * 137 * Find the icon closest to the requested size and number of colors. 138 */ 139 static CURSORICONDIRENTRY *CURSORICON_FindBestIcon( CURSORICONDIR *dir, int width, 140 int height, int colors ) 141 { 142 int i; 143 CURSORICONDIRENTRY *entry, *bestEntry = NULL; 144 UINT iTotalDiff, iXDiff=0, iYDiff=0, iColorDiff; 145 UINT iTempXDiff, iTempYDiff, iTempColorDiff; 146 147 if (dir->idCount < 1) 148 { 149 dprintf(("Empty directory!\n" )); 150 return NULL; 151 } 152 if (dir->idCount == 1) return &dir->idEntries[0]; /* No choice... */ 153 154 /* Find Best Fit */ 155 iTotalDiff = 0xFFFFFFFF; 156 iColorDiff = 0xFFFFFFFF; 157 for (i = 0, entry = &dir->idEntries[0]; i < dir->idCount; i++,entry++) 158 { 159 iTempXDiff = abs(width - entry->ResInfo.icon.bWidth); 160 iTempYDiff = abs(height - entry->ResInfo.icon.bHeight); 161 162 if(iTotalDiff > (iTempXDiff + iTempYDiff)) 163 { 164 iXDiff = iTempXDiff; 165 iYDiff = iTempYDiff; 166 iTotalDiff = iXDiff + iYDiff; 167 } 168 } 169 170 /* Find Best Colors for Best Fit */ 171 for (i = 0, entry = &dir->idEntries[0]; i < dir->idCount; i++,entry++) 172 { 173 if(abs(width - entry->ResInfo.icon.bWidth) == iXDiff && 174 abs(height - entry->ResInfo.icon.bHeight) == iYDiff) 175 { 176 iTempColorDiff = abs(colors - entry->ResInfo.icon.bColorCount); 177 if(iColorDiff > iTempColorDiff) 178 { 179 bestEntry = entry; 180 iColorDiff = iTempColorDiff; 181 } 182 } 183 } 184 185 return bestEntry; 186 } 187 188 189 /********************************************************************** 190 * CURSORICON_FindBestCursor 191 * 192 * Find the cursor closest to the requested size. 193 * FIXME: parameter 'color' ignored and entries with more than 1 bpp 194 * ignored too 195 */ 196 static CURSORICONDIRENTRY *CURSORICON_FindBestCursor( CURSORICONDIR *dir, 197 int width, int height, int color) 198 { 199 int i, maxwidth, maxheight; 200 CURSORICONDIRENTRY *entry, *bestEntry = NULL; 201 202 if (dir->idCount < 1) 203 { 204 dprintf(("Empty directory!\n" )); 205 return NULL; 206 } 207 if (dir->idCount == 1) return &dir->idEntries[0]; /* No choice... */ 208 209 /* Double height to account for AND and XOR masks */ 210 211 height *= 2; 212 213 /* First find the largest one smaller than or equal to the requested size*/ 214 215 maxwidth = maxheight = 0; 216 for(i = 0,entry = &dir->idEntries[0]; i < dir->idCount; i++,entry++) 217 if ((entry->ResInfo.cursor.wWidth <= width) && (entry->ResInfo.cursor.wHeight <= height) && 218 (entry->ResInfo.cursor.wWidth > maxwidth) && (entry->ResInfo.cursor.wHeight > maxheight) && 219 (entry->wBitCount == 1)) 220 { 221 bestEntry = entry; 222 maxwidth = entry->ResInfo.cursor.wWidth; 223 maxheight = entry->ResInfo.cursor.wHeight; 224 } 225 if (bestEntry) return bestEntry; 226 227 /* Now find the smallest one larger than the requested size */ 228 229 maxwidth = maxheight = 255; 230 for(i = 0,entry = &dir->idEntries[0]; i < dir->idCount; i++,entry++) 231 if ((entry->ResInfo.cursor.wWidth < maxwidth) && (entry->ResInfo.cursor.wHeight < maxheight) && 232 (entry->wBitCount == 1)) 233 { 234 bestEntry = entry; 235 maxwidth = entry->ResInfo.cursor.wWidth; 236 maxheight = entry->ResInfo.cursor.wHeight; 237 } 238 239 return bestEntry; 240 } 241 /********************************************************************** 242 * LookupIconIdFromDirectoryEx16 (USER.364) 243 * 244 * FIXME: exact parameter sizes 245 */ 246 INT WIN32API LookupIconIdFromDirectoryEx(LPBYTE xdir, BOOL bIcon, 247 INT width, INT height, UINT cFlag ) 248 { 249 CURSORICONDIR *dir = (CURSORICONDIR*)xdir; 250 UINT retVal = 0; 251 252 dprintf(("LookupIconIdFromDirectoryEx %x %d (%d,%d)", xdir, bIcon, width, height)); 253 if( dir && !dir->idReserved && (dir->idType & 3) ) 254 { 255 CURSORICONDIRENTRY* entry; 256 HDC hdc; 257 UINT palEnts; 258 int colors; 259 hdc = GetDC(0); 260 palEnts = GetSystemPaletteEntries(hdc, 0, 0, NULL); 261 if (palEnts == 0) 262 palEnts = 256; 263 colors = (cFlag & LR_MONOCHROME) ? 2 : palEnts; 264 265 ReleaseDC(0, hdc); 266 267 if( bIcon ) 268 entry = CURSORICON_FindBestIcon( dir, width, height, colors ); 269 else 270 entry = CURSORICON_FindBestCursor( dir, width, height, 1); 271 272 if( entry ) retVal = entry->wResId; 273 } 274 else dprintf(("invalid resource directory\n")); 275 return retVal; 276 } 277 /********************************************************************** 278 * LookupIconIdFromDirectory (USER32.379) 279 */ 280 INT WIN32API LookupIconIdFromDirectory( LPBYTE dir, BOOL bIcon ) 281 { 282 return LookupIconIdFromDirectoryEx( dir, bIcon, 283 bIcon ? GetSystemMetrics(SM_CXICON) : GetSystemMetrics(SM_CXCURSOR), 284 bIcon ? GetSystemMetrics(SM_CYICON) : GetSystemMetrics(SM_CYCURSOR), bIcon ? 0 : LR_MONOCHROME ); 285 } 286 //****************************************************************************** 287 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.