Changeset 2114 for trunk/src


Ignore:
Timestamp:
Dec 18, 1999, 5:31:52 PM (26 years ago)
Author:
cbratschi
Message:

MDI fixes, ChildWindowFromPointEx

Location:
trunk/src/user32
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/pmframe.cpp

    r1971 r2114  
    1 /* $Id: pmframe.cpp,v 1.26 1999-12-05 00:31:47 sandervl Exp $ */
     1/* $Id: pmframe.cpp,v 1.27 1999-12-18 16:31:49 cbratschi Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    325325        dprintf(("PMFRAME: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    326326
    327         //Save height so WM_WINDOWPOSCHANGED handler in pmwindow.cpp
     327        //Save height so WM_WINDOWPOSCHANGED handler in pmwindow.cpp
    328328        //(for client) doesn't overwrite the client rectangle (breaks ydelta calculation)
    329         clientHeight = win32wnd->getWindowHeight();
     329        clientHeight = win32wnd->getWindowHeight();
    330330
    331331        RestoreOS2TIB();
     
    385385#endif
    386386
    387                 if(swp[i].y != 0) {
     387                if(swp[i].y != 0) //CB: y value of 0 is valid!
     388                {
    388389                    //child window at offset <> 0 from client area -> offset now changes
    389390                    swp[i].y  += yDelta;
  • trunk/src/user32/user32.cpp

    r2093 r2114  
    1 /* $Id: user32.cpp,v 1.60 1999-12-16 16:53:58 cbratschi Exp $ */
     1/* $Id: user32.cpp,v 1.61 1999-12-18 16:31:49 cbratschi Exp $ */
    22
    33/*
     
    25722572/* CB: move to MDI */
    25732573
    2574 /*****************************************************************************
    2575  * Name      : WORD WIN32API TileWindows
    2576  * Purpose   : The TileWindows function tiles the specified windows, or the child
    2577  *             windows of the specified parent window.
    2578  * Parameters: HWND       hwndParent     handle of parent window
    2579  *             WORD       wFlags         types of windows not to arrange
    2580  *             LPCRECT    lpRect         rectangle to arrange windows in
    2581  *             WORD       cChildrenb     number of windows to arrange
    2582  *             const HWND *ahwndChildren array of window handles
    2583  * Variables :
    2584  * Result    : If the function succeeds, the return value is the number of
    2585  *               windows arranged.
    2586  *             If the function fails, the return value is zero.
    2587  * Remark    :
    2588  * Status    : UNTESTED STUB
    2589  *
    2590  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
    2591  *****************************************************************************/
    2592 WORD WIN32API TileWindows(HWND       hwndParent,
    2593                           UINT       wFlags,
    2594                           const LPRECT lpRect,
    2595                           UINT       cChildrenb,
    2596                           const HWND *ahwndChildren)
    2597 {
    2598   dprintf(("USER32:TileWindows (%08xh,%08xh,%08xh,%08xh,%08x) not implemented.\n",
    2599            hwndParent,
    2600            wFlags,
    2601            lpRect,
    2602            cChildrenb,
    2603            ahwndChildren));
    2604 
    2605    return (0);
    2606 }
    2607 /*****************************************************************************
    2608  * Name      : BOOL WIN32API TileChildWindows
    2609  * Purpose   : Unknown
    2610  * Parameters: Unknown
    2611  * Variables :
    2612  * Result    :
    2613  * Remark    :
    2614  * Status    : UNTESTED UNKNOWN STUB
    2615  *
    2616  * Author    : Patrick Haller [Wed, 1998/06/16 11:55]
    2617  *****************************************************************************/
    2618 BOOL WIN32API TileChildWindows(DWORD x1,
    2619                                   DWORD x2)
    2620 {
    2621   dprintf(("USER32: TileChildWindows(%08xh,%08xh) not implemented.\n",
    2622            x1,
    2623            x2));
    2624 
    2625   return (FALSE); /* default */
    2626 }
    2627 /*****************************************************************************
    2628  * Name      : BOOL WIN32API CascadeChildWindows
    2629  * Purpose   : Unknown
    2630  * Parameters: Unknown
    2631  * Variables :
    2632  * Result    :
    2633  * Remark    :
    2634  * Status    : UNTESTED UNKNOWN STUB
    2635  *
    2636  * Author    : Patrick Haller [Wed, 1998/06/16 11:55]
    2637  *****************************************************************************/
    2638 BOOL WIN32API CascadeChildWindows(DWORD x1,
    2639                                      DWORD x2)
    2640 {
    2641   dprintf(("USER32: CascadeChildWindows(%08xh,%08xh) not implemented.\n",
    2642            x1,
    2643            x2));
    2644 
    2645   return (FALSE); /* default */
    2646 }
    2647 
    26482574/* Drag'n'drop */
    26492575
  • trunk/src/user32/win32wbase.cpp

    r2099 r2114  
    1 /* $Id: win32wbase.cpp,v 1.113 1999-12-17 17:18:03 cbratschi Exp $ */
     1/* $Id: win32wbase.cpp,v 1.114 1999-12-18 16:31:50 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    20012001                  point.x = pt.x;
    20022002                  point.y = pt.y;
    2003                   MapWindowPoints(getParent()->getWindowHandle(),Win32Hwnd,&point,1);
     2003                  MapWindowPoints(Win32Hwnd,getParent()->getWindowHandle(),&point,1);
    20042004                  NotifyParent(Msg,wParam,MAKELPARAM(point.x,point.y));
    20052005                }
  • trunk/src/user32/win32wmdichild.cpp

    r2101 r2114  
    1 /* $Id: win32wmdichild.cpp,v 1.14 1999-12-17 17:49:54 cbratschi Exp $ */
     1/* $Id: win32wmdichild.cpp,v 1.15 1999-12-18 16:31:51 cbratschi Exp $ */
    22/*
    33 * Win32 MDI Child Window Class for OS/2
     
    435435    Win32MDIClientWindow *client = (Win32MDIClientWindow *)getParent();
    436436    char   buffer[128];
    437     UINT   n          = sprintf(buffer, "%d ", getWindowId() - client->getFirstChildId() + 1);
    438     BOOL   bRet     = 0;
     437    UINT   id   = getWindowId()-client->getFirstChildId()+1;
     438    UINT   n    = sprintf(buffer,(id > 9) ? "%d":"&%d ",id);
     439    BOOL   bRet = 0;
    439440
    440441    if( !client->getMDIMenu() )
  • trunk/src/user32/win32wmdiclient.cpp

    r2099 r2114  
    1 /* $Id: win32wmdiclient.cpp,v 1.15 1999-12-17 17:18:04 cbratschi Exp $ */
     1/* $Id: win32wmdiclient.cpp,v 1.16 1999-12-18 16:31:51 cbratschi Exp $ */
    22/*
    33 * Win32 MDI Client Window Class for OS/2
     
    437437        if( child == getActiveChild() )
    438438        {
    439             ShowWindow(SW_HIDE);
     439            ::ShowWindow(child->getWindowHandle(),SW_HIDE);
    440440            if( child == getMaximizedChild() )
    441441            {
     
    455455    if (flagDestroy)
    456456    {
    457 //        MDI_PostUpdate(GetParent(child), ci, SB_BOTH+1);
     457        postUpdate(SB_BOTH+1);
    458458        ::DestroyWindow(child->getWindowHandle());
    459459    }
     
    687687
    688688/**********************************************************************
    689  *                      MDI_CalcDefaultChildPos
     689 *                      MDI_CalcDefaultChildPos
    690690 *
    691691 *  It seems that the default height is about 2/3 of the client rect
     
    696696    RECT rect = *this->getClientRect();
    697697    INT  spacing = GetSystemMetrics(SM_CYCAPTION) +
    698                      GetSystemMetrics(SM_CYFRAME) - 1;
     698                     GetSystemMetrics(SM_CYFRAME) - 1;
    699699
    700700    if( rect.bottom - rect.top - delta >= spacing )
    701         rect.bottom -= delta;
     701        rect.bottom -= delta;
    702702
    703703    nstagger = (rect.bottom - rect.top)/(3 * spacing);
     
    11081108}
    11091109
     1110/*****************************************************************************
     1111 * Name      : WORD WIN32API CascadeWindows
     1112 * Purpose   : The CascadeWindows function cascades the specified windows or
     1113 *             the child windows of the specified parent window.
     1114 * Parameters: HWND hwndParent         handle of parent window
     1115 *             UINT wHow               types of windows not to arrange
     1116 *             CONST RECT * lpRect     rectangle to arrange windows in
     1117 *             UINT cKids              number of windows to arrange
     1118 *             const HWND FAR * lpKids array of window handles
     1119 * Variables :
     1120 * Result    : If the function succeeds, the return value is the number of windows arranged.
     1121 *             If the function fails, the return value is zero.
     1122 * Remark    :
     1123 * Status    : UNTESTED STUB
     1124 *
     1125 * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
     1126 *****************************************************************************/
     1127WORD WIN32API CascadeWindows(HWND       hwndParent,
     1128                             UINT       wHow,
     1129                             CONST LPRECT lpRect,
     1130                             UINT       cKids,
     1131                             const HWND *lpKids)
     1132{
     1133  dprintf(("USER32:CascadeWindows(%08xh,%u,%08xh,%u,%08x) not implemented.\n",
     1134         hwndParent,
     1135         wHow,
     1136         lpRect,
     1137         cKids,
     1138         lpKids));
     1139
     1140  return (0);
     1141}
     1142
     1143/*****************************************************************************
     1144 * Name      : BOOL WIN32API CascadeChildWindows
     1145 * Purpose   : Unknown
     1146 * Parameters: Unknown
     1147 * Variables :
     1148 * Result    :
     1149 * Remark    :
     1150 * Status    : UNTESTED UNKNOWN STUB
     1151 *
     1152 * Author    : Patrick Haller [Wed, 1998/06/16 11:55]
     1153 *****************************************************************************/
     1154BOOL WIN32API CascadeChildWindows(DWORD x1,
     1155                                     DWORD x2)
     1156{
     1157  dprintf(("USER32: CascadeChildWindows(%08xh,%08xh) not implemented.\n",
     1158           x1,
     1159           x2));
     1160
     1161  return (FALSE); /* default */
     1162}
     1163
     1164/*****************************************************************************
     1165 * Name      : WORD WIN32API TileWindows
     1166 * Purpose   : The TileWindows function tiles the specified windows, or the child
     1167 *             windows of the specified parent window.
     1168 * Parameters: HWND       hwndParent     handle of parent window
     1169 *             WORD       wFlags         types of windows not to arrange
     1170 *             LPCRECT    lpRect         rectangle to arrange windows in
     1171 *             WORD       cChildrenb     number of windows to arrange
     1172 *             const HWND *ahwndChildren array of window handles
     1173 * Variables :
     1174 * Result    : If the function succeeds, the return value is the number of
     1175 *               windows arranged.
     1176 *             If the function fails, the return value is zero.
     1177 * Remark    :
     1178 * Status    : UNTESTED STUB
     1179 *
     1180 * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
     1181 *****************************************************************************/
     1182WORD WIN32API TileWindows(HWND       hwndParent,
     1183                          UINT       wFlags,
     1184                          const LPRECT lpRect,
     1185                          UINT       cChildrenb,
     1186                          const HWND *ahwndChildren)
     1187{
     1188  dprintf(("USER32:TileWindows (%08xh,%08xh,%08xh,%08xh,%08x) not implemented.\n",
     1189           hwndParent,
     1190           wFlags,
     1191           lpRect,
     1192           cChildrenb,
     1193           ahwndChildren));
     1194
     1195   return (0);
     1196}
     1197
     1198/*****************************************************************************
     1199 * Name      : BOOL WIN32API TileChildWindows
     1200 * Purpose   : Unknown
     1201 * Parameters: Unknown
     1202 * Variables :
     1203 * Result    :
     1204 * Remark    :
     1205 * Status    : UNTESTED UNKNOWN STUB
     1206 *
     1207 * Author    : Patrick Haller [Wed, 1998/06/16 11:55]
     1208 *****************************************************************************/
     1209BOOL WIN32API TileChildWindows(DWORD x1,
     1210                                  DWORD x2)
     1211{
     1212  dprintf(("USER32: TileChildWindows(%08xh,%08xh) not implemented.\n",
     1213           x1,
     1214           x2));
     1215
     1216  return (FALSE); /* default */
     1217}
     1218
    11101219/* -------- Miscellaneous service functions ----------
    11111220 *
  • trunk/src/user32/win32wnd.cpp

    r2084 r2114  
    1 /* $Id: win32wnd.cpp,v 1.3 1999-12-16 00:11:48 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.4 1999-12-18 16:31:52 cbratschi Exp $ */
    22/*
    33 * Win32 Window Class for OS/2
     
    3333#include "syscolor.h"
    3434#include "win32wndhandle.h"
     35#include "mdi.h"
     36#include "win32wmdiclient.h"
    3537
    3638
     
    5052LRESULT Win32Window::DefFrameProcA(HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
    5153{
    52  Win32Window *window = NULL;
     54 Win32MDIClientWindow *window = NULL;
     55 Win32MDIChildWindow *child;
    5356
    5457    if(hwndMDIClient)
    55         window = (Win32Window *)GetWindowFromHandle(hwndMDIClient);
     58        window = (Win32MDIClientWindow*)GetWindowFromHandle(hwndMDIClient);
    5659
    57     if(window)
     60    if (window && window->isMDIClient())
    5861    {
    5962        switch(Msg)
     
    6467
    6568#if 0
     69        case WM_SETTEXT:
     70            //CB: infinite loop
     71            //window->updateFrameText(MDI_REPAINTFRAME,(LPCSTR)lParam);
     72            return 0;
     73#endif
     74
    6675        case WM_COMMAND:
    67             ci = (MDICLIENTINFO*)wndPtr->wExtra;
    68 
    6976            /* check for possible syscommands for maximized MDI child */
    70             WIN_ReleaseWndPtr(wndPtr);
    71 
    72             if( ci && (
    73                 wParam <  ci->idFirstChild ||
    74                 wParam >= ci->idFirstChild + ci->nActiveChildren
    75             )){
     77            if(wParam <  window->getFirstChildId() || wParam >= window->getFirstChildId()+window->getNrOfChildren())
     78            {
    7679                if( (wParam - 0xF000) & 0xF00F ) break;
    7780                switch( wParam )
     
    8588                case SC_CLOSE:
    8689                case SC_RESTORE:
    87                     if( ci->hwndChildMaximized )
    88                     return SendMessage16( ci->hwndChildMaximized, WM_SYSCOMMAND,
    89                            wParam, lParam);
     90                    child = window->getMaximizedChild();
     91                    if (child)
     92                    return ::SendMessageA(child->getWindowHandle(),WM_SYSCOMMAND,wParam,lParam);
    9093                }
    9194            }
    9295            else
    9396            {
    94                 wndPtr = WIN_FindWndPtr(hwndMDIClient);
    95                 childHwnd = MDI_GetChildByID(wndPtr,wParam );
    96                 WIN_ReleaseWndPtr(wndPtr);
    97 
    98                 if( childHwnd )
    99                     SendMessage16(hwndMDIClient, WM_MDIACTIVATE,
    100                                       (WPARAM16)childHwnd , 0L);
     97                child = window->getChildByID(wParam);
     98                if (child)
     99                    ::SendMessageA(window->getWindowHandle(),WM_MDIACTIVATE,(WPARAM)child->getWindowHandle(),0L);
    101100            }
    102101            break;
    103 #endif
    104102
    105103        case WM_SETFOCUS:
  • trunk/src/user32/window.cpp

    r2084 r2114  
    1 /* $Id: window.cpp,v 1.42 1999-12-16 00:11:48 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.43 1999-12-18 16:31:52 cbratschi Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    458458    if(!window) {
    459459        dprintf(("ShowWindow, window %x not found", hwnd));
    460         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     460        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    461461        return 0;
    462462    }
     
    11451145    pDWP = (DWP *) hdwp;
    11461146    if (!pDWP) {
    1147         dprintf(("**EndDeferWindowPos invalid parameter\n"));
     1147        dprintf(("**EndDeferWindowPos invalid parameter\n"));
    11481148        SetLastError(ERROR_INVALID_PARAMETER);
    11491149        return FALSE;
     
    11691169    return ChildWindowFromPointEx(hwnd, pt, 0);
    11701170}
    1171 //******************************************************************************
    1172 //******************************************************************************
    11731171/*****************************************************************************
    11741172 * Name      : HWND WIN32API ChildWindowFromPointEx
    1175  * Purpose   : The GetWindowRect function retrieves the dimensions of the
    1176  *             bounding rectangle of the specified window. The dimensions are
    1177  *             given in screen coordinates that are relative to the upper-left
    1178  *             corner of the screen.
     1173 * Purpose   : pt: client coordinates
    11791174 * Parameters:
    11801175 * Variables :
     
    11861181 * Author    : Rene Pronk [Sun, 1999/08/08 23:30]
    11871182 *****************************************************************************/
    1188 
    11891183HWND WIN32API ChildWindowFromPointEx (HWND hwndParent, POINT pt, UINT uFlags)
    11901184{
    11911185        RECT rect;
    11921186        HWND hWnd;
    1193         POINT absolutePt;
     1187        POINT framePt;
    11941188
    11951189        dprintf(("ChildWindowFromPointEx(%08xh,%08xh,%08xh).\n",
     
    12021196        }
    12031197
    1204         // absolutePt has its top in the upper-left corner of the screen
    1205         absolutePt = pt;
    1206         ClientToScreen (hwndParent, &absolutePt);
    1207 
    1208         // make rect the size of the parent window
    1209         GetWindowRect (hwndParent, &rect);
    1210         rect.right = rect.right - rect.left;
    1211         rect.bottom = rect.bottom - rect.top;
    1212         rect.left = 0;
    1213         rect.top = 0;
    1214 
    1215         if (PtInRect (&rect, pt) == 0) {
     1198        MapWindowPoints(hwndParent,GetParent(hwndParent),&framePt,1);
     1199        if (PtInRect (&rect, framePt) == 0) {
    12161200                // point is outside window
    12171201                return NULL;
    12181202        }
     1203
    12191204
    12201205        // get first child
     
    12381223                // is the point in this window's rect?
    12391224                GetWindowRect (hWnd, &rect);
    1240                 if (PtInRect (&rect, absolutePt) == FALSE) {
     1225                if (PtInRect (&rect,pt) == FALSE) {
    12411226                        hWnd = GetWindow (hWnd, GW_HWNDNEXT);
    12421227                        continue;
     
    12801265
    12811266    hwndOS2 = OSLibWinWindowFromPoint(OSLIB_HWND_DESKTOP, (PVOID)&wPoint);
    1282     if(hwndOS2) {
     1267    if(hwndOS2)
     1268    {
     1269      hwnd = Win32BaseWindow::OS2ToWin32Handle(hwndOS2);
     1270      if (!hwnd)
     1271      {
     1272        //CB: could be a frame control
     1273        hwndOS2 = OSLibWinQueryWindow(hwndOS2,QWOS_PARENT);
    12831274        hwnd = Win32BaseWindow::OS2ToWin32Handle(hwndOS2);
    1284         if(hwnd) {
    1285                 dprintf(("WindowFromPoint (%d,%d) %x->%x\n", point.x, point.y, hwndOS2, hwnd));
    1286                 return hwnd;
    1287         }
     1275      }
     1276      if(hwnd) {
     1277              dprintf(("WindowFromPoint (%d,%d) %x->%x\n", point.x, point.y, hwndOS2, hwnd));
     1278              return hwnd;
     1279      }
    12881280    }
    12891281    dprintf(("WindowFromPoint (%d,%d) %x->1\n", point.x, point.y, hwndOS2));
     
    13031295    }
    13041296    return window->IsWindowUnicode();
    1305 }
    1306 /*****************************************************************************
    1307  * Name      : WORD WIN32API CascadeWindows
    1308  * Purpose   : The CascadeWindows function cascades the specified windows or
    1309  *             the child windows of the specified parent window.
    1310  * Parameters: HWND hwndParent         handle of parent window
    1311  *             UINT wHow               types of windows not to arrange
    1312  *             CONST RECT * lpRect     rectangle to arrange windows in
    1313  *             UINT cKids              number of windows to arrange
    1314  *             const HWND FAR * lpKids array of window handles
    1315  * Variables :
    1316  * Result    : If the function succeeds, the return value is the number of windows arranged.
    1317  *             If the function fails, the return value is zero.
    1318  * Remark    :
    1319  * Status    : UNTESTED STUB
    1320  *
    1321  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
    1322  *****************************************************************************/
    1323 
    1324 WORD WIN32API CascadeWindows(HWND       hwndParent,
    1325                              UINT       wHow,
    1326                              CONST LPRECT lpRect,
    1327                              UINT       cKids,
    1328                              const HWND *lpKids)
    1329 {
    1330   dprintf(("USER32:CascadeWindows(%08xh,%u,%08xh,%u,%08x) not implemented.\n",
    1331          hwndParent,
    1332          wHow,
    1333          lpRect,
    1334          cKids,
    1335          lpKids));
    1336 
    1337   return (0);
    13381297}
    13391298/***********************************************************************
     
    13481307BOOL WIN32API EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam)
    13491308{
    1350   return windowDesktop->EnumThreadWindows(dwThreadId, lpfn, lParam); 
     1309  return windowDesktop->EnumThreadWindows(dwThreadId, lpfn, lParam);
    13511310}
    13521311//******************************************************************************
     
    13761335BOOL WIN32API EnumWindows(WNDENUMPROC lpfn, LPARAM lParam)
    13771336{
    1378   return windowDesktop->EnumWindows(lpfn, lParam); 
     1337  return windowDesktop->EnumWindows(lpfn, lParam);
    13791338}
    13801339//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.