button: add uiButtonPreferredSize macos implementation

This commit is contained in:
Rustam Gamidov 2020-03-25 11:52:08 +02:00
parent 580b04b41f
commit 3022e515e5
1 changed files with 7 additions and 0 deletions

View File

@ -116,6 +116,13 @@ void uiButtonSetMinSize(uiButton *b, int width, int height)
libui_btn.minHeight = height;
}
void uiButtonPreferredSize(uiButton *b, int *width, int *height)
{
NSSize s = b->button.intrinsicContentSize;
*width = s.width;
*height = s.height;
}
void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *, void *), void *data)
{
b->onClicked = f;