|
|
@ -410,7 +410,7 @@ class WindowImpl : public virtual WindowBaseImpl, public virtual IAvnWindow, pub |
|
|
{ |
|
|
{ |
|
|
private: |
|
|
private: |
|
|
bool _canResize = true; |
|
|
bool _canResize = true; |
|
|
int _hasDecorations = 2; |
|
|
SystemDecorations _hasDecorations = SystemDecorationsFull; |
|
|
CGRect _lastUndecoratedFrame; |
|
|
CGRect _lastUndecoratedFrame; |
|
|
AvnWindowState _lastWindowState; |
|
|
AvnWindowState _lastWindowState; |
|
|
|
|
|
|
|
|
@ -475,23 +475,26 @@ private: |
|
|
|
|
|
|
|
|
bool IsZoomed () |
|
|
bool IsZoomed () |
|
|
{ |
|
|
{ |
|
|
return _hasDecorations > 0 ? [Window isZoomed] : UndecoratedIsMaximized(); |
|
|
return _hasDecorations != SystemDecorationsNone ? [Window isZoomed] : UndecoratedIsMaximized(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void DoZoom() |
|
|
void DoZoom() |
|
|
{ |
|
|
{ |
|
|
if (_hasDecorations > 0) |
|
|
switch (_hasDecorations) |
|
|
{ |
|
|
{ |
|
|
[Window performZoom:Window]; |
|
|
case SystemDecorationsNone: |
|
|
} |
|
|
if (!UndecoratedIsMaximized()) |
|
|
else |
|
|
{ |
|
|
{ |
|
|
_lastUndecoratedFrame = [Window frame]; |
|
|
if (!UndecoratedIsMaximized()) |
|
|
} |
|
|
{ |
|
|
|
|
|
_lastUndecoratedFrame = [Window frame]; |
|
|
[Window zoom:Window]; |
|
|
} |
|
|
break; |
|
|
|
|
|
|
|
|
[Window zoom:Window]; |
|
|
case SystemDecorationsBorderOnly: |
|
|
|
|
|
case SystemDecorationsFull: |
|
|
|
|
|
[Window performZoom:Window]; |
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -509,32 +512,31 @@ private: |
|
|
{ |
|
|
{ |
|
|
@autoreleasepool |
|
|
@autoreleasepool |
|
|
{ |
|
|
{ |
|
|
_hasDecorations = value; |
|
|
_hasDecorations = (SystemDecorations)value; |
|
|
UpdateStyle(); |
|
|
UpdateStyle(); |
|
|
|
|
|
|
|
|
// full |
|
|
switch (_hasDecorations) |
|
|
if (_hasDecorations == 2) |
|
|
|
|
|
{ |
|
|
|
|
|
[Window setHasShadow:YES]; |
|
|
|
|
|
[Window setTitleVisibility:NSWindowTitleVisible]; |
|
|
|
|
|
[Window setTitlebarAppearsTransparent:NO]; |
|
|
|
|
|
[Window setTitle:_lastTitle]; |
|
|
|
|
|
} |
|
|
|
|
|
// border only |
|
|
|
|
|
else if (_hasDecorations == 1) |
|
|
|
|
|
{ |
|
|
|
|
|
[Window setHasShadow:YES]; |
|
|
|
|
|
[Window setTitleVisibility:NSWindowTitleHidden]; |
|
|
|
|
|
[Window setTitlebarAppearsTransparent:YES]; |
|
|
|
|
|
} |
|
|
|
|
|
// none |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
{ |
|
|
[Window setHasShadow:NO]; |
|
|
case SystemDecorationsNone: |
|
|
[Window setTitleVisibility:NSWindowTitleHidden]; |
|
|
[Window setHasShadow:NO]; |
|
|
[Window setTitlebarAppearsTransparent:YES]; |
|
|
[Window setTitleVisibility:NSWindowTitleHidden]; |
|
|
|
|
|
[Window setTitlebarAppearsTransparent:YES]; |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case SystemDecorationsBorderOnly: |
|
|
|
|
|
[Window setHasShadow:YES]; |
|
|
|
|
|
[Window setTitleVisibility:NSWindowTitleHidden]; |
|
|
|
|
|
[Window setTitlebarAppearsTransparent:YES]; |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case SystemDecorationsFull: |
|
|
|
|
|
[Window setHasShadow:YES]; |
|
|
|
|
|
[Window setTitleVisibility:NSWindowTitleVisible]; |
|
|
|
|
|
[Window setTitlebarAppearsTransparent:NO]; |
|
|
|
|
|
[Window setTitle:_lastTitle]; |
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return S_OK; |
|
|
return S_OK; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -666,12 +668,26 @@ protected: |
|
|
virtual NSWindowStyleMask GetStyle() override |
|
|
virtual NSWindowStyleMask GetStyle() override |
|
|
{ |
|
|
{ |
|
|
unsigned long s = NSWindowStyleMaskBorderless; |
|
|
unsigned long s = NSWindowStyleMaskBorderless; |
|
|
if(_hasDecorations == 1) |
|
|
|
|
|
s = s | NSWindowStyleMaskTitled | NSWindowStyleMaskFullSizeContentView; |
|
|
switch (_hasDecorations) |
|
|
if(_hasDecorations == 2) |
|
|
{ |
|
|
s = s | NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskBorderless; |
|
|
case SystemDecorationsNone: |
|
|
if(_hasDecorations == 2 && _canResize) |
|
|
break; |
|
|
s = s | NSWindowStyleMaskResizable; |
|
|
|
|
|
|
|
|
case SystemDecorationsBorderOnly: |
|
|
|
|
|
s = s | NSWindowStyleMaskTitled | NSWindowStyleMaskFullSizeContentView; |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case SystemDecorationsFull: |
|
|
|
|
|
s = s | NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskBorderless; |
|
|
|
|
|
if(_canResize) |
|
|
|
|
|
{ |
|
|
|
|
|
s = s | NSWindowStyleMaskResizable; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return s; |
|
|
return s; |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|