[gtk+] Add an example for custom css
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add an example for custom css
- Date: Fri, 14 Jan 2011 03:20:12 +0000 (UTC)
commit b23839c7a5ed92959d2badc112d1d4709c1fb64b
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jan 13 22:19:58 2011 -0500
Add an example for custom css
docs/reference/gtk/migrating-GtkStyleContext.xml | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/docs/reference/gtk/migrating-GtkStyleContext.xml b/docs/reference/gtk/migrating-GtkStyleContext.xml
index ef87ab5..42ede40 100644
--- a/docs/reference/gtk/migrating-GtkStyleContext.xml
+++ b/docs/reference/gtk/migrating-GtkStyleContext.xml
@@ -556,7 +556,24 @@
Typically, the provider will be a #GtkCssProvider, which parse CSS
information from a file or from a string.
</para>
-
+ <example>
+ <title>Using a custom GtkStyleProvider</title>
+ <programlisting>
+ GtkStyleContext *context;
+ GtkCssProvider *provider;
+
+ context = gtk_widget_get_style_context (widget);
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider),
+ ".frame1 {\n"
+ " border-image: url('gradient1.png') 10 10 10 10 stretch;\n"
+ "}\n", -1, NULL);
+ gtk_style_context_add_provider (context,
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (provider);
+ </programlisting>
+ </example>
<para>
Notice that you can also get style information from custom resources
by implementing the #GtkStyleProvider interface yourself. This is
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]