Пример #1
0
static void
gtk_style_property_set_property (GObject      *object,
                                 guint         prop_id,
                                 const GValue *value,
                                 GParamSpec   *pspec)
{
  GtkStyleProperty *property = GTK_STYLE_PROPERTY (object);
  GtkStylePropertyClass *klass = GTK_STYLE_PROPERTY_GET_CLASS (property);

  switch (prop_id)
    {
    case PROP_NAME:
      property->name = g_value_dup_string (value);
      g_assert (property->name);
      g_assert (g_hash_table_lookup (klass->properties, property->name) == NULL);
      g_hash_table_insert (klass->properties, property->name, property);
      break;
    case PROP_VALUE_TYPE:
      property->value_type = g_value_get_gtype (value);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}
Пример #2
0
/**
 * _gtk_style_property_parse_value:
 * @property: the property
 * @parser: the parser to parse from
 *
 * Tries to parse the given @property from the given @parser into
 * @value. The type that @value will be assigned is dependant on
 * the parser and no assumptions must be made about it. If the
 * parsing fails, %FALSE will be returned and @value will be
 * left uninitialized.
 *
 * Only if @property is a #GtkCssShorthandProperty, the @value will
 * always be a #GtkCssValue whose values can be queried with
 * _gtk_css_array_value_get_nth().
 *
 * Returns: %NULL on failure or the parsed #GtkCssValue
 **/
GtkCssValue *
_gtk_style_property_parse_value (GtkStyleProperty *property,
                                 GtkCssParser     *parser)
{
  GtkStylePropertyClass *klass;

  g_return_val_if_fail (GTK_IS_STYLE_PROPERTY (property), NULL);
  g_return_val_if_fail (parser != NULL, NULL);

  klass = GTK_STYLE_PROPERTY_GET_CLASS (property);

  return klass->parse_value (property, parser);
}
Пример #3
0
/**
 * _gtk_style_property_query:
 * @property: the property
 * @value: (out): an uninitialized #GValue to be filled with the
 *   contents of the lookup
 * @query_func: The function to use to query properties
 * @query_data: The data to pass to @query_func
 *
 * This function is called by gtk_style_properties_get() and in
 * turn gtk_style_context_get() and similar functions to get the
 * value to return to code using old APIs.
 **/
void
_gtk_style_property_query (GtkStyleProperty  *property,
                           GValue            *value,
                           GtkStyleQueryFunc  query_func,
                           gpointer           query_data)
{
  GtkStylePropertyClass *klass;

  g_return_if_fail (value != NULL);
  g_return_if_fail (GTK_IS_STYLE_PROPERTY (property));
  g_return_if_fail (query_func != NULL);

  klass = GTK_STYLE_PROPERTY_GET_CLASS (property);

  klass->query (property, value, query_func, query_data);
}
Пример #4
0
/**
 * _gtk_style_property_assign:
 * @property: the property
 * @props: The properties to assign to
 * @state: The state to assign
 * @value: (out): the #GValue with the value to be
 *     assigned
 *
 * This function is called by gtk_style_properties_set() and in
 * turn gtk_style_context_set() and similar functions to set the
 * value from code using old APIs.
 **/
void
_gtk_style_property_assign (GtkStyleProperty   *property,
                            GtkStyleProperties *props,
                            GtkStateFlags       state,
                            const GValue       *value)
{
  GtkStylePropertyClass *klass;

  g_return_if_fail (GTK_IS_STYLE_PROPERTY (property));
  g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
  g_return_if_fail (value != NULL);

  klass = GTK_STYLE_PROPERTY_GET_CLASS (property);

  klass->assign (property, props, state, value);
}