[libchamplain/libchamplain-0-4] Add get/set hightlighted color



commit 1815499e08bae9639c324cef6955165f48004464
Author: Pierre-Luc Beaudoin <pierre-luc pierlux com>
Date:   Sun Oct 18 23:04:54 2009 -0400

    Add get/set hightlighted color
    
    For better readability under some themes

 champlain/champlain-marker.c |   37 ++++++++++++++++++++++++++++++++++++-
 champlain/champlain-marker.h |    3 +++
 2 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/champlain/champlain-marker.c b/champlain/champlain-marker.c
index dee7f03..d4d0b8e 100644
--- a/champlain/champlain-marker.c
+++ b/champlain/champlain-marker.c
@@ -55,6 +55,7 @@
 #define DEFAULT_FONT_NAME "Sans 11"
 
 static ClutterColor SELECTED_COLOR = {0x00, 0x33, 0xcc, 0xff};
+static ClutterColor SELECTED_TEXT_COLOR = {0xff, 0xff, 0xff, 0xff};
 
 static ClutterColor DEFAULT_COLOR = {0x33, 0x33, 0x33, 0xff};
 static ClutterColor DEFAULT_TEXT_COLOR = {0xee, 0xee, 0xee, 0xff};
@@ -146,6 +147,38 @@ champlain_marker_get_highlight_color ()
   return &SELECTED_COLOR;
 }
 
+/**
+ * champlain_marker_set_hightlight_text_color:
+ * @color: a #ClutterColor
+ *
+ *
+ * Changes the highlight text color, this is to ensure a better integration with
+ * the desktop, this is automatically done by GtkChamplainEmbed.
+ *
+ * Since: 0.4
+ */
+void
+champlain_marker_set_highlight_text_color (ClutterColor *color)
+{
+  SELECTED_TEXT_COLOR.red = color->red;
+  SELECTED_TEXT_COLOR.green = color->green;
+  SELECTED_TEXT_COLOR.blue = color->blue;
+  SELECTED_TEXT_COLOR.alpha = color->alpha;
+}
+
+/**
+ * champlain_marker_get_hightlight_text_color:
+ *
+ * Returns: the highlight text color. Should not be freed.
+ *
+ * Since: 0.4.1
+ */
+const ClutterColor *
+champlain_marker_get_highlight_text_color ()
+{
+  return &SELECTED_TEXT_COLOR;
+}
+
 static void
 champlain_marker_get_property (GObject *object,
                                guint prop_id,
@@ -571,6 +604,7 @@ static void
 draw_marker (ChamplainMarker *marker)
 {
   ChamplainMarkerPrivate *priv = marker->priv;
+  ChamplainBaseMarkerPrivate *base_priv = CHAMPLAIN_BASE_MARKER (marker)->priv;
   guint height = 0, point = 0;
   guint total_width = 0, total_height = 0;
 
@@ -618,7 +652,8 @@ draw_marker (ChamplainMarker *marker)
       if (height > total_height)
         total_height = height;
 
-      clutter_text_set_color (CLUTTER_TEXT (priv->text_actor), priv->text_color);
+      clutter_text_set_color (CLUTTER_TEXT (priv->text_actor),
+          (base_priv->highlighted ? &SELECTED_TEXT_COLOR : priv->text_color));
       if (clutter_actor_get_parent (priv->text_actor) == NULL)
         clutter_container_add_actor (CLUTTER_CONTAINER (marker), priv->text_actor);
     }
diff --git a/champlain/champlain-marker.h b/champlain/champlain-marker.h
index 09d02be..44afca9 100644
--- a/champlain/champlain-marker.h
+++ b/champlain/champlain-marker.h
@@ -114,6 +114,9 @@ gboolean champlain_marker_get_draw_background (ChamplainMarker *marker);
 void champlain_marker_set_highlight_color (ClutterColor *color);
 const ClutterColor * champlain_marker_get_highlight_color (void);
 
+void champlain_marker_set_highlight_text_color (ClutterColor *color);
+const ClutterColor * champlain_marker_get_highlight_text_color (void);
+
 G_END_DECLS
 
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]