115 double x,
double y, gpointer data)
117 GtkWidget *w = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture));
120 GtkWidget *p, *label;
123 switch (GPOINTER_TO_UINT(data)) {
146 p = gtk_popover_new();
148 gtk_widget_set_parent(p, w);
150 label = gtk_label_new(buf);
153 gtk_widget_set_name(label,
"city_happiness_label");
154 gtk_widget_set_margin_start(label, 4);
155 gtk_widget_set_margin_end(label, 4);
156 gtk_widget_set_margin_top(label, 4);
157 gtk_widget_set_margin_bottom(label, 4);
158 gtk_popover_set_child(GTK_POPOVER(p), label);
160 gtk_popover_popup(GTK_POPOVER(p));
174 GtkWidget *label, *table;
185 static bool happiness_label_str_done;
190 pdialog->
shell = gtk_grid_new();
191 gtk_orientable_set_orientation(GTK_ORIENTABLE(pdialog->
shell),
192 GTK_ORIENTATION_VERTICAL);
197 table = gtk_grid_new();
198 gtk_widget_set_margin_bottom(table, 4);
199 gtk_widget_set_margin_end(table, 4);
200 gtk_widget_set_margin_start(table, 4);
201 gtk_widget_set_margin_top(table, 4);
202 gtk_grid_set_row_spacing(GTK_GRID(table), 10);
205 &happiness_label_str_done);
211 GtkEventController *controller;
216 label = gtk_label_new(happiness_label_str[i]);
218 gtk_widget_set_name(label,
"city_label");
219 gtk_widget_set_halign(label, GTK_ALIGN_START);
220 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
222 gtk_grid_attach(GTK_GRID(table), label, 0, i, 1, 1);
225 pdialog->
feeling_surfaces[i] = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
228 pic = gtk_picture_new();
230 gtk_widget_set_margin_start(pic, 5);
231 g_object_set_data(G_OBJECT(pic),
"pdialog", pdialog);
233 controller = GTK_EVENT_CONTROLLER(gtk_gesture_click_new());
234 g_signal_connect(controller,
"pressed",
236 gtk_widget_add_controller(pic, controller);
238 gtk_widget_set_halign(pic, GTK_ALIGN_START);
239 gtk_widget_set_valign(pic, GTK_ALIGN_START);
241 gtk_grid_attach(GTK_GRID(table), pic, 1, i, 1, 1);
247 _(
"Additional information is available%svia left "
248 "click on the citizens."), low_dlg ?
"\n" :
" ");
249 label = gtk_label_new(buf);
250 gtk_widget_set_name(label,
"city_label");
251 gtk_widget_set_halign(label, GTK_ALIGN_START);
252 gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
255 gtk_widget_show(pdialog->
shell);
const char * text_happiness_cities(const struct city *pcity)
const char * text_happiness_nationality(const struct city *pcity)
const char * text_happiness_wonders(const struct city *pcity)
const char * text_happiness_units(const struct city *pcity)
const char * text_happiness_luxuries(const struct city *pcity)
const char * text_happiness_buildings(const struct city *pcity)