PROP_0,
PROP_LONGITUDE,
PROP_LATITUDE,
+ PROP_HIGHLIGHTED,
};
//static guint champlain_base_marker_signals[LAST_SIGNAL] = { 0, };
case PROP_LATITUDE:
g_value_set_double (value, priv->lat);
break;
+ case PROP_HIGHLIGHTED:
+ g_value_set_boolean (value, priv->highlighted);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
champlain_base_marker_set_position (base_marker, lat, priv->lon);
break;
}
+ case PROP_HIGHLIGHTED:
+ {
+ gboolean bvalue = g_value_get_boolean (value);
+ champlain_base_marker_set_highlighted (base_marker, bvalue);
+ break;
+ }
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
"The latitude coordonate of the base_marker",
-90.0f, 90.0f, 0.0f, CHAMPLAIN_PARAM_READWRITE));
+ /**
+ * ChamplainBaseMarker:highlighted:
+ *
+ * The highlighted state of the marker
+ *
+ * Since: 0.4
+ */
+ g_object_class_install_property (object_class, PROP_HIGHLIGHTED,
+ g_param_spec_boolean ("highlighted", "Highlighted",
+ "The highlighted stated of the marker",
+ FALSE, CHAMPLAIN_PARAM_READWRITE));
}
static void
{
ChamplainBaseMarkerPrivate *priv = CHAMPLAIN_BASE_MARKER_GET_PRIVATE (marker);
marker->priv = priv;
+ priv->lat = 0;
+ priv->lon = 0;
+ priv->highlighted = FALSE;
}
* Since: 0.4
*/
void
-champlain_base_marker_set_position (ChamplainBaseMarker *champlainBaseMarker, gdouble latitude, gdouble longitude)
+champlain_base_marker_set_position (ChamplainBaseMarker *champlainBaseMarker,
+ gdouble latitude,
+ gdouble longitude)
{
g_return_if_fail (CHAMPLAIN_IS_BASE_MARKER (champlainBaseMarker));
g_object_notify (G_OBJECT (champlainBaseMarker), "latitude");
g_object_notify (G_OBJECT (champlainBaseMarker), "longitude");
}
+
+/**
+ * champlain_base_marker_set_highlighted:
+ * @base_marker: a #ChamplainBaseMarker
+ * @value: the highlighted state
+ *
+ * Sets the marker as highlighted or not. This will affect the "Selected" look
+ * of the marker.
+ *
+ * Since: 0.4
+ */
+void
+champlain_base_marker_set_highlighted (ChamplainBaseMarker *champlainBaseMarker,
+ gboolean value)
+{
+ g_return_if_fail (CHAMPLAIN_IS_BASE_MARKER (champlainBaseMarker));
+
+ ChamplainBaseMarkerPrivate *priv = CHAMPLAIN_BASE_MARKER_GET_PRIVATE (champlainBaseMarker);
+
+ priv->highlighted = value;
+
+ g_object_notify (G_OBJECT (champlainBaseMarker), "highlighted");
+}
+
+/**
+ * champlain_base_marker_get_highlighted:
+ * @base_marker: a #ChamplainBaseMarker
+ *
+ * Returns the highlighted or not state of the marker.
+ *
+ * Since: 0.4
+ */
+gboolean
+champlain_base_marker_get_highlighted (ChamplainBaseMarker *champlainBaseMarker)
+{
+ g_return_val_if_fail (CHAMPLAIN_IS_BASE_MARKER (champlainBaseMarker), FALSE);
+
+ ChamplainBaseMarkerPrivate *priv = CHAMPLAIN_BASE_MARKER_GET_PRIVATE (champlainBaseMarker);
+
+ return priv->highlighted;
+}
#define DEFAULT_FONT_NAME "Sans 11"
+static ClutterColor SELECTED_COLOR = {0x00, 0x00, 0xff, 0xff};
+
static ClutterColor DEFAULT_COLOR = {0x33, 0x33, 0x33, 0xff};
static ClutterColor DEFAULT_TEXT_COLOR = {0xee, 0xee, 0xee, 0xff};
gint point)
{
ChamplainMarkerPrivate *priv = marker->priv;
+ ChamplainBaseMarkerPrivate *base_priv = CHAMPLAIN_BASE_MARKER (marker)->priv;
ClutterActor *bg = NULL;
+ ClutterColor *color;
ClutterColor darker_color;
cairo_t *cr;
bg = clutter_cairo_new (width, height + point);
cr = clutter_cairo_create (CLUTTER_CAIRO (bg));
+ /* If selected, add the selection color to the marker's color */
+ if (base_priv->highlighted)
+ color = &SELECTED_COLOR;
+ else
+ color = priv->color;
+
+
draw_box (cr, width, height, point, priv->alignment == PANGO_ALIGN_LEFT);
- clutter_color_darken (priv->color, &darker_color);
+ clutter_color_darken (color, &darker_color);
cairo_set_source_rgba (cr,
- priv->color->red / 255.0,
- priv->color->green / 255.0,
- priv->color->blue / 255.0,
- priv->color->alpha / 255.0);
+ color->red / 255.0,
+ color->green / 255.0,
+ color->blue / 255.0,
+ color->alpha / 255.0);
cairo_fill_preserve (cr);
cairo_set_line_width (cr, 1.0);
marker->priv->redraw_id = g_idle_add (redraw_on_idle, marker);
}
+static void
+notify_highlighted (GObject *gobject,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+ queue_redraw (CHAMPLAIN_MARKER (gobject));
+}
+
static void
champlain_marker_init (ChamplainMarker *marker)
{
priv->ellipsize = PANGO_ELLIPSIZE_NONE;
priv->draw_background = TRUE;
priv->redraw_id = 0;
+
+ g_signal_connect (marker, "notify::highlighted", G_CALLBACK (notify_highlighted), NULL);
}
/**