#include "deprecated/gtkcolorchooserprivate.h"
#include "deprecated/gtkcolorchooserwidget.h"
+#include "gtkcolorchooserwidgetprivate.h"
#include "gtkcoloreditorprivate.h"
#include "gtkcolorswatchprivate.h"
#include "gtkgrid.h"
return (guint)value;
}
-static char *
-accessible_color_name (GdkRGBA *color)
+char *
+accessible_color_name (const GdkRGBA *color)
{
if (color->alpha < 1.0)
return g_strdup_printf (_("Red %d%%, Green %d%%, Blue %d%%, Alpha %d%%"),
connect_button_signals (button, cc);
gtk_color_swatch_set_icon (GTK_COLOR_SWATCH (button), "list-add-symbolic");
gtk_color_swatch_set_selectable (GTK_COLOR_SWATCH (button), FALSE);
+ gtk_accessible_update_property (GTK_ACCESSIBLE (button),
+ GTK_ACCESSIBLE_PROPERTY_LABEL, _("Add Color"),
+ -1);
gtk_box_append (GTK_BOX (box), button);
cc->settings = g_settings_new ("org.gtk.gtk4.Settings.ColorChooser");
--- /dev/null
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2023 Red Hat, Inc.
+ *
+ * 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 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 <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+char *accessible_color_name (const GdkRGBA *color);
+
+G_END_DECLS
+
#include "gtkcoloreditorprivate.h"
+#include <glib/gi18n-lib.h>
+
#include "deprecated/gtkcolorchooserprivate.h"
#include "gtkcolorplaneprivate.h"
#include "gtkcolorscaleprivate.h"
#include "gtkcolorswatchprivate.h"
+#include "gtkcolorchooserwidgetprivate.h"
#include "gtkcolorutils.h"
#include "gtkcolorpickerprivate.h"
#include "gtkgrid.h"
editor->text_changed = TRUE;
}
+static void
+update_color (GtkColorEditor *editor,
+ const GdkRGBA *color)
+{
+ char *name;
+ char *text;
+ name = accessible_color_name (color);
+ text = g_strdup_printf (_("Color: %s"), name);
+ gtk_accessible_update_property (GTK_ACCESSIBLE (editor->swatch),
+ GTK_ACCESSIBLE_PROPERTY_LABEL, text,
+ -1);
+ g_free (name);
+ g_free (text);
+ gtk_color_swatch_set_rgba (GTK_COLOR_SWATCH (editor->swatch), color);
+ gtk_color_scale_set_rgba (GTK_COLOR_SCALE (editor->a_slider), color);
+ entry_set_rgba (editor, color);
+}
+
static void
hsv_changed (GtkColorEditor *editor)
{
gtk_hsv_to_rgb (h, s, v, &color.red, &color.green, &color.blue);
color.alpha = a;
- gtk_color_swatch_set_rgba (GTK_COLOR_SWATCH (editor->swatch), &color);
- gtk_color_scale_set_rgba (GTK_COLOR_SCALE (editor->a_slider), &color);
- entry_set_rgba (editor, &color);
+ update_color (editor, &color);
g_object_notify (G_OBJECT (editor), "rgba");
}
gtk_adjustment_set_value (editor->v_adj, v);
gtk_adjustment_set_value (editor->a_adj, color->alpha);
- gtk_color_swatch_set_rgba (GTK_COLOR_SWATCH (editor->swatch), color);
- gtk_color_scale_set_rgba (GTK_COLOR_SCALE (editor->a_slider), color);
- entry_set_rgba (editor, color);
+ update_color (editor, color);
g_object_notify (G_OBJECT (editor), "rgba");
}