LCL-Cocoa: Update a changed main menu correctly. Issue #30809, patch from Zoë Peterson.

git-svn-id: trunk@54635 -
This commit is contained in:
juha 2017-04-19 08:14:55 +00:00
parent ae6948b6b3
commit 1ea9fd9ddd
2 changed files with 16 additions and 0 deletions

View File

@ -2250,6 +2250,21 @@ begin
end;
end;
function TCocoaWidgetSet.SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean;
var
lWin: NSWindow;
begin
Result := False;
lWin := GetNSObjectWindow(NSObject(AWindowHandle));
if (lWin <> nil) and lWin.isKindOfClass(TCocoaWindow) and
(TCocoaWindow(lWin).LCLForm.Menu.Handle = AMenuHandle) then
begin
if lWin.isKeyWindow or lWin.isMainWindow then
SetMainMenu(AMenuHandle, TCocoaWindow(lWin).LCLForm.Menu);
Result := True;
end;
end;
{------------------------------- FONT AND TEXT --------------------------------}
function TCocoaWidgetSet.SetTextColor(DC: HDC; Color: TColorRef): TColorRef;

View File

@ -169,6 +169,7 @@ function SetCursor(ACursor: HCURSOR): HCURSOR; override;
function SetCursorPos(X, Y: Integer): Boolean; override;
function SetFocus(Handle: HWND): HWND; override;
function SetForegroundWindow(HWnd: HWND): boolean; override;
function SetMenu(AWindowHandle: HWND; AMenuHandle: HMENU): Boolean; override;
function SetProp(Handle: hwnd; Str: PChar; Data: Pointer) : Boolean; override;
function SetROP2(DC: HDC; Mode: Integer): Integer; override;
function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo; bRedraw : Boolean): Integer; override;