? .gtkstyle.c.swp
Index: gtklabel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtklabel.c,v
retrieving revision 1.203
diff -u -p -r1.203 gtklabel.c
--- gtklabel.c	6 Jul 2006 05:14:01 -0000	1.203
+++ gtklabel.c	14 Sep 2006 21:26:14 -0000
@@ -93,7 +93,8 @@ enum {
   PROP_WIDTH_CHARS,
   PROP_SINGLE_LINE_MODE,
   PROP_ANGLE,
-  PROP_MAX_WIDTH_CHARS
+  PROP_MAX_WIDTH_CHARS,
+  PROP_USE_DROPSHADOW
 };
 
 static guint signals[LAST_SIGNAL] = { 0 };
@@ -143,6 +144,8 @@ static void gtk_label_set_use_markup_int
 						  gboolean       val);
 static void gtk_label_set_use_underline_internal (GtkLabel      *label,
 						  gboolean       val);
+static void gtk_label_set_use_dropshadow_internal(GtkLabel      *label,
+						  gboolean       val);
 static void gtk_label_set_attributes_internal    (GtkLabel      *label,
 						  PangoAttrList *attrs);
 static void gtk_label_set_uline_text_internal    (GtkLabel      *label,
@@ -341,6 +344,15 @@ gtk_label_class_init (GtkLabelClass *cla
                                                         P_("If set, wrap lines if the text becomes too wide"),
                                                         FALSE,
                                                         GTK_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
+                                   PROP_USE_DROPSHADOW,
+                                   g_param_spec_boolean ("use-dropshadow",
+							 P_("Use dropshadow"),
+							 P_("If set, the label is drawn in white with a black dropshadow"),
+                                                        FALSE,
+                                                        GTK_PARAM_READWRITE));
+
   /**
    * GtkLabel:wrap-mode:
    *
@@ -683,6 +695,9 @@ gtk_label_set_property (GObject      *ob
     case PROP_MAX_WIDTH_CHARS:
       gtk_label_set_max_width_chars (label, g_value_get_int (value));
       break;
+    case PROP_USE_DROPSHADOW:
+      gtk_label_set_use_dropshadow (label, g_value_get_boolean (value));
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -766,6 +781,8 @@ gtk_label_get_property (GObject     *obj
     case PROP_MAX_WIDTH_CHARS:
       g_value_set_int (value, gtk_label_get_max_width_chars (label));
       break;
+    case PROP_USE_DROPSHADOW:
+      g_value_set_boolean (value, label->use_dropshadow);
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -792,6 +809,7 @@ gtk_label_init (GtkLabel *label)
 
   label->use_underline = FALSE;
   label->use_markup = FALSE;
+  label->use_dropshadow = FALSE;
   
   label->mnemonic_keyval = GDK_VoidSymbol;
   label->layout = NULL;
@@ -1113,6 +1131,19 @@ gtk_label_set_use_underline_internal (Gt
 }
 
 static void
+gtk_label_set_use_dropshadow_internal (GtkLabel *label,
+				      gboolean val)
+{
+  val = val != FALSE;
+  if (label->use_dropshadow != val)
+    {
+      label->use_dropshadow = val;
+
+      g_object_notify (G_OBJECT (label), "use-dropshadow");
+    }
+}
+
+static void
 gtk_label_set_attributes_internal (GtkLabel      *label,
 				   PangoAttrList *attrs)
 {
@@ -1122,7 +1153,7 @@ gtk_label_set_attributes_internal (GtkLa
   if (label->attrs)
     pango_attr_list_unref (label->attrs);
 
-  if (!label->use_markup && !label->use_underline)
+  if (!label->use_markup && !label->use_underline && !label->use_dropshadow)
     {
       if (attrs)
 	pango_attr_list_ref (attrs);
@@ -1135,9 +1166,31 @@ gtk_label_set_attributes_internal (GtkLa
   g_object_notify (G_OBJECT (label), "attributes");
 }
 
+static void
+set_dropshadow_attribute (GtkLabel *label)
+{
+  GdkColor black = { 0, };
+  PangoAttribute *attr;
+  int length;
+
+  length = strlen (label->text);
+
+  if (!label->effective_attrs)
+    label->effective_attrs = pango_attr_list_new ();
+
+  attr = gdk_pango_attr_embossed_new (TRUE);
+  attr->start_index = 0;
+  attr->end_index = length;
+  pango_attr_list_change (label->effective_attrs, attr);
+
+  attr = gdk_pango_attr_emboss_color_new (&black);
+  attr->start_index = 0;
+  attr->end_index = length;
+  pango_attr_list_change (label->effective_attrs, attr);
+}
 
 /* Calculates text, attrs and mnemonic_keyval from
- * label, use_underline and use_markup
+ * label, use_underline, use_markup and use_dropshadow
  */
 static void
 gtk_label_recalculate (GtkLabel *label)
@@ -1148,7 +1201,7 @@ gtk_label_recalculate (GtkLabel *label)
     {
       if (label->use_underline)
 	gtk_label_set_uline_text_internal (label, label->label);
-      else
+      else if (!label->use_dropshadow)
 	{
 	  gtk_label_set_text_internal (label, g_strdup (label->label));
 	  if (label->attrs)
@@ -1159,6 +1212,10 @@ gtk_label_recalculate (GtkLabel *label)
 	}
     }
 
+  /* dropshadow can stack with underline and markup but not user attrs */
+  if (label->use_dropshadow)
+    set_dropshadow_attribute (label);
+
   if (!label->use_underline)
     {
       guint keyval = label->mnemonic_keyval;
@@ -1205,8 +1262,8 @@ gtk_label_set_text (GtkLabel    *label,
  * 
  * Sets a #PangoAttrList; the attributes in the list are applied to the
  * label text. The attributes set with this function will be ignored
- * if the "use_underline" property or the "use_markup" property
- * is %TRUE.
+ * if the "use_underline" property, the "use_markup" property
+ * or the "use_dropshadow" property are %TRUE.
  **/
 void
 gtk_label_set_attributes (GtkLabel         *label,
@@ -2440,16 +2497,21 @@ gtk_label_expose (GtkWidget      *widget
       label->text && (*label->text != '\0'))
     {
       get_layout_location (label, &x, &y);
-
-      gtk_paint_layout (widget->style,
-                        widget->window,
-                        GTK_WIDGET_STATE (widget),
-			FALSE,
-                        &event->area,
-                        widget,
-                        "label",
-                        x, y,
-                        label->layout);
+ 
+      if (label->use_dropshadow) 
+        gdk_draw_layout (widget->window,
+                         widget->style->white_gc,
+                         x, y, label->layout);
+      else
+        gtk_paint_layout (widget->style,
+                          widget->window,
+                          GTK_WIDGET_STATE (widget),
+                          FALSE,
+                          &event->area,
+                          widget,
+                          "label",
+                          x, y,
+                          label->layout);
       
       if (label->select_info &&
           (label->select_info->selection_anchor !=
@@ -2474,7 +2536,7 @@ gtk_label_expose (GtkWidget      *widget
                                                    range,
                                                    1);
 	  gdk_region_intersect (clip, event->region);
- 
+
          /* FIXME should use gtk_paint, but it can't use a clip
            * region
            */
@@ -3661,6 +3723,43 @@ gtk_label_get_single_line_mode  (GtkLabe
   g_return_val_if_fail (GTK_IS_LABEL (label), FALSE);
 
   return label->single_line_mode;
+}
+
+/**
+ * gtk_label_set_use_dropshadow:
+ * @label: a #GtkLabel
+ * @setting: %TRUE if the label is to be drawn with a dropshadow
+ *
+ * If true, the label is drawn in white with a black dropshadow.
+ *
+ * Since: 2.12
+ */
+void
+gtk_label_set_use_dropshadow (GtkLabel *label,
+			     gboolean  setting)
+{
+  g_return_if_fail (GTK_IS_LABEL (label));
+
+  gtk_label_set_use_dropshadow_internal (label, setting);
+  gtk_label_recalculate (label);
+}
+
+/**
+ * gtk_label_get_use_dropshadow:
+ * @label: a #GtkLabel
+ *
+ * Returns whether the label is drawn in white with a black dropshadow.
+ *
+ * Return value: %TRUE if the label is drawn with a dropshadow.
+ *
+ * Since: 2.12
+ **/
+gboolean
+gtk_label_get_use_dropshadow (GtkLabel *label)
+{
+  g_return_val_if_fail (GTK_IS_LABEL (label), FALSE);
+  
+  return label->use_dropshadow;
 }
 
 /* Compute the X position for an offset that corresponds to the "more important
Index: gtklabel.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtklabel.h,v
retrieving revision 1.47
diff -u -p -r1.47 gtklabel.h
--- gtklabel.h	19 Jun 2006 14:27:50 -0000	1.47
+++ gtklabel.h	14 Sep 2006 21:26:14 -0000
@@ -62,6 +62,7 @@ struct _GtkLabel
   guint   have_transform   : 1;
   guint   in_click         : 1;
   guint   wrap_mode        : 3;
+  guint   use_dropshadow   : 1;
 
   guint   mnemonic_keyval;
   
@@ -118,6 +119,9 @@ gboolean              gtk_label_get_use_
 void                  gtk_label_set_use_underline (GtkLabel      *label,
 						   gboolean       setting);
 gboolean              gtk_label_get_use_underline (GtkLabel      *label);
+void                  gtk_label_set_use_dropshadow(GtkLabel      *label,
+						   gboolean       setting);
+gboolean              gtk_label_get_use_dropshadow(GtkLabel      *label);
 
 void     gtk_label_set_markup_with_mnemonic       (GtkLabel         *label,
 						   const gchar      *str);
