Example #1
0
static void
gtk_css_shorthand_property_set_property (GObject      *object,
                                         guint         prop_id,
                                         const GValue *value,
                                         GParamSpec   *pspec)
{
  GtkCssShorthandProperty *property = GTK_CSS_SHORTHAND_PROPERTY (object);
  const char **subproperties;
  guint i;

  switch (prop_id)
    {
    case PROP_SUBPROPERTIES:
      subproperties = g_value_get_boxed (value);
      g_assert (subproperties);
      for (i = 0; subproperties[i] != NULL; i++)
        {
          GtkStyleProperty *subproperty = _gtk_style_property_lookup (subproperties[i]);
          g_assert (GTK_IS_CSS_STYLE_PROPERTY (subproperty));
          g_ptr_array_add (property->subproperties, subproperty);
        }
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}
Example #2
0
/**
 * _gtk_css_style_property_get_initial_value:
 * @property: the property
 *
 * Queries the initial value of the given @property. See the
 * [CSS Documentation](http://www.w3.org/TR/css3-cascade/#intial)
 * for an explanation of this concept.
 *
 * Returns: a reference to the initial value. The value will never change.
 **/
GtkCssValue *
_gtk_css_style_property_get_initial_value (GtkCssStyleProperty *property)
{
  gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), NULL);

  return property->initial_value;
}
Example #3
0
/**
 * _gtk_css_style_property_get_id:
 * @property: the property
 *
 * Gets the id for the given property. IDs are used to allow using arrays
 * for style lookups.
 *
 * Returns: The id of the property
 **/
guint
_gtk_css_style_property_get_id (GtkCssStyleProperty *property)
{
  gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), 0);

  return property->id;
}
Example #4
0
/**
 * _gtk_css_style_property_get_affects:
 * @property: the property
 *
 * Returns all the things this property affects. See @GtkCssAffects for what
 * the flags mean.
 *
 * Returns: The things this property affects.
 **/
GtkCssAffects
_gtk_css_style_property_get_affects (GtkCssStyleProperty *property)
{
  gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), 0);

  return property->affects;
}
Example #5
0
/**
 * _gtk_css_style_property_is_animated:
 * @property: the property
 *
 * Queries if the given @property can be is animated. See the
 * [CSS Documentation](http://www.w3.org/TR/css3-transitions/#animatable-css)
 * for animatable properties.
 *
 * Returns: %TRUE if the property can be animated.
 **/
gboolean
_gtk_css_style_property_is_animated (GtkCssStyleProperty *property)
{
  gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), FALSE);

  return property->animated;
}
Example #6
0
static void
transition_info_add (TransitionInfo    infos[GTK_CSS_PROPERTY_N_PROPERTIES],
                     GtkStyleProperty *property,
                     guint             index)
{
    if (property == NULL)
    {
        guint i;

        for (i = 0; i < _gtk_css_style_property_get_n_properties (); i++)
        {
            GtkCssStyleProperty *prop = _gtk_css_style_property_lookup_by_id (i);

            transition_info_add (infos, GTK_STYLE_PROPERTY (prop), index);
        }
    }
    else if (GTK_IS_CSS_SHORTHAND_PROPERTY (property))
    {
        GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property);
        guint i;

        for (i = 0; i < _gtk_css_shorthand_property_get_n_subproperties (shorthand); i++)
        {
            GtkCssStyleProperty *prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i);

            transition_info_add (infos, GTK_STYLE_PROPERTY (prop), index);
        }
    }
    else if (GTK_IS_CSS_STYLE_PROPERTY (property))
    {
        guint id;

        if (!_gtk_css_style_property_is_animated (GTK_CSS_STYLE_PROPERTY (property)))
            return;

        id = _gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (property));
        g_assert (id < GTK_CSS_PROPERTY_N_PROPERTIES);
        infos[id].index = index;
        infos[id].pending = TRUE;
    }
    else
    {
        g_assert_not_reached ();
    }
}