33 #include "container.h" |
33 #include "container.h" |
34 #include "../../ucx/mempool.h" |
34 #include "../../ucx/mempool.h" |
35 #include "../common/context.h" |
35 #include "../common/context.h" |
36 #include "../common/object.h" |
36 #include "../common/object.h" |
37 |
37 |
|
38 static void set_alignment(GtkWidget *widget, float xalign, float yalign) { |
|
39 #if GTK_MAJOR_VERSION >= 3 && GTK_MINOR_VERSION >= 16 |
|
40 gtk_label_set_xalign(GTK_LABEL(widget), xalign); |
|
41 gtk_label_set_yalign(GTK_LABEL(widget), yalign); |
|
42 #else |
|
43 gtk_misc_set_alignment(GTK_MISC(widget), xalign, yalign); |
|
44 #endif |
|
45 } |
|
46 |
38 UIWIDGET ui_label(UiObject *obj, char *label) { |
47 UIWIDGET ui_label(UiObject *obj, char *label) { |
39 GtkWidget *widget = gtk_label_new(label); |
48 GtkWidget *widget = gtk_label_new(label); |
40 |
49 |
41 UiContainer *ct = uic_get_current_container(obj); |
50 UiContainer *ct = uic_get_current_container(obj); |
42 ct->add(ct, widget, FALSE); |
51 ct->add(ct, widget, FALSE); |
44 return widget; |
53 return widget; |
45 } |
54 } |
46 |
55 |
47 UIWIDGET ui_llabel(UiObject *obj, char *label) { |
56 UIWIDGET ui_llabel(UiObject *obj, char *label) { |
48 UIWIDGET widget = ui_label(obj, label); |
57 UIWIDGET widget = ui_label(obj, label); |
49 gtk_misc_set_alignment(GTK_MISC(widget), 0, .5); |
58 set_alignment(widget, 0, .5); |
50 return widget; |
59 return widget; |
51 } |
60 } |
52 |
61 |
53 UIWIDGET ui_rlabel(UiObject *obj, char *label) { |
62 UIWIDGET ui_rlabel(UiObject *obj, char *label) { |
54 UIWIDGET widget = ui_label(obj, label); |
63 UIWIDGET widget = ui_label(obj, label); |
55 //gtk_label_set_justify(GTK_LABEL(widget), GTK_JUSTIFY_RIGHT); |
64 //gtk_label_set_justify(GTK_LABEL(widget), GTK_JUSTIFY_RIGHT); |
56 gtk_misc_set_alignment(GTK_MISC(widget), 1, .5); |
65 |
|
66 set_alignment(widget, 1, .5); |
57 return widget; |
67 return widget; |
58 } |
68 } |
59 |
69 |
60 UIWIDGET ui_space(UiObject *obj) { |
70 UIWIDGET ui_space(UiObject *obj) { |
61 GtkWidget *widget = gtk_label_new(""); |
71 GtkWidget *widget = gtk_label_new(""); |