static gint gd_tagged_entry_tag_panel_get_height (GdTaggedEntryTag *tag, GdTaggedEntry *entry) { GtkWidget *widget = GTK_WIDGET (entry); gint height, req_height; GtkRequisition requisition; GtkAllocation allocation; GtkBorder margin; gtk_widget_get_allocation (widget, &allocation); gtk_widget_get_preferred_size (widget, &requisition, NULL); gd_tagged_entry_tag_get_margin (tag, entry, &margin); /* the tag panel height is the whole entry height, minus the tag margins */ req_height = requisition.height - gtk_widget_get_margin_top (widget) - gtk_widget_get_margin_bottom (widget); height = MIN (req_height, allocation.height) - margin.top - margin.bottom; return height; }
static void gd_tagged_entry_tag_panel_get_position (GdTaggedEntry *self, gint *x_out, gint *y_out) { GtkWidget *widget = GTK_WIDGET (self); gint text_x, text_y, text_width, text_height, req_height; GtkAllocation allocation; GtkRequisition requisition; gtk_widget_get_allocation (widget, &allocation); gtk_widget_get_preferred_size (widget, &requisition, NULL); req_height = requisition.height - gtk_widget_get_margin_top (widget) - gtk_widget_get_margin_bottom (widget); gd_tagged_entry_get_text_area_size (GTK_ENTRY (self), &text_x, &text_y, &text_width, &text_height); /* allocate the panel immediately after the text area */ if (x_out) *x_out = allocation.x + text_x + text_width; if (y_out) *y_out = allocation.y + (gint) floor ((allocation.height - req_height) / 2); }
/* * Class: org_java_gtk_gtk_Widget * Method: gtk_widget_get_margin_bottom * Signature: (J)I */ JNIEXPORT jint JNICALL Java_org_java_1gtk_gtk_Widget_gtk_1widget_1get_1margin_1bottom (JNIEnv *env, jclass cls, jlong widget) { return (jint)gtk_widget_get_margin_bottom((GtkWidget*)widget); }
static void attachment_paned_notify_cb (EAttachmentPaned *paned, GParamSpec *pspec, GtkExpander *expander) { GtkAllocation toplevel_allocation; GtkWidget *toplevel; GtkWidget *child; GtkLabel *label; const gchar *text; label = GTK_LABEL (paned->priv->show_hide_label); /* Update the expander label and set the right bottom margin around the handle. */ if (gtk_expander_get_expanded (expander)) { gint bottom, value; text = _("Hide Attachment _Bar"); bottom = gtk_widget_get_margin_bottom (paned->priv->controls_container); value = bottom - paned->priv->vpaned_handle_size; gtk_widget_set_margin_bottom ( paned->priv->controls_container, (value < 0) ? 0 : value); } else { gtk_widget_set_margin_bottom (paned->priv->controls_container, 6); text = _("Show Attachment _Bar"); } gtk_label_set_text_with_mnemonic (label, text); /* Resize the top-level window if required conditions are met. * This is based on gtk_expander_resize_toplevel(), but adapted * to the fact our GtkExpander has no direct child widget. */ if (!e_attachment_paned_get_resize_toplevel (paned)) return; if (!gtk_widget_get_realized (GTK_WIDGET (paned))) return; child = gtk_paned_get_child2 (GTK_PANED (paned)); toplevel = gtk_widget_get_toplevel (GTK_WIDGET (paned)); if (toplevel == NULL) return; if (!gtk_widget_get_realized (GTK_WIDGET (toplevel))) return; gtk_widget_get_allocation (toplevel, &toplevel_allocation); if (gtk_expander_get_expanded (expander)) { GtkRequisition child_requisition; gtk_widget_get_preferred_size ( child, &child_requisition, NULL); toplevel_allocation.height += child_requisition.height; } else { GtkAllocation child_allocation; gtk_widget_get_allocation (child, &child_allocation); toplevel_allocation.height -= child_allocation.height; } gtk_window_resize ( GTK_WINDOW (toplevel), toplevel_allocation.width, toplevel_allocation.height); }