- Timestamp:
- Feb 6, 2002, 6:23:21 PM (24 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 3 added
- 2 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/comboex.c
r7726 r7815 52 52 * mod 4 53 53 * 1. Implemented CBN_SELCHANGE, CBN_KILLFOCUS, and CBN_SELENDOK. 54 * 2. Fix putting text in CBEN_ENDEDIT notif ys for CBN_DROPDOWN case.54 * 2. Fix putting text in CBEN_ENDEDIT notifies for CBN_DROPDOWN case. 55 55 * 3. Lock image selected status to focus state of edit control if 56 56 * edit control exists. Mimics native actions. … … 87 87 #include "debugtools.h" 88 88 #include "wine/unicode.h" 89 #ifdef __WIN32OS2__90 #include "ccbase.h"91 #define inline92 #endif93 89 94 90 DEFAULT_DEBUG_CHANNEL(comboex); … … 116 112 typedef struct 117 113 { 118 #ifdef __WIN32OS2__119 COMCTL32_HEADER header;120 #endif121 114 HIMAGELIST himl; 122 115 HWND hwndSelf; /* my own hwnd */ … … 128 121 INT selected; /* index of selected item */ 129 122 DWORD flags; /* WINE internal flags */ 130 #ifdef __WIN32OS2__131 123 HFONT hDefaultFont; 132 #endif133 124 HFONT font; 134 135 125 INT nb_items; /* Number of items */ 136 126 BOOL bUnicode; /* TRUE if this window is Unicode */ … … 543 533 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); 544 534 545 TRACE("-- 0x%p\n", infoPtr->himl);535 TRACE("-- %p\n", infoPtr->himl); 546 536 547 537 return (LRESULT)infoPtr->himl; … … 1099 1089 1100 1090 /* allocate memory for info structure */ 1101 #ifdef __WIN32OS2__1102 infoPtr = (COMBOEX_INFO*)initControl(hwnd,sizeof(COMBOEX_INFO));1103 #else1104 1091 infoPtr = (COMBOEX_INFO *)COMCTL32_Alloc (sizeof(COMBOEX_INFO)); 1105 #endif1106 1092 if (infoPtr == NULL) { 1107 1093 ERR("could not allocate info memory!\n"); … … 1225 1211 SystemParametersInfoA (SPI_GETICONTITLELOGFONT, sizeof(mylogfont), 1226 1212 &mylogfont, 0); 1227 #ifdef __WIN32OS2__1228 1213 infoPtr->font = infoPtr->hDefaultFont = CreateFontIndirectA (&mylogfont); 1229 #else1230 infoPtr->font = CreateFontIndirectA (&mylogfont);1231 #endif1232 1214 } 1233 1215 SendMessageW (infoPtr->hwndCombo, WM_SETFONT, (WPARAM)infoPtr->font, 0); … … 1460 1442 dis->CtlType, dis->CtlID, dis->itemID, dis->hwndItem, dis->itemData); 1461 1443 1462 if ( (dis->itemID >= infoPtr->nb_items) || (dis->itemID < 0)) return FALSE;1444 if (dis->itemID >= infoPtr->nb_items) return FALSE; 1463 1445 1464 1446 olditem = infoPtr->items; … … 1770 1752 } 1771 1753 1772 #ifdef __WIN32OS2__1773 //NEVER delete the font object received by WM_SETFONT!1774 1754 if (infoPtr->hDefaultFont) DeleteObject (infoPtr->hDefaultFont); 1775 #else1776 DeleteObject (infoPtr->font);1777 #endif1778 1755 1779 1756 /* free comboex info data */ … … 2474 2451 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 2475 2452 uMsg, wParam, lParam); 2476 #ifdef __WIN32OS2__2477 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);2478 #else2479 2453 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 2480 #endif2481 2454 } 2482 2455 return 0; -
trunk/src/comctl32/comctl32.c
r7342 r7815 2 2 * Common controls functions 3 3 * 4 * Copyright 1997 Dimitrie O. Paun5 * Copyright 1998,2000 Eric Kohl6 *7 4 */ 8 5 9 #ifdef __WIN32OS2__ 10 #include <odin.h> 11 #endif 6 #include <windows.h> 7 #include <misc.h> 12 8 13 #include <string.h> 14 #include "winbase.h" 15 #include "heap.h" 16 #include "commctrl.h" 17 #include "debugtools.h" 18 #include "winerror.h" 19 #include "shlwapi.h" 20 #include "comctl32.h" 21 22 DEFAULT_DEBUG_CHANNEL(commctrl); 23 24 #ifndef __WIN32OS2__ 25 extern void ANIMATE_Register(void); 26 extern void ANIMATE_Unregister(void); 27 extern void COMBOEX_Register(void); 28 extern void COMBOEX_Unregister(void); 29 extern void DATETIME_Register(void); 30 extern void DATETIME_Unregister(void); 31 extern void FLATSB_Register(void); 32 extern void FLATSB_Unregister(void); 33 extern void HEADER_Register(void); 34 extern void HEADER_Unregister(void); 35 extern void HOTKEY_Register(void); 36 extern void HOTKEY_Unregister(void); 37 extern void IPADDRESS_Register(void); 38 extern void IPADDRESS_Unregister(void); 39 extern void LISTVIEW_Register(void); 40 extern void LISTVIEW_Unregister(void); 41 extern void MONTHCAL_Register(void); 42 extern void MONTHCAL_Unregister(void); 43 extern void NATIVEFONT_Register(void); 44 extern void NATIVEFONT_Unregister(void); 45 extern void PAGER_Register(void); 46 extern void PAGER_Unregister(void); 47 extern void PROGRESS_Register(void); 48 extern void PROGRESS_Unregister(void); 49 extern void REBAR_Register(void); 50 extern void REBAR_Unregister(void); 51 extern void STATUS_Register(void); 52 extern void STATUS_Unregister(void); 53 extern void TAB_Register(void); 54 extern void TAB_Unregister(void); 55 extern void TOOLBAR_Register(void); 56 extern void TOOLBAR_Unregister(void); 57 extern void TOOLTIPS_Register(void); 58 extern void TOOLTIPS_Unregister(void); 59 extern void TRACKBAR_Register(void); 60 extern void TRACKBAR_Unregister(void); 61 extern void TREEVIEW_Register(void); 62 extern void TREEVIEW_Unregister(void); 63 extern void UPDOWN_Register(void); 64 extern void UPDOWN_Unregister(void); 65 #endif 66 67 HANDLE COMCTL32_hHeap = (HANDLE)NULL; 68 LPSTR COMCTL32_aSubclass = (LPSTR)NULL; 69 HMODULE COMCTL32_hModule = 0; 70 LANGID COMCTL32_uiLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL); 71 HBRUSH COMCTL32_hPattern55AABrush = (HANDLE)NULL; 72 73 static HBITMAP COMCTL32_hPattern55AABitmap = (HANDLE)NULL; 74 75 static const WORD wPattern55AA[] = 9 DWORD WINAPI COMCTL32_389(DWORD x1, DWORD x2) 76 10 { 77 0x5555, 0xaaaa, 0x5555, 0xaaaa, 78 0x5555, 0xaaaa, 0x5555, 0xaaaa 79 }; 80 81 82 /*********************************************************************** 83 * COMCTL32_LibMain [Internal] Initializes the internal 'COMCTL32.DLL'. 84 * 85 * PARAMS 86 * hinstDLL [I] handle to the 'dlls' instance 87 * fdwReason [I] 88 * lpvReserved [I] reserverd, must be NULL 89 * 90 * RETURNS 91 * Success: TRUE 92 * Failure: FALSE 93 */ 94 95 BOOL WINAPI 96 COMCTL32_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 97 { 98 TRACE("%x,%lx,%p\n", hinstDLL, fdwReason, lpvReserved); 99 100 switch (fdwReason) { 101 case DLL_PROCESS_ATTACH: 102 COMCTL32_hModule = (HMODULE)hinstDLL; 103 104 /* create private heap */ 105 COMCTL32_hHeap = HeapCreate (0, 0x10000, 0); 106 TRACE("Heap created: 0x%x\n", COMCTL32_hHeap); 107 108 /* add global subclassing atom (used by 'tooltip' and 'updown') */ 109 COMCTL32_aSubclass = (LPSTR)(DWORD)GlobalAddAtomA ("CC32SubclassInfo"); 110 TRACE("Subclassing atom added: %p\n", COMCTL32_aSubclass); 111 112 /* create local pattern brush */ 113 COMCTL32_hPattern55AABitmap = CreateBitmap (8, 8, 1, 1, wPattern55AA); 114 COMCTL32_hPattern55AABrush = CreatePatternBrush (COMCTL32_hPattern55AABitmap); 115 116 /* register all Win95 common control classes */ 117 ANIMATE_Register (); 118 FLATSB_Register (); 119 HEADER_Register (); 120 HOTKEY_Register (); 121 LISTVIEW_Register (); 122 PROGRESS_Register (); 123 STATUS_Register (); 124 TAB_Register (); 125 TOOLBAR_Register (); 126 TOOLTIPS_Register (); 127 TRACKBAR_Register (); 128 TREEVIEW_Register (); 129 UPDOWN_Register (); 130 break; 131 132 case DLL_PROCESS_DETACH: 133 /* unregister all common control classes */ 134 ANIMATE_Unregister (); 135 COMBOEX_Unregister (); 136 DATETIME_Unregister (); 137 FLATSB_Unregister (); 138 HEADER_Unregister (); 139 HOTKEY_Unregister (); 140 IPADDRESS_Unregister (); 141 LISTVIEW_Unregister (); 142 MONTHCAL_Unregister (); 143 NATIVEFONT_Unregister (); 144 PAGER_Unregister (); 145 PROGRESS_Unregister (); 146 REBAR_Unregister (); 147 STATUS_Unregister (); 148 TAB_Unregister (); 149 TOOLBAR_Unregister (); 150 TOOLTIPS_Unregister (); 151 TRACKBAR_Unregister (); 152 TREEVIEW_Unregister (); 153 UPDOWN_Unregister (); 154 155 /* delete local pattern brush */ 156 DeleteObject (COMCTL32_hPattern55AABrush); 157 COMCTL32_hPattern55AABrush = (HANDLE)NULL; 158 DeleteObject (COMCTL32_hPattern55AABitmap); 159 COMCTL32_hPattern55AABitmap = (HANDLE)NULL; 160 161 /* delete global subclassing atom */ 162 GlobalDeleteAtom (LOWORD(COMCTL32_aSubclass)); 163 TRACE("Subclassing atom deleted: %p\n", COMCTL32_aSubclass); 164 COMCTL32_aSubclass = (LPSTR)NULL; 165 166 /* destroy private heap */ 167 HeapDestroy (COMCTL32_hHeap); 168 TRACE("Heap destroyed: 0x%x\n", COMCTL32_hHeap); 169 COMCTL32_hHeap = (HANDLE)NULL; 170 break; 171 } 172 173 return TRUE; 11 dprintf(("comctl32_389: %x %X not implemented!!", x1, x2)); 12 return 0; //NT 4 comctl32 returns 0 174 13 } 175 14 15 DWORD WINAPI COMCTL32_390(DWORD x1, DWORD x2, DWORD x3, DWORD x4) 16 { 17 dprintf(("comctl32_390: %x %x %x %x not implemented!!", x1, x2, x3, x4)); 176 18 177 /*********************************************************************** 178 * MenuHelp [COMCTL32.2] 179 * 180 * PARAMS 181 * uMsg [I] message (WM_MENUSELECT) (see NOTES) 182 * wParam [I] wParam of the message uMsg 183 * lParam [I] lParam of the message uMsg 184 * hMainMenu [I] handle to the application's main menu 185 * hInst [I] handle to the module that contains string resources 186 * hwndStatus [I] handle to the status bar window 187 * lpwIDs [I] pointer to an array of integers (see NOTES) 188 * 189 * RETURNS 190 * No return value 191 * 192 * NOTES 193 * The official documentation is incomplete! 194 * This is the correct documentation: 195 * 196 * uMsg: 197 * MenuHelp() does NOT handle WM_COMMAND messages! It only handles 198 * WM_MENUSELECT messages. 199 * 200 * lpwIDs: 201 * (will be written ...) 202 */ 19 /* Pseudo Assembler 20 push [esp+arg_C] 21 mov eax, [esp+4+arg_0] 22 push [esp+4+arg_8] 23 mov dword ptr [eax+1A8h], 1 24 push [esp+8+arg_4] 25 push dword ptr [eax + 38h] 26 call ds:SetDIBColorTable 27 retn 10h 28 */ 203 29 204 VOID WINAPI 205 MenuHelp (UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu, 206 HINSTANCE hInst, HWND hwndStatus, LPUINT lpwIDs) 207 { 208 UINT uMenuID = 0; 209 210 if (!IsWindow (hwndStatus)) 211 return; 212 213 switch (uMsg) { 214 case WM_MENUSELECT: 215 TRACE("WM_MENUSELECT wParam=0x%X lParam=0x%lX\n", 216 wParam, lParam); 217 218 if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) { 219 /* menu was closed */ 220 TRACE("menu was closed!\n"); 221 SendMessageA (hwndStatus, SB_SIMPLE, FALSE, 0); 222 } 223 else { 224 /* menu item was selected */ 225 if (HIWORD(wParam) & MF_POPUP) 226 uMenuID = (UINT)*(lpwIDs+1); 227 else 228 uMenuID = (UINT)LOWORD(wParam); 229 TRACE("uMenuID = %u\n", uMenuID); 230 231 if (uMenuID) { 232 CHAR szText[256]; 233 234 if (!LoadStringA (hInst, uMenuID, szText, 256)) 235 szText[0] = '\0'; 236 237 SendMessageA (hwndStatus, SB_SETTEXTA, 238 255 | SBT_NOBORDERS, (LPARAM)szText); 239 SendMessageA (hwndStatus, SB_SIMPLE, TRUE, 0); 240 } 241 } 242 break; 243 244 case WM_COMMAND : 245 TRACE("WM_COMMAND wParam=0x%X lParam=0x%lX\n", 246 wParam, lParam); 247 /* WM_COMMAND is not invalid since it is documented 248 * in the windows api reference. So don't output 249 * any FIXME for WM_COMMAND 250 */ 251 WARN("We don't care about the WM_COMMAND\n"); 252 break; 253 254 default: 255 FIXME("Invalid Message 0x%x!\n", uMsg); 256 break; 257 } 30 return 0; 258 31 } 259 260 261 /***********************************************************************262 * ShowHideMenuCtl [COMCTL32.3]263 *264 * Shows or hides controls and updates the corresponding menu item.265 *266 * PARAMS267 * hwnd [I] handle to the client window.268 * uFlags [I] menu command id.269 * lpInfo [I] pointer to an array of integers. (See NOTES.)270 *271 * RETURNS272 * Success: TRUE273 * Failure: FALSE274 *275 * NOTES276 * The official documentation is incomplete!277 * This is the correct documentation:278 *279 * hwnd280 * Handle to the window that contains the menu and controls.281 *282 * uFlags283 * Identifier of the menu item to receive or loose a check mark.284 *285 * lpInfo286 * The array of integers contains pairs of values. BOTH values of287 * the first pair must be the handles to the application's main menu.288 * Each subsequent pair consists of a menu id and control id.289 */290 291 BOOL WINAPI292 ShowHideMenuCtl (HWND hwnd, UINT uFlags, LPINT lpInfo)293 {294 LPINT lpMenuId;295 296 TRACE("%x, %x, %p\n", hwnd, uFlags, lpInfo);297 298 if (lpInfo == NULL)299 return FALSE;300 301 if (!(lpInfo[0]) || !(lpInfo[1]))302 return FALSE;303 304 /* search for control */305 lpMenuId = &lpInfo[2];306 while (*lpMenuId != uFlags)307 lpMenuId += 2;308 309 if (GetMenuState (lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) {310 /* uncheck menu item */311 CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_UNCHECKED);312 313 /* hide control */314 lpMenuId++;315 SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,316 SWP_HIDEWINDOW);317 }318 else {319 /* check menu item */320 CheckMenuItem (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_CHECKED);321 322 /* show control */323 lpMenuId++;324 SetWindowPos (GetDlgItem (hwnd, *lpMenuId), 0, 0, 0, 0, 0,325 SWP_SHOWWINDOW);326 }327 328 return TRUE;329 }330 331 332 /***********************************************************************333 * GetEffectiveClientRect [COMCTL32.4]334 *335 * PARAMS336 * hwnd [I] handle to the client window.337 * lpRect [O] pointer to the rectangle of the client window338 * lpInfo [I] pointer to an array of integers (see NOTES)339 *340 * RETURNS341 * No return value.342 *343 * NOTES344 * The official documentation is incomplete!345 * This is the correct documentation:346 *347 * lpInfo348 * (will be written...)349 */350 351 VOID WINAPI352 GetEffectiveClientRect (HWND hwnd, LPRECT lpRect, LPINT lpInfo)353 {354 RECT rcCtrl;355 INT *lpRun;356 HWND hwndCtrl;357 358 TRACE("(0x%08lx 0x%08lx 0x%08lx)\n",359 (DWORD)hwnd, (DWORD)lpRect, (DWORD)lpInfo);360 361 GetClientRect (hwnd, lpRect);362 lpRun = lpInfo;363 364 do {365 lpRun += 2;366 if (*lpRun == 0)367 return;368 lpRun++;369 hwndCtrl = GetDlgItem (hwnd, *lpRun);370 if (GetWindowLongA (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {371 TRACE("control id 0x%x\n", *lpRun);372 GetWindowRect (hwndCtrl, &rcCtrl);373 MapWindowPoints ((HWND)0, hwnd, (LPPOINT)&rcCtrl, 2);374 SubtractRect (lpRect, lpRect, &rcCtrl);375 }376 lpRun++;377 } while (*lpRun);378 }379 380 381 /***********************************************************************382 * DrawStatusTextA [COMCTL32.5][COMCTL32.27]383 *384 * Draws text with borders, like in a status bar.385 *386 * PARAMS387 * hdc [I] handle to the window's display context388 * lprc [I] pointer to a rectangle389 * text [I] pointer to the text390 * style [I] drawing style391 *392 * RETURNS393 * No return value.394 *395 * NOTES396 * The style variable can have one of the following values:397 * (will be written ...)398 */399 400 VOID WINAPI401 DrawStatusTextA (HDC hdc, LPRECT lprc, LPCSTR text, UINT style)402 {403 RECT r = *lprc;404 UINT border = BDR_SUNKENOUTER;405 406 if (style & SBT_POPOUT)407 border = BDR_RAISEDOUTER;408 else if (style & SBT_NOBORDERS)409 border = 0;410 411 DrawEdge (hdc, &r, border, BF_RECT|BF_ADJUST|BF_MIDDLE);412 413 /* now draw text */414 if (text) {415 int oldbkmode = SetBkMode (hdc, TRANSPARENT);416 r.left += 3;417 DrawTextA (hdc, text, lstrlenA(text),418 &r, DT_LEFT|DT_VCENTER|DT_SINGLELINE);419 if (oldbkmode != TRANSPARENT)420 SetBkMode(hdc, oldbkmode);421 }422 }423 424 425 /***********************************************************************426 * DrawStatusTextW [COMCTL32.28]427 *428 * Draws text with borders, like in a status bar.429 *430 * PARAMS431 * hdc [I] handle to the window's display context432 * lprc [I] pointer to a rectangle433 * text [I] pointer to the text434 * style [I] drawing style435 *436 * RETURNS437 * No return value.438 */439 440 VOID WINAPI441 DrawStatusTextW (HDC hdc, LPRECT lprc, LPCWSTR text, UINT style)442 {443 LPSTR p = HEAP_strdupWtoA (GetProcessHeap (), 0, text);444 DrawStatusTextA (hdc, lprc, p, style);445 HeapFree (GetProcessHeap (), 0, p );446 }447 448 449 /***********************************************************************450 * CreateStatusWindowA [COMCTL32.6][COMCTL32.21]451 *452 * Creates a status bar453 *454 * PARAMS455 * style [I] window style456 * text [I] pointer to the window text457 * parent [I] handle to the parent window458 * wid [I] control id of the status bar459 *460 * RETURNS461 * Success: handle to the status window462 * Failure: 0463 */464 465 HWND WINAPI466 CreateStatusWindowA (INT style, LPCSTR text, HWND parent, UINT wid)467 {468 return CreateWindowA(STATUSCLASSNAMEA, text, style,469 CW_USEDEFAULT, CW_USEDEFAULT,470 CW_USEDEFAULT, CW_USEDEFAULT,471 parent, wid, 0, 0);472 }473 474 475 /***********************************************************************476 * CreateStatusWindowW [COMCTL32.22] Creates a status bar control477 *478 * PARAMS479 * style [I] window style480 * text [I] pointer to the window text481 * parent [I] handle to the parent window482 * wid [I] control id of the status bar483 *484 * RETURNS485 * Success: handle to the status window486 * Failure: 0487 */488 489 HWND WINAPI490 CreateStatusWindowW (INT style, LPCWSTR text, HWND parent, UINT wid)491 {492 return CreateWindowW(STATUSCLASSNAMEW, text, style,493 CW_USEDEFAULT, CW_USEDEFAULT,494 CW_USEDEFAULT, CW_USEDEFAULT,495 parent, wid, 0, 0);496 }497 498 499 /***********************************************************************500 * CreateUpDownControl [COMCTL32.16] Creates an up-down control501 *502 * PARAMS503 * style [I] window styles504 * x [I] horizontal position of the control505 * y [I] vertical position of the control506 * cx [I] with of the control507 * cy [I] height of the control508 * parent [I] handle to the parent window509 * id [I] the control's identifier510 * inst [I] handle to the application's module instance511 * buddy [I] handle to the buddy window, can be NULL512 * maxVal [I] upper limit of the control513 * minVal [I] lower limit of the control514 * curVal [I] current value of the control515 *516 * RETURNS517 * Success: handle to the updown control518 * Failure: 0519 */520 521 HWND WINAPI522 CreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy,523 HWND parent, INT id, HINSTANCE inst,524 HWND buddy, INT maxVal, INT minVal, INT curVal)525 {526 HWND hUD =527 CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy,528 parent, id, inst, 0);529 if (hUD) {530 SendMessageA (hUD, UDM_SETBUDDY, buddy, 0);531 SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));532 SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));533 }534 535 return hUD;536 }537 538 539 /***********************************************************************540 * InitCommonControls [COMCTL32.17]541 *542 * Registers the common controls.543 *544 * PARAMS545 * No parameters.546 *547 * RETURNS548 * No return values.549 *550 * NOTES551 * This function is just a dummy.552 * The Win95 controls are registered at the DLL's initialization.553 * To register other controls InitCommonControlsEx() must be used.554 */555 556 VOID WINAPI557 InitCommonControls (void)558 {559 }560 561 562 /***********************************************************************563 * InitCommonControlsEx [COMCTL32.81]564 *565 * Registers the common controls.566 *567 * PARAMS568 * lpInitCtrls [I] pointer to an INITCOMMONCONTROLS structure.569 *570 * RETURNS571 * Success: TRUE572 * Failure: FALSE573 *574 * NOTES575 * Only the additional common controls are registered by this function.576 * The Win95 controls are registered at the DLL's initialization.577 */578 579 BOOL WINAPI580 InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls)581 {582 INT cCount;583 DWORD dwMask;584 585 if (!lpInitCtrls)586 return FALSE;587 if (lpInitCtrls->dwSize != sizeof(INITCOMMONCONTROLSEX))588 return FALSE;589 590 TRACE("(0x%08lx)\n", lpInitCtrls->dwICC);591 592 for (cCount = 0; cCount < 32; cCount++) {593 dwMask = 1 << cCount;594 if (!(lpInitCtrls->dwICC & dwMask))595 continue;596 597 switch (lpInitCtrls->dwICC & dwMask) {598 /* dummy initialization */599 case ICC_ANIMATE_CLASS:600 case ICC_BAR_CLASSES:601 case ICC_LISTVIEW_CLASSES:602 case ICC_TREEVIEW_CLASSES:603 case ICC_TAB_CLASSES:604 case ICC_UPDOWN_CLASS:605 case ICC_PROGRESS_CLASS:606 case ICC_HOTKEY_CLASS:607 break;608 609 /* advanced classes - not included in Win95 */610 case ICC_DATE_CLASSES:611 MONTHCAL_Register ();612 DATETIME_Register ();613 break;614 615 case ICC_USEREX_CLASSES:616 COMBOEX_Register ();617 break;618 619 case ICC_COOL_CLASSES:620 REBAR_Register ();621 break;622 623 case ICC_INTERNET_CLASSES:624 IPADDRESS_Register ();625 break;626 627 case ICC_PAGESCROLLER_CLASS:628 PAGER_Register ();629 break;630 631 case ICC_NATIVEFNTCTL_CLASS:632 NATIVEFONT_Register ();633 break;634 635 default:636 FIXME("Unknown class! dwICC=0x%lX\n", dwMask);637 break;638 }639 }640 641 return TRUE;642 }643 644 645 /***********************************************************************646 * CreateToolbarEx [COMCTL32.32] Creates a tool bar window647 *648 * PARAMS649 * hwnd650 * style651 * wID652 * nBitmaps653 * hBMInst654 * wBMID655 * lpButtons656 * iNumButtons657 * dxButton658 * dyButton659 * dxBitmap660 * dyBitmap661 * uStructSize662 *663 * RETURNS664 * Success: handle to the tool bar control665 * Failure: 0666 */667 668 HWND WINAPI669 CreateToolbarEx (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,670 HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,671 INT iNumButtons, INT dxButton, INT dyButton,672 INT dxBitmap, INT dyBitmap, UINT uStructSize)673 {674 HWND hwndTB;675 676 /* If not position is specified then put it at the top */677 if ((style & CCS_BOTTOM) == 0) {678 style|=CCS_TOP;679 }680 681 hwndTB =682 CreateWindowExA (0, TOOLBARCLASSNAMEA, "", style|WS_CHILD, 0, 0, 0, 0,683 hwnd, (HMENU)wID, 0, NULL);684 if(hwndTB) {685 TBADDBITMAP tbab;686 687 SendMessageA (hwndTB, TB_BUTTONSTRUCTSIZE,688 (WPARAM)uStructSize, 0);689 690 /* set bitmap and button size */691 /*If CreateToolbarEx receives 0, windows sets default values*/692 if (dxBitmap <= 0)693 dxBitmap = 16;694 if (dyBitmap <= 0)695 dyBitmap = 15;696 SendMessageA (hwndTB, TB_SETBITMAPSIZE, 0,697 MAKELPARAM((WORD)dxBitmap, (WORD)dyBitmap));698 699 if (dxButton <= 0)700 dxButton = 24;701 if (dyButton <= 0)702 dyButton = 22;703 SendMessageA (hwndTB, TB_SETBUTTONSIZE, 0,704 MAKELPARAM((WORD)dxButton, (WORD)dyButton));705 706 707 /* add bitmaps */708 if (nBitmaps > 0)709 {710 tbab.hInst = hBMInst;711 tbab.nID = wBMID;712 713 SendMessageA (hwndTB, TB_ADDBITMAP,714 (WPARAM)nBitmaps, (LPARAM)&tbab);715 }716 /* add buttons */717 if(iNumButtons > 0)718 SendMessageA (hwndTB, TB_ADDBUTTONSA,719 (WPARAM)iNumButtons, (LPARAM)lpButtons);720 }721 722 return hwndTB;723 }724 725 726 /***********************************************************************727 * CreateMappedBitmap [COMCTL32.8]728 *729 * PARAMS730 * hInstance [I]731 * idBitmap [I]732 * wFlags [I]733 * lpColorMap [I]734 * iNumMaps [I]735 *736 * RETURNS737 * Success: handle to the new bitmap738 * Failure: 0739 */740 741 HBITMAP WINAPI742 CreateMappedBitmap (HINSTANCE hInstance, INT idBitmap, UINT wFlags,743 LPCOLORMAP lpColorMap, INT iNumMaps)744 {745 HGLOBAL hglb;746 HRSRC hRsrc;747 LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo;748 UINT nSize, nColorTableSize;749 RGBQUAD *pColorTable;750 INT iColor, i, iMaps, nWidth, nHeight;751 HDC hdcScreen;752 HBITMAP hbm;753 LPCOLORMAP sysColorMap;754 COLORREF cRef;755 COLORMAP internalColorMap[4] =756 {{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}};757 758 /* initialize pointer to colortable and default color table */759 if (lpColorMap) {760 iMaps = iNumMaps;761 sysColorMap = lpColorMap;762 }763 else {764 internalColorMap[0].to = GetSysColor (COLOR_BTNTEXT);765 internalColorMap[1].to = GetSysColor (COLOR_BTNSHADOW);766 internalColorMap[2].to = GetSysColor (COLOR_BTNFACE);767 internalColorMap[3].to = GetSysColor (COLOR_BTNHIGHLIGHT);768 iMaps = 4;769 sysColorMap = (LPCOLORMAP)internalColorMap;770 }771 772 hRsrc = FindResourceA (hInstance, (LPSTR)idBitmap, RT_BITMAPA);773 if (hRsrc == 0)774 return 0;775 hglb = LoadResource (hInstance, hRsrc);776 if (hglb == 0)777 return 0;778 lpBitmap = (LPBITMAPINFOHEADER)LockResource (hglb);779 if (lpBitmap == NULL)780 return 0;781 782 nColorTableSize = (1 << lpBitmap->biBitCount);783 nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD);784 lpBitmapInfo = (LPBITMAPINFOHEADER)GlobalAlloc (GMEM_FIXED, nSize);785 if (lpBitmapInfo == NULL)786 return 0;787 RtlMoveMemory (lpBitmapInfo, lpBitmap, nSize);788 789 pColorTable = (RGBQUAD*)(((LPBYTE)lpBitmapInfo)+(UINT)lpBitmapInfo->biSize);790 791 for (iColor = 0; iColor < nColorTableSize; iColor++) {792 for (i = 0; i < iMaps; i++) {793 cRef = RGB(pColorTable[iColor].rgbRed,794 pColorTable[iColor].rgbGreen,795 pColorTable[iColor].rgbBlue);796 if ( cRef == sysColorMap[i].from) {797 #if 0798 if (wFlags & CBS_MASKED) {799 if (sysColorMap[i].to != COLOR_BTNTEXT)800 pColorTable[iColor] = RGB(255, 255, 255);801 }802 else803 #endif804 pColorTable[iColor].rgbBlue = GetBValue(sysColorMap[i].to);805 pColorTable[iColor].rgbGreen = GetGValue(sysColorMap[i].to);806 pColorTable[iColor].rgbRed = GetRValue(sysColorMap[i].to);807 break;808 }809 }810 }811 nWidth = (INT)lpBitmapInfo->biWidth;812 nHeight = (INT)lpBitmapInfo->biHeight;813 hdcScreen = GetDC ((HWND)0);814 hbm = CreateCompatibleBitmap (hdcScreen, nWidth, nHeight);815 if (hbm) {816 HDC hdcDst = CreateCompatibleDC (hdcScreen);817 HBITMAP hbmOld = SelectObject (hdcDst, hbm);818 LPBYTE lpBits = (LPBYTE)(lpBitmap + 1);819 lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);820 StretchDIBits (hdcDst, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,821 lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS,822 SRCCOPY);823 SelectObject (hdcDst, hbmOld);824 DeleteDC (hdcDst);825 }826 ReleaseDC ((HWND)0, hdcScreen);827 GlobalFree ((HGLOBAL)lpBitmapInfo);828 FreeResource (hglb);829 830 return hbm;831 }832 833 834 /***********************************************************************835 * CreateToolbar [COMCTL32.7] Creates a tool bar control836 *837 * PARAMS838 * hwnd839 * style840 * wID841 * nBitmaps842 * hBMInst843 * wBMID844 * lpButtons845 * iNumButtons846 *847 * RETURNS848 * Success: handle to the tool bar control849 * Failure: 0850 *851 * NOTES852 * Do not use this functions anymore. Use CreateToolbarEx instead.853 */854 855 HWND WINAPI856 CreateToolbar (HWND hwnd, DWORD style, UINT wID, INT nBitmaps,857 HINSTANCE hBMInst, UINT wBMID,858 LPCOLDTBBUTTON lpButtons,INT iNumButtons)859 {860 return CreateToolbarEx (hwnd, style | CCS_NODIVIDER, wID, nBitmaps,861 hBMInst, wBMID, (LPCTBBUTTON)lpButtons,862 iNumButtons, 0, 0, 0, 0, sizeof (OLDTBBUTTON));863 }864 865 866 /***********************************************************************867 * DllGetVersion [COMCTL32.25]868 *869 * Retrieves version information of the 'COMCTL32.DLL'870 *871 * PARAMS872 * pdvi [O] pointer to version information structure.873 *874 * RETURNS875 * Success: S_OK876 * Failure: E_INVALIDARG877 *878 * NOTES879 * Returns version of a comctl32.dll from IE4.01 SP1.880 */881 882 HRESULT WINAPI883 COMCTL32_DllGetVersion (DLLVERSIONINFO *pdvi)884 {885 if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) {886 WARN("wrong DLLVERSIONINFO size from app");887 return E_INVALIDARG;888 }889 890 pdvi->dwMajorVersion = COMCTL32_VERSION;891 pdvi->dwMinorVersion = COMCTL32_VERSION_MINOR;892 pdvi->dwBuildNumber = 2919;893 pdvi->dwPlatformID = 6304;894 895 TRACE("%lu.%lu.%lu.%lu\n",896 pdvi->dwMajorVersion, pdvi->dwMinorVersion,897 pdvi->dwBuildNumber, pdvi->dwPlatformID);898 899 return S_OK;900 }901 902 /***********************************************************************903 * DllInstall (COMCTL32.@)904 */905 HRESULT WINAPI COMCTL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)906 {907 FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE",908 debugstr_w(cmdline));909 910 return S_OK;911 }912 913 914 typedef struct __TRACKINGLIST {915 TRACKMOUSEEVENT tme;916 POINT pos; /* center of hover rectangle */917 INT iHoverTime; /* elapsed time the cursor has been inside of the hover rect */918 } _TRACKINGLIST;919 920 static _TRACKINGLIST TrackingList[10];921 static int iTrackMax = 0;922 static UINT_PTR timer;923 924 static const INT iTimerInterval = 50; /* msec for timer interval */925 926 /* FIXME: need to implement WM_NCMOUSELEAVE and WM_NCMOUSEHOVER for */927 /* TrackMouseEventProc and _TrackMouseEvent */928 static void CALLBACK TrackMouseEventProc(HWND hwndUnused, UINT uMsg, UINT_PTR idEvent,929 DWORD dwTime)930 {931 int i = 0;932 POINT pos;933 HWND hwnd;934 INT hoverwidth = 0, hoverheight = 0;935 936 GetCursorPos(&pos);937 hwnd = WindowFromPoint(pos);938 939 SystemParametersInfoA(SPI_GETMOUSEHOVERWIDTH, 0, &hoverwidth, 0);940 SystemParametersInfoA(SPI_GETMOUSEHOVERHEIGHT, 0, &hoverheight, 0);941 942 /* loop through tracking events we are processing */943 while (i < iTrackMax) {944 /* see if this tracking event is looking for TME_LEAVE and that the */945 /* mouse has left the window */946 if ((TrackingList[i].tme.dwFlags & TME_LEAVE) &&947 (TrackingList[i].tme.hwndTrack != hwnd)) {948 PostMessageA(TrackingList[i].tme.hwndTrack, WM_MOUSELEAVE, 0, 0);949 950 /* remove the TME_LEAVE flag */951 TrackingList[i].tme.dwFlags ^= TME_LEAVE;952 }953 954 /* see if we are tracking hovering for this hwnd */955 if(TrackingList[i].tme.dwFlags & TME_HOVER) {956 /* add the timer interval to the hovering time */957 TrackingList[i].iHoverTime+=iTimerInterval;958 959 /* has the cursor moved outside the rectangle centered around pos? */960 if((abs(pos.x - TrackingList[i].pos.x) > (hoverwidth / 2.0))961 || (abs(pos.y - TrackingList[i].pos.y) > (hoverheight / 2.0)))962 {963 /* record this new position as the current position and reset */964 /* the iHoverTime variable to 0 */965 TrackingList[i].pos = pos;966 TrackingList[i].iHoverTime = 0;967 }968 969 /* has the mouse hovered long enough? */970 if(TrackingList[i].iHoverTime <= TrackingList[i].tme.dwHoverTime)971 {972 PostMessageA(TrackingList[i].tme.hwndTrack, WM_MOUSEHOVER, 0, 0);973 974 /* stop tracking mouse hover */975 TrackingList[i].tme.dwFlags ^= TME_HOVER;976 }977 }978 979 /* see if we are still tracking TME_HOVER or TME_LEAVE for this entry */980 if((TrackingList[i].tme.dwFlags & TME_HOVER) ||981 (TrackingList[i].tme.dwFlags & TME_LEAVE)) {982 i++;983 } else { /* remove this entry from the tracking list */984 TrackingList[i] = TrackingList[--iTrackMax];985 }986 }987 988 /* stop the timer if the tracking list is empty */989 if(iTrackMax == 0) {990 KillTimer(0, timer);991 timer = 0;992 }993 }994 995 /***********************************************************************996 * _TrackMouseEvent [COMCTL32.25]997 *998 * Requests notification of mouse events999 *1000 * During mouse tracking WM_MOUSEHOVER or WM_MOUSELEAVE events are posted1001 * to the hwnd specified in the ptme structure. After the event message1002 * is posted to the hwnd, the entry in the queue is removed.1003 *1004 * If the current hwnd isn't ptme->hwndTrack the TME_HOVER flag is completely1005 * ignored. The TME_LEAVE flag results in a WM_MOUSELEAVE message being posted1006 * immediately and the TME_LEAVE flag being ignored.1007 *1008 * PARAMS1009 * ptme [I,O] pointer to TRACKMOUSEEVENT information structure.1010 *1011 * RETURNS1012 * Success: non-zero1013 * Failure: zero1014 *1015 */1016 1017 BOOL WINAPI1018 _TrackMouseEvent (TRACKMOUSEEVENT *ptme)1019 {1020 DWORD flags = 0;1021 int i = 0;1022 BOOL cancel = 0, hover = 0, leave = 0, query = 0;1023 HWND hwnd;1024 POINT pos;1025 1026 pos.x = 0;1027 pos.y = 0;1028 1029 TRACE("%lx, %lx, %x, %lx\n", ptme->cbSize, ptme->dwFlags, ptme->hwndTrack, ptme->dwHoverTime);1030 1031 if (ptme->cbSize != sizeof(TRACKMOUSEEVENT)) {1032 WARN("wrong TRACKMOUSEEVENT size from app");1033 SetLastError(ERROR_INVALID_PARAMETER); /* FIXME not sure if this is correct */1034 return FALSE;1035 }1036 1037 flags = ptme->dwFlags;1038 1039 /* if HOVER_DEFAULT was specified replace this with the systems current value */1040 if(ptme->dwHoverTime == HOVER_DEFAULT)1041 SystemParametersInfoA(SPI_GETMOUSEHOVERTIME, 0, &(ptme->dwHoverTime), 0);1042 1043 GetCursorPos(&pos);1044 hwnd = WindowFromPoint(pos);1045 1046 if ( flags & TME_CANCEL ) {1047 flags &= ~ TME_CANCEL;1048 cancel = 1;1049 }1050 1051 if ( flags & TME_HOVER ) {1052 flags &= ~ TME_HOVER;1053 hover = 1;1054 }1055 1056 if ( flags & TME_LEAVE ) {1057 flags &= ~ TME_LEAVE;1058 leave = 1;1059 }1060 1061 /* fill the TRACKMOUSEEVENT struct with the current tracking for the given hwnd */1062 if ( flags & TME_QUERY ) {1063 flags &= ~ TME_QUERY;1064 query = 1;1065 i = 0;1066 1067 /* Find the tracking list entry with the matching hwnd */1068 while((i < iTrackMax) && (TrackingList[i].tme.hwndTrack != ptme->hwndTrack)) {1069 i++;1070 }1071 1072 /* hwnd found, fill in the ptme struct */1073 if(i < iTrackMax)1074 *ptme = TrackingList[i].tme;1075 else1076 ptme->dwFlags = 0;1077 1078 return TRUE; /* return here, TME_QUERY is retrieving information */1079 }1080 1081 if ( flags )1082 FIXME("Unknown flag(s) %08lx\n", flags );1083 1084 if(cancel) {1085 /* find a matching hwnd if one exists */1086 i = 0;1087 1088 while((i < iTrackMax) && (TrackingList[i].tme.hwndTrack != ptme->hwndTrack)) {1089 i++;1090 }1091 1092 if(i < iTrackMax) {1093 TrackingList[i].tme.dwFlags &= ~(ptme->dwFlags & ~TME_CANCEL);1094 1095 /* if we aren't tracking on hover or leave remove this entry */1096 if(!((TrackingList[i].tme.dwFlags & TME_HOVER) ||1097 (TrackingList[i].tme.dwFlags & TME_LEAVE)))1098 {1099 TrackingList[i] = TrackingList[--iTrackMax];1100 1101 if(iTrackMax == 0) {1102 KillTimer(0, timer);1103 timer = 0;1104 }1105 }1106 }1107 } else {1108 /* see if hwndTrack isn't the current window */1109 if(ptme->hwndTrack != hwnd) {1110 if(leave) {1111 PostMessageA(ptme->hwndTrack, WM_MOUSELEAVE, 0, 0);1112 }1113 } else {1114 /* See if this hwnd is already being tracked and update the tracking flags */1115 for(i = 0; i < iTrackMax; i++) {1116 if(TrackingList[i].tme.hwndTrack == ptme->hwndTrack) {1117 if(hover) {1118 TrackingList[i].tme.dwFlags |= TME_HOVER;1119 TrackingList[i].tme.dwHoverTime = ptme->dwHoverTime;1120 }1121 1122 if(leave)1123 TrackingList[i].tme.dwFlags |= TME_LEAVE;1124 1125 /* reset iHoverTime as per winapi specs */1126 TrackingList[i].iHoverTime = 0;1127 1128 return TRUE;1129 }1130 }1131 1132 /* if the tracking list is full return FALSE */1133 if (iTrackMax == sizeof (TrackingList) / sizeof(*TrackingList)) {1134 return FALSE;1135 }1136 1137 /* Adding new mouse event to the tracking list */1138 TrackingList[iTrackMax].tme = *ptme;1139 1140 /* Initialize HoverInfo variables even if not hover tracking */1141 TrackingList[iTrackMax].iHoverTime = 0;1142 TrackingList[iTrackMax].pos = pos;1143 1144 iTrackMax++;1145 1146 if (!timer) {1147 timer = SetTimer(0, 0, iTimerInterval, TrackMouseEventProc);1148 }1149 }1150 }1151 1152 return TRUE;1153 }1154 1155 1156 /*************************************************************************1157 * GetMUILanguage [COMCTL32.39]1158 *1159 * FIXME: What's this supposed to do? Apparently some i18n thing.1160 *1161 */1162 LANGID WINAPI GetMUILanguage (VOID)1163 {1164 return COMCTL32_uiLang;1165 }1166 1167 1168 /*************************************************************************1169 * InitMUILanguage [COMCTL32.85]1170 *1171 * FIXME: What's this supposed to do? Apparently some i18n thing.1172 *1173 */1174 1175 VOID WINAPI InitMUILanguage (LANGID uiLang)1176 {1177 COMCTL32_uiLang = uiLang;1178 }1179 1180 1181 /***********************************************************************1182 * COMCTL32_CreateToolTip [NOT AN API]1183 *1184 * Creates a tooltip for the control specified in hwnd and does all1185 * necessary setup and notifications.1186 *1187 * PARAMS1188 * hwndOwner [I] Handle to the window that will own the tool tip.1189 *1190 * RETURNS1191 * Success: Handle of tool tip window.1192 * Failure: NULL1193 */1194 HWND1195 COMCTL32_CreateToolTip(HWND hwndOwner)1196 {1197 HWND hwndToolTip;1198 1199 hwndToolTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0,1200 CW_USEDEFAULT, CW_USEDEFAULT,1201 CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner,1202 0, 0, 0);1203 1204 /* Send NM_TOOLTIPSCREATED notification */1205 if (hwndToolTip)1206 {1207 NMTOOLTIPSCREATED nmttc;1208 /* true owner can be different if hwndOwner is a child window */1209 HWND hwndTrueOwner = GetWindow(hwndToolTip, GW_OWNER);1210 nmttc.hdr.hwndFrom = hwndTrueOwner;1211 nmttc.hdr.idFrom = GetWindowLongA(hwndTrueOwner, GWL_ID);1212 nmttc.hdr.code = NM_TOOLTIPSCREATED;1213 nmttc.hwndToolTips = hwndToolTip;1214 1215 SendMessageA(GetParent(hwndTrueOwner), WM_NOTIFY,1216 (WPARAM)GetWindowLongA(hwndTrueOwner, GWL_ID),1217 (LPARAM)&nmttc);1218 }1219 1220 return hwndToolTip;1221 } -
trunk/src/comctl32/comctl32.def
r6380 r7815 1 ; $Id: comctl32.def,v 1.2 4 2001-07-21 09:07:16sandervl Exp $1 ; $Id: comctl32.def,v 1.25 2002-02-06 17:23:18 sandervl Exp $ 2 2 LIBRARY COMCTL32 INITINSTANCE 3 3 DESCRIPTION 'Odin32 System DLL - ComCtl32 - Common Controls Library' … … 21 21 CreateUpDownControl = _CreateUpDownControl@48 @16 22 22 InitCommonControls = _InitCommonControls@0 @17 23 CreatePropertySheetPageA = _CreatePropertySheetPageA@4 @18 24 CreatePropertySheetPageW = _CreatePropertySheetPageW@4 @19 25 CreateStatusWindow = _CreateStatusWindowA@16 @20 26 CreateStatusWindowW = _CreateStatusWindowW@16 @21 27 CreateToolbarEx = _CreateToolbarEx@52 @22 28 DestroyPropertySheetPage = _DestroyPropertySheetPage@4 @23 29 DllGetVersion = _COMCTL32_DllGetVersion@4 @24 30 DllInstall = _COMCTL32_DllInstall@8 @25 31 DrawStatusText = _DrawStatusTextA@16 @26 32 DrawStatusTextW = _DrawStatusTextW@16 @27 33 34 FlatSB_EnableScrollBar = _FlatSB_EnableScrollBar@12 @28 35 FlatSB_GetScrollInfo = _FlatSB_GetScrollInfo@12 @29 36 FlatSB_GetScrollPos = _FlatSB_GetScrollPos@8 @30 37 FlatSB_GetScrollProp = _FlatSB_GetScrollProp@12 @31 38 FlatSB_GetScrollRange = _FlatSB_GetScrollRange@16 @32 39 FlatSB_SetScrollInfo = _FlatSB_SetScrollInfo@16 @33 40 FlatSB_SetScrollPos = _FlatSB_SetScrollPos@16 @34 41 FlatSB_SetScrollProp = _FlatSB_SetScrollProp@16 @35 42 FlatSB_SetScrollRange = _FlatSB_SetScrollRange@20 @36 43 FlatSB_ShowScrollBar = _FlatSB_ShowScrollBar@12 @37 44 GetMUILanguage = _GetMUILanguage@0 @38 45 46 ImageList_Add = _ImageList_Add@12 @39 47 ImageList_AddIcon = _ImageList_AddIcon@8 @40 48 ImageList_AddMasked = _ImageList_AddMasked@12 @41 49 ImageList_BeginDrag = _ImageList_BeginDrag@16 @42 50 ImageList_Copy = _ImageList_Copy@20 @43 51 ImageList_Create = _ImageList_Create@20 @44 52 ImageList_Destroy = _ImageList_Destroy@4 @45 53 ImageList_DragEnter = _ImageList_DragEnter@12 @46 54 ImageList_DragLeave = _ImageList_DragLeave@4 @47 55 ImageList_DragMove = _ImageList_DragMove@8 @48 56 ImageList_DragShowNolock = _ImageList_DragShowNolock@4 @49 57 ImageList_Draw = _ImageList_Draw@24 @50 58 ImageList_DrawEx = _ImageList_DrawEx@40 @51 59 ImageList_DrawIndirect = _ImageList_DrawIndirect@4 @52 60 ImageList_Duplicate = _ImageList_Duplicate@4 @53 61 ImageList_EndDrag = _ImageList_EndDrag@0 @54 62 ImageList_GetBkColor = _ImageList_GetBkColor@4 @55 63 ImageList_GetDragImage = _ImageList_GetDragImage@8 @56 64 ;;stub ImageList_GetFlags @57 65 ImageList_GetIcon = _ImageList_GetIcon@12 @58 66 ImageList_GetIconSize = _ImageList_GetIconSize@12 @59 67 ImageList_GetImageCount = _ImageList_GetImageCount@4 @60 68 ImageList_GetImageInfo = _ImageList_GetImageInfo@12 @61 69 ImageList_GetImageRect = _ImageList_GetImageRect@12 @62 70 ImageList_LoadImage = _ImageList_LoadImageA@28 @63 71 ImageList_LoadImageA = _ImageList_LoadImageA@28 @64 72 ImageList_LoadImageW = _ImageList_LoadImageW@28 @65 73 ImageList_Merge = _ImageList_Merge@24 @66 74 ImageList_Read = _ImageList_Read@4 @67 75 ImageList_Remove = _ImageList_Remove@8 @68 76 ImageList_Replace = _ImageList_Replace@16 @69 77 ImageList_ReplaceIcon = _ImageList_ReplaceIcon@12 @70 23 CreatePropertySheetPage = _CreatePropertySheetPageA@4 @18 24 CreatePropertySheetPageA = _CreatePropertySheetPageA@4 @19 25 CreatePropertySheetPageW = _CreatePropertySheetPageW@4 @20 26 CreateStatusWindow = _CreateStatusWindowA@16 @21 27 CreateStatusWindowW = _CreateStatusWindowW@16 @22 28 CreateToolbarEx = _CreateToolbarEx@52 @23 29 DestroyPropertySheetPage = _DestroyPropertySheetPage@4 @24 30 DllGetVersion = _COMCTL32_DllGetVersion@4 @25 31 DllInstall = _COMCTL32_DllInstall@8 @26 32 DrawStatusText = _DrawStatusTextA@16 @27 33 DrawStatusTextW = _DrawStatusTextW@16 @28 34 FlatSB_EnableScrollBar = _FlatSB_EnableScrollBar@12 @29 35 FlatSB_GetScrollInfo = _FlatSB_GetScrollInfo@12 @30 36 FlatSB_GetScrollPos = _FlatSB_GetScrollPos@8 @31 37 FlatSB_GetScrollProp = _FlatSB_GetScrollProp@12 @32 38 FlatSB_GetScrollRange = _FlatSB_GetScrollRange@16 @33 39 FlatSB_SetScrollInfo = _FlatSB_SetScrollInfo@16 @34 40 FlatSB_SetScrollPos = _FlatSB_SetScrollPos@16 @35 41 FlatSB_SetScrollProp = _FlatSB_SetScrollProp@16 @36 42 FlatSB_SetScrollRange = _FlatSB_SetScrollRange@20 @37 43 FlatSB_ShowScrollBar = _FlatSB_ShowScrollBar@12 @38 44 GetMUILanguage = _GetMUILanguage@0 @39 45 ImageList_Add = _ImageList_Add@12 @40 46 ImageList_AddIcon = _ImageList_AddIcon@8 @41 47 ImageList_AddMasked = _ImageList_AddMasked@12 @42 48 ImageList_BeginDrag = _ImageList_BeginDrag@16 @43 49 ImageList_Copy = _ImageList_Copy@20 @44 50 ImageList_Create = _ImageList_Create@20 @45 51 ImageList_Destroy = _ImageList_Destroy@4 @46 52 ImageList_DragEnter = _ImageList_DragEnter@12 @47 53 ImageList_DragLeave = _ImageList_DragLeave@4 @48 54 ImageList_DragMove = _ImageList_DragMove@8 @49 55 ImageList_DragShowNolock = _ImageList_DragShowNolock@4 @50 56 ImageList_Draw = _ImageList_Draw@24 @51 57 ImageList_DrawEx = _ImageList_DrawEx@40 @52 58 ImageList_DrawIndirect = _ImageList_DrawIndirect@4 @53 59 ImageList_Duplicate = _ImageList_Duplicate@4 @54 60 ImageList_EndDrag = _ImageList_EndDrag@0 @55 61 ImageList_GetBkColor = _ImageList_GetBkColor@4 @56 62 ImageList_GetDragImage = _ImageList_GetDragImage@8 @57 63 ImageList_GetFlags = _ImageList_GetFlags@4 @58 64 ImageList_GetIcon = _ImageList_GetIcon@12 @59 65 ImageList_GetIconSize = _ImageList_GetIconSize@12 @60 66 ImageList_GetImageCount = _ImageList_GetImageCount@4 @61 67 ImageList_GetImageInfo = _ImageList_GetImageInfo@12 @62 68 ImageList_GetImageRect = _ImageList_GetImageRect@12 @63 69 ImageList_LoadImage = _ImageList_LoadImageA@28 @64 70 ImageList_LoadImageA = _ImageList_LoadImageA@28 @65 71 ImageList_LoadImageW = _ImageList_LoadImageW@28 @66 72 ImageList_Merge = _ImageList_Merge@24 @67 73 ImageList_Read = _ImageList_Read@4 @68 74 ImageList_Remove = _ImageList_Remove@8 @69 75 ImageList_Replace = _ImageList_Replace@16 @70 78 76 Alloc = _COMCTL32_Alloc@4 @71 79 77 ReAlloc = _COMCTL32_ReAlloc@8 @72 80 78 Free = _COMCTL32_Free@4 @73 81 79 GetSize = _COMCTL32_GetSize@4 @74 82 ImageList_ SetBkColor = _ImageList_SetBkColor@8@7583 ImageList_Set DragCursorImage = _ImageList_SetDragCursorImage@16@7684 ImageList_Set Filter = _ImageList_SetFilter@12@7785 ;;stub ImageList_SetFlags@7886 ImageList_Set IconSize = _ImageList_SetIconSize@12@7987 ImageList_SetI mageCount = _ImageList_SetImageCount@8@8088 ImageList_Set OverlayImage = _ImageList_SetOverlayImage@12@8189 ImageList_ Write = _ImageList_Write@8@8290 91 InitCommonControlsEx = _InitCommonControlsEx@4 @8 392 InitMUILanguage = _InitMUILanguage@4 @8 493 InitializeFlatSB = _InitializeFlatSB@4 @8 594 PropertySheet = _PropertySheetA@4 @8 695 PropertySheetA = _PropertySheetA@4 @8 796 PropertySheetW = _PropertySheetW@4 @8 897 UninitializeFlatSB = _UninitializeFlatSB@4 @ 8998 _TrackMouseEvent = __TrackMouseEvent@4 @9 080 ImageList_ReplaceIcon = _ImageList_ReplaceIcon@12 @75 81 ImageList_SetBkColor = _ImageList_SetBkColor@8 @76 82 ImageList_SetDragCursorImage = _ImageList_SetDragCursorImage@16 @77 83 ImageList_SetFilter = _ImageList_SetFilter@12 @78 84 ImageList_SetFlags = _ImageList_SetFlags@8 @79 85 ImageList_SetIconSize = _ImageList_SetIconSize@12 @80 86 ImageList_SetImageCount = _ImageList_SetImageCount@8 @81 87 ImageList_SetOverlayImage = _ImageList_SetOverlayImage@12 @82 88 ImageList_Write = _ImageList_Write@8 @83 89 InitCommonControlsEx = _InitCommonControlsEx@4 @84 90 InitMUILanguage = _InitMUILanguage@4 @85 91 InitializeFlatSB = _InitializeFlatSB@4 @86 92 PropertySheet = _PropertySheetA@4 @87 93 PropertySheetA = _PropertySheetA@4 @88 94 PropertySheetW = _PropertySheetW@4 @89 95 UninitializeFlatSB = _UninitializeFlatSB@4 @90 96 _TrackMouseEvent = __TrackMouseEvent@4 @91 99 97 100 98 … … 102 100 CreateMRUListA = _CreateMRUListA@4 @151 103 101 ; ordinals???? 104 FreeMRUList A = _FreeMRUListA@4@152102 FreeMRUList = _FreeMRUList@4 @152 105 103 AddMRUStringA = _AddMRUStringA@8 @153 106 104 EnumMRUListA = _EnumMRUListA@16 @154 … … 180 178 _COMCTL32_390@16 @390 NONAME 181 179 182 ;400 stub CreateMRUListW@4 183 ;401 stub AddMRUStringW@8 184 ;402 stub FindMRUStringW@12185 ;403 stub EnumMRUListW@16 186 ;404 stub CreateMRUListLazyW@16 180 CreateMRUListW = _CreateMRUListW@4 @400 181 AddMRUStringW = _AddMRUStringW@8 @401 182 FindMRUStringW = _FindMRUStringW@12 @402 183 EnumMRUListW = _EnumMRUListW@16 @403 184 CreateMRUListLazyW = _CreateMRUListLazyW@16 @404 187 185 188 186 _COMCTL32_410@16 @410 NONAME … … 191 189 _COMCTL32_413@16 @413 NONAME 192 190 _COMCTL32_415@20 @415 NONAME 191 192 _COMCTL32_419@16 @419 NONAME 193 -
trunk/src/comctl32/comctl32.h
r5630 r7815 1 /* $Id: comctl32.h,v 1.2 0 2001-04-29 10:30:56sandervl Exp $ */1 /* $Id: comctl32.h,v 1.21 2002-02-06 17:23:18 sandervl Exp $ */ 2 2 /* 3 3 * Win32 common controls implementation … … 26 26 #define NO_ULONG 27 27 #include <misc.h> 28 29 #ifndef __cplusplus 30 #undef inline 31 #define inline 32 #endif 33 34 extern HBRUSH COMCTL32_hPattern55AABrush; 28 35 29 36 #ifdef __cplusplus -
trunk/src/comctl32/comctl32undoc.c
r7508 r7815 23 23 #include <stdlib.h> /* atoi */ 24 24 #include <ctype.h> 25 #include <limits.h> 25 26 26 27 #include "commctrl.h" … … 37 38 DEFAULT_DEBUG_CHANNEL(commctrl); 38 39 40 39 41 extern HANDLE COMCTL32_hHeap; /* handle to the private heap */ 40 42 … … 56 58 typedef HRESULT (* CALLBACK DPALOADPROC)(LPLOADDATA,IStream*,LPARAM); 57 59 #else 58 typedef HRESULT CALLBACK (*DPALOADPROC)(LPLOADDATA,IStream*,LPARAM);60 typedef HRESULT (CALLBACK *DPALOADPROC)(LPLOADDATA,IStream*,LPARAM); 59 61 #endif 60 62 … … 99 101 position.s.HighPart = 0; 100 102 103 /* 104 * Zero out our streamData 105 */ 106 memset(&streamData,0,sizeof(STREAMDATA)); 107 101 108 errCode = IStream_Seek (pStream, position, STREAM_SEEK_CUR, &newPosition); 102 109 if (errCode != S_OK) … … 110 117 streamData.dwSize, streamData.dwData2, streamData.dwItems); 111 118 112 if (lParam < sizeof(STREAMDATA) || 119 if ( ulRead < sizeof(STREAMDATA) || 120 lParam < sizeof(STREAMDATA) || 113 121 streamData.dwSize < sizeof(STREAMDATA) || 114 122 streamData.dwData2 < 1) { 115 123 errCode = E_FAIL; 116 124 } 125 126 if (streamData.dwItems > (UINT_MAX / 2 / sizeof(VOID*))) /* 536870911 */ 127 return E_OUTOFMEMORY; 117 128 118 129 /* create the dpa */ … … 261 272 else if (nResult < 0) 262 273 { 263 if (! dwFlags & 8)274 if (!(dwFlags & 8)) 264 275 { 265 276 PVOID ptr; … … 274 285 else 275 286 { 276 if (! dwFlags & 4)287 if (!(dwFlags & 4)) 277 288 { 278 289 PVOID ptr; … … 414 425 */ 415 426 416 #ifdef __WIN32OS2__ 417 #include <wine\undoccomctl32.h> 418 #else 419 typedef struct tagCREATEMRULIST 427 typedef struct tagCREATEMRULISTA 420 428 { 421 429 DWORD cbSize; /* size of struct */ … … 425 433 LPCSTR lpszSubKey; /* reg. subkey */ 426 434 PROC lpfnCompare; /* item compare proc */ 427 } CREATEMRULIST, *LPCREATEMRULIST; 435 } CREATEMRULISTA, *LPCREATEMRULISTA; 436 437 typedef struct tagCREATEMRULISTW 438 { 439 DWORD cbSize; /* size of struct */ 440 DWORD nMaxItems; /* max no. of items in list */ 441 DWORD dwFlags; /* see below */ 442 HKEY hKey; /* root reg. key under which list is saved */ 443 LPCWSTR lpszSubKey; /* reg. subkey */ 444 PROC lpfnCompare; /* item compare proc */ 445 } CREATEMRULISTW, *LPCREATEMRULISTW; 428 446 429 447 /* dwFlags */ … … 452 470 typedef struct tagWINEMRULIST 453 471 { 454 CREATEMRULIST extview; /* original create information */ 472 CREATEMRULISTW extview; /* original create information */ 473 BOOL isUnicode; /* is compare fn Unicode */ 455 474 DWORD wineFlags; /* internal flags */ 456 475 DWORD cursize; /* current size of realMRU */ … … 463 482 #define WMRUF_CHANGED 0x0001 /* MRU list has changed */ 464 483 465 HANDLE WINAPI466 CreateMRUListLazyA (LPCREATEMRULIST lpcml, DWORD dwParam2,467 DWORD dwParam3, DWORD dwParam4);468 #endif469 470 484 /************************************************************************** 471 485 * MRU_SaveChanged - Localize MRU saving code … … 476 490 INT i, err; 477 491 HKEY newkey; 478 CHAR realname[2];492 WCHAR realname[2]; 479 493 LPWINEMRUITEM witem; 494 WCHAR emptyW[] = {'\0'}; 480 495 481 496 /* or should we do the following instead of RegOpenKeyEx: … … 483 498 484 499 /* open the sub key */ 485 if ((err = RegOpenKeyEx A( mp->extview.hKey, mp->extview.lpszSubKey,486 500 if ((err = RegOpenKeyExW( mp->extview.hKey, mp->extview.lpszSubKey, 501 0, KEY_WRITE, &newkey))) { 487 502 /* not present - what to do ??? */ 488 503 ERR("Can not open key, error=%d, attempting to create\n", 489 504 err); 490 if ((err = RegCreateKeyEx A( mp->extview.hKey, mp->extview.lpszSubKey,505 if ((err = RegCreateKeyExW( mp->extview.hKey, mp->extview.lpszSubKey, 491 506 0, 492 "",507 emptyW, 493 508 REG_OPTION_NON_VOLATILE, 494 509 KEY_READ | KEY_WRITE, … … 497 512 0))) { 498 513 ERR("failed to create key /%s/, err=%d\n", 499 mp->extview.lpszSubKey, err);514 debugstr_w(mp->extview.lpszSubKey), err); 500 515 return; 501 516 } … … 504 519 mp->wineFlags &= ~WMRUF_CHANGED; 505 520 err = RegSetValueExA(newkey, "MRUList", 0, REG_SZ, 506 mp->realMRU, lstrlenA(mp->realMRU) + 1);521 mp->realMRU, strlen(mp->realMRU) + 1); 507 522 if (err) { 508 523 ERR("error saving MRUList, err=%d\n", err); … … 516 531 witem->itemFlag &= ~WMRUIF_CHANGED; 517 532 realname[0] = 'a' + i; 518 err = RegSetValueEx A(newkey, realname, 0,533 err = RegSetValueExW(newkey, realname, 0, 519 534 (mp->extview.dwFlags & MRUF_BINARY_LIST) ? 520 535 REG_BINARY : REG_SZ, 521 536 &witem->datastart, witem->size); 522 537 if (err) { 523 ERR("error saving /%s/, err=%d\n", realname, err);538 ERR("error saving /%s/, err=%d\n", debugstr_w(realname), err); 524 539 } 525 540 TRACE("saving value for name /%s/ size=%ld\n", 526 realname, witem->size);541 debugstr_w(realname), witem->size); 527 542 } 528 543 } … … 531 546 532 547 /************************************************************************** 533 * CreateMRUListA [COMCTL32.151]534 *535 * PARAMS536 * lpcml [I] ptr to CREATEMRULIST structure.537 *538 * RETURNS539 * Handle to MRU list.540 */541 HANDLE WINAPI542 CreateMRUListA (LPCREATEMRULIST lpcml)543 {544 return CreateMRUListLazyA (lpcml, 0, 0, 0);545 }546 547 /**************************************************************************548 548 * FreeMRUList [COMCTL32.152] 549 549 * … … 553 553 */ 554 554 DWORD WINAPI 555 FreeMRUList A(HANDLE hMRUList)555 FreeMRUList (HANDLE hMRUList) 556 556 { 557 557 LPWINEMRULIST mp = (LPWINEMRULIST)hMRUList; … … 570 570 COMCTL32_Free(mp->realMRU); 571 571 COMCTL32_Free(mp->array); 572 COMCTL32_Free((LPWSTR)mp->extview.lpszSubKey); 572 573 return COMCTL32_Free(mp); 573 574 } … … 595 596 LPWINEMRULIST mp = (LPWINEMRULIST)hList; 596 597 INT i, ret; 598 LPSTR dataA = NULL; 597 599 598 600 if (!mp->extview.lpfnCompare) { 599 601 ERR("MRU list not properly created. No compare procedure.\n"); 600 602 return -1; 603 } 604 605 if(!(mp->extview.dwFlags & MRUF_BINARY_LIST) && !mp->isUnicode) { 606 DWORD len = WideCharToMultiByte(CP_ACP, 0, lpData, -1, 607 NULL, 0, NULL, NULL); 608 dataA = COMCTL32_Alloc(len); 609 WideCharToMultiByte(CP_ACP, 0, lpData, -1, dataA, len, NULL, NULL); 601 610 } 602 611 … … 608 617 } 609 618 else { 610 if (!mp->extview.lpfnCompare(lpData, &mp->array[i]->datastart)) 611 break; 619 if(mp->isUnicode) { 620 if (!mp->extview.lpfnCompare(lpData, &mp->array[i]->datastart)) 621 break; 622 } else { 623 DWORD len = WideCharToMultiByte(CP_ACP, 0, 624 (LPWSTR)&mp->array[i]->datastart, -1, 625 NULL, 0, NULL, NULL); 626 LPSTR itemA = COMCTL32_Alloc(len); 627 INT cmp; 628 WideCharToMultiByte(CP_ACP, 0, (LPWSTR)&mp->array[i]->datastart, -1, 629 itemA, len, NULL, NULL); 630 631 cmp = mp->extview.lpfnCompare(dataA, itemA); 632 COMCTL32_Free(itemA); 633 if(!cmp) 634 break; 635 } 612 636 } 613 637 } 638 if(dataA) 639 COMCTL32_Free(dataA); 614 640 if (i < mp->cursize) 615 641 ret = i; … … 693 719 694 720 /************************************************************************** 695 * AddMRUString A [COMCTL32.153]721 * AddMRUStringW [COMCTL32.401] 696 722 * 697 723 * Add item to MRU string list. If item already exists in list them it is … … 708 734 */ 709 735 INT WINAPI 736 AddMRUStringW(HANDLE hList, LPCWSTR lpszString) 737 { 738 FIXME("(%08x, %s) empty stub!\n", hList, debugstr_w(lpszString)); 739 740 return 0; 741 } 742 743 /************************************************************************** 744 * AddMRUStringA [COMCTL32.153] 745 */ 746 INT WINAPI 710 747 AddMRUStringA(HANDLE hList, LPCSTR lpszString) 711 748 { … … 732 769 FIXME("(%08x, %d): stub\n", hList, nItemPos); 733 770 return TRUE; 771 } 772 773 /************************************************************************** 774 * FindMRUStringW [COMCTL32.402] 775 */ 776 INT WINAPI 777 FindMRUStringW (HANDLE hList, LPCWSTR lpszString, LPINT lpRegNum) 778 { 779 FIXME("stub\n"); 780 return -1; 734 781 } 735 782 … … 752 799 FindMRUStringA (HANDLE hList, LPCSTR lpszString, LPINT lpRegNum) 753 800 { 754 return FindMRUData(hList, (LPVOID)lpszString, lstrlenA(lpszString), 755 lpRegNum); 756 } 757 758 /************************************************************************** 759 * CreateMRUListLazyA [COMCTL32.157] 760 */ 761 HANDLE WINAPI 762 CreateMRUListLazyA (LPCREATEMRULIST lpcml, DWORD dwParam2, DWORD dwParam3, DWORD dwParam4) 763 { 764 LPWINEMRULIST mp; 801 DWORD len = MultiByteToWideChar(CP_ACP, 0, lpszString, -1, NULL, 0); 802 LPWSTR stringW = COMCTL32_Alloc(len * sizeof(WCHAR)); 803 INT ret; 804 805 MultiByteToWideChar(CP_ACP, 0, lpszString, -1, stringW, len); 806 ret = FindMRUData(hList, stringW, len * sizeof(WCHAR), lpRegNum); 807 COMCTL32_Free(stringW); 808 return ret; 809 } 810 811 /************************************************************************* 812 * CreateMRUListLazy_common 813 */ 814 HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp) 815 { 765 816 INT i, err; 766 817 HKEY newkey; 767 818 DWORD datasize, dwdisp; 768 CHAR realname[2];819 WCHAR realname[2]; 769 820 LPWINEMRUITEM witem; 770 821 DWORD type; 771 772 if (lpcml == NULL) 773 return 0; 774 775 if (lpcml->cbSize < sizeof(CREATEMRULIST)) 776 return 0; 777 778 mp = (LPWINEMRULIST) COMCTL32_Alloc(sizeof(WINEMRULIST)); 779 memcpy(mp, lpcml, sizeof(CREATEMRULIST)); 780 781 /* get space to save indexes that will turn into names 822 WCHAR emptyW[] = {'\0'}; 823 824 /* get space to save indices that will turn into names 782 825 * but in order of most to least recently used 783 826 */ … … 791 834 792 835 /* open the sub key */ 793 if ((err = RegCreateKeyExA( mp->extview.hKey, mp->extview.lpszSubKey,794 0,795 "",836 if ((err = RegCreateKeyExW( mp->extview.hKey, mp->extview.lpszSubKey, 837 0, 838 emptyW, 796 839 REG_OPTION_NON_VOLATILE, 797 840 KEY_READ | KEY_WRITE, … … 801 844 /* error - what to do ??? */ 802 845 ERR("(%lu %lu %lx %lx \"%s\" %p): Can not open key, error=%d\n", 803 lpcml->cbSize, lpcml->nMaxItems, lpcml->dwFlags,804 (DWORD) lpcml->hKey, lpcml->lpszSubKey, lpcml->lpfnCompare,805 846 mp->extview.cbSize, mp->extview.nMaxItems, mp->extview.dwFlags, 847 (DWORD)mp->extview.hKey, debugstr_w(mp->extview.lpszSubKey), 848 mp->extview.lpfnCompare, err); 806 849 return 0; 807 850 } … … 826 869 for(i=0; i<mp->cursize; i++) { 827 870 realname[0] = 'a' + i; 828 if(RegQueryValueEx A( newkey, realname, 0, &type, 0, &datasize)) {871 if(RegQueryValueExW( newkey, realname, 0, &type, 0, &datasize)) { 829 872 /* not present - what to do ??? */ 830 ERR("Key %s not found 1\n", realname);873 ERR("Key %s not found 1\n", debugstr_w(realname)); 831 874 } 832 875 mp->array[i] = witem = (LPWINEMRUITEM)COMCTL32_Alloc(datasize + 833 876 sizeof(WINEMRUITEM)); 834 877 witem->size = datasize; 835 if(RegQueryValueEx A( newkey, realname, 0, &type,878 if(RegQueryValueExW( newkey, realname, 0, &type, 836 879 &witem->datastart, &datasize)) { 837 880 /* not present - what to do ??? */ 838 ERR("Key %s not found 2\n", realname);881 ERR("Key %s not found 2\n", debugstr_w(realname)); 839 882 } 840 883 } … … 845 888 846 889 TRACE("(%lu %lu %lx %lx \"%s\" %p): Current Size = %ld\n", 847 lpcml->cbSize, lpcml->nMaxItems, lpcml->dwFlags, 848 (DWORD)lpcml->hKey, lpcml->lpszSubKey, lpcml->lpfnCompare, 849 mp->cursize); 850 890 mp->extview.cbSize, mp->extview.nMaxItems, mp->extview.dwFlags, 891 (DWORD)mp->extview.hKey, debugstr_w(mp->extview.lpszSubKey), 892 mp->extview.lpfnCompare, mp->cursize); 851 893 return (HANDLE)mp; 852 894 } 853 895 854 896 /************************************************************************** 855 * EnumMRUListA [COMCTL32.154] 856 * 897 * CreateMRUListLazyW [COMCTL32.404] 898 */ 899 HANDLE WINAPI 900 CreateMRUListLazyW (LPCREATEMRULISTW lpcml, DWORD dwParam2, DWORD dwParam3, DWORD dwParam4) 901 { 902 LPWINEMRULIST mp; 903 904 if (lpcml == NULL) 905 return 0; 906 907 if (lpcml->cbSize < sizeof(CREATEMRULISTW)) 908 return 0; 909 910 mp = (LPWINEMRULIST) COMCTL32_Alloc(sizeof(WINEMRULIST)); 911 memcpy(&mp->extview, lpcml, sizeof(CREATEMRULISTW)); 912 mp->extview.lpszSubKey = COMCTL32_Alloc((strlenW(lpcml->lpszSubKey) + 1) * 913 sizeof(WCHAR)); 914 strcpyW((LPWSTR)mp->extview.lpszSubKey, lpcml->lpszSubKey); 915 mp->isUnicode = TRUE; 916 917 return CreateMRUListLazy_common(mp); 918 } 919 920 /************************************************************************** 921 * CreateMRUListLazyA [COMCTL32.157] 922 */ 923 HANDLE WINAPI 924 CreateMRUListLazyA (LPCREATEMRULISTA lpcml, DWORD dwParam2, DWORD dwParam3, DWORD dwParam4) 925 { 926 LPWINEMRULIST mp; 927 DWORD len; 928 929 if (lpcml == NULL) 930 return 0; 931 932 if (lpcml->cbSize < sizeof(CREATEMRULISTA)) 933 return 0; 934 935 mp = (LPWINEMRULIST) COMCTL32_Alloc(sizeof(WINEMRULIST)); 936 memcpy(&mp->extview, lpcml, sizeof(CREATEMRULISTW)); 937 len = MultiByteToWideChar(CP_ACP, 0, lpcml->lpszSubKey, -1, NULL, 0); 938 mp->extview.lpszSubKey = COMCTL32_Alloc(len * sizeof(WCHAR)); 939 MultiByteToWideChar(CP_ACP, 0, lpcml->lpszSubKey, -1, 940 (LPWSTR)mp->extview.lpszSubKey, len); 941 mp->isUnicode = FALSE; 942 return CreateMRUListLazy_common(mp); 943 } 944 945 /************************************************************************** 946 * CreateMRUListW [COMCTL32.400] 947 * 948 * PARAMS 949 * lpcml [I] ptr to CREATEMRULIST structure. 950 * 951 * RETURNS 952 * Handle to MRU list. 953 */ 954 HANDLE WINAPI 955 CreateMRUListW (LPCREATEMRULISTW lpcml) 956 { 957 return CreateMRUListLazyW(lpcml, 0, 0, 0); 958 } 959 960 /************************************************************************** 961 * CreateMRUListA [COMCTL32.151] 962 */ 963 HANDLE WINAPI 964 CreateMRUListA (LPCREATEMRULISTA lpcml) 965 { 966 return CreateMRUListLazyA (lpcml, 0, 0, 0); 967 } 968 969 970 /************************************************************************** 971 * EnumMRUListW [COMCTL32.403] 972 * 857 973 * Enumerate item in a list 858 974 * … … 870 986 * the list. 871 987 */ 872 INT WINAPI EnumMRUList A(HANDLE hList, INT nItemPos, LPVOID lpBuffer,988 INT WINAPI EnumMRUListW(HANDLE hList, INT nItemPos, LPVOID lpBuffer, 873 989 DWORD nBufferSize) 874 990 { … … 889 1005 return datasize; 890 1006 } 1007 1008 /************************************************************************** 1009 * EnumMRUListA [COMCTL32.154] 1010 * 1011 */ 1012 INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, 1013 DWORD nBufferSize) 1014 { 1015 LPWINEMRULIST mp = (LPWINEMRULIST) hList; 1016 LPWINEMRUITEM witem; 1017 INT desired, datasize; 1018 DWORD lenA; 1019 1020 if (nItemPos >= mp->cursize) return -1; 1021 if ((nItemPos < 0) || !lpBuffer) return mp->cursize; 1022 desired = mp->realMRU[nItemPos]; 1023 desired -= 'a'; 1024 TRACE("nItemPos=%d, desired=%d\n", nItemPos, desired); 1025 witem = mp->array[desired]; 1026 if(mp->extview.dwFlags & MRUF_BINARY_LIST) { 1027 datasize = min( witem->size, nBufferSize ); 1028 memcpy( lpBuffer, &witem->datastart, datasize); 1029 } else { 1030 lenA = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)&witem->datastart, -1, 1031 NULL, 0, NULL, NULL); 1032 datasize = min( witem->size, nBufferSize ); 1033 WideCharToMultiByte(CP_ACP, 0, (LPWSTR)&witem->datastart, -1, 1034 lpBuffer, datasize, NULL, NULL); 1035 } 1036 TRACE("(%08x, %d, %p, %ld): returning len=%d\n", 1037 hList, nItemPos, lpBuffer, nBufferSize, datasize); 1038 return datasize; 1039 } 1040 891 1041 892 1042 /************************************************************************** … … 1328 1478 DSA_InsertItem (const HDSA hdsa, INT nIndex, LPVOID pSrc) 1329 1479 { 1330 INT nNewItems, nSize , i;1480 INT nNewItems, nSize; 1331 1481 LPVOID lpTemp, lpDest; 1332 LPDWORD p;1333 1482 1334 1483 TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc); … … 1337 1486 return -1; 1338 1487 1339 for (i = 0; i < hdsa->nItemSize; i += 4) {1340 p = *(DWORD**)((char *) pSrc + i);1341 if (IsBadStringPtrA ((char*)p, 256))1342 TRACE("-- %d=%p\n", i, (DWORD*)p);1343 else1344 TRACE("-- %d=%p [%s]\n", i, p, debugstr_a((char*)p));1345 }1346 1347 1488 /* when nIndex >= nItemCount then append */ 1348 1489 if (nIndex >= hdsa->nItemCount) … … 2162 2303 if (hwndParent) { 2163 2304 hwndParent = GetWindow (lpNotify->hwndFrom, GW_OWNER); 2164 if (hwndParent) 2165 idFrom = GetDlgCtrlID (lpNotify->hwndFrom); 2305 /* the following is done even if the return from above 2306 * is zero. GLA 12/2001 */ 2307 idFrom = GetDlgCtrlID (lpNotify->hwndFrom); 2166 2308 } 2167 2309 } … … 2182 2324 * 2183 2325 * PARAMS 2326 * hwndTo [I] 2184 2327 * hwndFrom [I] 2185 * hwndTo [I]2186 2328 * uCode [I] 2187 2329 * lpHdr [I] … … 2193 2335 2194 2336 LRESULT WINAPI 2195 COMCTL32_SendNotify (HWND hwnd From, HWND hwndTo,2337 COMCTL32_SendNotify (HWND hwndTo, HWND hwndFrom, 2196 2338 UINT uCode, LPNMHDR lpHdr) 2197 2339 { … … 2199 2341 2200 2342 TRACE("(0x%04x 0x%04x %d %p)\n", 2201 hwnd From, hwndTo, uCode, lpHdr);2343 hwndTo, hwndFrom, uCode, lpHdr); 2202 2344 2203 2345 notify.hwndFrom = hwndFrom; … … 2645 2787 } 2646 2788 2647 #ifdef __WIN32OS2__ 2648 DWORD WINAPI COMCTL32_389(DWORD x1, DWORD x2) 2649 { 2650 dprintf(("comctl32_389: %x %X not implemented!!", x1, x2)); 2651 return 0; //NT 4 comctl32 returns 0 2652 } 2653 2654 DWORD WINAPI COMCTL32_390(DWORD x1, DWORD x2, DWORD x3, DWORD x4) 2655 { 2656 dprintf(("comctl32_390: %x %x %x %x not implemented!!", x1, x2, x3, x4)); 2657 2658 /* Pseudo Assembler 2659 push [esp+arg_C] 2660 mov eax, [esp+4+arg_0] 2661 push [esp+4+arg_8] 2662 mov dword ptr [eax+1A8h], 1 2663 push [esp+8+arg_4] 2664 push dword ptr [eax + 38h] 2665 call ds:SetDIBColorTable 2666 retn 10h 2667 */ 2668 2669 return 0; 2670 } 2671 #endif 2789 /************************************************************************** 2790 * @ [COMCTL32.419] 2791 * 2792 * FIXME: What's this supposed to do? 2793 */ 2794 2795 BOOL WINAPI COMCTL32_419( DWORD a, DWORD b, DWORD c, DWORD d) 2796 { 2797 2798 FIXME("(%lx, %lx, %lx, %lx): stub!\n", a, b, c, d); 2799 2800 return TRUE; 2801 } 2802 -
trunk/src/comctl32/imagelist.c
r7508 r7815 4 4 * Copyright 1998 Eric Kohl 5 5 * 2000 Jason Mawdsley. 6 * 2001 Michael Stefaniuc 7 * 2001 Charles Loep for CodeWeavers 6 8 * 7 9 * TODO: 8 10 * - Fix ImageList_DrawIndirect (xBitmap, yBitmap, rgbFg, rgbBk, dwRop). 9 11 * - Fix ImageList_GetIcon. 10 * - Fix drag functions.11 * - Fix ImageList_Write.12 12 * - Fix ImageList_SetFilter (undocumented). 13 13 * BTW does anybody know anything about this function??? … … 24 24 */ 25 25 26 #include <stdlib.h> 26 27 #include <string.h> 27 28 #include "winerror.h" … … 36 37 37 38 38 #define _MAX(a,b) (((a)>(b))?(a):(b))39 #define _MIN(a,b) (((a)>(b))?(b):(a))40 41 39 #define MAX_OVERLAYIMAGE 15 42 40 43 44 41 /* internal image list data used for Drag & Drop operations */ 45 46 static HIMAGELIST himlInternalDrag = NULL; 47 static INT nInternalDragHotspotX = 0; 48 static INT nInternalDragHotspotY = 0; 49 50 static HWND hwndInternalDrag = 0; 51 static INT xInternalPos = 0; 52 static INT yInternalPos = 0; 53 54 static HDC hdcBackBuffer = 0; 55 static HBITMAP hbmBackBuffer = 0; 42 typedef struct 43 { 44 HWND hwnd; 45 HIMAGELIST himl; 46 /* position of the drag image relative to the window */ 47 INT x; 48 INT y; 49 /* offset of the hotspot relative to the origin of the image */ 50 INT dxHotspot; 51 INT dyHotspot; 52 /* is the drag image visible */ 53 BOOL bShow; 54 /* saved background */ 55 HBITMAP hbmBg; 56 } INTERNALDRAG; 57 58 static INTERNALDRAG InternalDrag = { 0, 0, 0, 0, 0, 0, FALSE, 0 }; 59 56 60 57 61 … … 78 82 INT nNewWidth, nNewCount; 79 83 80 if ((himl->cCurImage + nImageCount < himl->cMaxImage)84 if ((himl->cCurImage + nImageCount <= himl->cMaxImage) 81 85 && (himl->cy >= cy)) 82 86 return; … … 459 463 } 460 464 } 461 462 463 464 465 465 466 … … 707 708 { 708 709 HDC hdcSrc, hdcDst; 709 710 FIXME("partially implemented!\n"); 710 INT cx, cy; 711 712 TRACE("(himlTrack=%p iTrack=%d dx=%d dy=%d)\n", himlTrack, iTrack, 713 dxHotspot, dyHotspot); 711 714 712 715 if (himlTrack == NULL) 713 716 return FALSE; 714 717 715 if ( himlInternalDrag)718 if (InternalDrag.himl) 716 719 ImageList_EndDrag (); 717 720 718 himlInternalDrag = 719 ImageList_Create (himlTrack->cx, himlTrack->cy, 720 himlTrack->flags, 1, 1); 721 if (himlInternalDrag == NULL) { 721 cx = himlTrack->cx; 722 cy = himlTrack->cy; 723 724 InternalDrag.himl = ImageList_Create (cx, cy, himlTrack->flags, 1, 1); 725 if (InternalDrag.himl == NULL) { 722 726 ERR("Error creating drag image list!\n"); 723 727 return FALSE; 724 728 } 725 729 726 nInternalDragHotspotX= dxHotspot;727 nInternalDragHotspotY= dyHotspot;730 InternalDrag.dxHotspot = dxHotspot; 731 InternalDrag.dyHotspot = dyHotspot; 728 732 729 733 hdcSrc = CreateCompatibleDC (0); … … 732 736 /* copy image */ 733 737 SelectObject (hdcSrc, himlTrack->hbmImage); 734 SelectObject (hdcDst, himlInternalDrag->hbmImage); 735 StretchBlt (hdcDst, 0, 0, himlInternalDrag->cx, himlInternalDrag->cy, hdcSrc, 736 iTrack * himlTrack->cx, 0, himlTrack->cx, himlTrack->cy, SRCCOPY); 738 SelectObject (hdcDst, InternalDrag.himl->hbmImage); 739 BitBlt (hdcDst, 0, 0, cx, cy, hdcSrc, iTrack * cx, 0, SRCCOPY); 737 740 738 741 /* copy mask */ 739 742 SelectObject (hdcSrc, himlTrack->hbmMask); 740 SelectObject (hdcDst, himlInternalDrag->hbmMask); 741 StretchBlt (hdcDst, 0, 0, himlInternalDrag->cx, himlInternalDrag->cy, hdcSrc, 742 iTrack * himlTrack->cx, 0, himlTrack->cx, himlTrack->cy, SRCCOPY); 743 SelectObject (hdcDst, InternalDrag.himl->hbmMask); 744 BitBlt (hdcDst, 0, 0, cx, cy, hdcSrc, iTrack * cx, 0, SRCCOPY); 743 745 744 746 DeleteDC (hdcSrc); 745 747 DeleteDC (hdcDst); 746 748 747 himlInternalDrag->cCurImage = 1;749 InternalDrag.himl->cCurImage = 1; 748 750 749 751 return TRUE; … … 1032 1034 ImageList_DragEnter (HWND hwndLock, INT x, INT y) 1033 1035 { 1034 if (himlInternalDrag == NULL) 1036 TRACE("(hwnd=%#x x=%d y=%d)\n", hwndLock, x, y); 1037 1038 if (InternalDrag.himl == NULL) 1035 1039 return FALSE; 1036 1040 1037 1041 if (hwndLock) 1038 hwndInternalDrag= hwndLock;1042 InternalDrag.hwnd = hwndLock; 1039 1043 else 1040 hwndInternalDrag = GetDesktopWindow (); 1041 1042 xInternalPos = x; 1043 yInternalPos = y; 1044 1045 hdcBackBuffer = CreateCompatibleDC (0); 1046 hbmBackBuffer = CreateCompatibleBitmap (hdcBackBuffer, 1047 himlInternalDrag->cx, himlInternalDrag->cy); 1048 1049 ImageList_DragShowNolock (TRUE); 1050 1051 return FALSE; 1044 InternalDrag.hwnd = GetDesktopWindow (); 1045 1046 InternalDrag.x = x; 1047 InternalDrag.y = y; 1048 1049 /* draw the drag image and save the background */ 1050 if (!ImageList_DragShowNolock(TRUE)) { 1051 return FALSE; 1052 } 1053 1054 return TRUE; 1052 1055 } 1053 1056 … … 1070 1073 { 1071 1074 if (hwndLock) 1072 hwndInternalDrag= hwndLock;1075 InternalDrag.hwnd = hwndLock; 1073 1076 else 1074 hwndInternalDrag= GetDesktopWindow ();1077 InternalDrag.hwnd = GetDesktopWindow (); 1075 1078 1076 1079 ImageList_DragShowNolock (FALSE); 1077 1078 DeleteDC (hdcBackBuffer);1079 DeleteObject (hbmBackBuffer);1080 1080 1081 1081 return TRUE; … … 1099 1099 * The position of the drag image is relative to the window, not 1100 1100 * the client area. 1101 * 1102 * BUGS 1103 * The drag image should be drawn semitransparent. 1101 1104 */ 1102 1105 … … 1104 1107 ImageList_DragMove (INT x, INT y) 1105 1108 { 1106 ImageList_DragShowNolock (FALSE); 1107 1108 xInternalPos = x; 1109 yInternalPos = y; 1110 1111 ImageList_DragShowNolock (TRUE); 1112 1113 return FALSE; 1109 TRACE("(x=%d y=%d)\n", x, y); 1110 1111 if (!InternalDrag.himl) { 1112 return FALSE; 1113 } 1114 1115 /* draw/update the drag image */ 1116 if (InternalDrag.bShow) { 1117 HDC hdcDrag; 1118 HDC hdcOffScreen; 1119 HDC hdcBg; 1120 HBITMAP hbmOffScreen; 1121 INT origNewX, origNewY; 1122 INT origOldX, origOldY; 1123 INT origRegX, origRegY; 1124 INT sizeRegX, sizeRegY; 1125 1126 1127 /* calculate the update region */ 1128 origNewX = x - InternalDrag.dxHotspot; 1129 origNewY = y - InternalDrag.dyHotspot; 1130 origOldX = InternalDrag.x - InternalDrag.dxHotspot; 1131 origOldY = InternalDrag.y - InternalDrag.dyHotspot; 1132 origRegX = min(origNewX, origOldX); 1133 origRegY = min(origNewY, origOldY); 1134 sizeRegX = InternalDrag.himl->cx + abs(x - InternalDrag.x); 1135 sizeRegY = InternalDrag.himl->cy + abs(y - InternalDrag.y); 1136 1137 hdcDrag = GetDCEx(InternalDrag.hwnd, 0, 1138 DCX_WINDOW | DCX_CACHE | DCX_LOCKWINDOWUPDATE); 1139 hdcOffScreen = CreateCompatibleDC(hdcDrag); 1140 hdcBg = CreateCompatibleDC(hdcDrag); 1141 1142 hbmOffScreen = CreateCompatibleBitmap(hdcDrag, sizeRegX, sizeRegY); 1143 SelectObject(hdcOffScreen, hbmOffScreen); 1144 SelectObject(hdcBg, InternalDrag.hbmBg); 1145 1146 /* get the actual background of the update region */ 1147 BitBlt(hdcOffScreen, 0, 0, sizeRegX, sizeRegY, hdcDrag, 1148 origRegX, origRegY, SRCCOPY); 1149 /* erase the old image */ 1150 BitBlt(hdcOffScreen, origOldX - origRegX, origOldY - origRegY, 1151 InternalDrag.himl->cx, InternalDrag.himl->cy, hdcBg, 0, 0, 1152 SRCCOPY); 1153 /* save the background */ 1154 BitBlt(hdcBg, 0, 0, InternalDrag.himl->cx, InternalDrag.himl->cy, 1155 hdcOffScreen, origNewX - origRegX, origNewY - origRegY, SRCCOPY); 1156 /* draw the image */ 1157 /* FIXME: image should be drawn semitransparent */ 1158 ImageList_Draw(InternalDrag.himl, 0, hdcOffScreen, origNewX - origRegX, 1159 origNewY - origRegY, ILD_NORMAL); 1160 /* draw the update region to the screen */ 1161 BitBlt(hdcDrag, origRegX, origRegY, sizeRegX, sizeRegY, 1162 hdcOffScreen, 0, 0, SRCCOPY); 1163 1164 DeleteDC(hdcBg); 1165 DeleteDC(hdcOffScreen); 1166 DeleteObject(hbmOffScreen); 1167 ReleaseDC(InternalDrag.hwnd, hdcDrag); 1168 } 1169 1170 /* update the image position */ 1171 InternalDrag.x = x; 1172 InternalDrag.y = y; 1173 1174 return TRUE; 1114 1175 } 1115 1176 … … 1127 1188 * Failure: FALSE 1128 1189 * 1129 * FIXME1130 * semi-stub.1190 * BUGS 1191 * The drag image should be drawn semitransparent. 1131 1192 */ 1132 1193 … … 1135 1196 { 1136 1197 HDC hdcDrag; 1137 1138 FIXME("semi-stub!\n"); 1198 HDC hdcBg; 1199 INT x, y; 1200 1139 1201 TRACE("bShow=0x%X!\n", bShow); 1140 1202 1141 hdcDrag = GetDCEx (hwndInternalDrag, 0, 1203 /* DragImage is already visible/hidden */ 1204 if ((InternalDrag.bShow && bShow) || (!InternalDrag.bShow && !bShow)) { 1205 return FALSE; 1206 } 1207 1208 /* position of the origin of the DragImage */ 1209 x = InternalDrag.x - InternalDrag.dxHotspot; 1210 y = InternalDrag.y - InternalDrag.dyHotspot; 1211 1212 hdcDrag = GetDCEx (InternalDrag.hwnd, 0, 1142 1213 DCX_WINDOW | DCX_CACHE | DCX_LOCKWINDOWUPDATE); 1143 1214 if (!hdcDrag) { 1215 return FALSE; 1216 } 1217 1218 hdcBg = CreateCompatibleDC(hdcDrag); 1219 if (!InternalDrag.hbmBg) { 1220 InternalDrag.hbmBg = CreateCompatibleBitmap(hdcDrag, 1221 InternalDrag.himl->cx, InternalDrag.himl->cy); 1222 } 1223 SelectObject(hdcBg, InternalDrag.hbmBg); 1224 1144 1225 if (bShow) { 1145 /* s how drag image*/1146 1147 /* save background */1148 1149 /* draw drag image*/1150 1151 } 1152 else { 1153 /* hide drag image */1154 1155 /* restore background */ 1156 1157 }1158 1159 ReleaseDC (hwndInternalDrag, hdcDrag);1160 1161 return FALSE;1226 /* save the background */ 1227 BitBlt(hdcBg, 0, 0, InternalDrag.himl->cx, InternalDrag.himl->cy, 1228 hdcDrag, x, y, SRCCOPY); 1229 /* show the image */ 1230 /* FIXME: this should be drawn semitransparent */ 1231 ImageList_Draw(InternalDrag.himl, 0, hdcDrag, x, y, ILD_NORMAL); 1232 } else { 1233 /* hide the image */ 1234 BitBlt(hdcDrag, x, y, InternalDrag.himl->cx, InternalDrag.himl->cy, 1235 hdcBg, 0, 0, SRCCOPY); 1236 } 1237 1238 InternalDrag.bShow = !InternalDrag.bShow; 1239 1240 DeleteDC(hdcBg); 1241 ReleaseDC (InternalDrag.hwnd, hdcDrag); 1242 return TRUE; 1162 1243 } 1163 1244 … … 1393 1474 * Success: TRUE 1394 1475 * Failure: FALSE 1395 *1396 * BUGS1397 * semi-stub.1398 1476 */ 1399 1477 … … 1401 1479 ImageList_EndDrag (void) 1402 1480 { 1403 FIXME("semi-stub!\n"); 1404 1405 if (himlInternalDrag) 1406 { 1407 1408 ImageList_Destroy (himlInternalDrag); 1409 himlInternalDrag = NULL; 1410 1411 nInternalDragHotspotX = 0; 1412 nInternalDragHotspotY = 0; 1413 1414 } 1481 /* cleanup the InternalDrag struct */ 1482 InternalDrag.hwnd = 0; 1483 ImageList_Destroy (InternalDrag.himl); 1484 InternalDrag.himl = 0; 1485 InternalDrag.x= 0; 1486 InternalDrag.y= 0; 1487 InternalDrag.dxHotspot = 0; 1488 InternalDrag.dyHotspot = 0; 1489 InternalDrag.bShow = FALSE; 1490 DeleteObject(InternalDrag.hbmBg); 1491 InternalDrag.hbmBg = 0; 1415 1492 1416 1493 return TRUE; … … 1453 1530 * Success: Handle of the drag image list. 1454 1531 * Failure: NULL. 1455 *1456 * BUGS1457 * semi-stub.1458 1532 */ 1459 1533 … … 1461 1535 ImageList_GetDragImage (POINT *ppt, POINT *pptHotspot) 1462 1536 { 1463 FIXME("semi-stub!\n"); 1464 1465 if (himlInternalDrag) 1466 return (himlInternalDrag); 1537 if (InternalDrag.himl) { 1538 if (ppt) { 1539 ppt->x = InternalDrag.x; 1540 ppt->y = InternalDrag.y; 1541 } 1542 if (pptHotspot) { 1543 pptHotspot->x = InternalDrag.dxHotspot; 1544 pptHotspot->y = InternalDrag.dyHotspot; 1545 } 1546 return (InternalDrag.himl); 1547 } 1467 1548 1468 1549 return NULL; 1550 } 1551 1552 1553 /************************************************************************* 1554 * ImageList_GetFlags [COMCTL32.58] 1555 * 1556 * BUGS 1557 * Stub. 1558 */ 1559 1560 DWORD WINAPI 1561 ImageList_GetFlags(HIMAGELIST himl) 1562 { 1563 FIXME("(%p):empty stub\n", himl); 1564 return 0; 1469 1565 } 1470 1566 … … 1838 1934 INT nX1, nX2; 1839 1935 1936 TRACE("(himl1=%p i1=%d himl2=%p i2=%d dx=%d dy=%d)\n", himl1, i1, himl2, 1937 i2, dx, dy); 1938 1840 1939 if ((himl1 == NULL) || (himl2 == NULL)) 1841 1940 return NULL; … … 1853 1952 1854 1953 if (dx > 0) { 1855 cxDst = _MAX(himl1->cx, dx + himl2->cx);1954 cxDst = max (himl1->cx, dx + himl2->cx); 1856 1955 xOff1 = 0; 1857 1956 xOff2 = dx; 1858 1957 } 1859 1958 else if (dx < 0) { 1860 cxDst = _MAX(himl2->cx, himl1->cx - dx);1959 cxDst = max (himl2->cx, himl1->cx - dx); 1861 1960 xOff1 = -dx; 1862 1961 xOff2 = 0; 1863 1962 } 1864 1963 else { 1865 cxDst = _MAX(himl1->cx, himl2->cx);1964 cxDst = max (himl1->cx, himl2->cx); 1866 1965 xOff1 = 0; 1867 1966 xOff2 = 0; … … 1869 1968 1870 1969 if (dy > 0) { 1871 cyDst = _MAX(himl1->cy, dy + himl2->cy);1970 cyDst = max (himl1->cy, dy + himl2->cy); 1872 1971 yOff1 = 0; 1873 1972 yOff2 = dy; 1874 1973 } 1875 1974 else if (dy < 0) { 1876 cyDst = _MAX(himl2->cy, himl1->cy - dy);1975 cyDst = max (himl2->cy, himl1->cy - dy); 1877 1976 yOff1 = -dy; 1878 1977 yOff2 = 0; 1879 1978 } 1880 1979 else { 1881 cyDst = _MAX(himl1->cy, himl2->cy);1980 cyDst = max (himl1->cy, himl2->cy); 1882 1981 yOff1 = 0; 1883 1982 yOff2 = 0; … … 1922 2021 DeleteDC (hdcSrcImage); 1923 2022 DeleteDC (hdcDstImage); 2023 himlDst->cCurImage = 1; 1924 2024 } 1925 2025 … … 2380 2480 2381 2481 if (i == -1) { 2382 if (himl->cCurImage + 1 > =himl->cMaxImage)2482 if (himl->cCurImage + 1 > himl->cMaxImage) 2383 2483 IMAGELIST_InternalExpandBitmaps (himl, 1, 0, 0); 2384 2484 … … 2474 2574 * Failure: FALSE 2475 2575 * 2476 * BUGS 2477 * semi-stub. 2576 * NOTES 2577 * When this function is called and the drag image is visible, a 2578 * short flickering occurs but this matches the Win9x behavior. It is 2579 * possible to fix the flickering using code like in ImageList_DragMove. 2478 2580 */ 2479 2581 … … 2483 2585 { 2484 2586 HIMAGELIST himlTemp; 2485 2486 FIXME("semi-stub!\n");2487 2488 if ( himlInternalDrag== NULL)2587 INT dx, dy; 2588 BOOL visible; 2589 2590 if (InternalDrag.himl == NULL) 2489 2591 return FALSE; 2490 2592 2491 2593 TRACE(" dxH=%d dyH=%d nX=%d nY=%d\n", 2492 dxHotspot, dyHotspot, nInternalDragHotspotX, nInternalDragHotspotY); 2493 2494 himlTemp = ImageList_Merge (himlInternalDrag, 0, himlDrag, iDrag, 2495 dxHotspot, dyHotspot); 2496 2497 ImageList_Destroy (himlInternalDrag); 2498 himlInternalDrag = himlTemp; 2499 2500 nInternalDragHotspotX = dxHotspot; 2501 nInternalDragHotspotY = dyHotspot; 2502 2503 return FALSE; 2594 dxHotspot, dyHotspot, InternalDrag.dxHotspot, InternalDrag.dyHotspot); 2595 2596 visible = InternalDrag.bShow; 2597 2598 /* Calculate the offset between the origin of the old image and the 2599 * origin of the second image. 2600 * dxHotspot, dyHotspot is the offset of THE Hotspot (there is only one 2601 * hotspot) to the origin of the second image. 2602 * See M$DN for details */ 2603 dx = InternalDrag.dxHotspot - dxHotspot; 2604 dy = InternalDrag.dyHotspot - dyHotspot; 2605 himlTemp = ImageList_Merge (InternalDrag.himl, 0, himlDrag, iDrag, dx, dy); 2606 2607 if (visible) { 2608 /* hide the drag image */ 2609 ImageList_DragShowNolock(FALSE); 2610 } 2611 if ((InternalDrag.himl->cx != himlTemp->cx) || 2612 (InternalDrag.himl->cy != himlTemp->cy)) { 2613 /* the size of the drag image changed, invalidate the buffer */ 2614 DeleteObject(InternalDrag.hbmBg); 2615 InternalDrag.hbmBg = 0; 2616 } 2617 2618 ImageList_Destroy (InternalDrag.himl); 2619 InternalDrag.himl = himlTemp; 2620 2621 /* update the InternalDragOffset, if the origin of the 2622 * DragImage was changed by ImageList_Merge. */ 2623 if (dx > InternalDrag.dxHotspot) { 2624 InternalDrag.dxHotspot = dx; 2625 } 2626 if (dy > InternalDrag.dyHotspot) { 2627 InternalDrag.dyHotspot = dy; 2628 } 2629 2630 if (visible) { 2631 /* show the drag image */ 2632 ImageList_DragShowNolock(TRUE); 2633 } 2634 2635 return TRUE; 2504 2636 } 2505 2637 … … 2531 2663 2532 2664 return FALSE; 2665 } 2666 2667 2668 /************************************************************************* 2669 * ImageList_SetFlags [COMCTL32.79] 2670 * 2671 * BUGS 2672 * Stub. 2673 */ 2674 2675 DWORD WINAPI 2676 ImageList_SetFlags(HIMAGELIST himl, DWORD flags) 2677 { 2678 FIXME("(%p %08lx):empty stub\n", himl, flags); 2679 return 0; 2533 2680 } 2534 2681 … … 2612 2759 2613 2760 nNewCount = iImageCount + himl->cGrow; 2614 nCopyCount = _MIN(himl->cCurImage, iImageCount);2761 nCopyCount = min(himl->cCurImage, iImageCount); 2615 2762 2616 2763 hdcImageList = CreateCompatibleDC (0); … … 2707 2854 2708 2855 2856 2857 /* helper for ImageList_Write - write bitmap to pstm 2858 * currently everything is written as 24 bit RGB, except masks 2859 */ 2860 static BOOL 2861 _write_bitmap(HBITMAP hBitmap, LPSTREAM pstm, int cx, int cy) 2862 { 2863 LPBITMAPFILEHEADER bmfh; 2864 LPBITMAPINFOHEADER bmih; 2865 LPBYTE data, lpBits, lpBitsOrg; 2866 BITMAP bm; 2867 INT bitCount, sizeImage, offBits, totalSize; 2868 INT nwidth, nheight, nsizeImage, icount; 2869 HDC xdc; 2870 BOOL result = FALSE; 2871 2872 2873 xdc = GetDC(0); 2874 GetObjectA(hBitmap, sizeof(BITMAP), (LPVOID)&bm); 2875 2876 /* XXX is this always correct? */ 2877 icount = bm.bmWidth / cx; 2878 nwidth = cx << 2; 2879 nheight = cy * ((icount+3)>>2); 2880 2881 bitCount = bm.bmBitsPixel == 1 ? 1 : 24; 2882 sizeImage = ((((bm.bmWidth * bitCount)+31) & ~31) >> 3) * bm.bmHeight; 2883 nsizeImage = ((((nwidth * bitCount)+31) & ~31) >> 3) * nheight; 2884 2885 totalSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER); 2886 if(bitCount != 24) 2887 totalSize += (1 << bitCount) * sizeof(RGBQUAD); 2888 offBits = totalSize; 2889 totalSize += nsizeImage; 2890 2891 data = (LPBYTE)LocalAlloc(LMEM_ZEROINIT, totalSize); 2892 bmfh = (LPBITMAPFILEHEADER)data; 2893 bmih = (LPBITMAPINFOHEADER)(data + sizeof(BITMAPFILEHEADER)); 2894 lpBits = data + offBits; 2895 2896 /* setup BITMAPFILEHEADER */ 2897 bmfh->bfType = (('M' << 8) | 'B'); 2898 bmfh->bfSize = 0; 2899 bmfh->bfReserved1 = 0; 2900 bmfh->bfReserved2 = 0; 2901 bmfh->bfOffBits = offBits; 2902 2903 /* setup BITMAPINFOHEADER */ 2904 bmih->biSize = sizeof(BITMAPINFOHEADER); 2905 bmih->biWidth = bm.bmWidth; 2906 bmih->biHeight = bm.bmHeight; 2907 bmih->biPlanes = 1; 2908 bmih->biBitCount = bitCount; 2909 bmih->biCompression = BI_RGB; 2910 bmih->biSizeImage = nsizeImage; 2911 bmih->biXPelsPerMeter = 0; 2912 bmih->biYPelsPerMeter = 0; 2913 bmih->biClrUsed = 0; 2914 bmih->biClrImportant = 0; 2915 2916 lpBitsOrg = (LPBYTE)LocalAlloc(LMEM_ZEROINIT, nsizeImage); 2917 if(!GetDIBits(xdc, hBitmap, 0, bm.bmHeight, lpBitsOrg, 2918 (BITMAPINFO *)bmih, DIB_RGB_COLORS)) 2919 goto failed; 2920 else { 2921 int i; 2922 int obpl = (((bm.bmWidth*bitCount+31) & ~31)>>3); 2923 int nbpl = (((nwidth*bitCount+31) & ~31)>>3); 2924 2925 for(i = 0; i < nheight; i++) { 2926 int ooff = ((nheight-1-i)%cy) * obpl + ((i/cy) * nbpl); 2927 int noff = (nbpl * (nheight-1-i)); 2928 memcpy(lpBits + noff, lpBitsOrg + ooff, nbpl); 2929 } 2930 } 2931 2932 bmih->biWidth = nwidth; 2933 bmih->biHeight = nheight; 2934 2935 if(bitCount == 1) { 2936 //Hack. 2937 LPBITMAPINFO inf = (LPBITMAPINFO)bmih; 2938 inf->bmiColors[0].rgbRed = inf->bmiColors[0].rgbGreen = inf->bmiColors[0].rgbBlue = 0; 2939 inf->bmiColors[1].rgbRed = inf->bmiColors[1].rgbGreen = inf->bmiColors[1].rgbBlue = 0xff; 2940 } 2941 2942 if(!SUCCEEDED(IStream_Write(pstm, data, totalSize, NULL))) 2943 goto failed; 2944 2945 result = TRUE; 2946 2947 failed: 2948 ReleaseDC(0, xdc); 2949 LocalFree((HLOCAL)lpBitsOrg); 2950 2951 return result; 2952 } 2953 2954 2709 2955 /************************************************************************* 2710 2956 * ImageList_Write [COMCTL32.83] … … 2720 2966 * Failure: FALSE 2721 2967 * 2722 * NOTES2723 * This function can not be implemented yet, because2724 * IStream32::Write is not implemented.2725 *2726 2968 * BUGS 2727 * empty stub.2969 * probably. 2728 2970 */ 2729 2971 … … 2731 2973 ImageList_Write (HIMAGELIST himl, LPSTREAM pstm) 2732 2974 { 2975 ILHEAD ilHead; 2976 int i; 2977 2733 2978 if (!himl) 2734 2979 return FALSE; 2735 2980 2736 FIXME("empty stub!\n"); 2737 2738 return FALSE; 2739 } 2740 2981 ilHead.usMagic = (('L' << 8) | 'I'); 2982 ilHead.usVersion = 0x101; 2983 ilHead.cCurImage = himl->cCurImage; 2984 ilHead.cMaxImage = himl->cMaxImage; 2985 ilHead.cGrow = himl->cGrow; 2986 ilHead.cx = himl->cx; 2987 ilHead.cy = himl->cy; 2988 ilHead.bkcolor = himl->clrBk; 2989 ilHead.flags = himl->flags; 2990 for(i = 0; i < 4; i++) { 2991 ilHead.ovls[i] = himl->nOvlIdx[i]; 2992 } 2993 2994 if(!SUCCEEDED(IStream_Write(pstm, &ilHead, sizeof(ILHEAD), NULL))) 2995 return FALSE; 2996 2997 /* write the bitmap */ 2998 if(!_write_bitmap(himl->hbmImage, pstm, himl->cx, himl->cy)) 2999 return FALSE; 3000 3001 /* write the mask if we have one */ 3002 if(himl->flags & ILC_MASK) { 3003 if(!_write_bitmap(himl->hbmMask, pstm, himl->cx, himl->cy)) 3004 return FALSE; 3005 } 3006 3007 return TRUE; 3008 } 3009 -
trunk/src/comctl32/initcomctl32.cpp
r6644 r7815 1 /* $Id: initcomctl32.cpp,v 1. 3 2001-09-05 12:04:58 birdExp $ */1 /* $Id: initcomctl32.cpp,v 1.4 2002-02-06 17:23:19 sandervl Exp $ */ 2 2 /* 3 3 * COMCTL32 DLL entry point … … 58 58 59 59 case DLL_PROCESS_DETACH: 60 { 61 BOOL ret = COMCTL32_LibMain(hinstDLL, fdwReason, fImpLoad); 62 return ret; 63 } 60 return COMCTL32_LibMain(hinstDLL, fdwReason, fImpLoad); 64 61 } 65 62 return FALSE; -
trunk/src/comctl32/makefile
r6892 r7815 1 # $Id: makefile,v 1.3 6 2001-09-30 08:58:01 birdExp $1 # $Id: makefile,v 1.37 2002-02-06 17:23:20 sandervl Exp $ 2 2 3 3 # … … 22 22 $(OBJDIR)\initterm.obj \ 23 23 $(OBJDIR)\initcomctl32.obj \ 24 $(OBJDIR)\commctrl.obj \ 24 25 $(OBJDIR)\progress.obj \ 25 26 $(OBJDIR)\comctl32undoc.obj \ -
trunk/src/comctl32/rebar.c
r7726 r7815 21 21 22 22 /* 23 * Rebar control rev 8 a23 * Rebar control rev 8b 24 24 * 25 25 * Copyright 1998, 1999 Eric Kohl … … 89 89 * time. 90 90 * 16. Fix REBARSPACE. It should depend on CCS_NODIVIDER. 91 * rev 8b 92 * 17. Fix determination of whether Gripper is needed in _ValidateBand. 93 * 18. Fix _AdjustBand processing of RBBS_FIXEDSIZE. 94 * rev 8c 95 * 19. Fix problem in _Layout when all lengths are 0. 91 96 * 92 97 * … … 123 128 #include "debugtools.h" 124 129 125 #ifdef __WIN32OS2__126 #include <winuser.h>127 #include "ccbase.h"128 #endif129 130 130 DEFAULT_DEBUG_CHANNEL(rebar); 131 131 … … 196 196 typedef struct 197 197 { 198 #ifdef __WIN32OS2__199 COMCTL32_HEADER header;200 #endif201 198 COLORREF clrBk; /* background color */ 202 199 COLORREF clrText; /* text color */ … … 209 206 HWND hwndToolTip; /* handle to the tool tip control */ 210 207 HWND hwndNotify; /* notification window (parent) */ 211 #ifdef __WIN32OS2__212 208 HFONT hDefaultFont; 213 #endif214 209 HFONT hFont; /* handle to the rebar's font */ 215 210 SIZE imageSize; /* image size (image list) */ … … 577 572 INT oldBkMode = SetBkMode (hdc, TRANSPARENT); 578 573 COLORREF oldcolor = CLR_NONE; 579 oldcolor = SetTextColor (hdc, (lpBand->clrFore != CLR_NONE) ? 580 lpBand->clrFore : infoPtr->clrBtnText); 574 COLORREF new; 575 if (lpBand->clrFore != CLR_NONE) { 576 new = (lpBand->clrFore == CLR_DEFAULT) ? infoPtr->clrBtnText : 577 lpBand->clrFore; 578 oldcolor = SetTextColor (hdc, new); 579 } 581 580 DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText, 582 581 DT_CENTER | DT_VCENTER | DT_SINGLELINE); 583 582 if (oldBkMode != TRANSPARENT) 584 583 SetBkMode (hdc, oldBkMode); 585 SetTextColor (hdc, oldcolor); 584 if (lpBand->clrFore != CLR_NONE) 585 SetTextColor (hdc, oldcolor); 586 586 SelectObject (hdc, hOldFont); 587 587 } … … 716 716 717 717 /* compute new width */ 718 if ( lpBand->hwndChild && extra) {718 if ((lpBand->hwndChild && extra) && !(lpBand->fStyle & RBBS_FIXEDSIZE)) { 719 719 /* set to the "current" band size less the header */ 720 720 fudge = lpBand->ccx; … … 1331 1331 INT initx, inity, x, y, cx, cxsep, mmcy, mcy, clientcx, clientcy; 1332 1332 INT adjcx, adjcy, row, rightx, bottomy, origheight; 1333 UINT i, j, rowstart, origrows ;1333 UINT i, j, rowstart, origrows, cntonrow; 1334 1334 BOOL dobreak; 1335 1335 … … 1392 1392 rowstart = 0; 1393 1393 prevBand = NULL; 1394 cntonrow = 0; 1394 1395 1395 1396 for (i = 0; i < infoPtr->uNumBands; i++) { … … 1410 1411 1411 1412 /* separator from previous band */ 1412 cxsep = ( ((infoPtr->dwStyle & CCS_VERT) ? y==inity : x==initx)) ? 1413 0 : SEP_WIDTH; 1413 cxsep = (cntonrow == 0) ? 0 : SEP_WIDTH; 1414 1414 1415 1415 /* Header: includes gripper, text, image */ … … 1453 1453 prevBand = NULL; 1454 1454 rowstart = i; 1455 cntonrow = 0; 1455 1456 } 1456 1457 … … 1508 1509 lpBand->rcBand.right, lpBand->rcBand.bottom); 1509 1510 prevBand = lpBand; 1511 cntonrow++; 1510 1512 1511 1513 } /* for (i = 0; i < infoPtr->uNumBands... */ … … 1730 1732 lpBand = &infoPtr->bands[iband]; 1731 1733 if(HIDDENBAND(lpBand)) continue; 1732 if (! lpBand->fMask & RBBS_VARIABLEHEIGHT) continue;1734 if (!(lpBand->fMask & RBBS_VARIABLEHEIGHT)) continue; 1733 1735 if (((INT)lpBand->cyMaxChild < 1) || 1734 1736 ((INT)lpBand->cyIntegral < 1)) { … … 1864 1866 UINT header=0; 1865 1867 UINT textheight=0; 1868 INT i, nonfixed; 1869 REBAR_BAND *tBand; 1866 1870 1867 1871 lpBand->fStatus = 0; … … 1900 1904 /* in the band and preceed the child window. */ 1901 1905 1906 /* count number of non-FIXEDSIZE and non-Hidden bands */ 1907 nonfixed = 0; 1908 for (i=0; i<infoPtr->uNumBands; i++){ 1909 tBand = &infoPtr->bands[i]; 1910 if (!HIDDENBAND(tBand) && !(tBand->fStyle & RBBS_FIXEDSIZE)) 1911 nonfixed++; 1912 } 1913 1902 1914 /* calculate gripper rectangle */ 1903 1915 if ( (!(lpBand->fStyle & RBBS_NOGRIPPER)) && 1904 1916 ( (lpBand->fStyle & RBBS_GRIPPERALWAYS) || 1905 ( !(lpBand->fStyle & RBBS_FIXEDSIZE) && ( infoPtr->uNumBands> 1)))1917 ( !(lpBand->fStyle & RBBS_FIXEDSIZE) && (nonfixed > 1))) 1906 1918 ) { 1907 1919 lpBand->fStatus |= HAS_GRIPPER; … … 2076 2088 HDC hdc = (HDC)wParam; 2077 2089 RECT rect; 2078 COLORREF old , new;2090 COLORREF old = CLR_NONE, new; 2079 2091 2080 2092 oldrow = -1; … … 2122 2134 2123 2135 /* draw the actual background */ 2124 if (lpBand->clrBack != CLR_NONE) 2125 new = lpBand->clrBack; 2126 else 2127 new = infoPtr->clrBtnFace; 2136 if (lpBand->clrBack != CLR_NONE) { 2137 new = (lpBand->clrBack == CLR_DEFAULT) ? infoPtr->clrBtnFace : 2138 lpBand->clrBack; 2139 #if GLATESTING 2140 /* testing only - make background green to see it */ 2141 new = RGB(0,128,0); 2142 #endif 2143 old = SetBkColor (hdc, new); 2144 } 2145 2128 2146 rect = lpBand->rcBand; 2129 #if GLATESTING2130 /* testing only - make background green to see it */2131 new = RGB(0,128,0);2132 #endif2133 old = SetBkColor (hdc, new);2134 2147 TRACE("%s background color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n", 2135 (lpBand->clrBack == CLR_NONE) ? "std" : "", 2136 new, 2148 (lpBand->clrBack == CLR_NONE) ? "none" : 2149 ((lpBand->clrBack == CLR_DEFAULT) ? "dft" : ""), 2150 GetBkColor(hdc), 2137 2151 lpBand->rcBand.left,lpBand->rcBand.top, 2138 2152 lpBand->rcBand.right,lpBand->rcBand.bottom, … … 2140 2154 clip->right, clip->bottom); 2141 2155 ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0); 2142 SetBkColor (hdc, old); 2156 if (lpBand->clrBack != CLR_NONE) 2157 SetBkColor (hdc, old); 2143 2158 } 2144 2159 return TRUE; … … 2587 2602 lprbbi->clrFore = lpBand->clrFore; 2588 2603 lprbbi->clrBack = lpBand->clrBack; 2589 if (lprbbi->clrBack == CLR_ NONE)2604 if (lprbbi->clrBack == CLR_DEFAULT) 2590 2605 lprbbi->clrBack = infoPtr->clrBtnFace; 2591 2606 } … … 2673 2688 lprbbi->clrFore = lpBand->clrFore; 2674 2689 lprbbi->clrBack = lpBand->clrBack; 2675 if (lprbbi->clrBack == CLR_ NONE)2690 if (lprbbi->clrBack == CLR_DEFAULT) 2676 2691 lprbbi->clrBack = infoPtr->clrBtnFace; 2677 2692 } … … 2771 2786 COLORREF clr = infoPtr->clrBk; 2772 2787 2773 if (clr == CLR_ NONE)2788 if (clr == CLR_DEFAULT) 2774 2789 clr = infoPtr->clrBtnFace; 2775 2790 … … 3636 3651 DeleteObject (infoPtr->hcurVert); 3637 3652 DeleteObject (infoPtr->hcurDrag); 3638 3639 #ifdef __WIN32OS2__3640 //NEVER delete the font object received by WM_SETFONT!3641 3653 if(infoPtr->hDefaultFont) DeleteObject (infoPtr->hDefaultFont); 3642 #else3643 DeleteObject (infoPtr->hFont);3644 #endif3645 3654 SetWindowLongA (infoPtr->hwndSelf, 0, 0); 3646 3655 … … 3809 3818 3810 3819 /* allocate memory for info structure */ 3811 #ifdef __WIN32OS2__3812 infoPtr = (REBAR_INFO*)initControl(hwnd,sizeof(REBAR_INFO));3813 #else3814 3820 infoPtr = (REBAR_INFO *)COMCTL32_Alloc (sizeof(REBAR_INFO)); 3815 #endif3816 3821 SetWindowLongA (hwnd, 0, (DWORD)infoPtr); 3817 3822 … … 3856 3861 tfont = CreateFontIndirectA (&ncm.lfCaptionFont); 3857 3862 if (tfont) { 3858 #ifdef __WIN32OS2__3859 3863 infoPtr->hFont = infoPtr->hDefaultFont = tfont; 3860 #else3861 infoPtr->hFont = tfont;3862 #endif3863 3864 } 3864 3865 … … 4413 4414 ERR("unknown msg %04x wp=%08x lp=%08lx\n", 4414 4415 uMsg, wParam, lParam); 4415 #ifdef __WIN32OS2__4416 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);4417 #else4418 4416 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 4419 #endif4420 4417 } 4421 4418 return 0; -
trunk/src/comctl32/tab.c
r6709 r7815 21 21 #include "debugtools.h" 22 22 #include <math.h> 23 #ifdef __WIN32OS2__24 #include "ccbase.h"25 #define COMCTL32_hPattern55AABrush GetPattern55AABitmap()26 #endif27 23 28 24 DEFAULT_DEBUG_CHANNEL(tab); … … 45 41 typedef struct 46 42 { 47 #ifdef __WIN32OS2__48 COMCTL32_HEADER header;49 #endif50 43 UINT uNumItem; /* number of tab items */ 51 44 UINT uNumRows; /* number of tab rows */ … … 1168 1161 1169 1162 /* 1170 * Ok Microsoft trys to even out the rows. place the same1163 * Ok windows tries to even out the rows. place the same 1171 1164 * number of tabs in each row. So lets give that a shot 1172 *1173 1165 */ 1174 1166 … … 1226 1218 infoPtr->items[iIndexStart].rect.top) ; 1227 1219 iIndexEnd++) 1228 /* intentional y blank */;1220 /* intentionally blank */; 1229 1221 1230 1222 /* … … 1861 1853 1862 1854 /* This modifies r to be the text rectangle. */ 1863 { 1864 HFONT hOldFont = SelectObject(hdc, infoPtr->hFont); 1865 TAB_DrawItemInterior(hwnd, hdc, iItem, &r); 1866 SelectObject(hdc,hOldFont); 1867 } 1855 { 1856 HFONT hOldFont = SelectObject(hdc, infoPtr->hFont); 1857 TAB_DrawItemInterior(hwnd, hdc, iItem, &r); 1858 SelectObject(hdc,hOldFont); 1859 } 1860 1868 1861 /* Draw the focus rectangle */ 1869 1862 if (((lStyle & TCS_FOCUSNEVER) == 0) && … … 2279 2272 TAB_InvalidateTabArea(hwnd, infoPtr); 2280 2273 2281 TRACE("[%04x]: added item %d '%s'\n",2274 TRACE("[%04x]: added item %d %s\n", 2282 2275 hwnd, iItem, debugstr_w(infoPtr->items[iItem].pszText)); 2283 2276 … … 2348 2341 TAB_InvalidateTabArea(hwnd, infoPtr); 2349 2342 2350 TRACE("[%04x]: added item %d '%s'\n",2343 TRACE("[%04x]: added item %d %s\n", 2351 2344 hwnd, iItem, debugstr_w(infoPtr->items[iItem].pszText)); 2352 2345 … … 2704 2697 DWORD dwStyle; 2705 2698 2706 #ifdef __WIN32OS2__2707 infoPtr = (TAB_INFO*)initControl(hwnd,sizeof(TAB_INFO));2708 #else2709 2699 infoPtr = (TAB_INFO *)COMCTL32_Alloc (sizeof(TAB_INFO)); 2710 #endif2711 2700 2712 2701 SetWindowLongA(hwnd, 0, (DWORD)infoPtr); … … 2949 2938 case WM_LBUTTONUP: 2950 2939 return TAB_LButtonUp (hwnd, wParam, lParam); 2951 2940 2941 case WM_NOTIFY: 2942 return SendMessageA(GetParent(hwnd), WM_NOTIFY, wParam, lParam); 2943 2952 2944 case WM_RBUTTONDOWN: 2953 2945 return TAB_RButtonDown (hwnd, wParam, lParam); … … 2989 2981 WARN("unknown msg %04x wp=%08x lp=%08lx\n", 2990 2982 uMsg, wParam, lParam); 2991 #ifdef __WIN32OS2__ 2992 return defComCtl32ProcA (hwnd, uMsg, wParam, lParam); 2993 #else 2994 return DefWindowProcA (hwnd, uMsg, wParam, lParam); 2995 #endif 2983 return DefWindowProcA(hwnd, uMsg, wParam, lParam); 2996 2984 } 2997 2985 -
trunk/src/comctl32/toolbar.c
r7616 r7815 60 60 DEFAULT_DEBUG_CHANNEL(toolbar); 61 61 62 #ifdef __WIN32OS2__63 #undef inline64 #define inline65 #define COMCTL32_hPattern55AABrush GetPattern55AABrush()66 #endif67 68 62 typedef struct 69 63 { … … 102 96 INT nOldHit; 103 97 INT nHotItem; /* index of the "hot" item */ 104 #ifdef __WIN32OS2__105 98 HFONT hDefaultFont; 106 #endif107 99 HFONT hFont; /* text font */ 108 100 HIMAGELIST himlInt; /* image list created internally */ … … 118 110 BOOL bAnchor; /* anchor highlight enabled */ 119 111 BOOL bNtfUnicode; /* TRUE if NOTIFYs use {W} */ 112 BOOL bDoRedraw; /* Redraw status */ 120 113 DWORD dwExStyle; /* extended toolbar style */ 121 114 DWORD dwDTFlags; /* DrawText flags */ … … 156 149 157 150 151 static LPWSTR 152 TOOLBAR_GetText(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr) 153 { 154 LPWSTR lpText = NULL; 155 156 /* FIXME: iString == -1 is undocumented */ 157 if ((HIWORD(btnPtr->iString) != 0) && (btnPtr->iString != -1)) 158 lpText = (LPWSTR)btnPtr->iString; 159 else if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings)) 160 lpText = infoPtr->strings[btnPtr->iString]; 161 162 return lpText; 163 } 164 158 165 static void 159 166 TOOLBAR_DumpButton(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *bP, INT btn_num, BOOL internal) 160 167 { 161 168 if (TRACE_ON(toolbar)){ 162 TRACE("button %d id %d, bitmap=%d, state=%02x, style=%02x, data=%08lx, string =%d\n",169 TRACE("button %d id %d, bitmap=%d, state=%02x, style=%02x, data=%08lx, stringid=0x%08x\n", 163 170 btn_num, bP->idCommand, 164 171 bP->iBitmap, bP->fsState, bP->fsStyle, bP->dwData, bP->iString); 172 TRACE("string %s\n", debugstr_w(TOOLBAR_GetText(infoPtr,bP))); 165 173 if (internal) 166 174 TRACE("button %d id %d, hot=%s, row=%d, rect=(%d,%d)-(%d,%d)\n", … … 185 193 iP->dwExStyle, iP->nNumButtons, iP->nNumBitmaps, 186 194 iP->nNumStrings, dwStyle); 187 TRACE("toolbar %08x at line %d, himlInt=%p, himlDef=%p, himlHot=%p, himlDis=%p \n",195 TRACE("toolbar %08x at line %d, himlInt=%p, himlDef=%p, himlHot=%p, himlDis=%p, redrawable=%s\n", 188 196 iP->hwndSelf, line, 189 iP->himlInt, iP->himlDef, iP->himlHot, iP->himlDis); 197 iP->himlInt, iP->himlDef, iP->himlHot, iP->himlDis, 198 (iP->bDoRedraw) ? "TRUE" : "FALSE"); 190 199 for(i=0; i<iP->nNumButtons; i++) { 191 200 TOOLBAR_DumpButton(iP, &iP->buttons[i], i, TRUE); … … 215 224 TOOLBAR_SendNotify (NMHDR *nmhdr, TOOLBAR_INFO *infoPtr, UINT code) 216 225 { 226 if(!IsWindow(infoPtr->hwndSelf)) 227 return 0; /* we have just been destroyed */ 228 217 229 nmhdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf); 218 230 nmhdr->hwndFrom = infoPtr->hwndSelf; … … 228 240 return SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, 229 241 (WPARAM) nmhdr->idFrom, (LPARAM)nmhdr); 230 }231 232 static LPWSTR233 TOOLBAR_GetText(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)234 {235 LPWSTR lpText = NULL;236 237 /* FIXME: iString == -1 is undocumented */238 if ((HIWORD(btnPtr->iString) != 0) && (btnPtr->iString != -1))239 lpText = (LPWSTR)btnPtr->iString;240 else if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings))241 lpText = infoPtr->strings[btnPtr->iString];242 243 return lpText;244 242 } 245 243 … … 447 445 lpText = TOOLBAR_GetText(infoPtr, btnPtr); 448 446 449 TRACE (" lpText: %s\n", debugstr_w(lpText));447 TRACE ("Stringtext: %s\n", debugstr_w(lpText)); 450 448 451 449 /* draw text */ … … 818 816 lpSize->cy = 0; 819 817 820 if (!(btnPtr->fsState & TBSTATE_HIDDEN) && 821 (btnPtr->iString > -1) && 822 (btnPtr->iString < infoPtr->nNumStrings)) 818 if (!(btnPtr->fsState & TBSTATE_HIDDEN) ) 823 819 { 824 LPWSTR lpText = infoPtr->strings[btnPtr->iString];820 LPWSTR lpText = TOOLBAR_GetText(infoPtr, btnPtr); 825 821 826 822 /* first get size of all the text */ … … 1330 1326 1331 1327 static INT 1332 TOOLBAR_GetButtonIndex (TOOLBAR_INFO *infoPtr, INT idCommand )1328 TOOLBAR_GetButtonIndex (TOOLBAR_INFO *infoPtr, INT idCommand, BOOL CommandIsIndex) 1333 1329 { 1334 1330 TBUTTON_INFO *btnPtr; 1335 1331 INT i; 1336 1332 1333 if (CommandIsIndex) { 1334 TRACE("command is really index command=%d\n", idCommand); 1335 return idCommand; 1336 } 1337 1337 btnPtr = infoPtr->buttons; 1338 1338 for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) { … … 1421 1421 PCUSTOMBUTTON btnInfo; 1422 1422 NMTOOLBARA nmtb; 1423 TOOLBAR_INFO *infoPtr = custInfo ->tbInfo;1423 TOOLBAR_INFO *infoPtr = custInfo ? custInfo->tbInfo : NULL; 1424 1424 1425 1425 switch (uMsg) … … 1434 1434 int i = 0; 1435 1435 int index; 1436 1437 infoPtr = custInfo->tbInfo; 1436 1438 1437 1439 /* send TBN_QUERYINSERT notification */ … … 1484 1486 1485 1487 /* insert button into the apropriate list */ 1486 index = TOOLBAR_GetButtonIndex (custInfo->tbInfo, nmtb.tbButton.idCommand );1488 index = TOOLBAR_GetButtonIndex (custInfo->tbInfo, nmtb.tbButton.idCommand, FALSE); 1487 1489 if (index == -1) 1488 1490 { … … 2076 2078 TOOLBAR_CalcToolbar (hwnd); 2077 2079 2080 TOOLBAR_DumpToolbar (infoPtr, __LINE__); 2081 2078 2082 InvalidateRect(hwnd, NULL, FALSE); 2079 2083 … … 2138 2142 TOOLBAR_CalcToolbar (hwnd); 2139 2143 2144 TOOLBAR_DumpToolbar (infoPtr, __LINE__); 2145 2140 2146 InvalidateRect(hwnd, NULL, FALSE); 2141 2147 … … 2152 2158 if ((wParam) && (HIWORD(lParam) == 0)) { 2153 2159 char szString[256]; 2154 INT len , lenW;2160 INT len; 2155 2161 TRACE("adding string from resource!\n"); 2156 2162 … … 2173 2179 } 2174 2180 2175 lenW = MultiByteToWideChar( CP_ACP, 0, szString, -1, NULL, 0 ); 2176 infoPtr->strings[infoPtr->nNumStrings] = COMCTL32_Alloc (sizeof(WCHAR)*lenW); 2177 MultiByteToWideChar( CP_ACP, 0, szString, -1, 2178 infoPtr->strings[infoPtr->nNumStrings], lenW ); 2181 /*COMCTL32_Alloc zeros out the allocated memory*/ 2182 Str_SetPtrAtoW (&infoPtr->strings[infoPtr->nNumStrings], szString ); 2179 2183 infoPtr->nNumStrings++; 2180 2184 } 2181 2185 else { 2182 2186 LPSTR p = (LPSTR)lParam; 2183 INT len , lenW;2187 INT len; 2184 2188 2185 2189 if (p == NULL) … … 2205 2209 } 2206 2210 2207 lenW = MultiByteToWideChar( CP_ACP, 0, p, -1, NULL, 0 ); 2208 infoPtr->strings[infoPtr->nNumStrings] = COMCTL32_Alloc (sizeof(WCHAR)*lenW); 2209 MultiByteToWideChar( CP_ACP, 0, p, -1, 2210 infoPtr->strings[infoPtr->nNumStrings], lenW ); 2211 Str_SetPtrAtoW (&infoPtr->strings[infoPtr->nNumStrings], p ); 2211 2212 infoPtr->nNumStrings++; 2212 2213 … … 2260 2261 infoPtr->strings[infoPtr->nNumStrings] = 2261 2262 COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); 2262 lstrcpynW (infoPtr->strings[infoPtr->nNumStrings], p, len );2263 lstrcpynW (infoPtr->strings[infoPtr->nNumStrings], p, len+1); 2263 2264 infoPtr->nNumStrings++; 2264 2265 … … 2282 2283 } 2283 2284 2284 infoPtr->strings[infoPtr->nNumStrings] = 2285 COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); 2286 strcpyW (infoPtr->strings[infoPtr->nNumStrings], szString); 2285 Str_SetPtrW (&infoPtr->strings[infoPtr->nNumStrings], szString); 2287 2286 infoPtr->nNumStrings++; 2288 2287 } … … 2313 2312 } 2314 2313 2315 infoPtr->strings[infoPtr->nNumStrings] = 2316 COMCTL32_Alloc (sizeof(WCHAR)*(len+1)); 2317 strcpyW (infoPtr->strings[infoPtr->nNumStrings], p); 2314 Str_SetPtrW (&infoPtr->strings[infoPtr->nNumStrings], p); 2318 2315 infoPtr->nNumStrings++; 2319 2316 … … 2353 2350 cx = 0; 2354 2351 cy = 0; 2352 TOOLBAR_CalcToolbar (hwnd); 2355 2353 } 2356 2354 else { … … 2425 2423 INT nIndex; 2426 2424 2427 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );2425 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 2428 2426 if (nIndex == -1) 2429 2427 return FALSE; … … 2449 2447 BOOL bChecked = FALSE; 2450 2448 2451 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );2449 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 2452 2450 if (nIndex == -1) 2453 2451 return FALSE; … … 2495 2493 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 2496 2494 2497 return TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );2495 return TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 2498 2496 } 2499 2497 … … 2600 2598 DWORD bState; 2601 2599 2602 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );2600 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 2603 2601 if (nIndex == -1) 2604 2602 return FALSE; … … 2641 2639 INT nIndex; 2642 2640 2643 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );2641 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 2644 2642 if (nIndex == -1) 2645 2643 return -1; … … 2700 2698 return -1; 2701 2699 2702 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2700 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, 2701 lpTbInfo->dwMask & 0x80000000); 2703 2702 if (nIndex == -1) 2704 2703 return -1; 2705 2704 2706 btnPtr = &infoPtr->buttons[nIndex];2705 if (!(btnPtr = &infoPtr->buttons[nIndex])) return -1; 2707 2706 2708 2707 if (lpTbInfo->dwMask & TBIF_COMMAND) … … 2719 2718 lpTbInfo->fsStyle = btnPtr->fsStyle; 2720 2719 if (lpTbInfo->dwMask & TBIF_TEXT) { 2721 if ((btnPtr->iString >= 0) && (btnPtr->iString < infoPtr->nNumStrings)) 2722 { 2723 if (!WideCharToMultiByte( CP_ACP, 0, (LPWSTR)infoPtr->strings[btnPtr->iString], -1, 2724 lpTbInfo->pszText, lpTbInfo->cchText, NULL, NULL )) 2725 lpTbInfo->pszText[lpTbInfo->cchText-1] = 0; 2720 LPWSTR lpText = TOOLBAR_GetText(infoPtr,btnPtr); 2721 Str_GetPtrWtoA (lpText, lpTbInfo->pszText,lpTbInfo->cchText); 2726 2722 } 2727 else lpTbInfo->pszText[0]=0;2728 }2729 2723 return nIndex; 2730 2724 } … … 2746 2740 return -1; 2747 2741 2748 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2742 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, 2743 lpTbInfo->dwMask & 0x80000000); 2749 2744 if (nIndex == -1) 2750 2745 return -1; … … 2765 2760 lpTbInfo->fsStyle = btnPtr->fsStyle; 2766 2761 if (lpTbInfo->dwMask & TBIF_TEXT) { 2767 if ((btnPtr->iString >= 0) || (btnPtr->iString < infoPtr->nNumStrings)) 2768 lstrcpynW (lpTbInfo->pszText, 2769 (LPWSTR)infoPtr->strings[btnPtr->iString], 2770 lpTbInfo->cchText); 2762 LPWSTR lpText = TOOLBAR_GetText(infoPtr,btnPtr); 2763 Str_GetPtrW (lpText,lpTbInfo->pszText,lpTbInfo->cchText); 2771 2764 } 2772 2765 … … 2792 2785 { 2793 2786 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 2794 INT nIndex, nStringIndex; 2795 2796 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2787 INT nIndex; 2788 LPWSTR lpText; 2789 2790 if (lParam == 0) 2791 return -1; 2792 2793 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 2797 2794 if (nIndex == -1) 2798 2795 return -1; 2799 2796 2800 nStringIndex = infoPtr->buttons[nIndex].iString; 2801 2802 TRACE("index=%d stringIndex=%d\n", nIndex, nStringIndex); 2803 2804 if ((nStringIndex < 0) || (nStringIndex >= infoPtr->nNumStrings)) 2805 return -1; 2797 lpText = TOOLBAR_GetText(infoPtr,&infoPtr->buttons[nIndex]); 2798 2799 return WideCharToMultiByte( CP_ACP, 0, lpText, -1, 2800 (LPSTR)lParam, 0x7fffffff, NULL, NULL ) - 1; 2801 } 2802 2803 2804 static LRESULT 2805 TOOLBAR_GetButtonTextW (HWND hwnd, WPARAM wParam, LPARAM lParam) 2806 { 2807 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 2808 INT nIndex; 2809 LPWSTR lpText; 2806 2810 2807 2811 if (lParam == 0) 2808 2812 return -1; 2809 2813 2810 return WideCharToMultiByte( CP_ACP, 0, (LPWSTR)infoPtr->strings[nStringIndex], -1, 2811 (LPSTR)lParam, 0x7fffffff, NULL, NULL ) - 1; 2812 } 2813 2814 2815 static LRESULT 2816 TOOLBAR_GetButtonTextW (HWND hwnd, WPARAM wParam, LPARAM lParam) 2817 { 2818 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 2819 INT nIndex, nStringIndex; 2820 2821 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2814 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 2822 2815 if (nIndex == -1) 2823 2816 return -1; 2824 2817 2825 nStringIndex = infoPtr->buttons[nIndex].iString; 2826 2827 TRACE("index=%d stringIndex=%d\n", nIndex, nStringIndex); 2828 2829 if ((nStringIndex < 0) || (nStringIndex >= infoPtr->nNumStrings)) 2830 return -1; 2831 2832 if (lParam == 0) 2833 return -1; 2834 2835 strcpyW ((LPWSTR)lParam, (LPWSTR)infoPtr->strings[nStringIndex]); 2836 2837 return strlenW ((LPWSTR)infoPtr->strings[nStringIndex]); 2818 lpText = TOOLBAR_GetText(infoPtr,&infoPtr->buttons[nIndex]); 2819 2820 strcpyW ((LPWSTR)lParam, lpText); 2821 2822 return strlenW (lpText); 2838 2823 } 2839 2824 … … 2960 2945 if (infoPtr == NULL) 2961 2946 return FALSE; 2962 nIndex = (INT)wParam;2947 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 2963 2948 btnPtr = &infoPtr->buttons[nIndex]; 2964 2949 if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons)) … … 2995 2980 INT nIndex; 2996 2981 2997 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );2982 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 2998 2983 if (nIndex == -1) 2999 2984 return -1; … … 3009 2994 INT nIndex; 3010 2995 3011 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );2996 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 3012 2997 if (nIndex == -1) 3013 2998 return -1; … … 3069 3054 TRACE("\n"); 3070 3055 3071 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );3056 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 3072 3057 if (nIndex == -1) 3073 3058 return FALSE; … … 3101 3086 INT nIndex; 3102 3087 3103 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );3088 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 3104 3089 if (nIndex == -1) 3105 3090 return FALSE; … … 3138 3123 * meaning (like -nIndex (or ~nIndex) to get the real position of insertion). 3139 3124 */ 3140 int len; 3141 LPSTR ptr; 3142 3143 /* FIXME: iString == -1 is undocumented */ 3144 if(lpTbb->iString && lpTbb->iString!=-1) { 3145 len = strlen((char*)lpTbb->iString) + 2; 3146 ptr = COMCTL32_Alloc(len); 3147 nIndex = infoPtr->nNumButtons; 3148 strcpy(ptr, (char*)lpTbb->iString); 3149 ptr[len - 1] = 0; /* ended by two '\0' */ 3150 lpTbb->iString = TOOLBAR_AddStringA(hwnd, 0, (LPARAM)ptr); 3151 COMCTL32_Free(ptr); 3152 } 3153 else { 3154 ERR("lpTbb->iString is NULL\n"); 3155 return FALSE; 3156 } 3125 nIndex = infoPtr->nNumButtons; 3157 3126 3158 3127 } else if (nIndex < 0) 3159 3128 return FALSE; 3129 3130 /* If the string passed is not an index, assume address of string 3131 and do our own AddString */ 3132 if ((HIWORD(lpTbb->iString) != 0) && (lpTbb->iString != -1)) { 3133 LPSTR ptr; 3134 INT len; 3135 3136 TRACE("string %s passed instead of index, adding string\n", 3137 debugstr_a((LPSTR)lpTbb->iString)); 3138 len = strlen((LPSTR)lpTbb->iString) + 2; 3139 ptr = COMCTL32_Alloc(len); 3140 strcpy(ptr, (LPSTR)lpTbb->iString); 3141 ptr[len - 1] = 0; /* ended by two '\0' */ 3142 lpTbb->iString = TOOLBAR_AddStringA(hwnd, 0, (LPARAM)ptr); 3143 COMCTL32_Free(ptr); 3144 } 3160 3145 3161 3146 TRACE("inserting button index=%d\n", nIndex); … … 3180 3165 infoPtr->buttons[nIndex].fsStyle = lpTbb->fsStyle; 3181 3166 infoPtr->buttons[nIndex].dwData = lpTbb->dwData; 3182 infoPtr->buttons[nIndex].iString = lpTbb->iString; 3167 /* if passed string and not index, then add string */ 3168 if(HIWORD(lpTbb->iString) && lpTbb->iString!=-1) { 3169 Str_SetPtrAtoW ((LPWSTR *)&infoPtr->buttons[nIndex].iString, (LPCSTR )lpTbb->iString); 3170 } 3171 else 3172 infoPtr->buttons[nIndex].iString = lpTbb->iString; 3183 3173 3184 3174 if ((infoPtr->hwndToolTip) && !(lpTbb->fsStyle & TBSTYLE_SEP)) { … … 3206 3196 TOOLBAR_CalcToolbar (hwnd); 3207 3197 3208 InvalidateRect (hwnd, NULL, FALSE);3198 InvalidateRect (hwnd, NULL, TRUE); 3209 3199 3210 3200 return TRUE; … … 3222 3212 if (lpTbb == NULL) 3223 3213 return FALSE; 3214 3215 TOOLBAR_DumpButton(infoPtr, (TBUTTON_INFO *)lpTbb, nIndex, FALSE); 3216 3224 3217 if (nIndex < 0) 3225 3218 return FALSE; … … 3240 3233 } 3241 3234 3235 3236 /* If the string passed is not an index, assume address of string 3237 and do our own AddString */ 3238 if ((HIWORD(lpTbb->iString) != 0) && (lpTbb->iString != -1)) { 3239 LPWSTR ptr; 3240 INT len; 3241 3242 TRACE("string %s passed instead of index, adding string\n", 3243 debugstr_w((LPWSTR)lpTbb->iString)); 3244 len = strlenW((LPWSTR)lpTbb->iString) + 2; 3245 ptr = COMCTL32_Alloc(len*sizeof(WCHAR)); 3246 strcpyW(ptr, (LPWSTR)lpTbb->iString); 3247 ptr[len - 1] = 0; /* ended by two '\0' */ 3248 lpTbb->iString = TOOLBAR_AddStringW(hwnd, 0, (LPARAM)ptr); 3249 COMCTL32_Free(ptr); 3250 } 3251 3242 3252 /* insert new button */ 3243 3253 infoPtr->buttons[nIndex].iBitmap = lpTbb->iBitmap; … … 3246 3256 infoPtr->buttons[nIndex].fsStyle = lpTbb->fsStyle; 3247 3257 infoPtr->buttons[nIndex].dwData = lpTbb->dwData; 3248 infoPtr->buttons[nIndex].iString = lpTbb->iString; 3258 /* if passed string and not index, then add string */ 3259 if(HIWORD(lpTbb->iString) && lpTbb->iString!=-1) { 3260 Str_SetPtrW ((LPWSTR *)&infoPtr->buttons[nIndex].iString, (LPWSTR)lpTbb->iString); 3261 } 3262 else 3263 infoPtr->buttons[nIndex].iString = lpTbb->iString; 3249 3264 3250 3265 if ((infoPtr->hwndToolTip) && !(lpTbb->fsStyle & TBSTYLE_SEP)) { … … 3270 3285 COMCTL32_Free (oldButtons); 3271 3286 3272 InvalidateRect (hwnd, NULL, FALSE);3287 InvalidateRect (hwnd, NULL, TRUE); 3273 3288 3274 3289 return TRUE; … … 3285 3300 INT nIndex; 3286 3301 3287 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );3302 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 3288 3303 if (nIndex == -1) 3289 3304 return FALSE; … … 3299 3314 INT nIndex; 3300 3315 3301 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );3316 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 3302 3317 if (nIndex == -1) 3303 3318 return FALSE; … … 3313 3328 INT nIndex; 3314 3329 3315 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );3330 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 3316 3331 if (nIndex == -1) 3317 3332 return TRUE; … … 3327 3342 INT nIndex; 3328 3343 3329 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );3344 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 3330 3345 if (nIndex == -1) 3331 3346 return FALSE; … … 3341 3356 INT nIndex; 3342 3357 3343 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );3358 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 3344 3359 if (nIndex == -1) 3345 3360 return FALSE; … … 3355 3370 INT nIndex; 3356 3371 3357 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );3372 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 3358 3373 if (nIndex == -1) 3359 3374 return FALSE; … … 3376 3391 INT nIndex; 3377 3392 3378 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );3393 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 3379 3394 if (nIndex == -1) 3380 3395 return FALSE; … … 3508 3523 return FALSE; 3509 3524 3510 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 3525 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, 3526 lptbbi->dwMask & 0x80000000); 3511 3527 if (nIndex == -1) 3512 3528 return FALSE; … … 3526 3542 btnPtr->fsStyle = lptbbi->fsStyle; 3527 3543 3528 if (lptbbi->dwMask & TBIF_TEXT) { 3529 if ((btnPtr->iString >= 0) || 3530 (btnPtr->iString < infoPtr->nNumStrings)) { 3531 TRACE("Ooooooch\n"); 3532 #if 0 3533 WCHAR **lpString = &infoPtr->strings[btnPtr->iString]; 3534 INT len = lstrlenA (lptbbi->pszText); 3535 *lpString = COMCTL32_ReAlloc (lpString, sizeof(WCHAR)*(len+1)); 3536 #endif 3537 3538 /* this is the ultimate sollution */ 3539 /* Str_SetPtrA (&infoPtr->strings[btnPtr->iString], lptbbi->pszText); */ 3540 } 3541 } 3542 3544 if ((lptbbi->dwMask & TBIF_TEXT) && ((INT)lptbbi->pszText != -1)) { 3545 if ((HIWORD(btnPtr->iString) == 0) || (btnPtr->iString == -1)) 3546 /* iString is index, zero it to make Str_SetPtr succeed */ 3547 btnPtr->iString=0; 3548 3549 Str_SetPtrAtoW ((LPWSTR *)&btnPtr->iString, lptbbi->pszText); 3550 } 3543 3551 return TRUE; 3544 3552 } … … 3558 3566 return FALSE; 3559 3567 3560 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 3568 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, 3569 lptbbi->dwMask & 0x80000000); 3561 3570 if (nIndex == -1) 3562 3571 return FALSE; … … 3576 3585 btnPtr->fsStyle = lptbbi->fsStyle; 3577 3586 3578 if (lptbbi->dwMask & TBIF_TEXT) { 3579 if ((btnPtr->iString >= 0) || 3580 (btnPtr->iString < infoPtr->nNumStrings)) { 3581 #if 0 3582 WCHAR **lpString = &infoPtr->strings[btnPtr->iString]; 3583 INT len = lstrlenW (lptbbi->pszText); 3584 *lpString = COMCTL32_ReAlloc (lpString, sizeof(WCHAR)*(len+1)); 3585 #endif 3586 3587 /* this is the ultimate solution */ 3588 /* Str_SetPtrA (&infoPtr->strings[btnPtr->iString], lptbbi->pszText); */ 3589 } 3590 } 3591 3587 if ((lptbbi->dwMask & TBIF_TEXT) && ((INT)lptbbi->pszText != -1)) { 3588 if ((HIWORD(btnPtr->iString) == 0) || (btnPtr->iString == -1)) 3589 /* iString is index, zero it to make Str_SetPtr succeed */ 3590 btnPtr->iString=0; 3591 Str_SetPtrW ((LPWSTR *)&btnPtr->iString, lptbbi->pszText); 3592 } 3592 3593 return TRUE; 3593 3594 } … … 3690 3691 3691 3692 3693 if (wParam != 0) { 3694 FIXME("no support for multiple image lists\n"); 3695 return 0; 3696 } 3697 3692 3698 himlTemp = infoPtr->himlDis; 3693 3699 infoPtr->himlDis = (HIMAGELIST)lParam; … … 3731 3737 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd); 3732 3738 HIMAGELIST himlTemp; 3739 3740 if (wParam != 0) { 3741 FIXME("no support for multiple image lists\n"); 3742 return 0; 3743 } 3733 3744 3734 3745 himlTemp = infoPtr->himlHot; … … 3784 3795 HIMAGELIST himlTemp; 3785 3796 3797 if (wParam != 0) { 3798 FIXME("no support for multiple image lists\n"); 3799 return 0; 3800 } 3801 3786 3802 himlTemp = infoPtr->himlDef; 3787 3803 infoPtr->himlDef = (HIMAGELIST)lParam; … … 3796 3812 3797 3813 /* FIXME: redraw ? */ 3814 InvalidateRect(hwnd, NULL, TRUE); 3798 3815 3799 3816 return (LRESULT)himlTemp; … … 3914 3931 INT nIndex; 3915 3932 3916 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );3933 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 3917 3934 if (nIndex == -1) 3918 3935 return FALSE; … … 3947 3964 INT nIndex; 3948 3965 3949 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam );3966 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); 3950 3967 if (nIndex == -1) 3951 3968 return FALSE; … … 4043 4060 infoPtr->bNtfUnicode = FALSE; 4044 4061 infoPtr->hwndSelf = hwnd; 4062 infoPtr->bDoRedraw = TRUE; 4045 4063 4046 4064 SystemParametersInfoA (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); 4047 #ifdef __WIN32OS2__4048 4065 infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectA (&logFont); 4049 #else4050 infoPtr->hFont = CreateFontIndirectA (&logFont);4051 #endif4052 4066 4053 4067 if (dwStyle & TBSTYLE_TOOLTIPS) { … … 4106 4120 4107 4121 /* delete default font */ 4108 #ifdef __WIN32OS2__4109 //NEVER delete the font object received by WM_SETFONT!4110 if (infoPtr->hDefaultFont)4111 DeleteObject (infoPtr->hDefaultFont);4112 #else4113 4122 if (infoPtr->hFont) 4114 DeleteObject (infoPtr->hFont); 4115 #endif 4123 DeleteObject (infoPtr->hDefaultFont); 4116 4124 4117 4125 /* free toolbar info data */ … … 4129 4137 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); 4130 4138 NMTBCUSTOMDRAW tbcd; 4131 INT ret , ntfret;4139 INT ret = FALSE, ntfret; 4132 4140 4133 4141 if (dwStyle & TBSTYLE_CUSTOMERASE) { … … 4162 4170 MapWindowPoints(hwnd, parent, &pt, 1); 4163 4171 OffsetWindowOrgEx (hdc, pt.x, pt.y, &ptorig); 4164 SendMessageA (parent, WM_ERASEBKGND, wParam, lParam);4172 ret = SendMessageA (parent, WM_ERASEBKGND, wParam, lParam); 4165 4173 SetWindowOrgEx (hdc, ptorig.x, ptorig.y, 0); 4166 return TRUE; 4167 }4168 4174 } 4175 if (!ret) 4176 ret = DefWindowProcA (hwnd, WM_ERASEBKGND, wParam, lParam); 4169 4177 4170 4178 if (dwStyle & TBSTYLE_CUSTOMERASE) { … … 4397 4405 4398 4406 if (bSendMessage) 4399 SendMessageA ( GetParent(hwnd), WM_COMMAND,4407 SendMessageA (infoPtr->hwndNotify, WM_COMMAND, 4400 4408 MAKEWPARAM(btnPtr->idCommand, 0), (LPARAM)hwnd); 4401 4409 … … 4759 4767 4760 4768 static LRESULT 4769 TOOLBAR_SetRedraw (HWND hwnd, WPARAM wParam, LPARAM lParam) 4770 /***************************************************** 4771 * 4772 * Function; 4773 * Handles the WM_SETREDRAW message. 4774 * 4775 * Documentation: 4776 * According to testing V4.71 of COMCTL32 returns the 4777 * *previous* status of the redraw flag (either 0 or 1) 4778 * instead of the MSDN documented value of 0 if handled. 4779 * (For laughs see the "consistancy" with same function 4780 * in rebar.) 4781 * 4782 *****************************************************/ 4783 { 4784 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 4785 BOOL oldredraw = infoPtr->bDoRedraw; 4786 4787 TRACE("set to %s\n", 4788 (wParam) ? "TRUE" : "FALSE"); 4789 infoPtr->bDoRedraw = (BOOL) wParam; 4790 if (wParam) { 4791 InvalidateRect (infoPtr->hwndSelf, 0, TRUE); 4792 } 4793 return (oldredraw) ? 1 : 0; 4794 } 4795 4796 4797 static LRESULT 4761 4798 TOOLBAR_Size (HWND hwnd, WPARAM wParam, LPARAM lParam) 4762 4799 { … … 5191 5228 return TOOLBAR_Paint (hwnd, wParam); 5192 5229 5230 case WM_SETREDRAW: 5231 return TOOLBAR_SetRedraw (hwnd, wParam, lParam); 5232 5193 5233 case WM_SIZE: 5194 5234 return TOOLBAR_Size (hwnd, wParam, lParam); … … 5206 5246 case WM_MEASUREITEM: 5207 5247 case WM_VKEYTOITEM: 5208 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); 5248 { 5249 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 5250 if(infoPtr != NULL) 5251 return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam); 5252 else 5253 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam); 5254 } 5209 5255 5210 5256 default:
Note:
See TracChangeset
for help on using the changeset viewer.