Revision: 1916
http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1916&view=rev
Author: Sikon
Date: 2008-01-05 07:53:46 -0800 (Sat, 05 Jan 2008)
Log Message:
-----------
Graphical rating, filter tabs at bottom
Added Paths:
-----------
gtkpod/trunk/src/rb_cell_renderer_rating.c
gtkpod/trunk/src/rb_cell_renderer_rating.h
gtkpod/trunk/src/rb_rating_helper.c
gtkpod/trunk/src/rb_rating_helper.h
Added: gtkpod/trunk/src/rb_cell_renderer_rating.c
===================================================================
--- gtkpod/trunk/src/rb_cell_renderer_rating.c (rev 0)
+++ gtkpod/trunk/src/rb_cell_renderer_rating.c 2008-01-05 15:53:46 UTC (rev
1916)
@@ -0,0 +1,348 @@
+/*
+ *
+ * rb-cell-renderer-rating.c
+ * arch-tag: Implementation of star rating GtkTreeView cell renderer
+ *
+ * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <[EMAIL PROTECTED]>
+ * Copyright (C) 2002 Olivier Martin <[EMAIL PROTECTED]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include "rb_cell_renderer_rating.h"
+#include "rb_rating_helper.h"
+
+static void rb_cell_renderer_rating_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void rb_cell_renderer_rating_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void rb_cell_renderer_rating_init (RBCellRendererRating *celltext);
+static void rb_cell_renderer_rating_class_init (RBCellRendererRatingClass
*class);
+static void rb_cell_renderer_rating_get_size (GtkCellRenderer *cell,
+ GtkWidget *widget,
+ GdkRectangle *rectangle,
+ gint *x_offset,
+ gint *y_offset,
+ gint *width,
+ gint *height);
+static void rb_cell_renderer_rating_render (GtkCellRenderer *cell,
+ GdkWindow *window,
+ GtkWidget *widget,
+ GdkRectangle *background_area,
+ GdkRectangle *cell_area,
+ GdkRectangle *expose_area,
+ GtkCellRendererState flags);
+static gboolean rb_cell_renderer_rating_activate (GtkCellRenderer *cell,
+ GdkEvent *event,
+ GtkWidget *widget,
+ const gchar *path,
+ GdkRectangle *background_area,
+ GdkRectangle *cell_area,
+ GtkCellRendererState flags);
+static void rb_cell_renderer_rating_finalize (GObject *object);
+
+struct RBCellRendererRatingPrivate
+{
+ double rating;
+};
+
+struct RBCellRendererRatingClassPrivate
+{
+ RBRatingPixbufs *pixbufs;
+};
+
+G_DEFINE_TYPE (RBCellRendererRating, rb_cell_renderer_rating,
GTK_TYPE_CELL_RENDERER)
+#define RB_CELL_RENDERER_RATING_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE
((o), \
+ RB_TYPE_CELL_RENDERER_RATING, \
+ RBCellRendererRatingPrivate))
+
+enum
+{
+ PROP_0,
+ PROP_RATING
+};
+
+enum
+{
+ RATED,
+ LAST_SIGNAL
+};
+
+static guint rb_cell_renderer_rating_signals[LAST_SIGNAL] = { 0 };
+
+static void
+rb_marshal_VOID__STRING_DOUBLE (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data)
+{
+ typedef void (*GMarshalFunc_VOID__STRING_DOUBLE) (gpointer data1,
+
gpointer arg_1,
+
gdouble arg_2,
+
gpointer data2);
+ register GMarshalFunc_VOID__STRING_DOUBLE callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+
+ g_return_if_fail (n_param_values == 3);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+
+ callback = (GMarshalFunc_VOID__STRING_DOUBLE) (marshal_data ?
marshal_data : cc->callback);
+
+ callback (data1,
+ (char *) g_value_get_string (param_values + 1),
+ g_value_get_double (param_values + 2),
+ data2);
+}
+
+static void
+rb_cell_renderer_rating_init (RBCellRendererRating *cellrating)
+{
+
+ cellrating->priv = RB_CELL_RENDERER_RATING_GET_PRIVATE (cellrating);
+
+ /* set the renderer able to be activated */
+ GTK_CELL_RENDERER (cellrating)->mode =
GTK_CELL_RENDERER_MODE_ACTIVATABLE;
+
+ /* create the needed icons */
+}
+
+static void
+rb_cell_renderer_rating_class_init (RBCellRendererRatingClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
+
+ object_class->finalize = rb_cell_renderer_rating_finalize;
+
+ object_class->get_property = rb_cell_renderer_rating_get_property;
+ object_class->set_property = rb_cell_renderer_rating_set_property;
+
+ cell_class->get_size = rb_cell_renderer_rating_get_size;
+ cell_class->render = rb_cell_renderer_rating_render;
+ cell_class->activate = rb_cell_renderer_rating_activate;
+
+ class->priv = g_new0 (RBCellRendererRatingClassPrivate, 1);
+ class->priv->pixbufs = rb_rating_pixbufs_new ();
+
+ rb_rating_install_rating_property (object_class, PROP_RATING);
+
+ rb_cell_renderer_rating_signals[RATED] =
+ g_signal_new ("rated",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (RBCellRendererRatingClass,
rated),
+ NULL, NULL,
+ rb_marshal_VOID__STRING_DOUBLE,
+ G_TYPE_NONE,
+ 2,
+ G_TYPE_STRING,
+ G_TYPE_DOUBLE);
+
+ g_type_class_add_private (class, sizeof (RBCellRendererRatingPrivate));
+}
+
+static void
+rb_cell_renderer_rating_finalize (GObject *object)
+{
+ RBCellRendererRating *cellrating;
+
+ cellrating = RB_CELL_RENDERER_RATING (object);
+
+ G_OBJECT_CLASS (rb_cell_renderer_rating_parent_class)->finalize
(object);
+}
+
+static void
+rb_cell_renderer_rating_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ RBCellRendererRating *cellrating = RB_CELL_RENDERER_RATING (object);
+
+ switch (param_id) {
+ case PROP_RATING:
+ g_value_set_double (value, cellrating->priv->rating);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void
+rb_cell_renderer_rating_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ RBCellRendererRating *cellrating= RB_CELL_RENDERER_RATING (object);
+
+ switch (param_id) {
+ case PROP_RATING:
+ cellrating->priv->rating = g_value_get_double (value);
+ if (cellrating->priv->rating < 0)
+ cellrating->priv->rating = 0;
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+/**
+ * rb_cell_renderer_rating_new: create a cell renderer that will
+ * display some pixbufs for representing the rating of a song.
+ * It is also able to update the rating.
+ *
+ * Return value: the new cell renderer
+ **/
+
+GtkCellRenderer *
+rb_cell_renderer_rating_new ()
+{
+ return GTK_CELL_RENDERER (gtk_type_new
(rb_cell_renderer_rating_get_type ()));
+}
+
+static void
+rb_cell_renderer_rating_get_size (GtkCellRenderer *cell,
+ GtkWidget *widget,
+ GdkRectangle *cell_area,
+ gint *x_offset,
+ gint *y_offset,
+ gint *width,
+ gint *height)
+{
+ int icon_width;
+ RBCellRendererRating *cellrating = (RBCellRendererRating *) cell;
+
+ gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_width, NULL);
+
+ if (x_offset)
+ *x_offset = 0;
+
+ if (y_offset)
+ *y_offset = 0;
+
+ if (width)
+ *width = (gint) GTK_CELL_RENDERER (cellrating)->xpad * 2 +
icon_width * RB_RATING_MAX_SCORE;
+
+ if (height)
+ *height = (gint) GTK_CELL_RENDERER (cellrating)->ypad * 2 +
icon_width;
+}
+
+static void
+rb_cell_renderer_rating_render (GtkCellRenderer *cell,
+ GdkWindow *window,
+ GtkWidget *widget,
+ GdkRectangle *background_area,
+ GdkRectangle *cell_area,
+ GdkRectangle *expose_area,
+ GtkCellRendererState flags)
+
+{
+ gboolean selected;
+ GdkRectangle pix_rect, draw_rect;
+ RBCellRendererRating *cellrating = (RBCellRendererRating *) cell;
+ RBCellRendererRatingClass *cell_class;
+
+ cellrating = RB_CELL_RENDERER_RATING (cell);
+ cell_class = RB_CELL_RENDERER_RATING_GET_CLASS (cellrating);
+ rb_cell_renderer_rating_get_size (cell, widget, cell_area,
+ &pix_rect.x,
+ &pix_rect.y,
+ &pix_rect.width,
+ &pix_rect.height);
+
+ pix_rect.x += cell_area->x;
+ pix_rect.y += cell_area->y;
+ pix_rect.width -= cell->xpad * 2;
+ pix_rect.height -= cell->ypad * 2;
+
+ if (gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect) == FALSE)
+ return;
+
+ selected = (flags & GTK_CELL_RENDERER_SELECTED);
+
+ rb_rating_render_stars (widget, window, cell_class->priv->pixbufs,
+ draw_rect.x - pix_rect.x,
+ draw_rect.y - pix_rect.y,
+ draw_rect.x, draw_rect.y,
+ cellrating->priv->rating, selected);
+}
+
+static gboolean
+rb_cell_renderer_rating_activate (GtkCellRenderer *cell,
+ GdkEvent *event,
+ GtkWidget *widget,
+ const gchar *path,
+ GdkRectangle *background_area,
+ GdkRectangle *cell_area,
+ GtkCellRendererState flags)
+{
+ int mouse_x, mouse_y;
+ double rating;
+
+ RBCellRendererRating *cellrating = (RBCellRendererRating *) cell;
+
+ g_return_val_if_fail (RB_IS_CELL_RENDERER_RATING (cellrating), FALSE);
+
+ gtk_widget_get_pointer (widget, &mouse_x, &mouse_y);
+ gtk_tree_view_widget_to_tree_coords (GTK_TREE_VIEW (widget),
+ mouse_x,
+ mouse_y,
+ &mouse_x,
+ &mouse_y);
+
+ rating = rb_rating_get_rating_from_widget (widget,
+ mouse_x - cell_area->x,
+ cell_area->width,
+ cellrating->priv->rating);
+
+ if (rating != -1.0) {
+ g_signal_emit (G_OBJECT (cellrating),
+ rb_cell_renderer_rating_signals[RATED],
+ 0, path, rating);
+ }
+
+ return TRUE;
+}
Added: gtkpod/trunk/src/rb_cell_renderer_rating.h
===================================================================
--- gtkpod/trunk/src/rb_cell_renderer_rating.h (rev 0)
+++ gtkpod/trunk/src/rb_cell_renderer_rating.h 2008-01-05 15:53:46 UTC (rev
1916)
@@ -0,0 +1,64 @@
+/* rbcellrendererrating.h
+ *
+ * arch-tag: Header for star rating GtkTreeView cell renderer
+ *
+ * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <[EMAIL PROTECTED]>
+ * Copyright (C) 2002 Jorn Baayen <[EMAIL PROTECTED]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __RB_CELL_RENDERER_RATING_H
+#define __RB_CELL_RENDERER_RATING_H
+
+#include <gtk/gtkcellrenderer.h>
+
+G_BEGIN_DECLS
+
+#define RB_TYPE_CELL_RENDERER_RATING
(rb_cell_renderer_rating_get_type ())
+#define RB_CELL_RENDERER_RATING(obj) (GTK_CHECK_CAST ((obj),
RB_TYPE_CELL_RENDERER_RATING, RBCellRendererRating))
+#define RB_CELL_RENDERER_RATING_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass),
RB_TYPE_CELL_RENDERER_RATING, RBCellRendererRatingClass))
+#define RB_IS_CELL_RENDERER_RATING(obj) (GTK_CHECK_TYPE ((obj),
RB_TYPE_CELL_RENDERER_RATING))
+#define RB_IS_CELL_RENDERER_RATING_CLASS(klass) (GTK_CHECK_CLASS_TYPE
((klass), RB_TYPE_CELL_RENDERER_RATING))
+#define RB_CELL_RENDERER_RATING_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj),
RB_TYPE_CELL_RENDERER_RATING, RBCellRendererRatingClass))
+
+typedef struct RBCellRendererRatingPrivate RBCellRendererRatingPrivate;
+typedef struct RBCellRendererRatingClassPrivate
RBCellRendererRatingClassPrivate;
+
+typedef struct
+{
+ GtkCellRenderer parent;
+
+ RBCellRendererRatingPrivate *priv;
+} RBCellRendererRating;
+
+typedef struct
+{
+ GtkCellRendererClass parent_class;
+
+ void (*rated) (RBCellRendererRating *renderer, GtkTreePath *path,
double rating);
+
+ RBCellRendererRatingClassPrivate *priv;
+
+} RBCellRendererRatingClass;
+
+GtkType rb_cell_renderer_rating_get_type (void);
+
+GtkCellRenderer *rb_cell_renderer_rating_new (void);
+
+G_END_DECLS
+
+#endif /* __RB_CELL_RENDERER_RATING_H */
Added: gtkpod/trunk/src/rb_rating_helper.c
===================================================================
--- gtkpod/trunk/src/rb_rating_helper.c (rev 0)
+++ gtkpod/trunk/src/rb_rating_helper.c 2008-01-05 15:53:46 UTC (rev 1916)
@@ -0,0 +1,218 @@
+/*
+ *
+ * arch-tag: Implementation of functions shared by the rating widget and cell
renderer.
+ *
+ * Copyright (C) 2004 Christophe Fergeau <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "rb_rating_helper.h"
+
+#define RB_STOCK_SET_STAR "star-set"
+#define RB_STOCK_UNSET_STAR "star-unset"
+#define RB_STOCK_NO_STAR "star-none"
+
+struct _RBRatingPixbufs {
+ GdkPixbuf *pix_star;
+ GdkPixbuf *pix_dot;
+ GdkPixbuf *pix_blank;
+};
+
+void
+rb_rating_pixbufs_free (RBRatingPixbufs *pixbufs)
+{
+ if (pixbufs->pix_star != NULL)
+ g_object_unref (pixbufs->pix_star);
+ if (pixbufs->pix_dot != NULL)
+ g_object_unref (pixbufs->pix_dot);
+ if (pixbufs->pix_blank != NULL)
+ g_object_unref (pixbufs->pix_blank);
+}
+
+void
+rb_rating_install_rating_property (GObjectClass *klass, gulong prop)
+{
+ g_object_class_install_property (klass, prop,
+ g_param_spec_double ("rating",
+ ("Rating Value"),
+ ("Rating Value"),
+ 0.0,
(double)RB_RATING_MAX_SCORE,
+
(double)RB_RATING_MAX_SCORE/2.0,
+
G_PARAM_READWRITE));
+
+}
+
+RBRatingPixbufs *
+rb_rating_pixbufs_new (void)
+{
+ RBRatingPixbufs *pixbufs;
+ GtkIconTheme *theme;
+ gint width;
+
+ pixbufs = g_new0 (RBRatingPixbufs, 1);
+ if (pixbufs == NULL) {
+ return NULL;
+ }
+
+ theme = gtk_icon_theme_get_default ();
+ gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, NULL, &width);
+
+ pixbufs->pix_star = gtk_icon_theme_load_icon (theme,
+ RB_STOCK_SET_STAR,
+ width,
+ 0,
+ NULL);
+ pixbufs->pix_dot = gtk_icon_theme_load_icon (theme,
+ RB_STOCK_UNSET_STAR,
+ width,
+ 0,
+ NULL);
+ pixbufs->pix_blank = gtk_icon_theme_load_icon (theme,
+ RB_STOCK_NO_STAR,
+ width,
+ 0,
+ NULL);
+ if (pixbufs->pix_star != NULL &&
+ pixbufs->pix_dot != NULL &&
+ pixbufs->pix_blank != NULL) {
+ return pixbufs;
+ }
+
+ rb_rating_pixbufs_free (pixbufs);
+ g_free (pixbufs);
+ return NULL;
+}
+
+gboolean
+rb_rating_render_stars (GtkWidget *widget,
+ GdkWindow *window,
+ RBRatingPixbufs *pixbufs,
+ gulong x,
+ gulong y,
+ gulong x_offset,
+ gulong y_offset,
+ gdouble rating,
+ gboolean selected)
+{
+ int i, icon_width;
+ gboolean rtl;
+
+ g_return_val_if_fail (widget != NULL, FALSE);
+ g_return_val_if_fail (window != NULL, FALSE);
+ g_return_val_if_fail (pixbufs != NULL, FALSE);
+
+ rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
+ gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_width, NULL);
+
+ for (i = 0; i < RB_RATING_MAX_SCORE; i++) {
+ GdkPixbuf *buf;
+ GtkStateType state;
+ gint star_offset;
+ int offset;
+
+ if (selected == TRUE) {
+ offset = 0;
+ if (GTK_WIDGET_HAS_FOCUS (widget))
+ state = GTK_STATE_SELECTED;
+ else
+ state = GTK_STATE_ACTIVE;
+ } else {
+ offset = 120;
+ if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
+ state = GTK_STATE_INSENSITIVE;
+ else
+ state = GTK_STATE_NORMAL;
+ }
+
+ if (i < rating)
+ buf = pixbufs->pix_star;
+ else if (i >= rating && i < RB_RATING_MAX_SCORE)
+ buf = pixbufs->pix_dot;
+ else
+ buf = pixbufs->pix_blank;
+
+ if (buf == NULL) {
+ return FALSE;
+ }
+
+/* buf = eel_create_colorized_pixbuf (buf,
+
(widget->style->text[state].red + offset) >> 8,
+
(widget->style->text[state].green + offset) >> 8,
+
(widget->style->text[state].blue + offset) >> 8); */
+ if (buf == NULL) {
+ return FALSE;
+ }
+
+ if (rtl) {
+ star_offset = (RB_RATING_MAX_SCORE - i - 1) *
icon_width;
+ } else {
+ star_offset = i * icon_width;
+ }
+
+ gdk_draw_pixbuf (window,
+ NULL,
+ buf,
+ x, y,
+ x_offset + star_offset, y_offset,
+ icon_width, icon_width,
+ GDK_RGB_DITHER_NORMAL, 0, 0);
+/* g_object_unref (G_OBJECT (buf)); */
+ }
+
+ return TRUE;
+}
+
+double
+rb_rating_get_rating_from_widget (GtkWidget *widget,
+ gint widget_x,
+ gint widget_width,
+ double current_rating)
+{
+ int icon_width;
+ double rating = -1.0;
+
+ gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_width, NULL);
+
+ /* ensure the user clicks within the good cell */
+ if (widget_x >= 0 && widget_x <= widget_width) {
+ gboolean rtl;
+
+ rating = (int) (widget_x / icon_width) + 1;
+
+ rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
+ if (rtl) {
+ rating = RB_RATING_MAX_SCORE - rating + 1;
+ }
+
+ if (rating < 0)
+ rating = 0;
+
+ if (rating > RB_RATING_MAX_SCORE)
+ rating = RB_RATING_MAX_SCORE;
+
+ if (rating == current_rating) {
+ /* Make it possible to give a 0 rating to a song */
+ rating--;
+ }
+ }
+
+ return rating;
+}
Added: gtkpod/trunk/src/rb_rating_helper.h
===================================================================
--- gtkpod/trunk/src/rb_rating_helper.h (rev 0)
+++ gtkpod/trunk/src/rb_rating_helper.h 2008-01-05 15:53:46 UTC (rev 1916)
@@ -0,0 +1,47 @@
+/*
+ * arch-tag: Header for functions shared by the rating widget and cell
renderer.
+ *
+ * Copyright (C) 2004 Christophe Fergeau <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#ifndef RB_RATING_HELPER_H
+#define RB_RATING_HELPER_H 1
+
+#include <gtk/gtk.h>
+
+typedef struct _RBRatingPixbufs RBRatingPixbufs;
+
+/* Number of stars */
+#define RB_RATING_MAX_SCORE 5
+
+gboolean rb_rating_render_stars (GtkWidget *widget, GdkWindow *window,
+ RBRatingPixbufs *pixbufs,
+ gulong x, gulong y,
+ gulong x_offset, gulong y_offset,
+ gdouble rating, gboolean selected);
+
+double rb_rating_get_rating_from_widget (GtkWidget *widget,
+ gint widget_x, gint widget_width,
+ double current_rating);
+
+RBRatingPixbufs *rb_rating_pixbufs_new (void);
+void rb_rating_pixbufs_free (RBRatingPixbufs *pixbufs);
+
+void rb_rating_install_rating_property (GObjectClass *klass, gulong prop);
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2