diff options
| author | Simon Tatham <anakin@pobox.com> | 2015-12-06 16:00:10 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2015-12-06 16:00:10 +0000 |
| commit | 7000b0c70a409afc427b3012d55366577dc0418e (patch) | |
| tree | 2054055ebfbffd5f204016d55c27daa9b0ca5426 | |
| parent | 346584bf6e38232be8773c24fd7dedcbd7b3d9ed (diff) | |
| download | puzzles-7000b0c70a409afc427b3012d55366577dc0418e.zip puzzles-7000b0c70a409afc427b3012d55366577dc0418e.tar.gz puzzles-7000b0c70a409afc427b3012d55366577dc0418e.tar.bz2 puzzles-7000b0c70a409afc427b3012d55366577dc0418e.tar.xz | |
Implement align_label for GTK 3.[14,16).
gtk_misc_set_alignment was deprecated in GTK 3.14. But my replacement
code using gtk_label_set_{x,y}align doesn't work there, because that
function wasn't introduced until GTK 3.16, so there are two minor
versions in the middle where a third strategy is needed.
(That middle strategy doesn't permit arbitrary float alignments, but
that's OK, bceause we only actually use multiples of 0.5.)
| -rw-r--r-- | gtk.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1398,6 +1398,13 @@ static void align_label(GtkLabel *label, double x, double y) #if GTK_CHECK_VERSION(3,16,0) gtk_label_set_xalign(label, x); gtk_label_set_yalign(label, y); +#elif GTK_CHECK_VERSION(3,14,0) + gtk_widget_set_halign(GTK_WIDGET(label), + x == 0 ? GTK_ALIGN_START : + x == 1 ? GTK_ALIGN_END : GTK_ALIGN_CENTER); + gtk_widget_set_valign(GTK_WIDGET(label), + y == 0 ? GTK_ALIGN_START : + y == 1 ? GTK_ALIGN_END : GTK_ALIGN_CENTER); #else gtk_misc_set_alignment(GTK_MISC(label), x, y); #endif |