Hi, Attached is a first draft of a replacement control for GtkHSV. It's called GtkColorWheel and the highlights of the API are: * get/set_color (with a GdkColor) and get/set_hsv (three gdoubles). * get/set_diameter(gint) and get/set_ring_width(gint) for setting the size of the ring. * get/set_model. Currently the only valid model is HSV. Maybe in future this could be expanded to LAB, etc. I have removed the methods gtk_hsv_to_rgb() and gtk_rgb_to_hsv() as they were only used in GtkHSV and the colour selector, and are redundant now with the get/set_color() and get/set_hsv() methods. Let's argue this one out for a bit, and when we have a stable API which people don't mind being public, I'll implement it (read: hack gtkhsv.c) and port GtkColorSelector to use it. One more thing - is there any documentation on gtkdoc? i.e. how do I document a enum, and what are valid in the headers? I had a look through the source code but not all of the comments are in the code - I had thought that the API documentation was generated solely from the source code (I'm a Java hacker too) but obviously I am wrong. Can someone point me in the right direction? Regards, Ross -- Ross Burton mail: ross burtonini com jabber: rossburton jabber org PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF
/* HSV color selector for GTK+ * * Copyright (C) 1999 The Free Software Foundation * * Authors: Simon Budig <Simon Budig unix-ag org> (original code) * Federico Mena-Quintero <federico gimp org> (cleanup for GTK+) * Jonathan Blandford <jrb redhat com> (cleanup for GTK+) * Ross Burton <ross burtonini com> (cleanup for GTK+) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef __GTK_COLOR_WHEEL_H__ #define __GTK_COLOR_WHEEL_H__ /* * Modified by the GTK+ Team and others 1997-2002. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ #include <gtk/gtkcontainer.h> #ifdef __cplusplus //extern "C" { #endif #define GTK_TYPE_COLOR_WHEEL (gtk_color_wheel_get_type ()) #define GTK_COLOR_WHEEL(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_COLOR_WHEEL, GtkColorWheel)) #define GTK_COLOR_WHEEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_COLOR_WHEEL, GtkColorWheelClass)) #define GTK_IS_COLOR_WHEEL(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_COLOR_WHEEL)) #define GTK_IS_COLOR_WHEEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_COLOR_WHEEL)) #define GTK_COLOR_WHEEL_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_COLOR_WHEEL, GtkColorWheelClass)) /* * What colour model to use in a wheel. */ typedef enum { GTK_COLOR_WHEEL_HSV } GtkColorWheelModel; typedef struct _GtkColorWheel GtkColorWheel; typedef struct _GtkColorWheelClass GtkColorWheelClass; struct _GtkColorWheel { GtkWidget parent_instance; /* Private data */ gpointer priv; }; struct _GtkColorWheelClass { GtkWidgetClass parent_class; /* Notification signals */ void (*changed) (GtkColorWheel *wheel); /* Keybindings */ void (* move) (GtkColorWheel *wheel, GtkDirectionType type); }; GtkType gtk_color_wheel_get_type (void) G_GNUC_CONST; GtkWidget* gtk_color_wheel_new (void); void gtk_color_wheel_set_model (GtkColorWheel *wheel, GtkColorWheelModel model); GtkColorWheelModel gtk_color_wheel_get_model (GtkColorWheel *wheel); GdkColor* gtk_color_wheel_get_color (GtkColorWheel *wheel); void gtk_color_wheel_set_color (GtkColorWheel *wheel, GdkColor *color); void gtk_color_wheel_get_hsv (GtkColorWheel *wheel, gdouble *h, gdouble *s, gdouble *v); void gtk_color_wheel_set_hsv (GtkColorWheel *wheel, gdouble h, gdouble s, gdouble v); void gtk_color_wheel_set_diameter (GtkColorWheel *wheel, gint diameter); void gtk_color_wheel_set_ring_width (GtkColorWheel *wheel, gint width); gint gtk_color_wheel_get_diameter (GtkColorWheel *wheel); gint gtk_color_wheel_get_ring_width (GtkColorWheel *wheel); gboolean gtk_color_wheel_is_adjusting (GtkColorWheel *wheel); #ifdef __cplusplus } #endif #endif /* __GTK_COLOR_WHEEL_H__ */
Attachment:
signature.asc
Description: This is a digitally signed message part