- Timestamp:
- May 7, 2002, 3:28:13 PM (23 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/listbox.cpp
r8301 r8377 1 /* $Id: listbox.cpp,v 1.2 8 2002-04-24 08:56:16sandervl Exp $ */1 /* $Id: listbox.cpp,v 1.29 2002-05-07 13:28:12 sandervl Exp $ */ 2 2 /* 3 3 * Listbox controls … … 1771 1771 1772 1772 if (descr->style & LBS_MULTICOLUMN) return 0; 1773 dprintf(("We are handling scroll")); 1773 1774 switch(LOWORD(wParam)) 1774 1775 { … … 2038 2039 if (!PtInRect(&screenRect,screenMousePos)) 2039 2040 { 2041 dprintf(("Scrollbar hittest - plain branch")); 2040 2042 ReleaseCapture(); 2043 LISTBOX_SetCaretIndex( hwnd, pDescr, pDescr->lphc->droppedIndex, FALSE ); 2041 2044 LISTBOX_SetSelection( hwnd, pDescr, pDescr->lphc->droppedIndex, FALSE, FALSE ); 2042 2045 #ifdef __WIN32OS2__ 2043 2046 COMBO_RollupListbox(pDescr->lphc); 2044 2047 2045 /* @@PF Previous code is all wrong here. Here we are supposed to close2048 /* @@PF Previous code is all wrong here. Here we are supposed to close 2046 2049 and only close dropdown, instead flip, flips it. This happens because 2047 2050 previous code did not pay attention to the fact that combobox can be … … 2052 2055 #endif 2053 2056 return 0; 2054 } else 2057 } 2058 else 2055 2059 { 2056 /* Check to see the NC is a scrollbar */ 2057 INT nHitTestType = SendMessageA(hwnd,WM_NCHITTEST,0,MAKELONG(screenMousePos.x,screenMousePos.y)); 2058 2059 /* Windows sends this message when a scrollbar is clicked 2060 */ 2061 if (nHitTestType != HTCLIENT) 2062 { 2063 SendMessageA(hwnd,(msg == WM_LBUTTONDOWN) ? WM_NCLBUTTONDOWN:WM_NCLBUTTONDBLCLK,nHitTestType,MAKELONG(screenMousePos.x,screenMousePos.y)); 2064 } 2065 2066 /* Resume the Capture after scrolling is complete 2067 */ 2068 if (hWndOldCapture) 2069 { 2070 SetCapture(hWndOldCapture); 2071 } 2060 INT nHitTestType=0; 2061 LONG style = GetWindowLongA( hwnd, GWL_STYLE ); 2062 /* Check Vertical scroll bar */ 2063 if (style & WS_VSCROLL) 2064 { 2065 clientRect.right += GetSystemMetrics(SM_CXVSCROLL); 2066 if (PtInRect( &clientRect, mousePos )) 2067 { 2068 nHitTestType = HTVSCROLL; 2069 } 2070 } 2071 /* Check horizontal scroll bar */ 2072 if (style & WS_HSCROLL) 2073 { 2074 clientRect.bottom += GetSystemMetrics(SM_CYHSCROLL); 2075 if (PtInRect( &clientRect, mousePos )) 2076 { 2077 nHitTestType = HTHSCROLL; 2078 } 2079 } 2080 /* Windows sends this message when a scrollbar is clicked 2081 */ 2082 2083 if(nHitTestType != 0) 2084 { 2085 SendMessageW(hwnd, WM_NCLBUTTONDOWN, nHitTestType, 2086 MAKELONG(screenMousePos.x, screenMousePos.y)); 2087 } 2088 /* Resume the Capture after scrolling is complete 2089 */ 2090 if(hWndOldCapture != 0) 2091 { 2092 SetCapture(hWndOldCapture); 2093 } 2094 2072 2095 } 2073 2096 } -
trunk/src/user32/win32wbase.cpp
r8301 r8377 1 /* $Id: win32wbase.cpp,v 1.32 3 2002-04-24 08:56:17sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.324 2002-05-07 13:28:13 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 2735 2735 Win32BaseWindow *Win32BaseWindow::getParent() 2736 2736 { 2737 Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::getParentOfChild(); 2738 //experiment 2739 #if 0 2740 return ((ULONG)wndparent == (ULONG)windowDesktop) ? NULL : wndparent; 2741 #else 2742 return wndparent; 2743 #endif 2744 } 2745 //****************************************************************************** 2746 //Note: does not set last error if no parent (verified in NT4, SP6) 2747 //****************************************************************************** 2748 HWND Win32BaseWindow::GetParent() 2749 { 2737 2750 Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::getParentOfChild(); 2738 return ((ULONG)wndparent == (ULONG)windowDesktop) ? NULL : wndparent; 2739 } 2740 //****************************************************************************** 2741 //Note: does not set last error if no parent (verified in NT4, SP6) 2742 //****************************************************************************** 2743 HWND Win32BaseWindow::GetParent() 2744 { 2745 Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::getParentOfChild(); 2746 2747 if(getStyle() & WS_CHILD) { 2748 if(wndparent) { 2749 return wndparent->getWindowHandle(); 2750 } 2751 dprintf(("WARNING: GetParent: WS_CHILD but no parent!!")); 2752 DebugInt3(); 2753 return 0; 2754 } 2755 else 2756 if(getStyle() & WS_POPUP) 2757 return (getOwner()) ? getOwner()->getWindowHandle() : 0; 2758 else return 0; 2751 2752 if(getStyle() & WS_CHILD) 2753 { 2754 if(wndparent) { 2755 return wndparent->getWindowHandle(); 2756 } 2757 dprintf(("WARNING: GetParent: WS_CHILD but no parent!!")); 2758 DebugInt3(); 2759 return 0; 2760 } 2761 else 2762 if(getStyle() & WS_POPUP) 2763 return (getOwner()) ? getOwner()->getWindowHandle() : 0; 2764 else return 0; 2759 2765 } 2760 2766 //****************************************************************************** … … 2762 2768 HWND Win32BaseWindow::SetParent(HWND hwndNewParent) 2763 2769 { 2764 HWND oldhwnd;2765 Win32BaseWindow *newparent;2766 Win32BaseWindow *oldparent = (Win32BaseWindow *)ChildWindow::getParentOfChild();2767 BOOL fShow = FALSE;2768 2769 if(oldparent) {2770 HWND oldhwnd; 2771 Win32BaseWindow *newparent; 2772 Win32BaseWindow *oldparent = (Win32BaseWindow *)ChildWindow::getParentOfChild(); 2773 BOOL fShow = FALSE; 2774 2775 if(oldparent) { 2770 2776 oldhwnd = oldparent->getWindowHandle(); 2771 2777 oldparent->removeChild(this); 2772 }2773 else oldhwnd = 0;2774 2775 /* Windows hides the window first, then shows it again2776 * including the WM_SHOWWINDOW messages and all */2777 if(IsWindowCreated() && (getStyle() & WS_VISIBLE)) {2778 } 2779 else oldhwnd = 0; 2780 2781 /* Windows hides the window first, then shows it again 2782 * including the WM_SHOWWINDOW messages and all */ 2783 if(IsWindowCreated() && (getStyle() & WS_VISIBLE)) { 2778 2784 ShowWindow(SW_HIDE); 2779 2785 fShow = TRUE; 2780 }2781 if(oldparent) {2786 } 2787 if(oldparent) { 2782 2788 //release parent here (increased refcount during creation) 2783 2789 RELEASE_WNDOBJ(oldparent); 2784 }2785 newparent = GetWindowFromHandle(hwndNewParent);2786 if(newparent && !newparent->isDesktopWindow())2787 {2790 } 2791 newparent = GetWindowFromHandle(hwndNewParent); 2792 if(newparent && !newparent->isDesktopWindow()) 2793 { 2788 2794 setParent(newparent); 2789 2795 getParent()->addChild(this); … … 2793 2799 if(!(getStyle() & WS_CHILD)) 2794 2800 { 2795 //TODO: Send WM_STYLECHANGED msg?2796 setStyle(getStyle() | WS_CHILD);2797 2801 if(getWindowId()) 2798 2802 { … … 2807 2811 SWP_NOACTIVATE|SWP_NOSIZE); 2808 2812 fParentChange = FALSE; 2809 }2810 else {2813 } 2814 else { 2811 2815 if(newparent) RELEASE_WNDOBJ(newparent); 2812 2816 … … 2816 2820 OSLibWinSetParent(getOS2FrameWindowHandle(), OSLIB_HWND_DESKTOP); 2817 2821 2818 //TODO: Send WM_STYLECHANGED msg?2819 setStyle(getStyle() & ~WS_CHILD);2820 2822 setWindowId(0); 2821 }2822 /* SetParent additionally needs to make hwndChild the topmost window2823 in the x-order and send the expected WM_WINDOWPOSCHANGING and2824 WM_WINDOWPOSCHANGED notification messages.2825 */2826 if(state >= STATE_PRE_WMNCCREATE) {2823 } 2824 /* SetParent additionally needs to make hwndChild the topmost window 2825 in the x-order and send the expected WM_WINDOWPOSCHANGING and 2826 WM_WINDOWPOSCHANGED notification messages. 2827 */ 2828 if(state >= STATE_PRE_WMNCCREATE) { 2827 2829 SetWindowPos(HWND_TOPMOST, 0, 0, 0, 0, 2828 2830 SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|(fShow? SWP_SHOWWINDOW : 0)); 2829 2831 2830 /* FIXME: a WM_MOVE is also generated (in the DefWindowProc handler2831 * for WM_WINDOWPOSCHANGED) in Windows, should probably remove SWP_NOMOVE */2832 }2833 return oldhwnd;2832 /* FIXME: a WM_MOVE is also generated (in the DefWindowProc handler 2833 * for WM_WINDOWPOSCHANGED) in Windows, should probably remove SWP_NOMOVE */ 2834 } 2835 return oldhwnd; 2834 2836 } 2835 2837 //****************************************************************************** … … 2837 2839 BOOL Win32BaseWindow::IsChild(HWND hwndParent) 2838 2840 { 2839 // PH: Optimizer won't unroll calls to getParent() even2840 // in release build.2841 Win32BaseWindow *_parent = getParent();2841 // PH: Optimizer won't unroll calls to getParent() even 2842 // in release build. 2843 Win32BaseWindow *_parent = getParent(); 2842 2844 2843 if(_parent)2844 {2845 if(_parent->getWindowHandle() == hwndParent)2846 return TRUE;2847 2848 return _parent->IsChild(hwndParent);2849 }2850 else2851 return 0;2845 if(_parent) 2846 { 2847 if(_parent->getWindowHandle() == hwndParent) 2848 return TRUE; 2849 2850 return _parent->IsChild(hwndParent); 2851 } 2852 else 2853 return 0; 2852 2854 } 2853 2855 //****************************************************************************** … … 2855 2857 HWND Win32BaseWindow::GetTopWindow() 2856 2858 { 2857 HWND hwndTop;2858 Win32BaseWindow *topwindow;2859 HWND hwndTop; 2860 Win32BaseWindow *topwindow; 2859 2861 2860 2862 hwndTop = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_TOP); … … 2898 2900 HWND Win32BaseWindow::GetTopParent() 2899 2901 { 2900 Win32BaseWindow *window = this;2901 HWND hwndTopParent = 0;2902 Win32BaseWindow *window = this; 2903 HWND hwndTopParent = 0; 2902 2904 2903 2905 lock(); … … 2918 2920 BOOL Win32BaseWindow::EnumChildWindows(WNDENUMPROC lpfn, LPARAM lParam) 2919 2921 { 2920 BOOL rc = TRUE;2921 HWND hwnd;2922 Win32BaseWindow *prevchild = 0, *child = 0;2922 BOOL rc = TRUE; 2923 HWND hwnd; 2924 Win32BaseWindow *prevchild = 0, *child = 0; 2923 2925 2924 2926 dprintf(("EnumChildWindows of %x parameter %x %x (%x)", getWindowHandle(), lpfn, lParam, getFirstChild())); … … 2970 2972 BOOL Win32BaseWindow::EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam) 2971 2973 { 2972 Win32BaseWindow *child = 0;2973 ULONG tid, pid;2974 BOOL rc;2975 HWND hwnd;2974 Win32BaseWindow *child = 0; 2975 ULONG tid, pid; 2976 BOOL rc; 2977 HWND hwnd; 2976 2978 2977 2979 dprintf(("EnumThreadWindows %x %x %x", dwThreadId, lpfn, lParam)); … … 2995 2997 BOOL Win32BaseWindow::EnumWindows(WNDENUMPROC lpfn, LPARAM lParam) 2996 2998 { 2997 Win32BaseWindow *window;2998 BOOL rc;2999 HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD;3000 DWORD dwStyle;2999 Win32BaseWindow *window; 3000 BOOL rc; 3001 HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD; 3002 DWORD dwStyle; 3001 3003 3002 3004 dprintf(("EnumWindows %x %x", lpfn, lParam)); … … 3049 3051 HWND Win32BaseWindow::FindWindowEx(HWND hwndParent, HWND hwndChildAfter, ATOM atom, LPSTR lpszWindow) 3050 3052 { 3051 Win32BaseWindow *parent = GetWindowFromHandle(hwndParent);3052 Win32BaseWindow *child = GetWindowFromHandle(hwndChildAfter);3053 Win32BaseWindow *firstchild = child;3053 Win32BaseWindow *parent = GetWindowFromHandle(hwndParent); 3054 Win32BaseWindow *child = GetWindowFromHandle(hwndChildAfter); 3055 Win32BaseWindow *firstchild = child; 3054 3056 3055 3057 dprintf(("FindWindowEx %x %x %x %s", hwndParent, hwndChildAfter, atom, lpszWindow));
Note:
See TracChangeset
for help on using the changeset viewer.