]> err.no Git - libchamplain/commitdiff
Add get/set hightlighted color
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 19 Oct 2009 03:04:54 +0000 (23:04 -0400)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 19 Oct 2009 03:04:54 +0000 (23:04 -0400)
For better readability under some themes

champlain/champlain-marker.c
champlain/champlain-marker.h

index dee7f032ec8ab8fd57c135bcf026035b3e867c00..d4d0b8e87356cd078e4a014b2b3b341e4f4283e0 100644 (file)
@@ -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);
     }
index 09d02be5a34d214db9774b9c9578efa096b9a705..44afca9c003251e156963cb834cc33b58e1704ff 100644 (file)
@@ -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