diff --git a/rtl/win16/win31.pp b/rtl/win16/win31.pp index 9e21135fb8..8342bb1fc9 100644 --- a/rtl/win16/win31.pp +++ b/rtl/win16/win31.pp @@ -599,6 +599,13 @@ type { WM_MOUSEACTIVATE return codes } MA_NOACTIVATEANDEAT = 4; +{ Menu support } +{ Flags for TrackPopupMenu } + TPM_RIGHTBUTTON = $0002; + TPM_LEFTALIGN = $0000; + TPM_CENTERALIGN = $0004; + TPM_RIGHTALIGN = $0008; + function GetFreeSystemResources(SysResource: UINT): UINT; external 'USER'; procedure LogError(err: UINT; lpInfo: FarPointer); external 'KERNEL'; @@ -779,6 +786,9 @@ function ScrollWindowEx(hwnd: HWND; dx, dy: SmallInt; prcScroll, prcClip: LPRECT; hrgnUpdate: HRGN; prcUpdate: LPRECT; flags: UINT): SmallInt; external 'USER'; +{ Menu support } +function IsMenu(hmenu: HMENU): BOOL; external 'USER'; + implementation end. diff --git a/rtl/win16/winprocsh.inc b/rtl/win16/winprocsh.inc index 848af72891..4391621541 100644 --- a/rtl/win16/winprocsh.inc +++ b/rtl/win16/winprocsh.inc @@ -1019,3 +1019,45 @@ function TranslateAccelerator(hwnd: HWND; haccl: HACCEL; lpmsg: LPMSG): SmallInt {$ifdef VAR_PARAMS_ARE_FAR} function TranslateAccelerator(hwnd: HWND; haccl: HACCEL; var msg: MSG): SmallInt; external 'USER'; {$endif} + +{ Menu support } + +function CreateMenu: HMENU; external 'USER'; +function CreatePopupMenu: HMENU; external 'USER'; +function LoadMenu(hinst: HINST; lpszMenuName: LPCSTR): HMENU; external 'USER'; +function LoadMenuIndirect(lpmith: LPVOID): HMENU; external 'USER'; + +function DestroyMenu(hmenu: HMENU): BOOL; external 'USER'; + +function GetMenu(hwnd: HWND): HMENU; external 'USER'; +function SetMenu(hwnd: HWND; hmenu: HMENU): BOOL; external 'USER'; + +function GetSystemMenu(hwnd: HWND; fRevert: BOOL): HMENU; external 'USER'; + +procedure DrawMenuBar(hwnd: HWND); external 'USER'; + +function HiliteMenuItem(hwnd: HWND; hmenu: HMENU; idHiliteItem, fuHilite: UINT): BOOL; external 'USER'; + +function InsertMenu(hmenu: HMENU; idItem, fuFlags, idNewItem: UINT; lpNewItem: LPCSTR): BOOL; external 'USER'; +function AppendMenu(hmenu: HMENU; fuFlags, idNewItem: UINT; lpNewItem: LPCSTR): BOOL; external 'USER'; +function ModifyMenu(hmenu: HMENU; idItem, fuFlags, idNewItem: UINT; lpNewItem: LPCSTR): BOOL; external 'USER'; +function RemoveMenu(hmenu: HMENU; idItem, fuFlags: UINT): BOOL; external 'USER'; +function DeleteMenu(hmenu: HMENU; idItem, fuFlags: UINT): BOOL; external 'USER'; + +function ChangeMenu(hmenu: HMENU; uPosition: UINT; lpNewItem: LPCSTR; idNewItem, fuFlags: UINT): BOOL; external 'USER'; + +function EnableMenuItem(hmenu: HMENU; idEnableItem, uEnable: UINT): BOOL; external 'USER'; +function CheckMenuItem(hmenu: HMENU; idCheckItem, uCheck: UINT): BOOL; external 'USER'; + +function GetSubMenu(hmenu: HMENU; nPos: SmallInt): HMENU; external 'USER'; + +function GetMenuItemCount(hmenu: HMENU): SmallInt; external 'USER'; +function GetMenuItemID(hmenu: HMENU; pos: SmallInt): UINT; external 'USER'; + +function GetMenuString(hmenu: HMENU; idItem: UINT; lpsz: LPSTR; cbMax: SmallInt; fwFlags: UINT): SmallInt; external 'USER'; +function GetMenuState(hmenu: HMENU; idItem, fuFlags: UINT): UINT; external 'USER'; + +function SetMenuItemBitmaps(hmenu: HMENU; idItem, fuFlags: UINT; hbmUnchecked, hbmChecked: HBITMAP): BOOL; external 'USER'; +function GetMenuCheckMarkDimensions: DWORD; external 'USER'; + +function TrackPopupMenu(hmenu: HMENU; fuFlags: UINT; x, y, nReserved: SmallInt; hwnd: HWND; lprc: LPRECT): BOOL; external 'USER'; diff --git a/rtl/win16/wintypes.inc b/rtl/win16/wintypes.inc index 61e4aedb52..0638c7cbe5 100644 --- a/rtl/win16/wintypes.inc +++ b/rtl/win16/wintypes.inc @@ -1920,3 +1920,76 @@ const type { Accelerator support } HACCEL = THandle; + +{ Menu support } + +{ Menu template header } + PMENUITEMTEMPLATEHEADER = ^MENUITEMTEMPLATEHEADER; + LPMENUITEMTEMPLATEHEADER = ^MENUITEMTEMPLATEHEADER; far; + MENUITEMTEMPLATEHEADER = record + versionNumber: UINT; + offset: UINT; + end; + TMenuItemTemplateHeader = MENUITEMTEMPLATEHEADER; + +{ Menu template item struct } + PMENUITEMTEMPLATE = ^MENUITEMTEMPLATE; + LPMENUITEMTEMPLATE = ^MENUITEMTEMPLATE; far; + MENUITEMTEMPLATE = record + mtOption: UINT; + mtID: UINT; + mtString: array [0..0] of Char; + end; + TMenuItemTemplate = MENUITEMTEMPLATE; + +const + MF_INSERT = $0000; + MF_CHANGE = $0080; + MF_APPEND = $0100; + MF_DELETE = $0200; + MF_REMOVE = $1000; + +{ Menu flags for Add/Check/EnableMenuItem() } + MF_BYCOMMAND = $0000; + MF_BYPOSITION = $0400; + + MF_SEPARATOR = $0800; + + MF_ENABLED = $0000; + MF_GRAYED = $0001; + MF_DISABLED = $0002; + + MF_UNCHECKED = $0000; + MF_CHECKED = $0008; + MF_USECHECKBITMAPS = $0200; + + MF_STRING = $0000; + MF_BITMAP = $0004; + MF_OWNERDRAW = $0100; + + MF_POPUP = $0010; + MF_MENUBARBREAK = $0020; + MF_MENUBREAK = $0040; + + MF_UNHILITE = $0000; + MF_HILITE = $0080; + + MF_SYSMENU = $2000; + MF_HELP = $4000; + MF_MOUSESELECT = $8000; + + + MF_END = $0080; { Only valid in menu resource templates } + +{ Flags for TrackPopupMenu } + TPM_LEFTBUTTON = $0000; + +{ Menu messages } + WM_INITMENU = $0116; + WM_INITMENUPOPUP = $0117; + + WM_MENUSELECT = $011F; + WM_MENUCHAR = $0120; + +{ Menu and control command messages } + WM_COMMAND = $0111;