Changeset 1203 for trunk/src/user32/listbox.cpp
- Timestamp:
- Oct 8, 1999, 11:26:08 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/listbox.cpp
r949 r1203 1 /* $Id: listbox.cpp,v 1. 1 1999-09-15 23:18:51 sandervlExp $ */1 /* $Id: listbox.cpp,v 1.2 1999-10-08 21:24:40 cbratschi Exp $ */ 2 2 /* 3 3 * Listbox controls … … 5 5 * Copyright 1996 Alexandre Julliard 6 6 * Copyright 1999 Christoph Bratschi (ported from WINE) 7 * 8 * WINE version: 990923 7 9 */ 8 10 … … 624 626 INT i; 625 627 LPINT16 p = (LPINT16)tabs; 626 //dbg_decl_str(listbox, 256);627 628 628 629 for (i = 0; i < descr->nb_tabs; i++) { … … 764 765 if (HAS_STRINGS(descr)) 765 766 { 766 if (!str ) return LB_ERR;767 if (!str || !str[0]) return LB_ERR; 767 768 if (exact) 768 769 { … … 1784 1785 1785 1786 1787 /************************************************************************* 1788 * LISTBOX_HandleLButtonDownCombo [Internal] 1789 * 1790 * Process LButtonDown message for the ComboListBox 1791 * 1792 * PARAMS 1793 * pWnd [I] The windows internal structure 1794 * pDescr [I] The ListBox internal structure 1795 * wParam [I] Key Flag (WM_LBUTTONDOWN doc for more info) 1796 * x [I] X Mouse Coordinate 1797 * y [I] Y Mouse Coordinate 1798 * 1799 * RETURNS 1800 * 0 since we are processing the WM_LBUTTONDOWN Message 1801 * 1802 * NOTES 1803 * This function is only to be used when a ListBox is a ComboListBox 1804 */ 1805 1806 static LRESULT LISTBOX_HandleLButtonDownCombo( HWND hwnd, LB_DESCR *pDescr, 1807 WPARAM wParam, INT x, INT y) 1808 { 1809 RECT clientRect, screenRect; 1810 POINT mousePos; 1811 1812 mousePos.x = x; 1813 mousePos.y = y; 1814 1815 GetClientRect(hwnd, &clientRect); 1816 1817 if(PtInRect(&clientRect, mousePos)) 1818 { 1819 /* MousePos is in client, resume normal processing */ 1820 return LISTBOX_HandleLButtonDown( hwnd, pDescr, wParam, x, y); 1821 } 1822 else 1823 { 1824 POINT screenMousePos; 1825 HWND hWndOldCapture; 1826 1827 /* Check the Non-Client Area */ 1828 screenMousePos = mousePos; 1829 hWndOldCapture = GetCapture(); 1830 ReleaseCapture(); 1831 GetWindowRect(hwnd, &screenRect); 1832 ClientToScreen(hwnd, &screenMousePos); 1833 1834 if(!PtInRect(&screenRect, screenMousePos)) 1835 { 1836 /* Close The Drop Down */ 1837 SEND_NOTIFICATION( hwnd, pDescr, LBN_SELCANCEL ); 1838 return 0; 1839 } 1840 else 1841 { 1842 /* Check to see the NC is a scrollbar */ 1843 INT nHitTestType=0; 1844 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 1845 /* Check Vertical scroll bar */ 1846 if (dwStyle & WS_VSCROLL) 1847 { 1848 clientRect.right += GetSystemMetrics(SM_CXVSCROLL); 1849 if (PtInRect( &clientRect, mousePos )) 1850 { 1851 nHitTestType = HTVSCROLL; 1852 } 1853 } 1854 /* Check horizontal scroll bar */ 1855 if (dwStyle & WS_HSCROLL) 1856 { 1857 clientRect.bottom += GetSystemMetrics(SM_CYHSCROLL); 1858 if (PtInRect( &clientRect, mousePos )) 1859 { 1860 nHitTestType = HTHSCROLL; 1861 } 1862 } 1863 /* Windows sends this message when a scrollbar is clicked 1864 */ 1865 1866 if(nHitTestType != 0) 1867 { 1868 SendMessageA(hwnd, WM_NCLBUTTONDOWN, nHitTestType, 1869 MAKELONG(screenMousePos.x, screenMousePos.y)); 1870 } 1871 /* Resume the Capture after scrolling is complete 1872 */ 1873 if(hWndOldCapture != 0) 1874 { 1875 SetCapture(hWndOldCapture); 1876 } 1877 } 1878 } 1879 return 0; 1880 } 1881 1882 1786 1883 /*********************************************************************** 1787 1884 * LISTBOX_HandleLButtonUp … … 2162 2259 { 2163 2260 switch (msg) 2164 2165 2166 2261 { 2262 case WM_CREATE: 2263 { 2167 2264 if (!LISTBOX_Create( hwnd, NULL )) 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2265 return -1; 2266 //TRACE("creating wnd=%04x descr=%p\n", 2267 // hwnd, *(LB_DESCR **)wnd->wExtra ); 2268 return 0; 2269 } 2270 case WM_NCCREATE: 2271 { 2272 DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE); 2273 2274 /* 2275 * When a listbox is not in a combobox and the look 2276 * is win95, the WS_BORDER style is replaced with 2277 * the WS_EX_CLIENTEDGE style. 2278 */ 2279 if (dwStyle & WS_BORDER) 2280 { 2281 SetWindowLongA(hwnd,GWL_EXSTYLE,GetWindowLongA(hwnd,GWL_EXSTYLE) | WS_EX_CLIENTEDGE); 2282 SetWindowLongA(hwnd,GWL_STYLE,GetWindowLongA(hwnd,GWL_STYLE) & ~ WS_BORDER); 2283 } 2284 } 2285 } 2189 2286 /* Ignore all other messages before we get a WM_CREATE */ 2190 2287 return DefWindowProcA( hwnd, msg, wParam, lParam ); … … 2214 2311 return descr->nb_items; 2215 2312 else 2216 return LB_ERR; 2313 return LB_ERR; 2217 2314 2218 2315 case LB_GETITEMDATA: … … 2561 2658 * the mouse is captured to show the tracking of the item. 2562 2659 */ 2563 captured = descr->captured; 2564 descr->captured = TRUE; 2565 2566 LISTBOX_HandleMouseMove( hwnd, 2567 descr, 2568 mousePos.x, mousePos.y); 2569 2570 descr->captured = captured; 2571 2572 /* 2573 * However, when tracking, it is important that we do not 2574 * perform a selection if the cursor is outside the list. 2575 */ 2660 2576 2661 GetClientRect(hwnd, &clientRect); 2577 2578 if (!PtInRect( &clientRect, mousePos )) 2662 if (PtInRect( &clientRect, mousePos )) 2663 { 2664 captured = descr->captured; 2665 descr->captured = TRUE; 2666 2667 LISTBOX_HandleMouseMove( hwnd, descr, 2668 mousePos.x, mousePos.y); 2669 descr->captured = captured; 2670 } 2671 else 2579 2672 { 2580 LISTBOX_MoveCaret( hwnd, descr, -1, FALSE ); 2673 LISTBOX_HandleMouseMove( hwnd, descr, 2674 mousePos.x, mousePos.y); 2581 2675 } 2676 2582 2677 2583 2678 return 0; … … 2620 2715 return LISTBOX_HandleLButtonUp( hwnd, descr ); 2621 2716 case WM_LBUTTONDOWN: 2622 return LISTBOX_HandleLButtonDown ( hwnd, descr, wParam,2717 return LISTBOX_HandleLButtonDownCombo( hwnd, descr, wParam, 2623 2718 (INT16)LOWORD(lParam), (INT16)HIWORD(lParam)); 2624 /* avoid activation at all costs */ 2625 case WM_MOUSEACTIVATE: 2719 case WM_MOUSEACTIVATE: 2626 2720 return MA_NOACTIVATE; 2627 2721 case WM_NCACTIVATE:
Note:
See TracChangeset
for help on using the changeset viewer.