mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Menu functions
svn path=/trunk/; revision=5353
This commit is contained in:
parent
381c1c6ca9
commit
feea865c46
2 changed files with 659 additions and 0 deletions
171
reactos/subsys/win32k/include/menu.h
Normal file
171
reactos/subsys/win32k/include/menu.h
Normal file
|
@ -0,0 +1,171 @@
|
|||
#ifndef __WIN32K_MENU_H
|
||||
#define __WIN32K_MENU_H
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <napi/win32.h>
|
||||
|
||||
#define IS_ATOM(x) \
|
||||
(((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
|
||||
|
||||
typedef struct _MENU_OBJECT
|
||||
{
|
||||
HANDLE Self;
|
||||
FAST_MUTEX MenuItemsLock;
|
||||
LIST_ENTRY MenuItemsHead;
|
||||
BOOL RtoL;
|
||||
DWORD dwStyle;
|
||||
UINT cyMax;
|
||||
HBRUSH hbrBack;
|
||||
DWORD dwContextHelpID;
|
||||
ULONG_PTR dwMenuData;
|
||||
} MENU_OBJECT, *PMENU_OBJECT;
|
||||
|
||||
NTSTATUS FASTCALL
|
||||
InitMenuImpl(VOID);
|
||||
|
||||
NTSTATUS FASTCALL
|
||||
CleanupMenuImpl(VOID);
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserCheckMenuItem(
|
||||
HMENU hmenu,
|
||||
UINT uIDCheckItem,
|
||||
UINT uCheck);
|
||||
|
||||
HMENU
|
||||
STDCALL
|
||||
NtUserCreateMenu(VOID);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserDeleteMenu(
|
||||
HMENU hMenu,
|
||||
UINT uPosition,
|
||||
UINT uFlags);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserDestroyMenu(
|
||||
HMENU hMenu);
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserDrawMenuBarTemp(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserEnableMenuItem(
|
||||
HMENU hMenu,
|
||||
UINT uIDEnableItem,
|
||||
UINT uEnable);
|
||||
|
||||
/*DWORD
|
||||
STDCALL
|
||||
NtUserInsertMenuItem(
|
||||
HMENU hMenu,
|
||||
UINT uItem,
|
||||
WINBOOL fByPosition,
|
||||
LPCMENUITEMINFO lpmii);*/
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserEndMenu(VOID);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserGetMenuBarInfo(
|
||||
HWND hwnd,
|
||||
LONG idObject,
|
||||
LONG idItem,
|
||||
PMENUBARINFO pmbi);
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserGetMenuIndex(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserGetMenuItemRect(
|
||||
HWND hWnd,
|
||||
HMENU hMenu,
|
||||
UINT uItem,
|
||||
LPRECT lprcItem);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserHiliteMenuItem(
|
||||
HWND hwnd,
|
||||
HMENU hmenu,
|
||||
UINT uItemHilite,
|
||||
UINT uHilite);
|
||||
|
||||
int
|
||||
STDCALL
|
||||
NtUserMenuItemFromPoint(
|
||||
HWND hWnd,
|
||||
HMENU hMenu,
|
||||
DWORD X,
|
||||
DWORD Y);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserRemoveMenu(
|
||||
HMENU hMenu,
|
||||
UINT uPosition,
|
||||
UINT uFlags);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserSetMenuContextHelpId(
|
||||
HMENU hmenu,
|
||||
DWORD dwContextHelpId);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserSetMenuDefaultItem(
|
||||
HMENU hMenu,
|
||||
UINT uItem,
|
||||
UINT fByPos);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserSetMenuFlagRtoL(
|
||||
HMENU hMenu);
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserThunkedMenuInfo(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1);
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
NtUserThunkedMenuItemInfo(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
NtUserTrackPopupMenuEx(
|
||||
HMENU hmenu,
|
||||
UINT fuFlags,
|
||||
int x,
|
||||
int y,
|
||||
HWND hwnd,
|
||||
LPTPMPARAMS lptpm);
|
||||
|
||||
#endif /* __WIN32K_MENU_H */
|
||||
|
||||
/* EOF */
|
488
reactos/subsys/win32k/ntuser/menu.c
Normal file
488
reactos/subsys/win32k/ntuser/menu.c
Normal file
|
@ -0,0 +1,488 @@
|
|||
/*
|
||||
* ReactOS W32 Subsystem
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: menu.c,v 1.1 2003/07/31 23:13:55 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Menus
|
||||
* FILE: subsys/win32k/ntuser/menu.c
|
||||
* PROGRAMER: Thomas Weidenmueller (w3seek@users.sourceforge.net)
|
||||
* REVISION HISTORY:
|
||||
* 07/30/2003 CSH Created
|
||||
*/
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <win32k/win32k.h>
|
||||
#include <napi/win32.h>
|
||||
#include <include/menu.h>
|
||||
#include <include/error.h>
|
||||
#include <include/winsta.h>
|
||||
#include <include/object.h>
|
||||
#include <include/guicheck.h>
|
||||
#include <include/window.h>
|
||||
#include <include/color.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* INTERNAL ******************************************************************/
|
||||
|
||||
NTSTATUS FASTCALL
|
||||
InitMenuImpl(VOID)
|
||||
{
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS FASTCALL
|
||||
CleanupMenuImpl(VOID)
|
||||
{
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
PMENU_OBJECT FASTCALL
|
||||
W32kGetMenuObject(HMENU hMenu)
|
||||
{
|
||||
PMENU_OBJECT MenuObject;
|
||||
NTSTATUS Status = ObmReferenceObjectByHandle(PsGetWin32Process()->
|
||||
WindowStation->HandleTable, hMenu, otMenu,
|
||||
(PVOID*)&MenuObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
return MenuObject;
|
||||
}
|
||||
|
||||
VOID FASTCALL
|
||||
W32kReleaseMenuObject(PMENU_OBJECT MenuObject)
|
||||
{
|
||||
ObmDereferenceObject(MenuObject);
|
||||
}
|
||||
|
||||
BOOL FASTCALL
|
||||
W32kDestroyMenuObject(PMENU_OBJECT MenuObject)
|
||||
{
|
||||
if(MenuObject)
|
||||
{
|
||||
/* remove all menu items */
|
||||
ExAcquireFastMutexUnsafe (&MenuObject->MenuItemsLock);
|
||||
RemoveEntryList(&MenuObject->MenuItemsHead);
|
||||
ExReleaseFastMutexUnsafe (&MenuObject->MenuItemsLock);
|
||||
|
||||
W32kReleaseMenuObject(MenuObject);
|
||||
|
||||
ObmCloseHandle(PsGetWin32Process()->WindowStation->HandleTable, MenuObject->Self);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
PMENU_OBJECT FASTCALL
|
||||
W32kCreateMenu(PHANDLE Handle)
|
||||
{
|
||||
PMENU_OBJECT MenuObject = (PMENU_OBJECT)ObmCreateObject(
|
||||
PsGetWin32Process()->WindowStation->HandleTable, Handle,
|
||||
otMenu, sizeof(MENU_OBJECT));
|
||||
|
||||
if(!MenuObject)
|
||||
{
|
||||
*Handle = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MenuObject->Self = *Handle;
|
||||
MenuObject->RtoL = FALSE; /* default */
|
||||
MenuObject->dwStyle = 0; /* FIXME */
|
||||
MenuObject->cyMax = 0; /* default */
|
||||
MenuObject->hbrBack = W32kGetSysColorBrush(COLOR_MENU); /*default background color */
|
||||
MenuObject->dwContextHelpID = 0; /* default */
|
||||
MenuObject->dwMenuData = 0; /* default */
|
||||
|
||||
InitializeListHead(&MenuObject->MenuItemsHead);
|
||||
ExInitializeFastMutex(&MenuObject->MenuItemsLock);
|
||||
|
||||
return MenuObject;
|
||||
}
|
||||
|
||||
BOOL FASTCALL
|
||||
W32kSetMenuFlagRtoL(PMENU_OBJECT MenuObject)
|
||||
{
|
||||
if(MenuObject)
|
||||
{
|
||||
MenuObject->RtoL = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL FASTCALL
|
||||
W32kSetMenuContextHelpId(PMENU_OBJECT MenuObject, DWORD dwContextHelpId)
|
||||
{
|
||||
if(MenuObject)
|
||||
{
|
||||
MenuObject->dwContextHelpID = dwContextHelpId;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
DWORD STDCALL
|
||||
NtUserCheckMenuItem(
|
||||
HMENU hmenu,
|
||||
UINT uIDCheckItem,
|
||||
UINT uCheck)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
HMENU STDCALL
|
||||
NtUserCreateMenu(VOID)
|
||||
{
|
||||
PWINSTATION_OBJECT WinStaObject;
|
||||
HANDLE Handle;
|
||||
|
||||
NTSTATUS Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
||||
KernelMode,
|
||||
0,
|
||||
&WinStaObject);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ObDereferenceObject(WinStaObject);
|
||||
DPRINT("Validation of window station handle (0x%X) failed\n",
|
||||
PROCESS_WINDOW_STATION());
|
||||
SetLastNtError(Status);
|
||||
return (HMENU)0;
|
||||
}
|
||||
|
||||
W32kCreateMenu(&Handle);
|
||||
return (HMENU)Handle;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
NtUserDeleteMenu(
|
||||
HMENU hMenu,
|
||||
UINT uPosition,
|
||||
UINT uFlags)
|
||||
{
|
||||
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
NtUserDestroyMenu(
|
||||
HMENU hMenu)
|
||||
{
|
||||
/* FIXME, check if menu belongs to the process */
|
||||
|
||||
PMENU_OBJECT MenuObject = W32kGetMenuObject(hMenu);
|
||||
if(!MenuObject)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return W32kDestroyMenuObject(MenuObject);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
DWORD STDCALL
|
||||
NtUserDrawMenuBarTemp(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
NtUserEnableMenuItem(
|
||||
HMENU hMenu,
|
||||
UINT uIDEnableItem,
|
||||
UINT uEnable)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
/*DWORD STDCALL
|
||||
NtUserInsertMenuItem(
|
||||
HMENU hMenu,
|
||||
UINT uItem,
|
||||
WINBOOL fByPosition,
|
||||
LPCMENUITEMINFO lpmii)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
NtUserEndMenu(VOID)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
NtUserGetMenuBarInfo(
|
||||
HWND hwnd,
|
||||
LONG idObject,
|
||||
LONG idItem,
|
||||
PMENUBARINFO pmbi)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
DWORD STDCALL
|
||||
NtUserGetMenuIndex(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
NtUserGetMenuItemRect(
|
||||
HWND hWnd,
|
||||
HMENU hMenu,
|
||||
UINT uItem,
|
||||
LPRECT lprcItem)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
NtUserHiliteMenuItem(
|
||||
HWND hwnd,
|
||||
HMENU hmenu,
|
||||
UINT uItemHilite,
|
||||
UINT uHilite)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int STDCALL
|
||||
NtUserMenuItemFromPoint(
|
||||
HWND hWnd,
|
||||
HMENU hMenu,
|
||||
DWORD X,
|
||||
DWORD Y)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
NtUserRemoveMenu(
|
||||
HMENU hMenu,
|
||||
UINT uPosition,
|
||||
UINT uFlags)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
NtUserSetMenuContextHelpId(
|
||||
HMENU hmenu,
|
||||
DWORD dwContextHelpId)
|
||||
{
|
||||
PMENU_OBJECT MenuObject = W32kGetMenuObject(hmenu);
|
||||
if(!MenuObject)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL res = W32kSetMenuContextHelpId(MenuObject, dwContextHelpId);
|
||||
W32kReleaseMenuObject(MenuObject);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
NtUserSetMenuDefaultItem(
|
||||
HMENU hMenu,
|
||||
UINT uItem,
|
||||
UINT fByPos)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
NtUserSetMenuFlagRtoL(
|
||||
HMENU hMenu)
|
||||
{
|
||||
PMENU_OBJECT MenuObject = W32kGetMenuObject(hMenu);
|
||||
if(!MenuObject)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL res = W32kSetMenuFlagRtoL(MenuObject);
|
||||
W32kReleaseMenuObject(MenuObject);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
DWORD STDCALL
|
||||
NtUserThunkedMenuInfo(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
DWORD STDCALL
|
||||
NtUserThunkedMenuItemInfo(
|
||||
DWORD Unknown0,
|
||||
DWORD Unknown1,
|
||||
DWORD Unknown2,
|
||||
DWORD Unknown3,
|
||||
DWORD Unknown4,
|
||||
DWORD Unknown5)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
NtUserTrackPopupMenuEx(
|
||||
HMENU hmenu,
|
||||
UINT fuFlags,
|
||||
int x,
|
||||
int y,
|
||||
HWND hwnd,
|
||||
LPTPMPARAMS lptpm)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* EOF */
|
Loading…
Reference in a new issue