2017-10-11 06:05:52 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *grid;
|
|
|
|
GtkWidget *label1;
|
|
|
|
GtkWidget *label2;
|
|
|
|
GtkWidget *label3;
|
|
|
|
GtkWidget *label4;
|
|
|
|
|
|
|
|
g_setenv ("GTK_DEBUG", "baselines,layout", TRUE);
|
|
|
|
gtk_init ();
|
|
|
|
|
2020-02-14 19:55:36 +00:00
|
|
|
window = gtk_window_new ();
|
2017-10-11 06:05:52 +00:00
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 30);
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 30);
|
2020-05-02 21:26:54 +00:00
|
|
|
gtk_window_set_child (GTK_WINDOW (window), grid);
|
2017-10-11 06:05:52 +00:00
|
|
|
|
|
|
|
label1 = gtk_label_new ("Some Text");
|
|
|
|
label2 = gtk_label_new ("QQQQQQQQQ");
|
|
|
|
label3 = gtk_label_new ("Some Text");
|
|
|
|
label4 = gtk_label_new ("Some Text");
|
|
|
|
|
|
|
|
g_message ("label1: %p", label1);
|
|
|
|
g_message ("label2: %p", label2);
|
|
|
|
g_message ("label3: %p", label3);
|
|
|
|
g_message ("label4: %p", label4);
|
|
|
|
|
2023-05-09 17:08:08 +00:00
|
|
|
gtk_widget_set_valign (label1, GTK_ALIGN_BASELINE_FILL);
|
|
|
|
gtk_widget_set_valign (label2, GTK_ALIGN_BASELINE_FILL);
|
2017-10-11 06:05:52 +00:00
|
|
|
gtk_widget_set_valign (label3, GTK_ALIGN_START);
|
|
|
|
gtk_widget_set_valign (label4, GTK_ALIGN_START);
|
|
|
|
|
|
|
|
gtk_widget_set_margin_top (label1, 12);
|
|
|
|
gtk_widget_set_margin_bottom (label2, 18);
|
|
|
|
gtk_widget_set_margin_top (label3, 30);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Since none of the widgets in the second row request baseline alignment,
|
|
|
|
* GtkGrid should not compute or apply a baseline for those widgets.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), label1, 0, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), label2, 1, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), label3, 0, 1, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), label4, 1, 1, 1, 1);
|
|
|
|
|
2022-11-29 12:06:33 +00:00
|
|
|
gtk_window_present (GTK_WINDOW (window));
|
2020-02-10 03:24:47 +00:00
|
|
|
while (TRUE)
|
|
|
|
g_main_context_iteration (NULL, TRUE);
|
2017-10-11 06:05:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|