libchamplain Reference Manual: ChamplainLabel

## ChamplainLabel ChamplainLabel — A label to identify points of interest on a map |

## Functions

ClutterActor * | champlain_label_new ()
ClutterActor * | champlain_label_new_with_text ()
ClutterActor * | champlain_label_new_with_image ()
ClutterActor * | champlain_label_new_from_file ()
ClutterActor * | champlain_label_new_full ()
void | champlain_label_set_text ()
void | champlain_label_set_image ()
void | champlain_label_set_use_markup ()
void | champlain_label_set_alignment ()
void | champlain_label_set_color ()
void | champlain_label_set_text_color ()
void | champlain_label_set_font_name ()
void | champlain_label_set_wrap ()
void | champlain_label_set_wrap_mode ()
void | champlain_label_set_attributes ()
void | champlain_label_set_single_line_mode ()
void | champlain_label_set_ellipsize ()
void | champlain_label_set_draw_background ()
void | champlain_label_set_draw_shadow ()
gboolean | champlain_label_get_use_markup ()
const gchar * | champlain_label_get_text ()
ClutterActor * | champlain_label_get_image ()
PangoAlignment | champlain_label_get_alignment ()
ClutterColor * | champlain_label_get_color ()
ClutterColor * | champlain_label_get_text_color ()
const gchar * | champlain_label_get_font_name ()
gboolean | champlain_label_get_wrap ()
PangoWrapMode | champlain_label_get_wrap_mode ()
PangoEllipsizeMode | champlain_label_get_ellipsize ()
gboolean | champlain_label_get_single_line_mode ()
gboolean | champlain_label_get_draw_background ()
PangoAttrList * | champlain_label_get_attributes ()
gboolean | champlain_label_get_draw_shadow ()

## Properties

PangoAlignment | alignment | Read / Write
ClutterColor * | color | Read / Write
gboolean | draw-background | Read / Write
gboolean | draw-shadow | Read / Write
PangoEllipsizeMode | ellipsize | Read / Write
gchar * | font-name | Read / Write
ClutterActor * | image | Read / Write
gboolean | single-line-mode | Read / Write
gchar * | text | Read / Write
ClutterColor * | text-color | Read / Write
gboolean | use-markup | Read / Write
gboolean | wrap | Read / Write
PangoWrapMode | wrap-mode | Read / Write

## Types and Values

struct | ChamplainLabel

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── ClutterActor
                ╰── ChamplainMarker
                    ╰── ChamplainLabel

## Implemented Interfaces

ChamplainLabel implements ClutterContainer, ClutterScriptable, ClutterAnimatable, AtkImplementorIface and ChamplainLocation.

## Description

Markers reprensent points of interest on a map. Markers need to be placed on a layer (a ChamplainMarkerLayer). Layers have to be added to a ChamplainView for the markers to show on the map.

A marker is nothing more than a regular ClutterActor. You can draw on it what ever you want. Set the markers position on the map using champlain_location_set_location.

Champlain has a default type of markers with text. To create one, use champlain_label_new_with_text.

## Functions

### champlain_label_new ()

    ClutterActor *
    champlain_label_new (void);

Creates a new instance of ChamplainLabel.

#### Returns

a new ChamplainLabel ready to be used as a ClutterActor.

Since 0.10

### champlain_label_new_with_text ()

    ClutterActor *
    champlain_label_new_with_text (const gchar *text,
                                   const gchar *font,
                                   ClutterColor *text_color,
                                   ClutterColor *label_color);

Creates a new instance of ChamplainLabel with text value.

#### Parameters

text | the text of the label |
font | the font to use to draw the text, for example "Courrier Bold 11", can be NULL. | [allow-none]
text_color | a ClutterColor, the color of the text, can be NULL. | [allow-none]
label_color | a ClutterColor, the color of the label, can be NULL. | [allow-none]

#### Returns

a new ChamplainLabel with a drawn label containing the given text.

Since 0.10

### champlain_label_new_with_image ()

    ClutterActor *
    champlain_label_new_with_image (ClutterActor *actor);

Creates a new instance of ChamplainLabel with image.

#### Parameters

actor | The image as a `ClutterActor` . |

#### Returns

a new ChamplainLabel with a drawn label containing the given image.

Since 0.10

### champlain_label_new_from_file ()

    ClutterActor *
    champlain_label_new_from_file (const gchar *filename,
                                   GError **error);

Creates a new instance of ChamplainLabel with image loaded from file.

#### Parameters

filename | The filename of the image. |
error | Return location for an error. |

#### Returns

a new ChamplainLabel with a drawn label containing the given image.

Since 0.10

### champlain_label_new_full ()

    ClutterActor *
    champlain_label_new_full (const gchar *text,
                              ClutterActor *actor);

Creates a new instance of ChamplainLabel consisting of a custom ClutterActor.

#### Parameters

text | The text of the label |
actor | The image as a `ClutterActor` |

#### Returns

a new ChamplainLabel with a drawn label containing the given image.

Since 0.10

### champlain_label_set_text ()

    void
    champlain_label_set_text (ChamplainLabel *label,
                              const gchar *text);

Sets the label's text.

#### Parameters

label | a ChamplainLabel |
text | The new text of the label |

Since 0.10

### champlain_label_set_image ()

    void
    champlain_label_set_image (ChamplainLabel *label,
                               ClutterActor *image);

Sets the label's image.

#### Parameters

label | a ChamplainLabel |
image | The image as a `ClutterActor` or NULL to remove the current image. | [allow-none]

Since 0.10

### champlain_label_set_use_markup ()

    void
    champlain_label_set_use_markup (ChamplainLabel *label,
                                    gboolean use_markup);

Sets if the label's text uses markup.

#### Parameters

label | a ChamplainLabel |
use_markup | The value |

Since 0.10

### champlain_label_set_alignment ()

    void
    champlain_label_set_alignment (ChamplainLabel *label,
                                   PangoAlignment alignment);

Sets the label's text alignment.

#### Parameters

label | a ChamplainLabel |
alignment | The label's alignment |

Since 0.10

### champlain_label_set_color ()

    void
    champlain_label_set_color (ChamplainLabel *label,
                               const ClutterColor *color);

Sets the label's background color.

#### Parameters

label | a ChamplainLabel |
color | The label's background color or NULL to reset the background to the default color. The color parameter is copied. | [allow-none]

Since 0.10

### champlain_label_set_text_color ()

    void
    champlain_label_set_text_color (ChamplainLabel *label,
                                    const ClutterColor *color);

Sets the label's text color.

#### Parameters

label | a ChamplainLabel |
color | The label's text color or NULL to reset the text to the default color. The color parameter is copied. | [allow-none]

Since 0.10

### champlain_label_set_font_name ()

    void
    champlain_label_set_font_name (ChamplainLabel *label,
                                   const gchar *font_name);

Sets the label's font name such as "Sans 12".

#### Parameters

label | a ChamplainLabel |
font_name | The label's font name or NULL to reset the font to the default value. | [allow-none]

Since 0.10

### champlain_label_set_wrap ()

    void
    champlain_label_set_wrap (ChamplainLabel *label,
                              gboolean wrap);

Sets if the label's text wrap.

#### Parameters

label | a ChamplainLabel |
wrap | The label's wrap. |

Since 0.10

### champlain_label_set_wrap_mode ()

    void
    champlain_label_set_wrap_mode (ChamplainLabel *label,
                                   PangoWrapMode wrap_mode);

Sets the label's text wrap mode.

#### Parameters

label | a ChamplainLabel |
wrap_mode | The label's wrap mode. |

Since 0.10

### champlain_label_set_attributes ()

    void
    champlain_label_set_attributes (ChamplainLabel *label,
                                    PangoAttrList *list);

Sets the label's text attributes.

#### Parameters

label | a ChamplainLabel |
list | The label's text attributes. |

Since 0.10

### champlain_label_set_single_line_mode ()

    void
    champlain_label_set_single_line_mode (ChamplainLabel *label,
                                          gboolean mode);

Sets if the label's text is on a single line.

#### Parameters

label | a ChamplainLabel |
mode | The label's single line mode |

Since 0.10

### champlain_label_set_ellipsize ()

    void
    champlain_label_set_ellipsize (ChamplainLabel *label,
                                   PangoEllipsizeMode mode);

Sets the label's text ellipsize mode.

#### Parameters

label | a ChamplainLabel |
mode | The label's ellipsize mode. |

Since 0.10

### champlain_label_set_draw_background ()

    void
    champlain_label_set_draw_background (ChamplainLabel *label,
                                         gboolean background);

Sets if the label has a background.

#### Parameters

label | a ChamplainLabel |
background | value. |

Since 0.10

### champlain_label_set_draw_shadow ()

    void
    champlain_label_set_draw_shadow (ChamplainLabel *label,
                                     gboolean shadow);

Sets if the label's background has a shadow.

#### Parameters

label | a ChamplainLabel |
shadow | value. |

Since 0.12.10

### champlain_label_get_use_markup ()

    gboolean
    champlain_label_get_use_markup (ChamplainLabel *label);

Check whether the label uses markup.

#### Parameters

label | a ChamplainLabel |

#### Returns

if the label's text contains markup.

Since 0.10

### champlain_label_get_text ()

    const gchar *
    champlain_label_get_text (ChamplainLabel *label);

Get the label's text.

#### Parameters

label | a ChamplainLabel |

#### Returns

the label's text.

Since 0.10

### champlain_label_get_image ()

    ClutterActor *
    champlain_label_get_image (ChamplainLabel *label);

Get the label's image.

#### Parameters

label | a ChamplainLabel |

#### Returns

the label's image.

[transfer none]

Since 0.10

### champlain_label_get_alignment ()

    PangoAlignment
    champlain_label_get_alignment (ChamplainLabel *label);

Get the label's text alignment.

#### Parameters

label | a ChamplainLabel |

#### Returns

the label's text alignment.

Since 0.10

### champlain_label_get_color ()

    ClutterColor *
    champlain_label_get_color (ChamplainLabel *label);

Gets the label's background color.

#### Parameters

label | a ChamplainLabel |

#### Returns

the label's background color.

Since 0.10

### champlain_label_get_text_color ()

    ClutterColor *
    champlain_label_get_text_color (ChamplainLabel *label);

Gets the label's text color.

#### Parameters

label | a ChamplainLabel |

#### Returns

the label's text color.

Since 0.10

### champlain_label_get_font_name ()

    const gchar *
    champlain_label_get_font_name (ChamplainLabel *label);

Gets the label's font name.

#### Parameters

label | a ChamplainLabel |

#### Returns

the label's font name.

Since 0.10

### champlain_label_get_wrap ()

    gboolean
    champlain_label_get_wrap (ChamplainLabel *label);

Checks whether the label text wraps.

#### Parameters

label | a ChamplainLabel |

#### Returns

if the label's text wraps.

Since 0.10

### champlain_label_get_wrap_mode ()

    PangoWrapMode
    champlain_label_get_wrap_mode (ChamplainLabel *label);

Gets the label's text wrap mode.

#### Parameters

label | a ChamplainLabel |

#### Returns

the label's text wrap mode.

Since 0.10

### champlain_label_get_ellipsize ()

    PangoEllipsizeMode
    champlain_label_get_ellipsize (ChamplainLabel *label);

Gets the label's text ellipsize mode.

#### Parameters

label | a ChamplainLabel |

#### Returns

the label's text ellipsize mode.

Since 0.10

### champlain_label_get_single_line_mode ()

    gboolean
    champlain_label_get_single_line_mode (ChamplainLabel *label);

Checks the label's single line mode.

#### Parameters

label | a ChamplainLabel |

#### Returns

the label's text single line mode.

Since 0.10

### champlain_label_get_draw_background ()

    gboolean
    champlain_label_get_draw_background (ChamplainLabel *label);

Checks whether the label has a background.

#### Parameters

label | a ChamplainLabel |

#### Returns

if the label has a background.

Since 0.10

### champlain_label_get_attributes ()

    PangoAttrList *
    champlain_label_get_attributes (ChamplainLabel *label);

Gets the label's text attributes.

#### Parameters

label | a ChamplainLabel |

#### Returns

the label's text attributes.

Since 0.10

### champlain_label_get_draw_shadow ()

    gboolean
    champlain_label_get_draw_shadow (ChamplainLabel *label);

Checks whether the label's background has a shadow.

#### Parameters

label | a ChamplainLabel |

#### Returns

if the label's background has a shadow.

Since 0.12.10

## Types and Values

### struct ChamplainLabel

    struct ChamplainLabel;

The ChamplainLabel structure contains only private data and should be accessed using the provided API

Since 0.10

## Property Details

### The `“alignment”` property

      “alignment”                PangoAlignment

The label's alignment

Flags: Read / Write

Default value: PANGO_ALIGN_LEFT

Since 0.10

### The `“color”` property

      “color”                    ClutterColor *

The label's color

Flags: Read / Write

Since 0.10

### The `“draw-background”` property

      “draw-background”          gboolean

If the label has a background

Flags: Read / Write

Default value: TRUE

Since 0.10

### The `“draw-shadow”` property

      “draw-shadow”              gboolean

If the label background has a shadow

Flags: Read / Write

Default value: TRUE

Since 0.12.10

### The `“ellipsize”` property

      “ellipsize”                PangoEllipsizeMode

The label's ellipsize mode

Flags: Read / Write

Default value: PANGO_ELLIPSIZE_NONE

Since 0.10

### The `“font-name”` property

      “font-name”                gchar *

The label's text font name

Flags: Read / Write

Default value: "Sans 11"

Since 0.10

### The `“image”` property

      “image”                    ClutterActor *

The image of the label

Flags: Read / Write

Since 0.10

### The `“single-line-mode”` property

      “single-line-mode”         gboolean

If the label is in single line mode

Flags: Read / Write

Default value: TRUE

Since 0.10

### The `“text”` property

      “text”                     gchar *

The text of the label

Flags: Read / Write

Default value: ""

Since 0.10

### The `“text-color”` property

      “text-color”               ClutterColor *

The label's text color

Flags: Read / Write

Since 0.10

### The `“use-markup”` property

      “use-markup”               gboolean

If the label's text uses markup

Flags: Read / Write

Default value: FALSE

Since 0.10

### The `“wrap”` property

      “wrap”                     gboolean

If the label's text wrap is set

Flags: Read / Write

Default value: FALSE

Since 0.10

### The `“wrap-mode”` property

      “wrap-mode”                PangoWrapMode

The label's text wrap mode

Flags: Read / Write

Default value: PANGO_WRAP_WORD

Since 0.10