mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 03:10:09 +00:00
GtkWidget: Add gtk_widget_override_cursor().
This function replaces gtk_widget_modify_cursor().
This commit is contained in:
parent
b0c87faa50
commit
9aca6c8071
@ -4850,6 +4850,7 @@ gtk_widget_override_background_color
|
||||
gtk_widget_override_color
|
||||
gtk_widget_override_font
|
||||
gtk_widget_override_symbolic_color
|
||||
gtk_widget_override_cursor
|
||||
gtk_widget_modify_style
|
||||
gtk_widget_get_modifier_style
|
||||
gtk_widget_modify_fg
|
||||
|
@ -8093,6 +8093,42 @@ gtk_widget_override_symbolic_color (GtkWidget *widget,
|
||||
gtk_modifier_style_map_color (style, name, color);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_override_cursor:
|
||||
* @widget: a #GtkWidget
|
||||
* @primary: the color to use for primary cursor (does not need to be
|
||||
* allocated), or %NULL to undo the effect of previous calls to
|
||||
* of gtk_widget_override_cursor().
|
||||
* @secondary: the color to use for secondary cursor (does not need to be
|
||||
* allocated), or %NULL to undo the effect of previous calls to
|
||||
* of gtk_widget_override_cursor().
|
||||
*
|
||||
* Sets the cursor color to use in a widget, overriding the
|
||||
* #GtkWidget:cursor-color and #GtkWidget:secondary-cursor-color
|
||||
* style properties. All other style values are left untouched.
|
||||
* See also gtk_widget_modify_style().
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gtk_widget_override_cursor (GtkWidget *widget,
|
||||
const GdkColor *cursor,
|
||||
const GdkColor *secondary_cursor)
|
||||
{
|
||||
GtkModifierStyle *style;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
style = _gtk_widget_get_modifier_properties (widget);
|
||||
gtk_modifier_style_set_color_property (style,
|
||||
GTK_TYPE_WIDGET,
|
||||
"cursor-color", cursor);
|
||||
gtk_modifier_style_set_color_property (style,
|
||||
GTK_TYPE_WIDGET,
|
||||
"secondary-cursor-color",
|
||||
secondary_cursor);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_modify_fg:
|
||||
* @widget: a #GtkWidget
|
||||
@ -8333,22 +8369,22 @@ modify_color_property (GtkWidget *widget,
|
||||
* See also gtk_widget_modify_style().
|
||||
*
|
||||
* Since: 2.12
|
||||
*
|
||||
* Deprecated: 3.0. Use gtk_widget_override_cursor() instead.
|
||||
**/
|
||||
void
|
||||
gtk_widget_modify_cursor (GtkWidget *widget,
|
||||
const GdkColor *primary,
|
||||
const GdkColor *secondary)
|
||||
{
|
||||
GtkRcStyle *rc_style;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
rc_style = gtk_widget_get_modifier_style (widget);
|
||||
gtk_widget_override_cursor (widget, primary, secondary);
|
||||
|
||||
modify_color_property (widget, rc_style, "cursor-color", primary);
|
||||
modify_color_property (widget, rc_style, "secondary-cursor-color", secondary);
|
||||
|
||||
gtk_widget_modify_style (widget, rc_style);
|
||||
g_signal_emit (widget,
|
||||
widget_signals[STYLE_SET],
|
||||
0,
|
||||
widget->priv->style);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -773,6 +773,10 @@ void gtk_widget_override_font (GtkWidget *w
|
||||
void gtk_widget_override_symbolic_color (GtkWidget *widget,
|
||||
const gchar *name,
|
||||
const GdkRGBA *color);
|
||||
void gtk_widget_override_cursor (GtkWidget *widget,
|
||||
const GdkColor *cursor,
|
||||
const GdkColor *secondary_cursor);
|
||||
|
||||
|
||||
void gtk_widget_style_attach (GtkWidget *widget);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user