Bug 69872 - GTK_WIDGET_SET_FLAGS should be deprecated

Add gtk_widget_set_receives_default() and
gtk_widget_get_receives_default() as accessors for
GTK_RECEIVES_DEFAULT.
This commit is contained in:
Michael Natterer 2009-09-04 14:50:35 +02:00
parent dc3fb714a0
commit b81079d898
3 changed files with 60 additions and 0 deletions

View File

@ -4990,6 +4990,7 @@ gtk_widget_get_pango_context
gtk_widget_get_parent
gtk_widget_get_parent_window
gtk_widget_get_pointer
gtk_widget_get_receives_default
gtk_widget_get_root_window
gtk_widget_get_screen
gtk_widget_get_sensitive
@ -5078,6 +5079,7 @@ gtk_widget_set_name
gtk_widget_set_no_show_all
gtk_widget_set_parent
gtk_widget_set_parent_window
gtk_widget_set_receives_default
gtk_widget_set_redraw_on_allocate
gtk_widget_set_scroll_adjustments
gtk_widget_set_sensitive

View File

@ -5471,6 +5471,60 @@ gtk_widget_grab_default (GtkWidget *widget)
g_warning (G_STRLOC ": widget not within a GtkWindow");
}
/**
* gtk_widget_set_receives_default:
* @widget: a #GtkWidget
* @receives_default: whether or not @widget can be a default widget.
*
* Specifies whether @widget will be treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See gtk_widget_grab_default() for details about the meaning of
* "default".
*
* Since: 2.18
**/
void
gtk_widget_set_receives_default (GtkWidget *widget,
gboolean receives_default)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
if (receives_default != gtk_widget_get_receives_default (widget))
{
if (receives_default)
GTK_WIDGET_SET_FLAGS (widget, GTK_RECEIVES_DEFAULT);
else
GTK_WIDGET_UNSET_FLAGS (widget, GTK_RECEIVES_DEFAULT);
g_object_notify (G_OBJECT (widget), "receives-default");
}
}
/**
* gtk_widget_get_receives_default:
* @widget: a #GtkWidget
*
* Determines whether @widget is alyways treated as default widget
* withing its toplevel when it has the focus, even if another widget
* is the default.
*
* See gtk_widget_set_receives_default().
*
* Return value: %TRUE if @widget acts as default widget when focussed,
* %FALSE otherwise
*
* Since: 2.18
**/
gboolean
gtk_widget_get_receives_default (GtkWidget *widget)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
return (GTK_WIDGET_FLAGS (widget) & GTK_RECEIVES_DEFAULT) != 0;
}
/**
* gtk_widget_has_grab:
* @widget: a #GtkWidget

View File

@ -561,6 +561,10 @@ gboolean gtk_widget_get_can_default (GtkWidget *widget);
gboolean gtk_widget_has_default (GtkWidget *widget);
void gtk_widget_grab_default (GtkWidget *widget);
void gtk_widget_set_receives_default (GtkWidget *widget,
gboolean receives_default);
gboolean gtk_widget_get_receives_default (GtkWidget *widget);
gboolean gtk_widget_has_grab (GtkWidget *widget);
void gtk_widget_set_name (GtkWidget *widget,