From 580b04b41f80734596c93e991d3b0a812ff78b0b Mon Sep 17 00:00:00 2001 From: Rustam Gamidov Date: Wed, 25 Mar 2020 11:39:02 +0200 Subject: [PATCH] button: add uiButtonPreferredSize GTK3 implementation --- unix/button.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/unix/button.c b/unix/button.c index 38713a16..6c23dbb5 100644 --- a/unix/button.c +++ b/unix/button.c @@ -38,6 +38,13 @@ void uiButtonSetMinSize(uiButton *b, int width, int height) gtk_widget_set_size_request(b->widget, width, height); } +void uiButtonPreferredSize(uiButton *b, int *width, int *height) +{ + gtk_widget_show(b->widget); + gtk_widget_get_preferred_height(b->widget, NULL, height); + gtk_widget_get_preferred_width(b->widget, NULL, width); +} + void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *, void *), void *data) { b->onClicked = f;