diff --git a/lcl/interfaces/cocoa/cocoawindows.pas b/lcl/interfaces/cocoa/cocoawindows.pas index 7e5a571faf..873c667f65 100644 --- a/lcl/interfaces/cocoa/cocoawindows.pas +++ b/lcl/interfaces/cocoa/cocoawindows.pas @@ -67,6 +67,7 @@ type procedure Close; procedure Resize; procedure Move; + procedure WindowStateChanged; function GetEnabled: Boolean; procedure SetEnabled(AValue: Boolean); @@ -136,6 +137,8 @@ type procedure windowDidResignKey(notification: NSNotification); message 'windowDidResignKey:'; procedure windowDidResize(notification: NSNotification); message 'windowDidResize:'; procedure windowDidMove(notification: NSNotification); message 'windowDidMove:'; + procedure windowDidMiniaturize(notification: NSNotification); message 'windowDidMiniaturize:'; + procedure windowDidDeminiaturize(notification: NSNotification); message 'windowDidDeminiaturize:'; // fullscreen notifications are only reported for 10.7 fullscreen procedure windowWillEnterFullScreen(notification: NSNotification); message 'windowWillEnterFullScreen:'; procedure windowDidEnterFullScreen(notification: NSNotification); message 'windowDidEnterFullScreen:'; @@ -209,6 +212,7 @@ type function lclOwnWindow: NSWindow; message 'lclOwnWindow'; procedure lclSetFrame(const r: TRect); override; function lclFrame: TRect; override; + function lclWindowState: Integer; override; procedure viewDidMoveToSuperview; override; procedure viewDidMoveToWindow; override; procedure viewWillMoveToWindow(newWindow: CocoaAll.NSWindow); override; @@ -444,6 +448,14 @@ begin end; end; +function TCocoaWindowContent.lclWindowState: Integer; +begin + if isembedded then + Result := inherited lclWindowState + else + Result := window.lclWindowState; +end; + procedure TCocoaWindowContent.viewDidMoveToSuperview; begin inherited viewDidMoveToSuperview; @@ -780,6 +792,18 @@ begin callback.Move; end; +procedure TCocoaWindow.windowDidMiniaturize(notification: NSNotification); +begin + if Assigned(callback) then + callback.WindowStateChanged; +end; + +procedure TCocoaWindow.windowDidDeminiaturize(notification: NSNotification); +begin + if Assigned(callback) then + callback.WindowStateChanged; +end; + procedure TCocoaWindow.windowWillEnterFullScreen(notification: NSNotification); begin if not isInFullScreen then isInFullScreen := true; diff --git a/lcl/interfaces/cocoa/cocoawsforms.pas b/lcl/interfaces/cocoa/cocoawsforms.pas index efc6804e19..4bcad61aea 100644 --- a/lcl/interfaces/cocoa/cocoawsforms.pas +++ b/lcl/interfaces/cocoa/cocoawsforms.pas @@ -51,6 +51,7 @@ type procedure Close; virtual; procedure Resize; virtual; procedure Move; virtual; + procedure WindowStateChanged; virtual; function GetEnabled: Boolean; virtual; procedure SetEnabled(AValue: Boolean); virtual; @@ -428,6 +429,15 @@ begin boundsDidChange(Owner); end; +procedure TLCLWindowCallback.WindowStateChanged; +var + Bounds: TRect; +begin + Bounds := HandleFrame.lclFrame; + LCLSendSizeMsg(Target, Bounds.Right - Bounds.Left, Bounds.Bottom - Bounds.Top, + Owner.lclWindowState, True); +end; + function TLCLWindowCallback.GetEnabled: Boolean; begin Result := Owner.lclIsEnabled;