GtkCssValue * _gtk_css_rgba_value_new_from_rgba (const GdkRGBA *rgba) { GtkCssValue *value; g_return_val_if_fail (rgba != NULL, NULL); value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_RGBA); value->rgba = *rgba; return value; }
GtkCssValue * _gtk_css_image_value_new (GtkCssImage *image) { static GtkCssValue none_singleton = { >K_CSS_VALUE_IMAGE, 1, NULL }; GtkCssValue *value; if (image == NULL) return _gtk_css_value_ref (&none_singleton); value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_IMAGE); value->image = image; return value; }
static GtkCssValue * gtk_css_win32_size_value_new (double scale, GtkWin32Theme *theme, GtkWin32SizeType type) { GtkCssValue *result; result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_WIN32_SIZE.value_class); result->scale = scale; result->theme = gtk_win32_theme_ref (theme); result->type = type; return result; }
GtkCssValue * _gtk_css_bg_size_value_new (GtkCssValue *x, GtkCssValue *y) { GtkCssValue *result; if (x == NULL && y == NULL) return _gtk_css_value_ref (&auto_singleton); result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_BG_SIZE); result->x = x; result->y = y; return result; }
static GtkCssValue * _gtk_css_ease_value_new_steps (guint n_steps, gboolean start) { GtkCssValue *value; g_return_val_if_fail (n_steps > 0, NULL); value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_EASE); value->type = GTK_CSS_EASE_STEPS; value->u.steps.steps = n_steps; value->u.steps.start = start; return value; }
GtkCssValue * gtk_css_icon_theme_value_new (GtkIconTheme *icontheme) { GtkCssValue *result; if (icontheme == NULL) return _gtk_css_value_ref (&default_icon_theme_value); result = g_object_get_data (G_OBJECT (icontheme), "-gtk-css-value"); if (result) return _gtk_css_value_ref (result); result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_ICON_THEME); result->icontheme = g_object_ref (icontheme); g_object_set_data (G_OBJECT (icontheme), I_("-gtk-css-value"), result); result->changed_id = g_signal_connect (icontheme, "changed", G_CALLBACK (gtk_css_value_icon_theme_changed_cb), result); return result; }
GtkCssValue * _gtk_css_ease_value_new_cubic_bezier (double x1, double y1, double x2, double y2) { GtkCssValue *value; g_return_val_if_fail (x1 >= 0.0, NULL); g_return_val_if_fail (x1 <= 1.0, NULL); g_return_val_if_fail (x2 >= 0.0, NULL); g_return_val_if_fail (x2 <= 1.0, NULL); value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_EASE); value->type = GTK_CSS_EASE_CUBIC_BEZIER; value->u.cubic.x1 = x1; value->u.cubic.y1 = y1; value->u.cubic.x2 = x2; value->u.cubic.y2 = y2; return value; }
GtkCssValue * _gtk_css_number_value_new (double value, GtkCssUnit unit) { static GtkCssValue number_singletons[] = { { >K_CSS_VALUE_NUMBER, 1, GTK_CSS_NUMBER, 0 }, { >K_CSS_VALUE_NUMBER, 1, GTK_CSS_NUMBER, 1 }, }; static GtkCssValue px_singletons[] = { { >K_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 0 }, { >K_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 1 }, { >K_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 2 }, { >K_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 3 }, { >K_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 4 }, }; GtkCssValue *result; if (unit == GTK_CSS_NUMBER && (value == 0 || value == 1)) return _gtk_css_value_ref (&number_singletons[(int) value]); if (unit == GTK_CSS_PX && (value == 0 || value == 1 || value == 2 || value == 3 || value == 4)) { return _gtk_css_value_ref (&px_singletons[(int) value]); } result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_NUMBER); result->unit = unit; result->value = value; return result; }