开发者

Shift focus by navigation key using clutter toolkit in c?

开发者 https://www.devze.com 2023-04-12 06:59 出处:网络
I have to create a vertical menu using clutter in C. Can anyone help me how to implement focus shift using the navigatio开发者_JS百科n keys for the menu where i want to highlight the focused menu opti

I have to create a vertical menu using clutter in C. Can anyone help me how to implement focus shift using the navigatio开发者_JS百科n keys for the menu where i want to highlight the focused menu option.


the easiest way is to mark the actor that contains all the menu items as reactive, assign to it the key focus using clutter_actor_grab_key_focus() and connect to the key-press-event signal. then you can use clutter_event_get_key_symbol() on the ClutterEvent passed to the signal and match it agains key symbols like CLUTTER_KEY_Down or CLUTTER_KEY_Up.

then there's even the possibility to use ClutterBindingPool to handle tuples of (key symbol, modifier) and assign them to a specific callback function.

for more information, see the API reference:

http://developer.gnome.org/clutter/stable/ClutterActor.html#clutter-actor-grab-key-focus http://developer.gnome.org/clutter/stable/ClutterActor.html#ClutterActor-key-press-event http://developer.gnome.org/clutter/stable/clutter-Events.html#clutter-event-get-key-symbol http://developer.gnome.org/clutter/stable/clutter-Key-Bindings.html

the list of key symbols in in the clutter-keysyms.h header:

http://git.gnome.org/browse/clutter/tree/clutter/clutter-keysyms.h

there are various recipes in the Cookbook as well:

https://developer.gnome.org/clutter-cookbook/stable/events-handling-key-events.html

0

精彩评论

暂无评论...
验证码 换一张
取 消