1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
21 using System.Runtime.InteropServices;
24 /// View is the base class for all views.
26 public class View : CustomActor
28 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
30 internal View(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.View_SWIGUpcast(cPtr), cMemoryOwn)
32 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
34 // Register this instance of view in the view registry.
35 ViewRegistry.RegisterView(this);
37 // By default, we do not want the position to use the anchor point
38 //this.PositionUsesAnchorPoint = false;
39 this.PositionUsesAnchorPoint = !(InternalSetting.DefaultParentOriginAsTopLeft);
42 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj)
44 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
49 DisposeQueue.Instance.Add(this);
51 // Unregister this instance of view from the view registry.
52 ViewRegistry.UnregisterView(this);
55 public override void Dispose()
57 if (!Stage.IsInstalled())
59 DisposeQueue.Instance.Add(this);
65 if (swigCPtr.Handle != global::System.IntPtr.Zero)
70 NDalicPINVOKE.delete_View(swigCPtr);
72 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
74 global::System.GC.SuppressFinalize(this);
81 private EventHandler _keyInputFocusGainedEventHandler;
82 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
83 private delegate void KeyInputFocusGainedCallbackType(IntPtr control);
84 private KeyInputFocusGainedCallbackType _keyInputFocusGainedCallback;
87 /// Event for KeyInputFocusGained signal which can be used to subscribe/unsubscribe the event handler provided by the user.<br>
88 /// KeyInputFocusGained signal is emitted when the control gets Key Input Focus.<br>
90 public event EventHandler FocusGained
94 if (_keyInputFocusGainedEventHandler == null)
96 _keyInputFocusGainedCallback = OnKeyInputFocusGained;
97 this.KeyInputFocusGainedSignal().Connect(_keyInputFocusGainedCallback);
100 _keyInputFocusGainedEventHandler += value;
105 _keyInputFocusGainedEventHandler -= value;
107 if (_keyInputFocusGainedEventHandler == null && KeyInputFocusGainedSignal().Empty() == false)
109 this.KeyInputFocusGainedSignal().Disconnect(_keyInputFocusGainedCallback);
114 private void OnKeyInputFocusGained(IntPtr view)
116 if (_keyInputFocusGainedEventHandler != null)
118 _keyInputFocusGainedEventHandler(this, null);
123 private EventHandler _keyInputFocusLostEventHandler;
124 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
125 private delegate void KeyInputFocusLostCallbackType(IntPtr control);
126 private KeyInputFocusLostCallbackType _keyInputFocusLostCallback;
129 /// Event for KeyInputFocusLost signal which can be used to subscribe/unsubscribe the event handler provided by the user.<br>
130 /// KeyInputFocusLost signal is emitted when the control loses Key Input Focus.<br>
132 public event EventHandler FocusLost
136 if (_keyInputFocusLostEventHandler == null)
138 _keyInputFocusLostCallback = OnKeyInputFocusLost;
139 this.KeyInputFocusLostSignal().Connect(_keyInputFocusLostCallback);
142 _keyInputFocusLostEventHandler += value;
147 _keyInputFocusLostEventHandler -= value;
149 if (_keyInputFocusLostEventHandler == null && KeyInputFocusLostSignal().Empty() == false)
151 this.KeyInputFocusLostSignal().Disconnect(_keyInputFocusLostCallback);
156 private void OnKeyInputFocusLost(IntPtr view)
158 if (_keyInputFocusLostEventHandler != null)
160 _keyInputFocusLostEventHandler(this, null);
165 /// Event arguments that passed via KeyEvent signal.
167 public class KeyEventArgs : EventArgs
172 /// Key - is the key sent to the View.
187 private EventHandlerWithReturnType<object, KeyEventArgs, bool> _keyEventHandler;
188 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
189 private delegate bool KeyCallbackType(IntPtr control, IntPtr keyEvent);
190 private KeyCallbackType _keyCallback;
193 /// Event for KeyPressed signal which can be used to subscribe/unsubscribe the event handler provided by the user.<br>
194 /// KeyPressed signal is emitted when key event is received.<br>
196 public event EventHandlerWithReturnType<object, KeyEventArgs, bool> KeyEvent
200 if (_keyEventHandler == null)
202 _keyCallback = OnKeyEvent;
203 this.KeyEventSignal().Connect(_keyCallback);
206 _keyEventHandler += value;
211 _keyEventHandler -= value;
213 if (_keyEventHandler == null && KeyEventSignal().Empty() == false)
215 this.KeyEventSignal().Disconnect(_keyCallback);
220 private bool OnKeyEvent(IntPtr view, IntPtr keyEvent)
222 KeyEventArgs e = new KeyEventArgs();
224 e.Key = Tizen.NUI.Key.GetKeyFromPtr(keyEvent);
226 if (_keyEventHandler != null)
228 return _keyEventHandler(this, e);
234 private EventHandler _onRelayoutEventHandler;
235 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
236 private delegate void OnRelayoutEventCallbackType(IntPtr control);
237 private OnRelayoutEventCallbackType _onRelayoutEventCallback;
240 /// Event for OnRelayout signal which can be used to subscribe/unsubscribe the event handler.<br>
241 /// OnRelayout signal is emitted after the size has been set on the view during relayout.<br>
243 public event EventHandler OnRelayoutEvent
247 if (_onRelayoutEventHandler == null)
249 _onRelayoutEventCallback = OnRelayout;
250 this.OnRelayoutSignal().Connect(_onRelayoutEventCallback);
253 _onRelayoutEventHandler += value;
258 _onRelayoutEventHandler -= value;
260 if (_onRelayoutEventHandler == null && OnRelayoutSignal().Empty() == false)
262 this.OnRelayoutSignal().Disconnect(_onRelayoutEventCallback);
268 // Callback for View OnRelayout signal
269 private void OnRelayout(IntPtr data)
271 if (_onRelayoutEventHandler != null)
273 _onRelayoutEventHandler(this, null);
278 /// Event arguments that passed via Touch signal.
280 public class TouchEventArgs : EventArgs
282 private Touch _touch;
285 /// Touch - contains the information of touch points
300 private EventHandlerWithReturnType<object, TouchEventArgs, bool> _touchDataEventHandler;
301 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
302 private delegate bool TouchDataCallbackType(IntPtr view, IntPtr touchData);
303 private TouchDataCallbackType _touchDataCallback;
306 /// Event for Touched signal which can be used to subscribe/unsubscribe the event handler provided by the user.<br>
307 /// Touched signal is emitted when touch input is received.<br>
309 public event EventHandlerWithReturnType<object, TouchEventArgs, bool> Touched
313 if (_touchDataEventHandler == null)
315 _touchDataCallback = OnTouch;
316 this.TouchSignal().Connect(_touchDataCallback);
319 _touchDataEventHandler += value;
324 _touchDataEventHandler -= value;
326 if (_touchDataEventHandler == null && TouchSignal().Empty() == false)
328 this.TouchSignal().Disconnect(_touchDataCallback);
334 // Callback for View TouchSignal
335 private bool OnTouch(IntPtr view, IntPtr touchData)
337 TouchEventArgs e = new TouchEventArgs();
339 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
341 if (_touchDataEventHandler != null)
343 return _touchDataEventHandler(this, e);
350 /// Event arguments that passed via Hover signal.
352 public class HoverEventArgs : EventArgs
354 private Hover _hover;
357 /// Hover - contains touch points that represent the points that are currently being hovered or the points where a hover has stopped.
372 private EventHandlerWithReturnType<object, HoverEventArgs, bool> _hoverEventHandler;
373 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
374 private delegate bool HoverEventCallbackType(IntPtr view, IntPtr hoverEvent);
375 private HoverEventCallbackType _hoverEventCallback;
378 /// Event for Hovered signal which can be used to subscribe/unsubscribe the event handler provided by the user.<br>
379 /// Hovered signal is emitted when hover input is received.<br>
381 public event EventHandlerWithReturnType<object, HoverEventArgs, bool> Hovered
385 if (_hoverEventHandler == null)
387 _hoverEventCallback = OnHoverEvent;
388 this.HoveredSignal().Connect(_hoverEventCallback);
391 _hoverEventHandler += value;
396 _hoverEventHandler -= value;
398 if (_hoverEventHandler == null && HoveredSignal().Empty() == false)
400 this.HoveredSignal().Disconnect(_hoverEventCallback);
406 // Callback for View Hover signal
407 private bool OnHoverEvent(IntPtr view, IntPtr hoverEvent)
409 HoverEventArgs e = new HoverEventArgs();
411 e.Hover = Tizen.NUI.Hover.GetHoverFromPtr(hoverEvent);
413 if (_hoverEventHandler != null)
415 return _hoverEventHandler(this, e);
422 /// Event arguments that passed via Wheel signal.
424 public class WheelEventArgs : EventArgs
426 private Wheel _wheel;
429 /// WheelEvent - store a wheel rolling type : MOUSE_WHEEL or CUSTOM_WHEEL
444 private EventHandlerWithReturnType<object, WheelEventArgs, bool> _wheelEventHandler;
445 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
446 private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
447 private WheelEventCallbackType _wheelEventCallback;
450 /// Event for WheelMoved signal which can be used to subscribe/unsubscribe the event handler provided by the user.<br>
451 /// WheelMoved signal is emitted when wheel event is received.<br>
453 public event EventHandlerWithReturnType<object, WheelEventArgs, bool> WheelMoved
457 if (_wheelEventHandler == null)
459 _wheelEventCallback = OnWheelEvent;
460 this.WheelEventSignal().Connect(_wheelEventCallback);
463 _wheelEventHandler += value;
468 _wheelEventHandler -= value;
470 if (_wheelEventHandler == null && WheelEventSignal().Empty() == false)
472 this.WheelEventSignal().Disconnect(_wheelEventCallback);
478 // Callback for View Wheel signal
479 private bool OnWheelEvent(IntPtr view, IntPtr wheelEvent)
481 WheelEventArgs e = new WheelEventArgs();
483 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
485 if (_wheelEventHandler != null)
487 return _wheelEventHandler(this, e);
493 private EventHandler _onStageEventHandler;
494 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
495 private delegate void OnStageEventCallbackType(IntPtr control);
496 private OnStageEventCallbackType _onStageEventCallback;
499 /// Event for OnStage signal which can be used to subscribe/unsubscribe the event handler.<br>
500 /// OnStage signal is emitted after the view has been connected to the stage.<br>
502 public event EventHandler OnStageEvent
506 if (_onStageEventHandler == null)
508 _onStageEventCallback = OnStage;
509 this.OnStageSignal().Connect(_onStageEventCallback);
512 _onStageEventHandler += value;
517 _onStageEventHandler -= value;
519 if (_onStageEventHandler == null && OnStageSignal().Empty() == false)
521 this.OnStageSignal().Disconnect(_onStageEventCallback);
526 // Callback for View OnStage signal
527 private void OnStage(IntPtr data)
529 if (_onStageEventHandler != null)
531 _onStageEventHandler(this, null);
536 private EventHandler _offStageEventHandler;
537 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
538 private delegate void OffStageEventCallbackType(IntPtr control);
539 private OffStageEventCallbackType _offStageEventCallback;
542 /// Event for OffStage signal which can be used to subscribe/unsubscribe the event handler.<br>
543 /// OffStage signal is emitted after the view has been disconnected from the stage.<br>
545 public event EventHandler OffStageEvent
549 if (_offStageEventHandler == null)
551 _offStageEventCallback = OffStage;
552 this.OffStageSignal().Connect(_offStageEventCallback);
555 _offStageEventHandler += value;
560 _offStageEventHandler -= value;
562 if (_offStageEventHandler == null && OffStageSignal().Empty() == false)
564 this.OffStageSignal().Disconnect(_offStageEventCallback);
569 // Callback for View OffStage signal
570 private void OffStage(IntPtr data)
572 if (_offStageEventHandler != null)
574 _offStageEventHandler(this, null);
583 internal static View GetViewFromPtr(global::System.IntPtr cPtr)
585 View ret = new View(cPtr, false);
586 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
590 internal class Property : global::System.IDisposable
592 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
593 protected bool swigCMemOwn;
595 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
597 swigCMemOwn = cMemoryOwn;
598 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
601 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
603 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
611 public virtual void Dispose()
615 if (swigCPtr.Handle != global::System.IntPtr.Zero)
620 NDalicPINVOKE.delete_View_Property(swigCPtr);
622 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
624 global::System.GC.SuppressFinalize(this);
628 internal static readonly int TOOLTIP = NDalicManualPINVOKE.View_Property_TOOLTIP_get();
629 internal static readonly int STATE = NDalicManualPINVOKE.View_Property_STATE_get();
630 internal static readonly int SUB_STATE = NDalicManualPINVOKE.View_Property_SUB_STATE_get();
631 internal static readonly int LEFT_FOCUSABLE_ACTOR_ID = NDalicManualPINVOKE.View_Property_LEFT_FOCUSABLE_ACTOR_ID_get();
632 internal static readonly int RIGHT_FOCUSABLE_ACTOR_ID = NDalicManualPINVOKE.View_Property_RIGHT_FOCUSABLE_ACTOR_ID_get();
633 internal static readonly int UP_FOCUSABLE_ACTOR_ID = NDalicManualPINVOKE.View_Property_UP_FOCUSABLE_ACTOR_ID_get();
634 internal static readonly int DOWN_FOCUSABLE_ACTOR_ID = NDalicManualPINVOKE.View_Property_DOWN_FOCUSABLE_ACTOR_ID_get();
636 internal Property() : this(NDalicPINVOKE.new_View_Property(), true)
638 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
641 internal static readonly int STYLE_NAME = NDalicPINVOKE.View_Property_STYLE_NAME_get();
642 internal static readonly int BACKGROUND_COLOR = NDalicPINVOKE.View_Property_BACKGROUND_COLOR_get();
643 internal static readonly int BACKGROUND_IMAGE = NDalicPINVOKE.View_Property_BACKGROUND_IMAGE_get();
644 internal static readonly int KEY_INPUT_FOCUS = NDalicPINVOKE.View_Property_KEY_INPUT_FOCUS_get();
645 internal static readonly int BACKGROUND = NDalicPINVOKE.View_Property_BACKGROUND_get();
651 /// Describes the direction to move the keyboard focus towards.
653 public enum FocusDirection
664 /// Creates a new instance of a View.
666 public View() : this(NDalicPINVOKE.View_New(), true)
668 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
671 internal View(View uiControl) : this(NDalicPINVOKE.new_View__SWIG_1(View.getCPtr(uiControl)), true)
673 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
676 internal View Assign(View handle)
678 View ret = new View(NDalicPINVOKE.View_Assign(swigCPtr, View.getCPtr(handle)), false);
679 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
684 /// Downcasts a handle to View handle.<br>
685 /// If handle points to a View, the downcast produces valid handle.<br>
686 /// If not, the returned handle is left uninitialized.<br>
688 /// <param name="handle">Handle to an object</param>
689 /// <returns>A handle to a View or an uninitialized handle</returns>
690 public new static View DownCast(BaseHandle handle)
692 View ret = new View(NDalicPINVOKE.View_DownCast(BaseHandle.getCPtr(handle)), true);
693 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
698 /// Downcasts a handle to class which inherit View handle.
700 /// <typeparam name="T">Class which inherit View</typeparam>
701 /// <param name="actor">Actor to an object</param>
702 /// <returns>A object which inherit View</returns>
703 public static T DownCast<T>(Actor actor) where T : View
705 return (T)(ViewRegistry.GetViewFromActor(actor));
708 private View ConvertIdToView(uint id)
714 actor = Parent.FindChildById(id);
719 actor = Stage.Instance.GetRootLayer().FindChildById(id);
722 return View.DownCast<View>(actor);
725 internal void SetKeyInputFocus()
727 NDalicPINVOKE.View_SetKeyInputFocus(swigCPtr);
728 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
732 /// Quries whether the view has focus.
734 /// <returns>true if this view has focus</returns>
735 public bool HasFocus()
737 bool ret = NDalicPINVOKE.View_HasKeyInputFocus(swigCPtr);
738 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
742 internal void ClearKeyInputFocus()
744 NDalicPINVOKE.View_ClearKeyInputFocus(swigCPtr);
745 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
748 internal PinchGestureDetector GetPinchGestureDetector()
750 PinchGestureDetector ret = new PinchGestureDetector(NDalicPINVOKE.View_GetPinchGestureDetector(swigCPtr), true);
751 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
755 internal PanGestureDetector GetPanGestureDetector()
757 PanGestureDetector ret = new PanGestureDetector(NDalicPINVOKE.View_GetPanGestureDetector(swigCPtr), true);
758 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
762 internal TapGestureDetector GetTapGestureDetector()
764 TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.View_GetTapGestureDetector(swigCPtr), true);
765 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
769 internal LongPressGestureDetector GetLongPressGestureDetector()
771 LongPressGestureDetector ret = new LongPressGestureDetector(NDalicPINVOKE.View_GetLongPressGestureDetector(swigCPtr), true);
772 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777 /// Sets the name of the style to be applied to the view.
779 /// <param name="styleName">A string matching a style described in a stylesheet</param>
780 public void SetStyleName(string styleName)
782 NDalicPINVOKE.View_SetStyleName(swigCPtr, styleName);
783 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
787 /// Retrieves the name of the style to be applied to the view (if any).
789 /// <returns>A string matching a style, or an empty string</returns>
790 public string GetStyleName()
792 string ret = NDalicPINVOKE.View_GetStyleName(swigCPtr);
793 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
797 internal void SetBackgroundColor(Vector4 color)
799 NDalicPINVOKE.View_SetBackgroundColor(swigCPtr, Vector4.getCPtr(color));
800 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
803 internal Vector4 GetBackgroundColor()
805 Vector4 ret = new Vector4(NDalicPINVOKE.View_GetBackgroundColor(swigCPtr), true);
806 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
810 internal void SetBackgroundImage(Image image)
812 NDalicPINVOKE.View_SetBackgroundImage(swigCPtr, Image.getCPtr(image));
813 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
817 /// Clears the background.
819 public void ClearBackground()
821 NDalicPINVOKE.View_ClearBackground(swigCPtr);
822 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
825 internal ControlKeySignal KeyEventSignal()
827 ControlKeySignal ret = new ControlKeySignal(NDalicPINVOKE.View_KeyEventSignal(swigCPtr), false);
828 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
832 internal KeyInputFocusSignal KeyInputFocusGainedSignal()
834 KeyInputFocusSignal ret = new KeyInputFocusSignal(NDalicPINVOKE.View_KeyInputFocusGainedSignal(swigCPtr), false);
835 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
839 internal KeyInputFocusSignal KeyInputFocusLostSignal()
841 KeyInputFocusSignal ret = new KeyInputFocusSignal(NDalicPINVOKE.View_KeyInputFocusLostSignal(swigCPtr), false);
842 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
846 internal View(ViewImpl implementation) : this(NDalicPINVOKE.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
848 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
851 internal enum PropertyRange
853 PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,
854 CONTROL_PROPERTY_START_INDEX = PROPERTY_START_INDEX,
855 CONTROL_PROPERTY_END_INDEX = CONTROL_PROPERTY_START_INDEX + 1000
859 /// styleName, type string.
861 public string StyleName
866 GetProperty(View.Property.STYLE_NAME).Get(out temp);
871 SetProperty(View.Property.STYLE_NAME, new Tizen.NUI.PropertyValue(value));
876 /// mutually exclusive with BACKGROUND_IMAGE & BACKGROUND, type Vector4.
878 public Color BackgroundColor
882 Color backgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
884 Tizen.NUI.PropertyMap background = Background;
886 background.Find(Visual.Property.Type).Get(ref visualType);
887 if (visualType == (int)Visual.Type.Color)
889 background.Find(ColorVisualProperty.MixColor).Get(backgroundColor);
892 return backgroundColor;
896 SetProperty(View.Property.BACKGROUND, new Tizen.NUI.PropertyValue(value));
901 /// mutually exclusive with BACKGROUND_COLOR & BACKGROUND, type Map.
903 public string BackgroundImage
907 string backgroundImage = "";
909 Tizen.NUI.PropertyMap background = Background;
911 background.Find(Visual.Property.Type).Get(ref visualType);
912 if (visualType == (int)Visual.Type.Image)
914 background.Find(ImageVisualProperty.URL).Get(out backgroundImage);
917 return backgroundImage;
921 SetProperty(View.Property.BACKGROUND, new Tizen.NUI.PropertyValue(value));
925 internal bool KeyInputFocus
930 GetProperty(View.Property.KEY_INPUT_FOCUS).Get(ref temp);
935 SetProperty(View.Property.KEY_INPUT_FOCUS, new Tizen.NUI.PropertyValue(value));
940 /// mutually exclusive with BACKGROUND_COLOR & BACKGROUND_IMAGE, type Map or string for URL.
942 public Tizen.NUI.PropertyMap Background
946 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
947 GetProperty(View.Property.BACKGROUND).Get(temp);
952 SetProperty(View.Property.BACKGROUND, new Tizen.NUI.PropertyValue(value));
957 /// The current state of the view.
964 if (GetProperty(View.Property.STATE).Get(ref temp) == false)
966 //Tizen.Log.Error("NUI", "State get error!");
972 return States.Normal;
976 return States.Focused;
980 return States.Disabled;
984 return States.Normal;
990 SetProperty(View.Property.STATE, new Tizen.NUI.PropertyValue((int)value));
995 /// The current sub state of the view.
997 public States SubState
1002 if (GetProperty(View.Property.SUB_STATE).Get(out temp) == false)
1004 //Tizen.Log.Error("NUI", "subState get error!");
1009 return States.Normal;
1011 return States.Focused;
1013 return States.Disabled;
1015 return States.Normal;
1020 string valueToString = "";
1025 valueToString = "NORMAL";
1028 case States.Focused:
1030 valueToString = "FOCUSED";
1033 case States.Disabled:
1035 valueToString = "DISABLED";
1040 valueToString = "NORMAL";
1044 SetProperty(View.Property.SUB_STATE, new Tizen.NUI.PropertyValue(valueToString));
1049 /// Displays a tooltip
1051 public Tizen.NUI.PropertyMap Tooltip
1055 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
1056 GetProperty(View.Property.TOOLTIP).Get(temp);
1061 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
1066 /// Displays a tooltip as Text
1068 public string TooltipText
1072 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
1076 private int LeftFocusableActorId
1081 GetProperty(View.Property.LEFT_FOCUSABLE_ACTOR_ID).Get(ref temp);
1086 SetProperty(View.Property.LEFT_FOCUSABLE_ACTOR_ID, new Tizen.NUI.PropertyValue(value));
1090 private int RightFocusableActorId
1095 GetProperty(View.Property.RIGHT_FOCUSABLE_ACTOR_ID).Get(ref temp);
1100 SetProperty(View.Property.RIGHT_FOCUSABLE_ACTOR_ID, new Tizen.NUI.PropertyValue(value));
1104 private int UpFocusableActorId
1109 GetProperty(View.Property.UP_FOCUSABLE_ACTOR_ID).Get(ref temp);
1114 SetProperty(View.Property.UP_FOCUSABLE_ACTOR_ID, new Tizen.NUI.PropertyValue(value));
1118 private int DownFocusableActorId
1123 GetProperty(View.Property.DOWN_FOCUSABLE_ACTOR_ID).Get(ref temp);
1128 SetProperty(View.Property.DOWN_FOCUSABLE_ACTOR_ID, new Tizen.NUI.PropertyValue(value));
1133 /// Child Property of FlexContainer.<br>
1134 /// The proportion of the free space in the container the flex item will receive.<br>
1135 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br>
1142 GetProperty(FlexContainer.ChildProperty.FLEX).Get(ref temp);
1147 SetProperty(FlexContainer.ChildProperty.FLEX, new Tizen.NUI.PropertyValue(value));
1152 /// Child Property of FlexContainer.<br>
1153 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br>
1155 public int AlignSelf
1160 GetProperty(FlexContainer.ChildProperty.ALIGN_SELF).Get(ref temp);
1165 SetProperty(FlexContainer.ChildProperty.ALIGN_SELF, new Tizen.NUI.PropertyValue(value));
1170 /// Child Property of FlexContainer.<br>
1171 /// The space around the flex item.<br>
1173 public Vector4 FlexMargin
1177 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1178 GetProperty(FlexContainer.ChildProperty.FLEX_MARGIN).Get(temp);
1183 SetProperty(FlexContainer.ChildProperty.FLEX_MARGIN, new Tizen.NUI.PropertyValue(value));
1188 /// The top-left cell this child occupies, if not set, the first available cell is used
1190 public Vector2 CellIndex
1194 Vector2 temp = new Vector2(0.0f, 0.0f);
1195 GetProperty(TableView.ChildProperty.CELL_INDEX).Get(temp);
1200 SetProperty(TableView.ChildProperty.CELL_INDEX, new Tizen.NUI.PropertyValue(value));
1205 /// The number of rows this child occupies, if not set, default value is 1
1207 public float RowSpan
1212 GetProperty(TableView.ChildProperty.ROW_SPAN).Get(ref temp);
1217 SetProperty(TableView.ChildProperty.ROW_SPAN, new Tizen.NUI.PropertyValue(value));
1222 /// The number of columns this child occupies, if not set, default value is 1
1224 public float ColumnSpan
1229 GetProperty(TableView.ChildProperty.COLUMN_SPAN).Get(ref temp);
1234 SetProperty(TableView.ChildProperty.COLUMN_SPAN, new Tizen.NUI.PropertyValue(value));
1239 /// The horizontal alignment of this child inside the cells, if not set, default value is 'left'
1241 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
1246 if (GetProperty(TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT).Get(out temp) == false)
1248 //Tizen.Log.Error("NUI", "CellHorizontalAlignment get error!");
1254 return Tizen.NUI.HorizontalAlignmentType.Left;
1256 return Tizen.NUI.HorizontalAlignmentType.Center;
1258 return Tizen.NUI.HorizontalAlignmentType.Right;
1260 return Tizen.NUI.HorizontalAlignmentType.Left;
1265 string valueToString = "";
1268 case Tizen.NUI.HorizontalAlignmentType.Left:
1270 valueToString = "left";
1273 case Tizen.NUI.HorizontalAlignmentType.Center:
1275 valueToString = "center";
1278 case Tizen.NUI.HorizontalAlignmentType.Right:
1280 valueToString = "right";
1285 valueToString = "left";
1289 SetProperty(TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
1294 /// The vertical alignment of this child inside the cells, if not set, default value is 'top'
1296 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
1301 GetProperty(TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT).Get(out temp);
1303 //Tizen.Log.Error("NUI", "CellVerticalAlignment get error!");
1309 return Tizen.NUI.VerticalAlignmentType.Top;
1311 return Tizen.NUI.VerticalAlignmentType.Center;
1313 return Tizen.NUI.VerticalAlignmentType.Bottom;
1315 return Tizen.NUI.VerticalAlignmentType.Top;
1320 string valueToString = "";
1323 case Tizen.NUI.VerticalAlignmentType.Top:
1325 valueToString = "top";
1328 case Tizen.NUI.VerticalAlignmentType.Center:
1330 valueToString = "center";
1333 case Tizen.NUI.VerticalAlignmentType.Bottom:
1335 valueToString = "bottom";
1340 valueToString = "top";
1344 SetProperty(TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
1349 /// The left focusable view.<br>
1350 /// This will return NULL if not set.<br>
1351 /// This will also return NULL if the specified left focusable view is not on stage.<br>
1353 public View LeftFocusableView
1355 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1358 if (LeftFocusableActorId >= 0)
1360 return ConvertIdToView((uint)LeftFocusableActorId);
1366 LeftFocusableActorId = (int)value.GetId();
1371 /// The right focusable view.<br>
1372 /// This will return NULL if not set.<br>
1373 /// This will also return NULL if the specified right focusable view is not on stage.<br>
1375 public View RightFocusableView
1377 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1380 if (RightFocusableActorId >= 0)
1382 return ConvertIdToView((uint)RightFocusableActorId);
1388 RightFocusableActorId = (int)value.GetId();
1393 /// The up focusable view.<br>
1394 /// This will return NULL if not set.<br>
1395 /// This will also return NULL if the specified up focusable view is not on stage.<br>
1397 public View UpFocusableView
1399 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1402 if (UpFocusableActorId >= 0)
1404 return ConvertIdToView((uint)UpFocusableActorId);
1410 UpFocusableActorId = (int)value.GetId();
1415 /// The down focusable view.<br>
1416 /// This will return NULL if not set.<br>
1417 /// This will also return NULL if the specified down focusable view is not on stage.<br>
1419 public View DownFocusableView
1421 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1424 if (DownFocusableActorId >= 0)
1426 return ConvertIdToView((uint)DownFocusableActorId);
1432 DownFocusableActorId = (int)value.GetId();
1437 /// whether the view should be focusable by keyboard navigation.
1439 public bool Focusable
1443 SetKeyboardFocusable(value);
1447 return IsKeyboardFocusable();
1452 /// Enumeration for describing the states of view.