summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@openedhand.com>2008-04-17 15:41:00 +0000
committerEmmanuele Bassi <ebassi@openedhand.com>2008-04-17 15:41:00 +0000
commit7e3bf4204b8c90aa075a3ef8c18faf39d24300a2 (patch)
treea102a54c994a4b563da889b06f2b18e184661f6d /examples
parentf37accefda8f3556a6c3d26caeb597c6dbde117c (diff)
downloadclutter-gtk-7e3bf4204b8c90aa075a3ef8c18faf39d24300a2.tar.gz
2008-04-17 Emmanuele Bassi <ebassi@openedhand.com>
* clutter-gtk/gtk-clutter-util.[ch]: Add utility functions to ClutterGtk to be able to retrieve the ClutterColor equivalent of the various style color components of a GtkWidget. * clutter-gtk/Makefile.am: Add gtk-clutter-util.[ch] to the build. * doc/reference/clutter-gtk-docs.sgml: Add the new section in the documentation. * examples/gtk-clutter-events.c (create_colors): Test the newly added color retrieval API.
Diffstat (limited to 'examples')
-rw-r--r--examples/gtk-clutter-events.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/examples/gtk-clutter-events.c b/examples/gtk-clutter-events.c
index bb2f04e..43a9b29 100644
--- a/examples/gtk-clutter-events.c
+++ b/examples/gtk-clutter-events.c
@@ -2,6 +2,7 @@
#include <clutter/clutter.h>
#include <clutter-gtk/gtk-clutter-embed.h>
+#include <clutter-gtk/gtk-clutter-util.h>
typedef struct {
@@ -63,20 +64,8 @@ on_opacity_changed (GtkSpinButton *button, EventApp *app)
static void
create_colors (EventApp *app, ClutterColor *stage, ClutterColor *text)
{
- GtkStyle *style = gtk_widget_get_style (app->window);
- GdkColor color;
-
- /* Set the stage color to base[NORMAL] */
- color = style->bg[GTK_STATE_NORMAL];
- stage->red = (guint8) ((color.red/65535.0) * 255);
- stage->green = (guint8) ((color.green/65535.0) * 255);
- stage->blue = (guint8) ((color.blue/65535.0) * 255);
-
- /* Now the text color */
- color = style->text[GTK_STATE_NORMAL];
- text->red =(guint8) ((color.red/65535.0) * 255);
- text->green = (guint8) ((color.green/65535.0) * 255);
- text->blue = (guint8) ((color.blue/65535.0) * 255);
+ gtk_clutter_get_bg_color (app->window, GTK_STATE_NORMAL, stage);
+ gtk_clutter_get_text_color (app->window, GTK_STATE_NORMAL, text);
}
static gboolean