1 /* LIBGIMP - The GIMP Library 2 * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball 3 * 4 * gimpcolorbutton.h 5 * Copyright (C) 1999-2001 Sven Neumann 6 * 7 * This library is free software: you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 3 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library. If not, see 19 * <https://www.gnu.org/licenses/>. 20 */ 21 22 /* This provides a button with a color preview. The preview 23 * can handle transparency by showing the checkerboard. 24 * On click, a color selector is opened, which is already 25 * fully functional wired to the preview button. 26 */ 27 28 #if !defined (__GIMP_WIDGETS_H_INSIDE__) && !defined (GIMP_WIDGETS_COMPILATION) 29 #error "Only <libgimpwidgets/gimpwidgets.h> can be included directly." 30 #endif 31 32 #ifndef __GIMP_COLOR_BUTTON_H__ 33 #define __GIMP_COLOR_BUTTON_H__ 34 35 #include <libgimpwidgets/gimpbutton.h> 36 37 G_BEGIN_DECLS 38 39 40 #define GIMP_TYPE_COLOR_BUTTON (gimp_color_button_get_type ()) 41 #define GIMP_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_BUTTON, GimpColorButton)) 42 #define GIMP_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_BUTTON, GimpColorButtonClass)) 43 #define GIMP_IS_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_BUTTON)) 44 #define GIMP_IS_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_BUTTON)) 45 #define GIMP_COLOR_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_BUTTON, GimpColorButtonClass)) 46 47 48 typedef struct _GimpColorButtonClass GimpColorButtonClass; 49 50 struct _GimpColorButton 51 { 52 GimpButton parent_instance; 53 54 gchar *title; 55 gboolean continuous_update; 56 57 GtkWidget *color_area; 58 GtkWidget *dialog; 59 60 /*< private >*/ 61 gpointer popup_menu; 62 }; 63 64 struct _GimpColorButtonClass 65 { 66 GimpButtonClass parent_class; 67 68 /* signals */ 69 void (* color_changed) (GimpColorButton *button); 70 71 /* virtual functions */ 72 GType (* get_action_type) (GimpColorButton *button); 73 74 /* Padding for future expansion */ 75 void (* _gimp_reserved2) (void); 76 void (* _gimp_reserved3) (void); 77 void (* _gimp_reserved4) (void); 78 }; 79 80 81 GType gimp_color_button_get_type (void) G_GNUC_CONST; 82 83 GtkWidget * gimp_color_button_new (const gchar *title, 84 gint width, 85 gint height, 86 const GimpRGB *color, 87 GimpColorAreaType type); 88 89 void gimp_color_button_set_title (GimpColorButton *button, 90 const gchar *title); 91 const gchar * gimp_color_button_get_title (GimpColorButton *button); 92 93 void gimp_color_button_set_color (GimpColorButton *button, 94 const GimpRGB *color); 95 void gimp_color_button_get_color (GimpColorButton *button, 96 GimpRGB *color); 97 98 gboolean gimp_color_button_has_alpha (GimpColorButton *button); 99 void gimp_color_button_set_type (GimpColorButton *button, 100 GimpColorAreaType type); 101 102 gboolean gimp_color_button_get_update (GimpColorButton *button); 103 void gimp_color_button_set_update (GimpColorButton *button, 104 gboolean continuous); 105 106 void gimp_color_button_set_color_config (GimpColorButton *button, 107 GimpColorConfig *config); 108 109 GtkUIManager * gimp_color_button_get_ui_manager (GimpColorButton *button); 110 111 112 G_END_DECLS 113 114 #endif /* __GIMP_COLOR_BUTTON_H__ */ 115