4 using System.Runtime.InteropServices;
6 public class KeyboardFocusManager : BaseHandle {
7 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
9 internal KeyboardFocusManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.KeyboardFocusManager_SWIGUpcast(cPtr), cMemoryOwn) {
10 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
13 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyboardFocusManager obj) {
14 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
17 ~KeyboardFocusManager() {
21 public override void Dispose() {
23 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
26 NDalicManualPINVOKE.delete_KeyboardFocusManager(swigCPtr);
28 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
30 global::System.GC.SuppressFinalize(this);
37 * @brief Event arguments that passed via FocusChanged signal
40 public class FocusChangedEventArgs : EventArgs
42 private Actor _actorCurrent;
43 private Actor _actorNext;
46 * @brief Actor - is the original focused Actor
49 public Actor ActorCurrent
57 _actorCurrent = value;
62 * @brief Actor - is the current focused Actor
65 public Actor ActorNext
79 * @brief Event arguments that passed via FocusGroupChanged signal
82 public class FocusGroupChangedEventArgs : EventArgs
84 private Actor _currentFocusedActor;
85 private bool _forwardDirection;
88 * @brief Actor - is the current focused Actor
91 public Actor CurrentFocusedActor
95 return _currentFocusedActor;
99 _currentFocusedActor = value;
104 * @brief ForwardDirection - is the direction (forward or backward) in which to move the focus next
107 public bool ForwardDirection
111 return _forwardDirection;
115 _forwardDirection = value;
121 * @brief Event arguments that passed via FocusedActorEnterKey signal
124 public class FocusedActorEnterKeyEventArgs : EventArgs
126 private Actor _actor;
129 * @brief Actor - is the current focused Actor which has the enter key pressed on it.
146 * @brief Event arguments that passed via PreFocusChange signal
149 public class PreFocusChangeEventArgs : EventArgs
151 private Actor _current;
152 private Actor _proposed;
153 private View.KeyboardFocus.Direction _direction;
156 * @brief Actor - is the current focused Actor.
172 * @brief Actor - is the proposed focused Actor.
175 public Actor Proposed
188 * @brief Direction - is the direction of Focus change.
191 public View.KeyboardFocus.Direction Direction
204 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
205 public delegate void FocusChangedEventHandler(object source, FocusChangedEventArgs e);
207 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
208 public delegate void FocusGroupChangedEventHandler(object source, FocusGroupChangedEventArgs e);
210 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
211 public delegate void FocusedActorEnterKeyEventHandler(object source, FocusedActorEnterKeyEventArgs e);
213 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
214 public delegate Actor PreFocusChangeEventHandler(object source, PreFocusChangeEventArgs e);
216 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
217 public delegate IntPtr PreFocusChangeEventCallbackDelegate(IntPtr current, IntPtr proposed, View.KeyboardFocus.Direction direction);
218 private PreFocusChangeEventHandler _keyboardFocusManagerPreFocusChangeEventHandler;
219 private PreFocusChangeEventCallbackDelegate _keyboardFocusManagerPreFocusChangeEventCallbackDelegate;
221 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
222 private delegate void FocusChangedEventCallbackDelegate(IntPtr actorCurrent, IntPtr actorNext);
223 private FocusChangedEventHandler _keyboardFocusManagerFocusChangedEventHandler;
224 private FocusChangedEventCallbackDelegate _keyboardFocusManagerFocusChangedEventCallbackDelegate;
226 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
227 private delegate void FocusGroupChangedEventCallbackDelegate(IntPtr currentFocusedActor, bool forwardDirection);
228 private FocusGroupChangedEventHandler _keyboardFocusManagerFocusGroupChangedEventHandler;
229 private FocusGroupChangedEventCallbackDelegate _keyboardFocusManagerFocusGroupChangedEventCallbackDelegate;
231 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
232 private delegate void FocusedActorEnterKeyEventCallbackDelegate(IntPtr actor);
233 private FocusedActorEnterKeyEventHandler _keyboardFocusManagerFocusedActorEnterKeyEventHandler;
234 private FocusedActorEnterKeyEventCallbackDelegate _keyboardFocusManagerFocusedActorEnterKeyEventCallbackDelegate;
236 public event PreFocusChangeEventHandler PreFocusChange
242 // Restricted to only one listener
243 if (_keyboardFocusManagerPreFocusChangeEventHandler == null)
245 _keyboardFocusManagerPreFocusChangeEventHandler += value;
247 _keyboardFocusManagerPreFocusChangeEventCallbackDelegate = new PreFocusChangeEventCallbackDelegate(OnPreFocusChange);
248 this.PreFocusChangeSignal().Connect(_keyboardFocusManagerPreFocusChangeEventCallbackDelegate);
257 if (_keyboardFocusManagerPreFocusChangeEventHandler != null)
259 this.PreFocusChangeSignal().Disconnect(_keyboardFocusManagerPreFocusChangeEventCallbackDelegate);
262 _keyboardFocusManagerPreFocusChangeEventHandler -= value;
267 // Callback for KeyboardFocusManager PreFocusChangeSignal
268 private IntPtr OnPreFocusChange(IntPtr current, IntPtr proposed, View.KeyboardFocus.Direction direction)
271 PreFocusChangeEventArgs e = new PreFocusChangeEventArgs();
273 // Populate all members of "e" (PreFocusChangeEventArgs) with real data
274 e.Current = Actor.GetActorFromPtr(current);
275 e.Proposed = Actor.GetActorFromPtr(proposed);
276 e.Direction = direction;
278 if (_keyboardFocusManagerPreFocusChangeEventHandler != null)
280 //here we send all data to user event handlers
281 actor = _keyboardFocusManagerPreFocusChangeEventHandler(this, e);
284 return actor.GetPtrfromActor();
288 * @brief Event for FocusChanged signal which can be used to subscribe/unsubscribe the event handler
289 * (in the type of FocusChangedEventHandler) provided by the user.
290 * FocusChanged signal is emitted after the current focused actor has been changed.
292 public event FocusChangedEventHandler FocusChanged
298 // Restricted to only one listener
299 if (_keyboardFocusManagerFocusChangedEventHandler == null)
301 _keyboardFocusManagerFocusChangedEventHandler += value;
303 _keyboardFocusManagerFocusChangedEventCallbackDelegate = new FocusChangedEventCallbackDelegate(OnFocusChanged);
304 this.FocusChangedSignal().Connect(_keyboardFocusManagerFocusChangedEventCallbackDelegate);
313 if (_keyboardFocusManagerFocusChangedEventHandler != null)
315 this.FocusChangedSignal().Disconnect(_keyboardFocusManagerFocusChangedEventCallbackDelegate);
318 _keyboardFocusManagerFocusChangedEventHandler -= value;
323 // Callback for KeyboardFocusManager FocusChangedSignal
324 private void OnFocusChanged(IntPtr actorCurrent, IntPtr actorNext)
326 FocusChangedEventArgs e = new FocusChangedEventArgs();
328 // Populate all members of "e" (FocusChangedEventArgs) with real data
329 e.ActorCurrent = Actor.GetActorFromPtr(actorCurrent);
330 e.ActorNext = Actor.GetActorFromPtr(actorNext);
332 if (_keyboardFocusManagerFocusChangedEventHandler != null)
334 //here we send all data to user event handlers
335 _keyboardFocusManagerFocusChangedEventHandler(this, e);
340 * @brief Event for FocusGroupChanged signal which can be used to subscribe/unsubscribe the event handler
341 * (in the type of FocusGroupChangedEventHandler) provided by the user.
342 * FocusGroupChanged signal is emitted when the focus group has been changed.
344 public event FocusGroupChangedEventHandler FocusGroupChanged
350 // Restricted to only one listener
351 if (_keyboardFocusManagerFocusGroupChangedEventHandler == null)
353 _keyboardFocusManagerFocusGroupChangedEventHandler += value;
355 _keyboardFocusManagerFocusGroupChangedEventCallbackDelegate = new FocusGroupChangedEventCallbackDelegate(OnFocusGroupChanged);
356 this.FocusGroupChangedSignal().Connect(_keyboardFocusManagerFocusGroupChangedEventCallbackDelegate);
365 if (_keyboardFocusManagerFocusGroupChangedEventHandler != null)
367 this.FocusGroupChangedSignal().Disconnect(_keyboardFocusManagerFocusGroupChangedEventCallbackDelegate);
370 _keyboardFocusManagerFocusGroupChangedEventHandler -= value;
375 // Callback for KeyboardFocusManager FocusGroupChangedSignal
376 private void OnFocusGroupChanged(IntPtr currentFocusedActor, bool forwardDirection)
378 FocusGroupChangedEventArgs e = new FocusGroupChangedEventArgs();
380 // Populate all members of "e" (FocusGroupChangedEventArgs) with real data
381 e.CurrentFocusedActor = Actor.GetActorFromPtr(currentFocusedActor);
382 e.ForwardDirection = forwardDirection;
384 if (_keyboardFocusManagerFocusGroupChangedEventHandler != null)
386 //here we send all data to user event handlers
387 _keyboardFocusManagerFocusGroupChangedEventHandler(this, e);
392 * @brief Event for FocusedActorEnterKeyPressed signal which can be used to subscribe/unsubscribe the event handler
393 * (in the type of FocusedActorEnterKeyEventHandler) provided by the user.
394 * FocusedActorEnterKeyPressed signal is emitted when the current focused actor has the enter key pressed on it.
396 public event FocusedActorEnterKeyEventHandler FocusedActorEnterKeyPressed
402 // Restricted to only one listener
403 if (_keyboardFocusManagerFocusedActorEnterKeyEventHandler == null)
405 _keyboardFocusManagerFocusedActorEnterKeyEventHandler += value;
407 _keyboardFocusManagerFocusedActorEnterKeyEventCallbackDelegate = new FocusedActorEnterKeyEventCallbackDelegate(OnFocusedActorEnterKey);
408 this.FocusedActorEnterKeySignal().Connect(_keyboardFocusManagerFocusedActorEnterKeyEventCallbackDelegate);
417 if (_keyboardFocusManagerFocusedActorEnterKeyEventHandler != null)
419 this.FocusedActorEnterKeySignal().Disconnect(_keyboardFocusManagerFocusedActorEnterKeyEventCallbackDelegate);
422 _keyboardFocusManagerFocusedActorEnterKeyEventHandler -= value;
427 // Callback for KeyboardFocusManager FocusedActorEnterKeySignal
428 private void OnFocusedActorEnterKey(IntPtr actor)
430 FocusedActorEnterKeyEventArgs e = new FocusedActorEnterKeyEventArgs();
432 // Populate all members of "e" (FocusedActorEnterKeyEventArgs) with real data
433 e.Actor = Actor.GetActorFromPtr(actor);
435 if (_keyboardFocusManagerFocusedActorEnterKeyEventHandler != null)
437 //here we send all data to user event handlers
438 _keyboardFocusManagerFocusedActorEnterKeyEventHandler(this, e);
442 public KeyboardFocusManager() : this(NDalicManualPINVOKE.new_KeyboardFocusManager(), true) {
443 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
446 public static KeyboardFocusManager Get() {
447 KeyboardFocusManager ret = new KeyboardFocusManager(NDalicManualPINVOKE.KeyboardFocusManager_Get(), true);
448 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
452 public bool SetCurrentFocusActor(Actor actor) {
453 bool ret = NDalicManualPINVOKE.KeyboardFocusManager_SetCurrentFocusActor(swigCPtr, Actor.getCPtr(actor));
454 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
458 public Actor GetCurrentFocusActor() {
459 Actor ret = new Actor(NDalicManualPINVOKE.KeyboardFocusManager_GetCurrentFocusActor(swigCPtr), true);
460 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
464 public bool MoveFocus(View.KeyboardFocus.Direction direction) {
465 bool ret = NDalicManualPINVOKE.KeyboardFocusManager_MoveFocus(swigCPtr, (int)direction);
466 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
470 public void ClearFocus() {
471 NDalicManualPINVOKE.KeyboardFocusManager_ClearFocus(swigCPtr);
472 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
475 public void SetFocusGroupLoop(bool enabled) {
476 NDalicManualPINVOKE.KeyboardFocusManager_SetFocusGroupLoop(swigCPtr, enabled);
477 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
480 public bool GetFocusGroupLoop() {
481 bool ret = NDalicManualPINVOKE.KeyboardFocusManager_GetFocusGroupLoop(swigCPtr);
482 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
486 public void SetAsFocusGroup(Actor actor, bool isFocusGroup) {
487 NDalicManualPINVOKE.KeyboardFocusManager_SetAsFocusGroup(swigCPtr, Actor.getCPtr(actor), isFocusGroup);
488 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
491 public bool IsFocusGroup(Actor actor) {
492 bool ret = NDalicManualPINVOKE.KeyboardFocusManager_IsFocusGroup(swigCPtr, Actor.getCPtr(actor));
493 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
497 public Actor GetFocusGroup(Actor actor) {
498 Actor ret = new Actor(NDalicManualPINVOKE.KeyboardFocusManager_GetFocusGroup(swigCPtr, Actor.getCPtr(actor)), true);
499 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
503 public void SetFocusIndicatorActor(Actor indicator) {
504 NDalicManualPINVOKE.KeyboardFocusManager_SetFocusIndicatorActor(swigCPtr, Actor.getCPtr(indicator));
505 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
508 public Actor GetFocusIndicatorActor() {
509 Actor ret = new Actor(NDalicManualPINVOKE.KeyboardFocusManager_GetFocusIndicatorActor(swigCPtr), true);
510 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
514 public KeyboardPreFocusChangeSignal PreFocusChangeSignal() {
515 KeyboardPreFocusChangeSignal ret = new KeyboardPreFocusChangeSignal(NDalicManualPINVOKE.KeyboardFocusManager_PreFocusChangeSignal(swigCPtr), false);
516 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
520 public FocusChangedSignal FocusChangedSignal() {
521 FocusChangedSignal ret = new FocusChangedSignal(NDalicManualPINVOKE.KeyboardFocusManager_FocusChangedSignal(swigCPtr), false);
522 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
526 public FocusGroupChangedSignal FocusGroupChangedSignal() {
527 FocusGroupChangedSignal ret = new FocusGroupChangedSignal(NDalicManualPINVOKE.KeyboardFocusManager_FocusGroupChangedSignal(swigCPtr), false);
528 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
532 public ActorSignal FocusedActorEnterKeySignal() {
533 ActorSignal ret = new ActorSignal(NDalicManualPINVOKE.KeyboardFocusManager_FocusedActorEnterKeySignal(swigCPtr), false);
534 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();