1 #pragma once 2 3 #define IS_ATOM(x) \ 4 (((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000)) 5 6 #define MENU_ITEM_TYPE(flags) \ 7 ((flags) & (MF_STRING | MF_BITMAP | MF_OWNERDRAW | MF_SEPARATOR)) 8 9 #ifndef MF_END 10 #define MF_END (0x0080) 11 #endif 12 13 typedef struct tagMENUSTATE 14 { 15 PPOPUPMENU pGlobalPopupMenu; 16 struct 17 { 18 ULONG fMenuStarted:1; 19 ULONG fIsSysMenu:1; 20 ULONG fInsideMenuLoop:1; 21 ULONG fButtonDown:1; 22 ULONG fInEndMenu:1; 23 ULONG fUnderline:1; 24 ULONG fButtonAlwaysDown:1; 25 ULONG fDragging:1; 26 ULONG fModelessMenu:1; 27 ULONG fInCallHandleMenuMessages:1; 28 ULONG fDragAndDrop:1; 29 ULONG fAutoDismiss:1; 30 ULONG fAboutToAutoDismiss:1; 31 ULONG fIgnoreButtonUp:1; 32 ULONG fMouseOffMenu:1; 33 ULONG fInDoDragDrop:1; 34 ULONG fActiveNoForeground:1; 35 ULONG fNotifyByPos:1; 36 ULONG fSetCapture:1; 37 ULONG iAniDropDir:5; 38 }; 39 POINT ptMouseLast; 40 INT mnFocus; 41 INT cmdLast; 42 PTHREADINFO ptiMenuStateOwner; 43 DWORD dwLockCount; 44 struct tagMENUSTATE* pmnsPrev; 45 POINT ptButtonDown; 46 ULONG_PTR uButtonDownHitArea; 47 UINT uButtonDownIndex; 48 INT vkButtonDown; 49 ULONG_PTR uDraggingHitArea; 50 UINT uDraggingIndex; 51 UINT uDraggingFlags; 52 HDC hdcWndAni; 53 DWORD dwAniStartTime; 54 INT ixAni; 55 INT iyAni; 56 INT cxAni; 57 INT cyAni; 58 HBITMAP hbmAni; 59 HDC hdcAni; 60 } MENUSTATE, *PMENUSTATE; 61 62 typedef struct _SETMENUITEMRECT 63 { 64 UINT uItem; 65 BOOL fByPosition; 66 RECTL rcRect; 67 } SETMENUITEMRECT, *PSETMENUITEMRECT; 68 69 70 // 71 // Legacy ReactOS Menu transfer structures. 72 // 73 typedef struct tagROSMENUINFO 74 { 75 /* ----------- MENUINFO ----------- */ 76 DWORD cbSize; 77 DWORD fMask; 78 DWORD dwStyle; 79 UINT cyMax; 80 HBRUSH hbrBack; 81 DWORD dwContextHelpID; 82 ULONG_PTR dwMenuData; 83 /* ----------- Extra ----------- */ 84 ULONG fFlags; /* Menu flags (MF_POPUP, MF_SYSMENU) */ 85 UINT iItem; /* Currently focused item */ 86 UINT cItems; /* Number of items in the menu */ 87 WORD cxMenu; /* Width of the whole menu */ 88 WORD cyMenu; /* Height of the whole menu */ 89 ULONG cxTextAlign; 90 PWND spwndNotify; /* window receiving the messages for ownerdraw */ 91 INT iTop; 92 INT iMaxTop; 93 DWORD dwArrowsOn:2; 94 95 HMENU Self; /* Handle of this menu */ 96 HWND Wnd; /* Window containing the menu */ 97 BOOL TimeToHide; /* Request hiding when receiving a second click in the top-level menu item */ 98 } ROSMENUINFO, *PROSMENUINFO; 99 100 typedef struct tagROSMENUITEMINFO 101 { 102 /* ----------- MENUITEMINFOW ----------- */ 103 UINT cbSize; 104 UINT fMask; 105 UINT fType; 106 UINT fState; 107 UINT wID; 108 HMENU hSubMenu; 109 HBITMAP hbmpChecked; 110 HBITMAP hbmpUnchecked; 111 DWORD dwItemData; 112 LPWSTR dwTypeData; 113 UINT cch; 114 HBITMAP hbmpItem; 115 /* ----------- Extra ----------- */ 116 RECT Rect; /* Item area (relative to menu window) */ 117 UINT dxTab; /* X position of text after Tab */ 118 LPWSTR lpstr; /* Copy of the text pointer in MenuItem->Text */ 119 SIZE maxBmpSize; /* Maximum size of the bitmap items in MIIM_BITMAP state */ 120 } ROSMENUITEMINFO, *PROSMENUITEMINFO; 121 // 122 // 123 // 124 125 BOOL FASTCALL IntIsMenu(HMENU); 126 127 PMENU FASTCALL 128 IntGetMenuObject(HMENU hMenu); 129 130 #define IntReleaseMenuObject(MenuObj) \ 131 UserDereferenceObject(MenuObj) 132 133 BOOLEAN 134 UserDestroyMenuObject(PVOID Object); 135 136 BOOL FASTCALL 137 IntDestroyMenuObject(PMENU MenuObject, BOOL bRecurse); 138 139 PMENU FASTCALL 140 IntCloneMenu(PMENU Source); 141 142 int FASTCALL 143 IntGetMenuItemByFlag(PMENU MenuObject, UINT uSearchBy, UINT fFlag, 144 PMENU *SubMenu, PITEM *MenuItem, 145 PITEM *PrevMenuItem); 146 147 BOOL FASTCALL 148 IntCleanupMenus(struct _EPROCESS *Process, PPROCESSINFO Win32Process); 149 150 BOOL FASTCALL 151 IntInsertMenuItem(_In_ PMENU MenuObject, UINT uItem, BOOL fByPosition, PROSMENUITEMINFO ItemInfo, PUNICODE_STRING lpstr); 152 153 PMENU FASTCALL 154 IntGetSystemMenu(PWND Window, BOOL bRevert); 155 156 UINT FASTCALL IntFindSubMenu(HMENU *hMenu, HMENU hSubTarget ); 157 UINT FASTCALL IntGetMenuState( HMENU hMenu, UINT uId, UINT uFlags); 158 BOOL FASTCALL IntRemoveMenuItem(PMENU Menu, UINT uPosition, UINT uFlags, BOOL bRecurse); 159 PITEM FASTCALL MENU_FindItem( PMENU *pmenu, UINT *nPos, UINT wFlags ); 160 BOOL FASTCALL IntMenuItemInfo(PMENU Menu, UINT Item, BOOL ByPosition, PROSMENUITEMINFO UnsafeItemInfo, BOOL SetOrGet, PUNICODE_STRING lpstr); 161 BOOL FASTCALL IntSetMenu(PWND Wnd,HMENU Menu,BOOL *Changed); 162 UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, PWND pWnd, BOOL suppress_draw ); 163 BOOL MenuInit(VOID); 164 VOID MENU_TrackKbdMenuBar(PWND pwnd, UINT wParam, WCHAR wChar); 165 VOID MENU_TrackMouseMenuBar( PWND pWnd, ULONG ht, POINT pt); 166 BOOL WINAPI PopupMenuWndProc(PWND Wnd,UINT Message,WPARAM wParam,LPARAM lParam,LRESULT *lResult); 167 BOOL FASTCALL IntSetMenuItemInfo(PMENU, PITEM, PROSMENUITEMINFO, PUNICODE_STRING); 168 PWND MENU_IsMenuActive(VOID); 169 void MENU_EndMenu( PWND pwnd ); 170 void FASTCALL MENU_InitSysMenuPopup(PMENU menu, DWORD style, DWORD clsStyle, LONG HitTest ); 171 INT FASTCALL IntMenuItemFromPoint(PWND pWnd, HMENU hMenu, POINT ptScreen); 172 BOOL WINAPI IntTrackPopupMenuEx( PMENU menu, UINT wFlags, int x, int y, PWND pWnd, LPTPMPARAMS lpTpm); 173