button: add uiButtonPreferredSize GTK3 implementation

This commit is contained in:
Rustam Gamidov 2020-03-25 11:39:02 +02:00 committed by Rustam Gamidov
parent 43cf92a277
commit 580b04b41f
1 changed files with 7 additions and 0 deletions

View File

@ -38,6 +38,13 @@ void uiButtonSetMinSize(uiButton *b, int width, int height)
gtk_widget_set_size_request(b->widget, width, 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) void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *, void *), void *data)
{ {
b->onClicked = f; b->onClicked = f;