2016-03-26 02:39:53 +00:00
|
|
|
/* Theming/Style Classes
|
2012-05-18 05:23:45 +00:00
|
|
|
*
|
2019-02-05 09:19:57 +00:00
|
|
|
* GTK uses CSS for theming. Style classes can be associated
|
2012-05-18 05:23:45 +00:00
|
|
|
* with widgets to inform the theme about intended rendering.
|
|
|
|
*
|
|
|
|
* This demo shows some common examples where theming features
|
2020-02-03 04:17:23 +00:00
|
|
|
* of GTK are used for certain effects: primary toolbars
|
|
|
|
* and linked buttons.
|
2012-05-18 05:23:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#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)
|
|
|
|
{
|
2020-02-14 19:55:36 +00:00
|
|
|
window = gtk_window_new ();
|
2017-10-31 06:41:15 +00:00
|
|
|
gtk_window_set_display (GTK_WINDOW (window),
|
|
|
|
gtk_widget_get_display (do_widget));
|
2012-05-26 00:50:35 +00:00
|
|
|
gtk_window_set_title (GTK_WINDOW (window), "Style Classes");
|
2016-03-26 02:36:50 +00:00
|
|
|
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
2020-05-09 16:03:11 +00:00
|
|
|
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
2012-05-18 05:23:45 +00:00
|
|
|
|
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");
|
2020-05-02 21:26:54 +00:00
|
|
|
gtk_window_set_child (GTK_WINDOW (window), grid);
|
2012-05-18 05:23:45 +00:00
|
|
|
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;
|
|
|
|
}
|