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 private import std.algorithm; 34 35 36 /** 37 * `GtkColorChooser` is an interface that is implemented by widgets 38 * for choosing colors. 39 * 40 * Depending on the situation, colors may be allowed to have alpha (translucency). 41 * 42 * In GTK, the main widgets that implement this interface are 43 * [class@Gtk.ColorChooserWidget], [class@Gtk.ColorChooserDialog] and 44 * [class@Gtk.ColorButton]. 45 */ 46 public interface ColorChooserIF{ 47 /** Get the main Gtk struct */ 48 public GtkColorChooser* getColorChooserStruct(bool transferOwnership = false); 49 50 /** the main Gtk struct as a void* */ 51 protected void* getStruct(); 52 53 54 /** */ 55 public static GType getType() 56 { 57 return gtk_color_chooser_get_type(); 58 } 59 60 /** 61 * Adds a palette to the color chooser. 62 * 63 * If @orientation is horizontal, the colors are grouped in rows, 64 * with @colors_per_line colors in each row. If @horizontal is %FALSE, 65 * the colors are grouped in columns instead. 66 * 67 * The default color palette of [class@Gtk.ColorChooserWidget] has 68 * 45 colors, organized in columns of 5 colors (this includes some 69 * grays). 70 * 71 * The layout of the color chooser widget works best when the 72 * palettes have 9-10 columns. 73 * 74 * Calling this function for the first time has the side effect 75 * of removing the default color palette from the color chooser. 76 * 77 * If @colors is %NULL, removes all previously added palettes. 78 * 79 * Params: 80 * orientation = %GTK_ORIENTATION_HORIZONTAL if the palette should 81 * be displayed in rows, %GTK_ORIENTATION_VERTICAL for columns 82 * colorsPerLine = the number of colors to show in each row/column 83 * colors = the colors of the palette, or %NULL 84 */ 85 public void addPalette(GtkOrientation orientation, int colorsPerLine, RGBA[] colors); 86 87 /** 88 * Gets the currently-selected color. 89 * 90 * Params: 91 * color = a `GdkRGBA` to fill in with the current color 92 */ 93 public void getRgba(out RGBA color); 94 95 /** 96 * Returns whether the color chooser shows the alpha channel. 97 * 98 * Returns: %TRUE if the color chooser uses the alpha channel, 99 * %FALSE if not 100 */ 101 public bool getUseAlpha(); 102 103 /** 104 * Sets the color. 105 * 106 * Params: 107 * color = the new color 108 */ 109 public void setRgba(RGBA color); 110 111 /** 112 * Sets whether or not the color chooser should use the alpha channel. 113 * 114 * Params: 115 * useAlpha = %TRUE if color chooser should use alpha channel, %FALSE if not 116 */ 117 public void setUseAlpha(bool useAlpha); 118 119 /** 120 * Emitted when a color is activated from the color chooser. 121 * 122 * This usually happens when the user clicks a color swatch, 123 * or a color is selected and the user presses one of the keys 124 * Space, Shift+Space, Return or Enter. 125 * 126 * Params: 127 * color = the color 128 */ 129 gulong addOnColorActivated(void delegate(RGBA, ColorChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 130 }