ReactOS  0.4.13-dev-241-g63286c6
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_TOP_MARGIN   3
 
#define MENU_BOTTOM_MARGIN   2
 
#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)
 

Functions

 DBG_DEFAULT_CHANNEL (UserMenu)
 
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 FASTCALL MENU_ShowPopup (PWND pwndOwner, PMENU menu, UINT id, UINT flags, INT x, INT y)
 
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, const RECT *lprect)
 
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 187 of file menu.c.

◆ IS_BITMAP_ITEM

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

Definition at line 61 of file menu.c.

◆ IS_MAGIC_BITMAP

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

Definition at line 63 of file menu.c.

◆ IS_STRING_ITEM

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

Definition at line 64 of file menu.c.

◆ IS_SYSTEM_MENU

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

Definition at line 58 of file menu.c.

◆ ITEM_NEXT

#define ITEM_NEXT   1

Definition at line 97 of file menu.c.

◆ ITEM_PREV

#define ITEM_PREV   -1

Definition at line 96 of file menu.c.

◆ MAX_GOINTOSUBMENU

#define MAX_GOINTOSUBMENU   (0x10)

Definition at line 68 of file menu.c.

◆ MAX_MENU_ITEMS

#define MAX_MENU_ITEMS   (0x4000)

Definition at line 67 of file menu.c.

◆ MAXMENUDEPTH

#define MAXMENUDEPTH   30

Definition at line 41 of file menu.c.

◆ MENU_BAR_ITEMS_SPACE

#define MENU_BAR_ITEMS_SPACE   (12)

Definition at line 78 of file menu.c.

◆ MENU_BOTTOM_MARGIN

#define MENU_BOTTOM_MARGIN   2

Definition at line 75 of file menu.c.

◆ MENU_COL_SPACE

#define MENU_COL_SPACE   4

Definition at line 71 of file menu.c.

◆ MENU_ITEM_HBMP_SPACE

#define MENU_ITEM_HBMP_SPACE   (5)

Definition at line 77 of file menu.c.

◆ MENU_TAB_SPACE

#define MENU_TAB_SPACE   (8)

Definition at line 80 of file menu.c.

◆ MENU_TOP_MARGIN

#define MENU_TOP_MARGIN   3

Definition at line 74 of file menu.c.

◆ MENUITEMINFO_STATE_MASK

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

Definition at line 54 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 45 of file menu.c.

◆ MII_STATE_MASK

Definition at line 56 of file menu.c.

◆ MM_GETMENUHANDLE

#define MM_GETMENUHANDLE   (WM_USER + 1)

Definition at line 29 of file menu.c.

◆ MM_SETMENUHANDLE

#define MM_SETMENUHANDLE   (WM_USER + 0)

Definition at line 28 of file menu.c.

◆ MNS_STYLE_MASK

◆ SEPARATOR_HEIGHT

#define SEPARATOR_HEIGHT   (5)

Definition at line 79 of file menu.c.

◆ STATE_MASK

#define STATE_MASK   (~TYPE_MASK)

Definition at line 52 of file menu.c.

◆ TF_ENDMENU

#define TF_ENDMENU   0x10000

Definition at line 33 of file menu.c.

◆ TF_SKIPREMOVE

#define TF_SKIPREMOVE   0x40000

Definition at line 35 of file menu.c.

◆ TF_SUSPENDPOPUP

#define TF_SUSPENDPOPUP   0x20000

Definition at line 34 of file menu.c.

◆ TPM_BUTTONDOWN

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

Definition at line 93 of file menu.c.

◆ TPM_INTERNAL

#define TPM_INTERNAL   0xF0000000

Definition at line 92 of file menu.c.

◆ TPM_POPUPMENU

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

Definition at line 94 of file menu.c.

◆ TYPE_MASK

Definition at line 50 of file menu.c.

◆ UpdateMenuItemState

#define UpdateMenuItemState (   state,
  change 
)

Definition at line 99 of file menu.c.

Function Documentation

◆ co_IntGetSubMenu()

PMENU FASTCALL co_IntGetSubMenu ( PMENU  pMenu,
int  nPos 
)

Definition at line 1352 of file menu.c.

1355 {
1356  PITEM pItem;
1357  if (!(pItem = MENU_FindItem( &pMenu, (UINT*)&nPos, MF_BYPOSITION ))) return NULL;
1358  return pItem->spSubMenu;
1359 }
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:511
#define MF_BYPOSITION
Definition: winuser.h:203
smooth NULL
Definition: ftsmooth.c:416
struct tagMENU * spSubMenu
Definition: ntuser.h:343
unsigned int UINT
Definition: ndis.h:50

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 262 of file menu.c.

263 {
264  PMENU ret = 0;
265  WND *win = ValidateHwndNoErr( hwnd );
266  if (win)
267  {
268  ret = UserGetMenuObject(win->SystemMenu);
269  }
270  return ret;
271 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)
Definition: window.c:96
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
int ret
Definition: ntuser.h:657
static real win[4][36]

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

◆ IntCheckMenuItem()

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

Definition at line 1263 of file menu.c.

1264 {
1265  PITEM MenuItem;
1266  DWORD res;
1267 
1268  if (!(MenuItem = MENU_FindItem( &MenuObject, &uIDCheckItem, uCheck ))) return -1;
1269 
1270  res = (DWORD)(MenuItem->fState & MF_CHECKED);
1271 
1272  MenuItem->fState ^= (res ^ uCheck) & MF_CHECKED;
1273 
1274  return res;
1275 }
UINT fState
Definition: ntuser.h:341
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:511
#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 826 of file menu.c.

827 {
828  HANDLE hMenu;
829  PMENU Menu;
830 
831  if(!Source)
832  return NULL;
833 
834  /* A menu is valid process wide. We can pass to the object manager any thread ptr */
836  Source->head.rpdesk,
837  ((PPROCESSINFO)Source->head.hTaskWow)->ptiList,
838  &hMenu,
839  TYPE_MENU,
840  sizeof(MENU));
841  if(!Menu)
842  return NULL;
843 
844  Menu->fFlags = Source->fFlags;
845  Menu->cyMax = Source->cyMax;
846  Menu->hbrBack = Source->hbrBack;
847  Menu->dwContextHelpId = Source->dwContextHelpId;
848  Menu->dwMenuData = Source->dwMenuData;
849  Menu->iItem = NO_SELECTED_ITEM;
850  Menu->spwndNotify = NULL;
851  Menu->cyMenu = 0;
852  Menu->cxMenu = 0;
853  Menu->cItems = 0;
854  Menu->iTop = 0;
855  Menu->iMaxTop = 0;
856  Menu->cxTextAlign = 0;
857  Menu->rgItems = NULL;
858 
859  Menu->hWnd = NULL;
860  Menu->TimeToHide = FALSE;
861 
862  IntCloneMenuItems(Menu, Source);
863 
864  return Menu;
865 }
DWORD_PTR dwMenuData
Definition: ntuser.h:398
HWND hWnd
Definition: ntuser.h:405
HBRUSH hbrBack
Definition: ntuser.h:399
struct _WND * spwndNotify
Definition: ntuser.h:393
BOOL TimeToHide
Definition: ntuser.h:406
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:535
struct tagMENU MENU
ULONG cxTextAlign
Definition: ntuser.h:392
ULONG cyMenu
Definition: ntuser.h:391
smooth NULL
Definition: ftsmooth.c:416
INT iTop
Definition: ntuser.h:400
DWORD dwContextHelpId
Definition: ntuser.h:396
#define NO_SELECTED_ITEM
Definition: ntuser.h:381
ULONG cyMax
Definition: ntuser.h:397
UINT cItems
Definition: ntuser.h:389
struct tagMENU * PMENU
PITEM rgItems
Definition: ntuser.h:394
BOOL FASTCALL IntCloneMenuItems(PMENU Destination, PMENU Source)
Definition: menu.c:775
INT iMaxTop
Definition: ntuser.h:401
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
ULONG fFlags
Definition: ntuser.h:386
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
ULONG cxMenu
Definition: ntuser.h:390
INT iItem
Definition: ntuser.h:387

Referenced by MENU_GetSystemMenu().

◆ IntCloneMenuItems()

BOOL FASTCALL IntCloneMenuItems ( PMENU  Destination,
PMENU  Source 
)

Definition at line 775 of file menu.c.

776 {
777  PITEM MenuItem, NewMenuItem = NULL;
778  UINT i;
779 
780  if(!Source->cItems)
781  return FALSE;
782 
783  NewMenuItem = DesktopHeapAlloc(Destination->head.rpdesk, Source->cItems * sizeof(ITEM));
784  if(!NewMenuItem) return FALSE;
785 
786  RtlZeroMemory(NewMenuItem, Source->cItems * sizeof(ITEM));
787 
788  Destination->rgItems = NewMenuItem;
789 
790  MenuItem = Source->rgItems;
791  for (i = 0; i < Source->cItems; i++, MenuItem++, NewMenuItem++)
792  {
793  NewMenuItem->fType = MenuItem->fType;
794  NewMenuItem->fState = MenuItem->fState;
795  NewMenuItem->wID = MenuItem->wID;
796  NewMenuItem->spSubMenu = MenuItem->spSubMenu;
797  NewMenuItem->hbmpChecked = MenuItem->hbmpChecked;
798  NewMenuItem->hbmpUnchecked = MenuItem->hbmpUnchecked;
799  NewMenuItem->dwItemData = MenuItem->dwItemData;
800  if (MenuItem->lpstr.Length)
801  {
802  NewMenuItem->lpstr.Length = 0;
803  NewMenuItem->lpstr.MaximumLength = MenuItem->lpstr.MaximumLength;
804  NewMenuItem->lpstr.Buffer = DesktopHeapAlloc(Destination->head.rpdesk, MenuItem->lpstr.MaximumLength);
805  if (!NewMenuItem->lpstr.Buffer)
806  {
807  DesktopHeapFree(Destination->head.rpdesk, NewMenuItem);
808  break;
809  }
810  RtlCopyUnicodeString(&NewMenuItem->lpstr, &MenuItem->lpstr);
811  NewMenuItem->lpstr.Buffer[MenuItem->lpstr.Length / sizeof(WCHAR)] = 0;
812  NewMenuItem->Xlpstr = NewMenuItem->lpstr.Buffer;
813  }
814  else
815  {
816  NewMenuItem->lpstr.Buffer = MenuItem->lpstr.Buffer;
817  NewMenuItem->Xlpstr = NewMenuItem->lpstr.Buffer;
818  }
819  NewMenuItem->hbmp = MenuItem->hbmp;
820  Destination->cItems = i + 1;
821  }
822  return TRUE;
823 }
Definition: fontsub.cpp:35
DWORD_PTR dwItemData
Definition: ntuser.h:348
UINT wID
Definition: ntuser.h:342
#define TRUE
Definition: types.h:120
USHORT MaximumLength
Definition: env_spec_w32.h:370
UINT fState
Definition: ntuser.h:341
UNICODE_STRING lpstr
Definition: ntuser.h:360
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
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
static __inline PVOID DesktopHeapAlloc(IN PDESKTOP Desktop, IN SIZE_T Bytes)
Definition: desktop.h:230
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
HANDLE hbmpUnchecked
Definition: ntuser.h:345
HBITMAP hbmp
Definition: ntuser.h:356
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2875
struct tagMENU * spSubMenu
Definition: ntuser.h:343
HANDLE hbmpChecked
Definition: ntuser.h:344
unsigned int UINT
Definition: ndis.h:50
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_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:239
USHORT * Xlpstr
Definition: ntuser.h:346
UINT fType
Definition: ntuser.h:340

Referenced by IntCloneMenu().

◆ IntCreateMenu()

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

Definition at line 733 of file menu.c.

738 {
739  PMENU Menu;
740 
742  Desktop,
743  ppi->ptiList,
744  Handle,
745  TYPE_MENU,
746  sizeof(MENU));
747  if(!Menu)
748  {
749  *Handle = 0;
750  return NULL;
751  }
752 
753  Menu->cyMax = 0; /* Default */
754  Menu->hbrBack = NULL; /* No brush */
755  Menu->dwContextHelpId = 0; /* Default */
756  Menu->dwMenuData = 0; /* Default */
757  Menu->iItem = NO_SELECTED_ITEM; // Focused item
758  Menu->fFlags = (IsMenuBar ? 0 : MNF_POPUP);
759  Menu->spwndNotify = NULL;
760  Menu->cyMenu = 0; // Height
761  Menu->cxMenu = 0; // Width
762  Menu->cItems = 0; // Item count
763  Menu->iTop = 0;
764  Menu->iMaxTop = 0;
765  Menu->cxTextAlign = 0;
766  Menu->rgItems = NULL;
767 
768  Menu->hWnd = NULL;
769  Menu->TimeToHide = FALSE;
770 
771  return Menu;
772 }
DWORD_PTR dwMenuData
Definition: ntuser.h:398
HWND hWnd
Definition: ntuser.h:405
HBRUSH hbrBack
Definition: ntuser.h:399
struct _WND * spwndNotify
Definition: ntuser.h:393
BOOL TimeToHide
Definition: ntuser.h:406
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:535
ULONG cxTextAlign
Definition: ntuser.h:392
ULONG cyMenu
Definition: ntuser.h:391
smooth NULL
Definition: ftsmooth.c:416
INT iTop
Definition: ntuser.h:400
DWORD dwContextHelpId
Definition: ntuser.h:396
_In_ HANDLE Handle
Definition: extypes.h:390
#define NO_SELECTED_ITEM
Definition: ntuser.h:381
ULONG cyMax
Definition: ntuser.h:397
UINT cItems
Definition: ntuser.h:389
struct tagMENU * PMENU
PITEM rgItems
Definition: ntuser.h:394
INT iMaxTop
Definition: ntuser.h:401
#define MNF_POPUP
Definition: ntuser.h:370
ULONG fFlags
Definition: ntuser.h:386
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
ULONG cxMenu
Definition: ntuser.h:390
INT iItem
Definition: ntuser.h:387

Referenced by IntSetMenuItemInfo(), and UserCreateMenu().

◆ IntDestroyMenu()

BOOL IntDestroyMenu ( PMENU  pMenu,
BOOL  bRecurse 
)

Definition at line 273 of file menu.c.

274 {
275  PMENU SubMenu;
276 
278  if (pMenu->rgItems) /* recursively destroy submenus */
279  {
280  int i;
281  ITEM *item = pMenu->rgItems;
282  for (i = pMenu->cItems; i > 0; i--, item++)
283  {
284  SubMenu = item->spSubMenu;
285  item->spSubMenu = NULL;
286 
287  /* Remove Item Text */
288  FreeMenuText(pMenu,item);
289 
290  /* Remove Item Bitmap and set it for this process */
291  if (item->hbmp && !(item->fState & MFS_HBMMENUBMP))
292  {
294  item->hbmp = NULL;
295  }
296 
297  /* Remove Item submenu */
298  if (bRecurse && SubMenu)//VerifyMenu(SubMenu))
299  {
300  /* Release submenu since it was referenced when inserted */
301  IntReleaseMenuObject(SubMenu);
302  IntDestroyMenuObject(SubMenu, bRecurse);
303  }
304  }
305  /* Free the Item */
306  DesktopHeapFree(pMenu->head.rpdesk, pMenu->rgItems );
307  pMenu->rgItems = NULL;
308  pMenu->cItems = 0;
309  }
310  return TRUE;
311 }
Definition: fontsub.cpp:35
BOOL NTAPI GreSetObjectOwner(HGDIOBJ hobj, ULONG ulOwner)
Definition: gdiobj.c:1250
#define TRUE
Definition: types.h:120
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:321
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
PROCDESKHEAD head
Definition: ntuser.h:385
smooth NULL
Definition: ftsmooth.c:416
UINT cItems
Definition: ntuser.h:389
PITEM rgItems
Definition: ntuser.h:394
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
static ATOM item
Definition: dde.c:856
BOOL FASTCALL UserIsEnteredExclusive(VOID)
Definition: ntuser.c:231
#define MFS_HBMMENUBMP
Definition: ntuser.h:336
static __inline BOOL DesktopHeapFree(IN PDESKTOP Desktop, IN PVOID lpMem)
Definition: desktop.h:239
struct _DESKTOP * rpdesk
Definition: ntuser.h:197
#define FreeMenuText(Menu, MenuItem)
Definition: menu.c:187

Referenced by IntDestroyMenuObject().

◆ IntDestroyMenuObject()

BOOL FASTCALL IntDestroyMenuObject ( PMENU  Menu,
BOOL  bRecurse 
)

Definition at line 321 of file menu.c.

322 {
324  if (Menu)
325  {
326  PWND Window;
327 
328  if (PsGetCurrentProcessSessionId() == Menu->head.rpdesk->rpwinstaParent->dwSessionId)
329  {
330  BOOL ret;
331  if (Menu->hWnd)
332  {
333  Window = ValidateHwndNoErr(Menu->hWnd);
334  if (Window)
335  {
336  //Window->IDMenu = 0; Only in Win9x!! wine win test_SetMenu test...
337 
338  /* DestroyMenu should not destroy system menu popup owner */
339  if ((Menu->fFlags & (MNF_POPUP | MNF_SYSSUBMENU)) == MNF_POPUP)
340  {
341  // Should we check it to see if it has Class?
342  ERR("FIXME Pop up menu window thing'ie\n");
343  //co_UserDestroyWindow( Window );
344  //Menu->hWnd = 0;
345  }
346  }
347  }
348 
349  if (!UserMarkObjectDestroy(Menu)) return TRUE;
350 
351  /* Remove all menu items */
352  IntDestroyMenu( Menu, bRecurse);
353 
354  ret = UserDeleteObject(Menu->head.h, TYPE_MENU);
355  TRACE("IntDestroyMenuObject %d\n",ret);
356  return ret;
357  }
358  }
359  return FALSE;
360 }
HWND hWnd
Definition: ntuser.h:405
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:683
#define TRUE
Definition: types.h:120
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)
Definition: window.c:96
Definition: window.c:29
PROCDESKHEAD head
Definition: ntuser.h:385
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG NTAPI PsGetCurrentProcessSessionId(VOID)
Definition: process.c:1133
#define TRACE(s)
Definition: solgame.cpp:4
int Window
Definition: x11stubs.h:26
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
int ret
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
BOOL FASTCALL UserIsEnteredExclusive(VOID)
Definition: ntuser.c:231
#define MNF_POPUP
Definition: ntuser.h:370
BOOL IntDestroyMenu(PMENU pMenu, BOOL bRecurse)
Definition: menu.c:273
#define MNF_SYSSUBMENU
Definition: ntuser.h:376
ULONG fFlags
Definition: ntuser.h:386
struct _DESKTOP * rpdesk
Definition: ntuser.h:197
BOOL FASTCALL UserMarkObjectDestroy(PVOID Object)
Definition: object.c:587

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 2703 of file menu.c.

2704 {
2705  UINT i;
2706  HFONT FontOld = NULL;
2707  BOOL flat_menu = FALSE;
2708 
2709  UserSystemParametersInfo(SPI_GETFLATMENU, 0, &flat_menu, 0);
2710 
2711  if (!pMenu)
2712  {
2713  pMenu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu));
2714  }
2715 
2716  if (!Font)
2717  {
2718  Font = ghMenuFont;
2719  }
2720 
2721  if (Rect == NULL || !pMenu)
2722  {
2724  }
2725 
2726  TRACE("(%x, %x, %p, %x, %x)\n", pWnd, hDC, Rect, pMenu, Font);
2727 
2728  FontOld = NtGdiSelectFont(hDC, Font);
2729 
2730  if (pMenu->cyMenu == 0)
2731  {
2732  MENU_MenuBarCalcSize(hDC, Rect, pMenu, pWnd);
2733  }
2734 
2735  Rect->bottom = Rect->top + pMenu->cyMenu;
2736 
2737  FillRect(hDC, Rect, IntGetSysColorBrush(flat_menu ? COLOR_MENUBAR : COLOR_MENU));
2738 
2741  GreMoveTo(hDC, Rect->left, Rect->bottom - 1, NULL);
2742  NtGdiLineTo(hDC, Rect->right, Rect->bottom - 1);
2743 
2744  if (pMenu->cItems == 0)
2745  {
2746  NtGdiSelectFont(hDC, FontOld);
2748  }
2749 
2750  for (i = 0; i < pMenu->cItems; i++)
2751  {
2752  MENU_DrawMenuItem(pWnd, pMenu, pWnd, hDC, &pMenu->rgItems[i], pMenu->cyMenu, TRUE, ODA_DRAWENTIRE);
2753  }
2754 
2755  NtGdiSelectFont(hDC, FontOld);
2756 
2757  return pMenu->cyMenu;
2758 }
#define TRUE
Definition: types.h:120
HFONT ghMenuFont
Definition: menu.c:14
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiGetStockObject(_In_ INT iObject)
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
__kernel_entry W32KAPI BOOL APIENTRY NtGdiLineTo(_In_ HDC hdc, _In_ INT x, _In_ INT y)
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
__kernel_entry W32KAPI HPEN APIENTRY NtGdiSelectPen(_In_ HDC hdc, _In_ HPEN hpen)
#define COLOR_3DFACE
Definition: winuser.h:919
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG cyMenu
Definition: ntuser.h:391
smooth NULL
Definition: ftsmooth.c:416
static void FASTCALL MENU_DrawMenuItem(PWND Wnd, PMENU Menu, PWND WndOwner, HDC hdc, PITEM lpitem, UINT Height, BOOL menuBar, UINT odaction)
Definition: menu.c:2215
#define COLOR_MENU
Definition: winuser.h:907
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
__kernel_entry W32KAPI HFONT APIENTRY NtGdiSelectFont(_In_ HDC hdc, _In_ HFONT hf)
Definition: dcobjs.c:597
#define ODA_DRAWENTIRE
Definition: winuser.h:2496
UINT_PTR IDMenu
Definition: ntuser.h:695
#define TRACE(s)
Definition: solgame.cpp:4
#define UlongToHandle(ul)
Definition: basetsd.h:97
UINT cItems
Definition: ntuser.h:389
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
PITEM rgItems
Definition: ntuser.h:394
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
unsigned int UINT
Definition: ndis.h:50
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:966
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2066
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 1221 of file menu.c.

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

Referenced by MENU_InitSysMenuPopup(), and NtUserEnableMenuItem().

◆ IntFindSubMenu()

UINT FASTCALL IntFindSubMenu ( HMENU hMenu,
HMENU  hSubTarget 
)

Definition at line 4870 of file menu.c.

4871 {
4872  PMENU menu, pSubTarget;
4873  UINT Pos;
4874  if (((*hMenu)==(HMENU)0xffff) ||(!(menu = UserGetMenuObject(*hMenu))))
4875  return NO_SELECTED_ITEM;
4876 
4877  pSubTarget = UserGetMenuObject(hSubTarget);
4878 
4879  Pos = MENU_FindSubMenu(&menu, pSubTarget );
4880 
4881  *hMenu = (menu ? UserHMGetHandle(menu) : NULL);
4882 
4883  return Pos;
4884 }
static UINT FASTCALL MENU_FindSubMenu(PMENU *menu, PMENU SubTarget)
Definition: menu.c:568
ush Pos
Definition: deflate.h:92
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define NO_SELECTED_ITEM
Definition: ntuser.h:381
unsigned int UINT
Definition: ndis.h:50
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 1798 of file menu.c.

1799 {
1800  static DWORD units;
1801 
1802  if (!units)
1803  {
1804  HDC hdc;
1805  SIZE size;
1806 
1807  if ((hdc = UserGetDCEx(NULL, NULL, DCX_CACHE)))
1808  {
1810  if (size.cx) units = MAKELONG( size.cx, size.cy );
1811  UserReleaseDC( 0, hdc, FALSE);
1812  }
1813  }
1814  return units;
1815 }
static HDC
Definition: imagelist.c:92
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
DWORD FASTCALL IntGetCharDimensions(HDC hdc, PTEXTMETRICW ptm, PDWORD height)
Definition: font.c:329
SIZE size
Definition: menu.c:131
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:319
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:2075
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
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 252 of file menu.c.

253 {
254  PWND Wnd = ValidateHwndNoErr(hWnd);
255 
256  if (!Wnd)
257  return NULL;
258 
259  return UserGetMenuObject(UlongToHandle(Wnd->IDMenu));
260 }
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)
Definition: window.c:96
HWND hWnd
Definition: settings.c:17
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
smooth NULL
Definition: ftsmooth.c:416
UINT_PTR IDMenu
Definition: ntuser.h:695
#define UlongToHandle(ul)
Definition: basetsd.h:97
Definition: ntuser.h:657

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 1319 of file menu.c.

1320 {
1321  UINT i = 0;
1322  PITEM MenuItem = MenuObject->rgItems;
1323 
1324  /* empty menu */
1325  if (!MenuItem) return -1;
1326 
1327  while ( !( MenuItem->fState & MFS_DEFAULT ) )
1328  {
1329  i++; MenuItem++;
1330  if (i >= MenuObject->cItems ) return -1;
1331  }
1332 
1333  /* default: don't return disabled items */
1334  if ( (!(GMDI_USEDISABLED & gmdiFlags)) && (MenuItem->fState & MFS_DISABLED )) return -1;
1335 
1336  /* search rekursiv when needed */
1337  if ( (gmdiFlags & GMDI_GOINTOPOPUPS) && MenuItem->spSubMenu )
1338  {
1339  UINT ret;
1340  (*gismc)++;
1341  ret = IntGetMenuDefaultItem( MenuItem->spSubMenu, fByPos, gmdiFlags, gismc );
1342  (*gismc)--;
1343  if ( -1 != ret ) return ret;
1344 
1345  /* when item not found in submenu, return the popup item */
1346  }
1347  return ( fByPos ) ? i : MenuItem->wID;
1348 }
UINT wID
Definition: ntuser.h:342
UINT fState
Definition: ntuser.h:341
#define MFS_DISABLED
Definition: winuser.h:744
#define MFS_DEFAULT
Definition: winuser.h:743
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 GMDI_GOINTOPOPUPS
Definition: winuser.h:2086
UINT FASTCALL IntGetMenuDefaultItem(PMENU MenuObject, UINT fByPos, UINT gmdiFlags, DWORD *gismc)
Definition: menu.c:1319
UINT cItems
Definition: ntuser.h:389
PITEM rgItems
Definition: ntuser.h:394
int ret
struct tagMENU * spSubMenu
Definition: ntuser.h:343
#define GMDI_USEDISABLED
Definition: winuser.h:2087
unsigned int UINT
Definition: ndis.h:50

Referenced by GetMenuDefaultItem(), and IntGetMenuDefaultItem().

◆ IntGetMenuInfo()

BOOL FASTCALL IntGetMenuInfo ( PMENU  Menu,
PROSMENUINFO  lpmi 
)

Definition at line 883 of file menu.c.

884 {
885  if(lpmi->fMask & MIM_BACKGROUND)
886  lpmi->hbrBack = Menu->hbrBack;
887  if(lpmi->fMask & MIM_HELPID)
888  lpmi->dwContextHelpID = Menu->dwContextHelpId;
889  if(lpmi->fMask & MIM_MAXHEIGHT)
890  lpmi->cyMax = Menu->cyMax;
891  if(lpmi->fMask & MIM_MENUDATA)
892  lpmi->dwMenuData = Menu->dwMenuData;
893  if(lpmi->fMask & MIM_STYLE)
894  lpmi->dwStyle = Menu->fFlags & MNS_STYLE_MASK;
895 
896  if (sizeof(MENUINFO) < lpmi->cbSize)
897  {
898  lpmi->cItems = Menu->cItems;
899 
900  lpmi->iItem = Menu->iItem;
901  lpmi->cxMenu = Menu->cxMenu;
902  lpmi->cyMenu = Menu->cyMenu;
903  lpmi->spwndNotify = Menu->spwndNotify;
904  lpmi->cxTextAlign = Menu->cxTextAlign;
905  lpmi->iTop = Menu->iTop;
906  lpmi->iMaxTop = Menu->iMaxTop;
907  lpmi->dwArrowsOn = Menu->dwArrowsOn;
908 
909  lpmi->fFlags = Menu->fFlags;
910  lpmi->Self = Menu->head.h;
911  lpmi->TimeToHide = Menu->TimeToHide;
912  lpmi->Wnd = Menu->hWnd;
913  }
914  return TRUE;
915 }
DWORD_PTR dwMenuData
Definition: ntuser.h:398
HWND hWnd
Definition: ntuser.h:405
#define TRUE
Definition: types.h:120
INT iMaxTop
Definition: menu.h:92
HBRUSH hbrBack
Definition: ntuser.h:399
#define MNS_STYLE_MASK
Definition: menu.c:43
WORD cyMenu
Definition: menu.h:88
UINT iItem
Definition: menu.h:85
PWND spwndNotify
Definition: menu.h:90
struct _WND * spwndNotify
Definition: ntuser.h:393
BOOL TimeToHide
Definition: ntuser.h:406
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:392
PROCDESKHEAD head
Definition: ntuser.h:385
ULONG cyMenu
Definition: ntuser.h:391
INT iTop
Definition: ntuser.h:400
DWORD dwContextHelpId
Definition: ntuser.h:396
HMENU Self
Definition: menu.h:95
INT iTop
Definition: menu.h:91
DWORD dwArrowsOn
Definition: ntuser.h:402
ULONG cyMax
Definition: ntuser.h:397
DWORD dwArrowsOn
Definition: menu.h:93
ULONG fFlags
Definition: menu.h:84
UINT cItems
Definition: ntuser.h:389
DWORD dwContextHelpID
Definition: menu.h:81
WORD cxMenu
Definition: menu.h:87
DWORD fMask
Definition: menu.h:77
INT iMaxTop
Definition: ntuser.h:401
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:386
ULONG cxMenu
Definition: ntuser.h:390
INT iItem
Definition: ntuser.h:387
DWORD dwStyle
Definition: menu.h:78

Referenced by UserMenuInfo().

◆ IntGetMenuItemInfo()

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

Definition at line 966 of file menu.c.

968 {
970 
971  if(lpmii->fMask & (MIIM_FTYPE | MIIM_TYPE))
972  {
973  lpmii->fType = MenuItem->fType;
974  }
975  if(lpmii->fMask & MIIM_BITMAP)
976  {
977  lpmii->hbmpItem = MenuItem->hbmp;
978  }
979  if(lpmii->fMask & MIIM_CHECKMARKS)
980  {
981  lpmii->hbmpChecked = MenuItem->hbmpChecked;
982  lpmii->hbmpUnchecked = MenuItem->hbmpUnchecked;
983  }
984  if(lpmii->fMask & MIIM_DATA)
985  {
986  lpmii->dwItemData = MenuItem->dwItemData;
987  }
988  if(lpmii->fMask & MIIM_ID)
989  {
990  lpmii->wID = MenuItem->wID;
991  }
992  if(lpmii->fMask & MIIM_STATE)
993  {
994  lpmii->fState = MenuItem->fState;
995  }
996  if(lpmii->fMask & MIIM_SUBMENU)
997  {
998  lpmii->hSubMenu = MenuItem->spSubMenu ? MenuItem->spSubMenu->head.h : NULL;
999  }
1000 
1001  if ((lpmii->fMask & MIIM_STRING) ||
1002  ((lpmii->fMask & MIIM_TYPE) && (MENU_ITEM_TYPE(lpmii->fType) == MF_STRING)))
1003  {
1004  if (lpmii->dwTypeData == NULL)
1005  {
1006  lpmii->cch = MenuItem->lpstr.Length / sizeof(WCHAR);
1007  }
1008  else
1009  {
1010  Status = MmCopyToCaller(lpmii->dwTypeData, MenuItem->lpstr.Buffer,
1011  min(lpmii->cch * sizeof(WCHAR),
1012  MenuItem->lpstr.MaximumLength));
1013  if (! NT_SUCCESS(Status))
1014  {
1016  return FALSE;
1017  }
1018  }
1019  }
1020 
1021  if (sizeof(ROSMENUITEMINFO) == lpmii->cbSize)
1022  {
1023  lpmii->Rect.left = MenuItem->xItem;
1024  lpmii->Rect.top = MenuItem->yItem;
1025  lpmii->Rect.right = MenuItem->cxItem; // Do this for now......
1026  lpmii->Rect.bottom = MenuItem->cyItem;
1027  lpmii->dxTab = MenuItem->dxTab;
1028  lpmii->lpstr = MenuItem->lpstr.Buffer;
1029  lpmii->maxBmpSize.cx = MenuItem->cxBmp;
1030  lpmii->maxBmpSize.cy = MenuItem->cyBmp;
1031  }
1032 
1033  return TRUE;
1034 }
INT cxBmp
Definition: ntuser.h:357
DWORD_PTR dwItemData
Definition: ntuser.h:348
LPWSTR lpstr
Definition: menu.h:118
UINT wID
Definition: ntuser.h:342
#define MIIM_FTYPE
Definition: winuser.h:724
#define TRUE
Definition: types.h:120
USHORT MaximumLength
Definition: env_spec_w32.h:370
UINT fState
Definition: ntuser.h:341
LONG NTSTATUS
Definition: precomp.h:26
#define MF_STRING
Definition: winuser.h:138
HBITMAP hbmpUnchecked
Definition: menu.h:110
LONG top
Definition: windef.h:292
ULONG cyItem
Definition: ntuser.h:352
ULONG yItem
Definition: ntuser.h:350
SIZE maxBmpSize
Definition: menu.h:119
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
LONG left
Definition: windef.h:291
#define MENU_ITEM_TYPE(flags)
Definition: menu.c:24
LONG right
Definition: windef.h:293
UNICODE_STRING lpstr
Definition: ntuser.h:360
#define MIIM_BITMAP
Definition: winuser.h:723
#define MIIM_SUBMENU
Definition: winuser.h:718
#define MIIM_STATE
Definition: winuser.h:716
smooth NULL
Definition: ftsmooth.c:416
ULONG cxItem
Definition: ntuser.h:351
LONG cx
Definition: windef.h:319
ULONG dxTab
Definition: ntuser.h:353
#define MIIM_ID
Definition: winuser.h:717
HBITMAP hbmpItem
Definition: menu.h:114
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:345
HBITMAP hbmp
Definition: ntuser.h:356
struct tagMENU * spSubMenu
Definition: ntuser.h:343
#define MIIM_TYPE
Definition: winuser.h:720
ULONG xItem
Definition: ntuser.h:349
HANDLE hbmpChecked
Definition: ntuser.h:344
#define MIIM_CHECKMARKS
Definition: winuser.h:719
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
#define MIIM_STRING
Definition: winuser.h:722
HMENU hSubMenu
Definition: menu.h:108
#define min(a, b)
Definition: monoChain.cc:55
LONG bottom
Definition: windef.h:294
HBITMAP hbmpChecked
Definition: menu.h:109
LPWSTR dwTypeData
Definition: menu.h:112
INT cyBmp
Definition: ntuser.h:358
#define MIIM_DATA
Definition: winuser.h:721
UINT fType
Definition: ntuser.h:340
LONG cy
Definition: windef.h:320

Referenced by IntMenuItemInfo(), and UserMenuItemInfo().

◆ IntGetMenuItemRect()

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

Definition at line 5085 of file menu.c.

5090 {
5091  LONG XMove, YMove;
5092  PITEM MenuItem;
5093  UINT I = uItem;
5094 
5095  if ((MenuItem = MENU_FindItem (&Menu, &I, MF_BYPOSITION)))
5096  {
5097  Rect->left = MenuItem->xItem;
5098  Rect->top = MenuItem->yItem;
5099  Rect->right = MenuItem->cxItem; // Do this for now......
5100  Rect->bottom = MenuItem->cyItem;
5101  }
5102  else
5103  {
5104  ERR("Failed Item Lookup! %u\n", uItem);
5105  return FALSE;
5106  }
5107 
5108  if (!pWnd)
5109  {
5110  HWND hWnd = Menu->hWnd;
5111  if (!(pWnd = UserGetWindowObject(hWnd))) return FALSE;
5112  }
5113 
5114  if (Menu->fFlags & MNF_POPUP)
5115  {
5116  XMove = pWnd->rcClient.left;
5117  YMove = pWnd->rcClient.top;
5118  }
5119  else
5120  {
5121  XMove = pWnd->rcWindow.left;
5122  YMove = pWnd->rcWindow.top;
5123  }
5124 
5125  Rect->left += XMove;
5126  Rect->top += YMove;
5127  Rect->right += XMove;
5128  Rect->bottom += YMove;
5129 
5130  return TRUE;
5131 }
HWND hWnd
Definition: ntuser.h:405
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:292
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:511
ULONG cyItem
Definition: ntuser.h:352
ULONG yItem
Definition: ntuser.h:350
RECT rcClient
Definition: ntuser.h:681
LONG left
Definition: windef.h:291
long LONG
Definition: pedump.c:60
#define MF_BYPOSITION
Definition: winuser.h:203
ULONG cxItem
Definition: ntuser.h:351
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
ULONG xItem
Definition: ntuser.h:349
#define I(s)
RECT rcWindow
Definition: ntuser.h:680
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int UINT
Definition: ndis.h:50
#define MNF_POPUP
Definition: ntuser.h:370
ULONG fFlags
Definition: ntuser.h:386

Referenced by NtUserGetMenuBarInfo().

◆ IntGetMenuObject()

PMENU FASTCALL IntGetMenuObject ( HMENU  hMenu)

Definition at line 196 of file menu.c.

197 {
198  PMENU Menu = UserGetMenuObject(hMenu);
199  if (Menu)
200  Menu->head.cLockObj++;
201 
202  return Menu;
203 }
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
PROCDESKHEAD head
Definition: ntuser.h:385

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

◆ IntGetMenuState()

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

Definition at line 4830 of file menu.c.

4831 {
4832  PMENU MenuObject;
4833  PITEM pItem;
4834 
4835  if (!(MenuObject = UserGetMenuObject(hMenu)))
4836  {
4837  return (UINT)-1;
4838  }
4839 
4840  if (!(pItem = MENU_FindItem( &MenuObject, &uId, uFlags ))) return -1;
4841 
4842  if (pItem->spSubMenu)
4843  {
4844  return (pItem->spSubMenu->cItems << 8) | ((pItem->fState|pItem->fType|MF_POPUP) & 0xff);
4845  }
4846  else
4847  return (pItem->fType | pItem->fState);
4848 }
UINT fState
Definition: ntuser.h:341
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:511
UINT uFlags
Definition: api.c:60
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
struct tagMENU * spSubMenu
Definition: ntuser.h:343
#define MF_POPUP
Definition: winuser.h:136
unsigned int UINT
Definition: ndis.h:50
UINT fType
Definition: ntuser.h:340

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

◆ IntGetSubMenu()

HMENU FASTCALL IntGetSubMenu ( HMENU  hMenu,
int  nPos 
)

Definition at line 4850 of file menu.c.

4851 {
4852  PMENU MenuObject;
4853  PITEM pItem;
4854 
4855  if (!(MenuObject = UserGetMenuObject(hMenu)))
4856  {
4857  return NULL;
4858  }
4859 
4860  if (!(pItem = MENU_FindItem( &MenuObject, (UINT*)&nPos, MF_BYPOSITION ))) return NULL;
4861 
4862  if (pItem->spSubMenu)
4863  {
4864  HMENU hsubmenu = UserHMGetHandle(pItem->spSubMenu);
4865  return hsubmenu;
4866  }
4867  return NULL;
4868 }
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:511
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
#define MF_BYPOSITION
Definition: winuser.h:203
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
struct tagMENU * spSubMenu
Definition: ntuser.h:343
unsigned int UINT
Definition: ndis.h:50
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 5238 of file menu.c.

5239 {
5240  PMENU Menu;
5241 
5242  if (bRevert)
5243  {
5244  if (Window->SystemMenu)
5245  {
5246  Menu = UserGetMenuObject(Window->SystemMenu);
5247  if (Menu && !(Menu->fFlags & MNF_SYSDESKMN))
5248  {
5249  IntDestroyMenuObject(Menu, TRUE);
5250  Window->SystemMenu = NULL;
5251  }
5252  }
5253  }
5254  else
5255  {
5256  Menu = Window->SystemMenu ? UserGetMenuObject(Window->SystemMenu) : NULL;
5257  if ((!Menu || Menu->fFlags & MNF_SYSDESKMN) && Window->style & WS_SYSMENU)
5258  {
5259  Menu = MENU_GetSystemMenu(Window, NULL);
5260  Window->SystemMenu = Menu ? UserHMGetHandle(Menu) : NULL;
5261  }
5262  }
5263 
5264  if (Window->SystemMenu)
5265  {
5266  HMENU hMenu = IntGetSubMenu( Window->SystemMenu, 0);
5267  /* Store the dummy sysmenu handle to facilitate the refresh */
5268  /* of the close button if the SC_CLOSE item change */
5269  Menu = UserGetMenuObject(hMenu);
5270  if (Menu)
5271  {
5272  Menu->spwndNotify = Window;
5273  Menu->fFlags |= MNF_SYSSUBMENU;
5274  }
5275  return Menu;
5276  }
5277  return NULL;
5278 }
#define TRUE
Definition: types.h:120
struct _WND * spwndNotify
Definition: ntuser.h:393
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:321
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
Definition: window.c:29
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
int Window
Definition: x11stubs.h:26
HMENU FASTCALL IntGetSubMenu(HMENU hMenu, int nPos)
Definition: menu.c:4850
#define MNF_SYSDESKMN
Definition: ntuser.h:375
#define MNF_SYSSUBMENU
Definition: ntuser.h:376
ULONG fFlags
Definition: ntuser.h:386
#define WS_SYSMENU
Definition: pedump.c:629
PMENU FASTCALL MENU_GetSystemMenu(PWND Window, PMENU Popup)
Definition: menu.c:5133
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 4659 of file menu.c.

4660 {
4661 
4662  DWORD dwStyle = 0;
4663  DWORD dwExStyle = 0;
4664  BOOLEAN retValue = TRUE;
4665 
4666  if (bti->cbSize == sizeof(TITLEBARINFO))
4667  {
4668  RtlZeroMemory(&bti->rgstate[0],sizeof(DWORD)*(CCHILDREN_TITLEBAR+1));
4669 
4670  bti->rgstate[0] = STATE_SYSTEM_FOCUSABLE;
4671 
4672  dwStyle = pWindowObject->style;
4673  dwExStyle = pWindowObject->ExStyle;
4674 
4675  bti->rcTitleBar.top = 0;
4676  bti->rcTitleBar.left = 0;
4677  bti->rcTitleBar.right = pWindowObject->rcWindow.right - pWindowObject->rcWindow.left;
4678  bti->rcTitleBar.bottom = pWindowObject->rcWindow.bottom - pWindowObject->rcWindow.top;
4679 
4680  /* Is it iconiced ? */
4681  if ((dwStyle & WS_ICONIC)!=WS_ICONIC)
4682  {
4683  /* Remove frame from rectangle */
4684  if (HAS_THICKFRAME( dwStyle, dwExStyle ))
4685  {
4686  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXFRAME) and UserGetSystemMetrics(SM_CYFRAME) */
4688  }
4689  else if (HAS_DLGFRAME( dwStyle, dwExStyle ))
4690  {
4691  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXDLGFRAME) and UserGetSystemMetrics(SM_CYDLGFRAME) */
4693  }
4694  else if (HAS_THINFRAME( dwStyle, dwExStyle))
4695  {
4696  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXBORDER) and UserGetSystemMetrics(SM_CYBORDER) */
4698  }
4699 
4700  /* We have additional border information if the window
4701  * is a child (but not an MDI child) */
4702  if ( (dwStyle & WS_CHILD) &&
4703  ((dwExStyle & WS_EX_MDICHILD) == 0 ) )
4704  {
4705  if (dwExStyle & WS_EX_CLIENTEDGE)
4706  {
4707  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXEDGE) and UserGetSystemMetrics(SM_CYEDGE) */
4709  }
4710 
4711  if (dwExStyle & WS_EX_STATICEDGE)
4712  {
4713  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXBORDER) and UserGetSystemMetrics(SM_CYBORDER) */
4715  }
4716  }
4717  }
4718 
4719  bti->rcTitleBar.top += pWindowObject->rcWindow.top;
4720  bti->rcTitleBar.left += pWindowObject->rcWindow.left;
4721  bti->rcTitleBar.right += pWindowObject->rcWindow.left;
4722 
4723  bti->rcTitleBar.bottom = bti->rcTitleBar.top;
4724  if (dwExStyle & WS_EX_TOOLWINDOW)
4725  {
4726  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CYSMCAPTION) */
4728  }
4729  else
4730  {
4731  /* FIXME: Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CYCAPTION) and UserGetSystemMetrics(SM_CXSIZE) */
4734  }
4735 
4736  if (dwStyle & WS_CAPTION)
4737  {
4738  bti->rgstate[1] = STATE_SYSTEM_INVISIBLE;
4739  if (dwStyle & WS_SYSMENU)
4740  {
4741  if (!(dwStyle & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX)))
4742  {
4743  bti->rgstate[2] = STATE_SYSTEM_INVISIBLE;
4744  bti->rgstate[3] = STATE_SYSTEM_INVISIBLE;
4745  }
4746  else
4747  {
4748  if (!(dwStyle & WS_MINIMIZEBOX))
4749  {
4751  }
4752  if (!(dwStyle & WS_MAXIMIZEBOX))
4753  {
4755  }
4756  }
4757 
4758  if (!(dwExStyle & WS_EX_CONTEXTHELP))
4759  {
4760  bti->rgstate[4] = STATE_SYSTEM_INVISIBLE;
4761  }
4762  if (pWindowObject->pcls->style & CS_NOCLOSE)
4763  {
4765  }
4766  }
4767  else
4768  {
4769  bti->rgstate[2] = STATE_SYSTEM_INVISIBLE;
4770  bti->rgstate[3] = STATE_SYSTEM_INVISIBLE;
4771  bti->rgstate[4] = STATE_SYSTEM_INVISIBLE;
4772  bti->rgstate[5] = STATE_SYSTEM_INVISIBLE;
4773  }
4774  }
4775  else
4776  {
4777  bti->rgstate[0] |= STATE_SYSTEM_INVISIBLE;
4778  }
4779  }
4780  else
4781  {
4783  retValue = FALSE;
4784  }
4785 
4786  return retValue;
4787 }
#define CCHILDREN_TITLEBAR
Definition: winuser.h:3699
#define WS_EX_CONTEXTHELP
Definition: winuser.h:386
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD ExStyle
Definition: ntuser.h:668
#define STATE_SYSTEM_UNAVAILABLE
Definition: winuser.h:2815
#define TRUE
Definition: types.h:120
#define STATE_SYSTEM_FOCUSABLE
Definition: winuser.h:2835
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
LONG top
Definition: windef.h:292
#define CS_NOCLOSE
Definition: winuser.h:649
#define SM_CXEDGE
Definition: winuser.h:998
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:291
#define SM_CYFRAME
Definition: winuser.h:986
#define SM_CXFRAME
Definition: winuser.h:984
LONG right
Definition: windef.h:293
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define WS_EX_MDICHILD
Definition: winuser.h:394
UINT style
Definition: ntuser.h:548
#define SM_CYDLGFRAME
Definition: winuser.h:958
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:999
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
#define WS_CAPTION
Definition: pedump.c:624
#define SM_CYCAPTION
Definition: winuser.h:953
#define WS_ICONIC
Definition: pedump.c:641
#define SM_CXDLGFRAME
Definition: winuser.h:956
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SM_CYBORDER
Definition: winuser.h:955
#define SM_CXBORDER
Definition: winuser.h:954
RECT rcWindow
Definition: ntuser.h:680
DWORD rgstate[CCHILDREN_TITLEBAR+1]
Definition: winuser.h:3704
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define SM_CXSIZE
Definition: winuser.h:981
#define HAS_DLGFRAME(Style, ExStyle)
Definition: window.h:8
LONG bottom
Definition: windef.h:294
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define WS_SYSMENU
Definition: pedump.c:629
#define SM_CYSMCAPTION
Definition: winuser.h:1004
#define WS_EX_STATICEDGE
Definition: winuser.h:403
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define STATE_SYSTEM_INVISIBLE
Definition: winuser.h:2830
PCLS pcls
Definition: ntuser.h:684
DWORD style
Definition: ntuser.h:670

Referenced by NtUserGetTitleBarInfo().

◆ IntHiliteMenuItem()

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

Definition at line 4633 of file menu.c.

4637 {
4638  PITEM MenuItem;
4639  UINT uItem = uItemHilite;
4640 
4641  if (!(MenuItem = MENU_FindItem( &MenuObject, &uItem, uHilite ))) return TRUE;
4642 
4643  if (uHilite & MF_HILITE)
4644  {
4645  MenuItem->fState |= MF_HILITE;
4646  }
4647  else
4648  {
4649  MenuItem->fState &= ~MF_HILITE;
4650  }
4651  if (MenuObject->iItem == uItemHilite) return TRUE;
4652  MENU_HideSubPopups( WindowObject, MenuObject, FALSE, 0 );
4653  MENU_SelectItem( WindowObject, MenuObject, uItemHilite, TRUE, 0 );
4654 
4655  return TRUE; // Always returns true!!!!
4656 }
#define TRUE
Definition: types.h:120
UINT fState
Definition: ntuser.h:341
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:511
#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:3021
static void FASTCALL MENU_HideSubPopups(PWND pWndOwner, PMENU Menu, BOOL SendMenuSelect, UINT wFlags)
Definition: menu.c:3144
unsigned int UINT
Definition: ndis.h:50
INT iItem
Definition: ntuser.h:387

Referenced by NtUserHiliteMenuItem().

◆ IntInsertMenuItem()

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

Definition at line 695 of file menu.c.

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

Referenced by MENU_GetSystemMenu(), and UserInsertMenuItem().

◆ IntIsMenu()

BOOL FASTCALL IntIsMenu ( HMENU  Menu)

Definition at line 244 of file menu.c.

245 {
246  if (UserGetMenuObject(Menu)) return TRUE;
247  return FALSE;
248 }
#define TRUE
Definition: types.h:120
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3

◆ IntMenuItemFromPoint()

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

Definition at line 1516 of file menu.c.

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

Referenced by IntDefWindowProc().

◆ IntMenuItemInfo()

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

Definition at line 4931 of file menu.c.

4938 {
4939  PITEM MenuItem;
4940  BOOL Ret;
4941 
4942  if (!(MenuItem = MENU_FindItem( &Menu, &Item, (ByPosition ? MF_BYPOSITION : MF_BYCOMMAND) )))
4943  {
4945  return( FALSE);
4946  }
4947  if (SetOrGet)
4948  {
4949  Ret = IntSetMenuItemInfo(Menu, MenuItem, ItemInfo, lpstr);
4950  }
4951  else
4952  {
4953  Ret = IntGetMenuItemInfo(Menu, MenuItem, ItemInfo);
4954  }
4955  return( Ret);
4956 }
#define MF_BYCOMMAND
Definition: winuser.h:202
PITEM FASTCALL MENU_FindItem(PMENU *pmenu, UINT *nPos, UINT wFlags)
Definition: menu.c:511
BOOL FASTCALL IntSetMenuItemInfo(PMENU MenuObject, PITEM MenuItem, PROSMENUITEMINFO lpmii, PUNICODE_STRING lpstr)
Definition: menu.c:1037
BOOL FASTCALL IntGetMenuItemInfo(PMENU Menu, PITEM MenuItem, PROSMENUITEMINFO lpmii)
Definition: menu.c:966
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
static LPCSTR lpstr
Definition: font.c:51
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by MENU_GetSystemMenu().

◆ IntRemoveMenuItem()

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

Definition at line 600 of file menu.c.

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

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

◆ IntSetMenu()

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

Definition at line 5314 of file menu.c.

5318 {
5319  PMENU OldMenu, NewMenu = NULL;
5320 
5321  if ((Wnd->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
5322  {
5323  ERR("SetMenu: Window is a Child 0x%p!\n",UserHMGetHandle(Wnd));
5325  return FALSE;
5326  }
5327 
5328  *Changed = (UlongToHandle(Wnd->IDMenu) != Menu);
5329  if (! *Changed)
5330  {
5331  return TRUE;
5332  }
5333 
5334  if (Wnd->IDMenu)
5335  {
5336  OldMenu = IntGetMenuObject(UlongToHandle(Wnd->IDMenu));
5337  ASSERT(NULL == OldMenu || OldMenu->hWnd == UserHMGetHandle(Wnd));
5338  }
5339  else
5340  {
5341  OldMenu = NULL;
5342  }
5343 
5344  if (NULL != Menu)
5345  {
5346  NewMenu = IntGetMenuObject(Menu);
5347  if (NULL == NewMenu)
5348  {
5349  if (NULL != OldMenu)
5350  {
5351  IntReleaseMenuObject(OldMenu);
5352  }
5354  return FALSE;
5355  }
5356  if (NULL != NewMenu->hWnd)
5357  {
5358  /* Can't use the same menu for two windows */
5359  if (NULL != OldMenu)
5360  {
5361  IntReleaseMenuObject(OldMenu);
5362  }
5364  return FALSE;
5365  }
5366 
5367  }
5368 
5369  Wnd->IDMenu = (UINT_PTR) Menu;
5370  if (NULL != NewMenu)
5371  {
5372  NewMenu->hWnd = UserHMGetHandle(Wnd);
5373  IntReleaseMenuObject(NewMenu);
5374  }
5375  if (NULL != OldMenu)
5376  {
5377  OldMenu->hWnd = NULL;
5378  IntReleaseMenuObject(OldMenu);
5379  }
5380 
5381  return TRUE;
5382 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
HWND hWnd
Definition: ntuser.h:405
#define TRUE
Definition: types.h:120
#define WS_CHILD
Definition: pedump.c:617
PMENU FASTCALL IntGetMenuObject(HMENU hMenu)
Definition: menu.c:196
#define ERROR_INVALID_MENU_HANDLE
Definition: winerror.h:882
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
UINT_PTR IDMenu
Definition: ntuser.h:695
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define UlongToHandle(ul)
Definition: basetsd.h:97
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ERR(fmt,...)
Definition: debug.h:109
#define WS_POPUP
Definition: pedump.c:616
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
DWORD style
Definition: ntuser.h:670

Referenced by IntCreateWindow(), and NtUserSetMenu().

◆ IntSetMenuContextHelpId()

BOOL FASTCALL IntSetMenuContextHelpId ( PMENU  Menu,
DWORD  dwContextHelpId 
)

Definition at line 876 of file menu.c.

877 {
878  Menu->dwContextHelpId = dwContextHelpId;
879  return TRUE;
880 }
#define TRUE
Definition: types.h:120
DWORD dwContextHelpId
Definition: ntuser.h:396

Referenced by NtUserSetMenuContextHelpId().

◆ IntSetMenuFlagRtoL()

BOOL FASTCALL IntSetMenuFlagRtoL ( PMENU  Menu)

Definition at line 868 of file menu.c.

869 {
870  ERR("SetMenuFlagRtoL\n");
871  Menu->fFlags |= MNF_RTOL;
872  return TRUE;
873 }
#define TRUE
Definition: types.h:120
#define ERR(fmt,...)
Definition: debug.h:109
#define MNF_RTOL
Definition: ntuser.h:373
ULONG fFlags
Definition: ntuser.h:386

Referenced by NtUserSetMenuFlagRtoL().

◆ IntSetMenuInfo()

BOOL FASTCALL IntSetMenuInfo ( PMENU  Menu,
PROSMENUINFO  lpmi 
)

Definition at line 918 of file menu.c.

919 {
920  if(lpmi->fMask & MIM_BACKGROUND)
921  Menu->hbrBack = lpmi->hbrBack;
922  if(lpmi->fMask & MIM_HELPID)
923  Menu->dwContextHelpId = lpmi->dwContextHelpID;
924  if(lpmi->fMask & MIM_MAXHEIGHT)
925  Menu->cyMax = lpmi->cyMax;
926  if(lpmi->fMask & MIM_MENUDATA)
927  Menu->dwMenuData = lpmi->dwMenuData;
928  if(lpmi->fMask & MIM_STYLE)
929  Menu->fFlags ^= (Menu->fFlags ^ lpmi->dwStyle) & MNS_STYLE_MASK;
930  if(lpmi->fMask & MIM_APPLYTOSUBMENUS)
931  {
932  int i;
933  PITEM item = Menu->rgItems;
934  for ( i = Menu->cItems; i; i--, item++)
935  {
936  if ( item->spSubMenu )
937  {
938  IntSetMenuInfo( item->spSubMenu, lpmi);
939  }
940  }
941  }
942  if (sizeof(MENUINFO) < lpmi->cbSize)
943  {
944  Menu->iItem = lpmi->iItem;
945  Menu->cyMenu = lpmi->cyMenu;
946  Menu->cxMenu = lpmi->cxMenu;
947  Menu->spwndNotify = lpmi->spwndNotify;
948  Menu->cxTextAlign = lpmi->cxTextAlign;
949  Menu->iTop = lpmi->iTop;
950  Menu->iMaxTop = lpmi->iMaxTop;
951  Menu->dwArrowsOn = lpmi->dwArrowsOn;
952 
953  Menu->TimeToHide = lpmi->TimeToHide;
954  Menu->hWnd = lpmi->Wnd;
955  }
956  if ( lpmi->fMask & MIM_STYLE)
957  {
958  if (lpmi->dwStyle & MNS_AUTODISMISS) FIXME("MNS_AUTODISMISS unimplemented wine\n");
959  if (lpmi->dwStyle & MNS_DRAGDROP) FIXME("MNS_DRAGDROP unimplemented wine\n");
960  if (lpmi->dwStyle & MNS_MODELESS) FIXME("MNS_MODELESS unimplemented wine\n");
961  }
962  return TRUE;
963 }
DWORD_PTR dwMenuData
Definition: ntuser.h:398
HWND hWnd
Definition: ntuser.h:405
#define MNS_MODELESS
Definition: winuser.h:751
#define TRUE
Definition: types.h:120
INT iMaxTop
Definition: menu.h:92
HBRUSH hbrBack
Definition: ntuser.h:399
#define MNS_DRAGDROP
Definition: winuser.h:752
#define MNS_AUTODISMISS
Definition: winuser.h:753
#define MNS_STYLE_MASK
Definition: menu.c:43
WORD cyMenu
Definition: menu.h:88
UINT iItem
Definition: menu.h:85
PWND spwndNotify
Definition: menu.h:90
struct _WND * spwndNotify
Definition: ntuser.h:393
BOOL TimeToHide
Definition: ntuser.h:406
DWORD cbSize
Definition: menu.h:76
HBRUSH hbrBack
Definition: menu.h:80
ULONG cxTextAlign
Definition: menu.h:89
UINT cyMax
Definition: menu.h:79
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
ULONG cxTextAlign
Definition: ntuser.h:392
#define FIXME(fmt,...)
Definition: debug.h:110
ULONG cyMenu
Definition: ntuser.h:391
INT iTop
Definition: ntuser.h:400
DWORD dwContextHelpId
Definition: ntuser.h:396
BOOL FASTCALL IntSetMenuInfo(PMENU Menu, PROSMENUINFO lpmi)
Definition: menu.c:918
INT iTop
Definition: menu.h:91
DWORD dwArrowsOn
Definition: ntuser.h:402
ULONG cyMax
Definition: ntuser.h:397
DWORD dwArrowsOn
Definition: menu.h:93
UINT cItems
Definition: ntuser.h:389
DWORD dwContextHelpID
Definition: menu.h:81
PITEM rgItems
Definition: ntuser.h:394
WORD cxMenu
Definition: menu.h:87
static ATOM item
Definition: dde.c:856
DWORD fMask
Definition: menu.h:77
INT iMaxTop
Definition: ntuser.h:401
ULONG_PTR dwMenuData
Definition: menu.h:82
BOOL TimeToHide
Definition: menu.h:97
HWND Wnd
Definition: menu.h:96
ULONG fFlags
Definition: ntuser.h:386
ULONG cxMenu
Definition: ntuser.h:390
INT iItem
Definition: ntuser.h:387
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 1037 of file menu.c.

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

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

◆ IntSetSystemMenu()

BOOL FASTCALL IntSetSystemMenu ( PWND  Window,
PMENU  Menu 
)

Definition at line 5281 of file menu.c.

5282 {
5283  PMENU OldMenu;
5284 
5285  if (!(Window->style & WS_SYSMENU)) return FALSE;
5286 
5287  if (Window->SystemMenu)
5288  {
5289  OldMenu = UserGetMenuObject(Window->SystemMenu);
5290  if (OldMenu)
5291  {
5292  OldMenu->fFlags &= ~MNF_SYSMENU;
5293  IntDestroyMenuObject(OldMenu, TRUE);
5294  }
5295  }
5296 
5297  OldMenu = MENU_GetSystemMenu(Window, Menu);
5298  if (OldMenu)
5299  { // Use spmenuSys too!
5300  Window->SystemMenu = UserHMGetHandle(OldMenu);
5301  }
5302  else
5303  Window->SystemMenu = NULL;
5304 
5305  if (Menu && Window != Menu->spwndNotify)
5306  {
5307  Menu->spwndNotify = Window;
5308  }
5309 
5310  return TRUE;
5311 }
#define MNF_SYSMENU
Definition: ntuser.h:378
#define TRUE
Definition: types.h:120
struct _WND * spwndNotify
Definition: ntuser.h:393
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:321
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
Definition: window.c:29
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
int Window
Definition: x11stubs.h:26
ULONG fFlags
Definition: ntuser.h:386
#define WS_SYSMENU
Definition: pedump.c:629
PMENU FASTCALL MENU_GetSystemMenu(PWND Window, PMENU Popup)
Definition: menu.c:5133

Referenced by NtUserSetSystemMenu().

◆ IntTrackPopupMenuEx()

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

Definition at line 4415 of file menu.c.

4417 {
4418  BOOL ret = FALSE;
4420 
4421  if (pti != pWnd->head.pti)
4422  {
4423  ERR("Must be the same pti!\n");
4424  return ret;
4425  }
4426 
4427  TRACE("hmenu %p flags %04x (%d,%d) hwnd %p lpTpm %p \n", //rect %s\n",
4428  UserHMGetHandle(menu), wFlags, x, y, UserHMGetHandle(pWnd), lpTpm); //,
4429  //lpTpm ? wine_dbgstr_rect( &lpTpm->rcExclude) : "-" );
4430 
4431  if (menu->hWnd && IntIsWindow(menu->hWnd))
4432  {
4434  return FALSE;
4435  }
4436 
4437  if (MENU_InitPopup( pWnd, menu, wFlags ))
4438  {
4439  MENU_InitTracking(pWnd, menu, TRUE, wFlags);
4440 
4441  /* Send WM_INITMENUPOPUP message only if TPM_NONOTIFY flag is not specified */
4442  if (!(wFlags & TPM_NONOTIFY))
4443  {
4445  }
4446 
4447  if (menu->fFlags & MNF_SYSMENU)
4448  MENU_InitSysMenuPopup( menu, pWnd->style, pWnd->pcls->style, HTSYSMENU);
4449 
4450  if (MENU_ShowPopup(pWnd, menu, 0, wFlags | TPM_POPUPMENU, x, y))
4451  ret = MENU_TrackMenu( menu, wFlags | TPM_POPUPMENU, 0, 0, pWnd,
4452  lpTpm ? &lpTpm->rcExclude : NULL);
4453  else
4454  {
4456  pti->MessageQueue->QF_flags &= ~QF_CAPTURELOCKED;
4457  co_UserSetCapture(NULL); /* release the capture */
4458  }
4459 
4460  MENU_ExitTracking(pWnd, TRUE, wFlags);
4461 
4462  if (menu->hWnd)
4463  {
4464  PWND pwndM = ValidateHwndNoErr( menu->hWnd );
4465  if (pwndM) // wine hack around this with their destroy function.
4466  {
4467  if (!(pWnd->state & WNDS_DESTROYED))
4468  co_UserDestroyWindow( pwndM ); // Fix wrong error return.
4469  }
4470  menu->hWnd = 0;
4471 
4472  if (!(wFlags & TPM_NONOTIFY))
4473  {
4474  co_IntSendMessage( UserHMGetHandle(pWnd), WM_UNINITMENUPOPUP, (WPARAM)UserHMGetHandle(menu),
4475  MAKELPARAM(0, IS_SYSTEM_MENU(menu)) );
4476  }
4477  }
4478  }
4479  return ret;
4480 }
#define MNF_SYSMENU
Definition: ntuser.h:378
HWND hWnd
Definition: ntuser.h:405
void FASTCALL MENU_InitSysMenuPopup(PMENU menu, DWORD style, DWORD clsStyle, LONG HitTest)
Definition: menu.c:1366
#define TRUE
Definition: types.h:120
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)
Definition: window.c:96
static BOOL MENU_InitPopup(PWND pWndOwner, PMENU menu, UINT flags)
Definition: menu.c:2799
static INT FASTCALL MENU_TrackMenu(PMENU pmenu, UINT wFlags, INT x, INT y, PWND pwnd, const RECT *lprect)
Definition: menu.c:3907
#define WM_INITMENUPOPUP
Definition: winuser.h:1722
#define TPM_POPUPMENU
Definition: menu.c:94
#define MAKELPARAM(l, h)
Definition: winuser.h:3915
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
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:4302
#define HTSYSMENU
Definition: winuser.h:2431
UINT style
Definition: ntuser.h:548
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2629
#define ERROR_POPUP_ALREADY_ACTIVE
Definition: winerror.h:927
#define QF_CAPTURELOCKED
Definition: msgqueue.h:111
THRDESKHEAD head
Definition: ntuser.h:659
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2533
#define TRACE(s)
Definition: solgame.cpp:4
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1340
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:157
#define TPM_NONOTIFY
Definition: winuser.h:2340
int ret
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
#define IS_SYSTEM_MENU(MenuInfo)
Definition: menu.c:58
DWORD state
Definition: ntuser.h:665
static BOOL FASTCALL MENU_InitTracking(PWND pWnd, PMENU Menu, BOOL bPopup, UINT wFlags)
Definition: menu.c:4242
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static BOOL FASTCALL MENU_ShowPopup(PWND pwndOwner, PMENU menu, UINT id, UINT flags, INT x, INT y)
Definition: menu.c:2868
ULONG fFlags
Definition: ntuser.h:386
RECT rcExclude
Definition: winuser.h:3518
#define MSQ_STATE_MENUOWNER
Definition: ntuser.h:3547
#define WNDS_DESTROYED
Definition: ntuser.h:604
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
PCLS pcls
Definition: ntuser.h:684
DWORD style
Definition: ntuser.h:670

Referenced by IntDefWindowProc(), and NtUserTrackPopupMenuEx().

◆ MENU_AdjustMenuItemRect()

VOID FASTCALL MENU_AdjustMenuItemRect ( PMENU  menu,
PRECTL  rect 
)

Definition at line 1466 of file menu.c.

1467 {
1468  if (menu->dwArrowsOn)
1469  {
1470  UINT arrow_bitmap_height;
1471  arrow_bitmap_height = gpsi->oembmi[OBI_UPARROW].cy;
1472  rect->top += arrow_bitmap_height - menu->iTop;
1473  rect->bottom += arrow_bitmap_height - menu->iTop;
1474  }
1475 }
PSERVERINFO gpsi
Definition: main.c:27
& rect
Definition: startmenu.cpp:1413
INT iTop
Definition: ntuser.h:400
DWORD dwArrowsOn
Definition: ntuser.h:402
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 3406 of file menu.c.

3407 {
3408  TRACE("%x PtMenu=%p\n", pmt, PtMenu);
3409 
3410  if (PtMenu)
3411  {
3412  UINT id = 0;
3413  PITEM item;
3414  if (IS_SYSTEM_MENU(PtMenu))
3415  {
3416  item = PtMenu->rgItems;
3417  }
3418  else
3419  {
3420  item = MENU_FindItemByCoords( PtMenu, pmt->Pt, &id );
3421  }
3422 
3423  if (item)
3424  {
3425  if (PtMenu->iItem != id)
3426  MENU_SwitchTracking(pmt, PtMenu, id, Flags);
3427 
3428  /* If the popup menu is not already "popped" */
3429  if (!(item->fState & MF_MOUSESELECT))
3430  {
3431  pmt->CurrentMenu = MENU_ShowSubPopup(pmt->OwnerWnd, PtMenu, FALSE, Flags);
3432  }
3433 
3434  return TRUE;
3435  }
3436  /* Else the click was on the menu bar, finish the tracking */
3437  }
3438  return FALSE;
3439 }
#define TRUE
Definition: types.h:120
static PMENU FASTCALL MENU_ShowSubPopup(PWND WndOwner, PMENU Menu, BOOL SelectFirst, UINT Flags)
Definition: menu.c:3195
PWND OwnerWnd
Definition: menu.c:87
PMENU CurrentMenu
Definition: menu.c:85
POINT Pt
Definition: menu.c:88
#define MF_MOUSESELECT
Definition: winuser.h:145
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define TRACE(s)
Definition: solgame.cpp:4
PITEM rgItems
Definition: ntuser.h:394
static ATOM item
Definition: dde.c:856
#define IS_SYSTEM_MENU(MenuInfo)
Definition: menu.c:58
unsigned int UINT
Definition: ndis.h:50
static void FASTCALL MENU_SwitchTracking(MTRACKER *pmt, PMENU PtMenu, UINT Index, UINT wFlags)
Definition: menu.c:3381
static ITEM * MENU_FindItemByCoords(MENU *menu, POINT pt, UINT *pos)
Definition: menu.c:1484
INT iItem
Definition: ntuser.h:387

Referenced by MENU_TrackMenu().

◆ MENU_ButtonUp()

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

Definition at line 3449 of file menu.c.

3450 {
3451  TRACE("%p pmenu=%x\n", pmt, PtMenu);
3452 
3453  if (PtMenu)
3454  {
3455  UINT Id = 0;
3456  ITEM *item;
3457 
3458  if ( IS_SYSTEM_MENU(PtMenu) )
3459  {
3460  item = PtMenu->rgItems;
3461  }
3462  else
3463  {
3464  item = MENU_FindItemByCoords( PtMenu, pmt->Pt, &Id );
3465  }
3466 
3467  if (item && ( PtMenu->iItem == Id))
3468  {
3469  if (!(item->spSubMenu))
3470  {
3471  INT ExecutedMenuId = MENU_ExecFocusedItem( pmt, PtMenu, Flags);
3472  if (ExecutedMenuId == -1 || ExecutedMenuId == -2) return -1;
3473  return ExecutedMenuId;
3474  }
3475 
3476  /* If we are dealing with the menu bar */
3477  /* and this is a click on an already "popped" item: */
3478  /* Stop the menu tracking and close the opened submenus */
3479  if (pmt->TopMenu == PtMenu && PtMenu->TimeToHide)
3480  {
3481  return 0;
3482  }
3483  }
3484  if ( IntGetMenu(PtMenu->hWnd) == PtMenu )
3485  {
3486  PtMenu->TimeToHide = TRUE;
3487  }
3488  }
3489  return -1;
3490 }
Definition: fontsub.cpp:35
HWND hWnd
Definition: ntuser.h:405
PMENU WINAPI IntGetMenu(HWND hWnd)
Definition: menu.c:252
#define TRUE
Definition: types.h:120
BOOL TimeToHide
Definition: ntuser.h:406
int32_t INT
Definition: typedefs.h:56
DWORD Id
POINT Pt
Definition: menu.c:88
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define TRACE(s)
Definition: solgame.cpp:4
PITEM rgItems
Definition: ntuser.h:394
static INT FASTCALL MENU_ExecFocusedItem(MTRACKER *pmt, PMENU Menu, UINT Flags)
Definition: menu.c:3326
static ATOM item
Definition: dde.c:856
#define IS_SYSTEM_MENU(MenuInfo)
Definition: menu.c:58
unsigned int UINT
Definition: ndis.h:50
PMENU TopMenu
Definition: menu.c:86
static ITEM * MENU_FindItemByCoords(MENU *menu, POINT pt, UINT *pos)
Definition: menu.c:1484
INT iItem
Definition: ntuser.h:387

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 1823 of file menu.c.

1825 {
1826  WCHAR *p;
1827  UINT check_bitmap_width = UserGetSystemMetrics( SM_CXMENUCHECK );
1828  UINT arrow_bitmap_width;
1829  RECT Rect;
1830  INT itemheight = 0;
1831 
1832  TRACE("dc=%x owner=%x (%d,%d)\n", hdc, pwndOwner, orgX, orgY);
1833 
1834  arrow_bitmap_width = gpsi->oembmi[OBI_MNARROW].cx;
1835 
1837 
1838  RECTL_vSetRect( &Rect, orgX, orgY, orgX, orgY );
1839 
1840  if (lpitem->fType & MF_OWNERDRAW)
1841  {
1842  MEASUREITEMSTRUCT mis;
1843  mis.CtlType = ODT_MENU;
1844  mis.CtlID = 0;
1845  mis.itemID = lpitem->wID;
1846  mis.itemData = lpitem->dwItemData;
1848  mis.itemWidth = 0;
1849  co_IntSendMessage( UserHMGetHandle(pwndOwner), WM_MEASUREITEM, 0, (LPARAM)&mis );
1850  /* Tests reveal that Windows ( Win95 thru WinXP) adds twice the average
1851  * width of a menufont character to the width of an owner-drawn menu.
1852  */
1853  Rect.right += mis.itemWidth + 2 * MenuCharSize.cx;
1854  if (menuBar) {
1855  /* under at least win95 you seem to be given a standard
1856  height for the menu and the height value is ignored */
1858  } else
1859  Rect.bottom += mis.itemHeight;
1860  // Or this,
1861  //lpitem->cxBmp = mis.itemWidth;
1862  //lpitem->cyBmp = mis.itemHeight;
1863  TRACE("MF_OWNERDRAW Height %d Width %d\n",mis.itemHeight,mis.itemWidth);
1864  TRACE("MF_OWNERDRAW id=%04lx size=%dx%d cx %d cy %d\n",
1865  lpitem->wID, Rect.right-Rect.left,
1866  Rect.bottom-Rect.top, MenuCharSize.cx, MenuCharSize.cy);
1867 
1868  lpitem->xItem = Rect.left;
1869  lpitem->yItem = Rect.top;
1870  lpitem->cxItem = Rect.right;
1871  lpitem->cyItem = Rect.bottom;
1872 
1873  return;
1874  }
1875 
1876  lpitem->xItem = orgX;
1877  lpitem->yItem = orgY;
1878  lpitem->cxItem = orgX;
1879  lpitem->cyItem = orgY;
1880 
1881  if (lpitem->fType & MF_SEPARATOR)
1882  {
1883  lpitem->cyItem += UserGetSystemMetrics( SM_CYMENUSIZE)/2;//SEPARATOR_HEIGHT;
1884  if( !menuBar)
1885  lpitem->cxItem += arrow_bitmap_width + MenuCharSize.cx;
1886  return;
1887  }
1888 
1889  lpitem->dxTab = 0;
1890 
1891  if (lpitem->hbmp)
1892  {
1893  SIZE size;
1894 
1895  if (!menuBar) {
1896  MENU_GetBitmapItemSize(lpitem, &size, pwndOwner );
1897  /* Keep the size of the bitmap in callback mode to be able
1898  * to draw it correctly */
1899  lpitem->cxBmp = size.cx;
1900  lpitem->cyBmp = size.cy;
1901  Menu->cxTextAlign = max(Menu->cxTextAlign, size.cx);
1902  lpitem->cxItem += size.cx + 2;
1903  itemheight = size.cy + 2;
1904 
1905  if( !((Menu->fFlags & MNS_STYLE_MASK) & MNS_NOCHECK))
1906  lpitem->cxItem += 2 * check_bitmap_width;
1907  lpitem->cxItem += 4 + MenuCharSize.cx;
1908  lpitem->dxTab = lpitem->cxItem;
1909  lpitem->cxItem += arrow_bitmap_width;
1910  } else /* hbmpItem & MenuBar */ {
1911  MENU_GetBitmapItemSize(lpitem, &size, pwndOwner );
1912  lpitem->cxItem += size.cx;
1913  if( lpitem->Xlpstr) lpitem->cxItem += 2;
1914  itemheight = size.cy;
1915 
1916  /* Special case: Minimize button doesn't have a space behind it. */
1917  if (lpitem->hbmp == (HBITMAP)HBMMENU_MBAR_MINIMIZE ||
1918  lpitem->hbmp == (HBITMAP)HBMMENU_MBAR_MINIMIZE_D)
1919  lpitem->cxItem -= 1;
1920  }
1921  }
1922  else if (!menuBar) {
1923  if( !((Menu->fFlags & MNS_STYLE_MASK) & MNS_NOCHECK))
1924  lpitem->cxItem += check_bitmap_width;
1925  lpitem->cxItem += 4 + MenuCharSize.cx;
1926  lpitem->dxTab = lpitem->cxItem;
1927  lpitem->cxItem += arrow_bitmap_width;
1928  }
1929 
1930  /* it must be a text item - unless it's the system menu */
1931  if (!(lpitem->fType & MF_SYSMENU) && lpitem->Xlpstr) {
1932  HFONT hfontOld = NULL;
1933  RECT rc;// = lpitem->Rect;
1934  LONG txtheight, txtwidth;
1935 
1936  rc.left = lpitem->xItem;
1937  rc.top = lpitem->yItem;
1938  rc.right = lpitem->cxItem; // Do this for now......
1939  rc.bottom = lpitem->cyItem;
1940 
1941  if ( lpitem->fState & MFS_DEFAULT ) {
1942  hfontOld = NtGdiSelectFont( hdc, ghMenuFontBold );
1943  }
1944  if (menuBar) {
1945  txtheight = DrawTextW( hdc, lpitem->Xlpstr, -1, &rc, DT_SINGLELINE|DT_CALCRECT);
1946 
1947  lpitem->cxItem += rc.right - rc.left;
1948  itemheight = max( max( itemheight, txtheight), UserGetSystemMetrics( SM_CYMENU) - 1);
1949 
1950  lpitem->cxItem += 2 * MenuCharSize.cx;
1951  } else {
1952  if ((p = wcschr( lpitem->Xlpstr, '\t' )) != NULL) {
1953  RECT tmprc = rc;
1954  LONG tmpheight;
1955  int n = (int)( p - lpitem->Xlpstr);
1956  /* Item contains a tab (only meaningful in popup menus) */
1957  /* get text size before the tab */
1958  txtheight = DrawTextW( hdc, lpitem->Xlpstr, n, &rc,
1960  txtwidth = rc.right - rc.left;
1961  p += 1; /* advance past the Tab */
1962  /* get text size after the tab */
1963  tmpheight = DrawTextW( hdc, p, -1, &tmprc,
1965  lpitem->dxTab += txtwidth;
1966  txtheight = max( txtheight, tmpheight);
1967  txtwidth += MenuCharSize.cx + /* space for the tab */
1968  tmprc.right - tmprc.left; /* space for the short cut */
1969  } else {
1970  txtheight = DrawTextW( hdc, lpitem->Xlpstr, -1, &rc,
1972  txtwidth = rc.right - rc.left;
1973  lpitem->dxTab += txtwidth;
1974  }
1975  lpitem->cxItem += 2 + txtwidth;
1976  itemheight = max( itemheight,
1977  max( txtheight + 2, MenuCharSize.cy + 4));
1978  }
1979  if (hfontOld)
1980  {
1981  NtGdiSelectFont (hdc, hfontOld);
1982  }
1983  } else if( menuBar) {
1984  itemheight = max( itemheight, UserGetSystemMetrics(SM_CYMENU)-1);
1985  }
1986  lpitem->cyItem += itemheight;
1987  TRACE("(%ld,%ld)-(%ld,%ld)\n", lpitem->xItem, lpitem->yItem, lpitem->cxItem, lpitem->cyItem);
1988 }
INT cxBmp
Definition: ntuser.h:357
DWORD_PTR dwItemData
Definition: ntuser.h:348
#define max(a, b)
Definition: svc.c:63
UINT wID
Definition: ntuser.h:342
#define SM_CYMENUSIZE
Definition: winuser.h:1008
#define MNS_STYLE_MASK
Definition: menu.c:43
UINT fState
Definition: ntuser.h:341
#define ODT_MENU
Definition: winuser.h:2491
#define SM_CXMENUCHECK
Definition: winuser.h:1021
GLdouble n
Definition: glext.h:7729
LONG top
Definition: windef.h:292
ULONG cyItem
Definition: ntuser.h:352
#define HBMMENU_MBAR_MINIMIZE
Definition: winuser.h:2587
ULONG yItem
Definition: ntuser.h:350
LONG left
Definition: windef.h:291
#define MFS_DEFAULT
Definition: winuser.h:743
LONG right
Definition: windef.h:293
PSERVERINFO gpsi
Definition: main.c:27
int32_t INT
Definition: typedefs.h:56
#define HBMMENU_MBAR_MINIMIZE_D
Definition: winuser.h:2590
ULONG cxTextAlign
Definition: ntuser.h:392
#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:131
#define MF_OWNERDRAW
Definition: winuser.h:135
smooth NULL
Definition: ftsmooth.c:416
ULONG cxItem
Definition: ntuser.h:351
LONG cx
Definition: windef.h:319
static void FASTCALL MENU_GetBitmapItemSize(PITEM lpitem, SIZE *size, PWND WndOwner)
Definition: menu.c:1586
#define MF_SEPARATOR
Definition: winuser.h:137
LONG_PTR LPARAM
Definition: windef.h:208
static SIZE MenuCharSize
Definition: menu.c:16
ULONG dxTab
Definition: ntuser.h:353
#define MF_SYSMENU
Definition: winuser.h:141
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
__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:356
#define WM_MEASUREITEM
Definition: winuser.h:1628
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
HDC hdc
Definition: main.c:9
ULONG_PTR itemData
Definition: winuser.h:3588
ULONG xItem
Definition: ntuser.h:349
LONG IntGetDialogBaseUnits(VOID)
Definition: menu.c:1798
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
DWORD * PDWORD
Definition: pedump.c:68
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HFONT ghMenuFontBold
Definition: menu.c:15
#define HIWORD(l)
Definition: typedefs.h:246
LONG bottom
Definition: windef.h:294
#define SM_CYMENU
Definition: winuser.h:966
static HBITMAP
Definition: button.c:44
INT cyBmp
Definition: ntuser.h:358
GLfloat GLfloat p
Definition: glext.h:8902
USHORT * Xlpstr
Definition: ntuser.h:346
ULONG fFlags
Definition: ntuser.h:386
UINT fType
Definition: ntuser.h:340
LONG cy
Definition: windef.h:320
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 408 of file menu.c.

409 {
410  UINT i;
411  ITEM *item;
412  int subdepth;
413 
414  if (!pmenu) return depth;
415 
416  depth++;
417  if( depth > MAXMENUDEPTH) return depth;
418  item = pmenu->rgItems;
419  subdepth = depth;
420  for( i = 0; i < pmenu->cItems && subdepth <= MAXMENUDEPTH; i++, item++)
421  {
422  if( item->spSubMenu)//VerifyMenu(item->spSubMenu))
423  {
424  int bdepth = MENU_depth( item->spSubMenu, depth);
425  if( bdepth > subdepth) subdepth = bdepth;
426  }
427  if( subdepth > MAXMENUDEPTH)
428  TRACE("<- hmenu %p\n", item->spSubMenu);
429  }
430  return subdepth;
431 }
Definition: fontsub.cpp:35
#define MAXMENUDEPTH
Definition: menu.c:41
int FASTCALL MENU_depth(PMENU pmenu, int depth)
Definition: menu.c:408
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 TRACE(s)
Definition: solgame.cpp:4
UINT cItems
Definition: ntuser.h:389
PITEM rgItems
Definition: ntuser.h:394
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
static ATOM item
Definition: dde.c:856
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 3593 of file menu.c.

3594 {
3595  BOOL atEnd = FALSE;
3596 
3597  /* When skipping left, we need to do something special after the
3598  first menu. */
3599  if (Vk == VK_LEFT && pmt->TopMenu->iItem == 0)
3600  {
3601  atEnd = TRUE;
3602  }
3603  /* When skipping right, for the non-system menu, we need to
3604  handle the last non-special menu item (ie skip any window
3605  icons such as MDI maximize, restore or close) */
3606  else if ((Vk == VK_RIGHT) && !IS_SYSTEM_MENU(pmt->TopMenu))
3607  {
3608  UINT i = pmt->TopMenu->iItem + 1;
3609  while (i < pmt->TopMenu->cItems) {
3610  if ((pmt->TopMenu->rgItems[i].wID >= SC_SIZE &&
3611  pmt->TopMenu->rgItems[i].wID <= SC_RESTORE)) {
3612  i++;
3613  } else break;
3614  }
3615  if (i == pmt->TopMenu->cItems) {
3616  atEnd = TRUE;
3617  }
3618  }
3619  /* When skipping right, we need to cater for the system menu */
3620  else if ((Vk == VK_RIGHT) && IS_SYSTEM_MENU(pmt->TopMenu))
3621  {
3622  if (pmt->TopMenu->iItem == (pmt->TopMenu->cItems - 1)) {
3623  atEnd = TRUE;
3624  }
3625  }
3626 
3627  if ( atEnd )
3628  {
3629  MDINEXTMENU NextMenu;
3630  PMENU MenuTmp;
3631  PWND pwndTemp;
3632  HMENU hNewMenu;
3633  HWND hNewWnd;
3634  UINT Id = 0;
3635 
3636  MenuTmp = (IS_SYSTEM_MENU(pmt->TopMenu)) ? co_IntGetSubMenu(pmt->TopMenu, 0) : pmt->TopMenu;
3637  NextMenu.hmenuIn = UserHMGetHandle(MenuTmp);
3638  NextMenu.hmenuNext = NULL;
3639  NextMenu.hwndNext = NULL;
3640  co_IntSendMessage(UserHMGetHandle(pmt->OwnerWnd), WM_NEXTMENU, Vk, (LPARAM) &NextMenu);
3641 
3642  TRACE("%p [%p] -> %p [%p]\n",
3643  pmt->CurrentMenu, pmt->OwnerWnd, NextMenu.hmenuNext, NextMenu.hwndNext );
3644 
3645  if (NULL == NextMenu.hmenuNext || NULL == NextMenu.hwndNext)
3646  {
3647  hNewWnd = UserHMGetHandle(pmt->OwnerWnd);
3648  if (IS_SYSTEM_MENU(pmt->TopMenu))
3649  {
3650  /* switch to the menu bar */
3651 
3652  if (pmt->OwnerWnd->style & WS_CHILD || !(MenuTmp = IntGetMenu(hNewWnd))) return FALSE;
3653 
3654  if (Vk == VK_LEFT)
3655  {
3656  Id = MenuTmp->cItems - 1;
3657 
3658  /* Skip backwards over any system predefined icons,
3659  eg. MDI close, restore etc icons */
3660  while ((Id > 0) &&
3661  (MenuTmp->rgItems[Id].wID >= SC_SIZE &&
3662  MenuTmp->rgItems[Id].wID <= SC_RESTORE)) Id--;
3663 
3664  }
3665  hNewMenu = UserHMGetHandle(MenuTmp);
3666  }
3667  else if (pmt->OwnerWnd->style & WS_SYSMENU)
3668  {
3669  /* switch to the system menu */
3670  MenuTmp = get_win_sys_menu(hNewWnd);
3671  if (MenuTmp) hNewMenu = UserHMGetHandle(MenuTmp);
3672  }
3673  else
3674  return FALSE;
3675  }
3676  else /* application returned a new menu to switch to */
3677  {
3678  hNewMenu = NextMenu.hmenuNext;
3679  hNewWnd = NextMenu.hwndNext;
3680 
3681  if ((MenuTmp = UserGetMenuObject(hNewMenu)) && (pwndTemp = ValidateHwndNoErr(hNewWnd)))
3682  {
3683  if ( pwndTemp->style & WS_SYSMENU && (get_win_sys_menu(hNewWnd) == MenuTmp) )
3684  {
3685  /* get the real system menu */
3686  MenuTmp = get_win_sys_menu(hNewWnd);
3687  hNewMenu = UserHMGetHandle(MenuTmp);
3688  }
3689  else if (pwndTemp->style & WS_CHILD || IntGetMenu(hNewWnd) != MenuTmp)
3690  {
3691  /* FIXME: Not sure what to do here;
3692  * perhaps try to track NewMenu as a popup? */
3693 
3694  WARN(" -- got confused.\n");
3695  return FALSE;
3696  }
3697  }
3698  else return FALSE;
3699  }
3700 
3701  if (hNewMenu != UserHMGetHandle(pmt->TopMenu))
3702  {
3704 
3705  if (pmt->CurrentMenu != pmt->TopMenu)
3707  }
3708 
3709  if (hNewWnd != UserHMGetHandle(pmt->OwnerWnd))
3710  {
3712  pmt->OwnerWnd = ValidateHwndNoErr(hNewWnd);
3714  MsqSetStateWindow(pti, MSQ_STATE_MENUOWNER, hNewWnd);
3715  pti->MessageQueue->QF_flags &= ~QF_CAPTURELOCKED;
3717  pti->MessageQueue->QF_flags |= QF_CAPTURELOCKED;
3718  }
3719 
3720  pmt->TopMenu = pmt->CurrentMenu = UserGetMenuObject(hNewMenu); /* all subpopups are hidden */
3721  MENU_SelectItem(pmt->OwnerWnd, pmt->TopMenu, Id, TRUE, 0);
3722 
3723  return TRUE;
3724  }
3725  return FALSE;
3726 }
UINT wID
Definition: ntuser.h:342
PMENU WINAPI IntGetMenu(HWND hWnd)
Definition: menu.c:252
#define TRUE
Definition: types.h:120
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)
Definition: window.c:96
#define SC_RESTORE
Definition: winuser.h:2552
#define WARN(fmt,...)
Definition: debug.h:111
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define VK_LEFT
Definition: winuser.h:2178
#define WS_CHILD
Definition: pedump.c:617
PWND OwnerWnd
Definition: menu.c:87
PMENU CurrentMenu
Definition: menu.c:85
DWORD Id
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
#define WM_NEXTMENU
Definition: winuser.h:1782
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 BOOL
Definition: ntddk_ex.h:94
PMENU get_win_sys_menu(HWND hwnd)
Definition: menu.c:262
#define QF_CAPTURELOCKED
Definition: msgqueue.h:111
smooth NULL
Definition: ftsmooth.c:416
HMENU hmenuIn
Definition: winuser.h:3577
LONG_PTR LPARAM
Definition: windef.h:208
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
static void FASTCALL MENU_SelectItem(PWND pwndOwner, PMENU menu, UINT wIndex, BOOL sendMenuSelect, PMENU topmenu)
Definition: menu.c:3021
static void FASTCALL MENU_HideSubPopups(PWND pWndOwner, PMENU Menu, BOOL SendMenuSelect, UINT wFlags)
Definition: menu.c:3144
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2533
#define TRACE(s)
Definition: solgame.cpp:4
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1340
#define NO_SELECTED_ITEM
Definition: ntuser.h:381
UINT cItems
Definition: ntuser.h:389
PITEM rgItems
Definition: ntuser.h:394
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
HMENU hmenuNext
Definition: winuser.h:3578
#define VK_RIGHT
Definition: winuser.h:2180
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
Definition: ntuser.h:657
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
#define IS_SYSTEM_MENU(MenuInfo)
Definition: menu.c:58
#define SC_SIZE
Definition: winuser.h:2538
unsigned int UINT
Definition: ndis.h:50
PMENU TopMenu
Definition: menu.c:86
PMENU FASTCALL co_IntGetSubMenu(PMENU pMenu, int nPos)
Definition: menu.c:1352
#define WS_SYSMENU
Definition: pedump.c:629
#define MSQ_STATE_MENUOWNER
Definition: ntuser.h:3547
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
DWORD style
Definition: ntuser.h:670
INT iItem
Definition: ntuser.h:387

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 1651 of file menu.c.

1653 {
1654  BITMAP bm;
1655  DWORD rop;
1656  HDC hdcMem;
1657  HBITMAP bmp;
1658  int w = rect->right - rect->left;
1659  int h = rect->bottom - rect->top;
1660  int bmp_xoffset = 0;
1661  int left, top;
1662  BOOL flat_menu;
1663  HBITMAP hbmToDraw = lpitem->hbmp;
1664  bmp = hbmToDraw;
1665 
1666  UserSystemParametersInfo(SPI_GETFLATMENU, 0, &flat_menu, 0);
1667 
1668  /* Check if there is a magic menu item associated with this item */
1669  if (IS_MAGIC_BITMAP(hbmToDraw))
1670  {
1671  UINT flags = 0;
1672  RECT r;
1673 
1674  r = *rect;
1675  switch ((INT_PTR)hbmToDraw)
1676  {
1677  case (INT_PTR)HBMMENU_SYSTEM:
1678  if (lpitem->dwItemData)
1679  {
1680  if (ValidateHwndNoErr((HWND)lpitem->dwItemData))
1681  {
1682  ERR("Get Item Data from this Window!!!\n");
1683  }
1684 
1685  ERR("Draw Bitmap\n");
1686  bmp = (HBITMAP)lpitem->dwItemData;
1687  if (!GreGetObject( bmp, sizeof(bm), &bm )) return;
1688  }
1689  else
1690  {
1691  PCURICON_OBJECT pIcon = NULL;
1692  //if (!BmpSysMenu) BmpSysMenu = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_CLOSE));
1693  //bmp = BmpSysMenu;
1694  //if (! GreGetObject(bmp, sizeof(bm), &bm)) return;
1695  /* only use right half of the bitmap */
1696  //bmp_xoffset = bm.bmWidth / 2;
1697  //bm.bmWidth -= bmp_xoffset;
1698  if (WndOwner)
1699  {
1700  pIcon = NC_IconForWindow(WndOwner);
1701  // FIXME: NC_IconForWindow should reference it for us */
1702  if (pIcon) UserReferenceObject(pIcon);
1703  }
1704  ERR("Draw ICON\n");
1705  if (pIcon)
1706  {
1709  LONG x = rect->left - cx/2 + 1 + (rect->bottom - rect->top)/2; // this is really what Window does
1710  LONG y = (rect->top + rect->bottom)/2 - cy/2; // center
1711  UserDrawIconEx(hdc, x, y, pIcon, cx, cy, 0, NULL, DI_NORMAL);
1712  UserDereferenceObject(pIcon);
1713  }
1714  return;
1715  }
1716  goto got_bitmap;
1719  break;
1721  r.right += 1;
1723  break;
1725  r.right += 1;
1727  break;
1730  break;
1733  break;
1734  case (INT_PTR)HBMMENU_CALLBACK:
1735  {
1736  DRAWITEMSTRUCT drawItem;
1737  POINT origorg;
1738  drawItem.CtlType = ODT_MENU;
1739  drawItem.CtlID = 0;
1740  drawItem.itemID = lpitem->wID;
1741  drawItem.itemAction = odaction;
1742  drawItem.itemState = (lpitem->fState & MF_CHECKED)?ODS_CHECKED:0;
1743  drawItem.itemState |= (lpitem->fState & MF_DEFAULT)?ODS_DEFAULT:0;
1744  drawItem.itemState |= (lpitem->fState & MF_DISABLED)?ODS_DISABLED:0;
1745  drawItem.itemState |= (lpitem->fState & MF_GRAYED)?ODS_GRAYED|ODS_DISABLED:0;
1746  drawItem.itemState |= (lpitem->fState & MF_HILITE)?ODS_SELECTED:0;
1747  drawItem.itemState |= (!(Menu->fFlags & MNF_UNDERLINE))?ODS_NOACCEL:0;
1748  drawItem.itemState |= (Menu->fFlags & MNF_INACTIVE)?ODS_INACTIVE:0;
1749  drawItem.hwndItem = (HWND)UserHMGetHandle(Menu);
1750  drawItem.hDC = hdc;
1751  drawItem.rcItem = *rect;
1752  drawItem.itemData = lpitem->dwItemData;
1753  /* some applications make this assumption on the DC's origin */
1754  GreSetViewportOrgEx( hdc, lpitem->xItem, lpitem->yItem, &origorg);
1755  RECTL_vOffsetRect( &drawItem.rcItem, - lpitem->xItem, - lpitem->yItem);
1756  co_IntSendMessage( UserHMGetHandle(WndOwner), WM_DRAWITEM, 0, (LPARAM)&drawItem);
1757  GreSetViewportOrgEx( hdc, origorg.x, origorg.y, NULL);
1758  return;
1759  }
1760  break;
1761 
1763  case (I