Merge "Add more shared C++/JavaScript docs and add JavaScript wrapping guide" into...
[platform/core/uifw/dali-toolkit.git] / plugins / dali-script-v8 / docs / content / keyboard-focus-manager.js
1 /**
2  *
3
4 ## Keyboard Focus Manager API
5
6 Keyboard focus manager controls the keyboard focus flow.
7
8 It also allows you to set an actor that is used to high light the focused actor.
9
10 {{#crossLink "KeyboardFocusManager/setFocusIndicatorActor:method"}}{{/crossLink}}
11
12 The application is required to help the manager when moving focus.
13
14 ![ Focus Manager ](../assets/img/focus-manager/focus-manager.png)
15
16 ### keyboard-pre-focus-change
17
18 Connect to the pre-focus-change call back as follows:
19 ```
20 // listen for pre-focus change events
21 dali.keyboardFocusManager.connect("keyboard-pre-focus-change", this.preFocusChanged);
22   
23 // example call back handler
24   
25 // currentFocusedActor =  currently focused actor
26 // proposed = keyboard focus managers guess at what actor should be next
27 // direction = the direction of the focus is moving in
28 //
29 myApp.preFocusChanged = function( currentFocusedActor, proposedActorToFocus, direction)
30 {
31   
32   if (direction == "up" )
33   {
34     return actor above current actor;
35     }
36   if (direction == "right" )
37   {
38     return actor to the right of current actor;
39   }
40 }
41   
42 dali.keyboardFocusManager.connect("keyboard-pre-focus-change", myCallback)
43 ```
44
45 KeyboardFocusManager makes the best guess for which actor to focus towards the given direction, but applications might want to change that.
46
47 By connecting with this signal, they can check the proposed actor to focus and return a different actor if they wish.
48
49 This signal is only emitted when the navigation key is pressed and KeyboardFocusManager tries to move the focus automatically.
50
51 It won't be emitted for focus movement by calling setCurrentFocusActor directly.
52
53 ### keyboard-focus-changed
54
55 This signal is emitted after the current focused actor has been changed.
56 ```
57 myCallback( originalFocusedActor, currentFocusedActor)
58 {
59 }
60   
61 dali.keyboardFocusManager.connect("keyboard-focus-change", myCallback)
62 ```
63
64 @class KeyboardFocusManager
65
66  */