GTK: hook SetMinSize. fuck around with gtk_widget_set_size_request() so the window can be resized smaller than the initial size.

This commit is contained in:
StapleButter
2017-10-05 01:22:03 +02:00
parent 5d5311c53c
commit f714c492b9
2 changed files with 9 additions and 0 deletions

View File

@ -85,6 +85,11 @@ _UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gbool
{ \
gtk_widget_grab_focus(type(c)->widget); \
}
#define uiUnixControlDefaultSetMinSize(type) \
static void type ## SetMinSize(uiControl *c, int w, int h) \
{ \
gtk_widget_set_size_request(type(c)->widget, w, h); \
}
// TODO this whole addedBefore stuff is a MASSIVE HACK.
#define uiUnixControlDefaultSetContainer(type) \
static void type ## SetContainer(uiUnixControl *c, GtkContainer *container, gboolean remove) \
@ -112,6 +117,7 @@ _UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gbool
uiUnixControlDefaultEnable(type) \
uiUnixControlDefaultDisable(type) \
uiUnixControlDefaultSetFocus(type) \
uiUnixControlDefaultSetMinSize(type) \
uiUnixControlDefaultSetContainer(type)
#define uiUnixControlAllDefaults(type) \
@ -133,6 +139,7 @@ _UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gbool
uiControl(var)->Enable = type ## Enable; \
uiControl(var)->Disable = type ## Disable; \
uiControl(var)->SetFocus = type ## SetFocus; \
uiControl(var)->SetMinSize = type ## SetMinSize; \
uiUnixControl(var)->SetContainer = type ## SetContainer;
// TODO document
_UI_EXTERN uiUnixControl *uiUnixAllocControl(size_t n, uint32_t typesig, const char *typenamestr);