*
* The #HildonButton can hold any valid child widget, but it usually
* contains two labels, named title and value, and it can also contain
- * an image. The contents of the button are packed together and they
- * do not expand by default (they don't use the full space of the
- * button).
+ * an image. The contents of the button are packed together inside a
+ * #GtkAlignment and they do not expand by default (they don't use the
+ * full space of the button).
*
* To change the alignment of both labels, use gtk_button_set_alignment()
*
"Title",
"Text of the title label inside the button",
NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ G_PARAM_READWRITE));
g_object_class_install_property (
gobject_class,
"Value",
"Text of the value label inside the button",
NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ G_PARAM_READWRITE));
g_object_class_install_property (
gobject_class,
gtk_widget_set_name (GTK_WIDGET (priv->title), "hildon-button-title");
gtk_widget_set_name (GTK_WIDGET (priv->value), "hildon-button-value");
+ hildon_button_set_style (self, HILDON_BUTTON_STYLE_NORMAL);
+
gtk_misc_set_alignment (GTK_MISC (priv->title), 0, 0.5);
gtk_misc_set_alignment (GTK_MISC (priv->value), 0, 0.5);
* @size_group: A #GtkSizeGroup for the button title (main label)
*
* Adds the title label of @button to @size_group.
+ *
+ * Since: 2.2
**/
void
hildon_button_add_title_size_group (HildonButton *button,
* @size_group: A #GtkSizeGroup for the button value (secondary label)
*
* Adds the value label of @button to @size_group.
+ *
+ * Since: 2.2
**/
void
hildon_button_add_value_size_group (HildonButton *button,
*
* Adds the image of @button to @size_group. You must add an image
* using hildon_button_set_image() before calling this function.
+ *
+ * Since: 2.2
**/
void
hildon_button_add_image_size_group (HildonButton *button,
*
* Convenience function to add title, value and image to size
* groups. %NULL size groups will be ignored.
+ *
+ * Since: 2.2
**/
void
hildon_button_add_size_groups (HildonButton *button,
/* If we pack both labels with (TRUE, TRUE) or (FALSE, FALSE) they
* can be painted outside of the button in some situations, see
- * NB#88126 */
- gtk_box_pack_start (GTK_BOX (priv->label_box), GTK_WIDGET (priv->title), TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (priv->label_box), GTK_WIDGET (priv->value), FALSE, FALSE, 0);
+ * NB#88126 and NB#110689 */
+ gtk_box_pack_start (GTK_BOX (priv->label_box), GTK_WIDGET (priv->title), FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->label_box), GTK_WIDGET (priv->value), TRUE, TRUE, 0);
hildon_button_construct_child (button);
}
* If @value is set to %NULL, the value label will be hidden and the
* title label will be realigned.
*
- *
* Since: 2.2
**/
void
* to change @xscale or @yscale you can just use
* gtk_button_set_alignment() instead.
*
+ * Note that for this method to work properly the, child widget of
+ * @button must be a #GtkAlignment. That's what #HildonButton uses by
+ * default, so this function will work unless you add a custom widget
+ * to @button.
+ *
* Since: 2.2
**/
void
child = gtk_bin_get_child (GTK_BIN (button));
+ /* If the button has no child, use priv->alignment, which is the default one */
+ if (child == NULL)
+ child = priv->alignment;
+
if (GTK_IS_ALIGNMENT (child)) {
- gtk_button_set_alignment (GTK_BUTTON (button), xalign, yalign);
- g_object_set (child, "xscale", xscale, "yscale", yscale, NULL);
+ gtk_alignment_set (GTK_ALIGNMENT (priv->alignment), xalign, yalign, xscale, yscale);
}
}