Adds uiGridDelete for unix

This commit is contained in:
emersion 2016-06-17 22:23:33 +02:00
parent 1fa79fd3b6
commit 65f078102a
2 changed files with 20 additions and 0 deletions

1
ui.h
View File

@ -655,6 +655,7 @@ typedef struct uiGrid uiGrid;
#define uiGrid(this) ((uiGrid *) (this))
_UI_EXTERN void uiGridAppend(uiGrid *g, uiControl *c, int left, int top, int xspan, int yspan, int hexpand, uiAlign halign, int vexpand, uiAlign valign);
_UI_EXTERN void uiGridInsertAt(uiGrid *g, uiControl *c, uiControl *existing, uiAt at, int xspan, int yspan, int hexpand, uiAlign halign, int vexpand, uiAlign valign);
_UI_EXTERN void uiGridDelete(uiGrid *g, int index);
_UI_EXTERN int uiGridPadded(uiGrid *g);
_UI_EXTERN void uiGridSetPadded(uiGrid *g, int padded);
_UI_EXTERN uiGrid *uiNewGrid(void);

View File

@ -108,6 +108,25 @@ void uiGridInsertAt(uiGrid *g, uiControl *c, uiControl *existing, uiAt at, int x
g_array_append_val(g->children, gc);
}
void uiGridDelete(uiGrid *g, int index)
{
struct gridChild *gc;
GtkWidget *widget;
gc = ctrl(g, index);
widget = GTK_WIDGET(uiControlHandle(gc->c));
uiControlSetParent(gc->c, NULL);
uiUnixControlSetContainer(uiUnixControl(gc->c), g->container, TRUE);
gtk_widget_set_hexpand(widget, gc->oldhexpand);
gtk_widget_set_halign(widget, gc->oldhalign);
gtk_widget_set_vexpand(widget, gc->oldvexpand);
gtk_widget_set_valign(widget, gc->oldvalign);
g_array_remove_index(g->children, index);
}
int uiGridPadded(uiGrid *g)
{
return g->padded;