summaryrefslogtreecommitdiff
path: root/app/wlib/gtklib/control.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/wlib/gtklib/control.c')
-rw-r--r--app/wlib/gtklib/control.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/app/wlib/gtklib/control.c b/app/wlib/gtklib/control.c
index e824c94..c891924 100644
--- a/app/wlib/gtklib/control.c
+++ b/app/wlib/gtklib/control.c
@@ -109,7 +109,9 @@ wPos_t wLabelWidth(
GtkRequisition requisition;
widget = gtk_label_new(wlibConvertInput(label));
gtk_widget_size_request(widget, &requisition);
+ g_object_ref_sink (widget);
gtk_widget_destroy(widget);
+ g_object_unref(widget);
return requisition.width+8;
}
@@ -162,7 +164,7 @@ wPos_t wControlGetPosX(
wPos_t wControlGetPosY(
wControl_p b) /* Control */
{
- return b->realY - BORDERSIZE - ((b->parent->option&F_MENUBAR)?MENUH:0);
+ return b->realY - BORDERSIZE - ((b->parent->option&F_MENUBAR)?b->parent->menu_height:0);
}
/**
@@ -179,15 +181,21 @@ void wControlSetPos(
wPos_t y)
{
b->realX = x;
- b->realY = y + BORDERSIZE + ((b->parent->option&F_MENUBAR)?MENUH:0);
+ b->realY = y + BORDERSIZE + ((b->parent->option&F_MENUBAR)?b->parent->menu_height:0);
if (b->widget) {
gtk_fixed_move(GTK_FIXED(b->parent->widget), b->widget, b->realX, b->realY);
}
if (b->label) {
+ GtkRequisition requisition, reqwidget;
+ gtk_widget_size_request(b->label, &requisition);
+ if (b->widget)
+ gtk_widget_size_request(b->widget, &reqwidget);
+ else
+ reqwidget.height = requisition.height;
gtk_fixed_move(GTK_FIXED(b->parent->widget), b->label, b->realX-b->labelW,
- b->realY+LABEL_OFFSET);
+ b->realY+(reqwidget.height/2 - requisition.height/2));
}
}
@@ -202,14 +210,18 @@ void wControlSetLabel(
wControl_p b,
const char * labelStr)
{
- GtkRequisition requisition;
+ GtkRequisition requisition,reqwidget;
if (b->label) {
gtk_label_set_text(GTK_LABEL(b->label), wlibConvertInput(labelStr));
gtk_widget_size_request(b->label, &requisition);
+ if (b->widget)
+ gtk_widget_size_request(b->widget, &reqwidget);
+ else
+ reqwidget.height = requisition.height;
b->labelW = requisition.width+8;
gtk_fixed_move(GTK_FIXED(b->parent->widget), b->label, b->realX-b->labelW,
- b->realY+LABEL_OFFSET);
+ b->realY+(reqwidget.height/2 - requisition.height/2));
} else {
b->labelW = wlibAddLabel(b, labelStr);
}