Changeset 2458 for trunk/src


Ignore:
Timestamp:
Jan 16, 2000, 7:17:13 PM (26 years ago)
Author:
cbratschi
Message:

menu and frame changes

Location:
trunk/src/user32/new
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/menu.cpp

    r2444 r2458  
    1 /* $Id: menu.cpp,v 1.10 2000-01-15 14:18:16 cbratschi Exp $*/
     1/* $Id: menu.cpp,v 1.11 2000-01-16 18:17:10 cbratschi Exp $*/
    22/*
    33 * Menu functions
     
    104104#define TPM_BUTTONDOWN          0x40000000              /* menu was clicked before tracking */
    105105#define TPM_POPUPMENU           0x20000000              /* menu is a popup menu */
     106#define TPM_CAPTIONSYSMENU      0x10000000
    106107
    107108  /* popup menu shade thickness */
     
    20142015 */
    20152016static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
    2016                                   BOOL selectFirst, UINT wFlags )
     2017                                  BOOL selectFirst, UINT wFlags,POINT *pt)
    20172018{
    20182019    RECT rect;
     
    20712072        MENU_InitSysMenuPopup(item->hSubMenu,GetWindowLongA(menu->hWnd,GWL_STYLE), GetClassLongA(menu->hWnd, GCL_STYLE));
    20722073
    2073         if (win32wnd) win32wnd->GetSysPopupPos(&rect);
    2074         rect.top = rect.bottom;
    2075         rect.right = GetSystemMetrics(SM_CXSIZE);
    2076         rect.bottom = GetSystemMetrics(SM_CYSIZE);
     2074        if ((wFlags & TPM_CAPTIONSYSMENU) && pt)
     2075        {
     2076          rect.top = pt->y;
     2077          rect.left = pt->x;
     2078          rect.bottom = rect.right = 0;
     2079        } else
     2080        {
     2081          if (win32wnd) win32wnd->GetSysPopupPos(&rect);
     2082          rect.top = rect.bottom;
     2083          rect.right = GetSystemMetrics(SM_CXSIZE);
     2084          rect.bottom = GetSystemMetrics(SM_CYSIZE);
     2085        }
    20772086    }
    20782087    else
     
    21852194    }
    21862195    else
    2187         pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hMenu, TRUE, wFlags);
     2196        pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hMenu, TRUE, wFlags,&pmt->pt);
    21882197
    21892198    return -1;
     
    22432252            if(!(item->fState & MF_MOUSESELECT ))
    22442253            {
    2245                 pmt->hCurrentMenu = MENU_ShowSubPopup( pmt->hOwnerWnd, hPtMenu, FALSE, wFlags );
     2254                pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd,hPtMenu,FALSE,wFlags,&pmt->pt);
    22462255            }
    22472256
     
    23212330    {
    23222331            MENU_SwitchTracking( pmt, hPtMenu, id );
    2323             pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hPtMenu, FALSE, wFlags);
     2332            pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hPtMenu, FALSE, wFlags,&pmt->pt);
    23242333    }
    23252334    return TRUE;
     
    25102519            if( !MENU_SuspendPopup( pmt, WM_KEYDOWN ) )
    25112520                pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd,
    2512                                                 pmt->hTopMenu, TRUE, wFlags);
     2521                                                pmt->hTopMenu, TRUE, wFlags,&pmt->pt);
    25132522        }
    25142523    }
     
    25382547
    25392548        hmenutmp = pmt->hCurrentMenu;
    2540         pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hmenutmp, TRUE, wFlags);
     2549        pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hmenutmp, TRUE, wFlags,&pmt->pt);
    25412550
    25422551        /* if subpopup was displayed then we are done */
     
    25682577            if( !MENU_SuspendPopup(pmt, WM_KEYDOWN) )
    25692578                pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd,
    2570                                                        pmt->hTopMenu, TRUE, wFlags);
     2579                                                       pmt->hTopMenu, TRUE, wFlags,&pmt->pt);
    25712580    }
    25722581}
     
    26972706                    menu = (POPUPMENU*)mt.hCurrentMenu;
    26982707                    if (!(menu->wFlags & MF_POPUP))
    2699                         mt.hCurrentMenu = MENU_ShowSubPopup(mt.hOwnerWnd, mt.hTopMenu, TRUE, wFlags);
     2708                        mt.hCurrentMenu = MENU_ShowSubPopup(mt.hOwnerWnd, mt.hTopMenu, TRUE, wFlags,&mt.pt);
    27002709                    else      /* otherwise try to move selection */
    27012710                        MENU_MoveSelection( mt.hOwnerWnd, mt.hCurrentMenu, ITEM_NEXT );
     
    28442853    if (IsMenu(hMenu))
    28452854    {
     2855        if (ht == HTCAPTION) wFlags |= TPM_CAPTIONSYSMENU;
     2856        if (IsIconic(hWnd)) wFlags |= TPM_BOTTOMALIGN; //CB: todo: for minimized windows
     2857
    28462858        MENU_InitTracking( hWnd, hMenu, FALSE, wFlags );
    28472859        MENU_TrackMenu( hMenu, wFlags, pt.x, pt.y, hWnd,ht == 0, NULL );
  • trunk/src/user32/new/oslibwin.cpp

    r2444 r2458  
    1 /* $Id: oslibwin.cpp,v 1.38 2000-01-15 14:18:16 cbratschi Exp $ */
     1/* $Id: oslibwin.cpp,v 1.39 2000-01-16 18:17:11 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    996996void OSLibWinShowTaskList(HWND hwndFrame)
    997997{
    998   WinPostMsg(NULLHANDLE, WM_SYSCOMMAND, (MPARAM)SC_TASKMANAGER, MPFROM2SHORT(CMDSRC_MENU, TRUE));
    999 }
    1000 //******************************************************************************
    1001 //******************************************************************************
     998  //CB: don't know if this works on all machines
     999  WinSetActiveWindow(HWND_DESKTOP,0x8000000E);
     1000}
     1001//******************************************************************************
     1002//******************************************************************************
  • trunk/src/user32/new/pmframe.cpp

    r2435 r2458  
    1 /* $Id: pmframe.cpp,v 1.17 2000-01-14 13:16:57 sandervl Exp $ */
     1/* $Id: pmframe.cpp,v 1.18 2000-01-16 18:17:11 cbratschi Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    118118      {
    119119        win32wnd->setStyle((win32wnd->getStyle() & ~WS_MINIMIZE_W) | WS_MAXIMIZE_W);
     120
     121        RECT rect;
     122
     123        rect.left = rect.top = rect.right = rect.bottom = 0;
     124        win32wnd->AdjustMaximizedRect(&rect);
     125        swp->x += rect.left;
     126        swp->cx += rect.right-rect.left;
     127        swp->y -= rect.bottom;
     128        swp->cy += rect.bottom-rect.top;
    120129      }
    121130      else if ((swp->fl & SWP_MINIMIZE) == SWP_MINIMIZE)
     
    131140
    132141    case WM_QUERYBORDERSIZE:
    133       goto RunDefFrameProc;
     142    {
     143      PWPOINT size = (PWPOINT)mp1;
     144
     145      size->x = 0;
     146      size->y = 0;
     147      RestoreOS2TIB();
     148      return (MRESULT)TRUE;
     149    }
    134150
    135151    case WM_BUTTON1DOWN:
     
    212228        if(!win32wnd->CanReceiveSizeMsgs())
    213229           break;
    214 //CB: todo: adjust maximized window rect (how does WINE it?)
     230
    215231        WinQueryWindowPos(hwnd, &swpOld);
    216232        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
     
    263279        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0)
    264280        {
    265                 goto RunDefFrameProc;
     281                goto RunDefFrameProc;
    266282        }
    267283
     
    276292        OSLibMapSWPtoWINDOWPOSFrame(pswp, &wp, &swpOld, hParent, hwnd);
    277293
    278         if(pswp->fl & SWP_ACTIVATE)
    279         {
     294        if(pswp->fl & SWP_ACTIVATE)
     295        {
    280296             WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd);
    281         }
    282 
    283         if(pswp->fl & (SWP_MOVE | SWP_SIZE))
    284         {
    285           //Note: Also updates the new window rectangle
     297        }
     298
     299        if((pswp->fl & (SWP_MOVE | SWP_SIZE)) && !(win32wnd->getStyle() & WS_MINIMIZE_W))
     300        {
     301          //Note: Also updates the new window rectangle
    286302          win32wnd->MsgFormatFrame(&wp);
    287303
     
    325341            {
    326342              WinInvalidateRect(hwnd,NULL,TRUE);
    327             } 
     343            }
    328344            else
    329345            {
     
    360376            }
    361377          }
    362         } 
     378        }
    363379        else
    364380        {
     
    378394
    379395    case WM_ERASEBACKGROUND:
    380         break;
     396        break;
    381397
    382398    case WM_CALCVALIDRECTS:
     
    453469  SWP swpClient = {0};
    454470
    455         rectOld = *win32wnd->getClientRectPtr();
     471        rectOld = *win32wnd->getClientRectPtr();
    456472        win32wnd->MsgFormatFrame(NULL);
    457473        rectNew = *win32wnd->getClientRectPtr();
    458474        if(WinEqualRect(0, (PRECTL)&rectOld, (PRECTL)&rectNew) == 1) {
    459                 WinInvalidateRect(win32wnd->getOS2FrameWindowHandle(), NULL, FALSE);
    460                 return;
    461         }
     475                WinInvalidateRect(win32wnd->getOS2FrameWindowHandle(), NULL, FALSE);
     476                return;
     477        }
    462478        //CB: todo: use result for WM_CALCVALIDRECTS
    463479        mapWin32ToOS2Rect(win32wnd->getOS2FrameWindowHandle(), win32wnd->getClientRectPtr(), (PRECTLOS2)&rect);
  • trunk/src/user32/new/scroll.cpp

    r2433 r2458  
    1 /* $Id: scroll.cpp,v 1.11 2000-01-13 20:11:37 sandervl Exp $ */
     1/* $Id: scroll.cpp,v 1.12 2000-01-16 18:17:11 cbratschi Exp $ */
    22/*
    33 * Scrollbar control
     
    7373static BOOL SCROLL_MovingThumb = FALSE;
    7474
    75 // Get the infoPtr: works only with scrollbar handles
    76 
    7775static SCROLLBAR_INFO *SCROLL_GetInfoPtr( HWND hwnd, INT nBar )
    7876{
    7977    Win32BaseWindow *win32wnd;
    80     HWND hwndFrame;
    8178
    8279    switch(nBar)
  • trunk/src/user32/new/win32wbase.cpp

    r2444 r2458  
    1 /* $Id: win32wbase.cpp,v 1.43 2000-01-15 14:18:17 cbratschi Exp $ */
     1/* $Id: win32wbase.cpp,v 1.44 2000-01-16 18:17:12 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    11231123      {
    11241124        horzScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
     1125        if (!horzScrollInfo) break;
    11251126        horzScrollInfo->MinVal = horzScrollInfo->CurVal = horzScrollInfo->Page = 0;
    11261127        horzScrollInfo->MaxVal = 100;
     
    11331134      {
    11341135        vertScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
     1136        if (!vertScrollInfo) break;
    11351137        vertScrollInfo->MinVal = vertScrollInfo->CurVal = vertScrollInfo->Page = 0;
    11361138        vertScrollInfo->MaxVal = 100;
     
    14061408                point.x = rectClient.left;
    14071409                point.y = rectClient.top;
    1408                 MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), &point, 1);
     1410                ClientToScreen(getParent()->getWindowHandle(),&point);
    14091411
    14101412                lParam = MAKELONG(point.x, point.y);
    14111413            }
    14121414            else {//in screen coordinates
    1413                 lParam = MAKELONG(rectWindow.left+rectClient.left, rectWindow.top+rectClient.top);
     1415                lParam = MAKELONG(rectClient.left,rectClient.top);
    14141416            }
    14151417            SendInternalMessageA(WM_MOVE, 0, lParam);
  • trunk/src/user32/new/win32wbase.h

    r2444 r2458  
    1 /* $Id: win32wbase.h,v 1.30 2000-01-15 14:18:18 cbratschi Exp $ */
     1/* $Id: win32wbase.h,v 1.31 2000-01-16 18:17:12 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    428428         fakeOpen32WinBaseClass fakeWinBase;
    429429
     430         VOID  AdjustMaximizedRect(LPRECT rect);
     431
    430432         BOOL   isOwnDC() { return (windowClass && windowClass->getStyle() & CS_OWNDC_W); }
    431433         HDC    getOwnDC() { return ownDC; }
  • trunk/src/user32/new/win32wbasenonclient.cpp

    r2452 r2458  
    1 /* $Id: win32wbasenonclient.cpp,v 1.12 2000-01-15 17:27:20 sandervl Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.13 2000-01-16 18:17:13 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    317317//******************************************************************************
    318318//******************************************************************************
    319 VOID Win32BaseWindow::AdjustRectOuter(LPRECT rect,BOOL menu)
    320 {
    321   if(dwStyle & WS_ICONIC) return;
    322 
     319VOID Win32BaseWindow::AdjustMaximizedRect(LPRECT rect)
     320{
    323321  /* Decide if the window will be managed (see CreateWindowEx) */
    324322  //if (!WindowNeedsWMBorder()) //CB: check Options.managed
     
    332330        if (HAS_THINFRAME( dwStyle ))
    333331          InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
     332  }
     333}
     334//******************************************************************************
     335//******************************************************************************
     336VOID Win32BaseWindow::AdjustRectOuter(LPRECT rect,BOOL menu)
     337{
     338  if(dwStyle & WS_ICONIC) return;
     339
     340  /* Decide if the window will be managed (see CreateWindowEx) */
     341  //if (!WindowNeedsWMBorder()) //CB: check Options.managed
     342  {
     343    if (HAS_THICKFRAME(dwStyle,dwExStyle ))
     344      InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) );
     345    else
     346      if (HAS_DLGFRAME( dwStyle, dwExStyle ))
     347        InflateRect(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) );
     348      else
     349        if (HAS_THINFRAME( dwStyle ))
     350          InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
    334351
    335352    if ((dwStyle & WS_CAPTION) == WS_CAPTION)
     
    367384  LONG result = 0;
    368385  UINT style;
     386
     387    dprintf(("Default WM_NCCALCSIZE handler"));
    369388
    370389    if (!calcValidRects) return 0;
     
    408427  RECT rect = rectWindow;
    409428
     429  if (dwStyle & WS_MINIMIZE) return HTCAPTION;
     430
    410431  if (!PtInRect(&rect,pt)) return HTNOWHERE;
    411 
    412   if (dwStyle & WS_MINIMIZE) return HTCAPTION;
    413432
    414433  if (!(flags & WIN_MANAGED))
     
    11971216LONG Win32BaseWindow::HandleNCRButtonUp(WPARAM wParam,LPARAM lParam)
    11981217{
    1199   if (wParam == HTCAPTION)
    1200   {
    1201     if (GetActiveWindow() != Win32Hwnd)
     1218  switch(wParam)
     1219  {
     1220    case HTCAPTION:
     1221      if (GetActiveWindow() != Win32Hwnd)
    12021222        SetActiveWindow();
    12031223
    1204     if ((GetActiveWindow() == Win32Hwnd) && (dwStyle & WS_SYSMENU))
    1205     {
    1206       SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTCAPTION,lParam);
    1207     }
     1224      if ((GetActiveWindow() == Win32Hwnd) && (dwStyle & WS_SYSMENU))
     1225      {
     1226        SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTCAPTION,lParam);
     1227      }
     1228      break;
     1229
     1230    default:
     1231      break;
    12081232  }
    12091233
     
    12251249    case SC_SIZE:
    12261250    {
    1227       DWORD flags = 0;
     1251      DWORD flags;
     1252
     1253      if (dwStyle & WS_MAXIMIZE) break;
    12281254
    12291255      switch ((wParam & 0xF)+2)
     
    12601286          flags = TFOS_BOTTOM | TFOS_RIGHT;
    12611287          break;
     1288
     1289        default:
     1290          flags = TFOS_BOTTOM | TFOS_RIGHT;
     1291          break;
    12621292      }
    12631293      if (flags) FrameTrackFrame(this,flags);
     
    12661296
    12671297    case SC_MOVE:
     1298        if (dwStyle & WS_MAXIMIZE) break;
    12681299        FrameTrackFrame(this,TFOS_MOVE);
    12691300        break;
Note: See TracChangeset for help on using the changeset viewer.