diff options
author | an87.li <an87.li@samsung.com> | 2017-03-20 06:42:12 +0800 |
---|---|---|
committer | an87.li <an87.li@samsung.com> | 2017-03-21 08:02:41 +0800 |
commit | 262194c9ab4206f26fc26767fad03cc510f82cd8 (patch) | |
tree | b63a9ee96d775196fb50397e6073a53acc058f75 | |
parent | 41580f9a2e7991ffd92184547bc2ab0aba42e88f (diff) | |
download | elm-sharp-262194c9ab4206f26fc26767fad03cc510f82cd8.tar.gz elm-sharp-262194c9ab4206f26fc26767fad03cc510f82cd8.tar.bz2 elm-sharp-262194c9ab4206f26fc26767fad03cc510f82cd8.zip |
Add comments for ElmSharp APIs.
1. Includes EcoreAnimator/EcoreMainloop/EcoreSynchronizationContext/Spinner/Table/Toolbar/ToolbarItem/Widget/Window
Change-Id: If9e7fe5c19454208def4457985ff70e57881a1b3
Signed-off-by: an87.li <an87.li@samsung.com>
-rwxr-xr-x[-rw-r--r--] | ElmSharp/ElmSharp/EcoreAnimator.cs | 16 | ||||
-rwxr-xr-x[-rw-r--r--] | ElmSharp/ElmSharp/EcoreMainloop.cs | 35 | ||||
-rwxr-xr-x[-rw-r--r--] | ElmSharp/ElmSharp/EcoreSynchronizationContext.cs | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | ElmSharp/ElmSharp/Spinner.cs | 65 | ||||
-rwxr-xr-x[-rw-r--r--] | ElmSharp/ElmSharp/Table.cs | 46 | ||||
-rwxr-xr-x[-rw-r--r--] | ElmSharp/ElmSharp/Toolbar.cs | 135 | ||||
-rwxr-xr-x[-rw-r--r--] | ElmSharp/ElmSharp/ToolbarItem.cs | 34 | ||||
-rwxr-xr-x[-rw-r--r--] | ElmSharp/ElmSharp/Widget.cs | 133 | ||||
-rwxr-xr-x | ElmSharp/ElmSharp/Window.cs | 42 |
9 files changed, 503 insertions, 6 deletions
diff --git a/ElmSharp/ElmSharp/EcoreAnimator.cs b/ElmSharp/ElmSharp/EcoreAnimator.cs index 200155f..a6b7992 100644..100755 --- a/ElmSharp/ElmSharp/EcoreAnimator.cs +++ b/ElmSharp/ElmSharp/EcoreAnimator.cs @@ -19,6 +19,9 @@ using System.Collections.Generic; namespace ElmSharp { + /// <summary> + /// EcoreAnimator is a helper class, it provides functions to manager animations. + /// </summary> public static class EcoreAnimator { static readonly Dictionary<int, Func<bool>> _taskMap = new Dictionary<int, Func<bool>>(); @@ -32,17 +35,30 @@ namespace ElmSharp _nativeHandler = NativeHandler; } + /// <summary> + /// Gets current system time as a floating point value in seconds. + /// </summary> + /// <returns>Current system time</returns> public static double GetCurrentTime() { return Interop.Ecore.ecore_time_get(); } + /// <summary> + /// Adds an animator to call <paramref name="handler"/> at every animation tick during main loop execution. + /// </summary> + /// <param name="handler">The function to call when it ticks off</param> + /// <returns>A handle to the new animator</returns> public static IntPtr AddAmimator(Func<bool> handler) { int id = RegistHandler(handler); return Interop.Ecore.ecore_animator_add(_nativeHandler, (IntPtr)id); } + /// <summary> + /// Removes the specified animator from the animator list. + /// </summary> + /// <param name="anim">The specified animator handle</param> public static void RemoveAnimator(IntPtr anim) { int taskId = (int)Interop.Ecore.ecore_animator_del(anim); diff --git a/ElmSharp/ElmSharp/EcoreMainloop.cs b/ElmSharp/ElmSharp/EcoreMainloop.cs index 4834c75..0e880c0 100644..100755 --- a/ElmSharp/ElmSharp/EcoreMainloop.cs +++ b/ElmSharp/ElmSharp/EcoreMainloop.cs @@ -19,6 +19,9 @@ using System.Collections.Generic; namespace ElmSharp { + /// <summary> + /// EcoreMainloop is a helper class, it provide functions relative Ecore's main loop. + /// </summary> public static class EcoreMainloop { static readonly Dictionary<int, Func<bool>> _taskMap = new Dictionary<int, Func<bool>>(); @@ -34,42 +37,74 @@ namespace ElmSharp _nativeHandler = NativeHandler; } + /// <summary> + /// Checks if you are calling this function from the main thread. + /// </summary> + /// <remarks>True is the calling function is the same thread, false otherwise.</remarks> public static bool IsMainThread => Interop.Eina.eina_main_loop_is(); + /// <summary> + /// Runs the application main loop. + /// </summary> public static void Begin() { Interop.Ecore.ecore_main_loop_begin(); } + /// <summary> + /// Quits the main loop once all the events currently on the queue have been processed. + /// </summary> public static void Quit() { Interop.Ecore.ecore_main_loop_quit(); } + /// <summary> + /// Adds an idler handler. + /// </summary> + /// <param name="task">The action to call when idling</param> public static void Post(Action task) { int id = RegistHandler(() => { task(); return false; }); Interop.Ecore.ecore_idler_add(_nativeHandler, (IntPtr)id); } + /// <summary> + /// Calls callback asynchronously in the main loop. + /// </summary> + /// <param name="task">The action wanted to be called</param> public static void PostAndWakeUp(Action task) { int id = RegistHandler(() => { task(); return false; }); Interop.Ecore.ecore_main_loop_thread_safe_call_async(_nativeHandler, (IntPtr)id); } + /// <summary> + /// Calls callback synchronously in the main loop. + /// </summary> + /// <param name="task">The action wanted to be called</param> public static void Send(Action task) { int id = RegistHandler(() => { task(); return false; }); Interop.Ecore.ecore_main_loop_thread_safe_call_sync(_nativeHandler, (IntPtr)id); } + /// <summary> + /// Creates a timer to call the given function in the given period of time. + /// </summary> + /// <param name="interval">The interval in seconds.</param> + /// <param name="handler">The given function.</param> + /// <returns>A timer object handler on success, NULL on failure.</returns> public static IntPtr AddTimer(double interval, Func<bool> handler) { int id = RegistHandler(handler); return Interop.Ecore.ecore_timer_add(interval, _nativeHandler, (IntPtr)id); } + /// <summary> + /// Removes the specified timer from the timer list. + /// </summary> + /// <param name="id">The specified timer handler</param> public static void RemoveTimer(IntPtr id) { int taskId = (int)Interop.Ecore.ecore_timer_del(id); diff --git a/ElmSharp/ElmSharp/EcoreSynchronizationContext.cs b/ElmSharp/ElmSharp/EcoreSynchronizationContext.cs index a7618c4..0fa013b 100644..100755 --- a/ElmSharp/ElmSharp/EcoreSynchronizationContext.cs +++ b/ElmSharp/ElmSharp/EcoreSynchronizationContext.cs @@ -50,8 +50,7 @@ namespace ElmSharp /// </summary> /// <param name="d"><see cref="System.Threading.SendOrPostCallback"/>The SendOrPostCallback delegate to call.</param> /// <param name="state"><see cref="System.Object"/>The object passed to the delegate.</param> - /// <remarks> - /// The Post method starts an asynchronous request to post a message.</remarks> + /// <remarks>The Post method starts an asynchronous request to post a message.</remarks> public override void Post(SendOrPostCallback d, object state) { EcoreMainloop.PostAndWakeUp(() => diff --git a/ElmSharp/ElmSharp/Spinner.cs b/ElmSharp/ElmSharp/Spinner.cs index cc852bf..e6a12e6 100644..100755 --- a/ElmSharp/ElmSharp/Spinner.cs +++ b/ElmSharp/ElmSharp/Spinner.cs @@ -18,6 +18,10 @@ using System; namespace ElmSharp { + /// <summary> + /// The Spinner is a widget that increase or decrease numeric values using arrow buttons, or edit values directly. + /// Inherits <see cref="Layout"/>. + /// </summary> public class Spinner : Layout { double _minimum = 0.0; @@ -26,6 +30,10 @@ namespace ElmSharp SmartEvent _changed; SmartEvent _delayedChanged; + /// <summary> + /// Creates and initializes a new instance of the Spinner class. + /// </summary> + /// <param name="parent">The parent of new Spinner instance</param> public Spinner(EvasObject parent) : base(parent) { _changed = new SmartEvent(this, this.RealHandle, "changed"); @@ -35,10 +43,19 @@ namespace ElmSharp _delayedChanged.On += (s, e) => DelayedValueChanged?.Invoke(this, EventArgs.Empty); } + /// <summary> + /// ValueChanged will be triggered whenever the spinner value is changed. + /// </summary> public event EventHandler ValueChanged; + /// <summary> + /// DelayedValueChanged will be triggered after a short time when the value is changed. + /// </summary> public event EventHandler DelayedValueChanged; + /// <summary> + /// Sets or gets the label format of the spinner. + /// </summary> public string LabelFormat { get @@ -51,6 +68,9 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the minimum value for the spinner. + /// </summary> public double Minimum { get @@ -64,6 +84,9 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the maximum value for the spinner. + /// </summary> public double Maximum { get @@ -77,6 +100,9 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the step that used to increment or decrement the spinner value. + /// </summary> public double Step { get @@ -89,6 +115,9 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the value displayed by the spinner. + /// </summary> public double Value { get @@ -101,6 +130,9 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the interval on time updates for an user mouse button hold on spinner widgets' arrows. + /// </summary> public double Interval { get @@ -113,6 +145,9 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the base for rounding. + /// </summary> public double RoundBase { get @@ -125,6 +160,9 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the round value for rounding. + /// </summary> public int RoundValue { get @@ -137,6 +175,14 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the wrap of a given spinner widget. + /// </summary> + /// <remarks> + /// If wrap is disabled, when the user tries to increment the value, but displayed value plus step value is bigger than maximum value, the new value will be the maximum value. + /// If wrap is enabled, when the user tries to increment the value, but displayed value plus step value is bigger than maximum value, the new value will be the minimum value. + /// By default it's disabled. + /// </remarks> public bool IsWrapEnabled { get @@ -149,6 +195,10 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets whether the spinner can be directly edited by the user or not. + /// </summary> + /// <remarks>By default it is enabled</remarks> public bool IsEditable { get @@ -161,17 +211,30 @@ namespace ElmSharp } } - + /// <summary> + /// Set a special string to display in the place of the numerical value. + /// </summary> + /// <param name="value">The numerical value to be replaced</param> + /// <param name="label">The label to be used</param> public void AddSpecialValue(double value, string label) { Interop.Elementary.elm_spinner_special_value_add(RealHandle, value, label); } + /// <summary> + /// Remove a previously added special value, After this, the spinner will display the value itself instead of a label. + /// </summary> + /// <param name="value">The replaced numerical value</param> public void RemoveSpecialValue(double value) { Interop.Elementary.elm_spinner_special_value_del(RealHandle, value); } + /// <summary> + /// Get the special string display in the place of the numerical value. + /// </summary> + /// <param name="value">The replaced numerical value.</param> + /// <returns>The value of the spinner which replaced numerical value with special string</returns> public string GetSpecialValue(double value) { return Interop.Elementary.elm_spinner_special_value_get(RealHandle, value); diff --git a/ElmSharp/ElmSharp/Table.cs b/ElmSharp/ElmSharp/Table.cs index 5e14162..707a34b 100644..100755 --- a/ElmSharp/ElmSharp/Table.cs +++ b/ElmSharp/ElmSharp/Table.cs @@ -18,15 +18,29 @@ using System; namespace ElmSharp { + /// <summary> + /// The Table is a container widget to arrange other widgets in a table where items can span multiple columns or rows . + /// Inherits <see cref="Container"/>. + /// </summary> public class Table : Container { int _paddingX = 0; int _paddingY = 0; + /// <summary> + /// Creates and initializes a new instance of the Table class. + /// </summary> + /// <param name="parent"> + /// A <see cref="EvasObject"/> to which the new Table instance will be attached. + /// </param> public Table(EvasObject parent) : base(parent) { } + /// <summary> + /// Sets or gets whether the layout of this table is homogeneous. + /// </summary> + /// <remarks>True for homogeneous, False for no homogeneous</remarks> public bool Homogeneous { get @@ -39,6 +53,9 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the horizontal padding between the cells. + /// </summary> public int PaddingX { get @@ -52,6 +69,9 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the vertical padding between the cells. + /// </summary> public int PaddingY { get @@ -64,7 +84,14 @@ namespace ElmSharp Interop.Elementary.elm_table_padding_set(RealHandle, _paddingX, _paddingY); } } - + /// <summary> + /// Adds a subobject on the table with the coordinates passed. + /// </summary> + /// <param name="obj">The subobject to be added to the table</param> + /// <param name="col">The column number</param> + /// <param name="row">The row number</param> + /// <param name="colspan">The column span</param> + /// <param name="rowspan">The row span</param> public void Pack(EvasObject obj, int col, int row, int colspan, int rowspan) { if (obj == null) @@ -73,6 +100,10 @@ namespace ElmSharp AddChild(obj); } + /// <summary> + /// Removes the child from the table. + /// </summary> + /// <param name="obj">The subobject</param> public void Unpack(EvasObject obj) { if (obj == null) @@ -81,12 +112,20 @@ namespace ElmSharp RemoveChild(obj); } + /// <summary> + /// Removes all child objects from a table object. + /// </summary> public void Clear() { Interop.Elementary.elm_table_clear(RealHandle, false); ClearChildren(); } + /// <summary> + /// Sets the color for particular part of the table. + /// </summary> + /// <param name="part">The name of part class</param> + /// <param name="color">The color</param> public override void SetPartColor(string part, Color color) { Interop.Elementary.elm_object_color_class_color_set(Handle, part, color.R * color.A / 255, @@ -95,6 +134,11 @@ namespace ElmSharp color.A); } + /// <summary> + /// Gets the color of particular part of the table. + /// </summary> + /// <param name="part">The name of part class, it could be 'bg', 'elm.swllow.content'</param> + /// <returns>The color of the particular part</returns> public override Color GetPartColor(string part) { int r, g, b, a; diff --git a/ElmSharp/ElmSharp/Toolbar.cs b/ElmSharp/ElmSharp/Toolbar.cs index b6424a5..63ebd93 100644..100755 --- a/ElmSharp/ElmSharp/Toolbar.cs +++ b/ElmSharp/ElmSharp/Toolbar.cs @@ -18,25 +18,74 @@ using System; namespace ElmSharp { + /// <summary> + /// Enumeration for the selection mode of Toolbar. + /// </summary> public enum ToolbarSelectionMode { + /// <summary> + /// Default select mode. + /// </summary> Default = 0, + + /// <summary> + /// Always select mode. + /// </summary> Always, + + /// <summary> + /// No select mode. + /// </summary> None, + + /// <summary> + /// No select mode with no finger size rule. + /// </summary> DisplayOnly, } + /// <summary> + /// Enumeration that sets the toolbar items display behavior, it can be scrollable, can show a menu with exceeding items, or simply hide them. + /// </summary> public enum ToolbarShrinkMode { + /// <summary> + /// Sets minimum toolbar size to fit all the items. + /// </summary> None = 0, + + /// <summary> + /// Hides exceeding items. + /// </summary> Hide, + + /// <summary> + /// Allows accessing exceeding items through a scroller. + /// </summary> Scroll, + + /// <summary> + /// Inserts a button to pop up a menu with exceeding items. + /// </summary> Menu, + + /// <summary> + /// Expands all items according to the size of the toolbar. + /// </summary> Expand } + /// <summary> + /// Event arguments for events of <see cref="ToolbarItem"/>. + /// </summary> + /// <remarks> + /// Inherits EventArgs. + /// </remarks> public class ToolbarItemEventArgs : EventArgs { + /// <summary> + /// Gets the ToolbarItem. + /// </summary> public ToolbarItem Item { get; private set; } internal static ToolbarItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info) @@ -46,11 +95,21 @@ namespace ElmSharp } } + /// <summary> + /// The Toolbar is a widget that displays a list of items inside a box. + /// </summary> public class Toolbar : Widget { SmartEvent<ToolbarItemEventArgs> _clicked; SmartEvent<ToolbarItemEventArgs> _selected; SmartEvent<ToolbarItemEventArgs> _longpressed; + + /// <summary> + /// Creates and initializes a new instance of the Toolbar class. + /// </summary> + /// <param name="parent"> + /// A EvasObject to which the new Table instance will be attached. + /// </param> public Toolbar(EvasObject parent) : base(parent) { _selected = new SmartEvent<ToolbarItemEventArgs>(this, this.RealHandle, "selected", ToolbarItemEventArgs.CreateFromSmartEvent); @@ -74,8 +133,15 @@ namespace ElmSharp }; } + /// <summary> + /// Selected will be triggered when toolbar have been selected. + /// </summary> public event EventHandler<ToolbarItemEventArgs> Selected; + /// <summary> + /// Sets or gets whether the layout of this toolbar is homogeneous. + /// </summary> + /// <remarks>True for homogeneous, False for no homogeneous</remarks> public bool Homogeneous { get @@ -88,6 +154,9 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the slection mode of a given Toolbar widget. + /// </summary> public ToolbarSelectionMode SelectionMode { get @@ -100,6 +169,9 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the shrink mode of a given Toolbar widget. + /// </summary> public ToolbarShrinkMode ShrinkMode { get @@ -112,6 +184,10 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the alignment of the items. + /// </summary> + /// <remarks>The toolbar items alignment, a float between 0.0 and 1.0</remarks> public double ItemAlignment { get @@ -124,6 +200,13 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the item's transverse expansion of a given toolbar widget. + /// </summary> + /// <remarks> + /// The transverse expansion of the item, true for on and false for off. + /// By default it's false. + /// </remarks> public bool TransverseExpansion { get @@ -136,10 +219,27 @@ namespace ElmSharp } } + /// <summary> + /// Appends ToolbarItem which just contains label to the toolbar. + /// </summary> + /// <param name="label">The label of the item</param> + /// <returns>The new ToolbarItem which appended to the toolbar</returns> + /// <seealso cref="Append(string, string)"/> + /// <seealso cref="Prepend(string)"/> public ToolbarItem Append(string label) { return Append(label, null); } + + /// <summary> + /// Appends ToolbarItem which contains label and icon to the toolbar. + /// </summary> + /// <param name="label">The label of the item</param> + /// <param name="icon">A string with the icon name or the absolute path of an image file</param> + /// <returns>The new ToolbarItem which appended to the toolbar</returns> + /// <seealso cref="Append(string)"/> + /// <seealso cref="Prepend(string)"/> + /// <seealso cref="Prepend(string, string)"/> public ToolbarItem Append(string label, string icon) { ToolbarItem item = new ToolbarItem(label, icon); @@ -147,11 +247,28 @@ namespace ElmSharp return item; } + /// <summary> + /// Prepends ToolbarItem which just contains label to the toolbar. + /// </summary> + /// <param name="label">The label of the item</param> + /// <returns>The new ToolbarItem which prepended to the toolbar</returns> + /// <seealso cref="Append(string)"/> + /// <seealso cref="Append(string, string)"/> + /// <seealso cref="Prepend(string, string)"/> public ToolbarItem Prepend(string label) { return Prepend(label, null); } + /// <summary> + /// Prepends ToolbarItem which contains label and icon to the toolbar. + /// </summary> + /// <param name="label">The label of the item</param> + /// <param name="icon">A string with the icon name or the absolute path of an image file</param> + /// <returns>The new <see cref="ToolbarItem"/> which prepended to the toolbar</returns> + /// <seealso cref="Append(string)"/> + /// <seealso cref="Append(string, string)"/> + /// <seealso cref="Prepend(string)"/> public ToolbarItem Prepend(string label, string icon) { ToolbarItem item = new ToolbarItem(label, icon); @@ -159,11 +276,26 @@ namespace ElmSharp return item; } + /// <summary> + /// Inserts a new item which just contains label into the toolbar object before item <paramref name="before"/>. + /// </summary> + /// <param name="before">The toolbar item to insert before</param> + /// <param name="label">The label of the item</param> + /// <returns>The new <see cref="ToolbarItem"/> which insert into the toolbar</returns> + /// <seealso cref="InsertBefore(ToolbarItem, string, string)"/> public ToolbarItem InsertBefore(ToolbarItem before, string label) { return InsertBefore(before, label); } + /// <summary> + /// Inserts a new item which contains label and icon into the toolbar object before item <paramref name="before"/>. + /// </summary> + /// <param name="before">The toolbar item to insert before</param> + /// <param name="label">The label of the item</param> + /// <param name="icon">A string with the icon name or the absolute path of an image file</param> + /// <returns>The new <see cref="ToolbarItem"/> which insert into the toolbar</returns> + /// <seealso cref="InsertBefore(ToolbarItem, string)"/> public ToolbarItem InsertBefore(ToolbarItem before, string label, string icon) { ToolbarItem item = new ToolbarItem(label, icon); @@ -171,6 +303,9 @@ namespace ElmSharp return item; } + /// <summary> + /// Gets the selected ToolbarItemItem of the toolbar. + /// </summary> public ToolbarItem SelectedItem { get diff --git a/ElmSharp/ElmSharp/ToolbarItem.cs b/ElmSharp/ElmSharp/ToolbarItem.cs index 72075dd..8cdc3be 100644..100755 --- a/ElmSharp/ElmSharp/ToolbarItem.cs +++ b/ElmSharp/ElmSharp/ToolbarItem.cs @@ -18,6 +18,9 @@ using System; namespace ElmSharp { + /// <summary> + /// The ToolbarItem is a item of Toolbar. + /// </summary> public class ToolbarItem : ItemObject { string _icon; @@ -28,6 +31,9 @@ namespace ElmSharp _icon = icon; } + /// <summary> + /// Sets or gets the icon path of the item. + /// </summary> public string Icon { get @@ -40,6 +46,10 @@ namespace ElmSharp Interop.Elementary.elm_toolbar_item_icon_set(Handle, value); } } + + /// <summary> + /// Sets or gets the text string of the item. + /// </summary> public string Text { get @@ -52,6 +62,10 @@ namespace ElmSharp SetPartText(null, value); } } + + /// <summary> + /// Sets or gets the enable of the item. + /// </summary> public bool Enabled { get @@ -63,6 +77,11 @@ namespace ElmSharp Interop.Elementary.elm_object_disabled_set(Handle, !value); } } + + /// <summary> + /// Sets or gets whether displaying the item as a separator. + /// </summary> + /// <remarks>Items aren't set as a separator by default. If set as a separator it displays a separator theme, so it won't display icons or labels.</remarks> public bool IsSeparator { get @@ -74,6 +93,10 @@ namespace ElmSharp Interop.Elementary.elm_toolbar_item_separator_set(Handle, value); } } + + /// <summary> + /// Sets or gets whether the item is selected. + /// </summary> public bool IsSelected { get @@ -86,8 +109,19 @@ namespace ElmSharp } } + /// <summary> + /// Selected will be triggered when the item is selected. + /// </summary> public event EventHandler Selected; + + /// <summary> + /// LongPressed will be triggered when the item is pressed long time. + /// </summary> public event EventHandler LongPressed; + + /// <summary> + /// Clicked will be triggered when the item is clicked. + /// </summary> public event EventHandler Clicked; internal void SendSelected() diff --git a/ElmSharp/ElmSharp/Widget.cs b/ElmSharp/ElmSharp/Widget.cs index 06df4db..f963191 100644..100755 --- a/ElmSharp/ElmSharp/Widget.cs +++ b/ElmSharp/ElmSharp/Widget.cs @@ -19,16 +19,41 @@ using System.Collections.Generic; namespace ElmSharp { + /// <summary> + /// Enumeration for the focus direction. + /// </summary> public enum FocusDirection { + /// <summary> + /// 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> Left } + /// <summary> + /// The Widget is abstract class, it is the parent of other widgets. + /// Inherits from <see cref="EvasObject"/>. + /// </summary> public abstract class Widget : EvasObject { Dictionary<string, EvasObject> _partContents = new Dictionary<string, EvasObject>(); @@ -43,6 +68,10 @@ namespace ElmSharp { } + /// <summary> + /// Creates and initializes a new instance of the Widget class. + /// </summary> + /// <param name="parent">The parent of new Widget instance</param> protected Widget(EvasObject parent) : base(parent) { _focused = new SmartEvent(this, "focused"); @@ -52,10 +81,19 @@ namespace ElmSharp _unfocused.On += (s, e) => Unfocused?.Invoke(this, EventArgs.Empty); } + /// <summary> + /// Focused will be triggered when the widget is focused. + /// </summary> public event EventHandler Focused; + /// <summary> + /// Unfocused will be triggered when the widget is unfocused. + /// </summary> public event EventHandler Unfocused; + /// <summary> + /// Sets or gets the state of the widget, which might be enabled or disabled. + /// </summary> public bool IsEnabled { get @@ -68,6 +106,9 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the style of the widget. + /// </summary> public string Style { get @@ -80,6 +121,9 @@ namespace ElmSharp } } + /// <summary> + /// Gets whether this widget is focused. + /// </summary> public bool IsFocused { get @@ -88,6 +132,10 @@ namespace ElmSharp } } + /// <summary> + /// Gets whether a widget is focusable or not. + /// </summary> + /// <remarks>Widgets which are meant to be interacted with by input events are created able to be focused, by default</remarks> public bool IsFocusAllowed { get @@ -96,6 +144,10 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the text of the widget. + /// </summary> + /// <remarks>It could be override by special child class</remarks> public virtual string Text { get @@ -108,6 +160,10 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the background color of the widget. + /// </summary> + /// <remarks>It could be override by special child class</remarks> public virtual Color BackgroundColor { get @@ -132,6 +188,10 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the opacity of the widget. + /// </summary> + /// <remarks>It could be override by special child class</remarks> public virtual int Opacity { get @@ -149,31 +209,61 @@ namespace ElmSharp } } + /// <summary> + /// Sets the widget to be focused or not. + /// </summary> + /// <param name="isFocus">Weather be focused</param> public void SetFocus(bool isFocus) { Interop.Elementary.elm_object_focus_set(RealHandle, isFocus); } + /// <summary> + /// Sets the ability for a widget to be focused. + /// </summary> + /// <param name="isAllowFocus">True if the object can be focused, false if not(and on errors)</param> public void AllowFocus(bool isAllowFocus) { Interop.Elementary.elm_object_focus_allow_set(RealHandle, isAllowFocus); } + /// <summary> + /// Gives focus to next widget in widget tree. + /// </summary> + /// <param name="direction">Direction to move the focus</param> public void FocusNext(FocusDirection direction) { Interop.Elementary.elm_object_focus_next(RealHandle, (int)direction); } + /// <summary> + /// Set next widget with specific focus direction. + /// </summary> + /// <param name="next">Focus next widget</param> + /// <param name="direction">Focus direction</param> public void SetNextFocusObject(EvasObject next, FocusDirection direction) { Interop.Elementary.elm_object_focus_next_object_set(RealHandle, next.RealHandle, (int)direction); } + /// <summary> + /// Sets content to particular part of the widget, and the preserve old content will not be unset. + /// </summary> + /// <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) { SetPartContent(part, content, false); } + /// <summary> + /// Sets content to particular part of the widget. + /// </summary> + /// <param name="part">The name of particular part</param> + /// <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) { if (preserveOldContent) @@ -185,11 +275,22 @@ namespace ElmSharp _partContents[part ?? "__default__"] = content; } + /// <summary> + /// Sets content to the widget, and the preserve old content will not be unset. + /// </summary> + /// <param name="content">The content</param> + /// <seealso cref="SetContent(EvasObject, bool)"/> public void SetContent(EvasObject content) { SetContent(content, false); } + /// <summary> + /// Sets content the widget. + /// </summary> + /// <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="SetContent(EvasObject)"/> public void SetContent(EvasObject content, bool preserveOldContent) { if (preserveOldContent) @@ -201,16 +302,32 @@ namespace ElmSharp _partContents["__default__"] = content; } + /// <summary> + /// Sets text to particular part of the widget. + /// </summary> + /// <param name="part">The name of particular part</param> + /// <param name="text">The text</param> public void SetPartText(string part, string text) { Interop.Elementary.elm_object_part_text_set(RealHandle, part, text); } + /// <summary> + /// Gets text of a particular part of the widget. + /// </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) { return Interop.Elementary.elm_object_part_text_get(RealHandle, part); } + /// <summary> + /// Sets color of a particular part of the widget. + /// </summary> + /// <param name="part">The name of particular part</param> + /// <param name="color">The color be set to widget</param> + /// <remarks>This method is a virtual method, it could be override by special child class</remarks> public virtual void SetPartColor(string part, Color color) { Interop.Elementary.elm_object_color_class_color_set(RealHandle, part, color.R * color.A / 255, @@ -219,6 +336,12 @@ namespace ElmSharp color.A); } + /// <summary> + /// Gets color of the particular part of the widget. + /// </summary> + /// <param name="part">The name of particular part</param> + /// <returns>The color of the particular part</returns> + /// <remarks>This method is a virtual method, it could be override by special child class</remarks> public virtual Color GetPartColor(string part) { int r, g, b, a; @@ -226,11 +349,21 @@ namespace ElmSharp return new Color((int)(r / (a / 255.0)), (int)(g / (a / 255.0)), (int)(b / (a / 255.0)), a); } + /// <summary> + /// Sets opacity of the particular part of the widget. + /// </summary> + /// <param name="part">The name of particular part</param> + /// <param name="opacity">The opacity of the particular part</param> public void SetPartOpacity(string part, int opacity) { Interop.Elementary.elm_object_color_class_color_set(Handle, part, 255, 255, 255, opacity); } + /// <summary> + /// Gets opacity of the particular part of the widget. + /// </summary> + /// <param name="part">The name of particular part</param> + /// <returns>Opacity value of the particular part</returns> public int GetPartOpacity(string part) { int r, g, b, a; diff --git a/ElmSharp/ElmSharp/Window.cs b/ElmSharp/ElmSharp/Window.cs index 6c71fcf..3dd0532 100755 --- a/ElmSharp/ElmSharp/Window.cs +++ b/ElmSharp/ElmSharp/Window.cs @@ -19,12 +19,27 @@ using System.Collections.Generic; namespace ElmSharp { + /// <summary> + /// Enumeration for the display rotation of window. + /// </summary> [Flags] public enum DisplayRotation { + /// <summary> + /// Rotation value of window is 0 degree + /// </summary> Degree_0 = 1, + /// <summary> + /// Rotation value of window is 90 degree + /// </summary> Degree_90 = 2, + /// <summary> + /// Rotation value of window is 180 degree + /// </summary> Degree_180 = 4, + /// <summary> + /// Rotation value of window is 270 degree + /// </summary> Degree_270 = 8 }; @@ -152,7 +167,7 @@ namespace ElmSharp } /// <summary> - /// Sets or gets value whether rotation is supported. + /// Gets whether window manager supports window rotation or not. /// </summary> public bool IsRotationSupported { @@ -206,6 +221,13 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the alpha channel state of a window. + /// </summary> + /// <remarks> + /// True if the window alpha channel is enabled, false otherwise. + /// If alpha is true, the alpha channel of the canvas will be enabled possibly making parts of the window completely or partially transparent. + /// </remarks> public bool Alpha { get @@ -218,6 +240,12 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the role of the window. + /// </summary> + /// <remarks> + /// The Role will be invalid if a new role is set or if the window is destroyed. + /// </remarks> public string Role { get @@ -230,6 +258,9 @@ namespace ElmSharp } } + /// <summary> + /// Sets or gets the mode of status bar. + /// </summary> public StatusBarMode StatusBarMode { get @@ -273,11 +304,19 @@ namespace ElmSharp } + /// <summary> + /// Set the keygrab of the window. + /// </summary> + /// <param name="keyname">keyname string to set keygrab</param> public void KeyGrabEx(string keyname) { Interop.Elementary.eext_win_keygrab_set(RealHandle, keyname); } + /// <summary> + /// Unset the keygrab of the window. + /// </summary> + /// <param name="keyname">keyname string to unset keygrab</param> public void KeyUngrabEx(string keyname) { Interop.Elementary.eext_win_keygrab_unset(RealHandle, keyname); @@ -299,7 +338,6 @@ namespace ElmSharp _referenceHolder.Remove(obj); } - /// </return> static int[] ConvertDegreeArray(DisplayRotation value) { List<int> rotations = new List<int>(); |