/* Copyright (C) 2012 The gtkmm Development Team * * 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.1 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, see . */ #include #include //For Orientation. #include _DEFS(gtkmm,gtk) _PINCLUDE(glibmm/private/interface_p.h) #ifndef DOXYGEN_SHOULD_SKIP_THIS extern "C" { typedef struct _GtkColorChooserInterface GtkColorChooserInterface; } #endif /* DOXYGEN_SHOULD_SKIP_THIS */ namespace Gtk { /** This interface can be implemented by widgets which allow the user to choose * a color. Depending on the situation, colors may be * allowed to have alpha (translucency). * The main widgets that implement this interface are ColorChooserWidget, ColorChooserDialog * and ColorChooserButton. * * @newin{3,4} */ class GTKMM_API ColorChooser : public Glib::Interface { _CLASS_INTERFACE(ColorChooser, GtkColorChooser, GTK_COLOR_CHOOSER, GtkColorChooserInterface, , , GTKMM_API) public: /** Gets the currently selected color. * @return The currently selected color. * @newin{3,4} */ Gdk::RGBA get_rgba() const; _IGNORE(gtk_color_chooser_get_rgba) _WRAP_METHOD(void set_rgba(const Gdk::RGBA& color), gtk_color_chooser_set_rgba) _WRAP_METHOD(bool get_use_alpha() const, gtk_color_chooser_get_use_alpha) _WRAP_METHOD(void set_use_alpha(bool use_alpha = true), gtk_color_chooser_set_use_alpha) /** Adds a palette to the color chooser. If @a orientation is horizontal, * the colors are grouped in rows, with @a colors_per_line colors * in each row. If @a orientation is vertical, the colors are grouped * in columns instead. * * The default color palette of ColorChooserWidget has * 27 colors, organized in columns of 3 colors. The default gray * palette has 9 grays in a single row. * * The layout of the color chooser widget works best when the * palettes have 9-10 columns. * * Calling this function for the first time has the * side effect of removing the default color and gray palettes * from the color chooser. * * @param orientation ORIENTATION_HORIZONTAL if the palette should be displayed in rows, or ORIENTATION_VERTICAL for columns * @param colors_per_line The number of colors to show in each row/column. * @param colors The colors of the palette. * * @newin{3,4} */ void add_palette(Orientation orientation, int colors_per_line, const std::vector& colors); _IGNORE(gtk_color_chooser_add_palette) #m4 _CONVERSION(`const GdkRGBA*',`const Gdk::RGBA&',`Glib::wrap(const_cast($3), true)') //#m4 _CONVERSION(`const Gdk::RGBA&',`const GdkRGBA*',`const_cast(($3).gobj())') _WRAP_SIGNAL(void color_activated(const Gdk::RGBA& color), "color-activated") _WRAP_PROPERTY("rgba", Gdk::RGBA) _WRAP_PROPERTY("use-alpha", bool) }; } // namespace Gtk