ReactOS  0.4.15-dev-5606-gf34e425
menu.c File Reference
#include <win32k.h>
Include dependency graph for menu.c:

Go to the source code of this file.

Classes

struct  MTRACKER
 

Macros

#define MM_SETMENUHANDLE   (WM_USER + 0)
 
#define MM_GETMENUHANDLE   (WM_USER + 1)
 
#define TF_ENDMENU   0x10000
 
#define TF_SUSPENDPOPUP   0x20000
 
#define TF_SKIPREMOVE   0x40000
 
#define MAXMENUDEPTH   30
 
#define MNS_STYLE_MASK   (MNS_NOCHECK|MNS_MODELESS|MNS_DRAGDROP|MNS_AUTODISMISS|MNS_NOTIFYBYPOS|MNS_CHECKORBMP)
 
#define MENUITEMINFO_TYPE_MASK
 
#define TYPE_MASK   (MENUITEMINFO_TYPE_MASK | MF_POPUP | MF_SYSMENU)
 
#define STATE_MASK   (~TYPE_MASK)
 
#define MENUITEMINFO_STATE_MASK   (STATE_MASK & ~(MF_BYPOSITION | MF_MOUSESELECT))
 
#define MII_STATE_MASK   (MFS_GRAYED|MFS_CHECKED|MFS_HILITE|MFS_DEFAULT)
 
#define IS_SYSTEM_MENU(MenuInfo)   (!((MenuInfo)->fFlags & MNF_POPUP) && ((MenuInfo)->fFlags & MNF_SYSMENU))
 
#define IS_BITMAP_ITEM(flags)   (MF_BITMAP == MENU_ITEM_TYPE(flags))
 
#define IS_MAGIC_BITMAP(id)   ((id) && ((INT_PTR)(id) < 12) && ((INT_PTR)(id) >= -1))
 
#define IS_STRING_ITEM(flags)   (MF_STRING == MENU_ITEM_TYPE(flags))
 
#define MAX_MENU_ITEMS   (0x4000)
 
#define MAX_GOINTOSUBMENU   (0x10)
 
#define MENU_COL_SPACE   4
 
#define MENU_ITEM_HBMP_SPACE   (5)
 
#define MENU_BAR_ITEMS_SPACE   (12)
 
#define SEPARATOR_HEIGHT   (5)
 
#define MENU_TAB_SPACE   (8)
 
#define TPM_INTERNAL   0xF0000000
 
#define TPM_BUTTONDOWN   0x40000000 /* menu was clicked before tracking */
 
#define TPM_POPUPMENU   0x20000000 /* menu is a popup menu */
 
#define ITEM_PREV   -1
 
#define ITEM_NEXT   1
 
#define UpdateMenuItemState(state, change)
 
#define FreeMenuText(Menu, MenuItem)
 
#define SHOW_DEBUGRECT   0
 

Functions

 DBG_DEFAULT_CHANNEL (UserMenu)
 
BOOL FASTCALL UITOOLS95_DrawFrameMenu (HDC dc, LPRECT r, UINT uFlags)
 
PMENU FASTCALL IntGetMenuObject (HMENU hMenu)
 
PMENU FASTCALL VerifyMenu (PMENU pMenu)
 
BOOL FASTCALL IntIsMenu (HMENU Menu)
 
PMENU WINAPI IntGetMenu (HWND hWnd)
 
PMENU get_win_sys_menu (HWND hwnd)
 
BOOL IntDestroyMenu (PMENU pMenu, BOOL bRecurse)
 
BOOLEAN UserDestroyMenuObject (PVOID Object)
 
BOOL FASTCALL IntDestroyMenuObject (PMENU Menu, BOOL bRecurse)
 
BOOL MenuInit (VOID)
 
int FASTCALL MENU_depth (PMENU pmenu, int depth)
 
static UINT MENU_GetStartOfNextColumn (PMENU menu)
 
static UINT MENU_GetStartOfPrevColumn (PMENU menu)
 
PITEM FASTCALL MENU_FindItem (PMENU *pmenu, UINT *nPos, UINT wFlags)
 
static UINT FASTCALL MENU_FindSubMenu (PMENU *menu, PMENU SubTarget)
 
BOOL FASTCALL IntRemoveMenuItem (PMENU pMenu, UINT nPos, UINT wFlags, BOOL bRecurse)
 
ITEMMENU_InsertItem (PMENU menu, UINT pos, UINT flags, PMENU *submenu, UINT *npos)
 
BOOL FASTCALL IntInsertMenuItem (_In_ PMENU MenuObject, UINT uItem, BOOL fByPosition, PROSMENUITEMINFO ItemInfo, PUNICODE_STRING lpstr)
 
PMENU FASTCALL IntCreateMenu (_Out_ PHANDLE Handle, _In_ BOOL IsMenuBar, _In_ PDESKTOP Desktop, _In_ PPROCESSINFO ppi)
 
BOOL FASTCALL IntCloneMenuItems (PMENU Destination, PMENU Source)
 
PMENU FASTCALL IntCloneMenu (PMENU Source)
 
BOOL FASTCALL IntSetMenuFlagRtoL (PMENU Menu)
 
BOOL FASTCALL IntSetMenuContextHelpId (PMENU Menu, DWORD dwContextHelpId)
 
BOOL FASTCALL IntGetMenuInfo (PMENU Menu, PROSMENUINFO lpmi)
 
BOOL FASTCALL IntSetMenuInfo (PMENU Menu, PROSMENUINFO lpmi)
 
BOOL FASTCALL IntGetMenuItemInfo (PMENU Menu, PITEM MenuItem, PROSMENUITEMINFO lpmii)
 
BOOL FASTCALL IntSetMenuItemInfo (PMENU MenuObject, PITEM MenuItem, PROSMENUITEMINFO lpmii, PUNICODE_STRING lpstr)
 
UINT FASTCALL IntEnableMenuItem (PMENU MenuObject, UINT uIDEnableItem, UINT uEnable)
 
DWORD FASTCALL IntCheckMenuItem (PMENU MenuObject, UINT uIDCheckItem, UINT uCheck)
 
BOOL FASTCALL UserSetMenuDefaultItem (PMENU MenuObject, UINT uItem, UINT fByPos)
 
UINT FASTCALL IntGetMenuDefaultItem (PMENU MenuObject, UINT fByPos, UINT gmdiFlags, DWORD *gismc)
 
PMENU FASTCALL co_IntGetSubMenu (PMENU pMenu, int nPos)
 
void FASTCALL MENU_InitSysMenuPopup (PMENU menu, DWORD style, DWORD clsStyle, LONG HitTest)
 
static void FASTCALL MENU_DrawPopupGlyph (HDC dc, LPRECT r, INT_PTR popupMagic, BOOL inactive, BOOL hilite)
 
VOID FASTCALL MENU_AdjustMenuItemRect (PMENU menu, PRECTL rect)
 
static ITEMMENU_FindItemByCoords (MENU *menu, POINT pt, UINT *pos)
 
INT FASTCALL IntMenuItemFromPoint (PWND pWnd, HMENU hMenu, POINT ptScreen)
 
static UINT FASTCALL MENU_FindItemByKey (PWND WndOwner, PMENU menu, WCHAR Key, BOOL ForceMenuChar)
 
static void FASTCALL MENU_GetBitmapItemSize (PITEM lpitem, SIZE *size, PWND WndOwner)
 
static void FASTCALL MENU_DrawBitmapItem (HDC hdc, PITEM lpitem, const RECT *rect, PMENU Menu, PWND WndOwner, UINT odaction, BOOL MenuBar)
 
LONG IntGetDialogBaseUnits (VOID)
 
static void FASTCALL MENU_CalcItemSize (HDC hdc, PITEM lpitem, PMENU Menu, PWND pwndOwner, INT orgX, INT orgY, BOOL menuBar, BOOL textandbmp)
 
static UINT MENU_GetMaxPopupHeight (PMENU lppop)
 
static void FASTCALL MENU_PopupMenuCalcSize (PMENU Menu, PWND WndOwner)
 
static void MENU_MenuBarCalcSize (HDC hdc, LPRECT lprect, PMENU lppop, PWND pwndOwner)
 
static void MENU_DrawScrollArrows (PMENU lppop, HDC hdc)
 
static void FASTCALL MENU_DrawMenuItem (PWND Wnd, PMENU Menu, PWND WndOwner, HDC hdc, PITEM lpitem, UINT Height, BOOL menuBar, UINT odaction)
 
static void FASTCALL MENU_DrawPopupMenu (PWND wnd, HDC hdc, PMENU menu)
 
PWND MENU_IsMenuActive (VOID)
 
void MENU_EndMenu (PWND pwnd)
 
DWORD WINAPI IntDrawMenuBarTemp (PWND pWnd, HDC hDC, LPRECT Rect, PMENU pMenu, HFONT Font)
 
UINT MENU_DrawMenuBar (HDC hDC, LPRECT lprect, PWND pWnd, BOOL suppress_draw)
 
static BOOL MENU_InitPopup (PWND pWndOwner, PMENU menu, UINT flags)
 
static BOOL RECTL_Intersect (const RECT *pRect, INT x, INT y, UINT width, UINT height)
 
static BOOL MENU_MoveRect (UINT flags, INT *x, INT *y, INT width, INT height, const RECT *pExclude, PMONITOR monitor)
 
static BOOL FASTCALL MENU_ShowPopup (PWND pwndOwner, PMENU menu, UINT id, UINT flags, INT x, INT y, const RECT *pExclude)
 
void MENU_EnsureMenuItemVisible (PMENU lppop, UINT wIndex, HDC hdc)
 
static void FASTCALL MENU_SelectItem (PWND pwndOwner, PMENU menu, UINT wIndex, BOOL sendMenuSelect, PMENU topmenu)
 
static void FASTCALL MENU_MoveSelection (PWND pwndOwner, PMENU menu, INT offset)
 
static void FASTCALL MENU_HideSubPopups (PWND pWndOwner, PMENU Menu, BOOL SendMenuSelect, UINT wFlags)
 
static PMENU FASTCALL MENU_ShowSubPopup (PWND WndOwner, PMENU Menu, BOOL SelectFirst, UINT Flags)
 
static INT FASTCALL MENU_ExecFocusedItem (MTRACKER *pmt, PMENU Menu, UINT Flags)
 
static void FASTCALL MENU_SwitchTracking (MTRACKER *pmt, PMENU PtMenu, UINT Index, UINT wFlags)
 
static BOOL FASTCALL MENU_ButtonDown (MTRACKER *pmt, PMENU PtMenu, UINT Flags)
 
static INT FASTCALL MENU_ButtonUp (MTRACKER *pmt, PMENU PtMenu, UINT Flags)
 
static PMENU FASTCALL MENU_PtMenu (PMENU menu, POINT pt)
 
static BOOL FASTCALL MENU_MouseMove (MTRACKER *pmt, PMENU PtMenu, UINT Flags)
 
static PMENU MENU_GetSubPopup (PMENU menu)
 
static LRESULT FASTCALL MENU_DoNextMenu (MTRACKER *pmt, UINT Vk, UINT wFlags)
 
static BOOL FASTCALL MENU_SuspendPopup (MTRACKER *pmt, UINT uMsg)
 
static BOOL FASTCALL MENU_KeyEscape (MTRACKER *pmt, UINT Flags)
 
static void FASTCALL MENU_KeyLeft (MTRACKER *pmt, UINT Flags, UINT msg)
 
static void FASTCALL MENU_KeyRight (MTRACKER *pmt, UINT Flags, UINT msg)
 
static INT FASTCALL MENU_TrackMenu (PMENU pmenu, UINT wFlags, INT x, INT y, PWND pwnd)
 
static BOOL FASTCALL MENU_InitTracking (PWND pWnd, PMENU Menu, BOOL bPopup, UINT wFlags)
 
static BOOL FASTCALL MENU_ExitTracking (PWND pWnd, BOOL bPopup, UINT wFlags)
 
VOID MENU_TrackMouseMenuBar (PWND pWnd, ULONG ht, POINT pt)
 
VOID MENU_TrackKbdMenuBar (PWND pwnd, UINT wParam, WCHAR wChar)
 
BOOL WINAPI IntTrackPopupMenuEx (PMENU menu, UINT wFlags, int x, int y, PWND pWnd, LPTPMPARAMS lpTpm)
 
BOOL WINAPI PopupMenuWndProc (PWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
 
BOOL FASTCALL IntHiliteMenuItem (PWND WindowObject, PMENU MenuObject, UINT uItemHilite, UINT uHilite)
 
BOOLEAN APIENTRY intGetTitleBarInfo (PWND pWindowObject, PTITLEBARINFO bti)
 
DWORD FASTCALL UserInsertMenuItem (PMENU Menu, UINT uItem, BOOL fByPosition, LPCMENUITEMINFOW UnsafeItemInfo, PUNICODE_STRING lpstr)
 
UINT FASTCALL IntGetMenuState (HMENU hMenu, UINT uId, UINT uFlags)
 
HMENU FASTCALL IntGetSubMenu (HMENU hMenu, int nPos)
 
UINT FASTCALL IntFindSubMenu (HMENU *hMenu, HMENU hSubTarget)
 
HMENU FASTCALL UserCreateMenu (PDESKTOP Desktop, BOOL PopupMenu)
 
BOOL FASTCALL IntMenuItemInfo (PMENU Menu, UINT Item, BOOL ByPosition, PROSMENUITEMINFO ItemInfo, BOOL SetOrGet, PUNICODE_STRING lpstr)
 
BOOL FASTCALL UserMenuItemInfo (PMENU Menu, UINT Item, BOOL ByPosition, PROSMENUITEMINFO UnsafeItemInfo, BOOL SetOrGet, PUNICODE_STRING lpstr)
 
BOOL FASTCALL UserMenuInfo (PMENU Menu, PROSMENUINFO UnsafeMenuInfo, BOOL SetOrGet)
 
BOOL FASTCALL IntGetMenuItemRect (PWND pWnd, PMENU Menu, UINT uItem, PRECTL Rect)
 
PMENU FASTCALL MENU_GetSystemMenu (PWND Window, PMENU Popup)
 
PMENU FASTCALL IntGetSystemMenu (PWND Window, BOOL bRevert)
 
BOOL FASTCALL IntSetSystemMenu (PWND Window, PMENU Menu)
 
BOOL FASTCALL IntSetMenu (PWND Wnd, HMENU Menu, BOOL *Changed)
 
DWORD APIENTRY NtUserCalcMenuBar (HWND hwnd, DWORD leftBorder, DWORD rightBorder, DWORD top, LPRECT prc)
 
DWORD APIENTRY NtUserCheckMenuItem (HMENU hMenu, UINT uIDCheckItem, UINT uCheck)
 
BOOL APIENTRY NtUserDeleteMenu (HMENU hMenu, UINT uPosition, UINT uFlags)
 
HMENU APIENTRY NtUserGetSystemMenu (HWND hWnd, BOOL bRevert)
 
BOOL APIENTRY NtUserSetSystemMenu (HWND hWnd, HMENU hMenu)
 
BOOLEAN APIENTRY NtUserGetTitleBarInfo (HWND hwnd, PTITLEBARINFO bti)
 
BOOL FASTCALL UserDestroyMenu (HMENU hMenu)
 
BOOL APIENTRY NtUserDestroyMenu (HMENU hMenu)
 
UINT APIENTRY NtUserEnableMenuItem (HMENU hMenu, UINT uIDEnableItem, UINT uEnable)
 
BOOL APIENTRY NtUserEndMenu (VOID)
 
BOOL APIENTRY NtUserGetMenuBarInfo (HWND hwnd, LONG idObject, LONG idItem, PMENUBARINFO pmbi)
 
UINT APIENTRY NtUserGetMenuIndex (HMENU hMenu, HMENU hSubMenu)
 
BOOL APIENTRY NtUserGetMenuItemRect (HWND hWnd, HMENU hMenu, UINT uItem, PRECTL lprcItem)
 
BOOL APIENTRY NtUserHiliteMenuItem (HWND hWnd, HMENU hMenu, UINT uItemHilite, UINT uHilite)
 
DWORD APIENTRY NtUserDrawMenuBarTemp (HWND hWnd, HDC hDC, PRECT pRect, HMENU hMenu, HFONT hFont)
 
int APIENTRY NtUserMenuItemFromPoint (HWND hWnd, HMENU hMenu, DWORD X, DWORD Y)
 
DWORD APIENTRY NtUserPaintMenuBar (HWND hWnd, HDC hDC, ULONG leftBorder, ULONG rightBorder, ULONG top, BOOL bActive)
 
BOOL APIENTRY NtUserRemoveMenu (HMENU hMenu, UINT uPosition, UINT uFlags)
 
BOOL APIENTRY NtUserSetMenu (HWND hWnd, HMENU Menu, BOOL Repaint)
 
BOOL APIENTRY NtUserSetMenuContextHelpId (HMENU hMenu, DWORD dwContextHelpId)
 
BOOL APIENTRY NtUserSetMenuDefaultItem (HMENU hMenu, UINT uItem, UINT fByPos)
 
BOOL APIENTRY NtUserSetMenuFlagRtoL (HMENU hMenu)
 
BOOL APIENTRY NtUserThunkedMenuInfo (HMENU hMenu, LPCMENUINFO lpcmi)
 
BOOL APIENTRY NtUserThunkedMenuItemInfo (HMENU hMenu, UINT uItem, BOOL fByPosition, BOOL bInsert, LPMENUITEMINFOW lpmii, PUNICODE_STRING lpszCaption)
 
BOOL APIENTRY NtUserTrackPopupMenuEx (HMENU hMenu, UINT fuFlags, int x, int y, HWND hWnd, LPTPMPARAMS lptpm)
 

Variables

HFONT ghMenuFont = NULL
 
HFONT ghMenuFontBold = NULL
 
static SIZE MenuCharSize
 
static HWND top_popup = NULL
 
static HMENU top_popup_hmenu = NULL
 
BOOL fInsideMenuLoop = FALSE
 
BOOL fInEndMenu = FALSE
 

Macro Definition Documentation

◆ FreeMenuText

#define FreeMenuText (   Menu,
  MenuItem 
)
Value:
{ \
if((MENU_ITEM_TYPE((MenuItem)->fType) == MF_STRING) && \
(MenuItem)->lpstr.Length) { \
DesktopHeapFree(((PMENU)Menu)->head.rpdesk, (MenuItem)->lpstr.Buffer); \
} \
}
struct outqueuenode * head
Definition: adnsresfilter.c:66
#define MF_STRING
Definition: winuser.h:138
#define MENU_ITEM_TYPE(flags)
Definition: menu.c:24
static LPCSTR lpstr
Definition: font.c:51

Definition at line 185 of file menu.c.

◆ IS_BITMAP_ITEM

#define IS_BITMAP_ITEM (   flags)    (MF_BITMAP == MENU_ITEM_TYPE(flags))

Definition at line 63 of file menu.c.

◆ IS_MAGIC_BITMAP

#define IS_MAGIC_BITMAP (   id)    ((id) && ((INT_PTR)(id) < 12) && ((INT_PTR)(id) >= -1))

Definition at line 65 of file menu.c.

◆ IS_STRING_ITEM

#define IS_STRING_ITEM (   flags)    (MF_STRING == MENU_ITEM_TYPE(flags))

Definition at line 66 of file menu.c.

◆ IS_SYSTEM_MENU

#define IS_SYSTEM_MENU (   MenuInfo)    (!((MenuInfo)->fFlags & MNF_POPUP) && ((MenuInfo)->fFlags & MNF_SYSMENU))

Definition at line 60 of file menu.c.

◆ ITEM_NEXT

#define ITEM_NEXT   1

Definition at line 95 of file menu.c.

◆ ITEM_PREV

#define ITEM_PREV   -1

Definition at line 94 of file menu.c.

◆ MAX_GOINTOSUBMENU

#define MAX_GOINTOSUBMENU   (0x10)

Definition at line 70 of file menu.c.

◆ MAX_MENU_ITEMS

#define MAX_MENU_ITEMS   (0x4000)

Definition at line 69 of file menu.c.

◆ MAXMENUDEPTH

#define MAXMENUDEPTH   30

Definition at line 43 of file menu.c.

◆ MENU_BAR_ITEMS_SPACE

#define MENU_BAR_ITEMS_SPACE   (12)

Definition at line 76 of file menu.c.

◆ MENU_COL_SPACE

#define MENU_COL_SPACE   4

Definition at line 73 of file menu.c.

◆ MENU_ITEM_HBMP_SPACE

#define MENU_ITEM_HBMP_SPACE   (5)

Definition at line 75 of file menu.c.

◆ MENU_TAB_SPACE

#define MENU_TAB_SPACE   (8)

Definition at line 78 of file menu.c.

◆ MENUITEMINFO_STATE_MASK

#define MENUITEMINFO_STATE_MASK   (STATE_MASK & ~(MF_BYPOSITION | MF_MOUSESELECT))

Definition at line 56 of file menu.c.

◆ MENUITEMINFO_TYPE_MASK

#define MENUITEMINFO_TYPE_MASK
Value:
MFT_MENUBARBREAK | MFT_MENUBREAK | MFT_RADIOCHECK | \
MFT_RIGHTORDER | MFT_RIGHTJUSTIFY /* same as MF_HELP */ )
#define MFT_RIGHTJUSTIFY
Definition: winuser.h:738
#define MFT_STRING
Definition: winuser.h:741
#define MFT_RADIOCHECK
Definition: winuser.h:737
#define MFT_BITMAP
Definition: winuser.h:733
#define MFT_SEPARATOR
Definition: winuser.h:739
#define MFT_MENUBREAK
Definition: winuser.h:735
#define MFT_OWNERDRAW
Definition: winuser.h:736

Definition at line 47 of file menu.c.

◆ MII_STATE_MASK

Definition at line 58 of file menu.c.

◆ MM_GETMENUHANDLE

#define MM_GETMENUHANDLE   (WM_USER + 1)

Definition at line 31 of file menu.c.

◆ MM_SETMENUHANDLE

#define MM_SETMENUHANDLE   (WM_USER + 0)

Definition at line 30 of file menu.c.

◆ MNS_STYLE_MASK

◆ SEPARATOR_HEIGHT

#define SEPARATOR_HEIGHT   (5)

Definition at line 77 of file menu.c.

◆ SHOW_DEBUGRECT

#define SHOW_DEBUGRECT   0

Definition at line 2848 of file menu.c.

◆ STATE_MASK

#define STATE_MASK   (~TYPE_MASK)

Definition at line 54 of file menu.c.

◆ TF_ENDMENU

#define TF_ENDMENU   0x10000

Definition at line 35 of file menu.c.

◆ TF_SKIPREMOVE

#define TF_SKIPREMOVE   0x40000

Definition at line 37 of file menu.c.

◆ TF_SUSPENDPOPUP

#define TF_SUSPENDPOPUP   0x20000

Definition at line 36 of file menu.c.

◆ TPM_BUTTONDOWN

#define TPM_BUTTONDOWN   0x40000000 /* menu was clicked before tracking */

Definition at line 91 of file menu.c.

◆ TPM_INTERNAL

#define TPM_INTERNAL   0xF0000000

Definition at line 90 of file menu.c.

◆ TPM_POPUPMENU

#define TPM_POPUPMENU   0x20000000 /* menu is a popup menu */

Definition at line 92 of file menu.c.

◆ TYPE_MASK

Definition at line 52 of file menu.c.

◆ UpdateMenuItemState

#define UpdateMenuItemState (   state,
  change 
)

Definition at line 97 of file menu.c.

Function Documentation

◆ co_IntGetSubMenu()

PMENU FASTCALL co_IntGetSubMenu ( PMENU  pMenu,
int  nPos 
)

Definition at line 1350 of file menu.c.

1353 {
1354  PITEM pItem;
1355  if (!(pItem = MENU_FindItem( &pMenu, (UINT*)&nPos, MF_BYPOSITION ))) return NULL;
1356  return pItem->spSubMenu;
1357 }
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:509
#define MF_BYPOSITION
Definition: winuser.h:203
struct tagMENU * spSubMenu
Definition: ntuser.h:370
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112

Referenced by MENU_DoNextMenu(), and MENU_FindItemByKey().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserMenu  )

◆ get_win_sys_menu()

PMENU get_win_sys_menu ( HWND  hwnd)

Definition at line 260 of file menu.c.

261 {
262  PMENU ret = 0;
263  WND *win = ValidateHwndNoErr( hwnd );
264  if (win)
265  {
266  ret = UserGetMenuObject(win->SystemMenu);
267  }
268  return ret;
269 }
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
int ret
Definition: ntuser.h:688
static real win[4][36]
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022

Referenced by MENU_DoNextMenu(), MENU_PtMenu(), MENU_TrackKbdMenuBar(), and MENU_TrackMouseMenuBar().

◆ IntCheckMenuItem()

DWORD FASTCALL IntCheckMenuItem ( PMENU  MenuObject,
UINT  uIDCheckItem,
UINT  uCheck 
)

Definition at line 1261 of file menu.c.

1262 {
1263  PITEM MenuItem;
1264  DWORD res;
1265 
1266  if (!(MenuItem = MENU_FindItem( &MenuObject, &uIDCheckItem, uCheck ))) return -1;
1267 
1268  res = (DWORD)(MenuItem->fState & MF_CHECKED);
1269 
1270  MenuItem->fState ^= (res ^ uCheck) & MF_CHECKED;
1271 
1272  return res;
1273 }
UINT fState
Definition: ntuser.h:368
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:509
#define DWORD
Definition: nt_native.h:44
#define MF_CHECKED
Definition: winuser.h:132
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613

Referenced by NtUserCheckMenuItem().

◆ IntCloneMenu()

PMENU FASTCALL IntCloneMenu ( PMENU  Source)

Definition at line 824 of file menu.c.

825 {
826  HANDLE hMenu;
827  PMENU Menu;
828 
829  if(!Source)
830  return NULL;
831 
832  /* A menu is valid process wide. We can pass to the object manager any thread ptr */
834  Source->head.rpdesk,
835  ((PPROCESSINFO)Source->head.hTaskWow)->ptiList,
836  &hMenu,
837  TYPE_MENU,
838  sizeof(MENU));
839  if(!Menu)
840  return NULL;
841 
842  Menu->fFlags = Source->fFlags;
843  Menu->cyMax = Source->cyMax;
844  Menu->hbrBack = Source->hbrBack;
845  Menu->dwContextHelpId = Source->dwContextHelpId;
846  Menu->dwMenuData = Source->dwMenuData;
847  Menu->iItem = NO_SELECTED_ITEM;
848  Menu->spwndNotify = NULL;
849  Menu->cyMenu = 0;
850  Menu->cxMenu = 0;
851  Menu->cItems = 0;
852  Menu->iTop = 0;
853  Menu->iMaxTop = 0;
854  Menu->cxTextAlign = 0;
855  Menu->rgItems = NULL;
856 
857  Menu->hWnd = NULL;
858  Menu->TimeToHide = FALSE;
859 
860  IntCloneMenuItems(Menu, Source);
861 
862  return Menu;
863 }
DWORD_PTR dwMenuData
Definition: ntuser.h:425
HWND hWnd
Definition: ntuser.h:432
HBRUSH hbrBack
Definition: ntuser.h:426
struct _WND * spwndNotify
Definition: ntuser.h:420
BOOL TimeToHide
Definition: ntuser.h:433
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:568
struct tagMENU MENU
ULONG cxTextAlign
Definition: ntuser.h:419
#define FALSE
Definition: types.h:117
ULONG cyMenu
Definition: ntuser.h:418
INT iTop
Definition: ntuser.h:427
DWORD dwContextHelpId
Definition: ntuser.h:423
#define NO_SELECTED_ITEM
Definition: ntuser.h:408
ULONG cyMax
Definition: ntuser.h:424
UINT cItems
Definition: ntuser.h:416
struct tagMENU * PMENU
PITEM rgItems
Definition: ntuser.h:421
BOOL FASTCALL IntCloneMenuItems(PMENU Destination, PMENU Source)
Definition: menu.c:773
INT iMaxTop
Definition: ntuser.h:428
#define NULL
Definition: types.h:112
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
ULONG fFlags
Definition: ntuser.h:413
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
ULONG cxMenu
Definition: ntuser.h:417
INT iItem
Definition: ntuser.h:414

Referenced by MENU_GetSystemMenu().

◆ IntCloneMenuItems()

BOOL FASTCALL IntCloneMenuItems ( PMENU  Destination,
PMENU  Source 
)

Definition at line 773 of file menu.c.

774 {
775  PITEM MenuItem, NewMenuItem = NULL;
776  UINT i;
777 
778  if(!Source->cItems)
779  return FALSE;
780 
781  NewMenuItem = DesktopHeapAlloc(Destination->head.rpdesk, Source->cItems * sizeof(ITEM));
782  if(!NewMenuItem) return FALSE;
783 
784  RtlZeroMemory(NewMenuItem, Source->cItems * sizeof(ITEM));
785 
786  Destination->rgItems = NewMenuItem;
787 
788  MenuItem = Source->rgItems;
789  for (i = 0; i < Source->cItems; i++, MenuItem++, NewMenuItem++)
790  {
791  NewMenuItem->fType = MenuItem->fType;
792  NewMenuItem->fState = MenuItem->fState;
793  NewMenuItem->wID = MenuItem->wID;
794  NewMenuItem->spSubMenu = MenuItem->spSubMenu;
795  NewMenuItem->hbmpChecked = MenuItem->hbmpChecked;
796  NewMenuItem->hbmpUnchecked = MenuItem->hbmpUnchecked;
797  NewMenuItem->dwItemData = MenuItem->dwItemData;
798  if (MenuItem->lpstr.Length)
799  {
800  NewMenuItem->lpstr.Length = 0;
801  NewMenuItem->lpstr.MaximumLength = MenuItem->lpstr.MaximumLength;
802  NewMenuItem->lpstr.Buffer = DesktopHeapAlloc(Destination->head.rpdesk, MenuItem->lpstr.MaximumLength);
803  if (!NewMenuItem->lpstr.Buffer)
804  {
805  DesktopHeapFree(Destination->head.rpdesk, NewMenuItem);
806  break;
807  }
808  RtlCopyUnicodeString(&NewMenuItem->lpstr, &MenuItem->lpstr);
809  NewMenuItem->lpstr.Buffer[MenuItem->lpstr.Length / sizeof(WCHAR)] = 0;
810  NewMenuItem->Xlpstr = NewMenuItem->lpstr.Buffer;
811  }
812  else
813  {
814  NewMenuItem->lpstr.Buffer = MenuItem->lpstr.Buffer;
815  NewMenuItem->Xlpstr = NewMenuItem->lpstr.Buffer;
816  }
817  NewMenuItem->hbmp = MenuItem->hbmp;
818  Destination->cItems = i + 1;
819  }
820  return TRUE;
821 }
Definition: fontsub.cpp:35
DWORD_PTR dwItemData
Definition: ntuser.h:375
UINT wID
Definition: ntuser.h:369
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define TRUE
Definition: types.h:120
UINT fState
Definition: ntuser.h:368
UNICODE_STRING lpstr
Definition: ntuser.h:387
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
static __inline PVOID DesktopHeapAlloc(IN PDESKTOP Desktop, IN SIZE_T Bytes)
Definition: desktop.h:204
#define FALSE
Definition: types.h:117
__wchar_t WCHAR
Definition: xmlstorage.h:180
HANDLE hbmpUnchecked
Definition: ntuser.h:372
HBITMAP hbmp
Definition: ntuser.h:383
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2991
struct tagMENU * spSubMenu
Definition: ntuser.h:370
HANDLE hbmpChecked
Definition: ntuser.h:371
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
static __inline BOOL DesktopHeapFree(IN PDESKTOP Desktop, IN PVOID lpMem)
Definition: desktop.h:215
USHORT * Xlpstr
Definition: ntuser.h:373
UINT fType
Definition: ntuser.h:367

Referenced by IntCloneMenu().

◆ IntCreateMenu()

PMENU FASTCALL IntCreateMenu ( _Out_ PHANDLE  Handle,
_In_ BOOL  IsMenuBar,
_In_ PDESKTOP  Desktop,
_In_ PPROCESSINFO  ppi 
)

Definition at line 731 of file menu.c.

736 {
737  PMENU Menu;
738 
740  Desktop,
741  ppi->ptiList,
742  Handle,
743  TYPE_MENU,
744  sizeof(MENU));
745  if(!Menu)
746  {
747  *Handle = 0;
748  return NULL;
749  }
750 
751  Menu->cyMax = 0; /* Default */
752  Menu->hbrBack = NULL; /* No brush */
753  Menu->dwContextHelpId = 0; /* Default */
754  Menu->dwMenuData = 0; /* Default */
755  Menu->iItem = NO_SELECTED_ITEM; // Focused item
756  Menu->fFlags = (IsMenuBar ? 0 : MNF_POPUP);
757  Menu->spwndNotify = NULL;
758  Menu->cyMenu = 0; // Height
759  Menu->cxMenu = 0; // Width
760  Menu->cItems = 0; // Item count
761  Menu->iTop = 0;
762  Menu->iMaxTop = 0;
763  Menu->cxTextAlign = 0;
764  Menu->rgItems = NULL;
765 
766  Menu->hWnd = NULL;
767  Menu->TimeToHide = FALSE;
768 
769  return Menu;
770 }
DWORD_PTR dwMenuData
Definition: ntuser.h:425
HWND hWnd
Definition: ntuser.h:432
HBRUSH hbrBack
Definition: ntuser.h:426
struct _WND * spwndNotify
Definition: ntuser.h:420
BOOL TimeToHide
Definition: ntuser.h:433
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:568
ULONG cxTextAlign
Definition: ntuser.h:419
#define FALSE
Definition: types.h:117
ULONG cyMenu
Definition: ntuser.h:418
INT iTop
Definition: ntuser.h:427
DWORD dwContextHelpId
Definition: ntuser.h:423
#define NO_SELECTED_ITEM
Definition: ntuser.h:408
ULONG cyMax
Definition: ntuser.h:424
UINT cItems
Definition: ntuser.h:416
struct tagMENU * PMENU
PITEM rgItems
Definition: ntuser.h:421
INT iMaxTop
Definition: ntuser.h:428
#define NULL
Definition: types.h:112
_In_ HANDLE Handle
Definition: extypes.h:390
#define MNF_POPUP
Definition: ntuser.h:397
ULONG fFlags
Definition: ntuser.h:413
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
ULONG cxMenu
Definition: ntuser.h:417
INT iItem
Definition: ntuser.h:414

Referenced by IntSetMenuItemInfo(), and UserCreateMenu().

◆ IntDestroyMenu()

BOOL IntDestroyMenu ( PMENU  pMenu,
BOOL  bRecurse 
)

Definition at line 271 of file menu.c.

272 {
273  PMENU SubMenu;
274 
276  if (pMenu->rgItems) /* recursively destroy submenus */
277  {
278  int i;
279  ITEM *item = pMenu->rgItems;
280  for (i = pMenu->cItems; i > 0; i--, item++)
281  {
282  SubMenu = item->spSubMenu;
283  item->spSubMenu = NULL;
284 
285  /* Remove Item Text */
286  FreeMenuText(pMenu,item);
287 
288  /* Remove Item Bitmap and set it for this process */
289  if (item->hbmp && !(item->fState & MFS_HBMMENUBMP))
290  {
292  item->hbmp = NULL;
293  }
294 
295  /* Remove Item submenu */
296  if (bRecurse && SubMenu)//VerifyMenu(SubMenu))
297  {
298  /* Release submenu since it was referenced when inserted */
299  IntReleaseMenuObject(SubMenu);
300  IntDestroyMenuObject(SubMenu, bRecurse);
301  }
302  }
303  /* Free the Item */
304  DesktopHeapFree(pMenu->head.rpdesk, pMenu->rgItems );
305  pMenu->rgItems = NULL;
306  pMenu->cItems = 0;
307  }
308  return TRUE;
309 }
Definition: fontsub.cpp:35
BOOL NTAPI GreSetObjectOwner(HGDIOBJ hobj, ULONG ulOwner)
Definition: gdiobj.c:1255
#define TRUE
Definition: types.h:120
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:319
PROCDESKHEAD head
Definition: ntuser.h:412
#define ASSERT(a)
Definition: mode.c:44
UINT cItems
Definition: ntuser.h:416
PITEM rgItems
Definition: ntuser.h:421
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
static ATOM item
Definition: dde.c:856
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
BOOL FASTCALL UserIsEnteredExclusive(VOID)
Definition: ntuser.c:227
#define MFS_HBMMENUBMP
Definition: ntuser.h:363
static __inline BOOL DesktopHeapFree(IN PDESKTOP Desktop, IN PVOID lpMem)
Definition: desktop.h:215
struct _DESKTOP * rpdesk
Definition: ntuser.h:219
#define FreeMenuText(Menu, MenuItem)
Definition: menu.c:185

Referenced by IntDestroyMenuObject().

◆ IntDestroyMenuObject()

BOOL FASTCALL IntDestroyMenuObject ( PMENU  Menu,
BOOL  bRecurse 
)

Definition at line 319 of file menu.c.

320 {
322  if (Menu)
323  {
324  PWND Window;
325 
326  if (PsGetCurrentProcessSessionId() == Menu->head.rpdesk->rpwinstaParent->dwSessionId)
327  {
328  BOOL ret;
329  if (Menu->hWnd)
330  {
331  Window = ValidateHwndNoErr(Menu->hWnd);
332  if (Window)
333  {
334  //Window->IDMenu = 0; Only in Win9x!! wine win test_SetMenu test...
335 
336  /* DestroyMenu should not destroy system menu popup owner */
337  if ((Menu->fFlags & (MNF_POPUP | MNF_SYSSUBMENU)) == MNF_POPUP)
338  {
339  // Should we check it to see if it has Class?
340  ERR("FIXME Pop up menu window thing'ie\n");
341  //co_UserDestroyWindow( Window );
342  //Menu->hWnd = 0;
343  }
344  }
345  }
346 
347  if (!UserMarkObjectDestroy(Menu)) return TRUE;
348 
349  /* Remove all menu items */
350  IntDestroyMenu( Menu, bRecurse);
351 
352  ret = UserDeleteObject(Menu->head.h, TYPE_MENU);
353  TRACE("IntDestroyMenuObject %d\n",ret);
354  return ret;
355  }
356  }
357  return FALSE;
358 }
HWND hWnd
Definition: ntuser.h:432
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:717
#define TRUE
Definition: types.h:120
Definition: window.c:28
#define FALSE
Definition: types.h:117
PROCDESKHEAD head
Definition: ntuser.h:412
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG NTAPI PsGetCurrentProcessSessionId(VOID)
Definition: process.c:1133
#define TRACE(s)
Definition: solgame.cpp:4
#define ASSERT(a)
Definition: mode.c:44
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
int Window
Definition: x11stubs.h:26
int ret
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:688
BOOL FASTCALL UserIsEnteredExclusive(VOID)
Definition: ntuser.c:227
#define MNF_POPUP
Definition: ntuser.h:397
BOOL IntDestroyMenu(PMENU pMenu, BOOL bRecurse)
Definition: menu.c:271
#define MNF_SYSSUBMENU
Definition: ntuser.h:403
ULONG fFlags
Definition: ntuser.h:413
struct _DESKTOP * rpdesk
Definition: ntuser.h:219
BOOL FASTCALL UserMarkObjectDestroy(PVOID Object)
Definition: object.c:621

Referenced by co_UserFreeWindow(), IntDestroyMenu(), IntGetSystemMenu(), IntRemoveMenuItem(), IntSetMenuItemInfo(), IntSetSystemMenu(), MENU_GetSystemMenu(), NtUserDestroyMenu(), UserDestroyMenu(), and UserDestroyMenuObject().

◆ IntDrawMenuBarTemp()

DWORD WINAPI IntDrawMenuBarTemp ( PWND  pWnd,
HDC  hDC,
LPRECT  Rect,
PMENU  pMenu,
HFONT  Font 
)

Definition at line 2687 of file menu.c.

2688 {
2689  UINT i;
2690  HFONT FontOld = NULL;
2691  BOOL flat_menu = FALSE;
2692 
2693  UserSystemParametersInfo(SPI_GETFLATMENU, 0, &flat_menu, 0);
2694 
2695  if (!pMenu)
2696  {
2697  pMenu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu));
2698  }
2699 
2700  if (!Font)
2701  {
2702  Font = ghMenuFont;
2703  }
2704 
2705  if (Rect == NULL || !pMenu)
2706  {
2708  }
2709 
2710  TRACE("(%x, %x, %p, %x, %x)\n", pWnd, hDC, Rect, pMenu, Font);
2711 
2712  FontOld = NtGdiSelectFont(hDC, Font);
2713 
2714  if (pMenu->cyMenu == 0)
2715  {
2716  MENU_MenuBarCalcSize(hDC, Rect, pMenu, pWnd);
2717  }
2718 
2719  Rect->bottom = Rect->top + pMenu->cyMenu;
2720 
2721  FillRect(hDC, Rect, IntGetSysColorBrush(flat_menu ? COLOR_MENUBAR : COLOR_MENU));
2722 
2725  GreMoveTo(hDC, Rect->left, Rect->bottom - 1, NULL);
2726  NtGdiLineTo(hDC, Rect->right, Rect->bottom - 1);
2727 
2728  if (pMenu->cItems == 0)
2729  {
2730  NtGdiSelectFont(hDC, FontOld);
2732  }
2733 
2734  for (i = 0; i < pMenu->cItems; i++)
2735  {
2736  MENU_DrawMenuItem(pWnd, pMenu, pWnd, hDC, &pMenu->rgItems[i], pMenu->cyMenu, TRUE, ODA_DRAWENTIRE);
2737  }
2738 
2739  NtGdiSelectFont(hDC, FontOld);
2740 
2741  return pMenu->cyMenu;
2742 }
HFONT ghMenuFont
Definition: menu.c:16
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
#define TRUE
Definition: types.h:120
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiGetStockObject(_In_ INT iObject)
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
__kernel_entry W32KAPI BOOL APIENTRY NtGdiLineTo(_In_ HDC hdc, _In_ INT x, _In_ INT y)
__kernel_entry W32KAPI HPEN APIENTRY NtGdiSelectPen(_In_ HDC hdc, _In_ HPEN hpen)
#define COLOR_3DFACE
Definition: winuser.h:923
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG cyMenu
Definition: ntuser.h:418
static void FASTCALL MENU_DrawMenuItem(PWND Wnd, PMENU Menu, PWND WndOwner, HDC hdc, PITEM lpitem, UINT Height, BOOL menuBar, UINT odaction)
Definition: menu.c:2206
#define COLOR_MENU
Definition: winuser.h:911
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
__kernel_entry W32KAPI HFONT APIENTRY NtGdiSelectFont(_In_ HDC hdc, _In_ HFONT hf)
Definition: dcobjs.c:597
#define ODA_DRAWENTIRE
Definition: winuser.h:2532
UINT_PTR IDMenu
Definition: ntuser.h:726
#define TRACE(s)
Definition: solgame.cpp:4
#define UlongToHandle(ul)
Definition: basetsd.h:97
UINT cItems
Definition: ntuser.h:416
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
PITEM rgItems
Definition: ntuser.h:421
COLORREF FASTCALL IntSetDCPenColor(HDC, COLORREF)
Definition: dcutil.c:259
BOOL FASTCALL GreMoveTo(HDC hdc, INT x, INT y, LPPOINT pptOut)
Definition: line.c:108
static HDC hDC
Definition: 3dtext.c:33
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static void MENU_MenuBarCalcSize(HDC hdc, LPRECT lprect, PMENU lppop, PWND pwndOwner)
Definition: menu.c:2103
#define SM_CYMENU
Definition: winuser.h:970
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2090
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)

Referenced by MENU_DrawMenuBar(), and NtUserDrawMenuBarTemp().

◆ IntEnableMenuItem()

UINT FASTCALL IntEnableMenuItem ( PMENU  MenuObject,
UINT  uIDEnableItem,
UINT  uEnable 
)

Definition at line 1219 of file menu.c.

1220 {
1221  PITEM MenuItem;
1222  UINT res;
1223 
1224  if (!(MenuItem = MENU_FindItem( &MenuObject, &uIDEnableItem, uEnable ))) return (UINT)-1;
1225 
1226  res = MenuItem->fState & (MF_GRAYED | MF_DISABLED);
1227 
1228  MenuItem->fState ^= (res ^ uEnable) & (MF_GRAYED | MF_DISABLED);
1229 
1230  /* If the close item in the system menu change update the close button */
1231  if (res != uEnable)
1232  {
1233  switch (MenuItem->wID) // More than just close.
1234  {
1235  case SC_CLOSE:
1236  case SC_MAXIMIZE:
1237  case SC_MINIMIZE:
1238  case SC_MOVE:
1239  case SC_RESTORE:
1240  case SC_SIZE:
1241  if (MenuObject->fFlags & MNF_SYSSUBMENU && MenuObject->spwndNotify != 0)
1242  {
1243  //RECTL rc = MenuObject->spwndNotify->rcWindow;
1244 
1245  /* Refresh the frame to reflect the change */
1246  //IntMapWindowPoints(0, MenuObject->spwndNotify, (POINT *)&rc, 2);
1247  //rc.bottom = 0;
1248  //co_UserRedrawWindow(MenuObject->spwndNotify, &rc, 0, RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN);
1249 
1250  // Allow UxTheme!
1251  UserPaintCaption(MenuObject->spwndNotify, DC_BUTTONS);
1252  }
1253  default:
1254  break;
1255  }
1256  }
1257  return res;
1258 }
UINT wID
Definition: ntuser.h:369
#define MF_DISABLED
Definition: winuser.h:130
#define SC_RESTORE
Definition: winuser.h:2588
UINT fState
Definition: ntuser.h:368
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:509
struct _WND * spwndNotify
Definition: ntuser.h:420
#define SC_MAXIMIZE
Definition: winuser.h:2578
#define SC_MINIMIZE
Definition: winuser.h:2576
#define SC_SIZE
Definition: winuser.h:2574
unsigned int UINT
Definition: ndis.h:50
BOOL UserPaintCaption(PWND pWnd, INT Flags)
Definition: defwnd.c:399
#define SC_MOVE
Definition: winuser.h:2575
#define SC_CLOSE
Definition: winuser.h:2582
GLuint res
Definition: glext.h:9613
#define MF_GRAYED
Definition: winuser.h:129
#define MNF_SYSSUBMENU
Definition: ntuser.h:403
ULONG fFlags
Definition: ntuser.h:413

Referenced by MENU_InitSysMenuPopup(), and NtUserEnableMenuItem().

◆ IntFindSubMenu()

UINT FASTCALL IntFindSubMenu ( HMENU hMenu,
HMENU  hSubTarget 
)

Definition at line 5015 of file menu.c.

5016 {
5017  PMENU menu, pSubTarget;
5018  UINT Pos;
5019  if (((*hMenu)==(HMENU)0xffff) ||(!(menu = UserGetMenuObject(*hMenu))))
5020  return NO_SELECTED_ITEM;
5021 
5022  pSubTarget = UserGetMenuObject(hSubTarget);
5023 
5024  Pos = MENU_FindSubMenu(&menu, pSubTarget );
5025 
5026  *hMenu = (menu ? UserHMGetHandle(menu) : NULL);
5027 
5028  return Pos;
5029 }
static UINT FASTCALL MENU_FindSubMenu(PMENU *menu, PMENU SubTarget)
Definition: menu.c:566
ush Pos
Definition: deflate.h:92
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define NO_SELECTED_ITEM
Definition: ntuser.h:408
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by co_IntTranslateAccelerator().

◆ IntGetDialogBaseUnits()

LONG IntGetDialogBaseUnits ( VOID  )

Definition at line 1802 of file menu.c.

1803 {
1804  static DWORD units;
1805 
1806  if (!units)
1807  {
1808  HDC hdc;
1809  SIZE size;
1810 
1811  if ((hdc = UserGetDCEx(NULL, NULL, DCX_CACHE)))
1812  {
1814  if (size.cx) units = MAKELONG( size.cx, size.cy );
1815  UserReleaseDC( 0, hdc, FALSE);
1816  }
1817  }
1818  return units;
1819 }
static HDC
Definition: imagelist.c:92
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
#define FALSE
Definition: types.h:117
DWORD FASTCALL IntGetCharDimensions(HDC hdc, PTEXTMETRICW ptm, PDWORD height)
Definition: font.c:329
SIZE size
Definition: menu.c:78
#define MAKELONG(a, b)
Definition: typedefs.h:249
LONG cx
Definition: windef.h:334
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
#define DCX_CACHE
Definition: winuser.h:2104
#define NULL
Definition: types.h:112
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
DWORD * PDWORD
Definition: pedump.c:68
GLfloat units
Definition: glext.h:11727

Referenced by MENU_CalcItemSize().

◆ IntGetMenu()

PMENU WINAPI IntGetMenu ( HWND  hWnd)

Definition at line 250 of file menu.c.

251 {
252  PWND Wnd = ValidateHwndNoErr(hWnd);
253 
254  if (!Wnd)
255  return NULL;
256 
257  return UserGetMenuObject(UlongToHandle(Wnd->IDMenu));
258 }
HWND hWnd
Definition: settings.c:17
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
UINT_PTR IDMenu
Definition: ntuser.h:726
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
Definition: ntuser.h:688
#define NULL
Definition: types.h:112

Referenced by MENU_ButtonUp(), MENU_DoNextMenu(), MENU_PtMenu(), MENU_TrackKbdMenuBar(), and MENU_TrackMouseMenuBar().

◆ IntGetMenuDefaultItem()

UINT FASTCALL IntGetMenuDefaultItem ( PMENU  MenuObject,
UINT  fByPos,
UINT  gmdiFlags,
DWORD gismc 
)

Definition at line 1317 of file menu.c.

1318 {
1319  UINT i = 0;
1320  PITEM MenuItem = MenuObject->rgItems;
1321 
1322  /* empty menu */
1323  if (!MenuItem) return -1;
1324 
1325  while ( !( MenuItem->fState & MFS_DEFAULT ) )
1326  {
1327  i++; MenuItem++;
1328  if (i >= MenuObject->cItems ) return -1;
1329  }
1330 
1331  /* default: don't return disabled items */
1332  if ( (!(GMDI_USEDISABLED & gmdiFlags)) && (MenuItem->fState & MFS_DISABLED )) return -1;
1333 
1334  /* search rekursiv when needed */
1335  if ( (gmdiFlags & GMDI_GOINTOPOPUPS) && MenuItem->spSubMenu )
1336  {
1337  UINT ret;
1338  (*gismc)++;
1339  ret = IntGetMenuDefaultItem( MenuItem->spSubMenu, fByPos, gmdiFlags, gismc );
1340  (*gismc)--;
1341  if ( -1 != ret ) return ret;
1342 
1343  /* when item not found in submenu, return the popup item */
1344  }
1345  return ( fByPos ) ? i : MenuItem->wID;
1346 }
UINT wID
Definition: ntuser.h:369
UINT fState
Definition: ntuser.h:368
#define MFS_DISABLED
Definition: winuser.h:744
#define MFS_DEFAULT
Definition: winuser.h:743
#define GMDI_GOINTOPOPUPS
Definition: winuser.h:2115
UINT FASTCALL IntGetMenuDefaultItem(PMENU MenuObject, UINT fByPos, UINT gmdiFlags, DWORD *gismc)
Definition: menu.c:1317
UINT cItems
Definition: ntuser.h:416
PITEM rgItems
Definition: ntuser.h:421
int ret
struct tagMENU * spSubMenu
Definition: ntuser.h:370
#define GMDI_USEDISABLED
Definition: winuser.h:2116
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50

Referenced by GetMenuDefaultItem(), and IntGetMenuDefaultItem().

◆ IntGetMenuInfo()

BOOL FASTCALL IntGetMenuInfo ( PMENU  Menu,
PROSMENUINFO  lpmi 
)

Definition at line 881 of file menu.c.

882 {
883  if(lpmi->fMask & MIM_BACKGROUND)
884  lpmi->hbrBack = Menu->hbrBack;
885  if(lpmi->fMask & MIM_HELPID)
886  lpmi->dwContextHelpID = Menu->dwContextHelpId;
887  if(lpmi->fMask & MIM_MAXHEIGHT)
888  lpmi->cyMax = Menu->cyMax;
889  if(lpmi->fMask & MIM_MENUDATA)
890  lpmi->dwMenuData = Menu->dwMenuData;
891  if(lpmi->fMask & MIM_STYLE)
892  lpmi->dwStyle = Menu->fFlags & MNS_STYLE_MASK;
893 
894  if (sizeof(MENUINFO) < lpmi->cbSize)
895  {
896  lpmi->cItems = Menu->cItems;
897 
898  lpmi->iItem = Menu->iItem;
899  lpmi->cxMenu = Menu->cxMenu;
900  lpmi->cyMenu = Menu->cyMenu;
901  lpmi->spwndNotify = Menu->spwndNotify;
902  lpmi->cxTextAlign = Menu->cxTextAlign;
903  lpmi->iTop = Menu->iTop;
904  lpmi->iMaxTop = Menu->iMaxTop;
905  lpmi->dwArrowsOn = Menu->dwArrowsOn;
906 
907  lpmi->fFlags = Menu->fFlags;
908  lpmi->Self = Menu->head.h;
909  lpmi->TimeToHide = Menu->TimeToHide;
910  lpmi->Wnd = Menu->hWnd;
911  }
912  return TRUE;
913 }
DWORD_PTR dwMenuData
Definition: ntuser.h:425
HWND hWnd
Definition: ntuser.h:432
INT iMaxTop
Definition: menu.h:92
HBRUSH hbrBack
Definition: ntuser.h:426
#define TRUE
Definition: types.h:120
#define MNS_STYLE_MASK
Definition: menu.c:45
WORD cyMenu
Definition: menu.h:88
UINT iItem
Definition: menu.h:85
PWND spwndNotify
Definition: menu.h:90
struct _WND * spwndNotify
Definition: ntuser.h:420
BOOL TimeToHide
Definition: ntuser.h:433
DWORD cbSize
Definition: menu.h:76
HBRUSH hbrBack
Definition: menu.h:80
ULONG cxTextAlign
Definition: menu.h:89
UINT cyMax
Definition: menu.h:79
ULONG cxTextAlign
Definition: ntuser.h:419
PROCDESKHEAD head
Definition: ntuser.h:412
ULONG cyMenu
Definition: ntuser.h:418
INT iTop
Definition: ntuser.h:427
DWORD dwContextHelpId
Definition: ntuser.h:423
HMENU Self
Definition: menu.h:95
INT iTop
Definition: menu.h:91
DWORD dwArrowsOn
Definition: ntuser.h:429
ULONG cyMax
Definition: ntuser.h:424
DWORD dwArrowsOn
Definition: menu.h:93
ULONG fFlags
Definition: menu.h:84
UINT cItems
Definition: ntuser.h:416
DWORD dwContextHelpID
Definition: menu.h:81
WORD cxMenu
Definition: menu.h:87
DWORD fMask
Definition: menu.h:77
INT iMaxTop
Definition: ntuser.h:428
ULONG_PTR dwMenuData
Definition: menu.h:82
BOOL TimeToHide
Definition: menu.h:97
HWND Wnd
Definition: menu.h:96
UINT cItems
Definition: menu.h:86
ULONG fFlags
Definition: ntuser.h:413
ULONG cxMenu
Definition: ntuser.h:417
INT iItem
Definition: ntuser.h:414
DWORD dwStyle
Definition: menu.h:78

Referenced by UserMenuInfo().

◆ IntGetMenuItemInfo()

BOOL FASTCALL IntGetMenuItemInfo ( PMENU  Menu,
PITEM  MenuItem,
PROSMENUITEMINFO  lpmii 
)

Definition at line 964 of file menu.c.

966 {
968 
969  if(lpmii->fMask & (MIIM_FTYPE | MIIM_TYPE))
970  {
971  lpmii->fType = MenuItem->fType;
972  }
973  if(lpmii->fMask & MIIM_BITMAP)
974  {
975  lpmii->hbmpItem = MenuItem->hbmp;
976  }
977  if(lpmii->fMask & MIIM_CHECKMARKS)
978  {
979  lpmii->hbmpChecked = MenuItem->hbmpChecked;
980  lpmii->hbmpUnchecked = MenuItem->hbmpUnchecked;
981  }
982  if(lpmii->fMask & MIIM_DATA)
983  {
984  lpmii->dwItemData = MenuItem->dwItemData;
985  }
986  if(lpmii->fMask & MIIM_ID)
987  {
988  lpmii->wID = MenuItem->wID;
989  }
990  if(lpmii->fMask & MIIM_STATE)
991  {
992  lpmii->fState = MenuItem->fState;
993  }
994  if(lpmii->fMask & MIIM_SUBMENU)
995  {
996  lpmii->hSubMenu = MenuItem->spSubMenu ? MenuItem->spSubMenu->head.h : NULL;
997  }
998 
999  if ((lpmii->fMask & MIIM_STRING) ||
1000  ((lpmii->fMask & MIIM_TYPE) && (MENU_ITEM_TYPE(lpmii->fType) == MF_STRING)))
1001  {
1002  if (lpmii->dwTypeData == NULL)
1003  {
1004  lpmii->cch = MenuItem->lpstr.Length / sizeof(WCHAR);
1005  }
1006  else
1007  {
1008  Status = MmCopyToCaller(lpmii->dwTypeData, MenuItem->lpstr.Buffer,
1009  min(lpmii->cch * sizeof(WCHAR),
1010  MenuItem->lpstr.MaximumLength));
1011  if (! NT_SUCCESS(Status))
1012  {
1014  return FALSE;
1015  }
1016  }
1017  }
1018 
1019  if (sizeof(ROSMENUITEMINFO) == lpmii->cbSize)
1020  {
1021  lpmii->Rect.left = MenuItem->xItem;
1022  lpmii->Rect.top = MenuItem->yItem;
1023  lpmii->Rect.right = MenuItem->cxItem; // Do this for now......
1024  lpmii->Rect.bottom = MenuItem->cyItem;
1025  lpmii->dxTab = MenuItem->dxTab;
1026  lpmii->lpstr = MenuItem->lpstr.Buffer;
1027  lpmii->maxBmpSize.cx = MenuItem->cxBmp;
1028  lpmii->maxBmpSize.cy = MenuItem->cyBmp;
1029  }
1030 
1031  return TRUE;
1032 }
INT cxBmp
Definition: ntuser.h:384
DWORD_PTR dwItemData
Definition: ntuser.h:375
LPWSTR lpstr
Definition: menu.h:118
UINT wID
Definition: ntuser.h:369
#define MIIM_FTYPE
Definition: winuser.h:724
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define TRUE
Definition: types.h:120
UINT fState
Definition: ntuser.h:368
LONG NTSTATUS
Definition: precomp.h:26
#define MF_STRING
Definition: winuser.h:138
HBITMAP hbmpUnchecked
Definition: menu.h:110
LONG top
Definition: windef.h:307
ULONG cyItem
Definition: ntuser.h:379
ULONG yItem
Definition: ntuser.h:377
SIZE maxBmpSize
Definition: menu.h:119
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
LONG left
Definition: windef.h:306
#define MENU_ITEM_TYPE(flags)
Definition: menu.c:24
LONG right
Definition: windef.h:308
UNICODE_STRING lpstr
Definition: ntuser.h:387
#define MIIM_BITMAP
Definition: winuser.h:723
#define MIIM_SUBMENU
Definition: winuser.h:718
#define FALSE
Definition: types.h:117
#define MIIM_STATE
Definition: winuser.h:716
ULONG cxItem
Definition: ntuser.h:378
LONG cx
Definition: windef.h:334
ULONG dxTab
Definition: ntuser.h:380
#define MIIM_ID
Definition: winuser.h:717
HBITMAP hbmpItem
Definition: menu.h:114
Status
Definition: gdiplustypes.h:24
DWORD dwItemData
Definition: menu.h:111
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
HANDLE hbmpUnchecked
Definition: ntuser.h:372
HBITMAP hbmp
Definition: ntuser.h:383
struct tagMENU * spSubMenu
Definition: ntuser.h:370
#define MIIM_TYPE
Definition: winuser.h:720
ULONG xItem
Definition: ntuser.h:376
HANDLE hbmpChecked
Definition: ntuser.h:371
#define MIIM_CHECKMARKS
Definition: winuser.h:719
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
#define MIIM_STRING
Definition: winuser.h:722
HMENU hSubMenu
Definition: menu.h:108
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
LONG bottom
Definition: windef.h:309
HBITMAP hbmpChecked
Definition: menu.h:109
LPWSTR dwTypeData
Definition: menu.h:112
INT cyBmp
Definition: ntuser.h:385
#define MIIM_DATA
Definition: winuser.h:721
UINT fType
Definition: ntuser.h:367
LONG cy
Definition: windef.h:335

Referenced by IntMenuItemInfo(), and UserMenuItemInfo().

◆ IntGetMenuItemRect()

BOOL FASTCALL IntGetMenuItemRect ( PWND  pWnd,
PMENU  Menu,
UINT  uItem,
PRECTL  Rect 
)

Definition at line 5230 of file menu.c.

5235 {
5236  LONG XMove, YMove;
5237  PITEM MenuItem;
5238  UINT I = uItem;
5239 
5240  if ((MenuItem = MENU_FindItem (&Menu, &I, MF_BYPOSITION)))
5241  {
5242  Rect->left = MenuItem->xItem;
5243  Rect->top = MenuItem->yItem;
5244  Rect->right = MenuItem->cxItem; // Do this for now......
5245  Rect->bottom = MenuItem->cyItem;
5246  }
5247  else
5248  {
5249  ERR("Failed Item Lookup! %u\n", uItem);
5250  return FALSE;
5251  }
5252 
5253  if (!pWnd)
5254  {
5255  HWND hWnd = Menu->hWnd;
5256  if (!(pWnd = UserGetWindowObject(hWnd))) return FALSE;
5257  }
5258 
5259  if (Menu->fFlags & MNF_POPUP)
5260  {
5261  XMove = pWnd->rcClient.left;
5262  YMove = pWnd->rcClient.top;
5263  }
5264  else
5265  {
5266  XMove = pWnd->rcWindow.left;
5267  YMove = pWnd->rcWindow.top;
5268  }
5269 
5270  Rect->left += XMove;
5271  Rect->top += YMove;
5272  Rect->right += XMove;
5273  Rect->bottom += YMove;
5274 
5275  return TRUE;
5276 }
HWND hWnd
Definition: ntuser.h:432
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:307
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:509
ULONG cyItem
Definition: ntuser.h:379
ULONG yItem
Definition: ntuser.h:377
RECT rcClient
Definition: ntuser.h:712
LONG left
Definition: windef.h:306
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define MF_BYPOSITION
Definition: winuser.h:203
ULONG cxItem
Definition: ntuser.h:378
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:134
ULONG xItem
Definition: ntuser.h:376
#define I(s)
RECT rcWindow
Definition: ntuser.h:711
#define ERR(fmt,...)
Definition: debug.h:110
unsigned int UINT
Definition: ndis.h:50
#define MNF_POPUP
Definition: ntuser.h:397
ULONG fFlags
Definition: ntuser.h:413

Referenced by NtUserGetMenuBarInfo().

◆ IntGetMenuObject()

PMENU FASTCALL IntGetMenuObject ( HMENU  hMenu)

Definition at line 194 of file menu.c.

195 {
196  PMENU Menu = UserGetMenuObject(hMenu);
197  if (Menu)
198  Menu->head.cLockObj++;
199 
200  return Menu;
201 }
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
PROCDESKHEAD head
Definition: ntuser.h:412

Referenced by IntSetMenu(), NtUserCallTwoParam(), and NtUserSetSystemMenu().

◆ IntGetMenuState()

UINT FASTCALL IntGetMenuState ( HMENU  hMenu,
UINT  uId,
UINT  uFlags 
)

Definition at line 4975 of file menu.c.

4976 {
4977  PMENU MenuObject;
4978  PITEM pItem;
4979 
4980  if (!(MenuObject = UserGetMenuObject(hMenu)))
4981  {
4982  return (UINT)-1;
4983  }
4984 
4985  if (!(pItem = MENU_FindItem( &MenuObject, &uId, uFlags ))) return -1;
4986 
4987  if (pItem->spSubMenu)
4988  {
4989  return (pItem->spSubMenu->cItems << 8) | ((pItem->fState|pItem->fType|MF_POPUP) & 0xff);
4990  }
4991  else
4992  return (pItem->fType | pItem->fState);
4993 }
UINT fState
Definition: ntuser.h:368
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:509
UINT uFlags
Definition: api.c:59
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
struct tagMENU * spSubMenu
Definition: ntuser.h:370
#define MF_POPUP
Definition: winuser.h:136
unsigned int UINT
Definition: ndis.h:50
UINT fType
Definition: ntuser.h:367

Referenced by co_IntTranslateAccelerator(), NC_DoButton(), NC_HandleNCLButtonDblClk(), and UserDrawCaptionButton().

◆ IntGetSubMenu()

HMENU FASTCALL IntGetSubMenu ( HMENU  hMenu,
int  nPos 
)

Definition at line 4995 of file menu.c.

4996 {
4997  PMENU MenuObject;
4998  PITEM pItem;
4999 
5000  if (!(MenuObject = UserGetMenuObject(hMenu)))
5001  {
5002  return NULL;
5003  }
5004 
5005  if (!(pItem = MENU_FindItem( &MenuObject, (UINT*)&nPos, MF_BYPOSITION ))) return NULL;
5006 
5007  if (pItem->spSubMenu)
5008  {
5009  HMENU hsubmenu = UserHMGetHandle(pItem->spSubMenu);
5010  return hsubmenu;
5011  }
5012  return NULL;
5013 }
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:509
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
#define MF_BYPOSITION
Definition: winuser.h:203
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
struct tagMENU * spSubMenu
Definition: ntuser.h:370
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by IntGetSystemMenu().

◆ IntGetSystemMenu()

PMENU FASTCALL IntGetSystemMenu ( PWND  Window,
BOOL  bRevert 
)

Definition at line 5383 of file menu.c.

5384 {
5385  PMENU Menu;
5386 
5387  if (bRevert)
5388  {
5389  if (Window->SystemMenu)
5390  {
5391  Menu = UserGetMenuObject(Window->SystemMenu);
5392  if (Menu && !(Menu->fFlags & MNF_SYSDESKMN))
5393  {
5394  IntDestroyMenuObject(Menu, TRUE);
5395  Window->SystemMenu = NULL;
5396  }
5397  }
5398  }
5399  else
5400  {
5401  Menu = Window->SystemMenu ? UserGetMenuObject(Window->SystemMenu) : NULL;
5402  if ((!Menu || Menu->fFlags & MNF_SYSDESKMN) && Window->style & WS_SYSMENU)
5403  {
5404  Menu = MENU_GetSystemMenu(Window, NULL);
5405  Window->SystemMenu = Menu ? UserHMGetHandle(Menu) : NULL;
5406  }
5407  }
5408 
5409  if (Window->SystemMenu)
5410  {
5411  HMENU hMenu = IntGetSubMenu( Window->SystemMenu, 0);
5412  /* Store the dummy sysmenu handle to facilitate the refresh */
5413  /* of the close button if the SC_CLOSE item change */
5414  Menu = UserGetMenuObject(hMenu);
5415  if (Menu)
5416  {
5417  Menu->spwndNotify = Window;
5418  Menu->fFlags |= MNF_SYSSUBMENU;
5419  }
5420  return Menu;
5421  }
5422  return NULL;
5423 }
#define TRUE
Definition: types.h:120
struct _WND * spwndNotify
Definition: ntuser.h:420
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:319
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
Definition: window.c:28
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
int Window
Definition: x11stubs.h:26
HMENU FASTCALL IntGetSubMenu(HMENU hMenu, int nPos)
Definition: menu.c:4995
#define MNF_SYSDESKMN
Definition: ntuser.h:402
#define NULL
Definition: types.h:112
#define MNF_SYSSUBMENU
Definition: ntuser.h:403
ULONG fFlags
Definition: ntuser.h:413
#define WS_SYSMENU
Definition: pedump.c:629
PMENU FASTCALL MENU_GetSystemMenu(PWND Window, PMENU Popup)
Definition: menu.c:5278
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by IntDefWindowProc(), MENU_TrackMouseMenuBar(), NC_DoButton(), NC_HandleNCLButtonDblClk(), NC_HandleNCRButtonDown(), NtUserGetMenuBarInfo(), NtUserGetSystemMenu(), and UserDrawCaptionButton().

◆ intGetTitleBarInfo()

BOOLEAN APIENTRY intGetTitleBarInfo ( PWND  pWindowObject,
PTITLEBARINFO  bti 
)

Definition at line 4804 of file menu.c.

4805 {
4806 
4807  DWORD dwStyle = 0;
4808  DWORD dwExStyle = 0;
4809  BOOLEAN retValue = TRUE;
4810 
4811  if (bti->cbSize == sizeof(TITLEBARINFO))
4812  {
4813  RtlZeroMemory(&bti->rgstate[0],sizeof(DWORD)*(CCHILDREN_TITLEBAR+1));
4814 
4815  bti->rgstate[0] = STATE_SYSTEM_FOCUSABLE;
4816 
4817  dwStyle = pWindowObject->style;
4818  dwExStyle = pWindowObject->ExStyle;
4819 
4820  bti->rcTitleBar.top = 0;
4821  bti->rcTitleBar.left = 0;
4822  bti->rcTitleBar.right = pWindowObject->rcWindow.right - pWindowObject->rcWindow.left;
4823  bti->rcTitleBar.bottom = pWindowObject->rcWindow.bottom - pWindowObject->rcWindow.top;
4824 
4825  /* Is it iconiced ? */
4826  if ((dwStyle & WS_ICONIC)!=WS_ICONIC)
4827  {
4828  /* Remove frame from rectangle */
4829  if (HAS_THICKFRAME( dwStyle, dwExStyle ))
4830  {
4831  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXFRAME) and UserGetSystemMetrics(SM_CYFRAME) */
4833  }
4834  else if (HAS_DLGFRAME( dwStyle, dwExStyle ))
4835  {
4836  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXDLGFRAME) and UserGetSystemMetrics(SM_CYDLGFRAME) */
4838  }
4839  else if (HAS_THINFRAME( dwStyle, dwExStyle))
4840  {
4841  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXBORDER) and UserGetSystemMetrics(SM_CYBORDER) */
4843  }
4844 
4845  /* We have additional border information if the window
4846  * is a child (but not an MDI child) */
4847  if ( (dwStyle & WS_CHILD) &&
4848  ((dwExStyle & WS_EX_MDICHILD) == 0 ) )
4849  {
4850  if (dwExStyle & WS_EX_CLIENTEDGE)
4851  {
4852  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXEDGE) and UserGetSystemMetrics(SM_CYEDGE) */
4854  }
4855 
4856  if (dwExStyle & WS_EX_STATICEDGE)
4857  {
4858  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXBORDER) and UserGetSystemMetrics(SM_CYBORDER) */
4860  }
4861  }
4862  }
4863 
4864  bti->rcTitleBar.top += pWindowObject->rcWindow.top;
4865  bti->rcTitleBar.left += pWindowObject->rcWindow.left;
4866  bti->rcTitleBar.right += pWindowObject->rcWindow.left;
4867 
4868  bti->rcTitleBar.bottom = bti->rcTitleBar.top;
4869  if (dwExStyle & WS_EX_TOOLWINDOW)
4870  {
4871  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CYSMCAPTION) */
4873  }
4874  else
4875  {
4876  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CYCAPTION) and UserGetSystemMetrics(SM_CXSIZE) */
4879  }
4880 
4881  if (dwStyle & WS_CAPTION)
4882  {
4883  bti->rgstate[1] = STATE_SYSTEM_INVISIBLE;
4884  if (dwStyle & WS_SYSMENU)
4885  {
4886  if (!(dwStyle & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX)))
4887  {
4888  bti->rgstate[2] = STATE_SYSTEM_INVISIBLE;
4889  bti->rgstate[3] = STATE_SYSTEM_INVISIBLE;
4890  }
4891  else
4892  {
4893  if (!(dwStyle & WS_MINIMIZEBOX))
4894  {
4896  }
4897  if (!(dwStyle & WS_MAXIMIZEBOX))
4898  {
4900  }
4901  }
4902 
4903  if (!(dwExStyle & WS_EX_CONTEXTHELP))
4904  {
4905  bti->rgstate[4] = STATE_SYSTEM_INVISIBLE;
4906  }
4907  if (pWindowObject->pcls->style & CS_NOCLOSE)
4908  {
4910  }
4911  }
4912  else
4913  {
4914  bti->rgstate[2] = STATE_SYSTEM_INVISIBLE;
4915  bti->rgstate[3] = STATE_SYSTEM_INVISIBLE;
4916  bti->rgstate[4] = STATE_SYSTEM_INVISIBLE;
4917  bti->rgstate[5] = STATE_SYSTEM_INVISIBLE;
4918  }
4919  }
4920  else
4921  {
4922  bti->rgstate[0] |= STATE_SYSTEM_INVISIBLE;
4923  }
4924  }
4925  else
4926  {
4928  retValue = FALSE;
4929  }
4930 
4931  return retValue;
4932 }
#define CCHILDREN_TITLEBAR
Definition: winuser.h:3747
#define WS_EX_CONTEXTHELP
Definition: winuser.h:386
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
DWORD ExStyle
Definition: ntuser.h:699
#define STATE_SYSTEM_UNAVAILABLE
Definition: winuser.h:2852
#define STATE_SYSTEM_FOCUSABLE
Definition: winuser.h:2872
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
#define TRUE
Definition: types.h:120
LONG top
Definition: windef.h:307
#define CS_NOCLOSE
Definition: winuser.h:649
#define SM_CXEDGE
Definition: winuser.h:1002
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:306
#define SM_CYFRAME
Definition: winuser.h:990
#define SM_CXFRAME
Definition: winuser.h:988
LONG right
Definition: windef.h:308
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define WS_EX_MDICHILD
Definition: winuser.h:394
UINT style
Definition: ntuser.h:575
#define FALSE
Definition: types.h:117
#define SM_CYDLGFRAME
Definition: winuser.h:962
unsigned char BOOLEAN
#define HAS_THINFRAME(Style, ExStyle)
Definition: window.h:16
#define HAS_THICKFRAME(Style, ExStyle)
Definition: window.h:12
#define SM_CYEDGE
Definition: winuser.h:1003
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#define WS_CAPTION
Definition: pedump.c:624
#define SM_CYCAPTION
Definition: winuser.h:957
#define WS_ICONIC
Definition: pedump.c:641
#define SM_CXDLGFRAME
Definition: winuser.h:960
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SM_CYBORDER
Definition: winuser.h:959
#define SM_CXBORDER
Definition: winuser.h:958
RECT rcWindow
Definition: ntuser.h:711
DWORD rgstate[CCHILDREN_TITLEBAR+1]
Definition: winuser.h:3752
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define SM_CXSIZE
Definition: winuser.h:985
#define HAS_DLGFRAME(Style, ExStyle)
Definition: window.h:8
LONG bottom
Definition: windef.h:309
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define WS_SYSMENU
Definition: pedump.c:629
#define SM_CYSMCAPTION
Definition: winuser.h:1008
#define WS_EX_STATICEDGE
Definition: winuser.h:403
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
#define STATE_SYSTEM_INVISIBLE
Definition: winuser.h:2867
PCLS pcls
Definition: ntuser.h:715
DWORD style
Definition: ntuser.h:701

Referenced by NtUserGetTitleBarInfo().

◆ IntHiliteMenuItem()

BOOL FASTCALL IntHiliteMenuItem ( PWND  WindowObject,
PMENU  MenuObject,
UINT  uItemHilite,
UINT  uHilite 
)

Definition at line 4778 of file menu.c.

4782 {
4783  PITEM MenuItem;
4784  UINT uItem = uItemHilite;
4785 
4786  if (!(MenuItem = MENU_FindItem( &MenuObject, &uItem, uHilite ))) return TRUE;
4787 
4788  if (uHilite & MF_HILITE)
4789  {
4790  MenuItem->fState |= MF_HILITE;
4791  }
4792  else
4793  {
4794  MenuItem->fState &= ~MF_HILITE;
4795  }
4796  if (MenuObject->iItem == uItemHilite) return TRUE;
4797  MENU_HideSubPopups( WindowObject, MenuObject, FALSE, 0 );
4798  MENU_SelectItem( WindowObject, MenuObject, uItemHilite, TRUE, 0 );
4799 
4800  return TRUE; // Always returns true!!!!
4801 }
#define TRUE
Definition: types.h:120
UINT fState
Definition: ntuser.h:368
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:509
#define FALSE
Definition: types.h:117
#define MF_HILITE
Definition: winuser.h:205
static void FASTCALL MENU_SelectItem(PWND pwndOwner, PMENU menu, UINT wIndex, BOOL sendMenuSelect, PMENU topmenu)
Definition: menu.c:3141
static void FASTCALL MENU_HideSubPopups(PWND pWndOwner, PMENU Menu, BOOL SendMenuSelect, UINT wFlags)
Definition: menu.c:3264
unsigned int UINT
Definition: ndis.h:50
INT iItem
Definition: ntuser.h:414

Referenced by NtUserHiliteMenuItem().

◆ IntInsertMenuItem()

BOOL FASTCALL IntInsertMenuItem ( _In_ PMENU  MenuObject,
UINT  uItem,
BOOL  fByPosition,
PROSMENUITEMINFO  ItemInfo,
PUNICODE_STRING  lpstr 
)

Definition at line 693 of file menu.c.

699 {
700  PITEM MenuItem;
701  PMENU SubMenu = NULL;
702 
703  NT_ASSERT(MenuObject != NULL);
704 
705  if (MAX_MENU_ITEMS <= MenuObject->cItems)
706  {
708  return FALSE;
709  }
710 
711  SubMenu = MenuObject;
712 
713  if(!(MenuItem = MENU_InsertItem( SubMenu, uItem, fByPosition ? MF_BYPOSITION : MF_BYCOMMAND, &SubMenu, &uItem ))) return FALSE;
714 
715  if(!IntSetMenuItemInfo(SubMenu, MenuItem, ItemInfo, lpstr))
716  {
717  IntRemoveMenuItem(SubMenu, uItem, fByPosition ? MF_BYPOSITION : MF_BYCOMMAND, FALSE);
718  return FALSE;
719  }
720 
721  /* Force size recalculation! */
722  SubMenu->cyMenu = 0;
723  MenuItem->hbmpChecked = MenuItem->hbmpUnchecked = 0;
724 
725  TRACE("IntInsertMenuItemToList = %u %i\n", uItem, (BOOL)((INT)uItem >= 0));
726 
727  return TRUE;
728 }
#define MF_BYCOMMAND
Definition: winuser.h:202
#define TRUE
Definition: types.h:120
BOOL FASTCALL IntSetMenuItemInfo(PMENU MenuObject, PITEM MenuItem, PROSMENUITEMINFO lpmii, PUNICODE_STRING lpstr)
Definition: menu.c:1035
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
BOOL FASTCALL IntRemoveMenuItem(PMENU pMenu, UINT nPos, UINT wFlags, BOOL bRecurse)
Definition: menu.c:598
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MF_BYPOSITION
Definition: winuser.h:203
ULONG cyMenu
Definition: ntuser.h:418
#define TRACE(s)
Definition: solgame.cpp:4
HANDLE hbmpUnchecked
Definition: ntuser.h:372
HANDLE hbmpChecked
Definition: ntuser.h:371
#define NULL
Definition: types.h:112
static LPCSTR lpstr
Definition: font.c:51
ITEM * MENU_InsertItem(PMENU menu, UINT pos, UINT flags, PMENU *submenu, UINT *npos)
Definition: menu.c:641
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
#define NT_ASSERT
Definition: rtlfuncs.h:3310

Referenced by MENU_GetSystemMenu(), and UserInsertMenuItem().

◆ IntIsMenu()

BOOL FASTCALL IntIsMenu ( HMENU  Menu)

Definition at line 242 of file menu.c.

243 {
244  if (UserGetMenuObject(Menu)) return TRUE;
245  return FALSE;
246 }
#define TRUE
Definition: types.h:120
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
#define FALSE
Definition: types.h:117

◆ IntMenuItemFromPoint()

INT FASTCALL IntMenuItemFromPoint ( PWND  pWnd,
HMENU  hMenu,
POINT  ptScreen 
)

Definition at line 1520 of file menu.c.

1521 {
1522  MENU *menu = UserGetMenuObject(hMenu);
1523  UINT pos;
1524 
1525  /*FIXME: Do we have to handle hWnd here? */
1526  if (!menu) return -1;
1527  if (!MENU_FindItemByCoords(menu, ptScreen, &pos)) return -1;
1528  return pos;
1529 }
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
unsigned int UINT
Definition: ndis.h:50
static ITEM * MENU_FindItemByCoords(MENU *menu, POINT pt, UINT *pos)
Definition: menu.c:1482

Referenced by IntDefWindowProc().

◆ IntMenuItemInfo()

BOOL FASTCALL IntMenuItemInfo ( PMENU  Menu,
UINT  Item,
BOOL  ByPosition,
PROSMENUITEMINFO  ItemInfo,
BOOL  SetOrGet,
PUNICODE_STRING  lpstr 
)

Definition at line 5076 of file menu.c.

5083 {
5084  PITEM MenuItem;
5085  BOOL Ret;
5086 
5087  if (!(MenuItem = MENU_FindItem( &Menu, &Item, (ByPosition ? MF_BYPOSITION : MF_BYCOMMAND) )))
5088  {
5090  return( FALSE);
5091  }
5092  if (SetOrGet)
5093  {
5094  Ret = IntSetMenuItemInfo(Menu, MenuItem, ItemInfo, lpstr);
5095  }
5096  else
5097  {
5098  Ret = IntGetMenuItemInfo(Menu, MenuItem, ItemInfo);
5099  }
5100  return( Ret);
5101 }
#define MF_BYCOMMAND
Definition: winuser.h:202
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:509
BOOL FASTCALL IntSetMenuItemInfo(PMENU MenuObject, PITEM MenuItem, PROSMENUITEMINFO lpmii, PUNICODE_STRING lpstr)
Definition: menu.c:1035
BOOL FASTCALL IntGetMenuItemInfo(PMENU Menu, PITEM MenuItem, PROSMENUITEMINFO lpmii)
Definition: menu.c:964
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MF_BYPOSITION
Definition: winuser.h:203
#define ERROR_MENU_ITEM_NOT_FOUND
Definition: winerror.h:937
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
static LPCSTR lpstr
Definition: font.c:51
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by MENU_GetSystemMenu().

◆ IntRemoveMenuItem()

BOOL FASTCALL IntRemoveMenuItem ( PMENU  pMenu,
UINT  nPos,
UINT  wFlags,
BOOL  bRecurse 
)

Definition at line 598 of file menu.c.

599 {
600  PITEM item;
601  PITEM newItems;
602 
603  TRACE("(menu=%p pos=%04x flags=%04x)\n",pMenu, nPos, wFlags);
604  if (!(item = MENU_FindItem( &pMenu, &nPos, wFlags ))) return FALSE;
605 
606  /* Remove item */
607 
608  FreeMenuText(pMenu,item);
609  if (bRecurse && item->spSubMenu)
610  {
611  IntDestroyMenuObject(item->spSubMenu, bRecurse);
612  }
614  if (--pMenu->cItems == 0)
615  {
616  DesktopHeapFree(pMenu->head.rpdesk, pMenu->rgItems );
617  pMenu->rgItems = NULL;
618  }
619  else
620  {
621  while (nPos < pMenu->cItems)
622  {
623  *item = *(item+1);
624  item++;
625  nPos++;
626  }
627  newItems = DesktopHeapReAlloc(pMenu->head.rpdesk, pMenu->rgItems, pMenu->cItems * sizeof(ITEM));
628  if (newItems)
629  {
630  pMenu->rgItems = newItems;
631  }
632  }
633  return TRUE;
634 }
Definition: fontsub.cpp:35
static __inline PVOID DesktopHeapReAlloc(IN PDESKTOP Desktop, IN PVOID lpMem, IN SIZE_T Bytes)
Definition: desktop.h:226
#define TRUE
Definition: types.h:120
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:509
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:319
#define FALSE
Definition: types.h:117
PROCDESKHEAD head
Definition: ntuser.h:412
#define TRACE(s)
Definition: solgame.cpp:4
UINT cItems
Definition: ntuser.h:416
PITEM rgItems
Definition: ntuser.h:421
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531
static ATOM item
Definition: dde.c:856
#define NULL
Definition: types.h:112
static __inline BOOL DesktopHeapFree(IN PDESKTOP Desktop, IN PVOID lpMem)
Definition: desktop.h:215
struct _DESKTOP * rpdesk
Definition: ntuser.h:219
#define FreeMenuText(Menu, MenuItem)
Definition: menu.c:185

Referenced by IntInsertMenuItem(), MENU_GetSystemMenu(), NtUserDeleteMenu(), and NtUserRemoveMenu().

◆ IntSetMenu()

BOOL FASTCALL IntSetMenu ( PWND  Wnd,
HMENU  Menu,
BOOL Changed 
)

Definition at line 5459 of file menu.c.

5463 {
5464  PMENU OldMenu, NewMenu = NULL;
5465 
5466  if ((Wnd->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
5467  {
5468  ERR("SetMenu: Window is a Child 0x%p!\n",UserHMGetHandle(Wnd));
5470  return FALSE;
5471  }
5472 
5473  *Changed = (UlongToHandle(Wnd->IDMenu) != Menu);
5474  if (! *Changed)
5475  {
5476  return TRUE;
5477  }
5478 
5479  if (Wnd->IDMenu)
5480  {
5481  OldMenu = IntGetMenuObject(UlongToHandle(Wnd->IDMenu));
5482  ASSERT(NULL == OldMenu || OldMenu->hWnd == UserHMGetHandle(Wnd));
5483  }
5484  else
5485  {
5486  OldMenu = NULL;
5487  }
5488 
5489  if (NULL != Menu)
5490  {
5491  NewMenu = IntGetMenuObject(Menu);
5492  if (NULL == NewMenu)
5493  {
5494  if (NULL != OldMenu)
5495  {
5496  IntReleaseMenuObject(OldMenu);
5497  }
5499  return FALSE;
5500  }
5501  if (NULL != NewMenu->hWnd)
5502  {
5503  /* Can't use the same menu for two windows */
5504  if (NULL != OldMenu)
5505  {
5506  IntReleaseMenuObject(OldMenu);
5507  }
5509  return FALSE;
5510  }
5511 
5512  }
5513 
5514  Wnd->IDMenu = (UINT_PTR) Menu;
5515  if (NULL != NewMenu)
5516  {
5517  NewMenu->hWnd = UserHMGetHandle(Wnd);
5518  IntReleaseMenuObject(NewMenu);
5519  }
5520  if (NULL != OldMenu)
5521  {
5522  OldMenu->hWnd = NULL;
5523  IntReleaseMenuObject(OldMenu);
5524  }
5525 
5526  return TRUE;
5527 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
HWND hWnd
Definition: ntuser.h:432
#define TRUE
Definition: types.h:120
#define WS_CHILD
Definition: pedump.c:617
PMENU FASTCALL IntGetMenuObject(HMENU hMenu)
Definition: menu.c:194
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_MENU_HANDLE
Definition: winerror.h:882
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
UINT_PTR IDMenu
Definition: ntuser.h:726
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define ASSERT(a)
Definition: mode.c:44
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define ERR(fmt,...)
Definition: debug.h:110
#define WS_POPUP
Definition: pedump.c:616
#define NULL
Definition: types.h:112
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
DWORD style
Definition: ntuser.h:701

Referenced by IntCreateWindow(), and NtUserSetMenu().

◆ IntSetMenuContextHelpId()

BOOL FASTCALL IntSetMenuContextHelpId ( PMENU  Menu,
DWORD  dwContextHelpId 
)

Definition at line 874 of file menu.c.

875 {
876  Menu->dwContextHelpId = dwContextHelpId;
877  return TRUE;
878 }
#define TRUE
Definition: types.h:120
DWORD dwContextHelpId
Definition: ntuser.h:423

Referenced by NtUserSetMenuContextHelpId().

◆ IntSetMenuFlagRtoL()

BOOL FASTCALL IntSetMenuFlagRtoL ( PMENU  Menu)

Definition at line 866 of file menu.c.

867 {
868  ERR("SetMenuFlagRtoL\n");
869  Menu->fFlags |= MNF_RTOL;
870  return TRUE;
871 }
#define TRUE
Definition: types.h:120
#define ERR(fmt,...)
Definition: debug.h:110
#define MNF_RTOL
Definition: ntuser.h:400
ULONG fFlags
Definition: ntuser.h:413

Referenced by NtUserSetMenuFlagRtoL().

◆ IntSetMenuInfo()

BOOL FASTCALL IntSetMenuInfo ( PMENU  Menu,
PROSMENUINFO  lpmi 
)

Definition at line 916 of file menu.c.

917 {
918  if(lpmi->fMask & MIM_BACKGROUND)
919  Menu->hbrBack = lpmi->hbrBack;
920  if(lpmi->fMask & MIM_HELPID)
921  Menu->dwContextHelpId = lpmi->dwContextHelpID;
922  if(lpmi->fMask & MIM_MAXHEIGHT)
923  Menu->cyMax = lpmi->cyMax;
924  if(lpmi->fMask & MIM_MENUDATA)
925  Menu->dwMenuData = lpmi->dwMenuData;
926  if(lpmi->fMask & MIM_STYLE)
927  Menu->fFlags ^= (Menu->fFlags ^ lpmi->dwStyle) & MNS_STYLE_MASK;
928  if(lpmi->fMask & MIM_APPLYTOSUBMENUS)
929  {
930  int i;
931  PITEM item = Menu->rgItems;
932  for ( i = Menu->cItems; i; i--, item++)
933  {
934  if ( item->spSubMenu )
935  {
936  IntSetMenuInfo( item->spSubMenu, lpmi);
937  }
938  }
939  }
940  if (sizeof(MENUINFO) < lpmi->cbSize)
941  {
942  Menu->iItem = lpmi->iItem;
943  Menu->cyMenu = lpmi->cyMenu;
944  Menu->cxMenu = lpmi->cxMenu;
945  Menu->spwndNotify = lpmi->spwndNotify;
946  Menu->cxTextAlign = lpmi->cxTextAlign;
947  Menu->iTop = lpmi->iTop;
948  Menu->iMaxTop = lpmi->iMaxTop;
949  Menu->dwArrowsOn = lpmi->dwArrowsOn;
950 
951  Menu->TimeToHide = lpmi->TimeToHide;
952  Menu->hWnd = lpmi->Wnd;
953  }
954  if ( lpmi->fMask & MIM_STYLE)
955  {
956  if (lpmi->dwStyle & MNS_AUTODISMISS) FIXME("MNS_AUTODISMISS unimplemented wine\n");
957  if (lpmi->dwStyle & MNS_DRAGDROP) FIXME("MNS_DRAGDROP unimplemented wine\n");
958  if (lpmi->dwStyle & MNS_MODELESS) FIXME("MNS_MODELESS unimplemented wine\n");
959  }
960  return TRUE;
961 }
DWORD_PTR dwMenuData
Definition: ntuser.h:425
HWND hWnd
Definition: ntuser.h:432
#define MNS_MODELESS
Definition: winuser.h:751
INT iMaxTop
Definition: menu.h:92
HBRUSH hbrBack
Definition: ntuser.h:426
#define MNS_DRAGDROP
Definition: winuser.h:752
#define MNS_AUTODISMISS
Definition: winuser.h:753
#define TRUE
Definition: types.h:120
#define MNS_STYLE_MASK
Definition: menu.c:45
WORD cyMenu
Definition: menu.h:88
UINT iItem
Definition: menu.h:85
PWND spwndNotify
Definition: menu.h:90
struct _WND * spwndNotify
Definition: ntuser.h:420
BOOL TimeToHide
Definition: ntuser.h:433
DWORD cbSize
Definition: menu.h:76
HBRUSH hbrBack
Definition: menu.h:80
ULONG cxTextAlign
Definition: menu.h:89
UINT cyMax
Definition: menu.h:79
ULONG cxTextAlign
Definition: ntuser.h:419
#define FIXME(fmt,...)
Definition: debug.h:111
ULONG cyMenu
Definition: ntuser.h:418
INT iTop
Definition: ntuser.h:427
DWORD dwContextHelpId
Definition: ntuser.h:423
BOOL FASTCALL IntSetMenuInfo(PMENU Menu, PROSMENUINFO lpmi)
Definition: menu.c:916
INT iTop
Definition: menu.h:91
DWORD dwArrowsOn
Definition: ntuser.h:429
ULONG cyMax
Definition: ntuser.h:424
DWORD dwArrowsOn
Definition: menu.h:93
UINT cItems
Definition: ntuser.h:416
DWORD dwContextHelpID
Definition: menu.h:81
PITEM rgItems
Definition: ntuser.h:421
WORD cxMenu
Definition: menu.h:87
static ATOM item
Definition: dde.c:856
DWORD fMask
Definition: menu.h:77
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
INT iMaxTop
Definition: ntuser.h:428
ULONG_PTR dwMenuData
Definition: menu.h:82
BOOL TimeToHide
Definition: menu.h:97
HWND Wnd
Definition: menu.h:96
ULONG fFlags
Definition: ntuser.h:413
ULONG cxMenu
Definition: ntuser.h:417
INT iItem
Definition: ntuser.h:414
DWORD dwStyle
Definition: menu.h:78

Referenced by UserMenuInfo().

◆ IntSetMenuItemInfo()

BOOL FASTCALL IntSetMenuItemInfo ( PMENU  MenuObject,
PITEM  MenuItem,
PROSMENUITEMINFO  lpmii,
PUNICODE_STRING  lpstr 
)

Definition at line 1035 of file menu.c.

1036 {
1037  PMENU SubMenuObject;
1038  BOOL circref = FALSE;
1039 
1040  if(!MenuItem || !MenuObject || !lpmii)
1041  {
1042  return FALSE;
1043  }
1044  if ( lpmii->fMask & MIIM_FTYPE )
1045  {
1046  MenuItem->fType &= ~MENUITEMINFO_TYPE_MASK;
1047  MenuItem->fType |= lpmii->fType & MENUITEMINFO_TYPE_MASK;
1048  }
1049  if (lpmii->fMask & MIIM_TYPE)
1050  {
1051  #if 0
1052  if (lpmii->fMask & ( MIIM_STRING | MIIM_FTYPE | MIIM_BITMAP))
1053  {
1054  ERR("IntSetMenuItemInfo: Invalid combination of fMask bits used\n");
1056  /* This does not happen on Win9x/ME */
1058  return FALSE;
1059  }
1060  #endif
1061  /*
1062  * Delete the menu item type when changing type from
1063  * MF_STRING.
1064  */
1065  if (MenuItem->fType != lpmii->fType &&
1066  MENU_ITEM_TYPE(MenuItem->fType) == MFT_STRING)
1067  {
1068  FreeMenuText(MenuObject,MenuItem);
1069  RtlInitUnicodeString(&MenuItem->lpstr, NULL);
1070  MenuItem->Xlpstr = NULL;
1071  }
1072  if(lpmii->fType & MFT_BITMAP)
1073  {
1074  if(lpmii->hbmpItem)
1075  MenuItem->hbmp = lpmii->hbmpItem;
1076  else
1077  { /* Win 9x/Me stuff */
1078  MenuItem->hbmp = (HBITMAP)((ULONG_PTR)(LOWORD(lpmii->dwTypeData)));
1079  }
1080  lpmii->dwTypeData = 0;
1081  }
1082  }
1083  if(lpmii->fMask & MIIM_BITMAP)
1084  {
1085  MenuItem->hbmp = lpmii->hbmpItem;
1086  if (MenuItem->hbmp <= HBMMENU_POPUP_MINIMIZE && MenuItem->hbmp >= HBMMENU_CALLBACK)
1087  MenuItem->fState |= MFS_HBMMENUBMP;
1088  else
1089  MenuItem->fState &= ~MFS_HBMMENUBMP;
1090  }
1091  if(lpmii->fMask & MIIM_CHECKMARKS)
1092  {
1093  MenuItem->hbmpChecked = lpmii->hbmpChecked;
1094  MenuItem->hbmpUnchecked = lpmii->hbmpUnchecked;
1095  }
1096  if(lpmii->fMask & MIIM_DATA)
1097  {
1098  MenuItem->dwItemData = lpmii->dwItemData;
1099  }
1100  if(lpmii->fMask & MIIM_ID)
1101  {
1102  MenuItem->wID = lpmii->wID;
1103  }
1104  if(lpmii->fMask & MIIM_STATE)
1105  {
1106  /* Remove MFS_DEFAULT flag from all other menu items if this item
1107  has the MFS_DEFAULT state */
1108  if(lpmii->fState & MFS_DEFAULT)
1109  UserSetMenuDefaultItem(MenuObject, -1, 0);
1110  /* Update the menu item state flags */
1111  UpdateMenuItemState(MenuItem->fState, lpmii->fState);
1112  }
1113 
1114  if(lpmii->fMask & MIIM_SUBMENU)
1115  {
1116  if (lpmii->hSubMenu)
1117  {
1118  SubMenuObject = UserGetMenuObject(lpmii->hSubMenu);
1119  if ( SubMenuObject && !(UserObjectInDestroy(lpmii->hSubMenu)) )
1120  {
1123  if (MenuObject == SubMenuObject)
1124  {
1125  HANDLE hMenu;
1126  ERR("Pop Up Menu Double Trouble!\n");
1127  SubMenuObject = IntCreateMenu(&hMenu,
1128  FALSE,
1129  MenuObject->head.rpdesk,
1130  (PPROCESSINFO)MenuObject->head.hTaskWow); // It will be marked.
1131  if (!SubMenuObject) return FALSE;
1132  IntReleaseMenuObject(SubMenuObject); // This will be referenced again after insertion.
1133  circref = TRUE;
1134  }
1135  if ( MENU_depth( SubMenuObject, 0) > MAXMENUDEPTH )
1136  {
1137  ERR( "Loop detected in menu hierarchy or maximum menu depth exceeded!\n");
1138  if (circref) IntDestroyMenuObject(SubMenuObject, FALSE);
1139  return FALSE;
1140  }
1141  /* Make sure the submenu is marked as a popup menu */
1142  SubMenuObject->fFlags |= MNF_POPUP;
1143  // Now fix the test_subpopup_locked_by_menu tests....
1144  if (MenuItem->spSubMenu) IntReleaseMenuObject(MenuItem->spSubMenu);
1145  MenuItem->spSubMenu = SubMenuObject;
1146  UserReferenceObject(SubMenuObject);
1147  }
1148  else
1149  {
1151  return FALSE;
1152  }
1153  }
1154  else
1155  { // If submenu just dereference it.
1156  if (MenuItem->spSubMenu) IntReleaseMenuObject(MenuItem->spSubMenu);
1157  MenuItem->spSubMenu = NULL;
1158  }
1159  }
1160 
1161  if ((lpmii->fMask & MIIM_STRING) ||
1162  ((lpmii->fMask & MIIM_TYPE) && (MENU_ITEM_TYPE(lpmii->fType) == MF_STRING)))
1163  {
1164  /* free the string when used */
1165  FreeMenuText(MenuObject,MenuItem);
1166  RtlInitUnicodeString(&MenuItem->lpstr, NULL);
1167  MenuItem->Xlpstr = NULL;
1168 
1169  if(lpmii->dwTypeData && lpmii->cch && lpstr && lpstr->Buffer)
1170  {
1172 
1173  if (!NT_VERIFY(lpmii->cch <= UNICODE_STRING_MAX_CHARS))
1174  {
1175  return FALSE;
1176  }
1177 
1178  Source.Length = Source.MaximumLength = (USHORT)(lpmii->cch * sizeof(WCHAR));
1179  Source.Buffer = lpmii->dwTypeData;
1180 
1181  MenuItem->lpstr.Buffer = DesktopHeapAlloc( MenuObject->head.rpdesk, Source.Length + sizeof(WCHAR));
1182  if(MenuItem->lpstr.Buffer != NULL)
1183  {
1184  MenuItem->lpstr.Length = 0;
1185  MenuItem->lpstr.MaximumLength = Source.Length + sizeof(WCHAR);
1186  RtlCopyUnicodeString(&MenuItem->lpstr, &Source);
1187  MenuItem->lpstr.Buffer[MenuItem->lpstr.Length / sizeof(WCHAR)] = 0;
1188 
1189  MenuItem->cch = MenuItem->lpstr.Length / sizeof(WCHAR);
1190  MenuItem->Xlpstr = (USHORT*)MenuItem->lpstr.Buffer;
1191  }
1192  }
1193  }
1194 
1195  if( !(MenuObject->fFlags & MNF_SYSMENU) &&
1196  !MenuItem->Xlpstr &&
1197  !lpmii->dwTypeData &&
1198  !(MenuItem->fType & MFT_OWNERDRAW) &&
1199  !MenuItem->hbmp)
1200  MenuItem->fType |= MFT_SEPARATOR;
1201 
1202  if (sizeof(ROSMENUITEMINFO) == lpmii->cbSize)
1203  {
1204  MenuItem->xItem = lpmii->Rect.left;
1205  MenuItem->yItem = lpmii->Rect.top;
1206  MenuItem->cxItem = lpmii->Rect.right; // Do this for now......
1207  MenuItem->cyItem = lpmii->Rect.bottom;
1208  MenuItem->dxTab = lpmii->dxTab;
1209  lpmii->lpstr = MenuItem->lpstr.Buffer; /* Send back new allocated string or zero */
1210  MenuItem->cxBmp = lpmii->maxBmpSize.cx;
1211  MenuItem->cyBmp = lpmii->maxBmpSize.cy;
1212  }
1213 
1214  return TRUE;
1215 }
#define MNF_SYSMENU
Definition: ntuser.h:405
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
INT cxBmp
Definition: ntuser.h:384
#define KeRosDumpStackFrames(Frames, Count)
Definition: gdidebug.h:11
DWORD_PTR dwItemData
Definition: ntuser.h:375
LPWSTR lpstr
Definition: menu.h:118
UINT wID
Definition: ntuser.h:369
#define MFT_STRING
Definition: winuser.h:741
#define MIIM_FTYPE
Definition: winuser.h:724
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define TRUE
Definition: types.h:120
BOOL FASTCALL UserSetMenuDefaultItem(PMENU MenuObject, UINT uItem, UINT fByPos)
Definition: menu.c:1276
UINT fState
Definition: ntuser.h:368
#define MF_STRING
Definition: winuser.h:138
ULONG cch
Definition: ntuser.h:374
HBITMAP hbmpUnchecked
Definition: menu.h:110
LONG top
Definition: windef.h:307
ULONG cyItem
Definition: ntuser.h:379
ULONG yItem
Definition: ntuser.h:377
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:319
SIZE maxBmpSize
Definition: menu.h:119
#define MFT_BITMAP
Definition: winuser.h:733
LONG left
Definition: windef.h:306
#define NT_VERIFY(exp)
Definition: rtlfuncs.h:3287
#define MENU_ITEM_TYPE(flags)
Definition: menu.c:24
#define MFS_DEFAULT
Definition: winuser.h:743
#define MAXMENUDEPTH
Definition: menu.c:43
LONG right
Definition: windef.h:308
UNICODE_STRING lpstr
Definition: ntuser.h:387
#define MIIM_BITMAP
Definition: winuser.h:723
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
int FASTCALL MENU_depth(PMENU pmenu, int depth)
Definition: menu.c:406
uint32_t ULONG_PTR
Definition: typedefs.h:65
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
#define MIIM_SUBMENU
Definition: winuser.h:718
static __inline PVOID DesktopHeapAlloc(IN PDESKTOP Desktop, IN SIZE_T Bytes)
Definition: desktop.h:204
#define FALSE
Definition: types.h:117
PROCDESKHEAD head
Definition: ntuser.h:412
#define MIIM_STATE
Definition: winuser.h:716
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG cxItem
Definition: ntuser.h:378
LONG cx
Definition: windef.h:334
#define UpdateMenuItemState(state, change)
Definition: menu.c:97
BOOL FASTCALL UserObjectInDestroy(HANDLE h)
Definition: object.c:703
ULONG dxTab
Definition: ntuser.h:380
#define MIIM_ID
Definition: winuser.h:717
HBITMAP hbmpItem
Definition: menu.h:114
#define HBMMENU_CALLBACK
Definition: winuser.h:2620
#define UNICODE_STRING_MAX_CHARS
DWORD dwItemData
Definition: menu.h:111
__wchar_t WCHAR
Definition: xmlstorage.h:180
HANDLE hbmpUnchecked
Definition: ntuser.h:372
HBITMAP hbmp
Definition: ntuser.h:383
#define HBMMENU_POPUP_MINIMIZE
Definition: winuser.h:2630
#define MFT_SEPARATOR
Definition: winuser.h:739
struct tagMENU * spSubMenu
Definition: ntuser.h:370
#define MIIM_TYPE
Definition: winuser.h:720
ULONG xItem
Definition: ntuser.h:376
HANDLE hbmpChecked
Definition: ntuser.h:371
#define MIIM_CHECKMARKS
Definition: winuser.h:719
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
#define ERR(fmt,...)
Definition: debug.h:110
#define MIIM_STRING
Definition: winuser.h:722
HMENU hSubMenu
Definition: menu.h:108
unsigned short USHORT
Definition: pedump.c:61
#define NULL
Definition: types.h:112
#define MFS_HBMMENUBMP
Definition: ntuser.h:363
DWORD_PTR hTaskWow
Definition: ntuser.h:218
#define MNF_POPUP
Definition: ntuser.h:397
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
LONG bottom
Definition: windef.h:309
HBITMAP hbmpChecked
Definition: menu.h:109
LPWSTR dwTypeData
Definition: menu.h:112
static LPCSTR lpstr
Definition: font.c:51
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
static HBITMAP
Definition: button.c:44
INT cyBmp
Definition: ntuser.h:385
#define MFT_OWNERDRAW
Definition: winuser.h:736
USHORT * Xlpstr
Definition: ntuser.h:373
#define MIIM_DATA
Definition: winuser.h:721
ULONG fFlags
Definition: ntuser.h:413
struct _DESKTOP * rpdesk
Definition: ntuser.h:219
PMENU FASTCALL IntCreateMenu(_Out_ PHANDLE Handle, _In_ BOOL IsMenuBar, _In_ PDESKTOP Desktop, _In_ PPROCESSINFO ppi)
Definition: menu.c:731
UINT fType
Definition: ntuser.h:367
LONG cy
Definition: windef.h:335
#define LOWORD(l)
Definition: pedump.c:82
#define MENUITEMINFO_TYPE_MASK
Definition: menu.c:47
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
#define FreeMenuText(Menu, MenuItem)
Definition: menu.c:185
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:731

Referenced by IntInsertMenuItem(), IntMenuItemInfo(), and UserMenuItemInfo().

◆ IntSetSystemMenu()

BOOL FASTCALL IntSetSystemMenu ( PWND  Window,
PMENU  Menu 
)

Definition at line 5426 of file menu.c.

5427 {
5428  PMENU OldMenu;
5429 
5430  if (!(Window->style & WS_SYSMENU)) return FALSE;
5431 
5432  if (Window->SystemMenu)
5433  {
5434  OldMenu = UserGetMenuObject(Window->SystemMenu);
5435  if (OldMenu)
5436  {
5437  OldMenu->fFlags &= ~MNF_SYSMENU;
5438  IntDestroyMenuObject(OldMenu, TRUE);
5439  }
5440  }
5441 
5442  OldMenu = MENU_GetSystemMenu(Window, Menu);
5443  if (OldMenu)
5444  { // Use spmenuSys too!
5445  Window->SystemMenu = UserHMGetHandle(OldMenu);
5446  }
5447  else
5448  Window->SystemMenu = NULL;
5449 
5450  if (Menu && Window != Menu->spwndNotify)
5451  {
5452  Menu->spwndNotify = Window;
5453  }
5454 
5455  return TRUE;
5456 }
#define MNF_SYSMENU
Definition: ntuser.h:405
#define TRUE
Definition: types.h:120
struct _WND * spwndNotify
Definition: ntuser.h:420
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:319
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
Definition: window.c:28
#define FALSE
Definition: types.h:117
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
int Window
Definition: x11stubs.h:26
#define NULL
Definition: types.h:112
ULONG fFlags
Definition: ntuser.h:413
#define WS_SYSMENU
Definition: pedump.c:629
PMENU FASTCALL MENU_GetSystemMenu(PWND Window, PMENU Popup)
Definition: menu.c:5278

Referenced by NtUserSetSystemMenu().

◆ IntTrackPopupMenuEx()

BOOL WINAPI IntTrackPopupMenuEx ( PMENU  menu,
UINT  wFlags,
int  x,
int  y,
PWND  pWnd,
LPTPMPARAMS  lpTpm 
)

Definition at line 4561 of file menu.c.

4563 {
4564  BOOL ret = FALSE;
4566 
4567  if (pti != pWnd->head.pti)
4568  {
4569  ERR("Must be the same pti!\n");
4570  return ret;
4571  }
4572 
4573  TRACE("hmenu %p flags %04x (%d,%d) hwnd %p lpTpm %p \n", //rect %s\n",
4574  UserHMGetHandle(menu), wFlags, x, y, UserHMGetHandle(pWnd), lpTpm); //,
4575  //lpTpm ? wine_dbgstr_rect( &lpTpm->rcExclude) : "-" );
4576 
4577  if (menu->hWnd && IntIsWindow(menu->hWnd))
4578  {
4580  return FALSE;
4581  }
4582 
4583  if (MENU_InitPopup( pWnd, menu, wFlags ))
4584  {
4585  MENU_InitTracking(pWnd, menu, TRUE, wFlags);
4586 
4587  /* Send WM_INITMENUPOPUP message only if TPM_NONOTIFY flag is not specified */
4588  if (!(wFlags & TPM_NONOTIFY))
4589  {
4591  }
4592 
4593  if (menu->fFlags & MNF_SYSMENU)
4594  MENU_InitSysMenuPopup( menu, pWnd->style, pWnd->pcls->style, HTSYSMENU);
4595 
4596  if (MENU_ShowPopup(pWnd, menu, 0, wFlags | TPM_POPUPMENU, x, y, lpTpm ? &lpTpm->rcExclude : NULL))
4597  ret = MENU_TrackMenu( menu, wFlags | TPM_POPUPMENU, 0, 0, pWnd);
4598  else
4599  {
4601  pti->MessageQueue->QF_flags &= ~QF_CAPTURELOCKED;
4602  co_UserSetCapture(NULL); /* release the capture */
4603  }
4604 
4605  MENU_ExitTracking(pWnd, TRUE, wFlags);
4606 
4607  if (menu->hWnd)
4608  {
4609  PWND pwndM = ValidateHwndNoErr( menu->hWnd );
4610  if (pwndM) // wine hack around this with their destroy function.
4611  {
4612  if (!(pWnd->state & WNDS_DESTROYED))
4613  co_UserDestroyWindow( pwndM ); // Fix wrong error return.
4614  }
4615  menu->hWnd = 0;
4616 
4617  if (!(wFlags & TPM_NONOTIFY))
4618  {
4619  co_IntSendMessage( UserHMGetHandle(pWnd), WM_UNINITMENUPOPUP, (WPARAM)UserHMGetHandle(menu),
4620  MAKELPARAM(0, IS_SYSTEM_MENU(menu)) );
4621  }
4622  }
4623  }
4624  return ret;
4625 }
#define MNF_SYSMENU
Definition: ntuser.h:405
HWND hWnd
Definition: ntuser.h:432
void FASTCALL MENU_InitSysMenuPopup(PMENU menu, DWORD style, DWORD clsStyle, LONG HitTest)
Definition: menu.c:1364
static INT FASTCALL MENU_TrackMenu(PMENU pmenu, UINT wFlags, INT x, INT y, PWND pwnd)
Definition: menu.c:4054
static BOOL MENU_InitPopup(PWND pWndOwner, PMENU menu, UINT flags)
Definition: menu.c:2783
#define TRUE
Definition: types.h:120
#define WM_INITMENUPOPUP
Definition: winuser.h:1736
#define TPM_POPUPMENU
Definition: menu.c:92
#define MAKELPARAM(l, h)
Definition: winuser.h:3998
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
static BOOL FASTCALL MENU_ShowPopup(PWND pwndOwner, PMENU menu, UINT id, UINT flags, INT x, INT y, const RECT *pExclude)
Definition: menu.c:2941
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
UINT_PTR WPARAM
Definition: windef.h:207
static BOOL FASTCALL MENU_ExitTracking(PWND pWnd, BOOL bPopup, UINT wFlags)
Definition: menu.c:4448
#define HTSYSMENU
Definition: winuser.h:2467
UINT style
Definition: ntuser.h:575
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2848
#define ERROR_POPUP_ALREADY_ACTIVE
Definition: winerror.h:927
#define QF_CAPTURELOCKED
Definition: msgqueue.h:111
THRDESKHEAD head
Definition: ntuser.h:690
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2551
#define TRACE(s)
Definition: solgame.cpp:4
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1458
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:188
#define TPM_NONOTIFY
Definition: winuser.h:2376
int ret
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:688
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
#define IS_SYSTEM_MENU(MenuInfo)
Definition: menu.c:60
DWORD state
Definition: ntuser.h:696
#define NULL
Definition: types.h:112
static BOOL FASTCALL MENU_InitTracking(PWND pWnd, PMENU Menu, BOOL bPopup, UINT wFlags)
Definition: menu.c:4388
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
ULONG fFlags
Definition: ntuser.h:413
RECT rcExclude
Definition: winuser.h:3566
#define MSQ_STATE_MENUOWNER
Definition: ntuser.h:3702
#define WNDS_DESTROYED
Definition: ntuser.h:631
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
PCLS pcls
Definition: ntuser.h:715
DWORD style
Definition: ntuser.h:701

Referenced by IntDefWindowProc(), and NtUserTrackPopupMenuEx().

◆ MENU_AdjustMenuItemRect()

VOID FASTCALL MENU_AdjustMenuItemRect ( PMENU  menu,
PRECTL  rect 
)

Definition at line 1464 of file menu.c.

1465 {
1466  if (menu->dwArrowsOn)
1467  {
1468  UINT arrow_bitmap_height;
1469  arrow_bitmap_height = gpsi->oembmi[OBI_UPARROW].cy;
1470  rect->top += arrow_bitmap_height - menu->iTop;
1471  rect->bottom += arrow_bitmap_height - menu->iTop;
1472  }
1473 }
PSERVERINFO gpsi
Definition: imm.c:18
& rect
Definition: startmenu.cpp:1413
INT iTop
Definition: ntuser.h:427
DWORD dwArrowsOn
Definition: ntuser.h:429
unsigned int UINT
Definition: ndis.h:50

Referenced by MENU_DrawMenuItem(), MENU_FindItemByCoords(), MENU_ShowSubPopup(), and NtUserMenuItemFromPoint().

◆ MENU_ButtonDown()

static BOOL FASTCALL MENU_ButtonDown ( MTRACKER pmt,
PMENU  PtMenu,
UINT  Flags 
)
static

Definition at line 3552 of file menu.c.

3553 {
3554  TRACE("%x PtMenu=%p\n", pmt, PtMenu);
3555 
3556  if (PtMenu)
3557  {
3558  UINT id = 0;
3559  PITEM item;
3560  if (IS_SYSTEM_MENU(PtMenu))
3561  {
3562  item = PtMenu->rgItems;
3563  }
3564  else
3565  {
3566  item = MENU_FindItemByCoords( PtMenu, pmt->Pt, &id );
3567  }
3568 
3569  if (item)
3570  {
3571  if (PtMenu->iItem != id)
3572  MENU_SwitchTracking(pmt, PtMenu, id, Flags);
3573 
3574  /* If the popup menu is not already "popped" */
3575  if (!(item->fState & MF_MOUSESELECT))
3576  {
3577  pmt->CurrentMenu = MENU_ShowSubPopup(pmt->OwnerWnd, PtMenu, FALSE, Flags);
3578  }
3579 
3580  return TRUE;
3581  }
3582  /* Else the click was on the menu bar, finish the tracking */
3583  }
3584  return FALSE;
3585 }
#define TRUE
Definition: types.h:120
static PMENU FASTCALL MENU_ShowSubPopup(PWND WndOwner, PMENU Menu, BOOL SelectFirst, UINT Flags)
Definition: menu.c:3315
PWND OwnerWnd
Definition: menu.c:85
PMENU CurrentMenu
Definition: menu.c:83
POINT Pt
Definition: menu.c:86
#define MF_MOUSESELECT
Definition: winuser.h:145
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
PITEM rgItems
Definition: ntuser.h:421
static ATOM item
Definition: dde.c:856
#define IS_SYSTEM_MENU(MenuInfo)
Definition: menu.c:60
unsigned int UINT
Definition: ndis.h:50
static void FASTCALL MENU_SwitchTracking(MTRACKER *pmt, PMENU PtMenu, UINT Index, UINT wFlags)
Definition: menu.c:3527
static ITEM * MENU_FindItemByCoords(MENU *menu, POINT pt, UINT *pos)
Definition: menu.c:1482
INT iItem
Definition: ntuser.h:414

Referenced by MENU_TrackMenu().

◆ MENU_ButtonUp()

static INT FASTCALL MENU_ButtonUp ( MTRACKER pmt,
PMENU  PtMenu,
UINT  Flags 
)
static

Definition at line 3595 of file menu.c.

3596 {
3597  TRACE("%p pmenu=%x\n", pmt, PtMenu);
3598 
3599  if (PtMenu)
3600  {
3601  UINT Id = 0;
3602  ITEM *item;
3603 
3604  if ( IS_SYSTEM_MENU(PtMenu) )
3605  {
3606  item = PtMenu->rgItems;
3607  }
3608  else
3609  {
3610  item = MENU_FindItemByCoords( PtMenu, pmt->Pt, &Id );
3611  }
3612 
3613  if (item && ( PtMenu->iItem == Id))
3614  {
3615  if (!(item->spSubMenu))
3616  {
3617  INT ExecutedMenuId = MENU_ExecFocusedItem( pmt, PtMenu, Flags);
3618  if (ExecutedMenuId == -1 || ExecutedMenuId == -2) return -1;
3619  return ExecutedMenuId;
3620  }
3621 
3622  /* If we are dealing with the menu bar */
3623  /* and this is a click on an already "popped" item: */
3624  /* Stop the menu tracking and close the opened submenus */
3625  if (pmt->TopMenu == PtMenu && PtMenu->TimeToHide)
3626  {
3627  return 0;
3628  }
3629  }
3630  if ( IntGetMenu(PtMenu->hWnd) == PtMenu )
3631  {
3632  PtMenu->TimeToHide = TRUE;
3633  }
3634  }
3635  return -1;
3636 }
Definition: fontsub.cpp:35
HWND hWnd
Definition: ntuser.h:432
PMENU WINAPI IntGetMenu(HWND hWnd)
Definition: menu.c:250
#define TRUE
Definition: types.h:120
BOOL TimeToHide
Definition: ntuser.h:433
int32_t INT
Definition: typedefs.h:58
DWORD Id
POINT Pt
Definition: menu.c:86
#define TRACE(s)
Definition: solgame.cpp:4
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
PITEM rgItems
Definition: ntuser.h:421
static INT FASTCALL MENU_ExecFocusedItem(MTRACKER *pmt, PMENU Menu, UINT Flags)
Definition: menu.c:3472
static ATOM item
Definition: dde.c:856
#define IS_SYSTEM_MENU(MenuInfo)
Definition: menu.c:60
unsigned int UINT
Definition: ndis.h:50
PMENU TopMenu
Definition: menu.c:84
static ITEM * MENU_FindItemByCoords(MENU *menu, POINT pt, UINT *pos)
Definition: menu.c:1482
INT iItem
Definition: ntuser.h:414

Referenced by MENU_TrackMenu().

◆ MENU_CalcItemSize()

static void FASTCALL MENU_CalcItemSize ( HDC  hdc,
PITEM  lpitem,
PMENU  Menu,
PWND  pwndOwner,
INT  orgX,
INT  orgY,
BOOL  menuBar,
BOOL  textandbmp 
)
static

Definition at line 1827 of file menu.c.

1829 {
1830  WCHAR *p;
1831  UINT check_bitmap_width = UserGetSystemMetrics( SM_CXMENUCHECK );
1832  UINT arrow_bitmap_width;
1833  RECT Rect;
1834  INT itemheight = 0;
1835 
1836  TRACE("dc=%x owner=%x (%d,%d)\n", hdc, pwndOwner, orgX, orgY);
1837 
1838  arrow_bitmap_width = gpsi->oembmi[OBI_MNARROW].cx;
1839 
1841 
1842  RECTL_vSetRect( &Rect, orgX, orgY, orgX, orgY );
1843 
1844  if (lpitem->fType & MF_OWNERDRAW)
1845  {
1846  MEASUREITEMSTRUCT mis;
1847  mis.CtlType = ODT_MENU;
1848  mis.CtlID = 0;
1849  mis.itemID = lpitem->wID;
1850  mis.itemData = lpitem->dwItemData;
1852  mis.itemWidth = 0;
1853  co_IntSendMessage( UserHMGetHandle(pwndOwner), WM_MEASUREITEM, 0, (LPARAM)&mis );
1854  /* Tests reveal that Windows ( Win95 thru WinXP) adds twice the average
1855  * width of a menufont character to the width of an owner-drawn menu.
1856  */
1857  Rect.right += mis.itemWidth + 2 * MenuCharSize.cx;
1858  if (menuBar) {
1859  /* under at least win95 you seem to be given a standard
1860  height for the menu and the height value is ignored */
1862  } else
1863  Rect.bottom += mis.itemHeight;
1864  // Or this,
1865  //lpitem->cxBmp = mis.itemWidth;
1866  //lpitem->cyBmp = mis.itemHeight;
1867  TRACE("MF_OWNERDRAW Height %d Width %d\n",mis.itemHeight,mis.itemWidth);
1868  TRACE("MF_OWNERDRAW id=%04lx size=%dx%d cx %d cy %d\n",
1869  lpitem->wID, Rect.right-Rect.left,
1870  Rect.bottom-Rect.top, MenuCharSize.cx, MenuCharSize.cy);
1871 
1872  lpitem->xItem = Rect.left;
1873  lpitem->yItem = Rect.top;
1874  lpitem->cxItem = Rect.right;
1875  lpitem->cyItem = Rect.bottom;
1876 
1877  return;
1878  }
1879 
1880  lpitem->xItem = orgX;
1881  lpitem->yItem = orgY;
1882  lpitem->cxItem = orgX;
1883  lpitem->cyItem = orgY;
1884 
1885  if (lpitem->fType & MF_SEPARATOR)
1886  {
1887  lpitem->cyItem += UserGetSystemMetrics( SM_CYMENUSIZE)/2;//SEPARATOR_HEIGHT;
1888  if( !menuBar)
1889  lpitem->cxItem += arrow_bitmap_width + MenuCharSize.cx;
1890  return;
1891  }
1892 
1893  lpitem->dxTab = 0;
1894 
1895  if (lpitem->hbmp)
1896  {
1897  SIZE size;
1898 
1899  if (!menuBar) {
1900  MENU_GetBitmapItemSize(lpitem, &size, pwndOwner );
1901  /* Keep the size of the bitmap in callback mode to be able
1902  * to draw it correctly */
1903  lpitem->cxBmp = size.cx;
1904  lpitem->cyBmp = size.cy;
1905  Menu->cxTextAlign = max(Menu->cxTextAlign, size.cx);
1906  lpitem->cxItem += size.cx + 2;
1907  itemheight = size.cy + 2;
1908 
1909  if( !((Menu->fFlags & MNS_STYLE_MASK) & MNS_NOCHECK))
1910  lpitem->cxItem += 2 * check_bitmap_width;
1911  lpitem->cxItem += 4 + MenuCharSize.cx;
1912  lpitem->dxTab = lpitem->cxItem;
1913  lpitem->cxItem += arrow_bitmap_width;
1914  } else /* hbmpItem & MenuBar */ {
1915  MENU_GetBitmapItemSize(lpitem, &size, pwndOwner );
1916  lpitem->cxItem += size.cx;
1917  if( lpitem->Xlpstr) lpitem->cxItem += 2;
1918  itemheight = size.cy;
1919 
1920  /* Special case: Minimize button doesn't have a space behind it. */
1921  if (lpitem->hbmp == (HBITMAP)HBMMENU_MBAR_MINIMIZE ||
1922  lpitem->hbmp == (HBITMAP)HBMMENU_MBAR_MINIMIZE_D)
1923  lpitem->cxItem -= 1;
1924  }
1925  }
1926  else if (!menuBar) {
1927  if( !((Menu->fFlags & MNS_STYLE_MASK) & MNS_NOCHECK))
1928  lpitem->cxItem += check_bitmap_width;
1929  lpitem->cxItem += 4 + MenuCharSize.cx;
1930  lpitem->dxTab = lpitem->cxItem;
1931  lpitem->cxItem += arrow_bitmap_width;
1932  }
1933 
1934  /* it must be a text item - unless it's the system menu */
1935  if (!(lpitem->fType & MF_SYSMENU) && lpitem->Xlpstr) {
1936  HFONT hfontOld = NULL;
1937  RECT rc;// = lpitem->Rect;
1938  LONG txtheight, txtwidth;
1939 
1940  rc.left = lpitem->xItem;
1941  rc.top = lpitem->yItem;
1942  rc.right = lpitem->cxItem; // Do this for now......
1943  rc.bottom = lpitem->cyItem;
1944 
1945  if ( lpitem->fState & MFS_DEFAULT ) {
1946  hfontOld = NtGdiSelectFont( hdc, ghMenuFontBold );
1947  }
1948  if (menuBar) {
1949  txtheight = DrawTextW( hdc, lpitem->Xlpstr, -1, &rc, DT_SINGLELINE|DT_CALCRECT);
1950 
1951  lpitem->cxItem += rc.right - rc.left;
1952  itemheight = max( max( itemheight, txtheight), UserGetSystemMetrics( SM_CYMENU) - 1);
1953 
1954  lpitem->cxItem += 2 * MenuCharSize.cx;
1955  } else {
1956  if ((p = wcschr( lpitem->Xlpstr, '\t' )) != NULL) {
1957  RECT tmprc = rc;
1958  LONG tmpheight;
1959  int n = (int)( p - lpitem->Xlpstr);
1960  /* Item contains a tab (only meaningful in popup menus) */
1961  /* get text size before the tab */
1962  txtheight = DrawTextW( hdc, lpitem->Xlpstr, n, &rc,
1964  txtwidth = rc.right - rc.left;
1965  p += 1; /* advance past the Tab */
1966  /* get text size after the tab */
1967  tmpheight = DrawTextW( hdc, p, -1, &tmprc,
1969  lpitem->dxTab += txtwidth;
1970  txtheight = max( txtheight, tmpheight);
1971  txtwidth += MenuCharSize.cx + /* space for the tab */
1972  tmprc.right - tmprc.left; /* space for the short cut */
1973  } else {
1974  txtheight = DrawTextW( hdc, lpitem->Xlpstr, -1, &rc,
1976  txtwidth = rc.right - rc.left;
1977  lpitem->dxTab += txtwidth;
1978  }
1979  lpitem->cxItem += 2 + txtwidth;
1980  itemheight = max( itemheight,
1981  max( txtheight + 2, MenuCharSize.cy + 4));
1982  }
1983  if (hfontOld)
1984  {
1985  NtGdiSelectFont (hdc, hfontOld);
1986  }
1987  } else if( menuBar) {
1988  itemheight = max( itemheight, UserGetSystemMetrics(SM_CYMENU)-1);
1989  }
1990  lpitem->cyItem += itemheight;
1991  TRACE("(%ld,%ld)-(%ld,%ld)\n", lpitem->xItem, lpitem->yItem, lpitem->cxItem, lpitem->cyItem);
1992 }
INT cxBmp
Definition: ntuser.h:384
DWORD_PTR dwItemData
Definition: ntuser.h:375
#define max(a, b)
Definition: svc.c:63
UINT wID
Definition: ntuser.h:369
#define SM_CYMENUSIZE
Definition: winuser.h:1012
#define MNS_STYLE_MASK
Definition: menu.c:45
UINT fState
Definition: ntuser.h:368
#define ODT_MENU
Definition: winuser.h:2527
PSERVERINFO gpsi
Definition: imm.c:18
#define SM_CXMENUCHECK
Definition: winuser.h:1025
GLdouble n
Definition: glext.h:7729
LONG top
Definition: windef.h:307
ULONG cyItem
Definition: ntuser.h:379
#define HBMMENU_MBAR_MINIMIZE
Definition: winuser.h:2623
ULONG yItem
Definition: ntuser.h:377
LONG left
Definition: windef.h:306
#define MFS_DEFAULT
Definition: winuser.h:743
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
#define HBMMENU_MBAR_MINIMIZE_D
Definition: winuser.h:2626
ULONG cxTextAlign
Definition: ntuser.h:419
#define DT_CALCRECT
Definition: winuser.h:526
long LONG
Definition: pedump.c:60
DWORD FASTCALL IntGetCharDimensions(HDC hdc, PTEXTMETRICW ptm, PDWORD height)
Definition: font.c:329
SIZE size
Definition: menu.c:78
#define MF_OWNERDRAW
Definition: winuser.h:135
ULONG cxItem
Definition: ntuser.h:378
LONG cx
Definition: windef.h:334
static void FASTCALL MENU_GetBitmapItemSize(PITEM lpitem, SIZE *size, PWND WndOwner)
Definition: menu.c:1590
#define MF_SEPARATOR
Definition: winuser.h:137
LONG_PTR LPARAM
Definition: windef.h:208
static SIZE MenuCharSize
Definition: menu.c:18
ULONG dxTab
Definition: ntuser.h:380
#define MF_SYSMENU
Definition: winuser.h:141
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
__kernel_entry W32KAPI HFONT APIENTRY NtGdiSelectFont(_In_ HDC hdc, _In_ HFONT hf)
Definition: dcobjs.c:597
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
HBITMAP hbmp
Definition: ntuser.h:383
#define WM_MEASUREITEM
Definition: winuser.h:1636
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
HDC hdc
Definition: main.c:9
ULONG_PTR itemData
Definition: winuser.h:3636
ULONG xItem
Definition: ntuser.h:376
LONG IntGetDialogBaseUnits(VOID)
Definition: menu.c:1802
FORCEINLINE VOID RECTL_vSetRect(_Out_ RECTL *prcl, _In_ LONG left, _In_ LONG top, _In_ LONG right, _In_ LONG bottom)
Definition: rect.h:5
#define DT_SINGLELINE
Definition: winuser.h:540
#define MNS_NOCHECK
Definition: winuser.h:750
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
DWORD * PDWORD
Definition: pedump.c:68
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HFONT ghMenuFontBold
Definition: menu.c:17
#define HIWORD(l)
Definition: typedefs.h:247
LONG bottom
Definition: windef.h:309
#define SM_CYMENU
Definition: winuser.h:970
static HBITMAP
Definition: button.c:44
INT cyBmp
Definition: ntuser.h:385
GLfloat GLfloat p
Definition: glext.h:8902
USHORT * Xlpstr
Definition: ntuser.h:373
ULONG fFlags
Definition: ntuser.h:413
UINT fType
Definition: ntuser.h:367
LONG cy
Definition: windef.h:335
struct Rect Rect
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by MENU_MenuBarCalcSize(), and MENU_PopupMenuCalcSize().

◆ MENU_depth()

int FASTCALL MENU_depth ( PMENU  pmenu,
int  depth 
)

Definition at line 406 of file menu.c.

407 {
408  UINT i;
409  ITEM *item;
410  int subdepth;
411 
412  if (!pmenu) return depth;
413 
414  depth++;
415  if( depth > MAXMENUDEPTH) return depth;
416  item = pmenu->rgItems;
417  subdepth = depth;
418  for( i = 0; i < pmenu->cItems && subdepth <= MAXMENUDEPTH; i++, item++)
419  {
420  if( item->spSubMenu)//VerifyMenu(item->spSubMenu))
421  {
422  int bdepth = MENU_depth( item->spSubMenu, depth);
423  if( bdepth > subdepth) subdepth = bdepth;
424  }
425  if( subdepth > MAXMENUDEPTH)
426  TRACE("<- hmenu %p\n", item->spSubMenu);
427  }
428  return subdepth;
429 }
Definition: fontsub.cpp:35
#define MAXMENUDEPTH
Definition: menu.c:43
int FASTCALL MENU_depth(PMENU pmenu, int depth)
Definition: menu.c:406
#define TRACE(s)
Definition: solgame.cpp:4
UINT cItems
Definition: ntuser.h:416
PITEM rgItems
Definition: ntuser.h:421
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
static ATOM item
Definition: dde.c:856
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50

Referenced by IntSetMenuItemInfo().

◆ MENU_DoNextMenu()

static LRESULT FASTCALL MENU_DoNextMenu ( MTRACKER pmt,
UINT  Vk,
UINT  wFlags 
)
static

Definition at line 3739 of file menu.c.

3740 {
3741  BOOL atEnd = FALSE;
3742 
3743  /* When skipping left, we need to do something special after the
3744  first menu. */
3745  if (Vk == VK_LEFT && pmt->TopMenu->iItem == 0)
3746  {
3747  atEnd = TRUE;
3748  }
3749  /* When skipping right, for the non-system menu, we need to
3750  handle the last non-special menu item (ie skip any window
3751  icons such as MDI maximize, restore or close) */
3752  else if ((Vk == VK_RIGHT) && !IS_SYSTEM_MENU(pmt->TopMenu))
3753  {
3754  UINT i = pmt->TopMenu->iItem + 1;
3755  while (i < pmt->TopMenu->cItems) {
3756  if ((pmt->TopMenu->rgItems[i].wID >= SC_SIZE &&
3757  pmt->TopMenu->rgItems[i].wID <= SC_RESTORE)) {
3758  i++;
3759  } else break;
3760  }
3761  if (i == pmt->TopMenu->cItems) {
3762  atEnd = TRUE;
3763  }
3764  }
3765  /* When skipping right, we need to cater for the system menu */
3766  else if ((Vk == VK_RIGHT) && IS_SYSTEM_MENU(pmt->TopMenu))
3767  {
3768  if (pmt->TopMenu->iItem == (pmt->TopMenu->cItems - 1)) {
3769  atEnd = TRUE;
3770  }
3771  }
3772 
3773  if ( atEnd )
3774  {
3775  MDINEXTMENU NextMenu;
3776  PMENU MenuTmp;
3777  PWND pwndTemp;
3778  HMENU hNewMenu;
3779  HWND hNewWnd;
3780  UINT Id = 0;
3781 
3782  MenuTmp = (IS_SYSTEM_MENU(pmt->TopMenu)) ? co_IntGetSubMenu(pmt->TopMenu, 0) : pmt->TopMenu;
3783  NextMenu.hmenuIn = UserHMGetHandle(MenuTmp);
3784  NextMenu.hmenuNext = NULL;
3785  NextMenu.hwndNext = NULL;
3786  co_IntSendMessage(UserHMGetHandle(pmt->OwnerWnd), WM_NEXTMENU, Vk, (LPARAM) &NextMenu);
3787 
3788  TRACE("%p [%p] -> %p [%p]\n",
3789  pmt->CurrentMenu, pmt->OwnerWnd, NextMenu.hmenuNext, NextMenu.hwndNext );
3790 
3791  if (NULL == NextMenu.hmenuNext || NULL == NextMenu.hwndNext)
3792  {
3793  hNewWnd = UserHMGetHandle(pmt->OwnerWnd);
3794  if (IS_SYSTEM_MENU(pmt->TopMenu))
3795  {
3796  /* switch to the menu bar */
3797 
3798  if (pmt->OwnerWnd->style & WS_CHILD || !(MenuTmp = IntGetMenu(hNewWnd))) return FALSE;
3799 
3800  if (Vk == VK_LEFT)
3801  {
3802  Id = MenuTmp->cItems - 1;
3803 
3804  /* Skip backwards over any system predefined icons,
3805  eg. MDI close, restore etc icons */
3806  while ((Id > 0) &&
3807  (MenuTmp->rgItems[Id].wID >= SC_SIZE &&
3808  MenuTmp->rgItems[Id].wID <= SC_RESTORE)) Id--;
3809 
3810  }
3811  hNewMenu = UserHMGetHandle(MenuTmp);
3812  }
3813  else if (pmt->OwnerWnd->style & WS_SYSMENU)
3814  {
3815  /* switch to the system menu */
3816  MenuTmp = get_win_sys_menu(hNewWnd);
3817  if (MenuTmp) hNewMenu = UserHMGetHandle(MenuTmp);
3818  else hNewMenu = NULL;
3819  }
3820  else
3821  return FALSE;
3822  }
3823  else /* application returned a new menu to switch to */
3824  {
3825  hNewMenu = NextMenu.hmenuNext;
3826  hNewWnd = NextMenu.hwndNext;
3827 
3828  if ((MenuTmp = UserGetMenuObject(hNewMenu)) && (pwndTemp = ValidateHwndNoErr(hNewWnd)))
3829  {
3830  if ( pwndTemp->style & WS_SYSMENU && (get_win_sys_menu(hNewWnd) == MenuTmp) )
3831  {
3832  /* get the real system menu */
3833  MenuTmp = get_win_sys_menu(hNewWnd);
3834  hNewMenu = UserHMGetHandle(MenuTmp);
3835  }
3836  else if (pwndTemp->style & WS_CHILD || IntGetMenu(hNewWnd) != MenuTmp)
3837  {
3838  /* FIXME: Not sure what to do here;
3839  * perhaps try to track NewMenu as a popup? */
3840 
3841  WARN(" -- got confused.\n");
3842  return FALSE;
3843  }
3844  }
3845  else return FALSE;
3846  }
3847 
3848  if (hNewMenu != UserHMGetHandle(pmt->TopMenu))
3849  {
3851 
3852  if (pmt->CurrentMenu != pmt->TopMenu)
3854  }
3855 
3856  if (hNewWnd != UserHMGetHandle(pmt->OwnerWnd))
3857  {
3859  pmt->OwnerWnd = ValidateHwndNoErr(hNewWnd);
3861  MsqSetStateWindow(pti, MSQ_STATE_MENUOWNER, hNewWnd);
3862  pti->MessageQueue->QF_flags &= ~QF_CAPTURELOCKED;
3864  pti->MessageQueue->QF_flags |= QF_CAPTURELOCKED;
3865  }
3866 
3867  pmt->TopMenu = pmt->CurrentMenu = UserGetMenuObject(hNewMenu); /* all subpopups are hidden */
3868  MENU_SelectItem(pmt->OwnerWnd, pmt->TopMenu, Id, TRUE, 0);
3869 
3870  return TRUE;
3871  }
3872  return FALSE;
3873 }
UINT wID
Definition: ntuser.h:369
PMENU WINAPI IntGetMenu(HWND hWnd)
Definition: menu.c:250
#define SC_RESTORE
Definition: winuser.h:2588
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define VK_LEFT
Definition: winuser.h:2214
#define WS_CHILD
Definition: pedump.c:617
PWND OwnerWnd
Definition: menu.c:85
PMENU CurrentMenu
Definition: menu.c:83
DWORD Id
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
#define WM_NEXTMENU
Definition: winuser.h:1796
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
PMENU get_win_sys_menu(HWND hwnd)
Definition: menu.c:260
#define QF_CAPTURELOCKED
Definition: msgqueue.h:111
HMENU hmenuIn
Definition: winuser.h:3625
LONG_PTR LPARAM
Definition: windef.h:208
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
static void FASTCALL MENU_SelectItem(PWND pwndOwner, PMENU menu, UINT wIndex, BOOL sendMenuSelect, PMENU topmenu)
Definition: menu.c:3141
static void FASTCALL MENU_HideSubPopups(PWND pWndOwner, PMENU Menu, BOOL SendMenuSelect, UINT wFlags)
Definition: menu.c:3264
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2551
#define TRACE(s)
Definition: solgame.cpp:4
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1458
#define NO_SELECTED_ITEM
Definition: ntuser.h:408
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
UINT cItems
Definition: ntuser.h:416
PITEM rgItems
Definition: ntuser.h:421
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
HMENU hmenuNext
Definition: winuser.h:3626
#define VK_RIGHT
Definition: winuser.h:2216
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531
Definition: ntuser.h:688
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define IS_SYSTEM_MENU(MenuInfo)
Definition: menu.c:60
#define SC_SIZE
Definition: winuser.h:2574
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
PMENU TopMenu
Definition: menu.c:84
PMENU FASTCALL co_IntGetSubMenu(PMENU pMenu, int nPos)
Definition: menu.c:1350
#define WS_SYSMENU
Definition: pedump.c:629
#define MSQ_STATE_MENUOWNER
Definition: ntuser.h:3702
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
DWORD style
Definition: ntuser.h:701
INT iItem
Definition: ntuser.h:414

Referenced by MENU_KeyLeft(), and MENU_KeyRight().

◆ MENU_DrawBitmapItem()

static void FASTCALL MENU_DrawBitmapItem ( HDC  hdc,
PITEM  lpitem,
const RECT rect,
PMENU  Menu,
PWND  WndOwner,
UINT  odaction,
BOOL  MenuBar 
)
static

Definition at line 1655 of file menu.c.

1657 {
1658  BITMAP bm;
1659  DWORD rop;
1660  HDC hdcMem;
1661  HBITMAP bmp;
1662  int w = rect->right - rect->left;
1663  int h = rect->bottom - rect->top;
1664  int bmp_xoffset = 0;
1665  int left, top;
1666  BOOL flat_menu;
1667  HBITMAP hbmToDraw = lpitem->hbmp;
1668  bmp = hbmToDraw;
1669 
1670  UserSystemParametersInfo(SPI_GETFLATMENU, 0, &flat_menu, 0);
1671 
1672  /* Check if there is a magic menu item associated with this item */
1673  if (IS_MAGIC_BITMAP(hbmToDraw))
1674  {
1675  UINT flags = 0;
1676  RECT r;
1677 
1678  r = *rect;
1679  switch ((INT_PTR)hbmToDraw)
1680  {
1681  case (INT_PTR)HBMMENU_SYSTEM:
1682  if (lpitem->dwItemData)
1683  {
1684  if (ValidateHwndNoErr((HWND)lpitem->dwItemData))
1685  {
1686  ERR("Get Item Data from this Window!!!\n");
1687  }
1688 
1689  ERR("Draw Bitmap\n");
1690  bmp = (HBITMAP)lpitem->dwItemData;
1691  if (!GreGetObject( bmp, sizeof(bm), &bm )) return;
1692  }
1693  else
1694  {
1695  PCURICON_OBJECT pIcon = NULL;
1696  //if (!BmpSysMenu) BmpSysMenu = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_CLOSE));
1697  //bmp = BmpSysMenu;
1698  //if (! GreGetObject(bmp, sizeof(bm), &bm)) return;
1699  /* only use right half of the bitmap */
1700  //bmp_xoffset = bm.bmWidth / 2;
1701  //bm.bmWidth -= bmp_xoffset;
1702  if (WndOwner)
1703  {
1704  pIcon = NC_IconForWindow(WndOwner);
1705  // FIXME: NC_IconForWindow should reference it for us */
1706  if (pIcon) UserReferenceObject(pIcon);
1707  }
1708  ERR("Draw ICON\n");
1709  if (pIcon)
1710  {
1713  LONG x = rect->left - cx/2 + 1 + (rect->bottom - rect->top)/2; // this is really what Window does
1714  LONG y = (rect->top + rect->bottom)/2 - cy/2; // center
1715  UserDrawIconEx(hdc, x, y, pIcon, cx, cy, 0, NULL, DI_NORMAL);
1716  UserDereferenceObject(pIcon);
1717  }
1718  return;
1719  }
1720  goto got_bitmap;
1723  break;
1725  r.right += 1;
1727  break;
1729  r.right += 1;
1731  break;
1734  break;
1737  break;