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