From 1b6110231dab304e0657a627a42cd0372b490e0e Mon Sep 17 00:00:00 2001 From: Seunghyun Choi Date: Fri, 16 Jun 2017 10:55:08 +0900 Subject: [PATCH] Enhance EvasObject and Widget Change-Id: I7546fb163d364d0d06270ee741602ddead26b21a --- src/ElmSharp/ElmSharp/EvasObject.cs | 118 +++++++++++++++++++++++++++++++++++ src/ElmSharp/ElmSharp/Widget.cs | 46 ++++++++++++++ src/ElmSharp/Interop/Interop.Evas.cs | 17 ++--- 3 files changed, 168 insertions(+), 13 deletions(-) mode change 100755 => 100644 src/ElmSharp/ElmSharp/Widget.cs diff --git a/src/ElmSharp/ElmSharp/EvasObject.cs b/src/ElmSharp/ElmSharp/EvasObject.cs index 5bc3f7c..9236ba6 100644 --- a/src/ElmSharp/ElmSharp/EvasObject.cs +++ b/src/ElmSharp/ElmSharp/EvasObject.cs @@ -34,6 +34,15 @@ namespace ElmSharp BottomRight, } + public enum AspectControl + { + None = 0, /* Preference on scaling unset */ + Neither = 1, /* Same effect as unset preference on scaling */ + Horizontal = 2, /* Use all horizontal container space to place an object, using the given aspect */ + Vertical = 3, /* Use all vertical container space to place an object, using the given aspect */ + Both = 4 /* Use all horizontal @b and vertical container spaces to place an object (never growing it out of those bounds), using the given aspect */ + } + /// /// The EcasObject is a base class for other widget class /// @@ -535,6 +544,36 @@ namespace ElmSharp } /// + /// Sets or gets whether an Evas object is to freeze (discard) events. + /// + public bool AllEventsFrozen + { + get + { + return Interop.Evas.evas_object_freeze_events_get(RealHandle); + } + set + { + Interop.Evas.evas_object_freeze_events_set(RealHandle, value); + } + } + + /// + /// Sets or gets the layer of its canvas that the given object will be part of. + /// + public int Layer + { + get + { + return Interop.Evas.evas_object_layer_get(Handle); + } + set + { + Interop.Evas.evas_object_layer_set(Handle, value); + } + } + + /// /// Clips one object to another. /// /// The object to clip object by @@ -697,6 +736,85 @@ namespace ElmSharp } /// + /// Sets the hints for an object's aspect ratio. + /// + /// The policy or type of aspect ratio to apply to object + /// The integer to use as aspect width ratio term + /// The integer to use as aspect height ratio term + public void SetSizeHintAspect(AspectControl aspect, int w, int h) + { + Interop.Evas.evas_object_size_hint_aspect_set(Handle, (int)aspect, w, h); + } + + /// + /// Gets the hints for an object's aspect ratio. + /// + /// The policy or type of aspect ratio to apply to object + /// The integer to use as aspect width ratio term + /// The integer to use as aspect height ratio term + public void GetSizeHintAspect(out AspectControl aspect, out int w, out int h) + { + int aspectRatio; + Interop.Evas.evas_object_size_hint_aspect_get(Handle, out aspectRatio, out w, out h); + aspect = (AspectControl)aspectRatio; + } + + /// + /// Stack immediately below anchor. + /// + /// The object below which to stack. + public void StackBelow(EvasObject anchor) + { + Interop.Evas.evas_object_stack_below(Handle, anchor); + } + + /// + /// Stack immediately above anchor. + /// + /// The object above which to stack. + public void StackAbove(EvasObject anchor) + { + Interop.Evas.evas_object_stack_above(Handle, anchor); + } + + /// + /// Raise to the top of its layer. + /// + public void RaiseTop() + { + Interop.Evas.evas_object_raise(Handle); + } + + /// + /// Get the geometry of a line number. + /// + /// the line number. + /// x coord of the line. + /// y coord of the line. + /// w coord of the line. + /// h coord of the line. + /// + public bool GetTextBlockGeometryByLineNumber(int lineNumber, out int x, out int y, out int w, out int h) + { + return Interop.Evas.evas_object_textblock_line_number_geometry_get(RealHandle, lineNumber, out x, out y, out w, out h); + } + + internal IntPtr GetData(string key) + { + return Interop.Evas.evas_object_data_get(RealHandle, key); + } + + internal void SetData(string key, IntPtr data) + { + Interop.Evas.evas_object_data_set(RealHandle, key, data); + } + + internal IntPtr DeleteData(string key) + { + return Interop.Evas.evas_object_data_del(RealHandle, key); + } + + /// /// The callback of Invalidate Event /// protected virtual void OnInvalidate() diff --git a/src/ElmSharp/ElmSharp/Widget.cs b/src/ElmSharp/ElmSharp/Widget.cs old mode 100755 new mode 100644 index daa5731..d18e047 --- a/src/ElmSharp/ElmSharp/Widget.cs +++ b/src/ElmSharp/ElmSharp/Widget.cs @@ -221,6 +221,52 @@ namespace ElmSharp } /// + /// Sets or gets whether a widget and its children are focusable or not. + /// + public bool AllowTreeFocus + { + get + { + return Interop.Elementary.elm_object_tree_focus_allow_get(RealHandle); + } + set + { + Interop.Elementary.elm_object_tree_focus_allow_set(RealHandle, value); + } + } + + /// + /// Sets or gets the widget's mirrored mode. + /// + public bool IsMirroredMode + { + get + { + return Interop.Elementary.elm_object_mirrored_get(RealHandle); + } + set + { + Interop.Elementary.elm_object_mirrored_set(RealHandle, value); + } + } + + /// + /// Sets or gets the widget's mirrored mode setting. + /// When widget set automatic mode(true), it follows the system mirrored mode. + /// + public bool IsAutoMirroredMode + { + get + { + return Interop.Elementary.elm_object_mirrored_automatic_get(RealHandle); + } + set + { + Interop.Elementary.elm_object_mirrored_automatic_set(RealHandle, value); + } + } + + /// /// Sets the widget to be focused or not. /// /// Weather be focused diff --git a/src/ElmSharp/Interop/Interop.Evas.cs b/src/ElmSharp/Interop/Interop.Evas.cs index ee5d3c8..a48c377 100644 --- a/src/ElmSharp/Interop/Interop.Evas.cs +++ b/src/ElmSharp/Interop/Interop.Evas.cs @@ -111,15 +111,6 @@ internal static partial class Interop Mul = 11 /* d = d*s */ } - public enum AspectControl - { - None = 0, /* Preference on scaling unset */ - Neither = 1, /* Same effect as unset preference on scaling */ - Horizontal = 2, /* Use all horizontal container space to place an object, using the given aspect */ - Vertical = 3, /* Use all vertical container space to place an object, using the given aspect */ - Both = 4 /* Use all horizontal @b and vertical container spaces to place an object (never growing it out of those bounds), using the given aspect */ - } - public enum ObjectCallbackPriority { After = 100, @@ -475,7 +466,7 @@ internal static partial class Interop internal static extern string evas_load_error_str(LoadError error); [DllImport(Libraries.Evas)] - internal static extern void evas_object_data_del(IntPtr obj, string key); + internal static extern IntPtr evas_object_data_del(IntPtr obj, string key); [DllImport(Libraries.Evas)] internal static extern void evas_object_focus_set(IntPtr obj, bool focus); @@ -541,7 +532,7 @@ internal static partial class Interop internal static extern void evas_object_render_op_set(IntPtr obj, RenderOp op); [DllImport(Libraries.Evas)] - internal static extern void evas_object_size_hint_aspect_set(IntPtr obj, AspectControl aspect, int w, int h); + internal static extern void evas_object_size_hint_aspect_set(IntPtr obj, int aspect, int w, int h); [DllImport(Libraries.Evas)] internal static extern IntPtr evas_object_smart_add(IntPtr obj, IntPtr smart); @@ -637,7 +628,7 @@ internal static partial class Interop internal static extern void evas_object_text_style_set(IntPtr obj, TextStyleType type); [DllImport(Libraries.Evas)] - internal static extern bool evas_object_textblock_line_number_geometry_get(IntPtr obj, int line, int x, int y, int w, int h); + internal static extern bool evas_object_textblock_line_number_geometry_get(IntPtr obj, int line, out int x, out int y, out int w, out int h); [DllImport(Libraries.Evas)] internal static extern void evas_object_textblock_valign_set(IntPtr obj, double align); @@ -688,7 +679,7 @@ internal static partial class Interop internal static extern void evas_object_stack_below(IntPtr obj, IntPtr below); [DllImport(Libraries.Evas)] - internal static extern void evas_object_size_hint_aspect_get(IntPtr obj, out AspectControl aspect, out int w, out int h); + internal static extern void evas_object_size_hint_aspect_get(IntPtr obj, out int aspect, out int w, out int h); internal static void SetX(IntPtr obj, int x) { -- 2.7.4