forked from AuroraMiddleware/gtk
gtk-demo: Visual improvement to solitaire
Make the fields visible.
This commit is contained in:
parent
5e2aeee9b0
commit
3340a5ee04
@ -334,6 +334,14 @@ create_board (GtkWidget *window)
|
|||||||
int x, y;
|
int x, y;
|
||||||
GtkDragSource *source;
|
GtkDragSource *source;
|
||||||
GtkDropTarget *target;
|
GtkDropTarget *target;
|
||||||
|
GtkCssProvider *provider;
|
||||||
|
const char css[] =
|
||||||
|
".solitaire-field {"
|
||||||
|
" border: 1px solid lightgray;"
|
||||||
|
"}";
|
||||||
|
|
||||||
|
provider = gtk_css_provider_new ();
|
||||||
|
gtk_css_provider_load_from_data (provider, css, -1);
|
||||||
|
|
||||||
grid = gtk_grid_new ();
|
grid = gtk_grid_new ();
|
||||||
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
|
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
|
||||||
@ -352,6 +360,10 @@ create_board (GtkWidget *window)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
image = gtk_image_new ();
|
image = gtk_image_new ();
|
||||||
|
gtk_style_context_add_provider (gtk_widget_get_style_context (image),
|
||||||
|
GTK_STYLE_PROVIDER (provider),
|
||||||
|
800);
|
||||||
|
gtk_widget_add_css_class (image, "solitaire-field");
|
||||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||||
if (x != 3 || y != 3)
|
if (x != 3 || y != 3)
|
||||||
{
|
{
|
||||||
@ -393,6 +405,8 @@ create_board (GtkWidget *window)
|
|||||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (target));
|
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (target));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user