mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
some work on menus
svn path=/trunk/; revision=5701
This commit is contained in:
parent
33a53f0e47
commit
545e6f33fb
3 changed files with 93 additions and 50 deletions
|
@ -4330,6 +4330,9 @@ extern "C" {
|
||||||
#define MIIM_STATE (1)
|
#define MIIM_STATE (1)
|
||||||
#define MIIM_SUBMENU (4)
|
#define MIIM_SUBMENU (4)
|
||||||
#define MIIM_TYPE (16)
|
#define MIIM_TYPE (16)
|
||||||
|
#define MIIM_STRING (0x40)
|
||||||
|
#define MIIM_BITMAP (0x80)
|
||||||
|
#define MIIM_FTYPE (0x100)
|
||||||
#define MFT_BITMAP (0x4L)
|
#define MFT_BITMAP (0x4L)
|
||||||
#define MFT_MENUBARBREAK (0x20L)
|
#define MFT_MENUBARBREAK (0x20L)
|
||||||
#define MFT_MENUBREAK (0x40L)
|
#define MFT_MENUBREAK (0x40L)
|
||||||
|
|
|
@ -14,10 +14,6 @@
|
||||||
#define MF_END (0x0080)
|
#define MF_END (0x0080)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MIIM_STRING
|
|
||||||
#define MIIM_STRING (0x00000040)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct _MENU_ITEM
|
typedef struct _MENU_ITEM
|
||||||
{
|
{
|
||||||
struct _MENU_ITEM *Next;
|
struct _MENU_ITEM *Next;
|
||||||
|
@ -83,6 +79,9 @@ int FASTCALL
|
||||||
IntGetMenuItemByFlag(PMENU_OBJECT MenuObject, UINT uSearchBy, UINT fFlag,
|
IntGetMenuItemByFlag(PMENU_OBJECT MenuObject, UINT uSearchBy, UINT fFlag,
|
||||||
PMENU_ITEM *MenuItem, PMENU_ITEM *PrevMenuItem);
|
PMENU_ITEM *MenuItem, PMENU_ITEM *PrevMenuItem);
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
IntGetMenuItemInfo(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, LPMENUITEMINFOW lpmii);
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntSetMenuItemInfo(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, LPCMENUITEMINFOW lpmii);
|
IntSetMenuItemInfo(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, LPCMENUITEMINFOW lpmii);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: menu.c,v 1.20 2003/08/20 13:02:32 weiden Exp $
|
/* $Id: menu.c,v 1.21 2003/08/20 14:01:16 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -48,16 +48,6 @@
|
||||||
#define MAX_MENU_ITEMS (0x4000)
|
#define MAX_MENU_ITEMS (0x4000)
|
||||||
#define MAX_GOINTOSUBMENU (0x10)
|
#define MAX_GOINTOSUBMENU (0x10)
|
||||||
|
|
||||||
#ifndef MIIM_STRING
|
|
||||||
#define MIIM_STRING (0x00000040)
|
|
||||||
#endif
|
|
||||||
#ifndef MIIM_BITMAP
|
|
||||||
#define MIIM_BITMAP (0x00000080)
|
|
||||||
#endif
|
|
||||||
#ifndef MIIM_FTYPE
|
|
||||||
#define MIIM_FTYPE (0x00000100)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define UpdateMenuItemState(state, change) \
|
#define UpdateMenuItemState(state, change) \
|
||||||
{\
|
{\
|
||||||
if((change) & MFS_DISABLED) { \
|
if((change) & MFS_DISABLED) { \
|
||||||
|
@ -294,23 +284,15 @@ IntCreateMenu(PHANDLE Handle)
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntSetMenuFlagRtoL(PMENU_OBJECT MenuObject)
|
IntSetMenuFlagRtoL(PMENU_OBJECT MenuObject)
|
||||||
{
|
{
|
||||||
if(MenuObject)
|
MenuObject->RtoL = TRUE;
|
||||||
{
|
return TRUE;
|
||||||
MenuObject->RtoL = TRUE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntSetMenuContextHelpId(PMENU_OBJECT MenuObject, DWORD dwContextHelpId)
|
IntSetMenuContextHelpId(PMENU_OBJECT MenuObject, DWORD dwContextHelpId)
|
||||||
{
|
{
|
||||||
if(MenuObject)
|
MenuObject->MenuInfo.dwContextHelpID = dwContextHelpId;
|
||||||
{
|
return TRUE;
|
||||||
MenuObject->MenuInfo.dwContextHelpID = dwContextHelpId;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
|
@ -336,25 +318,21 @@ IntGetMenuInfo(PMENU_OBJECT MenuObject, LPMENUINFO lpmi)
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntSetMenuInfo(PMENU_OBJECT MenuObject, LPMENUINFO lpmi)
|
IntSetMenuInfo(PMENU_OBJECT MenuObject, LPMENUINFO lpmi)
|
||||||
{
|
{
|
||||||
if(MenuObject)
|
if(lpmi->fMask & MIM_BACKGROUND)
|
||||||
|
MenuObject->MenuInfo.hbrBack = lpmi->hbrBack;
|
||||||
|
if(lpmi->fMask & MIM_HELPID)
|
||||||
|
MenuObject->MenuInfo.dwContextHelpID = lpmi->dwContextHelpID;
|
||||||
|
if(lpmi->fMask & MIM_MAXHEIGHT)
|
||||||
|
MenuObject->MenuInfo.cyMax = lpmi->cyMax;
|
||||||
|
if(lpmi->fMask & MIM_MENUDATA)
|
||||||
|
MenuObject->MenuInfo.dwMenuData = lpmi->dwMenuData;
|
||||||
|
if(lpmi->fMask & MIM_STYLE)
|
||||||
|
MenuObject->MenuInfo.dwStyle = lpmi->dwStyle;
|
||||||
|
if(lpmi->fMask & MIM_APPLYTOSUBMENUS)
|
||||||
{
|
{
|
||||||
if(lpmi->fMask & MIM_BACKGROUND)
|
/* FIXME */
|
||||||
MenuObject->MenuInfo.hbrBack = lpmi->hbrBack;
|
|
||||||
if(lpmi->fMask & MIM_HELPID)
|
|
||||||
MenuObject->MenuInfo.dwContextHelpID = lpmi->dwContextHelpID;
|
|
||||||
if(lpmi->fMask & MIM_MAXHEIGHT)
|
|
||||||
MenuObject->MenuInfo.cyMax = lpmi->cyMax;
|
|
||||||
if(lpmi->fMask & MIM_MENUDATA)
|
|
||||||
MenuObject->MenuInfo.dwMenuData = lpmi->dwMenuData;
|
|
||||||
if(lpmi->fMask & MIM_STYLE)
|
|
||||||
MenuObject->MenuInfo.dwStyle = lpmi->dwStyle;
|
|
||||||
if(lpmi->fMask & MIM_APPLYTOSUBMENUS)
|
|
||||||
{
|
|
||||||
/* FIXME */
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
return FALSE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -471,6 +449,49 @@ IntInsertMenuItemToList(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, int pos)
|
||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
IntGetMenuItemInfo(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, LPMENUITEMINFOW lpmii)
|
||||||
|
{
|
||||||
|
if(!MenuItem || !MenuObject || !lpmii)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
lpmii->cch = MenuItem->cch;
|
||||||
|
|
||||||
|
if(lpmii->fMask & MIIM_BITMAP)
|
||||||
|
{
|
||||||
|
lpmii->hbmpItem = MenuItem->hbmpItem;
|
||||||
|
}
|
||||||
|
if(lpmii->fMask & MIIM_CHECKMARKS)
|
||||||
|
{
|
||||||
|
lpmii->hbmpChecked = MenuItem->hbmpChecked;
|
||||||
|
lpmii->hbmpUnchecked = MenuItem->hbmpUnchecked;
|
||||||
|
}
|
||||||
|
if(lpmii->fMask & MIIM_DATA)
|
||||||
|
{
|
||||||
|
lpmii->dwItemData = MenuItem->dwItemData;
|
||||||
|
}
|
||||||
|
if(lpmii->fMask & (MIIM_FTYPE | MIIM_TYPE))
|
||||||
|
{
|
||||||
|
lpmii->fType = MenuItem->fType;
|
||||||
|
}
|
||||||
|
if(lpmii->fMask & MIIM_ID)
|
||||||
|
{
|
||||||
|
lpmii->wID = MenuItem->wID;
|
||||||
|
}
|
||||||
|
if(lpmii->fMask & MIIM_STATE)
|
||||||
|
{
|
||||||
|
lpmii->fState = MenuItem->fState;
|
||||||
|
}
|
||||||
|
if(lpmii->fMask & MIIM_SUBMENU)
|
||||||
|
{
|
||||||
|
lpmii->hSubMenu = MenuItem->hSubMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntSetMenuItemInfo(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, LPCMENUITEMINFOW lpmii)
|
IntSetMenuItemInfo(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, LPCMENUITEMINFOW lpmii)
|
||||||
{
|
{
|
||||||
|
@ -515,8 +536,11 @@ IntSetMenuItemInfo(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, LPCMENUITEMINFO
|
||||||
}
|
}
|
||||||
if(lpmii->fMask & MIIM_STATE)
|
if(lpmii->fMask & MIIM_STATE)
|
||||||
{
|
{
|
||||||
|
/* remove MFS_DEFAULT flag from all other menu items if this item
|
||||||
|
has the MFS_DEFAULT state */
|
||||||
if(lpmii->fState & MFS_DEFAULT)
|
if(lpmii->fState & MFS_DEFAULT)
|
||||||
IntSetMenuDefaultItem(MenuObject, -1, 0);
|
IntSetMenuDefaultItem(MenuObject, -1, 0);
|
||||||
|
/* update the menu item state flags */
|
||||||
UpdateMenuItemState(MenuItem->fState, lpmii->fState);
|
UpdateMenuItemState(MenuItem->fState, lpmii->fState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,6 +807,7 @@ IntGetMenuDefaultItem(PMENU_OBJECT MenuObject, UINT fByPos, UINT gmdiFlags,
|
||||||
while(MenuItem)
|
while(MenuItem)
|
||||||
{
|
{
|
||||||
if(MenuItem->fState & MFS_DEFAULT)
|
if(MenuItem->fState & MFS_DEFAULT)
|
||||||
|
{
|
||||||
|
|
||||||
if(!(gmdiFlags & GMDI_USEDISABLED) && (MenuItem->fState & MFS_DISABLED))
|
if(!(gmdiFlags & GMDI_USEDISABLED) && (MenuItem->fState & MFS_DISABLED))
|
||||||
break;
|
break;
|
||||||
|
@ -791,7 +816,6 @@ IntGetMenuDefaultItem(PMENU_OBJECT MenuObject, UINT fByPos, UINT gmdiFlags,
|
||||||
res = x;
|
res = x;
|
||||||
else
|
else
|
||||||
res = MenuItem->wID;
|
res = MenuItem->wID;
|
||||||
break;
|
|
||||||
|
|
||||||
if((*gismc < MAX_GOINTOSUBMENU) && (gmdiFlags & GMDI_GOINTOPOPUPS) &&
|
if((*gismc < MAX_GOINTOSUBMENU) && (gmdiFlags & GMDI_GOINTOPOPUPS) &&
|
||||||
MenuItem->hSubMenu)
|
MenuItem->hSubMenu)
|
||||||
|
@ -814,9 +838,9 @@ IntGetMenuDefaultItem(PMENU_OBJECT MenuObject, UINT fByPos, UINT gmdiFlags,
|
||||||
|
|
||||||
if(sres > -1)
|
if(sres > -1)
|
||||||
res = sres;
|
res = sres;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItem = MenuItem->Next;
|
MenuItem = MenuItem->Next;
|
||||||
|
@ -1229,7 +1253,7 @@ NtUserMenuItemFromPoint(
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOL
|
BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
|
@ -1240,9 +1264,26 @@ NtUserMenuItemInfo(
|
||||||
LPMENUITEMINFOW lpmii,
|
LPMENUITEMINFOW lpmii,
|
||||||
BOOL fsog)
|
BOOL fsog)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
BOOL res = FALSE;
|
||||||
|
PMENU_OBJECT MenuObject = IntGetMenuObject(hMenu);
|
||||||
|
if(!MenuObject)
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
if(fsog)
|
||||||
|
{
|
||||||
|
/* Set menu item info */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Get menu item info */
|
||||||
|
}
|
||||||
|
|
||||||
|
IntReleaseMenuObject(MenuObject);
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue