2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.Diagnostics;
24 /// Enumeration for the Tooltip orientation.
26 /// <since_tizen> preview </since_tizen>
27 [Obsolete("This has been deprecated in API12")]
28 public enum TooltipOrientation
31 /// Default value. Tooltip moves with a mouse pointer.
36 /// Tooltip should appear to the top left of the parent.
41 /// Tooltip should appear to the left of the parent.
46 /// Tooltip should appear to the top right of the parent.
51 /// Tooltip should appear to the left of the parent.
56 /// Tooltip should appear to the center of the parent.
61 /// Tooltip should appear to the right of the parent.
66 /// Tooltip should appear to the bottom left of the parent.
71 /// Tooltip should appear to the bottom of the parent.
76 /// Tooltip should appear to the bottom right of the parent.
82 /// Enumeration for the aspect control.
84 /// <since_tizen> preview </since_tizen>
85 [Obsolete("This has been deprecated in API12")]
86 public enum AspectControl
89 /// Preference on the scaling unset.
94 /// Same effect as the unset preference on the scaling.
99 /// Use all horizontal container space to place an object using the given aspect.
104 /// Use all vertical container space to place an object using the given aspect.
109 /// Use all horizontal @b and vertical container spaces to place an object (never growing it out of those bounds), using the given aspect.
115 /// How the object should be rendered to output.
117 /// <since_tizen> 5 </since_tizen>
118 [Obsolete("This has been deprecated in API12")]
122 /// default op: d = d * (1 - sa) + s
127 /// d = d*(1 - sa) + s*da
162 /// d = d*s + d*(1 - sa) + s*(1 - da)
167 /// d = d*(1 - sa + s)
183 /// The EvasObject is a base class for other widget classes.
185 /// <since_tizen> preview </since_tizen>
186 [Obsolete("This has been deprecated in API12")]
187 public abstract class EvasObject
189 private IntPtr _realHandle = IntPtr.Zero;
190 private EvasCanvas _evasCanvas;
191 private string _automationId;
193 private event EventHandler _backButtonPressed;
195 private event EventHandler _moreButtonPressed;
197 private Interop.Eext.EextEventCallback _backButtonHandler;
198 private Interop.Eext.EextEventCallback _moreButtonHandler;
200 private static Dictionary<IntPtr, EvasObject> s_handleTable = new Dictionary<IntPtr, EvasObject>();
203 /// Sets or gets the handle for EvasObject.
205 /// <since_tizen> preview </since_tizen>
206 [Obsolete("This has been deprecated in API12")]
207 public IntPtr Handle { get; protected set; }
210 /// Gets the parent object for EvasObject.
212 /// <since_tizen> preview </since_tizen>
213 [Obsolete("This has been deprecated in API12")]
214 public EvasObject Parent { get; private set; }
217 /// Sets or gets the real handle for EvasObject.
219 /// <since_tizen> preview </since_tizen>
220 [Obsolete("This has been deprecated in API12")]
221 public IntPtr RealHandle
225 return _realHandle == IntPtr.Zero ? Handle : _realHandle;
230 Interop.Evas.evas_object_show(_realHandle);
234 EvasObjectEvent _deleted;
235 EvasObjectEvent<EvasKeyEventArgs> _keyup;
236 EvasObjectEvent<EvasKeyEventArgs> _keydown;
237 EvasObjectEvent _moved;
238 EvasObjectEvent _resized;
239 EvasObjectEvent _shown;
240 EvasObjectEvent _hidden;
241 EventHandler _renderPost;
242 Interop.Evas.EvasCallback _renderPostCallback = null;
243 Interop.Elementary.Elm_Tooltip_Content_Cb _tooltipContentCallback = null;
245 GetTooltipContentDelegate _tooltipContentDelegate = null;
247 readonly HashSet<IInvalidatable> _eventStore = new HashSet<IInvalidatable>();
250 /// Creates and initializes a new instance of the EvasObject class with the parent EvasObject class parameter.
252 /// <param name="parent">Parent EvasObject class.</param>
253 /// <since_tizen> preview </since_tizen>
254 [Obsolete("This has been deprecated in API12")]
255 protected EvasObject(EvasObject parent) : this()
257 Debug.Assert(parent == null || parent.IsRealized);
262 /// Creates and initializes a new instance of the EvasObject class.
264 /// <since_tizen> preview </since_tizen>
265 [Obsolete("This has been deprecated in API12")]
266 protected EvasObject()
268 _backButtonHandler = new Interop.Eext.EextEventCallback((d, o, i) => { _backButtonPressed?.Invoke(this, EventArgs.Empty); });
269 _moreButtonHandler = new Interop.Eext.EextEventCallback((d, o, i) => { _moreButtonPressed?.Invoke(this, EventArgs.Empty); });
273 _tooltipContentCallback = (d, o, t) =>
275 return _tooltipContentDelegate?.Invoke();
279 // C# Finalizer was called on GC thread
280 // So, We can't access to EFL object
281 // And When Finalizer was called, Field can be already released.
288 /// Deleted will be triggered when the widght is deleted.
290 /// <since_tizen> preview </since_tizen>
291 [Obsolete("This has been deprecated in API12")]
292 public event EventHandler Deleted;
295 /// KeyUp will be triggered when the key is loose.
297 /// <since_tizen> preview </since_tizen>
298 [Obsolete("This has been deprecated in API12")]
299 public event EventHandler<EvasKeyEventArgs> KeyUp
301 add { _keyup.On += value; }
302 remove { _keyup.On -= value; }
306 /// KeyDown will be triggered when the key is pressed down.
308 /// <since_tizen> preview </since_tizen>
309 [Obsolete("This has been deprecated in API12")]
310 public event EventHandler<EvasKeyEventArgs> KeyDown
312 add { _keydown.On += value; }
313 remove { _keydown.On -= value; }
317 /// BackButtonPressed will be triggered when the Back button is pressed.
319 /// <since_tizen> preview </since_tizen>
320 [Obsolete("This has been deprecated in API12")]
321 public event EventHandler BackButtonPressed
325 if (_backButtonPressed == null)
327 Interop.Eext.eext_object_event_callback_add(RealHandle, Interop.Eext.EextCallbackType.EEXT_CALLBACK_BACK, _backButtonHandler, IntPtr.Zero);
329 _backButtonPressed += value;
333 _backButtonPressed -= value;
334 if (_backButtonPressed == null)
336 Interop.Eext.eext_object_event_callback_del(RealHandle, Interop.Eext.EextCallbackType.EEXT_CALLBACK_BACK, _backButtonHandler);
342 /// MoreButtonPressed will be triggered when the More button is pressed.
344 /// <since_tizen> preview </since_tizen>
345 [Obsolete("This has been deprecated in API12")]
346 public event EventHandler MoreButtonPressed
350 if (_moreButtonPressed == null)
352 Interop.Eext.eext_object_event_callback_add(RealHandle, Interop.Eext.EextCallbackType.EEXT_CALLBACK_MORE, _moreButtonHandler, IntPtr.Zero);
354 _moreButtonPressed += value;
358 _moreButtonPressed -= value;
359 if (_moreButtonPressed == null)
361 Interop.Eext.eext_object_event_callback_del(RealHandle, Interop.Eext.EextCallbackType.EEXT_CALLBACK_MORE, _moreButtonHandler);
367 /// Moved will be triggered when the widght is moved.
369 /// <since_tizen> preview </since_tizen>
370 [Obsolete("This has been deprecated in API12")]
371 public event EventHandler Moved
373 add { _moved.On += value; }
374 remove { _moved.On -= value; }
378 /// Resized Event Handler of the current widget's size.
380 /// <since_tizen> preview </since_tizen>
381 [Obsolete("This has been deprecated in API12")]
382 public event EventHandler Resized
384 add { _resized.On += value; }
385 remove { _resized.On -= value; }
389 /// Shown will be triggered when the widget is shown.
391 /// <since_tizen> preview </since_tizen>
392 [Obsolete("This has been deprecated in API12")]
393 public event EventHandler Shown
395 add { _shown.On += value; }
396 remove { _shown.On -= value; }
400 /// Hidden will be triggered when the widget is hidden.
402 /// <since_tizen> preview </since_tizen>
403 [Obsolete("This has been deprecated in API12")]
404 public event EventHandler Hidden
406 add { _hidden.On += value; }
407 remove { _hidden.On -= value; }
411 /// RenderPost Event Handler of the current widget.
413 /// <since_tizen> preview </since_tizen>
414 [Obsolete("This has been deprecated in API12")]
415 public event EventHandler RenderPost
419 _renderPost += value;
420 if (_renderPostCallback == null)
422 _renderPostCallback = new Interop.Evas.EvasCallback((o, e, d) => _renderPost?.Invoke(this, EventArgs.Empty));
423 Interop.Evas.evas_event_callback_add(Interop.Evas.evas_object_evas_get(RealHandle), Interop.Evas.ObjectCallbackType.RenderPost, _renderPostCallback, IntPtr.Zero);
428 _renderPost -= value;
429 if (_renderPost == null)
431 Interop.Evas.evas_event_callback_del(Interop.Evas.evas_object_evas_get(RealHandle), Interop.Evas.ObjectCallbackType.RenderPost, _renderPostCallback);
432 _renderPostCallback = null;
438 /// Called when a widget's tooltip is activated and needs content.
440 /// <returns></returns>
441 /// <since_tizen> preview </since_tizen>
442 [Obsolete("This has been deprecated in API12")]
443 public delegate EvasObject GetTooltipContentDelegate();
446 /// Gets a widget's status of realized or not.
448 /// <since_tizen> preview </since_tizen>
449 [Obsolete("This has been deprecated in API12")]
450 public bool IsRealized { get { return Handle != IntPtr.Zero; } }
455 /// <since_tizen> preview </since_tizen>
456 [Obsolete("This has been deprecated in API12")]
457 public EvasCanvas EvasCanvas
461 if (_evasCanvas == null)
462 _evasCanvas = new EvasCanvas(Handle);
468 /// Sets of gets a value that allow the automation framework to find and interact with this object.
470 /// <since_tizen> preview </since_tizen>
471 [Obsolete("This has been deprecated in API12")]
472 public string AutomationId
476 return _automationId;
480 if (_automationId != null)
481 throw new InvalidOperationException("AutomationId may only be set one time.");
482 _automationId = value;
487 /// Gets the current class's Name.
489 /// <since_tizen> preview </since_tizen>
490 [Obsolete("This has been deprecated in API12")]
491 public string ClassName
495 return Interop.Eo.efl_class_name_get(Interop.Eo.efl_class_get(RealHandle));
500 /// Sets or gets the horizontal pointer hints for an object's weight.
502 /// <since_tizen> preview </since_tizen>
503 [Obsolete("This has been deprecated in API12")]
504 public double WeightX
508 return Interop.Evas.GetWeightX(Handle);
512 Interop.Evas.SetWeightX(Handle, value);
517 /// Sets or gets the vertical pointer hints for an object's weight.
519 /// <since_tizen> preview </since_tizen>
520 [Obsolete("This has been deprecated in API12")]
521 public double WeightY
525 return Interop.Evas.GetWeightY(Handle);
529 Interop.Evas.SetWeightY(Handle, value);
534 /// Sets or gets the horizontal alignment hint of an object's alignment.
536 /// <since_tizen> preview </since_tizen>
537 [Obsolete("This has been deprecated in API12")]
538 public virtual double AlignmentX
542 return Interop.Evas.GetAlignX(Handle);
546 Interop.Evas.SetAlignX(Handle, value);
551 /// Sets or gets the vertical alignment hint of an object's alignment.
553 /// <since_tizen> preview </since_tizen>
554 [Obsolete("This has been deprecated in API12")]
555 public virtual double AlignmentY
559 return Interop.Evas.GetAlignY(Handle);
563 Interop.Evas.SetAlignY(Handle, value);
568 /// Sets or gets the width hints for an object's minimum size.
570 /// <since_tizen> preview </since_tizen>
571 [Obsolete("This has been deprecated in API12")]
572 public int MinimumWidth
577 Interop.Evas.evas_object_size_hint_min_get(RealHandle, out w, out h);
582 int h = MinimumHeight;
583 Interop.Evas.evas_object_size_hint_min_set(RealHandle, value, h);
588 /// Sets or gets the height hints for an object's minimum size.
590 /// <since_tizen> preview </since_tizen>
591 [Obsolete("This has been deprecated in API12")]
592 public int MinimumHeight
597 Interop.Evas.evas_object_size_hint_min_get(RealHandle, out w, out h);
602 int w = MinimumWidth;
603 Interop.Evas.evas_object_size_hint_min_set(RealHandle, w, value);
608 /// Gets the visible state of the given Evas object.
610 /// <since_tizen> preview </since_tizen>
611 [Obsolete("This has been deprecated in API12")]
612 public bool IsVisible
616 return Interop.Evas.evas_object_visible_get(Handle);
621 /// Sets or gets the position and (rectangular) size of the given Evas object.
623 /// <since_tizen> preview </since_tizen>
624 [Obsolete("This has been deprecated in API12")]
630 Interop.Evas.evas_object_geometry_get(Handle, out x, out y, out w, out h);
631 Rect rect = new Rect(x, y, w, h);
636 Interop.Evas.evas_object_geometry_set(Handle, value.X, value.Y, value.Width, value.Height);
641 /// Sets or gets the general or main color of the given Evas object.
643 /// <since_tizen> preview </since_tizen>
644 [Obsolete("This has been deprecated in API12")]
645 public virtual Color Color
650 Interop.Evas.evas_object_color_get(RealHandle, out r, out g, out b, out a);
651 return Color.FromRgba(r, g, b, a);
655 Interop.Evas.SetPremultipliedColor(RealHandle, value.R, value.G, value.B, value.A);
660 /// Sets or gets the map enabled state.
662 /// <since_tizen> preview </since_tizen>
663 [Obsolete("This has been deprecated in API12")]
664 public bool IsMapEnabled
668 return Interop.Evas.evas_object_map_enable_get(Handle);
672 Interop.Evas.evas_object_map_enable_set(Handle, value);
677 /// Sets or gets the current object's transformation map.
679 /// <since_tizen> preview </since_tizen>
680 [Obsolete("This has been deprecated in API12")]
681 public EvasMap EvasMap
685 IntPtr evasMap = Interop.Evas.evas_object_map_get(Handle);
686 return new EvasMap(evasMap);
690 Interop.Evas.evas_object_map_set(Handle, value.Handle);
695 /// Sets or gets whether an object is to repeat events.
697 /// <since_tizen> preview </since_tizen>
698 [Obsolete("This has been deprecated in API12")]
699 public bool RepeatEvents
703 var result = Interop.Evas.evas_object_repeat_events_get(Handle);
704 Debug.Assert(Handle == RealHandle || result == Interop.Evas.evas_object_repeat_events_get(RealHandle));
709 if (Handle != RealHandle)
711 Interop.Evas.evas_object_repeat_events_set(RealHandle, value);
713 Interop.Evas.evas_object_repeat_events_set(Handle, value);
718 /// Sets or gets whether events on a smart object's member should get propagated up to its parent.
720 /// <since_tizen> preview </since_tizen>
721 [Obsolete("This has been deprecated in API12")]
722 public bool PropagateEvents
726 var result = Interop.Evas.evas_object_propagate_events_get(Handle);
727 Debug.Assert(Handle == RealHandle || result == Interop.Evas.evas_object_propagate_events_get(RealHandle));
732 if (Handle != RealHandle)
734 Interop.Evas.evas_object_propagate_events_set(RealHandle, value);
736 Interop.Evas.evas_object_propagate_events_set(Handle, value);
741 /// Sets or gets whether an object is set to pass (ignore) events.
743 /// <since_tizen> preview </since_tizen>
744 [Obsolete("This has been deprecated in API12")]
745 public bool PassEvents
749 var result = Interop.Evas.evas_object_pass_events_get(Handle);
750 Debug.Assert(Handle == RealHandle || result == Interop.Evas.evas_object_pass_events_get(RealHandle));
755 if (Handle != RealHandle)
757 Interop.Evas.evas_object_pass_events_set(RealHandle, value);
759 Interop.Evas.evas_object_pass_events_set(Handle, value);
764 /// Sets or gets the style for this object tooltip.
766 /// <since_tizen> preview </since_tizen>
767 [Obsolete("This has been deprecated in API12")]
768 public string TooltipStyle
772 return Interop.Elementary.elm_object_tooltip_style_get(RealHandle);
776 Interop.Elementary.elm_object_tooltip_style_set(RealHandle, value);
781 /// Sets or gets the orientation of tooltip.
783 /// <since_tizen> preview </since_tizen>
784 [Obsolete("This has been deprecated in API12")]
785 public TooltipOrientation TooltipOrientation
789 return (TooltipOrientation)Interop.Elementary.elm_object_tooltip_orient_get(RealHandle);
793 Interop.Elementary.elm_object_tooltip_orient_set(RealHandle, (int)value);
798 /// Sets or gets size restriction state of an object's tooltip.
800 /// <since_tizen> preview </since_tizen>
801 [Obsolete("This has been deprecated in API12")]
802 public bool TooltipWindowMode
806 return Interop.Elementary.elm_object_tooltip_window_mode_get(RealHandle);
810 Interop.Elementary.elm_object_tooltip_window_mode_set(RealHandle, value);
815 /// Sets the content to be shown in the tooltip object.
817 /// <since_tizen> preview </since_tizen>
818 [Obsolete("This has been deprecated in API12")]
819 public GetTooltipContentDelegate TooltipContentDelegate
823 return _tooltipContentDelegate;
827 _tooltipContentDelegate = value;
830 Interop.Elementary.elm_object_tooltip_content_cb_set(RealHandle, _tooltipContentCallback, IntPtr.Zero, null);
834 Interop.Elementary.elm_object_tooltip_content_cb_set(RealHandle, null, IntPtr.Zero, null);
840 /// Gets the movement freeze by 1.
841 /// This gets the movement freeze count by one.
843 /// <since_tizen> preview </since_tizen>
844 [Obsolete("This has been deprecated in API12")]
845 public int TooltipMoveFreezeCount
849 return Interop.Elementary.elm_object_tooltip_move_freeze_get(RealHandle);
854 /// Sets or gets whether an Evas object is to freeze (discard) events.
856 /// <since_tizen> preview </since_tizen>
857 [Obsolete("This has been deprecated in API12")]
858 public bool AllEventsFrozen
862 var result = Interop.Evas.evas_object_freeze_events_get(Handle);
863 Debug.Assert(Handle == RealHandle || result == Interop.Evas.evas_object_freeze_events_get(RealHandle));
868 if (Handle != RealHandle)
870 Interop.Evas.evas_object_freeze_events_set(RealHandle, value);
872 Interop.Evas.evas_object_freeze_events_set(Handle, value);
877 /// Sets or gets the layer of its canvas that the given object will be part of.
879 /// <since_tizen> preview </since_tizen>
880 [Obsolete("This has been deprecated in API12")]
881 public virtual int Layer
885 return Interop.Evas.evas_object_layer_get(Handle);
889 Interop.Evas.evas_object_layer_set(Handle, value);
894 /// Sets or gets the render operation to be used for rendering the Evas object.
896 /// <since_tizen> 5 </since_tizen>
897 [Obsolete("This has been deprecated in API12")]
898 public RenderOp RenderOperation
902 return (RenderOp)Interop.Evas.evas_object_render_op_get(RealHandle);
906 Interop.Evas.evas_object_render_op_set(RealHandle, (Interop.Evas.RenderOp)value);
912 /// Clips one object to another.
914 /// <param name="clip">The object to clip object by.</param>
915 /// <since_tizen> preview </since_tizen>
916 [Obsolete("This has been deprecated in API12")]
917 public void SetClip(EvasObject clip)
919 Interop.Evas.evas_object_clip_set(Handle, clip);
923 /// Sets the hints for an object's alignment.
925 /// <param name="x">The horizontal alignment hint as double value ranging from 0.0 to 1.0. The default alignment hint value is 0.5.</param>
926 /// <param name="y">The vertical alignment hint as double value ranging from 0.0 to 1.0. The default alignment hint value is 0.5.</param>
927 /// <since_tizen> preview </since_tizen>
928 [Obsolete("This has been deprecated in API12")]
929 public void SetAlignment(double x, double y)
931 Interop.Evas.evas_object_size_hint_align_set(Handle, x, y);
935 /// Sets the hints for an object's weight.
937 /// <param name="x">The non-negative double value to be used as horizontal weight hint.</param>
938 /// <param name="y">The non-negative double value to be used as vertical weight hint.</param>
939 /// <since_tizen> preview </since_tizen>
940 [Obsolete("This has been deprecated in API12")]
941 public void SetWeight(double x, double y)
943 Interop.Evas.evas_object_size_hint_weight_set(Handle, x, y);
947 /// Sets the text for an object's tooltip.
949 /// <param name="text">The text value to display inside the tooltip.</param>
950 /// <since_tizen> preview </since_tizen>
951 [Obsolete("This has been deprecated in API12")]
952 public void SetTooltipText(string text)
954 Interop.Elementary.elm_object_tooltip_text_set(RealHandle, text);
958 /// Unsets an object's tooltip.
960 /// <since_tizen> preview </since_tizen>
961 [Obsolete("This has been deprecated in API12")]
962 public void UnsetTooltip()
964 Interop.Elementary.elm_object_tooltip_unset(RealHandle);
968 /// This increments the tooltip movement freeze count by one.
969 /// If the count is more than 0, the tooltip position will be fixed.
971 /// <since_tizen> preview </since_tizen>
972 [Obsolete("This has been deprecated in API12")]
973 public void PushTooltipMoveFreeze()
975 Interop.Elementary.elm_object_tooltip_move_freeze_push(RealHandle);
979 /// This decrements the tooltip freeze count by one.
981 /// <since_tizen> preview </since_tizen>
982 [Obsolete("This has been deprecated in API12")]
983 public void PopTooltipMoveFreeze()
985 Interop.Elementary.elm_object_tooltip_move_freeze_pop(RealHandle);
989 /// Force hide the tooltip of the object.
991 /// <since_tizen> preview </since_tizen>
992 [Obsolete("This has been deprecated in API12")]
993 public void HideTooltip()
995 Interop.Elementary.elm_object_tooltip_hide(RealHandle);
999 /// Force show the tooltip of the object.
1001 /// <since_tizen> preview </since_tizen>
1002 [Obsolete("This has been deprecated in API12")]
1003 public void ShowTooltip()
1005 Interop.Elementary.elm_object_tooltip_show(RealHandle);
1009 /// Makes the current object visible.
1011 /// <since_tizen> preview </since_tizen>
1012 [Obsolete("This has been deprecated in API12")]
1015 Interop.Evas.evas_object_show(Handle);
1019 /// Makes the current object invisible.
1021 /// <since_tizen> preview </since_tizen>
1022 [Obsolete("This has been deprecated in API12")]
1025 Interop.Evas.evas_object_hide(Handle);
1029 /// Changes the size of the current object.
1031 /// <param name="w">The new width.</param>
1032 /// <param name="h">The new height.</param>
1033 /// <since_tizen> preview </since_tizen>
1034 [Obsolete("This has been deprecated in API12")]
1035 public void Resize(int w, int h)
1037 Interop.Evas.evas_object_resize(Handle, w, h);
1041 /// Moves the current object to the given location.
1043 /// <param name="x">The X position to move the object.</param>
1044 /// <param name="y">The Y position to move the object.</param>
1045 /// <since_tizen> preview </since_tizen>
1046 [Obsolete("This has been deprecated in API12")]
1047 public void Move(int x, int y)
1049 Interop.Evas.evas_object_move(Handle, x, y);
1053 /// Lowers the object to the bottom of its layer.
1055 /// <since_tizen> preview </since_tizen>
1056 [Obsolete("This has been deprecated in API12")]
1059 Interop.Evas.evas_object_lower(Handle);
1063 /// Define the IntPtr operator.
1065 /// <param name="obj">Parent object.</param>
1066 /// <since_tizen> preview </since_tizen>
1067 [Obsolete("This has been deprecated in API12")]
1068 public static implicit operator IntPtr(EvasObject obj)
1076 /// Define cast to EvasObject operator from IntPtr
1078 /// <param name="handle">Native handle to EvasObject</param>
1079 /// <since_tizen> preview </since_tizen>
1080 [Obsolete("This has been deprecated in API12")]
1081 public static explicit operator EvasObject(IntPtr handle) => EvasObject.s_handleTable.TryGetValue(handle, out EvasObject obj) ? obj : null;
1084 /// Requests the keyname key events to be directed to the current object.
1086 /// <param name="keyname">The key to request events for.</param>
1087 /// <param name="exclusive">Set TRUE to request that the obj is the only object receiving the keyname events, otherwise set to FALSE.</param>
1088 /// <returns>If the call succeeds then true, otherwise false.</returns>
1089 /// <since_tizen> preview </since_tizen>
1090 [Obsolete("This has been deprecated in API12")]
1091 public bool KeyGrab(string keyname, bool exclusive)
1093 return Interop.Evas.evas_object_key_grab(Handle, keyname, 0, 0, exclusive);
1097 /// Removes the grab on the keyname key events.
1099 /// <param name="keyname">The key the grab is set for.</param>
1100 /// <since_tizen> preview </since_tizen>
1101 [Obsolete("This has been deprecated in API12")]
1102 public void KeyUngrab(string keyname)
1104 Interop.Evas.evas_object_key_ungrab(Handle, keyname, 0, 0);
1108 /// Marks the smart object as changed.
1110 /// <since_tizen> preview </since_tizen>
1111 [Obsolete("This has been deprecated in API12")]
1112 public void MarkChanged()
1114 Interop.Evas.evas_object_smart_changed(RealHandle);
1118 /// Calls the calculate smart function immediately.
1119 /// This will force immediate calculations needed for renderization of this object.
1121 /// <since_tizen> preview </since_tizen>
1122 [Obsolete("This has been deprecated in API12")]
1123 public void Calculate()
1125 Interop.Evas.evas_object_smart_calculate(RealHandle);
1129 /// Sets the hints for an object's aspect ratio.
1131 /// <param name="aspect">The policy or type of aspect ratio to apply to an object.</param>
1132 /// <param name="w">The integer to be used as aspect width ratio term.</param>
1133 /// <param name="h">The integer to be used as aspect height ratio term.</param>
1134 /// <since_tizen> preview </since_tizen>
1135 [Obsolete("This has been deprecated in API12")]
1136 public void SetSizeHintAspect(AspectControl aspect, int w, int h)
1138 Interop.Evas.evas_object_size_hint_aspect_set(Handle, (int)aspect, w, h);
1142 /// Gets the hints for an object's aspect ratio.
1144 /// <param name="aspect">The policy or type of aspect ratio to apply to an object.</param>
1145 /// <param name="w">The integer to be used as aspect width ratio term.</param>
1146 /// <param name="h">The integer to be used as aspect height ratio term.</param>
1147 /// <since_tizen> preview </since_tizen>
1148 [Obsolete("This has been deprecated in API12")]
1149 public void GetSizeHintAspect(out AspectControl aspect, out int w, out int h)
1152 Interop.Evas.evas_object_size_hint_aspect_get(Handle, out aspectRatio, out w, out h);
1153 aspect = (AspectControl)aspectRatio;
1157 /// Stacks immediately below anchor.
1159 /// <param name="anchor">The object below which to stack.</param>
1160 /// <since_tizen> preview </since_tizen>
1161 [Obsolete("This has been deprecated in API12")]
1162 public void StackBelow(EvasObject anchor)
1164 Interop.Evas.evas_object_stack_below(Handle, anchor);
1168 /// Stacks immediately above anchor.
1170 /// <param name="anchor">The object above which to stack.</param>
1171 /// <since_tizen> preview </since_tizen>
1172 [Obsolete("This has been deprecated in API12")]
1173 public void StackAbove(EvasObject anchor)
1175 Interop.Evas.evas_object_stack_above(Handle, anchor);
1179 /// Raises to the top of its layer.
1181 /// <since_tizen> preview </since_tizen>
1182 [Obsolete("This has been deprecated in API12")]
1183 public void RaiseTop()
1185 Interop.Evas.evas_object_raise(Handle);
1189 /// Gets the geometry of a line number.
1191 /// <param name="lineNumber">The line number.</param>
1192 /// <param name="x">x coordinate of the line.</param>
1193 /// <param name="y">y coordinate of the line.</param>
1194 /// <param name="w">w coordinate of the line.</param>
1195 /// <param name="h">h coordinate of the line.</param>
1196 /// <returns>True on success, or False on error.</returns>
1197 /// <since_tizen> preview </since_tizen>
1198 [Obsolete("GetTextBlockGeometryByLineNumber is obsolete as of version 5.0.0.14299 and is no longer supported.")]
1199 public bool GetTextBlockGeometryByLineNumber(int lineNumber, out int x, out int y, out int w, out int h)
1201 x = -1; y = -1; w = -1; h = -1;
1203 IntPtr _edjeHandle = Interop.Elementary.elm_layout_edje_get(RealHandle);
1204 if (_edjeHandle == IntPtr.Zero)
1209 IntPtr _textblock = Interop.Elementary.edje_object_part_object_get(_edjeHandle, "elm.text");
1210 if (_textblock == IntPtr.Zero)
1215 return Interop.Evas.evas_object_textblock_line_number_geometry_get(_textblock, lineNumber, out x, out y, out w, out h);
1218 internal IntPtr GetData(string key)
1220 return Interop.Evas.evas_object_data_get(RealHandle, key);
1223 internal void SetData(string key, IntPtr data)
1225 Interop.Evas.evas_object_data_set(RealHandle, key, data);
1228 internal IntPtr DeleteData(string key)
1230 return Interop.Evas.evas_object_data_del(RealHandle, key);
1234 /// The callback of the Invalidate Event.
1236 /// <since_tizen> preview </since_tizen>
1237 [Obsolete("This has been deprecated in API12")]
1238 protected virtual void OnInvalidate()
1243 /// The callback of the Instantiated Event.
1245 /// <since_tizen> preview </since_tizen>
1246 [Obsolete("This has been deprecated in API12")]
1247 protected virtual void OnInstantiated()
1252 /// The callback of the Realized Event.
1254 /// <since_tizen> preview </since_tizen>
1255 [Obsolete("This has been deprecated in API12")]
1256 protected virtual void OnRealized()
1261 /// The callback of the Unrealize Event.
1263 /// <since_tizen> preview </since_tizen>
1264 [Obsolete("This has been deprecated in API12")]
1265 protected virtual void OnUnrealize()
1270 /// Creates a widget handle.
1272 /// <param name="parent">Parent EvasObject.</param>
1273 /// <returns>Handle IntPtr.</returns>
1274 /// <since_tizen> preview </since_tizen>
1275 [Obsolete("This has been deprecated in API12")]
1276 protected abstract IntPtr CreateHandle(EvasObject parent);
1279 /// For this object bind Parent object.Init handle and all kinds of EvasObjectEvent.
1281 /// <param name="parent">Parent object.</param>
1282 /// <since_tizen> preview </since_tizen>
1283 [Obsolete("This has been deprecated in API12")]
1284 public void Realize(EvasObject parent)
1289 Handle = CreateHandle(parent);
1290 Debug.Assert(Handle != IntPtr.Zero);
1292 s_handleTable[Handle] = this;
1294 (parent as Window)?.AddChild(this);
1297 _deleted = new EvasObjectEvent(this, EvasObjectCallbackType.Del);
1298 _keydown = new EvasObjectEvent<EvasKeyEventArgs>(this, RealHandle, EvasObjectCallbackType.KeyDown, EvasKeyEventArgs.Create);
1299 _keyup = new EvasObjectEvent<EvasKeyEventArgs>(this, RealHandle, EvasObjectCallbackType.KeyUp, EvasKeyEventArgs.Create);
1300 _moved = new EvasObjectEvent(this, EvasObjectCallbackType.Move);
1301 _resized = new EvasObjectEvent(this, EvasObjectCallbackType.Resize);
1302 _shown = new EvasObjectEvent(this, EvasObjectCallbackType.Show);
1303 _hidden = new EvasObjectEvent(this, EvasObjectCallbackType.Hide);
1305 _deleted.On += (s, e) => MakeInvalidate();
1306 _shown.On += (s, e) => Elementary.SendEvasObjectRealized(this);
1311 /// Removes the current object relationship with others.
1313 /// <since_tizen> preview </since_tizen>
1314 [Obsolete("This has been deprecated in API12")]
1315 public void Unrealize()
1319 if (_renderPostCallback != null)
1321 Interop.Evas.evas_event_callback_del(Interop.Evas.evas_object_evas_get(Handle), Interop.Evas.ObjectCallbackType.RenderPost, _renderPostCallback);
1322 _renderPostCallback = null;
1326 IntPtr toBeDeleted = Handle;
1327 Handle = IntPtr.Zero;
1331 (Parent as Window)?.RemoveChild(this);
1333 Interop.Evas.evas_object_del(toBeDeleted);
1334 Deleted?.Invoke(this, EventArgs.Empty);
1336 s_handleTable.Remove(toBeDeleted);
1340 private void MakeInvalidate()
1342 Deleted?.Invoke(this, EventArgs.Empty);
1344 IntPtr toBeDeleted = Handle;
1345 Handle = IntPtr.Zero;
1347 MakeInvalidateEvent();
1349 (Parent as Window)?.RemoveChild(this);
1353 s_handleTable.Remove(toBeDeleted);
1356 private void DisposeEvent()
1358 var events = new List<IInvalidatable>(_eventStore);
1359 foreach (var evt in events)
1363 _eventStore.Clear();
1366 private void MakeInvalidateEvent()
1368 foreach (var evt in _eventStore)
1370 evt.MakeInvalidate();
1372 _eventStore.Clear();
1375 internal void AddToEventLifeTracker(IInvalidatable item)
1377 _eventStore.Add(item);
1380 internal void RemoveFromEventLifeTracker(IInvalidatable item)
1382 _eventStore.Remove(item);