[ElmSharp] Modify source file mode (#621)
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / List.cs
old mode 100755 (executable)
new mode 100644 (file)
index a8f2bc9..be147b7
@@ -20,14 +20,15 @@ using System.Collections.Generic;
 namespace ElmSharp
 {
     /// <summary>
-    /// Enumeration for setting list's resizing behavior, transverse axis scrolling and items cropping.
+    /// Enumeration for setting the list's resizing behavior, transverse axis scrolling, and items cropping.
     /// </summary>
+    /// <since_tizen> preview </since_tizen>
     public enum ListMode
     {
         /// <summary>
         /// The list won't set any of its size hints to inform how a possible container should resize it.
         /// Then, if it's not created as a "resize object", it might end with zeroed dimensions.
-        /// The list will respect the container's geometry and, if any of its items won't fit into its transverse axis, one won't be able to scroll it in that direction.
+        /// The list will respect the container's geometry, and if any of its items won't fit into its transverse axis, one won't be able to scroll it in that direction.
         /// </summary>
         Compress = 0,
         /// <summary>
@@ -35,13 +36,13 @@ namespace ElmSharp
         /// </summary>
         Scroll,
         /// <summary>
-        /// Sets a minimum size hint on the genlist object, so that containers may respect it (and resize itself to fit the child properly).
+        /// Sets a minimum size hint on the genlist object, so that the containers may respect it (and resize itself to fit the child properly).
         /// More specifically, a minimum size hint will be set for its transverse axis, so that the largest item in that direction fits well.
         /// This is naturally bound by the list object's maximum size hints, set externally.
         /// </summary>
         Limit,
         /// <summary>
-        /// Besides setting a minimum size on the transverse axis, just like on Limit, the list will set a minimum size on th longitudinal axis, trying to reserve space to all its children to be visible at a time.
+        /// Besides setting a minimum size on the transverse axis, just like on limit, the list will set a minimum size on the longitudinal axis, trying to reserve space to all its children to be visible at a time.
         /// This is naturally bound by the list object's maximum size hints, set externally.
         /// </summary>
         Expand
@@ -49,14 +50,16 @@ namespace ElmSharp
 
     /// <summary>
     /// It inherits System.EventArgs.
-    /// It contains Item which is <see cref="ListItem"/> type.
-    /// All events of List contain ListItemEventArgs as a parameter.
+    /// It contains an item which is <see cref="ListItem"/> type.
+    /// All the events of a list contain ListItemEventArgs as a parameter.
     /// </summary>
+    /// <since_tizen> preview </since_tizen>
     public class ListItemEventArgs : EventArgs
     {
         /// <summary>
-        /// Gets or sets List item. The return type is <see cref="ListItem"/>.
+        /// Gets or sets the list item. The return type is <see cref="ListItem"/>.
         /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public ListItem Item { get; set; }
 
         internal static ListItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info)
@@ -68,14 +71,14 @@ namespace ElmSharp
 
     /// <summary>
     /// It inherits <see cref="Layout"/>.
-    /// The List is a widget that aims to display simple list item which has 2 icons and 1 text, and can be selected.
+    /// The List is a widget that aims to display a simple list item which has 2 icons, 1 text, and can be selected.
     /// For more robust lists, <see cref="GenList"/> should probably be used.
     /// </summary>
     /// <seealso cref="GenList"/>
     /// <seealso cref="GenGrid"/>
-    public class List : Layout, IScrollable
+    /// <since_tizen> preview </since_tizen>
+    public class List : Layout
     {
-        ScrollableAdapter _scroller;
         HashSet<ListItem> _children = new HashSet<ListItem>();
         SmartEvent<ListItemEventArgs> _selected;
         SmartEvent<ListItemEventArgs> _unselected;
@@ -86,7 +89,8 @@ namespace ElmSharp
         /// <summary>
         /// Creates and initializes a new instance of the List class.
         /// </summary>
-        /// <param name="parent">The parent is a given container which will be attached by List as a child. It's <see cref="EvasObject"/> type.</param>
+        /// <param name="parent">The parent is a given container, which will be attached by the list as a child. It's <see cref="EvasObject"/> type.</param>
+        /// <since_tizen> preview </since_tizen>
         public List(EvasObject parent) : base(parent)
         {
             _selected = new SmartEvent<ListItemEventArgs>(this, this.RealHandle, "selected", ListItemEventArgs.CreateFromSmartEvent);
@@ -102,8 +106,9 @@ namespace ElmSharp
         }
 
         /// <summary>
-        /// Gets or sets which mode to use for the list.
+        /// Gets or sets which mode to be used for the list.
         /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public ListMode Mode
         {
             get
@@ -119,6 +124,7 @@ namespace ElmSharp
         /// <summary>
         /// Gets the selected item.
         /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public ListItem SelectedItem
         {
             get
@@ -131,33 +137,39 @@ namespace ElmSharp
         /// <summary>
         /// ItemSelected is raised when a new list item is selected.
         /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public event EventHandler<ListItemEventArgs> ItemSelected;
 
         /// <summary>
-        /// ItemUnselected is raised when the list item is Unselected.
+        /// ItemUnselected is raised when a list item is Unselected.
         /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public event EventHandler<ListItemEventArgs> ItemUnselected;
 
         /// <summary>
-        /// ItemDoubleClicked is raised when a new list item is double clicked.
+        /// ItemDoubleClicked is raised when a new list item is double-clicked.
         /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public event EventHandler<ListItemEventArgs> ItemDoubleClicked;
 
         /// <summary>
-        /// ItemLongPressed is raised when a list item is pressed for a certain amount of time. By default it's 1 second.
+        /// ItemLongPressed is raised when a list item is pressed for a certain amount of time. By default, it's 1 second.
         /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public event EventHandler<ListItemEventArgs> ItemLongPressed;
 
         /// <summary>
-        /// ItemActivated is raised when a new list item is double clicked or pressed (enter|return|spacebar).
+        /// ItemActivated is raised when a new list item is double-clicked or pressed (enter|return|spacebar).
         /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public event EventHandler<ListItemEventArgs> ItemActivated;
 
         /// <summary>
         /// Starts the list.
-        /// Call before running <see cref="EvasObject.Show"/> on the list object.
+        /// Called before running <see cref="EvasObject.Show"/> on the list object.
         /// If not called, it won't display the list properly.
         /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public void Update()
         {
             Interop.Elementary.elm_list_go(RealHandle);
@@ -169,6 +181,7 @@ namespace ElmSharp
         /// <param name="label">The text for the item.</param>
         /// <returns>Return a new added list item that contains a text.</returns>
         /// <seealso cref="ListItem"/>
+        /// <since_tizen> preview </since_tizen>
         public ListItem Append(string label)
         {
             return Append(label, null, null);
@@ -182,6 +195,7 @@ namespace ElmSharp
         /// <param name="rightIcon">The right icon for the item.</param>
         /// <returns>Return a new added list item that contains a text and 2 icons.</returns>
         /// <seealso cref="ListItem"/>
+        /// <since_tizen> preview </since_tizen>
         public ListItem Append(string label, EvasObject leftIcon, EvasObject rightIcon)
         {
             ListItem item = new ListItem(label, leftIcon, rightIcon);
@@ -195,6 +209,7 @@ namespace ElmSharp
         /// </summary>
         /// <param name="label">The text for the item.</param>
         /// <returns>Return a new added list item that contains a text.</returns>
+        /// <since_tizen> preview </since_tizen>
         public ListItem Prepend(string label)
         {
             return Prepend(label, null, null);
@@ -207,6 +222,7 @@ namespace ElmSharp
         /// <param name="leftIcon">The left icon for the item.</param>
         /// <param name="rigthIcon">The right icon for the item.</param>
         /// <returns>Return a new added list item that contains a text and 2 icons.</returns>
+        /// <since_tizen> preview </since_tizen>
         public ListItem Prepend(string label, EvasObject leftIcon, EvasObject rigthIcon)
         {
             ListItem item = new ListItem(label, leftIcon, rigthIcon);
@@ -216,9 +232,10 @@ namespace ElmSharp
         }
 
         /// <summary>
-        /// Removes all items from a given list widget.
+        /// Removes all the items from a given list widget.
         /// To delete just one item, use <see cref="ItemObject.Delete"/>.
         /// </summary>
+        /// <since_tizen> preview </since_tizen>
         public void Clear()
         {
             Interop.Elementary.elm_list_clear(RealHandle);
@@ -232,8 +249,9 @@ namespace ElmSharp
         /// <summary>
         /// Creates a widget handle.
         /// </summary>
-        /// <param name="parent">Parent EvasObject</param>
-        /// <returns>Handle IntPtr</returns>
+        /// <param name="parent">Parent EvasObject.</param>
+        /// <returns>Handle IntPtr.</returns>
+        /// <since_tizen> preview </since_tizen>
         protected override IntPtr CreateHandle(EvasObject parent)
         {
             IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
@@ -242,396 +260,9 @@ namespace ElmSharp
             RealHandle = Interop.Elementary.elm_list_add(handle);
             Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);
 
-            _scroller = new ScrollableAdapter(this);
-
             return handle;
         }
 
-        #region IScroller Implementation
-
-        /// <summary>
-        /// Scrolled will be triggered when the content has been scrolled.
-        /// </summary>
-        public event EventHandler Scrolled
-        {
-            add => _scroller.Scrolled += value;
-            remove => _scroller.Scrolled -= value;
-        }
-
-        /// <summary>
-        /// DragStart will be triggered when dragging the contents around has started.
-        /// </summary>
-        public event EventHandler DragStart
-        {
-            add => _scroller.DragStart += value;
-            remove => _scroller.DragStart -= value;
-        }
-
-        /// <summary>
-        /// DragStop will be triggered when dragging the contents around has stopped.
-        /// </summary>
-        public event EventHandler DragStop
-        {
-            add => _scroller.DragStop += value;
-            remove => _scroller.DragStop -= value;
-        }
-
-        /// <summary>
-        /// PageScrolled will be triggered when the visible page has changed.
-        /// </summary>
-        public event EventHandler PageScrolled
-        {
-            add => _scroller.PageScrolled += value;
-            remove => _scroller.PageScrolled -= value;
-        }
-
-        /// <summary>
-        /// Gets the current region in the content object that is visible through the Scroller.
-        /// </summary>
-        public Rect CurrentRegion => _scroller.CurrentRegion;
-
-        /// <summary>
-        /// Sets or gets the value of HorizontalScrollBarVisiblePolicy
-        /// </summary>
-        /// <remarks>
-        /// ScrollBarVisiblePolicy.Auto means the horizontal scrollbar is made visible if it is needed, and otherwise kept hidden.
-        /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off.
-        /// </remarks>
-        public virtual ScrollBarVisiblePolicy HorizontalScrollBarVisiblePolicy
-        {
-            get => _scroller.HorizontalScrollBarVisiblePolicy;
-            set => _scroller.HorizontalScrollBarVisiblePolicy = value;
-        }
-
-        /// <summary>
-        /// Sets or gets the value of VerticalScrollBarVisiblePolicy
-        /// </summary>
-        /// <remarks>
-        /// ScrollBarVisiblePolicy.Auto means the vertical scrollbar is made visible if it is needed, and otherwise kept hidden.
-        /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off.
-        /// </remarks>
-        public virtual ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy
-        {
-            get => _scroller.VerticalScrollBarVisiblePolicy;
-            set => _scroller.VerticalScrollBarVisiblePolicy = value;
-        }
-
-        /// <summary>
-        /// Sets or gets the value of ScrollBlock.
-        /// </summary>
-        /// <remarks>
-        /// This function will block scrolling movement  in a given direction.One can disable movements in the X axis, the Y axis or both.
-        /// The default value is ScrollBlock.None, where movements are allowed in both directions.
-        /// </remarks>
-        public ScrollBlock ScrollBlock
-        {
-            get => _scroller.ScrollBlock;
-            set => _scroller.ScrollBlock = value;
-        }
-
-        /// <summary>
-        /// Sets or gets scroll current page number.
-        /// </summary>
-        /// <remarks>
-        /// Current page means the page which meets the top of the viewport.
-        /// If there are two or more pages in the viewport, it returns the number of the page which meets the top of the viewport.
-        /// The page number starts from 0. 0 is the first page.
-        /// </remarks>
-        public int VerticalPageIndex => _scroller.VerticalPageIndex;
-
-        /// <summary>
-        /// Sets or gets scroll current page number.
-        /// </summary>
-        /// <remarks>
-        /// Current page means the page which meets the left of the viewport.
-        /// If there are two or more pages in the viewport, it returns the number of the page which meets the left of the viewport.
-        /// The page number starts from 0. 0 is the first page.
-        /// </remarks>
-        public int HorizontalPageIndex => _scroller.HorizontalPageIndex;
-
-        /// <summary>
-        /// Sets or gets the maximum limit of the movable page at vertical direction.
-        /// </summary>
-        public int VerticalPageScrollLimit
-        {
-            get => _scroller.VerticalPageScrollLimit;
-            set => _scroller.VerticalPageScrollLimit = value;
-        }
-
-        /// <summary>
-        /// Sets or gets the maximum limit of the movable page at horizontal direction.
-        /// </summary>
-        public int HorizontalPageScrollLimit
-        {
-            get => _scroller.HorizontalPageScrollLimit;
-            set => _scroller.HorizontalPageScrollLimit = value;
-        }
-
-        /// <summary>
-        /// Sets or gets the vertical bounce behaviour.
-        /// When scrolling, the scroller may "bounce" when reaching an edge of the content object.
-        /// This is a visual way to indicate the end has been reached.
-        /// This is enabled by default for both axis.
-        /// This API will set if it is enabled for the given axis with the boolean parameters for each axis.
-        /// </summary>
-        public bool VerticalBounce
-        {
-            get => _scroller.VerticalBounce;
-            set => _scroller.VerticalBounce = value;
-        }
-
-        /// <summary>
-        /// Sets or gets the horizontal bounce behaviour.
-        /// When scrolling, the scroller may "bounce" when reaching an edge of the content object.
-        /// This is a visual way to indicate the end has been reached.
-        /// This is enabled by default for both axis.
-        /// This API will set if it is enabled for the given axis with the boolean parameters for each axis.
-        /// </summary>
-        public bool HorizontalBounce
-        {
-            get => _scroller.HorizontalBounce;
-            set => _scroller.HorizontalBounce = value;
-        }
-
-        /// <summary>
-        /// Gets the width of the content object of the scroller.
-        /// </summary>
-        public int ChildWidth
-        {
-            get => _scroller.ChildWidth;
-        }
-
-        /// <summary>
-        /// Gets the height of the content object of the scroller.
-        /// </summary>
-        public int ChildHeight
-        {
-            get => _scroller.ChildHeight;
-        }
-
-        /// <summary>
-        /// Set scrolling gravity values for a scroller.
-        /// The gravity, defines how the scroller will adjust its view when the size of the scroller contents increase.
-        /// The scroller will adjust the view to glue itself as follows.
-        /// x=0.0, for staying where it is relative to the left edge of the content x=1.0, for staying where it is relative to the rigth edge of the content y=0.0, for staying where it is relative to the top edge of the content y=1.0, for staying where it is relative to the bottom edge of the content
-        /// Default values for x and y are 0.0
-        /// </summary>
-        public double HorizontalGravity
-        {
-            get => _scroller.HorizontalGravity;
-            set => _scroller.HorizontalGravity = value;
-        }
-
-        /// <summary>
-        /// Set scrolling gravity values for a scroller.
-        /// The gravity, defines how the scroller will adjust its view when the size of the scroller contents increase.
-        /// The scroller will adjust the view to glue itself as follows.
-        /// x=0.0, for staying where it is relative to the left edge of the content x=1.0, for staying where it is relative to the rigth edge of the content y=0.0, for staying where it is relative to the top edge of the content y=1.0, for staying where it is relative to the bottom edge of the content
-        /// Default values for x and y are 0.0
-        /// </summary>
-        public double VerticalGravity
-        {
-            get => _scroller.VerticalGravity;
-            set => _scroller.VerticalGravity = value;
-        }
-
-        /// <summary>
-        /// Get scroll last page number.
-        /// The page number starts from 0. 0 is the first page. This returns the last page number among the pages.
-        /// </summary>
-        public int LastVerticalPageNumber => _scroller.LastVerticalPageNumber;
-
-        /// <summary>
-        /// Get scroll last page number.
-        /// The page number starts from 0. 0 is the first page. This returns the last page number among the pages.
-        /// </summary>
-        public int LastHorizontalPageNumber => _scroller.LastHorizontalPageNumber;
-
-        /// <summary>
-        /// Set an infinite loop_ for a scroller.
-        /// This function sets the infinite loop vertically.
-        /// If the content is set, it will be shown repeatedly.
-        /// </summary>
-        public bool VerticalLoop
-        {
-            get => _scroller.VerticalLoop;
-            set => _scroller.VerticalLoop = value;
-        }
-
-        /// <summary>
-        /// Set an infinite loop_ for a scroller.
-        /// This function sets the infinite loop horizontally.
-        /// If the content is set, it will be shown repeatedly.
-        /// </summary>
-        public bool HorizontalLoop
-        {
-            get => _scroller.HorizontalLoop;
-            set => _scroller.HorizontalLoop = value;
-        }
-
-        /// <summary>
-        /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis.
-        /// </summary>
-        public int HorizontalPageSize
-        {
-            get => _scroller.HorizontalPageSize;
-            set => _scroller.HorizontalPageSize = value;
-        }
-
-        /// <summary>
-        /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis.
-        /// </summary>
-        public int VerticalPageSize
-        {
-            get => _scroller.VerticalPageSize;
-            set => _scroller.VerticalPageSize = value;
-        }
-
-        /// <summary>
-        /// Gets or sets a given scroller widget's scrolling page size, relative to its viewport size.
-        /// </summary>
-        public double VerticalRelativePageSize
-        {
-            get => _scroller.VerticalRelativePageSize;
-            set => _scroller.VerticalRelativePageSize = value;
-        }
-
-        /// <summary>
-        /// Gets or sets a given scroller widget's scrolling page size, relative to its viewport size.
-        /// </summary>
-        public double HorizontalRelativePageSize
-        {
-            get => _scroller.HorizontalRelativePageSize;
-            set => _scroller.HorizontalRelativePageSize = value;
-        }
-
-        /// <summary>
-        /// Gets or Sets the page snapping behavior of a scroller.
-        /// </summary>
-        /// <remarks>
-        /// When scrolling, if a scroller is paged (see VerticalRelativePageSize),
-        /// the scroller may snap to pages when being scrolled, i.e., even if it had momentum to scroll further,
-        /// it will stop at the next page boundaries. This is disabled, by default, for both axis.
-        /// This function will set if it that is enabled or not, for each axis.
-        /// </remarks>
-        public bool VerticalSnap
-        {
-            get => _scroller.VerticalSnap;
-            set => _scroller.VerticalSnap = value;
-        }
-
-        /// <summary>
-        /// Gets or Sets the page snapping behavior of a scroller.
-        /// </summary>
-        /// <remarks>
-        /// When scrolling, if a scroller is paged (see HorizontalRelativePageSize),
-        /// the scroller may snap to pages when being scrolled, i.e., even if it had momentum to scroll further,
-        /// it will stop at the next page boundaries. This is disabled, by default, for both axis.
-        /// This function will set if it that is enabled or not, for each axis.
-        /// </remarks>
-        public bool HorizontalSnap
-        {
-            get => _scroller.HorizontalSnap;
-            set => _scroller.HorizontalSnap = value;
-        }
-
-        /// <summary>
-        /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis.
-        /// </summary>
-        public int PageHeight
-        {
-            get => _scroller.PageHeight;
-            set => _scroller.PageHeight = value;
-        }
-
-        /// <summary>
-        /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis.
-        /// </summary>
-        public int PageWidth
-        {
-            get => _scroller.PageWidth;
-            set => _scroller.PageWidth = value;
-        }
-
-        /// <summary>
-        /// Gets or sets the step size to move scroller by key event.
-        /// </summary>
-        public int HorizontalStepSize
-        {
-            get => _scroller.HorizontalStepSize;
-            set => _scroller.HorizontalStepSize = value;
-        }
-
-        /// <summary>
-        /// Gets or sets the step size to move scroller by key event.
-        /// </summary>
-        public int VerticalStepSize
-        {
-            get => _scroller.VerticalStepSize;
-            set => _scroller.VerticalStepSize = value;
-        }
-
-        /// <summary>
-        /// Gets or sets a value whether mouse wheel is enabled or not over the scroller.
-        /// </summary>
-        public bool WheelDisabled
-        {
-            get => _scroller.WheelDisabled;
-            set => _scroller.WheelDisabled = value;
-        }
-
-        /// <summary>
-        /// Gets or sets the type of single direction scroll.
-        /// </summary>
-        public ScrollSingleDirection SingleDirection
-        {
-            get => _scroller.SingleDirection;
-            set => _scroller.SingleDirection = value;
-        }
-
-        /// <summary>
-        /// Sets the scroller minimum size limited to the minimum size of the content.
-        /// By default the scroller will be as small as its design allows, irrespective of its content.
-        /// This will make the scroller minimum size the right size horizontally and/or vertically to perfectly fit its content in that direction.
-        /// </summary>
-        /// <param name="horizontal">Enable limiting minimum size horizontally</param>
-        /// <param name="vertical">Enable limiting minimum size vertically</param>
-        public void MinimumLimit(bool horizontal, bool vertical)
-        {
-            _scroller.MinimumLimit(horizontal, vertical);
-        }
-
-        /// <summary>
-        /// Shows a specific virtual region within the scroller content object by the page number.
-        /// (0, 0) of the indicated page is located at the top-left corner of the viewport.
-        /// </summary>
-        /// <param name="horizontalPageIndex">The horizontal page number.</param>
-        /// <param name="verticalPageIndex">The vertical page number.</param>
-        /// <param name="animated">True means slider with animation.</param>
-        public void ScrollTo(int horizontalPageIndex, int verticalPageIndex, bool animated)
-        {
-            _scroller.ScrollTo(horizontalPageIndex, verticalPageIndex, animated);
-        }
-
-        /// <summary>
-        /// Shows a specific virtual region within the scroller content object.
-        /// </summary>
-        /// <remarks>
-        /// This ensures that all (or part, if it does not fit) of the designated region in the virtual content object ((0, 0)
-        /// starting at the top-left of the virtual content object) is shown within the scroller.
-        /// If set "animated" to true, it will allows the scroller to "smoothly slide" to this location
-        /// (if configuration in general calls for transitions).
-        /// It may not jump immediately to the new location and may take a while and show other content along the way.
-        /// </remarks>
-        /// <param name="region">Rect struct of region.</param>
-        /// <param name="animated">True means allows the scroller to "smoothly slide" to this location.</param>
-        public void ScrollTo(Rect region, bool animated)
-        {
-            _scroller.ScrollTo(region, animated);
-        }
-
-        #endregion
-
         void AddInternal(ListItem item)
         {
             _children.Add(item);