From 43cf92a277e85c42258d9299d108673ff4b3f92b Mon Sep 17 00:00:00 2001 From: Rustam Gamidov Date: Wed, 25 Mar 2020 09:58:16 +0200 Subject: [PATCH] button: add uiButtonPreferredSize --- ui.h | 1 + windows/button.cpp | 5 +++++ 2 files changed, 6 insertions(+) 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;