Changeset 3584 for trunk/src/user32/listbox.cpp
- Timestamp:
- May 22, 2000, 7:21:11 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/listbox.cpp
r3153 r3584 1 /* $Id: listbox.cpp,v 1.2 4 2000-03-18 16:13:30cbratschi Exp $ */1 /* $Id: listbox.cpp,v 1.25 2000-05-22 17:21:08 cbratschi Exp $ */ 2 2 /* 3 3 * Listbox controls … … 6 6 * Copyright 1999 Christoph Bratschi (ported from WINE) 7 7 * 8 * Corel version: 20000 3178 * Corel version: 20000513 9 9 * (WINE version: 991212) 10 10 * … … 34 34 - VK_LINEDOWN -> bottom most item not always visible 35 35 - performance not optimized 36 - ownerdraw is broken -> toolbar customize dialog37 36 - first item selection mark not redrawn on new selection 37 - LISTBOX_HandleLButtonDownCombo fails, bug in GetWindowRect or ClientToScreen! 38 I clicked on the vertical scrollbar, this happens: 39 t1: SendInternalMessageA WM_LBUTTONDOWN for 68000009 1 1d00c6 40 t1: GetClientRect of 68000009 returned (0,0) (191,110) 41 t1: USER32: GetCapture returned 68000009 42 t1: GetWindowRect 68000009 (450,130) (657,242) 43 t1: ClientToScreen 68000009 (198,29) -> (424,108) 44 mouse position is ok, but screen point is outside window rect!!! 45 the new point is left-top and not on the right!!! 38 46 */ 39 47 … … 112 120 #define SEND_NOTIFICATION(hwnd,descr,code) \ 113 121 (SendMessageA( (descr)->owner, WM_COMMAND, \ 114 MAKEWPARAM( (((descr)->lphc)?ID_CB_LISTBOX:GetWindowLongA(hwnd,GWL_ID)), (code)), hwnd ))122 MAKEWPARAM(GetWindowLongA(hwnd,GWL_ID), (code)), hwnd )) 115 123 116 124 /* Current timer status */ … … 482 490 { 483 491 DRAWITEMSTRUCT dis; 484 UINT id = (descr->lphc) ? ID_CB_LISTBOX :GetWindowLongA(hwnd,GWL_ID);492 UINT id = GetWindowLongA(hwnd,GWL_ID); 485 493 486 494 if (!item) … … 714 722 { 715 723 COMPAREITEMSTRUCT cis; 716 UINT id = (descr->lphc) ? ID_CB_LISTBOX :GetWindowLongA(hwnd,GWL_ID);724 UINT id = GetWindowLongA(hwnd,GWL_ID); 717 725 718 726 cis.CtlType = ODT_LISTBOX; … … 887 895 INT focusItem; 888 896 897 if (descr->style & LBS_NOREDRAW) return 0; 898 889 899 SetRect( &rect, 0, 0, descr->width, descr->height ); 890 if (descr->style & LBS_NOREDRAW) return 0;891 900 if (descr->style & LBS_MULTICOLUMN) 892 901 rect.right = rect.left + descr->column_width; … … 966 975 /* Paint the focus item now */ 967 976 descr->focus_item = focusItem; 968 if (focusRect.top != focusRect.bottom )977 if (focusRect.top != focusRect.bottom && descr->caret_on) 969 978 LISTBOX_DrawItem( hwnd, descr, hdc, &focusRect, descr->focus_item, ODA_FOCUS ); 970 979 … … 1281 1290 { 1282 1291 INT oldsel = descr->selected_item; 1283 //SvL: Why was this commented out??? (enabled in latest wine code) 1284 if (index == oldsel) return LB_OKAY; 1285 1286 if (oldsel != -1) descr->items[oldsel].selected = FALSE; 1287 if (index != -1) descr->items[index].selected = TRUE; 1288 descr->selected_item = index; 1289 if (oldsel != -1) LISTBOX_RepaintItem( hwnd, descr, oldsel, ODA_SELECT); 1290 if (index != -1) LISTBOX_RepaintItem( hwnd, descr, index, ODA_SELECT ); 1291 if (send_notify && descr->nb_items) SEND_NOTIFICATION( hwnd, descr, 1292 (index != -1) ? LBN_SELCHANGE : LBN_SELCANCEL ); 1293 else 1294 if( descr->lphc ) /* set selection change flag for parent combo */ 1295 descr->lphc->wState |= CBF_SELCHANGE; 1296 } 1297 return LB_OKAY; 1292 1293 if (index != oldsel) 1294 { 1295 if (oldsel != -1) descr->items[oldsel].selected = FALSE; 1296 if (index != -1) descr->items[index].selected = TRUE; 1297 1298 descr->selected_item = index; 1299 1300 if (oldsel != -1) 1301 LISTBOX_RepaintItem( hwnd, descr, oldsel, ODA_SELECT); 1302 if (index != -1) 1303 LISTBOX_RepaintItem( hwnd, descr, index, ODA_SELECT ); 1304 1305 if (send_notify && descr->nb_items) 1306 SEND_NOTIFICATION( hwnd, descr, (index != -1) 1307 ? LBN_SELCHANGE : LBN_SELCANCEL ); 1308 else 1309 if( descr->lphc ) 1310 /* set selection change flag for parent combo */ 1311 descr->lphc->wState |= CBF_SELCHANGE; 1312 } 1313 } 1314 1315 /* "If the index parameter is -1, the return value is LB_ERR even though 1316 * no error occurred." (At least for single selection boxes.) */ 1317 return (index == -1) ? LB_ERR : LB_OKAY; 1298 1318 } 1299 1319 … … 1396 1416 { 1397 1417 MEASUREITEMSTRUCT mis; 1398 UINT id = (descr->lphc) ? ID_CB_LISTBOX :GetWindowLongA(hwnd,GWL_ID);1418 UINT id = GetWindowLongA(hwnd,GWL_ID); 1399 1419 1400 1420 mis.CtlType = ODT_LISTBOX; … … 1490 1510 { 1491 1511 DELETEITEMSTRUCT dis; 1492 UINT id = (descr->lphc) ? ID_CB_LISTBOX :GetWindowLongA(hwnd,GWL_ID);1512 UINT id = GetWindowLongA(hwnd,GWL_ID); 1493 1513 1494 1514 dis.CtlType = ODT_LISTBOX; … … 1977 1997 1978 1998 static LRESULT LISTBOX_HandleLButtonDownCombo( HWND hwnd, LB_DESCR *pDescr, 1979 WPARAM wParam, INT x, INT y)1999 UINT msg,WPARAM wParam, INT x, INT y) 1980 2000 { 1981 2001 RECT clientRect, screenRect; … … 1989 2009 if(PtInRect(&clientRect, mousePos)) 1990 2010 { 1991 /* MousePos is in client, resume normal processing */ 1992 return LISTBOX_HandleLButtonDown( hwnd, pDescr, wParam, x, y); 2011 /* MousePos is in client, resume normal processing */ 2012 if (msg == WM_LBUTTONDOWN) 2013 { 2014 pDescr->lphc->droppedIndex = pDescr->nb_items ? pDescr->selected_item : -1; 2015 return LISTBOX_HandleLButtonDown( hwnd, pDescr, wParam, x, y); 2016 } 2017 else if (pDescr->style & LBS_NOTIFY) 2018 SEND_NOTIFICATION( hwnd, pDescr, LBN_DBLCLK ); 2019 return 0; 1993 2020 } 1994 2021 else 1995 2022 { 1996 POINT screenMousePos; 1997 HWND hWndOldCapture; 1998 1999 /* Check the Non-Client Area */ 2000 screenMousePos = mousePos; 2001 hWndOldCapture = GetCapture(); 2023 POINT screenMousePos; 2024 RECT screenRect; 2025 HWND hWndOldCapture; 2026 //CB: read buglist 2027 /* Check the Non-Client Area */ 2028 screenMousePos = mousePos; 2029 hWndOldCapture = GetCapture(); 2030 GetWindowRect(hwnd,&screenRect); 2031 ClientToScreen(hwnd,&screenMousePos); 2032 2033 if (!PtInRect(&screenRect,screenMousePos)) 2034 { 2002 2035 ReleaseCapture(); 2003 GetWindowRect(hwnd, &screenRect); 2004 ClientToScreen(hwnd, &screenMousePos); 2005 2006 if(!PtInRect(&screenRect, screenMousePos)) 2007 { 2008 /* Close The Drop Down */ 2009 SEND_NOTIFICATION( hwnd, pDescr, LBN_SELCANCEL ); 2010 return 0; 2011 } 2012 else 2013 { 2014 /* Check to see the NC is a scrollbar */ 2015 INT nHitTestType=0; 2016 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 2017 /* Check Vertical scroll bar */ 2018 if (dwStyle & WS_VSCROLL) 2019 { 2020 clientRect.right += GetSystemMetrics(SM_CXVSCROLL); 2021 if (PtInRect( &clientRect, mousePos )) 2022 { 2023 nHitTestType = HTVSCROLL; 2024 } 2025 } 2026 /* Check horizontal scroll bar */ 2027 if (dwStyle & WS_HSCROLL) 2028 { 2029 clientRect.bottom += GetSystemMetrics(SM_CYHSCROLL); 2030 if (PtInRect( &clientRect, mousePos )) 2031 { 2032 nHitTestType = HTHSCROLL; 2033 } 2034 } 2035 /* Windows sends this message when a scrollbar is clicked 2036 */ 2037 2038 if(nHitTestType != 0) 2039 { 2040 SendMessageA(hwnd, WM_NCLBUTTONDOWN, nHitTestType, 2041 MAKELONG(screenMousePos.x, screenMousePos.y)); 2042 } 2043 /* Resume the Capture after scrolling is complete 2044 */ 2045 if(hWndOldCapture != 0) 2046 { 2047 SetCapture(hWndOldCapture); 2048 } 2049 } 2036 LISTBOX_SetSelection( hwnd, pDescr, pDescr->lphc->droppedIndex, FALSE, FALSE ); 2037 COMBO_FlipListbox( pDescr->lphc, FALSE, FALSE ); 2038 2039 return 0; 2040 } else 2041 { 2042 /* Check to see the NC is a scrollbar */ 2043 INT nHitTestType = SendMessageA(hwnd,WM_NCHITTEST,0,MAKELONG(screenMousePos.x,screenMousePos.y)); 2044 2045 /* Windows sends this message when a scrollbar is clicked 2046 */ 2047 if (nHitTestType != HTCLIENT) 2048 { 2049 SendMessageA(hwnd,(msg == WM_LBUTTONDOWN) ? WM_NCLBUTTONDOWN:WM_NCLBUTTONDBLCLK,nHitTestType,MAKELONG(screenMousePos.x,screenMousePos.y)); 2050 } 2051 2052 /* Resume the Capture after scrolling is complete 2053 */ 2054 if (hWndOldCapture) 2055 { 2056 SetCapture(hWndOldCapture); 2057 } 2058 } 2050 2059 } 2051 2060 return 0; … … 2135 2144 { 2136 2145 INT index; 2137 TIMER_DIRECTION dir ;2146 TIMER_DIRECTION dir = LB_TIMER_NONE; 2138 2147 2139 2148 if (GetCapture() != hwnd) return 0; … … 2156 2165 x = descr->width - 1; 2157 2166 } 2158 else dir = LB_TIMER_NONE; /* inside */2159 2167 } 2160 2168 else … … 2162 2170 if (y < 0) dir = LB_TIMER_UP; /* above */ 2163 2171 else if (y >= descr->height) dir = LB_TIMER_DOWN; /* below */ 2164 else dir = LB_TIMER_NONE; /* inside */2165 2172 } 2166 2173 … … 2356 2363 descr->nb_tabs = 0; 2357 2364 descr->tabs = NULL; 2358 descr->caret_on = TRUE;2365 descr->caret_on = lphc ? FALSE:TRUE; 2359 2366 descr->in_focus = FALSE; 2360 2367 descr->captured = FALSE; … … 2388 2395 else 2389 2396 { 2390 UINT id = (descr->lphc ) ? ID_CB_LISTBOX :GetWindowLongA(hwnd,GWL_ID);2397 UINT id = GetWindowLongA(hwnd,GWL_ID); 2391 2398 2392 2399 mis.CtlType = ODT_LISTBOX; … … 3062 3069 } 3063 3070 case WM_LBUTTONDOWN: 3064 return LISTBOX_HandleLButtonDownCombo( hwnd, descr, wParam, 3071 case WM_LBUTTONDBLCLK: 3072 return LISTBOX_HandleLButtonDownCombo( hwnd, descr,msg, wParam, 3065 3073 (INT16)LOWORD(lParam), (INT16)HIWORD(lParam)); 3066 3074 case WM_MOUSEACTIVATE: … … 3077 3085 && (wParam == VK_DOWN || wParam == VK_UP)) ) 3078 3086 { 3079 COMBO_FlipListbox( lphc, FALSE );3087 COMBO_FlipListbox( lphc, FALSE, FALSE ); 3080 3088 return 0; 3081 3089 }
Note:
See TracChangeset
for help on using the changeset viewer.