2013-02-01 17:56:10 +00:00
|
|
|
/* CSS Theming/Style Classes
|
2012-05-18 05:23:45 +00:00
|
|
|
*
|
|
|
|
* GTK+ uses CSS for theming. Style classes can be associated
|
|
|
|
* with widgets to inform the theme about intended rendering.
|
|
|
|
*
|
|
|
|
* This demo shows some common examples where theming features
|
|
|
|
* of GTK+ are used for certain effects: primary toolbars,
|
|
|
|
* inline toolbars and linked buttons.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
static GtkWidget *window = NULL;
|
|
|
|
|
|
|
|
GtkWidget *
|
2012-05-26 00:39:59 +00:00
|
|
|
do_theming_style_classes (GtkWidget *do_widget)
|
2012-05-18 05:23:45 +00:00
|
|
|
{
|
|
|
|
GtkWidget *grid;
|
|
|
|
GtkBuilder *builder;
|
|
|
|
|
|
|
|
if (!window)
|
|
|
|
{
|
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
gtk_window_set_screen (GTK_WINDOW (window),
|
|
|
|
gtk_widget_get_screen (do_widget));
|
2012-05-26 00:50:35 +00:00
|
|
|
gtk_window_set_title (GTK_WINDOW (window), "Style Classes");
|
2012-05-18 05:23:45 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (window), 12);
|
|
|
|
g_signal_connect (window, "destroy",
|
|
|
|
G_CALLBACK (gtk_widget_destroyed), &window);
|
|
|
|
|
2015-06-28 13:23:28 +00:00
|
|
|
builder = gtk_builder_new_from_resource ("/theming_style_classes/theming.ui");
|
2012-05-18 05:23:45 +00:00
|
|
|
|
|
|
|
grid = (GtkWidget *)gtk_builder_get_object (builder, "grid");
|
|
|
|
gtk_widget_show_all (grid);
|
|
|
|
gtk_container_add (GTK_CONTAINER (window), grid);
|
|
|
|
g_object_unref (builder);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!gtk_widget_get_visible (window))
|
2015-06-28 13:23:28 +00:00
|
|
|
gtk_widget_show (window);
|
2012-05-18 05:23:45 +00:00
|
|
|
else
|
2015-06-28 13:23:28 +00:00
|
|
|
gtk_widget_destroy (window);
|
2012-05-18 05:23:45 +00:00
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|