Changeset 9599 for trunk/src


Ignore:
Timestamp:
Jan 3, 2003, 5:56:03 PM (23 years ago)
Author:
sandervl
Message:

menu update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/menu.c

    r9598 r9599  
    12071207        dis.itemState = 0;
    12081208        if (lpitem->fState & MF_CHECKED) dis.itemState |= ODS_CHECKED;
    1209         if (lpitem->fState & MF_GRAYED)  dis.itemState |= ODS_GRAYED;
     1209        if (lpitem->fState & MF_GRAYED)  dis.itemState |= ODS_GRAYED|ODS_DISABLED;
    12101210        if (lpitem->fState & MF_HILITE)  dis.itemState |= ODS_SELECTED;
    12111211        dis.itemAction = odaction; /* ODA_DRAWENTIRE | ODA_SELECT | ODA_FOCUS; */
     
    19721972            res += sizeof(WORD);
    19731973        }
    1974         if (!IS_STRING_ITEM(flags))
    1975             ERR("not a string item %04x\n", flags );
    19761974        str = res;
    19771975        if (!unicode) res += strlen(str) + 1;
     
    20382036                DestroyMenu(mii.hSubMenu);
    20392037                return NULL;
    2040         }
     2038            }
    20412039            mii.fMask |= MIIM_SUBMENU;
    20422040            mii.fType |= MF_POPUP;
    20432041        }
     2042        else if(!*mii.dwTypeData && !(mii.fType & MF_SEPARATOR))
     2043        {
     2044            WARN("Converting NULL menu item %04x, type %04x to SEPARATOR\n",
     2045                mii.wID, mii.fType);
     2046            mii.fType |= MF_SEPARATOR;
     2047        }
    20442048        InsertMenuItemW(hMenu, -1, MF_BYPOSITION, &mii);
    20452049    } while (!(resinfo & MF_END));
     
    28232827        {
    28242828            /*
    2825              * use the mouse coordinates in lParam instead of those in the MSG
    2826              * struct to properly handle synthetic messages. lParam coords are
    2827              * relative to client area, so they must be converted; since they can
    2828              * be negative, we must use SLOWORD/SHIWORD instead of LOWORD/HIWORD.
     2829             * Use the mouse coordinates in lParam instead of those in the MSG
     2830             * struct to properly handle synthetic messages. They are already
     2831             * in screen coordinates.
    28292832             */
    28302833            mt.pt.x = SLOWORD(msg.lParam);
    28312834            mt.pt.y = SHIWORD(msg.lParam);
    2832             ClientToScreen(msg.hwnd,&mt.pt);
    28332835
    28342836            /* Find a menu for this mouse event */
     
    33333335
    33343336/*******************************************************************
    3335  *         ChangeMenu    (USER.153)
    3336  */
    3337 BOOL16 WINAPI ChangeMenu16( HMENU16 hMenu, UINT16 pos, SEGPTR data,
    3338                             UINT16 id, UINT16 flags )
    3339 {
    3340     TRACE("menu=%04x pos=%d data=%08lx id=%04x flags=%04x\n",
    3341                   hMenu, pos, (DWORD)data, id, flags );
    3342     if (flags & MF_APPEND) return AppendMenu16( hMenu, flags & ~MF_APPEND,
    3343                                                 id, data );
    3344 
    3345     /* FIXME: Word passes the item id in 'pos' and 0 or 0xffff as id */
    3346     /* for MF_DELETE. We should check the parameters for all others */
    3347     /* MF_* actions also (anybody got a doc on ChangeMenu?). */
    3348 
    3349     if (flags & MF_DELETE) return DeleteMenu16(hMenu, pos, flags & ~MF_DELETE);
    3350     if (flags & MF_CHANGE) return ModifyMenu16(hMenu, pos, flags & ~MF_CHANGE,
    3351                                                id, data );
    3352     if (flags & MF_REMOVE) return RemoveMenu16(hMenu,
    3353                                               flags & MF_BYPOSITION ? pos : id,
    3354                                               flags & ~MF_REMOVE );
    3355     /* Default: MF_INSERT */
    3356     return InsertMenu16( hMenu, pos, flags, id, data );
    3357 }
    3358 
    3359 
    3360 /*******************************************************************
    33613337 *         ChangeMenuA    (USER32.@)
    33623338 */
     
    34013377
    34023378/*******************************************************************
    3403  *         CheckMenuItem    (USER.154)
    3404  */
    3405 BOOL16 WINAPI CheckMenuItem16( HMENU16 hMenu, UINT16 id, UINT16 flags )
    3406 {
    3407     return (BOOL16)CheckMenuItem( hMenu, id, flags );
    3408 }
    3409 
    3410 
    3411 /*******************************************************************
    34123379 *         CheckMenuItem    (USER32.@)
    34133380 */
     
    34233390    else item->fState &= ~MF_CHECKED;
    34243391    return ret;
    3425 }
    3426 
    3427 
    3428 /**********************************************************************
    3429  *         EnableMenuItem    (USER.155)
    3430  */
    3431 UINT16 WINAPI EnableMenuItem16( HMENU16 hMenu, UINT16 wItemID, UINT16 wFlags )
    3432 {
    3433     return EnableMenuItem( hMenu, wItemID, wFlags );
    34343392}
    34353393
     
    34763434
    34773435    return oldflags;
    3478 }
    3479 
    3480 
    3481 /*******************************************************************
    3482  *         GetMenuString    (USER.161)
    3483  */
    3484 INT16 WINAPI GetMenuString16( HMENU16 hMenu, UINT16 wItemID,
    3485                               LPSTR str, INT16 nMaxSiz, UINT16 wFlags )
    3486 {
    3487     return GetMenuStringA( hMenu, wItemID, str, nMaxSiz, wFlags );
    34883436}
    34893437
     
    35523500
    35533501/**********************************************************************
    3554  *         GetMenuState    (USER.250)
    3555  */
    3556 UINT16 WINAPI GetMenuState16( HMENU16 hMenu, UINT16 wItemID, UINT16 wFlags )
    3557 {
    3558     return GetMenuState( hMenu, wItemID, wFlags );
    3559 }
    3560 
    3561 
    3562 /**********************************************************************
    35633502 *         GetMenuState    (USER32.@)
    35643503 */
     
    35873526
    35883527/**********************************************************************
    3589  *         GetMenuItemCount    (USER.263)
    3590  */
    3591 INT16 WINAPI GetMenuItemCount16( HMENU16 hMenu )
     3528 *         GetMenuItemCount    (USER32.@)
     3529 */
     3530INT WINAPI GetMenuItemCount( HMENU hMenu )
    35923531{
    35933532    LPPOPUPMENU menu = MENU_GetMenu(hMenu);
     
    35983537}
    35993538
    3600 
    3601 /**********************************************************************
    3602  *         GetMenuItemCount    (USER32.@)
    3603  */
    3604 INT WINAPI GetMenuItemCount( HMENU hMenu )
    3605 {
    3606     LPPOPUPMENU menu = MENU_GetMenu(hMenu);
    3607     if (!menu) return -1;
    3608     TRACE("(%04x) returning %d\n",
    3609                   hMenu, menu->nItems );
    3610     return menu->nItems;
    3611 }
    3612 
    36133539/**********************************************************************
    36143540 *         GetMenuItemID    (USER.264)
     
    36303556    return lpmi->wID;
    36313557
    3632 }
    3633 
    3634 /*******************************************************************
    3635  *         InsertMenu    (USER.410)
    3636  */
    3637 BOOL16 WINAPI InsertMenu16( HMENU16 hMenu, UINT16 pos, UINT16 flags,
    3638                             UINT16 id, SEGPTR data )
    3639 {
    3640     UINT pos32 = (UINT)pos;
    3641     if ((pos == (UINT16)-1) && (flags & MF_BYPOSITION)) pos32 = (UINT)-1;
    3642     if (IS_STRING_ITEM(flags) && data)
    3643         return InsertMenuA( hMenu, pos32, flags, id, MapSL(data) );
    3644     return InsertMenuA( hMenu, pos32, flags, id, (LPSTR)data );
    36453558}
    36463559
     
    37033616
    37043617/*******************************************************************
    3705  *         AppendMenu    (USER.411)
    3706  */
    3707 BOOL16 WINAPI AppendMenu16(HMENU16 hMenu, UINT16 flags, UINT16 id, SEGPTR data)
    3708 {
    3709     return InsertMenu16( hMenu, -1, flags | MF_BYPOSITION, id, data );
    3710 }
    3711 
    3712 
    3713 /*******************************************************************
    37143618 *         AppendMenuA    (USER32.@)
    37153619 */
     
    37283632{
    37293633    return InsertMenuW( hMenu, -1, flags | MF_BYPOSITION, id, data );
    3730 }
    3731 
    3732 
    3733 /**********************************************************************
    3734  *         RemoveMenu   (USER.412)
    3735  */
    3736 BOOL16 WINAPI RemoveMenu16( HMENU16 hMenu, UINT16 nPos, UINT16 wFlags )
    3737 {
    3738     return RemoveMenu( hMenu, nPos, wFlags );
    37393634}
    37403635
     
    37733668    }
    37743669    return TRUE;
    3775 }
    3776 
    3777 
    3778 /**********************************************************************
    3779  *         DeleteMenu    (USER.413)
    3780  */
    3781 BOOL16 WINAPI DeleteMenu16( HMENU16 hMenu, UINT16 nPos, UINT16 wFlags )
    3782 {
    3783     return DeleteMenu( hMenu, nPos, wFlags );
    37843670}
    37853671
     
    37963682    RemoveMenu( hMenu, nPos, wFlags | MF_BYPOSITION );
    37973683    return TRUE;
    3798 }
    3799 
    3800 
    3801 /*******************************************************************
    3802  *         ModifyMenu    (USER.414)
    3803  */
    3804 BOOL16 WINAPI ModifyMenu16( HMENU16 hMenu, UINT16 pos, UINT16 flags,
    3805                             UINT16 id, SEGPTR data )
    3806 {
    3807     if (IS_STRING_ITEM(flags))
    3808         return ModifyMenuA( hMenu, pos, flags, id, MapSL(data) );
    3809     return ModifyMenuA( hMenu, pos, flags, id, (LPSTR)data );
    38103684}
    38113685
     
    38613735
    38623736/**********************************************************************
    3863  *         CreatePopupMenu    (USER.415)
    3864  */
    3865 HMENU16 WINAPI CreatePopupMenu16(void)
    3866 {
    3867     return CreatePopupMenu();
    3868 }
    3869 
    3870 
    3871 /**********************************************************************
    38723737 *         CreatePopupMenu    (USER32.@)
    38733738 */
     
    38963761
    38973762/**********************************************************************
    3898  *         SetMenuItemBitmaps    (USER.418)
    3899  */
    3900 BOOL16 WINAPI SetMenuItemBitmaps16( HMENU16 hMenu, UINT16 nPos, UINT16 wFlags,
    3901                                     HBITMAP16 hNewUnCheck, HBITMAP16 hNewCheck)
    3902 {
    3903     return SetMenuItemBitmaps( hMenu, nPos, wFlags, hNewUnCheck, hNewCheck );
    3904 }
    3905 
    3906 
    3907 /**********************************************************************
    39083763 *         SetMenuItemBitmaps    (USER32.@)
    39093764 */
     
    39273782    }
    39283783    return TRUE;
    3929 }
    3930 
    3931 
    3932 /**********************************************************************
    3933  *         CreateMenu    (USER.151)
    3934  */
    3935 HMENU16 WINAPI CreateMenu16(void)
    3936 {
    3937     return CreateMenu();
    39383784}
    39393785
     
    39623808
    39633809    return hMenu;
    3964 }
    3965 
    3966 
    3967 /**********************************************************************
    3968  *         DestroyMenu    (USER.152)
    3969  */
    3970 BOOL16 WINAPI DestroyMenu16( HMENU16 hMenu )
    3971 {
    3972     return DestroyMenu( hMenu );
    39733810}
    39743811
     
    42094046}
    42104047
    4211 
    4212 
    4213 /**********************************************************************
    4214  *         GetSubMenu    (USER.159)
    4215  */
    4216 HMENU16 WINAPI GetSubMenu16( HMENU16 hMenu, INT16 nPos )
    4217 {
    4218     return GetSubMenu( hMenu, nPos );
    4219 }
    42204048
    42214049
     
    44404268
    44414269/**********************************************************************
    4442  *              IsMenu    (USER.358)
    4443  */
    4444 BOOL16 WINAPI IsMenu16( HMENU16 hmenu )
    4445 {
    4446     return IsMenu( hmenu );
    4447 }
    4448 
    4449 
    4450 /**********************************************************************
    44514270 *              IsMenu    (USER32.@)
    44524271 */
     
    47904609}
    47914610
    4792 /*******************************************************************
    4793  *              InsertMenuItem   (USER.441)
    4794  *
    4795  * FIXME: untested
    4796  */
    4797 BOOL16 WINAPI InsertMenuItem16( HMENU16 hmenu, UINT16 pos, BOOL16 byposition,
    4798                                 const MENUITEMINFO16 *mii )
    4799 {
    4800     MENUITEMINFOA miia;
    4801 
    4802     miia.cbSize        = sizeof(miia);
    4803     miia.fMask         = mii->fMask;
    4804     miia.dwTypeData    = (LPSTR)mii->dwTypeData;
    4805     miia.fType         = mii->fType;
    4806     miia.fState        = mii->fState;
    4807     miia.wID           = mii->wID;
    4808     miia.hSubMenu      = mii->hSubMenu;
    4809     miia.hbmpChecked   = mii->hbmpChecked;
    4810     miia.hbmpUnchecked = mii->hbmpUnchecked;
    4811     miia.dwItemData    = mii->dwItemData;
    4812     miia.cch           = mii->cch;
    4813     if (IS_STRING_ITEM(miia.fType))
    4814         miia.dwTypeData = MapSL(mii->dwTypeData);
    4815     return InsertMenuItemA( hmenu, pos, byposition, &miia );
    4816 }
    4817 
    48184611
    48194612/**********************************************************************
     
    48784671
    48794672/**********************************************************************
    4880  *              CheckMenuRadioItem (USER.666)
    4881  */
    4882 BOOL16 WINAPI CheckMenuRadioItem16(HMENU16 hMenu,
    4883                                    UINT16 first, UINT16 last, UINT16 check,
    4884                                    BOOL16 bypos)
    4885 {
    4886      return CheckMenuRadioItem (hMenu, first, last, check, bypos);
    4887 }
    4888 
    4889 /**********************************************************************
    48904673 *              GetMenuItemRect    (USER32.@)
    48914674 *
     
    50014784
    50024785/**********************************************************************
    5003  *         SetMenuContextHelpId    (USER.384)
    5004  */
    5005 BOOL16 WINAPI SetMenuContextHelpId16( HMENU16 hMenu, DWORD dwContextHelpID)
    5006 {
    5007         return SetMenuContextHelpId( hMenu, dwContextHelpID );
    5008 }
    5009 
    5010 
    5011 /**********************************************************************
    50124786 *         SetMenuContextHelpId    (USER32.@)
    50134787 */
     
    50244798    }
    50254799    return FALSE;
    5026 }
    5027 
    5028 /**********************************************************************
    5029  *         GetMenuContextHelpId    (USER.385)
    5030  */
    5031 DWORD WINAPI GetMenuContextHelpId16( HMENU16 hMenu )
    5032 {
    5033         return GetMenuContextHelpId( hMenu );
    50344800}
    50354801
Note: See TracChangeset for help on using the changeset viewer.