add APIs to disable Mac window std buttons
This commit is contained in:
parent
57610634d6
commit
7b82375543
|
@ -79,6 +79,9 @@ FRAMELESSHELPER_API Qt::MouseButtons getMacMouseButtons();
|
||||||
FRAMELESSHELPER_API bool setStandardWindowButtonsVisibility(QWindow *w, bool visible);
|
FRAMELESSHELPER_API bool setStandardWindowButtonsVisibility(QWindow *w, bool visible);
|
||||||
FRAMELESSHELPER_API bool setStandardWindowButtonsPosition(QWindow *w, const QPoint &pos);
|
FRAMELESSHELPER_API bool setStandardWindowButtonsPosition(QWindow *w, const QPoint &pos);
|
||||||
FRAMELESSHELPER_API QSize standardWindowButtonsSize(QWindow *w);
|
FRAMELESSHELPER_API QSize standardWindowButtonsSize(QWindow *w);
|
||||||
|
FRAMELESSHELPER_API bool setCloseBtnEnabled(QWindow *w, bool enable = true);
|
||||||
|
FRAMELESSHELPER_API bool setMinBtnEnabled(QWindow *w, bool enable = true);
|
||||||
|
FRAMELESSHELPER_API bool setZoomBtnEnabled(QWindow *w, bool enable = true);
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,6 +264,33 @@ QSize standardWindowButtonsSize(QWindow *w)
|
||||||
return QSize(width, height);
|
return QSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool setStandardWindowButtonEnabled(QWindow *w, NSWindowButton name, bool enable = true)
|
||||||
|
{
|
||||||
|
NSWindow* nswindow = getNSWindow(w);
|
||||||
|
if (nswindow == nullptr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
NSButton* btn = [nswindow standardWindowButton:name];
|
||||||
|
[btn setEnabled: enable ? YES : NO];
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool setCloseBtnEnabled(QWindow *w, bool enable)
|
||||||
|
{
|
||||||
|
return setStandardWindowButtonEnabled(w, NSWindowCloseButton, enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool setMinBtnEnabled(QWindow *w, bool enable)
|
||||||
|
{
|
||||||
|
return setStandardWindowButtonEnabled(w, NSWindowMiniaturizeButton, enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool setZoomBtnEnabled(QWindow *w, bool enable)
|
||||||
|
{
|
||||||
|
return setStandardWindowButtonEnabled(w, NSWindowZoomButton, enable);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Utilities
|
} // namespace Utilities
|
||||||
|
|
||||||
FRAMELESSHELPER_END_NAMESPACE
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
Loading…
Reference in New Issue