|
|
@ -391,7 +391,7 @@ protected: |
|
|
|
|
|
|
|
|
void UpdateStyle() |
|
|
void UpdateStyle() |
|
|
{ |
|
|
{ |
|
|
[Window setStyleMask:GetStyle()]; |
|
|
[Window setStyleMask: GetStyle()]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public: |
|
|
public: |
|
|
@ -404,10 +404,13 @@ public: |
|
|
class WindowImpl : public virtual WindowBaseImpl, public virtual IAvnWindow, public IWindowStateChanged |
|
|
class WindowImpl : public virtual WindowBaseImpl, public virtual IAvnWindow, public IWindowStateChanged |
|
|
{ |
|
|
{ |
|
|
private: |
|
|
private: |
|
|
bool _canResize = true; |
|
|
bool _canResize; |
|
|
SystemDecorations _hasDecorations = SystemDecorationsFull; |
|
|
bool _fullScreenActive; |
|
|
CGRect _lastUndecoratedFrame; |
|
|
SystemDecorations _decorations; |
|
|
AvnWindowState _lastWindowState; |
|
|
AvnWindowState _lastWindowState; |
|
|
|
|
|
bool _inSetWindowState; |
|
|
|
|
|
NSRect _preZoomSize; |
|
|
|
|
|
bool _transitioningWindowState; |
|
|
|
|
|
|
|
|
FORWARD_IUNKNOWN() |
|
|
FORWARD_IUNKNOWN() |
|
|
BEGIN_INTERFACE_MAP() |
|
|
BEGIN_INTERFACE_MAP() |
|
|
@ -421,6 +424,11 @@ private: |
|
|
ComPtr<IAvnWindowEvents> WindowEvents; |
|
|
ComPtr<IAvnWindowEvents> WindowEvents; |
|
|
WindowImpl(IAvnWindowEvents* events, IAvnGlContext* gl) : WindowBaseImpl(events, gl) |
|
|
WindowImpl(IAvnWindowEvents* events, IAvnGlContext* gl) : WindowBaseImpl(events, gl) |
|
|
{ |
|
|
{ |
|
|
|
|
|
_fullScreenActive = false; |
|
|
|
|
|
_canResize = true; |
|
|
|
|
|
_decorations = SystemDecorationsFull; |
|
|
|
|
|
_transitioningWindowState = false; |
|
|
|
|
|
_inSetWindowState = false; |
|
|
_lastWindowState = Normal; |
|
|
_lastWindowState = Normal; |
|
|
WindowEvents = events; |
|
|
WindowEvents = events; |
|
|
[Window setCanBecomeKeyAndMain]; |
|
|
[Window setCanBecomeKeyAndMain]; |
|
|
@ -428,6 +436,20 @@ private: |
|
|
[Window setTabbingMode:NSWindowTabbingModeDisallowed]; |
|
|
[Window setTabbingMode:NSWindowTabbingModeDisallowed]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void HideOrShowTrafficLights () |
|
|
|
|
|
{ |
|
|
|
|
|
for (id subview in Window.contentView.superview.subviews) { |
|
|
|
|
|
if ([subview isKindOfClass:NSClassFromString(@"NSTitlebarContainerView")]) { |
|
|
|
|
|
NSView *titlebarView = [subview subviews][0]; |
|
|
|
|
|
for (id button in titlebarView.subviews) { |
|
|
|
|
|
if ([button isKindOfClass:[NSButton class]]) { |
|
|
|
|
|
[button setHidden: (_decorations != SystemDecorationsFull)]; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
virtual HRESULT Show () override |
|
|
virtual HRESULT Show () override |
|
|
{ |
|
|
{ |
|
|
@autoreleasepool |
|
|
@autoreleasepool |
|
|
@ -439,6 +461,8 @@ private: |
|
|
|
|
|
|
|
|
WindowBaseImpl::Show(); |
|
|
WindowBaseImpl::Show(); |
|
|
|
|
|
|
|
|
|
|
|
HideOrShowTrafficLights(); |
|
|
|
|
|
|
|
|
return SetWindowState(_lastWindowState); |
|
|
return SetWindowState(_lastWindowState); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -459,41 +483,69 @@ private: |
|
|
[cparent->Window addChildWindow:Window ordered:NSWindowAbove]; |
|
|
[cparent->Window addChildWindow:Window ordered:NSWindowAbove]; |
|
|
WindowBaseImpl::Show(); |
|
|
WindowBaseImpl::Show(); |
|
|
|
|
|
|
|
|
|
|
|
HideOrShowTrafficLights(); |
|
|
|
|
|
|
|
|
return S_OK; |
|
|
return S_OK; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void StartStateTransition () override |
|
|
|
|
|
{ |
|
|
|
|
|
_transitioningWindowState = true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void EndStateTransition () override |
|
|
|
|
|
{ |
|
|
|
|
|
_transitioningWindowState = false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SystemDecorations Decorations () override |
|
|
|
|
|
{ |
|
|
|
|
|
return _decorations; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
AvnWindowState WindowState () override |
|
|
|
|
|
{ |
|
|
|
|
|
return _lastWindowState; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void WindowStateChanged () override |
|
|
void WindowStateChanged () override |
|
|
{ |
|
|
{ |
|
|
AvnWindowState state; |
|
|
if(!_inSetWindowState && !_transitioningWindowState) |
|
|
GetWindowState(&state); |
|
|
{ |
|
|
WindowEvents->WindowStateChanged(state); |
|
|
AvnWindowState state; |
|
|
|
|
|
GetWindowState(&state); |
|
|
|
|
|
|
|
|
|
|
|
if(_lastWindowState != state) |
|
|
|
|
|
{ |
|
|
|
|
|
_lastWindowState = state; |
|
|
|
|
|
WindowEvents->WindowStateChanged(state); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bool UndecoratedIsMaximized () |
|
|
bool UndecoratedIsMaximized () |
|
|
{ |
|
|
{ |
|
|
return CGRectEqualToRect([Window frame], [Window screen].visibleFrame); |
|
|
auto windowSize = [Window frame]; |
|
|
|
|
|
auto available = [Window screen].visibleFrame; |
|
|
|
|
|
return CGRectEqualToRect(windowSize, available); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bool IsZoomed () |
|
|
bool IsZoomed () |
|
|
{ |
|
|
{ |
|
|
return _hasDecorations != SystemDecorationsNone ? [Window isZoomed] : UndecoratedIsMaximized(); |
|
|
return _decorations == SystemDecorationsFull ? [Window isZoomed] : UndecoratedIsMaximized(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void DoZoom() |
|
|
void DoZoom() |
|
|
{ |
|
|
{ |
|
|
switch (_hasDecorations) |
|
|
switch (_decorations) |
|
|
{ |
|
|
{ |
|
|
case SystemDecorationsNone: |
|
|
case SystemDecorationsNone: |
|
|
if (!UndecoratedIsMaximized()) |
|
|
case SystemDecorationsBorderOnly: |
|
|
{ |
|
|
[Window setFrame:[Window screen].visibleFrame display:true]; |
|
|
_lastUndecoratedFrame = [Window frame]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Window zoom:Window]; |
|
|
|
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case SystemDecorationsBorderOnly: |
|
|
|
|
|
case SystemDecorationsFull: |
|
|
case SystemDecorationsFull: |
|
|
[Window performZoom:Window]; |
|
|
[Window performZoom:Window]; |
|
|
break; |
|
|
break; |
|
|
@ -510,25 +562,52 @@ private: |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
virtual HRESULT SetHasDecorations(SystemDecorations value) override |
|
|
virtual HRESULT SetDecorations(SystemDecorations value) override |
|
|
{ |
|
|
{ |
|
|
@autoreleasepool |
|
|
@autoreleasepool |
|
|
{ |
|
|
{ |
|
|
_hasDecorations = value; |
|
|
auto currentWindowState = _lastWindowState; |
|
|
|
|
|
_decorations = value; |
|
|
|
|
|
|
|
|
|
|
|
if(_fullScreenActive) |
|
|
|
|
|
{ |
|
|
|
|
|
return S_OK; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
auto currentFrame = [Window frame]; |
|
|
|
|
|
|
|
|
UpdateStyle(); |
|
|
UpdateStyle(); |
|
|
|
|
|
|
|
|
|
|
|
HideOrShowTrafficLights(); |
|
|
|
|
|
|
|
|
switch (_hasDecorations) |
|
|
switch (_decorations) |
|
|
{ |
|
|
{ |
|
|
case SystemDecorationsNone: |
|
|
case SystemDecorationsNone: |
|
|
[Window setHasShadow:NO]; |
|
|
[Window setHasShadow:NO]; |
|
|
[Window setTitleVisibility:NSWindowTitleHidden]; |
|
|
[Window setTitleVisibility:NSWindowTitleHidden]; |
|
|
[Window setTitlebarAppearsTransparent:YES]; |
|
|
[Window setTitlebarAppearsTransparent:YES]; |
|
|
|
|
|
|
|
|
|
|
|
if(currentWindowState == Maximized) |
|
|
|
|
|
{ |
|
|
|
|
|
if(!UndecoratedIsMaximized()) |
|
|
|
|
|
{ |
|
|
|
|
|
DoZoom(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case SystemDecorationsBorderOnly: |
|
|
case SystemDecorationsBorderOnly: |
|
|
[Window setHasShadow:YES]; |
|
|
[Window setHasShadow:YES]; |
|
|
[Window setTitleVisibility:NSWindowTitleHidden]; |
|
|
[Window setTitleVisibility:NSWindowTitleHidden]; |
|
|
[Window setTitlebarAppearsTransparent:YES]; |
|
|
[Window setTitlebarAppearsTransparent:YES]; |
|
|
|
|
|
|
|
|
|
|
|
if(currentWindowState == Maximized) |
|
|
|
|
|
{ |
|
|
|
|
|
if(!UndecoratedIsMaximized()) |
|
|
|
|
|
{ |
|
|
|
|
|
DoZoom(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case SystemDecorationsFull: |
|
|
case SystemDecorationsFull: |
|
|
@ -536,6 +615,13 @@ private: |
|
|
[Window setTitleVisibility:NSWindowTitleVisible]; |
|
|
[Window setTitleVisibility:NSWindowTitleVisible]; |
|
|
[Window setTitlebarAppearsTransparent:NO]; |
|
|
[Window setTitlebarAppearsTransparent:NO]; |
|
|
[Window setTitle:_lastTitle]; |
|
|
[Window setTitle:_lastTitle]; |
|
|
|
|
|
|
|
|
|
|
|
if(currentWindowState == Maximized) |
|
|
|
|
|
{ |
|
|
|
|
|
auto newFrame = [Window contentRectForFrameRect:[Window frame]].size; |
|
|
|
|
|
|
|
|
|
|
|
[View setFrameSize:newFrame]; |
|
|
|
|
|
} |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -592,13 +678,19 @@ private: |
|
|
return E_POINTER; |
|
|
return E_POINTER; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(([Window styleMask] & NSWindowStyleMaskFullScreen) == NSWindowStyleMaskFullScreen) |
|
|
|
|
|
{ |
|
|
|
|
|
*ret = FullScreen; |
|
|
|
|
|
return S_OK; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if([Window isMiniaturized]) |
|
|
if([Window isMiniaturized]) |
|
|
{ |
|
|
{ |
|
|
*ret = Minimized; |
|
|
*ret = Minimized; |
|
|
return S_OK; |
|
|
return S_OK; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if([Window isZoomed]) |
|
|
if(IsZoomed()) |
|
|
{ |
|
|
{ |
|
|
*ret = Maximized; |
|
|
*ret = Maximized; |
|
|
return S_OK; |
|
|
return S_OK; |
|
|
@ -610,16 +702,57 @@ private: |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void EnterFullScreenMode () |
|
|
|
|
|
{ |
|
|
|
|
|
_fullScreenActive = true; |
|
|
|
|
|
|
|
|
|
|
|
[Window setHasShadow:YES]; |
|
|
|
|
|
[Window setTitleVisibility:NSWindowTitleVisible]; |
|
|
|
|
|
[Window setTitlebarAppearsTransparent:NO]; |
|
|
|
|
|
[Window setTitle:_lastTitle]; |
|
|
|
|
|
|
|
|
|
|
|
[Window setStyleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskResizable]; |
|
|
|
|
|
|
|
|
|
|
|
[Window toggleFullScreen:nullptr]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ExitFullScreenMode () |
|
|
|
|
|
{ |
|
|
|
|
|
[Window toggleFullScreen:nullptr]; |
|
|
|
|
|
|
|
|
|
|
|
_fullScreenActive = false; |
|
|
|
|
|
|
|
|
|
|
|
SetDecorations(_decorations); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
virtual HRESULT SetWindowState (AvnWindowState state) override |
|
|
virtual HRESULT SetWindowState (AvnWindowState state) override |
|
|
{ |
|
|
{ |
|
|
@autoreleasepool |
|
|
@autoreleasepool |
|
|
{ |
|
|
{ |
|
|
|
|
|
if(_lastWindowState == state) |
|
|
|
|
|
{ |
|
|
|
|
|
return S_OK; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_inSetWindowState = true; |
|
|
|
|
|
|
|
|
|
|
|
auto currentState = _lastWindowState; |
|
|
_lastWindowState = state; |
|
|
_lastWindowState = state; |
|
|
|
|
|
|
|
|
|
|
|
if(currentState == Normal) |
|
|
|
|
|
{ |
|
|
|
|
|
_preZoomSize = [Window frame]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(_shown) |
|
|
if(_shown) |
|
|
{ |
|
|
{ |
|
|
switch (state) { |
|
|
switch (state) { |
|
|
case Maximized: |
|
|
case Maximized: |
|
|
|
|
|
if(currentState == FullScreen) |
|
|
|
|
|
{ |
|
|
|
|
|
ExitFullScreenMode(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
lastPositionSet.X = 0; |
|
|
lastPositionSet.X = 0; |
|
|
lastPositionSet.Y = 0; |
|
|
lastPositionSet.Y = 0; |
|
|
|
|
|
|
|
|
@ -635,40 +768,66 @@ private: |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case Minimized: |
|
|
case Minimized: |
|
|
[Window miniaturize:Window]; |
|
|
if(currentState == FullScreen) |
|
|
|
|
|
{ |
|
|
|
|
|
ExitFullScreenMode(); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
[Window miniaturize:Window]; |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case FullScreen: |
|
|
|
|
|
if([Window isMiniaturized]) |
|
|
|
|
|
{ |
|
|
|
|
|
[Window deminiaturize:Window]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
EnterFullScreenMode(); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
default: |
|
|
case Normal: |
|
|
if([Window isMiniaturized]) |
|
|
if([Window isMiniaturized]) |
|
|
{ |
|
|
{ |
|
|
[Window deminiaturize:Window]; |
|
|
[Window deminiaturize:Window]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(currentState == FullScreen) |
|
|
|
|
|
{ |
|
|
|
|
|
ExitFullScreenMode(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(IsZoomed()) |
|
|
if(IsZoomed()) |
|
|
{ |
|
|
{ |
|
|
DoZoom(); |
|
|
if(_decorations == SystemDecorationsFull) |
|
|
|
|
|
{ |
|
|
|
|
|
DoZoom(); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
[Window setFrame:_preZoomSize display:true]; |
|
|
|
|
|
auto newFrame = [Window contentRectForFrameRect:[Window frame]].size; |
|
|
|
|
|
|
|
|
|
|
|
[View setFrameSize:newFrame]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_inSetWindowState = false; |
|
|
|
|
|
|
|
|
return S_OK; |
|
|
return S_OK; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
virtual void OnResized () override |
|
|
virtual void OnResized () override |
|
|
{ |
|
|
{ |
|
|
if(_shown) |
|
|
if(_shown && !_inSetWindowState && !_transitioningWindowState) |
|
|
{ |
|
|
{ |
|
|
auto windowState = [Window isMiniaturized] ? Minimized |
|
|
WindowStateChanged(); |
|
|
: (IsZoomed() ? Maximized : Normal); |
|
|
|
|
|
|
|
|
|
|
|
if (windowState != _lastWindowState) |
|
|
|
|
|
{ |
|
|
|
|
|
_lastWindowState = windowState; |
|
|
|
|
|
|
|
|
|
|
|
WindowEvents->WindowStateChanged(windowState); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -677,22 +836,23 @@ protected: |
|
|
{ |
|
|
{ |
|
|
unsigned long s = NSWindowStyleMaskBorderless; |
|
|
unsigned long s = NSWindowStyleMaskBorderless; |
|
|
|
|
|
|
|
|
switch (_hasDecorations) |
|
|
switch (_decorations) |
|
|
{ |
|
|
{ |
|
|
case SystemDecorationsNone: |
|
|
case SystemDecorationsNone: |
|
|
|
|
|
s = s | NSWindowStyleMaskFullSizeContentView | NSWindowStyleMaskMiniaturizable; |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case SystemDecorationsBorderOnly: |
|
|
case SystemDecorationsBorderOnly: |
|
|
s = s | NSWindowStyleMaskTitled | NSWindowStyleMaskFullSizeContentView; |
|
|
s = s | NSWindowStyleMaskTitled | NSWindowStyleMaskFullSizeContentView | NSWindowStyleMaskMiniaturizable; |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case SystemDecorationsFull: |
|
|
case SystemDecorationsFull: |
|
|
s = s | NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskBorderless; |
|
|
s = s | NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskBorderless; |
|
|
|
|
|
|
|
|
if(_canResize) |
|
|
if(_canResize) |
|
|
{ |
|
|
{ |
|
|
s = s | NSWindowStyleMaskResizable; |
|
|
s = s | NSWindowStyleMaskResizable; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -1171,6 +1331,20 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (void)performClose:(id)sender |
|
|
|
|
|
{ |
|
|
|
|
|
if([[self delegate] respondsToSelector:@selector(windowShouldClose:)]) |
|
|
|
|
|
{ |
|
|
|
|
|
if(![[self delegate] windowShouldClose:self]) return; |
|
|
|
|
|
} |
|
|
|
|
|
else if([self respondsToSelector:@selector(windowShouldClose:)]) |
|
|
|
|
|
{ |
|
|
|
|
|
if(![self windowShouldClose:self]) return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[self close]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
- (void)pollModalSession:(nonnull NSModalSession)session |
|
|
- (void)pollModalSession:(nonnull NSModalSession)session |
|
|
{ |
|
|
{ |
|
|
auto response = [NSApp runModalSession:session]; |
|
|
auto response = [NSApp runModalSession:session]; |
|
|
@ -1399,7 +1573,66 @@ NSArray* AllLoopModes = [NSArray arrayWithObjects: NSDefaultRunLoopMode, NSEvent |
|
|
|
|
|
|
|
|
- (void)windowDidResize:(NSNotification *)notification |
|
|
- (void)windowDidResize:(NSNotification *)notification |
|
|
{ |
|
|
{ |
|
|
_parent->OnResized(); |
|
|
auto parent = dynamic_cast<IWindowStateChanged*>(_parent.operator->()); |
|
|
|
|
|
|
|
|
|
|
|
if(parent != nullptr) |
|
|
|
|
|
{ |
|
|
|
|
|
parent->WindowStateChanged(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (void)windowWillExitFullScreen:(NSNotification *)notification |
|
|
|
|
|
{ |
|
|
|
|
|
auto parent = dynamic_cast<IWindowStateChanged*>(_parent.operator->()); |
|
|
|
|
|
|
|
|
|
|
|
if(parent != nullptr) |
|
|
|
|
|
{ |
|
|
|
|
|
parent->StartStateTransition(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (void)windowDidExitFullScreen:(NSNotification *)notification |
|
|
|
|
|
{ |
|
|
|
|
|
auto parent = dynamic_cast<IWindowStateChanged*>(_parent.operator->()); |
|
|
|
|
|
|
|
|
|
|
|
if(parent != nullptr) |
|
|
|
|
|
{ |
|
|
|
|
|
parent->EndStateTransition(); |
|
|
|
|
|
|
|
|
|
|
|
if(parent->Decorations() != SystemDecorationsFull && parent->WindowState() == Maximized) |
|
|
|
|
|
{ |
|
|
|
|
|
NSRect screenRect = [[self screen] visibleFrame]; |
|
|
|
|
|
[self setFrame:screenRect display:YES]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(parent->WindowState() == Minimized) |
|
|
|
|
|
{ |
|
|
|
|
|
[self miniaturize:nullptr]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
parent->WindowStateChanged(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (void)windowWillEnterFullScreen:(NSNotification *)notification |
|
|
|
|
|
{ |
|
|
|
|
|
auto parent = dynamic_cast<IWindowStateChanged*>(_parent.operator->()); |
|
|
|
|
|
|
|
|
|
|
|
if(parent != nullptr) |
|
|
|
|
|
{ |
|
|
|
|
|
parent->StartStateTransition(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
- (void)windowDidEnterFullScreen:(NSNotification *)notification |
|
|
|
|
|
{ |
|
|
|
|
|
auto parent = dynamic_cast<IWindowStateChanged*>(_parent.operator->()); |
|
|
|
|
|
|
|
|
|
|
|
if(parent != nullptr) |
|
|
|
|
|
{ |
|
|
|
|
|
parent->EndStateTransition(); |
|
|
|
|
|
parent->WindowStateChanged(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame |
|
|
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame |
|
|
|