1 /* -*- mode: c; c-basic-offset: 4; -*- 2 * 3 * color-button.h - Interactive color selection button. This is a composite 4 * widget that shows a color sample inside a button. When 5 * the button is clicked, a color picker with auto-apply 6 * modifies the color sample and sends the 'changed' signal. 7 * 8 * Fyre - rendering and interactive exploration of chaotic functions 9 * Copyright (C) 2004-2006 David Trowbridge and Micah Dowty 10 * 11 * This program is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation; either version 2 14 * of the License, or (at your option) any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with this program; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24 * 25 */ 26 27 #ifndef __COLOR_BUTTON_H__ 28 #define __COLOR_BUTTON_H__ 29 30 #include <glib.h> 31 #include <glib-object.h> 32 #include <gtk/gtkbutton.h> 33 34 G_BEGIN_DECLS 35 36 #define COLOR_BUTTON_TYPE (color_button_get_type ()) 37 #define COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COLOR_BUTTON_TYPE, ColorButton)) 38 #define COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), COLOR_BUTTON_TYPE, ColorButtonClass)) 39 #define IS_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COLOR_BUTTON_TYPE)) 40 #define IS_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), COLOR_BUTTON_TYPE)) 41 42 typedef struct _ColorButton ColorButton; 43 typedef struct _ColorButtonClass ColorButtonClass; 44 45 struct _ColorButton { 46 GtkButton button; 47 48 GtkWidget *frame; 49 GtkWidget *drawing_area; 50 GtkWidget *dialog; 51 52 gchar *title; 53 GdkColor previous_color; 54 GdkColor color; 55 guint16 previous_alpha; 56 guint16 alpha; 57 58 gboolean ignore_changes; 59 }; 60 61 struct _ColorButtonClass { 62 GtkButtonClass parent_class; 63 64 void (* color_button) (ColorButton *cb); 65 }; 66 67 GType color_button_get_type(void); 68 GtkWidget* color_button_new_with_defaults(const char *title, GdkColor *default_color, guint16 default_alpha); 69 GtkWidget* color_button_new(const char *title); 70 71 void color_button_set_color(ColorButton *cb, GdkColor *c); 72 void color_button_get_color(ColorButton *cb, GdkColor *c); 73 void color_button_set_alpha(ColorButton *cb, guint16 alpha); 74 guint16 color_button_get_alpha(ColorButton *cb); 75 void color_button_set_color_and_alpha(ColorButton *cb, GdkColor *c, guint16 alpha); 76 77 G_END_DECLS 78 79 #endif /* __COLOR_BUTTON_H__ */ 80 81 /* The End */ 82