/*
- * This file is part of hildon-libs
+ * This file is a part of hildon
*
* Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
*
*
*/
+/**
+ * SECTION:hildon-color-chooser-dialog
+ * @short_description: A dialog used to select a color from HSV colorspace.
+ * @see_also: #HildonColorButton
+ *
+ * HildonColorChooserDialog enables the user to
+ * select an arbitrary color from a HSV colorspace.
+ * The color is stored in one of the predefined color
+ * slots and can be reselected later on.
+ *
+ * Additionally the user can choose one of the standard "factory"
+ * colors.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <memory.h>
#include <string.h>
#include <libintl.h>
NULL
};
- dialog_type = g_type_register_static (HILDON_TYPE_COLOR_CHOOSER_DIALOG,
+ dialog_type = g_type_register_static (GTK_TYPE_DIALOG,
"HildonColorChooserDialog", &dialog_info, 0);
}
priv->hbox = gtk_hbox_new (FALSE, 0);
priv->vbox = gtk_vbox_new (FALSE, 0);
+ priv->chooser = hildon_color_chooser_new ();
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->chooser, TRUE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (priv->hbox), priv->vbox, FALSE, FALSE, 0);
GTK_TYPE_BORDER,
G_PARAM_READABLE));
-
gtk_widget_class_install_style_property (widget_klass,
g_param_spec_boxed ("default_color", "Default color",
"Default color for nonpainted custom colors",
GDK_TYPE_COLOR,
G_PARAM_READABLE));
}
+
+ g_type_class_add_private (object_klass, sizeof (HildonColorChooserDialogPrivate));
}
static void
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
+/**
+ * hildon_color_chooser_dialog_set_color:
+ * @dialog: a #HildonColorChooserDialog
+ * @color: a color to set on the #HildonColorChooserDialog
+ *
+ * Sets the dialog to point at the given color. It'll first try to
+ * search the palette of the existing colors to match the passed color.
+ * If the color is not found in the pallette, the color in the currently
+ * selected box will be modified.
+ *
+ */
void
hildon_color_chooser_dialog_set_color (HildonColorChooserDialog *dialog,
GdkColor *color)
HildonColorChooserDialogPrivate *priv = HILDON_COLOR_CHOOSER_DIALOG_GET_PRIVATE (data);
char key[128], color_str[13];
int tmp;
- GdkColor *color;
+ GdkColor *color = g_new (GdkColor, 1);
g_assert (priv);
- g_object_get (G_OBJECT (chooser), "color", &color, NULL);
+ hildon_color_chooser_get_color (chooser, color);
tmp = (priv->style_info.num_buttons.left * priv->style_info.num_buttons.right);
/**
* hildon_color_chooser_dialog_get_color:
* @dialog: a #HildonColorChooserDialog
- * @color: a color to fill with new values
+ * @color: a color structure to fill with the currently selected color
+ *
+ * Retrives the currently selected color in the color chooser dialog.
*
*/
void
g_return_if_fail (HILDON_IS_COLOR_CHOOSER_DIALOG (dialog));
priv = HILDON_COLOR_CHOOSER_DIALOG_GET_PRIVATE (dialog);
+ g_assert (priv);
- g_object_get (G_OBJECT (priv->chooser), "color", &color, NULL);
+ hildon_color_chooser_get_color (HILDON_COLOR_CHOOSER (priv->chooser), color);
}