mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
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.)
This commit is contained in:
7
gtk.c
7
gtk.c
@ -1398,6 +1398,13 @@ static void align_label(GtkLabel *label, double x, double y)
|
|||||||
#if GTK_CHECK_VERSION(3,16,0)
|
#if GTK_CHECK_VERSION(3,16,0)
|
||||||
gtk_label_set_xalign(label, x);
|
gtk_label_set_xalign(label, x);
|
||||||
gtk_label_set_yalign(label, y);
|
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
|
#else
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), x, y);
|
gtk_misc_set_alignment(GTK_MISC(label), x, y);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user