00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include <os2win.h>
00017 #include <win.h>
00018 #include <stdlib.h>
00019 #include <string.h>
00020 #include <stdarg.h>
00021 #include <assert.h>
00022 #include <misc.h>
00023 #include <win32wnd.h>
00024 #include <heapstring.h>
00025 #include <spy.h>
00026 #include "wndmsg.h"
00027 #include <oslibwin.h>
00028 #include <oslibutil.h>
00029 #include <oslibgdi.h>
00030 #include <oslibres.h>
00031 #include "oslibdos.h"
00032 #include "win32wndhandle.h"
00033 #include "win32wmisc.h"
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 HWND *WIN_ListChildren( HWND hwnd )
00044 {
00045 Win32BaseWindow *parent = Win32BaseWindow::GetWindowFromHandle(hwnd), *win32wnd;
00046 HWND *list, *phwnd;
00047 UINT count = 0;
00048
00049 if(parent == NULL) {
00050 dprintf(("ERROR: WIN_ListChildren invalid hwnd %x", hwnd));
00051 return 0;
00052 }
00053
00054
00055 win32wnd = (Win32BaseWindow*)parent->getFirstChild();
00056 while (win32wnd)
00057 {
00058 count++;
00059 win32wnd = (Win32BaseWindow*)win32wnd->getNextChild();
00060 }
00061
00062 if( count )
00063 {
00064
00065
00066 if ((list = (HWND *)HeapAlloc( GetProcessHeap(), 0, sizeof(HWND) * (count + 1))))
00067 {
00068 win32wnd = (Win32BaseWindow*)parent->getFirstChild();
00069 phwnd = list;
00070 count = 0;
00071 while(win32wnd)
00072 {
00073 *phwnd++ = win32wnd->getWindowHandle();
00074 count++;
00075 win32wnd = (Win32BaseWindow*)win32wnd->getNextChild();
00076 }
00077 *phwnd = 0;
00078 }
00079 else count = 0;
00080 } else list = NULL;
00081
00082 RELEASE_WNDOBJ(parent);
00083 return list;
00084 }
00085
00086
00087 MDICLIENTINFO *get_client_info( HWND hwndClient )
00088 {
00089 MDICLIENTINFO *ret = NULL;
00090 Win32BaseWindow *client = Win32BaseWindow::GetWindowFromHandle(hwndClient);
00091
00092 if (client)
00093 {
00094 if (client->getCBExtra() < sizeof(MDICLIENTINFO)) {
00095 dprintf(("WARNING: get_client_info %x is not an MDI client", hwndClient ));
00096 }
00097 else ret = (MDICLIENTINFO*)client->getExtraPtr();
00098 RELEASE_WNDOBJ(client);
00099 }
00100 return ret;
00101 }
00102
00103
00104 void GetWindowRectParent(HWND hwnd, RECT *pRect)
00105 {
00106 Win32BaseWindow *window = Win32BaseWindow::GetWindowFromHandle(hwnd);
00107
00108 if (window)
00109 {
00110 *pRect = *window->getWindowRect();
00111 RELEASE_WNDOBJ(window);
00112 }
00113 }
00114
00115
00116 HMENU WIN32API getSysMenu(HWND hwnd)
00117 {
00118 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
00119
00120 if(win32wnd) {
00121 HMENU hmenu = win32wnd->GetSysMenu();
00122 RELEASE_WNDOBJ(win32wnd);
00123 return hmenu;
00124 }
00125 return (HMENU)0;
00126 }
00127
00128
00129 VOID setSysMenu(HWND hwnd,HMENU hMenu)
00130 {
00131 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
00132
00133 if(win32wnd) {
00134 win32wnd->SetSysMenu(hMenu);
00135 RELEASE_WNDOBJ(win32wnd);
00136 }
00137 }
00138
00139
00140
00141 void NC_GetSysPopupPos( HWND hwnd, RECT* rect )
00142 {
00143 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
00144
00145 if (!win32wnd) return;
00146
00147 win32wnd->GetSysPopupPos(rect);
00148 RELEASE_WNDOBJ(win32wnd);
00149 }
00150
00151