Accelerators and Keybindings for widgets



I will attempt to describe what may be possible here and we can then evaluate 
whether this is what we want.

An accelerator provides a way of connecting a key press on a top level window to 
an action on a particular widget. It associates a key symbol and a set of 
modifiers with a widget and an action signal. An accclerator is specified to be 
part of a accelerator group when it is defined, using the function 
gtk_accel_group_add(). An accelerator group is associated with a window by the 
function gtk_window_add_accel_group(); it is possible to have more than one 
accelerator group associated with a window. A menu may have, at most, one 
accelerator group associated with it by the function gtk_menu_set_accel_group().

Given a widget, we need to be able to find the accelerators associated with the 
widget and identify the actions associated with the accelerators.

It is possible to get the list of GtkAccelEntry items associated with a widget 
(or GtkObject) by calling gtk_accel_group_entries_from_object() and associate an 
action with each entry. This might mean that we have more than one action with 
the same name if there are different The best we can do for the description is 
the name of the signal. Doing the action means emitting the signal. We could 
return the output from gtk_accelerator_name() for atk_action_get_keybinding() 
but this will require us to remove G_CONST_RETURN from the return value. 

I have not discussed keybingings as I do not think that we need to expose the 
keybindings associated with a Gtk class.

Padraig


> > The AtkAction interface is described as being supported for GailWidget,
> > providing basic support for accelerators inherited by all descendants of
> > GailWidget.
> > 
> > Was there a discussion on the mailing list about what this means?
> 
> I'm not sure, I don't see it.  I think that there is some generic
> high-level support for accelerators in GtkWidget, so that infers that
> there must be an action for each bound accelerator.  If that is not
> the case, or doesn't make sense, I would drop AtkAction from
> GtkWidget.  I will look at the Gtk accelerator stuff a little more
> closely, maybe the reasoning will become clear.
> 
> -Bill
>  
> > Padraig
> 
> -- 
> --------------
> Bill Haneman
> Gnome Accessibility / Batik SVG Toolkit
> Sun Microsystems Ireland





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]