forked from AuroraMiddleware/gtk
widget: Remove gtk_widget_override* API
This commit is contained in:
parent
addb655aee
commit
9a388690f4
173
gtk/gtkwidget.c
173
gtk/gtkwidget.c
@ -8952,179 +8952,6 @@ gtk_widget_get_parent (GtkWidget *widget)
|
||||
return widget->priv->parent;
|
||||
}
|
||||
|
||||
static GtkModifierStyle *
|
||||
_gtk_widget_get_modifier_properties (GtkWidget *widget)
|
||||
{
|
||||
GtkModifierStyle *style;
|
||||
|
||||
style = g_object_get_qdata (G_OBJECT (widget), quark_modifier_style);
|
||||
|
||||
if (G_UNLIKELY (!style))
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
|
||||
style = _gtk_modifier_style_new ();
|
||||
g_object_set_qdata_full (G_OBJECT (widget),
|
||||
quark_modifier_style,
|
||||
style,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
|
||||
context = _gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_style_context_add_provider (context,
|
||||
GTK_STYLE_PROVIDER (style),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_override_color:
|
||||
* @widget: a #GtkWidget
|
||||
* @state: the state for which to set the color
|
||||
* @color: (allow-none): the color to assign, or %NULL to undo the effect
|
||||
* of previous calls to gtk_widget_override_color()
|
||||
*
|
||||
* Sets the color to use for a widget.
|
||||
*
|
||||
* All other style values are left untouched.
|
||||
*
|
||||
* This function does not act recursively. Setting the color of a
|
||||
* container does not affect its children. Note that some widgets that
|
||||
* you may not think of as containers, for instance #GtkButtons,
|
||||
* are actually containers.
|
||||
*
|
||||
* This API is mostly meant as a quick way for applications to
|
||||
* change a widget appearance. If you are developing a widgets
|
||||
* library and intend this change to be themeable, it is better
|
||||
* done by setting meaningful CSS classes in your
|
||||
* widget/container implementation through gtk_style_context_add_class().
|
||||
*
|
||||
* This way, your widget library can install a #GtkCssProvider
|
||||
* with the %GTK_STYLE_PROVIDER_PRIORITY_FALLBACK priority in order
|
||||
* to provide a default styling for those widgets that need so, and
|
||||
* this theming may fully overridden by the user’s theme.
|
||||
*
|
||||
* Note that for complex widgets this may bring in undesired
|
||||
* results (such as uniform background color everywhere), in
|
||||
* these cases it is better to fully style such widgets through a
|
||||
* #GtkCssProvider with the %GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||
* priority.
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated:3.16: Use a custom style provider and style classes instead
|
||||
*/
|
||||
void
|
||||
gtk_widget_override_color (GtkWidget *widget,
|
||||
GtkStateFlags state,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
GtkModifierStyle *style;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
style = _gtk_widget_get_modifier_properties (widget);
|
||||
_gtk_modifier_style_set_color (style, state, color);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_override_background_color:
|
||||
* @widget: a #GtkWidget
|
||||
* @state: the state for which to set the background color
|
||||
* @color: (allow-none): the color to assign, or %NULL to undo the effect
|
||||
* of previous calls to gtk_widget_override_background_color()
|
||||
*
|
||||
* Sets the background color to use for a widget.
|
||||
*
|
||||
* All other style values are left untouched.
|
||||
* See gtk_widget_override_color().
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.16: This function is not useful in the context of CSS-based
|
||||
* rendering. If you wish to change the way a widget renders its background
|
||||
* you should use a custom CSS style, through an application-specific
|
||||
* #GtkStyleProvider and a CSS style class. You can also override the default
|
||||
* drawing of a widget through the #GtkWidget::draw signal, and use Cairo to
|
||||
* draw a specific color, regardless of the CSS style.
|
||||
*/
|
||||
void
|
||||
gtk_widget_override_background_color (GtkWidget *widget,
|
||||
GtkStateFlags state,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
GtkModifierStyle *style;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
style = _gtk_widget_get_modifier_properties (widget);
|
||||
_gtk_modifier_style_set_background_color (style, state, color);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_override_font:
|
||||
* @widget: a #GtkWidget
|
||||
* @font_desc: (allow-none): the font description to use, or %NULL to undo
|
||||
* the effect of previous calls to gtk_widget_override_font()
|
||||
*
|
||||
* Sets the font to use for a widget. All other style values are
|
||||
* left untouched. See gtk_widget_override_color().
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.16: This function is not useful in the context of CSS-based
|
||||
* rendering. If you wish to change the font a widget uses to render its text
|
||||
* you should use a custom CSS style, through an application-specific
|
||||
* #GtkStyleProvider and a CSS style class.
|
||||
*/
|
||||
void
|
||||
gtk_widget_override_font (GtkWidget *widget,
|
||||
const PangoFontDescription *font_desc)
|
||||
{
|
||||
GtkModifierStyle *style;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
style = _gtk_widget_get_modifier_properties (widget);
|
||||
_gtk_modifier_style_set_font (style, font_desc);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_override_symbolic_color:
|
||||
* @widget: a #GtkWidget
|
||||
* @name: the name of the symbolic color to modify
|
||||
* @color: (allow-none): the color to assign (does not need
|
||||
* to be allocated), or %NULL to undo the effect of previous
|
||||
* calls to gtk_widget_override_symbolic_color()
|
||||
*
|
||||
* Sets a symbolic color for a widget.
|
||||
*
|
||||
* All other style values are left untouched.
|
||||
* See gtk_widget_override_color() for overriding the foreground
|
||||
* or background color.
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.16: This function is not useful in the context of CSS-based
|
||||
* rendering. If you wish to change the color used to render symbolic icons
|
||||
* you should use a custom CSS style, through an application-specific
|
||||
* #GtkStyleProvider and a CSS style class.
|
||||
*/
|
||||
void
|
||||
gtk_widget_override_symbolic_color (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
GtkModifierStyle *style;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
style = _gtk_widget_get_modifier_properties (widget);
|
||||
_gtk_modifier_style_map_color (style, name, color);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_real_direction_changed (GtkWidget *widget,
|
||||
GtkTextDirection previous_direction)
|
||||
|
@ -1095,25 +1095,6 @@ gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_widget_hide_on_delete (GtkWidget *widget);
|
||||
|
||||
/* Functions to override widget styling */
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
void gtk_widget_override_color (GtkWidget *widget,
|
||||
GtkStateFlags state,
|
||||
const GdkRGBA *color);
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
void gtk_widget_override_background_color (GtkWidget *widget,
|
||||
GtkStateFlags state,
|
||||
const GdkRGBA *color);
|
||||
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
void gtk_widget_override_font (GtkWidget *widget,
|
||||
const PangoFontDescription *font_desc);
|
||||
|
||||
GDK_DEPRECATED_IN_3_16
|
||||
void gtk_widget_override_symbolic_color (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
const GdkRGBA *color);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_widget_reset_style (GtkWidget *widget);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user