* Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
*
* Author: Kuisma Salonen <kuisma.salonen@nokia.com>
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
+ * Contact: Rodrigo Novo <rodrigo.novo@nokia.com>
*
* 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; version 2.1 of
- * the License.
+ * 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
/**
* SECTION:hildon-color-chooser
- * @short_description: A widget used to select a color from an HSV colorspace
+ * @short_description: A widget used to select a color from an HSV colorspace.
* @see_also: #HildonColorChooserDialog
*
* HildonColorChooser is a widget that displays an HSV colorspace.
*
*/
-#include <gtk/gtk.h>
+#undef HILDON_DISABLE_DEPRECATED
+
#include "hildon-color-chooser.h"
#include "hildon-color-chooser-private.h"
static void
hildon_color_chooser_realize (GtkWidget *widget);
+static void
+hildon_color_chooser_unrealize (GtkWidget *widget);
+
static void
hildon_color_chooser_map (GtkWidget *widget);
widget_class->size_request = hildon_color_chooser_size_request;
widget_class->size_allocate = hildon_color_chooser_size_allocate;
widget_class->realize = hildon_color_chooser_realize;
+ widget_class->unrealize = hildon_color_chooser_unrealize;
widget_class->map = hildon_color_chooser_map;
widget_class->unmap = hildon_color_chooser_unmap;
widget_class->expose_event = hildon_color_chooser_expose;
widget_class->motion_notify_event = hildon_color_chooser_pointer_motion;
gtk_widget_class_install_style_property (widget_class,
- g_param_spec_boxed ("inner_size",
- "Inner sizes",
- "Sizes of SV plane, H bar and spacing",
- GTK_TYPE_BORDER,
- G_PARAM_READABLE));
+ g_param_spec_boxed ("inner_size",
+ "Inner sizes",
+ "Sizes of SV plane, H bar and spacing",
+ GTK_TYPE_BORDER,
+ G_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
- g_param_spec_boxed ("graphic_border",
- "Graphical borders",
- "Size of graphical border",
- GTK_TYPE_BORDER,
- G_PARAM_READABLE));
+ g_param_spec_boxed ("outer_border",
+ "Outer border",
+ "The outer border for the chooser",
+ GTK_TYPE_BORDER,
+ G_PARAM_READABLE));
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_boxed ("graphic_border",
+ "Graphical borders",
+ "Size of graphical border",
+ GTK_TYPE_BORDER,
+ G_PARAM_READABLE));
/**
* HildonColorChooser:color:
}
}
-
static void
hildon_color_chooser_realize (GtkWidget *widget)
{
gdk_window_set_user_data (priv->event_window, widget);
- widget->window = gtk_widget_get_parent_window (widget);
- widget->style = gtk_style_attach (widget->style, widget->window);
+ GTK_WIDGET_CLASS (parent_class)->realize (widget);
+}
+
+static void
+hildon_color_chooser_unrealize (GtkWidget *widget)
+{
+ HildonColorChooserPrivate *priv = HILDON_COLOR_CHOOSER_GET_PRIVATE (widget);
+
+ g_assert (priv);
+
+ if (priv->event_window) {
+ gdk_window_set_user_data (priv->event_window, NULL);
+ gdk_window_destroy (priv->event_window);
+ priv->event_window = NULL;
+ }
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ GTK_WIDGET_CLASS(parent_class)->unrealize(widget);
}
static void
if (tb) {
*inner = *tb;
- g_free (tb);
+ gtk_border_free (tb);
} else {
inner->left = 64;
inner->right = 64;
* @color: a color to be set
*
* Sets the color selected in the widget.
+ * Will move the crosshair pointer to indicate the passed color.
*/
void
-hildon_color_chooser_set_color (HildonColorChooser *sel,
+hildon_color_chooser_set_color (HildonColorChooser *chooser,
GdkColor *color)
{
unsigned short hue, sat, val;
unsigned long min, max;
signed long tmp, diff;
- HildonColorChooserPrivate *priv = HILDON_COLOR_CHOOSER_GET_PRIVATE (sel);
+ HildonColorChooserPrivate *priv = HILDON_COLOR_CHOOSER_GET_PRIVATE (chooser);
g_assert (priv);
priv->currsat = sat;
priv->currval = val;
- inline_limited_expose (sel);
- g_signal_emit (sel, color_chooser_signals[COLOR_CHANGED], 0);
+ inline_limited_expose (chooser);
+ g_signal_emit (chooser, color_chooser_signals[COLOR_CHANGED], 0);
}
inline void
return FALSE;
}
-/* FIXME Missing documentation */
+/**
+ * hildon_color_chooser_get_color:
+ * @chooser: a #HildonColorChooser
+ * @color: a color structure to fill with the currently selected color
+ *
+ * Retrives the currently selected color in the chooser.
+ *
+ */
void
-hildon_color_chooser_get_color (HildonColorChooser *sel,
+hildon_color_chooser_get_color (HildonColorChooser *chooser,
GdkColor *color)
{
HildonColorChooserPrivate *priv;
GdkVisual *system_visual = gdk_visual_get_system ();
unsigned long rgb[3], rgb2[3];
- g_return_if_fail (HILDON_IS_COLOR_CHOOSER (sel));
+ g_return_if_fail (HILDON_IS_COLOR_CHOOSER (chooser));
g_return_if_fail (color != NULL);
- priv = HILDON_COLOR_CHOOSER_GET_PRIVATE (sel);
+ priv = HILDON_COLOR_CHOOSER_GET_PRIVATE (chooser);
g_assert (priv);
inline_h2rgb (priv->currhue, rgb);
{
case PROP_COLOR: {
- GdkColor *color = g_new (GdkColor, 1);
- hildon_color_chooser_get_color ((HildonColorChooser *) object, color);
- g_value_take_boxed (value, color);
+ GdkColor color;
+ hildon_color_chooser_get_color ((HildonColorChooser *) object, &color);
+ g_value_set_boxed (value, &color);
} break;
default: