Struct

ClutterUnits

since: 13

Description [src]

struct ClutterUnits {
  /* No available fields */
}

A logical distance unit

ClutterUnits is a structure holding a logical distance value along with its type, expressed as a value of the ClutterUnitType enumeration. It is possible to use ClutterUnits to store a position or a size in units different than pixels, and convert them whenever needed (for instance inside the Clutter.ActorClass.allocate virtual function, or inside the Clutter.ActorClass.get_preferred_width and Clutter.ActorClass.get_preferred_height virtual functions.

In order to register a ClutterUnits property, the ClutterParamSpecUnit GParamSpec sub-class should be used:

  GParamSpec *pspec;

  pspec = clutter_param_spec_units ("active-width", NULL, NULL,
                                    CLUTTER_UNIT_MM,
                                    0.0, 12.0,
                                    12.0,
                                    G_PARAM_READWRITE);
  g_object_class_install_property (gobject_class, PROP_WIDTH, pspec);

A GValue holding units can be manipulated using clutter_value_set_units() and clutter_value_get_units(). GValues containing a ClutterUnits value can also be transformed to GValues initialized with G_TYPE_INT, G_TYPE_FLOAT and G_TYPE_STRING through implicit conversion and using g_value_transform().

Available since: 13

Functions

clutter_units_from_cm

Stores a value in centimeters inside units.

since: 13

clutter_units_from_em

Stores a value in em inside units, using the default font name.

since: 13

clutter_units_from_em_for_font

Stores a value in em inside units using font_name.

since: 13

clutter_units_from_mm

Stores a value in millimeters inside units.

since: 13

clutter_units_from_pixels

Stores a value in pixels inside units.

since: 13

clutter_units_from_pt

Stores a value in typographic points inside units.

since: 13

clutter_units_from_string

Parses a value and updates units with it.

since: 13

Instance methods

clutter_units_copy

Copies units.

since: 13

clutter_units_free

Frees the resources allocated by units.

since: 13

clutter_units_get_unit_type

Retrieves the unit type of the value stored inside units.

since: 13

clutter_units_get_unit_value

Retrieves the value stored inside units.

since: 13

clutter_units_to_pixels

Converts a value in ClutterUnits to pixels.

since: 13

clutter_units_to_string

Converts units into a string.

since: 13