Ignore:
Timestamp:
Jan 15, 2000, 3:18:18 PM (26 years ago)
Author:
cbratschi
Message:

several nc changes

File:
1 edited

Legend:

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

    r2433 r2444  
    1 /* $Id: menu.cpp,v 1.9 2000-01-13 20:11:36 sandervl Exp $*/
     1/* $Id: menu.cpp,v 1.10 2000-01-15 14:18:16 cbratschi Exp $*/
    22/*
    33 * Menu functions
     
    10291029    //debug_print_menuitem("MENU_DrawMenuItem: ", lpitem, "");
    10301030
    1031     if (lpitem->fType & MF_SYSMENU)
    1032     {
    1033         if( !IsIconic(hwnd) )
    1034         {
    1035           Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    1036 
    1037           if (win32wnd) win32wnd->DrawSysButton(hdc,lpitem->fState & (MF_HILITE | MF_MOUSESELECT));
    1038         }
    1039 
    1040         return;
    1041     }
     1031    if (lpitem->fType & MF_SYSMENU) return;
    10421032
    10431033    if (lpitem->fType & MF_OWNERDRAW)
     
    10741064
    10751065    if ((lpitem->fState & MF_HILITE) && !(IS_BITMAP_ITEM(lpitem->fType)))
    1076         if (menuBar)
    1077             DrawEdge(hdc, &rect, BDR_SUNKENOUTER, BF_RECT);
    1078         else
    10791066            FillRect( hdc, &rect, GetSysColorBrush(COLOR_HIGHLIGHT) );
    10801067    else {
     
    13851372    }
    13861373
    1387     FillRect(hDC, lprect, GetSysColorBrush(COLOR_MENU) );
    1388 
    1389     SelectObject( hDC, GetSysColorPen(COLOR_3DFACE));
    1390     MoveToEx( hDC, lprect->left, lprect->bottom,NULL);
    1391     LineTo( hDC, lprect->right, lprect->bottom );
     1374    HDC memDC;
     1375    HBITMAP memBmp,oldBmp;
     1376    RECT r;
     1377    HFONT oldMemFont;
     1378
     1379    memDC = CreateCompatibleDC(hDC);
     1380    r = *lprect;
     1381    r.right -= r.left;
     1382    r.bottom -= r.top;
     1383    r.left = r.top = 0;
     1384    memBmp = CreateCompatibleBitmap(hDC,r.right,r.bottom+1);
     1385    oldBmp = SelectObject(memDC,memBmp);
     1386    oldMemFont = SelectObject(memDC,hMenuFont);
     1387
     1388    FillRect(memDC,&r,GetSysColorBrush(COLOR_MENU));
     1389
     1390    SelectObject(memDC,GetSysColorPen(COLOR_3DFACE));
     1391    MoveToEx(memDC,r.left,r.bottom,NULL);
     1392    LineTo(memDC,r.right,r.bottom);
    13921393
    13931394    if (lppop->nItems == 0)
    13941395    {
    1395         retvalue = GetSystemMetrics(SM_CYMENU);
    1396         goto END;
    1397     }
    1398 
    1399     for (i = 0; i < lppop->nItems; i++)
    1400     {
     1396      retvalue = GetSystemMetrics(SM_CYMENU);
     1397    } else
     1398    {
     1399      for (i = 0; i < lppop->nItems; i++)
     1400      {
     1401        OffsetRect(&lppop->items[i].rect,-lprect->left,-lprect->top);
    14011402        MENU_DrawMenuItem( hwnd,getMenu(hwnd), GetWindow(hwnd,GW_OWNER),
    1402                          hDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
    1403     }
    1404     retvalue = lppop->Height;
     1403                         memDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE );
     1404        OffsetRect(&lppop->items[i].rect,lprect->left,lprect->top);
     1405      }
     1406      retvalue = lppop->Height;
     1407    }
     1408
     1409    BitBlt(hDC,lprect->left,lprect->top,lprect->right-lprect->left,lprect->bottom-lprect->top+1,memDC,0,0,SRCCOPY);
     1410    SelectObject(memDC,oldBmp);
     1411    if (oldMemFont) SelectObject(memDC,oldMemFont);
     1412    DeleteObject(memBmp);
     1413    DeleteDC(memDC);
    14051414
    14061415END:
     
    21032112 * Walks menu chain trying to find a menu pt maps to.
    21042113 */
    2105 static HMENU MENU_PtMenu( HMENU hMenu, POINT pt )
     2114static HMENU MENU_PtMenu(HMENU hMenu,POINT pt,BOOL inMenuBar)
    21062115{
    21072116   POPUPMENU *menu = (POPUPMENU*)hMenu;
     
    21122121          (menu->items[ht].fType & MF_POPUP) &&
    21132122          (menu->items[ht].fState & MF_MOUSESELECT))
    2114         ? (UINT) MENU_PtMenu(menu->items[ht].hSubMenu, pt) : 0;
     2123        ? (UINT) MENU_PtMenu(menu->items[ht].hSubMenu,pt,inMenuBar) : 0;
    21152124
    21162125   if( !ht )    /* check the current window (avoiding WM_HITTEST) */
     
    21262135        else
    21272136        {
    2128             ht = ( ht == HTSYSMENU ) ? (UINT)(getSysMenu(menu->hWnd))
    2129                  : ( ht == HTMENU ) ? (UINT)(getMenu(menu->hWnd)) : 0;
     2137            ht = ((ht == HTSYSMENU) && !inMenuBar) ? (UINT)(getSysMenu(menu->hWnd))
     2138                 : ((ht == HTMENU) && inMenuBar) ? (UINT)(getMenu(menu->hWnd)) : 0;
    21302139        }
    21312140   }
     
    24022411        if( hNewWnd != pmt->hOwnerWnd )
    24032412        {
    2404             ReleaseCapture(); 
     2413            ReleaseCapture();
    24052414            pmt->hOwnerWnd = hNewWnd;
    2406             SetCapture(pmt->hOwnerWnd); //SvL: Don't know if this is good enough
     2415            SetCapture(pmt->hOwnerWnd); //SvL: Don't know if this is good enough
    24072416            //EVENT_Capture( pmt->hOwnerWnd, HTMENU ); //CB: todo
    24082417        }
     
    25682577 * Menu tracking code.
    25692578 */
    2570 static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
    2571                               HWND hwnd, const RECT *lprect )
     2579static INT MENU_TrackMenu(HMENU hmenu,UINT wFlags,INT x,INT y,HWND hwnd,BOOL inMenuBar,const RECT *lprect)
    25722580{
    25732581    MSG msg;
     
    26062614         * clear that menu loop is not over yet. */
    26072615//        if (!GetMessageA(&msg,msg.hwnd,0,0)) break;
    2608         //SvL: Getting messages for only the menu delays background paints (i.e. VPBuddy logo)
     2616        //SvL: Getting messages for only the menu delays background paints (i.e. VPBuddy logo)
    26092617        if (!GetMessageA(&msg,0,0,0)) break;
    26102618        TranslateMessage( &msg );
     
    26192627            /* Find a menu for this mouse event */
    26202628            POINT pt = msg.pt;
    2621             hmenu = MENU_PtMenu( mt.hTopMenu, pt );
     2629
     2630            hmenu = MENU_PtMenu(mt.hTopMenu,pt,inMenuBar);
    26222631
    26232632            switch(msg.message)
     
    28282837void MENU_TrackMouseMenuBar( HWND hWnd, INT ht, POINT pt )
    28292838{
    2830     HMENU hMenu = (ht == HTSYSMENU) ? getSysMenu(hWnd):getMenu(hWnd);
     2839    HMENU hMenu = (ht == 0) ? getMenu(hWnd):getSysMenu(hWnd);
    28312840    UINT wFlags = TPM_ENTERIDLEEX | TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON;
    28322841
     
    28362845    {
    28372846        MENU_InitTracking( hWnd, hMenu, FALSE, wFlags );
    2838         MENU_TrackMenu( hMenu, wFlags, pt.x, pt.y, hWnd, NULL );
     2847        MENU_TrackMenu( hMenu, wFlags, pt.x, pt.y, hWnd,ht == 0, NULL );
    28392848        MENU_ExitTracking(hWnd);
    28402849    }
     
    28952904                PostMessageA( hWnd, WM_KEYDOWN, VK_DOWN, 0L );
    28962905
    2897             MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, hWnd, NULL );
     2906            MENU_TrackMenu( hTrackMenu, wFlags, 0, 0, hWnd,TRUE, NULL );
    28982907        }
    28992908
     
    29242933
    29252934    if (MENU_ShowPopup( hWnd, hMenu, 0, x, y, 0, 0 ))
    2926         ret = MENU_TrackMenu( hMenu, wFlags | TPM_POPUPMENU, 0, 0, hWnd, lpRect );
     2935        ret = MENU_TrackMenu( hMenu, wFlags | TPM_POPUPMENU, 0, 0, hWnd,FALSE, lpRect );
    29272936    MENU_ExitTracking(hWnd);
    29282937
     
    33113320
    33123321    if (IS_STRING_ITEM(flags) && str)
    3313         dprintf(("USER32: InsertMenuA %x %d %x %d %s", hMenu, pos, flags, id, str));
     3322        dprintf(("USER32: InsertMenuA %x %d %x %d %s", hMenu, pos, flags, id, str));
    33143323    //    TRACE("hMenu %04x, pos %d, flags %08x, "
    33153324    //                  "id %04x, str '%s'\n",
    33163325    //                  hMenu, pos, flags, id, str );
    33173326    else // TRACE("hMenu %04x, pos %d, flags %08x, "
    3318         dprintf(("USER32: InsertMenuA %x %d %x %d %x", hMenu, pos, flags, id, str));
     3327        dprintf(("USER32: InsertMenuA %x %d %x %d %x", hMenu, pos, flags, id, str));
    33193328    //                   "id %04x, str %08lx (not a string)\n",
    33203329    //                   hMenu, pos, flags, id, (DWORD)str );
     
    34453454    if (IS_STRING_ITEM(flags))
    34463455    {
    3447         dprintf(("USER32: ModifyMenuA, %x %d %x %d %s", hMenu, pos, flags, id, str));
     3456        dprintf(("USER32: ModifyMenuA, %x %d %x %d %s", hMenu, pos, flags, id, str));
    34483457        //TRACE("%04x %d %04x %04x '%s'\n",
    34493458        //              hMenu, pos, flags, id, str ? str : "#NULL#" );
     
    34523461    else
    34533462    {
    3454         dprintf(("USER32: ModifyMenuA, %x %d %x %d %x", hMenu, pos, flags, id, str));
     3463        dprintf(("USER32: ModifyMenuA, %x %d %x %d %x", hMenu, pos, flags, id, str));
    34553464        //TRACE("%04x %d %04x %04x %08lx\n",
    34563465        //              hMenu, pos, flags, id, (DWORD)str );
Note: See TracChangeset for help on using the changeset viewer.