Re: keybindings for scrollbars



Tim,

What is the relationship between these key bindings and those defined for 
GtkScrolledWindow?

Padraig

> hey all,
> 
> h/vscales currently support a good amount of keybinding, e.g
> left/right/up/down/page-up/page-down together with modifiers,
> to adjust their value.
> the same keybindings are not supported for scrollbars though,
> and i don't see a reason for that. note, that keybindings on
> scales and scrollbars only take affect if they have focus,
> and the developer needs to explicitely request focusability for
> the widget (e.g. by setting "can_focus", TRUE on the widget),
> in order for keybindings to take effect.
> 
> so i plan on comitting the following keybindings to GtkScrollbarClass
> (these are simply the current scale bindings, copied 1:1) unless someone
> feels there's further need to discuss this issue:
> 
> 
> #define add_slider_binding(binding_set, keyval, mask, scroll)          \
>   gtk_binding_entry_add_signal (binding_set, keyval, mask,             \
>                                 "move_slider", 1,                      \
>                                 GTK_TYPE_SCROLL_TYPE, scroll)
> 
>   /* All bindings (even arrow keys) are on both h/v scale, because
>    * blind users etc. don't care about scale orientation.
>    */
>   
>   add_slider_binding (binding_set, GDK_Left, 0,
>                       GTK_SCROLL_STEP_LEFT);
>   
>   add_slider_binding (binding_set, GDK_Left, GDK_CONTROL_MASK,
>                       GTK_SCROLL_PAGE_LEFT);
>   
>   add_slider_binding (binding_set, GDK_KP_Left, 0,
>                       GTK_SCROLL_STEP_LEFT);
>   
>   add_slider_binding (binding_set, GDK_KP_Left, GDK_CONTROL_MASK,
>                       GTK_SCROLL_PAGE_LEFT);
>   
>   add_slider_binding (binding_set, GDK_Right, 0,
>                       GTK_SCROLL_STEP_RIGHT);
>   
>   add_slider_binding (binding_set, GDK_Right, GDK_CONTROL_MASK,
>                       GTK_SCROLL_PAGE_RIGHT);
>   
>   add_slider_binding (binding_set, GDK_KP_Right, 0,
>                       GTK_SCROLL_STEP_RIGHT);
>   
>   add_slider_binding (binding_set, GDK_KP_Right, GDK_CONTROL_MASK,
>                       GTK_SCROLL_PAGE_RIGHT);
>   
>   add_slider_binding (binding_set, GDK_Up, 0,
>                       GTK_SCROLL_STEP_UP);
>   
>   add_slider_binding (binding_set, GDK_Up, GDK_CONTROL_MASK,
>                       GTK_SCROLL_PAGE_UP);
>   
>   add_slider_binding (binding_set, GDK_KP_Up, 0,
>                       GTK_SCROLL_STEP_UP);
>   
>   add_slider_binding (binding_set, GDK_KP_Up, GDK_CONTROL_MASK,
>                       GTK_SCROLL_PAGE_UP);
>   
>   add_slider_binding (binding_set, GDK_Down, 0,
>                       GTK_SCROLL_STEP_DOWN);
>   
>   add_slider_binding (binding_set, GDK_Down, GDK_CONTROL_MASK,
>                       GTK_SCROLL_PAGE_DOWN);
>   
>   add_slider_binding (binding_set, GDK_KP_Down, 0,
>                       GTK_SCROLL_STEP_DOWN);
>   
>   add_slider_binding (binding_set, GDK_KP_Down, GDK_CONTROL_MASK,
>                       GTK_SCROLL_PAGE_DOWN);
>   
>   add_slider_binding (binding_set, GDK_Page_Up, 0,
>                       GTK_SCROLL_PAGE_LEFT);
>   
>   add_slider_binding (binding_set, GDK_KP_Page_Up, 0,
>                       GTK_SCROLL_PAGE_LEFT);  
>   
>   add_slider_binding (binding_set, GDK_Page_Up, 0,
>                       GTK_SCROLL_PAGE_UP);
>   
>   add_slider_binding (binding_set, GDK_KP_Page_Up, 0,
>                       GTK_SCROLL_PAGE_UP);
>   
>   add_slider_binding (binding_set, GDK_Page_Down, 0,
>                       GTK_SCROLL_PAGE_RIGHT);
>   
>   add_slider_binding (binding_set, GDK_KP_Page_Down, 0,
>                       GTK_SCROLL_PAGE_RIGHT);
>   
>   add_slider_binding (binding_set, GDK_Page_Down, 0,
>                       GTK_SCROLL_PAGE_DOWN);
>   
>   add_slider_binding (binding_set, GDK_KP_Page_Down, 0,
>                       GTK_SCROLL_PAGE_DOWN);
>   
>   /* Logical bindings (vs. visual bindings above) */
>   
>   add_slider_binding (binding_set, GDK_plus, 0,
>                       GTK_SCROLL_STEP_FORWARD);  
>   
>   add_slider_binding (binding_set, GDK_minus, 0,
>                       GTK_SCROLL_STEP_BACKWARD);  
>   
>   add_slider_binding (binding_set, GDK_plus, GDK_CONTROL_MASK,
>                       GTK_SCROLL_PAGE_FORWARD);  
>   
>   add_slider_binding (binding_set, GDK_minus, GDK_CONTROL_MASK,
>                       GTK_SCROLL_PAGE_BACKWARD);
>   
>   
>   add_slider_binding (binding_set, GDK_KP_Add, 0,
>                       GTK_SCROLL_STEP_FORWARD);  
>   
>   add_slider_binding (binding_set, GDK_KP_Subtract, 0,
>                       GTK_SCROLL_STEP_BACKWARD);  
>   
>   add_slider_binding (binding_set, GDK_KP_Add, GDK_CONTROL_MASK,
>                       GTK_SCROLL_PAGE_FORWARD);  
>   
>   add_slider_binding (binding_set, GDK_KP_Subtract, GDK_CONTROL_MASK,
>                       GTK_SCROLL_PAGE_BACKWARD);
>   
>   
>   add_slider_binding (binding_set, GDK_Home, 0,
>                       GTK_SCROLL_START);
>   
>   add_slider_binding (binding_set, GDK_KP_Home, 0,
>                       GTK_SCROLL_START);
>   
>   add_slider_binding (binding_set, GDK_End, 0,
>                       GTK_SCROLL_END);
>   
>   add_slider_binding (binding_set, GDK_KP_End, 0,
>                       GTK_SCROLL_END);
>   
> 
> 
> ---
> ciaoTJ
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list




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