summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsung-su.kim <sung-su.kim@samsung.com>2017-06-05 18:54:59 +0900
committerSeungkeun Lee <sngn.lee@samsung.com>2017-06-14 23:07:39 +0000
commit20dbb669fc708380eb36a74bb99f181e91b4b4db (patch)
tree260b79d9daf272669879a126dd60846f7e1c872b
parent3735fbe1b7f9165d4bd185546997e61292ef016c (diff)
downloadelm-sharp-20dbb669fc708380eb36a74bb99f181e91b4b4db.tar.gz
elm-sharp-20dbb669fc708380eb36a74bb99f181e91b4b4db.tar.bz2
elm-sharp-20dbb669fc708380eb36a74bb99f181e91b4b4db.zip
Enhance Layout
Change-Id: Ice8b30935992e1f79a6a11aaf58950115e81d534
-rwxr-xr-x[-rw-r--r--]ElmSharp/ElmSharp/Container.cs6
-rw-r--r--[-rwxr-xr-x]ElmSharp/ElmSharp/Layout.cs202
-rwxr-xr-xElmSharp/ElmSharp/Widget.cs29
-rwxr-xr-xElmSharp/Interop/Interop.Elementary.cs111
4 files changed, 274 insertions, 74 deletions
diff --git a/ElmSharp/ElmSharp/Container.cs b/ElmSharp/ElmSharp/Container.cs
index f9e87c1..5701fe6 100644..100755
--- a/ElmSharp/ElmSharp/Container.cs
+++ b/ElmSharp/ElmSharp/Container.cs
@@ -57,18 +57,18 @@ namespace ElmSharp
}
}
- internal void AddChild(EvasObject obj)
+ protected void AddChild(EvasObject obj)
{
_children.Add(obj);
obj.Deleted += OnChildDeleted;
}
- internal void RemoveChild(EvasObject obj)
+ protected void RemoveChild(EvasObject obj)
{
_children.Remove(obj);
}
- internal void ClearChildren()
+ protected void ClearChildren()
{
_children.Clear();
}
diff --git a/ElmSharp/ElmSharp/Layout.cs b/ElmSharp/ElmSharp/Layout.cs
index 4c92402..217a0a3 100755..100644
--- a/ElmSharp/ElmSharp/Layout.cs
+++ b/ElmSharp/ElmSharp/Layout.cs
@@ -22,7 +22,7 @@ namespace ElmSharp
/// This is a container widget that takes a standard Edje design file and wraps it very thinly in a widget.
/// Inherits Widget
/// </summary>
- public class Layout : Widget
+ public class Layout : Container
{
SmartEvent _languageChanged;
SmartEvent _themeChanged;
@@ -72,6 +72,204 @@ namespace ElmSharp
}
/// <summary>
+ /// Gets or sets accessibility state of texblock(text) parts in the layout object.
+ /// </summary>
+ public bool TextBlockAccessibility
+ {
+ get
+ {
+ return Interop.Elementary.elm_layout_edje_object_can_access_get(RealHandle);
+ }
+ set
+ {
+ Interop.Elementary.elm_layout_edje_object_can_access_set(RealHandle, value);
+ }
+ }
+
+ /// <summary>
+ /// Freezes the Elementary layout object.
+ /// This function puts all changes on hold.
+ /// Successive freezes will nest, requiring an equal number of thaws.
+ /// </summary>
+ /// <returns>The frozen state or 0 if the object is not frozen or on error.</returns>
+ public int Freeze()
+ {
+ return Interop.Elementary.elm_layout_freeze(RealHandle);
+ }
+
+ /// <summary>
+ /// Thaws the Elementary object.
+ /// If sucessives freezes were done, an equal number of thaws will be required.
+ /// </summary>
+ /// <returns>The frozen state or 0 if the object is not frozen or on error.</returns>
+ public int Thaw()
+ {
+ return Interop.Elementary.elm_layout_thaw(RealHandle);
+ }
+
+ /// <summary>
+ /// Eval sizing.
+ /// Manually forces a sizing re-evaluation.
+ /// This is useful when the minimum size required by the edje theme of this layout has changed.
+ /// The change on the minimum size required by the edje theme is not immediately reported to the elementary layout, so one needs to call this function in order to tell the widget (layout) that it needs to reevaluate its own size.
+ /// The minimum size of the theme is calculated based on minimum size of parts, the size of elements inside containers like box and table, etc.
+ /// All of this can change due to state changes, and that's when this function should be called.
+ /// </summary>
+ public void Resizing()
+ {
+ Interop.Elementary.elm_layout_sizing_eval(RealHandle);
+ }
+
+ /// <summary>
+ /// Request sizing reevaluation, restricted to current width and/or height.
+ /// Useful mostly when there are TEXTBLOCK parts defining the height of the object and nothing else restricting it to a minimum width.Calling this function will restrict the minimum size in the Edje calculation to whatever size it the layout has at the moment.
+ /// </summary>
+ /// <param name="width">Restrict minimum size ot the current width.</param>
+ /// <param name="height">Restrict minimum size ot the current height.</param>
+ public void Resizing(bool width, bool height)
+ {
+ Interop.Elementary.elm_layout_sizing_restricted_eval(RealHandle, width, height);
+ }
+
+ /// <summary>
+ /// Get the edje data from the given layout.
+ /// This function fetches data specified inside the edje theme of this layout.
+ /// This function return NULL if data is not found.
+ /// </summary>
+ /// <param name="key">The data key</param>
+ /// <returns>The data</returns>
+ public string GetData(string key)
+ {
+ return Interop.Elementary.elm_layout_data_get(RealHandle, key);
+ }
+
+ /// <summary>
+ /// Gets the text set in the given part.
+ /// </summary>
+ /// <param name="part">The TEXT part to retrieve the text off.</param>
+ /// <returns></returns>
+ public override string GetPartText(string part)
+ {
+ return Interop.Elementary.elm_layout_text_get(RealHandle, part);
+ }
+
+ /// <summary>
+ /// Sets the text set in the given part.
+ /// </summary>
+ /// <param name="part">The TEXT part to retrieve the text off.</param>
+ /// <param name="text">The text to set.</param>
+ /// <returns></returns>
+ public override bool SetPartText(string part, string text)
+ {
+ return Interop.Elementary.elm_layout_text_set(RealHandle, part, text);
+ }
+
+ /// <summary>
+ /// Append child to layout box part.
+ /// Once the object is appended, it will become child of the layout.
+ /// Its lifetime will be bound to the layout, whenever the layout dies the child will be deleted automatically.
+ /// </summary>
+ /// <param name="part">The part</param>
+ /// <param name="child">The Object to append</param>
+ /// <returns>Sucess is true</returns>
+ public bool BoxAppend(string part, EvasObject child)
+ {
+ AddChild(child);
+ return Interop.Elementary.elm_layout_box_append(RealHandle, part, child.Handle);
+ }
+
+ /// <summary>
+ /// Prepend child to layout box part.
+ /// Once the object is prepended, it will become child of the layout.
+ /// Its lifetime will be bound to the layout, whenever the layout dies the child will be deleted automatically.
+ /// </summary>
+ /// <param name="part">The part</param>
+ /// <param name="child">The Object to prepend</param>
+ /// <returns>Sucess is true</returns>
+ public bool BoxPrepend(string part, EvasObject child)
+ {
+ AddChild(child);
+ return Interop.Elementary.elm_layout_box_prepend(RealHandle, part, child.Handle);
+ }
+
+ /// <summary>
+ /// Remove a child of the given part box.
+ /// The object will be removed from the box part and its lifetime will not be handled by the layout anymore.
+ /// </summary>
+ /// <param name="part">The part</param>
+ /// <param name="child">The Object to remove</param>
+ /// <returns>Sucess is true</returns>
+ public bool BoxRemove(string part, EvasObject child)
+ {
+ RemoveChild(child);
+ return Interop.Elementary.elm_layout_box_remove(RealHandle, part, child.Handle) != null;
+ }
+
+ /// <summary>
+ /// Remove all children of the given part box.
+ /// The objects will be removed from the box part and their lifetime will not be handled by the layout anymore.
+ /// </summary>
+ /// <param name="part">The part</param>
+ /// <param name="clear">If true, then all objects will be deleted as well, otherwise they will just be removed and will be dangling on the canvas.</param>
+ /// <returns>Sucess is true</returns>
+ public bool BoxRemoveAll(string part, bool clear)
+ {
+ ClearChildren();
+ return Interop.Elementary.elm_layout_box_remove_all(RealHandle, part, clear);
+ }
+
+ /// <summary>
+ /// Insert child to layout box part at a given position.
+ /// Once the object is inserted, it will become child of the layout.
+ /// Its lifetime will be bound to the layout, whenever the layout dies the child will be deleted automatically.
+ /// </summary>
+ /// <param name="part">The part</param>
+ /// <param name="child">The child object to insert into box.</param>
+ /// <param name="position">The numeric position >=0 to insert the child.</param>
+ /// <returns>Sucess is true</returns>
+ public bool BoxInsertAt(string part, EvasObject child, uint position)
+ {
+ AddChild(child);
+ return Interop.Elementary.elm_layout_box_insert_at(RealHandle, part, child.Handle, position);
+ }
+
+ /// <summary>
+ /// Insert child to layout box part before a reference object.
+ /// Once the object is inserted, it will become child of the layout.
+ /// Its lifetime will be bound to the layout, whenever the layout dies the child will be deleted automatically.
+ /// </summary>
+ /// <param name="part"></param>
+ /// <param name="child">The child object to insert into box.</param>
+ /// <param name="reference">Another reference object to insert before in box.</param>
+ /// <returns>Sucess is true</returns>
+ public bool BoxInsertBefore(string part, EvasObject child, EvasObject reference)
+ {
+ AddChild(child);
+ return Interop.Elementary.elm_layout_box_insert_before(RealHandle, part, child.Handle, reference.Handle);
+ }
+
+ /// <summary>
+ /// Sets the layout content.
+ /// </summary>
+ /// <param name="swallow">The swallow part name in the edje file</param>
+ /// <param name="content">The child that will be added in this layout object.</param>
+ /// <returns>TRUE on success, FALSE otherwise</returns>
+ public override bool SetPartContent(string part, EvasObject content)
+ {
+ return SetPartContent(part, content, false);
+ }
+
+ public override bool SetPartContent(string part, EvasObject content, bool preserveOldContent)
+ {
+ if (preserveOldContent)
+ {
+ Interop.Elementary.elm_layout_content_unset(RealHandle, part);
+ }
+ UpdatePartContents(content, part);
+ return Interop.Elementary.elm_layout_content_set(RealHandle, part, content);
+ }
+
+ /// <summary>
/// Sets the edje group from the elementary theme that is used as a layout.
/// </summary>
/// <param name="klass">The class of the group</param>
@@ -144,4 +342,4 @@ namespace ElmSharp
return Interop.Elementary.elm_layout_add(parent.Handle);
}
}
-}
+} \ No newline at end of file
diff --git a/ElmSharp/ElmSharp/Widget.cs b/ElmSharp/ElmSharp/Widget.cs
index ccd9ef4..daa5731 100755
--- a/ElmSharp/ElmSharp/Widget.cs
+++ b/ElmSharp/ElmSharp/Widget.cs
@@ -29,22 +29,27 @@ namespace ElmSharp
/// Previous direction
/// </summary>
Previous,
+
/// <summary>
/// Next direction
/// </summary>
Next,
+
/// <summary>
/// Up direction
/// </summary>
Up,
+
/// <summary>
/// Down direction
/// </summary>
Down,
+
/// <summary>
/// Right direction
/// </summary>
Right,
+
/// <summary>
/// Left direction
/// </summary>
@@ -82,6 +87,11 @@ namespace ElmSharp
_unfocused.On += (s, e) => Unfocused?.Invoke(this, EventArgs.Empty);
}
+ protected void UpdatePartContents(EvasObject content, string part = "__default__")
+ {
+ _partContents[part] = content;
+ }
+
/// <summary>
/// Focused will be triggered when the widget is focused.
/// </summary>
@@ -253,9 +263,9 @@ namespace ElmSharp
/// <param name="part">The name of particular part</param>
/// <param name="content">The content</param>
/// <seealso cref="SetPartContent(string, EvasObject, bool)"/>
- public void SetPartContent(string part, EvasObject content)
+ public virtual bool SetPartContent(string part, EvasObject content)
{
- SetPartContent(part, content, false);
+ return SetPartContent(part, content, false);
}
/// <summary>
@@ -265,15 +275,15 @@ namespace ElmSharp
/// <param name="content">The content</param>
/// <param name="preserveOldContent">true, preserve old content will be unset. false, preserve old content will not be unset.</param>
/// <seealso cref="SetPartContent(string, EvasObject)"/>
- public void SetPartContent(string part, EvasObject content, bool preserveOldContent)
+ public virtual bool SetPartContent(string part, EvasObject content, bool preserveOldContent)
{
if (preserveOldContent)
{
Interop.Elementary.elm_object_part_content_unset(RealHandle, part);
}
Interop.Elementary.elm_object_part_content_set(RealHandle, part, content);
-
- _partContents[part ?? "__default__"] = content;
+ UpdatePartContents(content, part);
+ return true;
}
/// <summary>
@@ -300,7 +310,7 @@ namespace ElmSharp
}
Interop.Elementary.elm_object_content_set(RealHandle, content);
- _partContents["__default__"] = content;
+ UpdatePartContents(content);
}
/// <summary>
@@ -308,9 +318,10 @@ namespace ElmSharp
/// </summary>
/// <param name="part">The name of particular part</param>
/// <param name="text">The text</param>
- public void SetPartText(string part, string text)
+ public virtual bool SetPartText(string part, string text)
{
Interop.Elementary.elm_object_part_text_set(RealHandle, part, text);
+ return true;
}
/// <summary>
@@ -318,7 +329,7 @@ namespace ElmSharp
/// </summary>
/// <param name="part">The name of particular part</param>
/// <returns>Text of the particular part of the widget</returns>
- public string GetPartText(string part)
+ public virtual string GetPartText(string part)
{
return Interop.Elementary.elm_object_part_text_get(RealHandle, part);
}
@@ -377,4 +388,4 @@ namespace ElmSharp
return Interop.Elementary.elm_object_part_content_get(RealHandle, part);
}
}
-}
+} \ No newline at end of file
diff --git a/ElmSharp/Interop/Interop.Elementary.cs b/ElmSharp/Interop/Interop.Elementary.cs
index 30e7bbb..c865f12 100755
--- a/ElmSharp/Interop/Interop.Elementary.cs
+++ b/ElmSharp/Interop/Interop.Elementary.cs
@@ -180,7 +180,7 @@ internal static partial class Interop
internal static extern void elm_object_tooltip_hide(IntPtr obj);
[DllImport(Libraries.Elementary)]
- internal static extern void elm_object_tooltip_orient_set(IntPtr obj, Elm_Tooltip_Orient orient);
+ internal static extern void elm_object_tooltip_orient_set(IntPtr obj, int orient);
internal static string elm_object_part_text_get(IntPtr obj, string part)
{
@@ -209,7 +209,7 @@ internal static partial class Interop
}
[DllImport(Libraries.Elementary)]
- internal static extern void elm_object_part_content_unset(IntPtr obj, string part);
+ internal static extern IntPtr elm_object_part_content_unset(IntPtr obj, string part);
internal static void elm_object_content_unset(IntPtr obj)
{
@@ -244,6 +244,9 @@ internal static partial class Interop
internal static extern bool elm_layout_theme_set(IntPtr obj, string klass, string group, string style);
[DllImport(Libraries.Elementary)]
+ internal static extern void elm_layout_file_get(IntPtr obj, IntPtr file, IntPtr group);
+
+ [DllImport(Libraries.Elementary)]
internal static extern bool elm_layout_file_set(IntPtr obj, string file, string group);
[DllImport(Libraries.Elementary)]
@@ -346,7 +349,7 @@ internal static partial class Interop
internal static extern bool elm_object_tree_focus_allow_get(IntPtr obj);
[DllImport(Libraries.Elementary)]
- internal static extern IntPtr elm_object_focus_next_object_get(IntPtr obj, Elm_Focus_Direction dir);
+ internal static extern IntPtr elm_object_focus_next_object_get(IntPtr obj, int dir);
[DllImport(Libraries.Elementary)]
internal static extern IntPtr elm_object_focused_object_get(IntPtr obj);
@@ -554,7 +557,7 @@ internal static partial class Interop
internal static extern void elm_transit_objects_final_state_keep_set(IntPtr transit, bool stateKeep);
[DllImport(Libraries.Elementary)]
- internal static extern void elm_transit_tween_mode_set(IntPtr transit, Elm_Transit_Tween_Mode tweenMode);
+ internal static extern void elm_transit_tween_mode_set(IntPtr transit, int tweenMode);
[DllImport(Libraries.Elementary)]
internal static extern void elm_transit_repeat_times_set(IntPtr transit, int repeat);
@@ -611,7 +614,7 @@ internal static partial class Interop
internal static extern int elm_transit_repeat_times_get(IntPtr transit);
[DllImport(Libraries.Elementary)]
- internal static extern Elm_Transit_Tween_Mode elm_transit_tween_mode_get(IntPtr transit);
+ internal static extern int elm_transit_tween_mode_get(IntPtr transit);
[DllImport(Libraries.Elementary)]
internal static extern void elm_transit_tween_mode_factor_set(IntPtr transit, double v1, double v2);
@@ -650,13 +653,13 @@ internal static partial class Interop
internal static extern bool elm_transit_smooth_get(IntPtr transit);
[DllImport(Libraries.Elementary)]
- internal static extern IntPtr elm_transit_effect_flip_add(IntPtr transit, Elm_Transit_Effect_Flip_Axis axis, bool cw);
+ internal static extern IntPtr elm_transit_effect_flip_add(IntPtr transit, int axis, bool cw);
[DllImport(Libraries.Elementary)]
- internal static extern IntPtr elm_transit_effect_resizable_flip_add(IntPtr transit, Elm_Transit_Effect_Flip_Axis axis, bool cw);
+ internal static extern IntPtr elm_transit_effect_resizable_flip_add(IntPtr transit, int axis, bool cw);
[DllImport(Libraries.Elementary)]
- internal static extern IntPtr elm_transit_effect_wipe_add(IntPtr transit, Elm_Transit_Effect_Wipe_Type type, Elm_Transit_Effect_Wipe_Dir dir);
+ internal static extern IntPtr elm_transit_effect_wipe_add(IntPtr transit, int type, int dir);
[DllImport(Libraries.Elementary)]
internal static extern IntPtr elm_transit_effect_blend_add(IntPtr transit);
@@ -679,61 +682,49 @@ internal static partial class Interop
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void Elm_Transit_Del_Cb(IntPtr data, IntPtr transit);
- internal enum Elm_Transit_Tween_Mode
- {
- ELM_TRANSIT_TWEEN_MODE_LINEAR,
- ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL,
- ELM_TRANSIT_TWEEN_MODE_DECELERATE,
- ELM_TRANSIT_TWEEN_MODE_ACCELERATE,
- ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP,
- ELM_TRANSIT_TWEEN_MODE_BOUNCE,
- ELM_TRANSIT_TWEEN_MODE_SPRING,
- ELM_TRANSIT_TWEEN_MODE_BEZIER_CURVE,
- }
+ [DllImport(Libraries.Elementary)]
+ internal static extern bool elm_layout_box_insert_at(IntPtr obj, string part, IntPtr child, uint pos);
- internal enum Elm_Transit_Effect_Flip_Axis
- {
- ELM_TRANSIT_EFFECT_FLIP_AXIS_X,
- ELM_TRANSIT_EFFECT_FLIP_AXIS_Y,
- }
+ [DllImport(Libraries.Elementary)]
+ internal static extern bool elm_layout_box_insert_before(IntPtr obj, string part, IntPtr child, IntPtr reference);
- internal enum Elm_Transit_Effect_Wipe_Type
- {
- ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE,
- ELM_TRANSIT_EFFECT_WIPE_TYPE_SHOW,
- }
+ [DllImport(Libraries.Elementary)]
+ internal static extern bool elm_layout_edje_object_can_access_get(IntPtr obj);
- internal enum Elm_Transit_Effect_Wipe_Dir
- {
- ELM_TRANSIT_EFFECT_WIPE_DIR_LEFT,
- ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT,
- ELM_TRANSIT_EFFECT_WIPE_DIR_UP,
- ELM_TRANSIT_EFFECT_WIPE_DIR_DOWN,
- }
+ [DllImport(Libraries.Elementary)]
+ internal static extern bool elm_layout_edje_object_can_access_set(IntPtr obj, bool canAccess);
- internal enum Elm_Focus_Direction
- {
- ELM_FOCUS_PREVIOUS,
- ELM_FOCUS_NEXT,
- ELM_FOCUS_UP,
- ELM_FOCUS_DOWN,
- ELM_FOCUS_RIGHT,
- ELM_FOCUS_LEFT,
- }
+ [DllImport(Libraries.Elementary)]
+ internal static extern int elm_layout_freeze(IntPtr obj);
- internal enum Elm_Tooltip_Orient
- {
- ELM_TOOLTIP_ORIENT_NONE,
- ELM_TOOLTIP_ORIENT_TOP_LEFT,
- ELM_TOOLTIP_ORIENT_TOP,
- ELM_TOOLTIP_ORIENT_TOP_RIGHT,
- ELM_TOOLTIP_ORIENT_LEFT,
- ELM_TOOLTIP_ORIENT_CENTER,
- ELM_TOOLTIP_ORIENT_RIGHT,
- ELM_TOOLTIP_ORIENT_BOTTOM_LEFT,
- ELM_TOOLTIP_ORIENT_BOTTOM,
- ELM_TOOLTIP_ORIENT_BOTTOM_RIGHT,
- ELM_TOOLTIP_ORIENT_LAST,
- }
+ [DllImport(Libraries.Elementary)]
+ internal static extern bool elm_layout_part_cursor_engine_only_get(IntPtr obj, string part);
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern bool elm_layout_part_cursor_engine_only_set(IntPtr obj, string part, bool engineOnly);
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern string elm_layout_part_cursor_get(IntPtr obj, string part);
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern bool elm_layout_part_cursor_set(IntPtr obj, string part, string cursor);
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern string elm_layout_part_cursor_style_get(IntPtr obj, string part);
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern bool elm_layout_part_cursor_style_set(IntPtr obj, string part, string style);
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern bool elm_layout_part_cursor_unset(IntPtr obj, string part);
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern void elm_layout_sizing_eval(IntPtr obj);
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern void elm_layout_sizing_restricted_eval(IntPtr obj, bool width, bool height);
+
+ [DllImport(Libraries.Elementary)]
+ internal static extern int elm_layout_thaw(IntPtr obj);
}
-} \ No newline at end of file
+}