diff --git a/ui.h b/ui.h index 00419a11..e1a540cc 100644 --- a/ui.h +++ b/ui.h @@ -139,6 +139,7 @@ _UI_EXTERN void uiButtonSetText(uiButton *b, const char *text); _UI_EXTERN void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *b, void *data), void *data); _UI_EXTERN uiButton *uiNewButton(const char *text); _UI_EXTERN void uiButtonSetMinSize(uiButton *b, int width, int height); +_UI_EXTERN void uiButtonPreferredSize(uiButton *b, int *width, int *height); typedef struct uiBox uiBox; #define uiBox(this) ((uiBox *) (this)) diff --git a/windows/button.cpp b/windows/button.cpp index 9affd985..3acaaa67 100644 --- a/windows/button.cpp +++ b/windows/button.cpp @@ -89,6 +89,11 @@ void uiButtonSetMinSize(uiButton *b, int width, int height) uiWindowsControlMinimumSizeChanged(uiWindowsControl(b)); } +void uiButtonPreferredSize(uiButton *b, int *width, int *height) +{ + uiButtonMinimumSize(uiWindowsControl(b), width, height); +} + void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *, void *), void *data) { b->onClicked = f;