From: sung-su.kim Date: Tue, 23 May 2017 10:21:51 +0000 (+0900) Subject: Enhance Scroller widget X-Git-Tag: submit/trunk/20170823.075128~110^2~73^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=49a8ef9492b8ddc4fe2aed2599ee8be7c1f754c7;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Enhance Scroller widget Change-Id: Id7162dda1bdc2bbdf8abbee8ad691176d5ee532a --- diff --git a/src/ElmSharp/ElmSharp/Scroller.cs b/src/ElmSharp/ElmSharp/Scroller.cs index 8bcfdd1..35ed35a 100755 --- a/src/ElmSharp/ElmSharp/Scroller.cs +++ b/src/ElmSharp/ElmSharp/Scroller.cs @@ -27,15 +27,18 @@ namespace ElmSharp /// Show scrollbars as needed /// Auto = 0, + /// /// Always show scrollbars /// Visible, + /// /// Never show scrollbars /// Invisible } + /// /// Enumeration for visible type of scrollbar. /// @@ -45,15 +48,39 @@ namespace ElmSharp /// Scrolling movement is allowed in both direction.(X axis and Y axis) /// None = 1, + /// /// Scrolling movement is not allowed in Y axis direction. /// Vertical = 2, + /// /// Scrolling movement is not allowed in X axis direction. /// Horizontal = 4 } + + /// + /// Type that controls how the content is scrolled. + /// + public enum ScrollSingleDirection + { + /// + /// Scroll every direction. + /// + None, + + /// + /// Scroll single direction if the direction is certain. + /// + Soft, + + /// + /// Scroll only single direction. + /// + Hard, + } + /// /// The Scroller is a container that holds and clips a single object and allows you to scroll across it. /// @@ -285,6 +312,391 @@ namespace ElmSharp } /// + /// 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. + /// + public bool VerticalBounce + { + get + { + bool v, h; + Interop.Elementary.elm_scroller_bounce_get(RealHandle, out h, out v); + return v; + } + set + { + bool h = HorizontalBounce; + Interop.Elementary.elm_scroller_bounce_set(RealHandle, h, value); + } + } + + /// + /// 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. + /// + public bool HorizontalBounce + { + get + { + bool v, h; + Interop.Elementary.elm_scroller_bounce_get(RealHandle, out h, out v); + return h; + } + set + { + bool v = VerticalBounce; + Interop.Elementary.elm_scroller_bounce_set(RealHandle, value, v); + } + } + + /// + /// Gets the width of the content object of the scroller. + /// + public int ChildWidth + { + get + { + int w, h; + Interop.Elementary.elm_scroller_child_size_get(RealHandle, out w, out h); + return w; + } + } + + /// + /// Gets the height of the content object of the scroller. + /// + public int ChildHeight + { + get + { + int w, h; + Interop.Elementary.elm_scroller_child_size_get(RealHandle, out w, out h); + return h; + } + } + + /// + /// 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 + /// + public double HorizontalGravity + { + get + { + double v, h; + Interop.Elementary.elm_scroller_gravity_get(RealHandle, out h, out v); + return h; + } + set + { + double v = VerticalGravity; + Interop.Elementary.elm_scroller_gravity_set(RealHandle, value, v); + } + } + + /// + /// 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 + /// + public double VerticalGravity + { + get + { + double v, h; + Interop.Elementary.elm_scroller_gravity_get(RealHandle, out h, out v); + return v; + } + set + { + double h = HorizontalGravity; + Interop.Elementary.elm_scroller_gravity_set(RealHandle, h, value); + } + } + + /// + /// 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. + /// + public int LastVerticalPageNumber + { + get + { + int v, h; + Interop.Elementary.elm_scroller_last_page_get(RealHandle, out h, out v); + return v; + } + } + + /// + /// 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. + /// + public int LastHorizontalPageNumber + { + get + { + int v, h; + Interop.Elementary.elm_scroller_last_page_get(RealHandle, out h, out v); + return h; + } + } + + /// + /// Set an infinite loop_ for a scroller. + /// This function sets the infinite loop vertically. + /// If the content is set, it will be shown repeatedly. + /// + public bool VerticalLoop + { + get + { + bool v, h; + Interop.Elementary.elm_scroller_loop_get(RealHandle, out h, out v); + return v; + } + set + { + bool h = HorizontalLoop; + Interop.Elementary.elm_scroller_loop_set(RealHandle, h, value); + } + } + + /// + /// Set an infinite loop_ for a scroller. + /// This function sets the infinite loop horizontally. + /// If the content is set, it will be shown repeatedly. + /// + public bool HorizontalLoop + { + get + { + bool v, h; + Interop.Elementary.elm_scroller_loop_get(RealHandle, out h, out v); + return h; + } + set + { + bool v = VerticalLoop; + Interop.Elementary.elm_scroller_loop_set(RealHandle, value, v); + } + } + + /// + /// Get a given scroller widget's scrolling page size, relative to its viewport size. + /// + public double VerticalRelativePageSize + { + get + { + double v, h; + Interop.Elementary.elm_scroller_page_relative_get(RealHandle, out h, out v); + return v; + } + set + { + double h = HorizontalRelativePageSize; + Interop.Elementary.elm_scroller_page_relative_set(RealHandle, h, value); + } + } + + /// + /// Get a given scroller widget's scrolling page size, relative to its viewport size. + /// + public double HorizontalRelativePageSize + { + get + { + double v, h; + Interop.Elementary.elm_scroller_page_relative_get(RealHandle, out h, out v); + return h; + } + set + { + double v = VerticalRelativePageSize; + Interop.Elementary.elm_scroller_page_relative_set(RealHandle, value, v); + } + } + + /// + /// Gets or Sets the page snapping behavior of a scroller. + /// + public bool VerticalSnap + { + get + { + bool v, h; + Interop.Elementary.elm_scroller_page_snap_get(RealHandle, out h, out v); + return v; + } + set + { + bool h = HorizontalSnap; + Interop.Elementary.elm_scroller_page_snap_set(RealHandle, h, value); + } + } + + /// + /// Gets or Sets the page snapping behavior of a scroller. + /// + public bool HorizontalSnap + { + get + { + bool v, h; + Interop.Elementary.elm_scroller_page_snap_get(RealHandle, out h, out v); + return h; + } + set + { + bool v = VerticalSnap; + Interop.Elementary.elm_scroller_page_snap_set(RealHandle, value, v); + } + } + + /// + /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis. + /// + public int PageHeight + { + get + { + int w, h; + Interop.Elementary.elm_scroller_page_size_get(RealHandle, out w, out h); + return h; + } + set + { + int w = PageWidth; + Interop.Elementary.elm_scroller_page_size_set(RealHandle, w, value); + } + } + + /// + /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis. + /// + public int PageWidth + { + get + { + int w, h; + Interop.Elementary.elm_scroller_page_size_get(RealHandle, out w, out h); + return w; + } + set + { + int h = PageHeight; + Interop.Elementary.elm_scroller_page_size_set(RealHandle, value, h); + } + } + + /// + /// Gets or sets the event propagation for a scroller. + /// This enables or disables event propagation from the scroller content to the scroller and its parent. + /// By default event propagation is enabled. + /// + public bool PropagateEvents + { + get + { + return Interop.Elementary.elm_scroller_propagate_events_get(RealHandle); + } + set + { + Interop.Elementary.elm_scroller_propagate_events_set(RealHandle, value); + } + } + + /// + /// Gets or sets the step size to move scroller by key event. + /// + public int HorizontalStepSize + { + get + { + int h, v; + Interop.Elementary.elm_scroller_step_size_get(RealHandle, out h, out v); + return h; + } + set + { + int v = VerticalStepSize; + Interop.Elementary.elm_scroller_step_size_set(RealHandle, value, v); + } + } + + /// + /// Gets or sets the step size to move scroller by key event. + /// + public int VerticalStepSize + { + get + { + int h, v; + Interop.Elementary.elm_scroller_step_size_get(RealHandle, out h, out v); + return v; + } + set + { + int h = HorizontalStepSize; + Interop.Elementary.elm_scroller_step_size_set(RealHandle, h, value); + } + } + + /// + /// Gets or sets a value whether mouse wheel is enabled or not over the scroller. + /// + public bool WheelDisabled + { + get + { + return Interop.Elementary.elm_scroller_wheel_disabled_get(RealHandle); + } + set + { + Interop.Elementary.elm_scroller_wheel_disabled_set(RealHandle, value); + } + } + + /// + /// Gets or sets the type of single direction scroll. + /// + public ScrollSingleDirection SingleDirection + { + get + { + return (ScrollSingleDirection)Interop.Elementary.elm_scroller_single_direction_get(RealHandle); + } + set + { + Interop.Elementary.elm_scroller_single_direction_set(RealHandle, (int)value); + } + } + + /// + /// 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. + /// + /// Enable limiting minimum size horizontally + /// Enable limiting minimum size vertically + public void MinimumLimit(bool horizontal, bool vertical) + { + Interop.Elementary.elm_scroller_content_min_limit(RealHandle, horizontal, vertical); + } + + /// /// Sets the page size to an absolute fixed value, with 0 turning it off for that axis. /// /// The horizontal page size. @@ -367,4 +779,4 @@ namespace ElmSharp return handle; } } -} +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.ScrollView.cs b/src/ElmSharp/Interop/Interop.Elementary.ScrollView.cs index 5da2fa1..671aa5c 100644 --- a/src/ElmSharp/Interop/Interop.Elementary.ScrollView.cs +++ b/src/ElmSharp/Interop/Interop.Elementary.ScrollView.cs @@ -111,9 +111,11 @@ internal static partial class Interop [DllImport(Libraries.Elementary)] internal static extern void elm_scroller_region_show (IntPtr obj, int x, int y, int w, int h); - // @TODO uses Elm_Scroller_Single_Direction structure: - // internal static extern ElmScrollerSingleDirection elm_scroller_single_direction_get(IntPtr obj); - // internal static extern void elm_scroller_single_direction_set(IntPtr obj, ElmScrollerSingleDirection single_dir); + [DllImport(Libraries.Elementary)] + internal static extern int elm_scroller_single_direction_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_single_direction_set(IntPtr obj, int singleDirection); [DllImport(Libraries.Elementary)] internal static extern void elm_scroller_step_size_get (IntPtr obj, out int x, out int y); @@ -142,4 +144,4 @@ internal static partial class Interop [DllImport(Libraries.Elementary)] internal static extern void elm_object_scroll_lock_y_set(IntPtr obj, bool enable); } -} +} \ No newline at end of file