1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.ColorChooserIF; 26 27 private import gdk.RGBA; 28 private import glib.MemorySlice; 29 private import gobject.ObjectG; 30 private import gobject.Signals; 31 private import gtk.c.functions; 32 public import gtk.c.types; 33 public import gtkc.gtktypes; 34 private import std.algorithm; 35 36 37 /** 38 * #GtkColorChooser is an interface that is implemented by widgets 39 * for choosing colors. Depending on the situation, colors may be 40 * allowed to have alpha (translucency). 41 * 42 * In GTK+, the main widgets that implement this interface are 43 * #GtkColorChooserWidget, #GtkColorChooserDialog and #GtkColorButton. 44 * 45 * Since: 3.4 46 */ 47 public interface ColorChooserIF{ 48 /** Get the main Gtk struct */ 49 public GtkColorChooser* getColorChooserStruct(bool transferOwnership = false); 50 51 /** the main Gtk struct as a void* */ 52 protected void* getStruct(); 53 54 /** 55 * Gets the currently-selected color. 56 * 57 * Returns: a gdk.RGBA to fill in with the current color. 58 * 59 * Since: 3.4 60 */ 61 public final RGBA getRgba() 62 { 63 RGBA color; 64 getRgba(color); 65 return color; 66 } 67 68 /** 69 */ 70 71 /** */ 72 public static GType getType() 73 { 74 return gtk_color_chooser_get_type(); 75 } 76 77 /** 78 * Adds a palette to the color chooser. If @orientation is horizontal, 79 * the colors are grouped in rows, with @colors_per_line colors 80 * in each row. If @horizontal is %FALSE, the colors are grouped 81 * in columns instead. 82 * 83 * The default color palette of #GtkColorChooserWidget has 84 * 27 colors, organized in columns of 3 colors. The default gray 85 * palette has 9 grays in a single row. 86 * 87 * The layout of the color chooser widget works best when the 88 * palettes have 9-10 columns. 89 * 90 * Calling this function for the first time has the 91 * side effect of removing the default color and gray palettes 92 * from the color chooser. 93 * 94 * If @colors is %NULL, removes all previously added palettes. 95 * 96 * Params: 97 * orientation = %GTK_ORIENTATION_HORIZONTAL if the palette should 98 * be displayed in rows, %GTK_ORIENTATION_VERTICAL for columns 99 * colorsPerLine = the number of colors to show in each row/column 100 * colors = the colors of the palette, or %NULL 101 * 102 * Since: 3.4 103 */ 104 public void addPalette(GtkOrientation orientation, int colorsPerLine, RGBA[] colors); 105 106 /** 107 * Gets the currently-selected color. 108 * 109 * Params: 110 * color = a #GdkRGBA to fill in with the current color 111 * 112 * Since: 3.4 113 */ 114 public void getRgba(out RGBA color); 115 116 /** 117 * Returns whether the color chooser shows the alpha channel. 118 * 119 * Returns: %TRUE if the color chooser uses the alpha channel, 120 * %FALSE if not 121 * 122 * Since: 3.4 123 */ 124 public bool getUseAlpha(); 125 126 /** 127 * Sets the color. 128 * 129 * Params: 130 * color = the new color 131 * 132 * Since: 3.4 133 */ 134 public void setRgba(RGBA color); 135 136 /** 137 * Sets whether or not the color chooser should use the alpha channel. 138 * 139 * Params: 140 * useAlpha = %TRUE if color chooser should use alpha channel, %FALSE if not 141 * 142 * Since: 3.4 143 */ 144 public void setUseAlpha(bool useAlpha); 145 146 /** 147 * Emitted when a color is activated from the color chooser. 148 * This usually happens when the user clicks a color swatch, 149 * or a color is selected and the user presses one of the keys 150 * Space, Shift+Space, Return or Enter. 151 * 152 * Params: 153 * color = the color 154 * 155 * Since: 3.4 156 */ 157 gulong addOnColorActivated(void delegate(RGBA, ColorChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 158 }