More conversion work, including getting rid of a few now-unnecessary function declarations.
This commit is contained in:
parent
01912877ce
commit
289ca0ed78
|
@ -16,10 +16,6 @@ extern void uiFree(void *);
|
|||
|
||||
extern void complain(const char *, ...);
|
||||
|
||||
extern int isToplevel(uiControl *);
|
||||
extern int controlSelfVisible(uiControl *);
|
||||
extern void controlUpdateState(uiControl *);
|
||||
|
||||
extern void osCommitEnable(uiControl *);
|
||||
extern void osCommitDisable(uiControl *);
|
||||
|
||||
|
|
33
unix/box.c
33
unix/box.c
|
@ -14,15 +14,11 @@ struct uiBox {
|
|||
GtkSizeGroup *stretchygroup; // ensures all stretchy controls have the same size
|
||||
};
|
||||
|
||||
static void onDestroy(uiBox *b);
|
||||
uiUnixControlAllDefaultsExceptDestroy(uiBox)
|
||||
|
||||
uiUnixDefineControlWithOnDestroy(
|
||||
uiBox, // type name
|
||||
onDestroy(this); // on destroy
|
||||
)
|
||||
|
||||
static void onDestroy(uiBox *b)
|
||||
static void uiBoxDestroy(uiControl *c)
|
||||
{
|
||||
uiBox *b = uiBox(c);
|
||||
struct child *bc;
|
||||
|
||||
while (b->controls->len != 0) {
|
||||
|
@ -33,18 +29,9 @@ static void onDestroy(uiBox *b)
|
|||
ptrArrayDestroy(b->controls);
|
||||
// kill the size group
|
||||
g_object_unref(b->stretchygroup);
|
||||
}
|
||||
|
||||
static void boxContainerUpdateState(uiControl *c)
|
||||
{
|
||||
uiBox *b = uiBox(c);
|
||||
struct child *bc;
|
||||
uintmax_t i;
|
||||
|
||||
for (i = 0; i < b->controls->len; i++) {
|
||||
bc = ptrArrayIndex(b->controls, struct child *, i);
|
||||
childUpdateState(bc);
|
||||
}
|
||||
// and then ourselves
|
||||
g_object_unref(b->widget);
|
||||
uiFreeControl(uiControl(b));
|
||||
}
|
||||
|
||||
#define isStretchy(bc) childFlag(bc)
|
||||
|
@ -73,7 +60,6 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
|
|||
gtk_widget_set_hexpand(widget, FALSE);
|
||||
// TODO make the other dimension fill
|
||||
ptrArrayAppend(b->controls, bc);
|
||||
uiControlQueueResize(uiControl(b));
|
||||
}
|
||||
|
||||
void uiBoxDelete(uiBox *b, uintmax_t index)
|
||||
|
@ -85,7 +71,6 @@ void uiBoxDelete(uiBox *b, uintmax_t index)
|
|||
if (isStretchy(bc))
|
||||
gtk_size_group_remove_widget(b->stretchygroup, childWidget(bc));
|
||||
childRemove(bc);
|
||||
uiControlQueueResize(uiControl(b));
|
||||
}
|
||||
|
||||
int uiBoxPadded(uiBox *b)
|
||||
|
@ -103,14 +88,13 @@ void uiBoxSetPadded(uiBox *b, int padded)
|
|||
gtk_box_set_spacing(b->box, gtkXPadding);
|
||||
else
|
||||
gtk_box_set_spacing(b->box, 0);
|
||||
uiControlQueueResize(uiControl(b));
|
||||
}
|
||||
|
||||
static uiBox *finishNewBox(GtkOrientation orientation)
|
||||
{
|
||||
uiBox *b;
|
||||
|
||||
b = (uiBox *) uiNewControl(uiBox);
|
||||
uiUnixNewControl(uiBox, b);
|
||||
|
||||
b->widget = gtk_box_new(orientation, 0);
|
||||
b->container = GTK_CONTAINER(b->widget);
|
||||
|
@ -125,9 +109,6 @@ static uiBox *finishNewBox(GtkOrientation orientation)
|
|||
|
||||
b->controls = newPtrArray();
|
||||
|
||||
uiUnixFinishNewControl(b, uiBox);
|
||||
uiControl(b)->ContainerUpdateState = boxContainerUpdateState;
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
|
|
10
unix/child.c
10
unix/child.c
|
@ -43,7 +43,7 @@ struct child *newChild(uiControl *child, uiControl *parent, GtkContainer *parent
|
|||
c->oldvalign = gtk_widget_get_valign(c->widget);
|
||||
|
||||
uiControlSetParent(c->c, parent);
|
||||
gtk_container_add(parentContainer, c->widget);
|
||||
uiUnixControlSetContainer(uiUnixControl(c->c), parentContainer, FALSE);
|
||||
c->parent = parentContainer;
|
||||
|
||||
return c;
|
||||
|
@ -71,8 +71,9 @@ struct child *newChildWithBox(uiControl *child, uiControl *parent, GtkContainer
|
|||
|
||||
void childRemove(struct child *c)
|
||||
{
|
||||
gtk_container_remove(c->parent, c->widget);
|
||||
uiControlSetParent(c->c, NULL);
|
||||
// TODO safe with boxes?
|
||||
uiUnixControlSetContainer(uiUnixControl(c->c), parentContainer, TRUE);
|
||||
|
||||
gtk_widget_set_hexpand(c->widget, c->oldhexpand);
|
||||
gtk_widget_set_halign(c->widget, c->oldhalign);
|
||||
|
@ -99,11 +100,6 @@ GtkWidget *childWidget(struct child *c)
|
|||
return c->widget;
|
||||
}
|
||||
|
||||
void childUpdateState(struct child *c)
|
||||
{
|
||||
controlUpdateState(c->c);
|
||||
}
|
||||
|
||||
int childFlag(struct child *c)
|
||||
{
|
||||
return c->flag;
|
||||
|
|
30
unix/group.c
30
unix/group.c
|
@ -14,25 +14,16 @@ struct uiGroup {
|
|||
int margined;
|
||||
};
|
||||
|
||||
static void onDestroy(uiGroup *);
|
||||
uiUnixControlAllDefaultsExceptDestroy(uiGroup)
|
||||
|
||||
uiUnixDefineControlWithOnDestroy(
|
||||
uiGroup, // type name
|
||||
onDestroy(this); // on destroy
|
||||
)
|
||||
|
||||
static void onDestroy(uiGroup *g)
|
||||
{
|
||||
if (g->child != NULL)
|
||||
childDestroy(g->child);
|
||||
}
|
||||
|
||||
static void groupContainerUpdateState(uiControl *c)
|
||||
static void uiGroupDestroy(uiControl *c)
|
||||
{
|
||||
uiGroup *g = uiGroup(c);
|
||||
|
||||
if (g->child != NULL)
|
||||
childUpdateState(g->child);
|
||||
childDestroy(g->child);
|
||||
g_object_unref(g->widget);
|
||||
uiFreeControl(uiControl(g));
|
||||
}
|
||||
|
||||
char *uiGroupTitle(uiGroup *g)
|
||||
|
@ -43,8 +34,6 @@ char *uiGroupTitle(uiGroup *g)
|
|||
void uiGroupSetTitle(uiGroup *g, const char *text)
|
||||
{
|
||||
gtk_frame_set_label(g->frame, text);
|
||||
// changing the text might necessitate a change in the groupbox's size
|
||||
uiControlQueueResize(uiControl(g));
|
||||
}
|
||||
|
||||
void uiGroupSetChild(uiGroup *g, uiControl *child)
|
||||
|
@ -52,9 +41,6 @@ void uiGroupSetChild(uiGroup *g, uiControl *child)
|
|||
if (g->child != NULL)
|
||||
childRemove(g->child);
|
||||
g->child = newChildWithBox(child, uiControl(g), g->container, g->margined);
|
||||
if (g->child != NULL) {
|
||||
uiControlQueueResize(uiControl(g));
|
||||
}
|
||||
}
|
||||
|
||||
int uiGroupMargined(uiGroup *g)
|
||||
|
@ -67,7 +53,6 @@ void uiGroupSetMargined(uiGroup *g, int margined)
|
|||
g->margined = margined;
|
||||
if (g->child != NULL)
|
||||
childSetMargined(g->child, g->margined);
|
||||
uiControlQueueResize(uiControl(g));
|
||||
}
|
||||
|
||||
uiGroup *uiNewGroup(const char *text)
|
||||
|
@ -78,7 +63,7 @@ uiGroup *uiNewGroup(const char *text)
|
|||
PangoAttribute *bold;
|
||||
PangoAttrList *boldlist;
|
||||
|
||||
g = (uiGroup *) uiNewControl(uiGroup);
|
||||
uiUnixNewControl(uiGroup, g);
|
||||
|
||||
g->widget = gtk_frame_new(text);
|
||||
g->container = GTK_CONTAINER(g->widget);
|
||||
|
@ -100,8 +85,5 @@ uiGroup *uiNewGroup(const char *text)
|
|||
gtk_label_set_attributes(label, boldlist);
|
||||
pango_attr_list_unref(boldlist); // thanks baedert in irc.gimp.net/#gtk+
|
||||
|
||||
uiUnixFinishNewControl(g, uiGroup);
|
||||
uiControl(g)->ContainerUpdateState = groupContainerUpdateState;
|
||||
|
||||
return g;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ extern struct child *newChildWithBox(uiControl *child, uiControl *parent, GtkCon
|
|||
extern void childRemove(struct child *c);
|
||||
extern void childDestroy(struct child *c);
|
||||
extern GtkWidget *childWidget(struct child *c);
|
||||
extern void childUpdateState(struct child *c);
|
||||
extern int childFlag(struct child *c);
|
||||
extern void childSetFlag(struct child *c, int flag);
|
||||
extern GtkWidget *childBox(struct child *c);
|
||||
|
@ -46,6 +45,3 @@ extern uiDrawContext *newContext(cairo_t *);
|
|||
extern void freeContext(uiDrawContext *);
|
||||
extern uiDrawTextFont *mkTextFont(PangoFont *f, gboolean add);
|
||||
extern PangoFont *pangoDescToPangoFont(PangoFontDescription *pdesc);
|
||||
|
||||
// TODO
|
||||
#define uiControlQueueResize(...)
|
||||
|
|
Loading…
Reference in New Issue