Changeset 8377 for trunk/src/user32/win32wbase.cpp
- Timestamp:
- May 7, 2002, 3:28:13 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.