Hi !
I was searching for a way to implement an ekstra button on the Native Title Bar - both on Mac and Windows, but have not succeeded with that.
Is this possible at all ? - or should I go for the Non-native title bar in that case ??
Thanks
Bo
Hi !
I was searching for a way to implement an ekstra button on the Native Title Bar - both on Mac and Windows, but have not succeeded with that.
Is this possible at all ? - or should I go for the Non-native title bar in that case ??
Thanks
Bo
For MacOs you can get hold of the underlying NSWindow class and mess around with the buttons on the toolbar. I’m not sure if you can add one but i think you can.
I have this method showHideWindowButtons and you can call it like this
...
OSXUIUtils::showHideWindowButtons(getPeer()->getNativeHandle(), true, true, 1.0);
....
void OSXUIUtils::showHideWindowButtons(void* view, bool show, bool animate, float duration)
{
NSView* nsView = (NSView*)view;
NSWindow* nsWindow = [nsView window];
//[nsWindow setWindowController:(__kindof NSWindowController * _Nullable)
CGFloat alpha = show ? 1.0 : 0.0;
if (animate)
{
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:duration];
[[[nsWindow standardWindowButton:NSWindowMiniaturizeButton] animator] setAlphaValue:alpha];
[[[nsWindow standardWindowButton:NSWindowZoomButton] animator] setAlphaValue:alpha];
[[[nsWindow standardWindowButton:NSWindowCloseButton] animator] setAlphaValue:alpha];
[NSAnimationContext endGrouping];
}
else
{
[[nsWindow standardWindowButton:NSWindowMiniaturizeButton] setAlphaValue:alpha];
[[nsWindow standardWindowButton:NSWindowZoomButton] setAlphaValue:alpha];
[[nsWindow standardWindowButton:NSWindowCloseButton] setAlphaValue:alpha];
}
}
Thanks Edwin, I’ll look into this..