2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 namespace ElmSharp.Wearable
22 /// The Circle GenList Selector is a widget to display and handle genlist items by rotary event
23 /// Inherits <see cref="GenList"/>
25 public class CircleGenList : GenList
30 /// Creates and initializes a new instance of the Circle GenList class
32 /// <param name="parent">The parent of new Circle GenList instance</param>
33 public CircleGenList(EvasObject parent) : base(parent) { }
36 /// Sets or gets the disabled state of the Circle GenList Selector
42 return Interop.Eext.eext_circle_object_disabled_get(circleHandle);
46 Interop.Eext.eext_circle_object_disabled_set(circleHandle, value);
51 /// Sets or gets the color of the scroll background
53 public Color VerticalScrollBackgroundColor
58 Interop.Eext.eext_circle_object_item_color_get(circleHandle, "vertical,scroll,bg", out r, out g, out b, out a);
59 return new Color(r, g, b, a);
63 Interop.Eext.eext_circle_object_item_color_set(circleHandle, "vertical,scroll,bg", value.R, value.G, value.B, value.A);
68 /// Sets or gets the line width of the scroll background
70 public int VerticalScrollBackgroundLineWidth
74 return Interop.Eext.eext_circle_object_item_line_width_get(circleHandle, "vertical,scroll,bg");
78 Interop.Eext.eext_circle_object_item_line_width_set(circleHandle, "vertical,scroll,bg", value);
83 /// Sets or gets the redius of the scroll background
85 public double VerticalScrollBackgroundRadius
89 return Interop.Eext.eext_circle_object_item_radius_get(circleHandle, "vertical,scroll,bg");
93 Interop.Eext.eext_circle_object_item_radius_set(circleHandle, "vertical,scroll,bg", value);
98 /// Sets or gets the color of the scroll bar
100 public Color VerticalScrollBarColor
105 Interop.Eext.eext_circle_object_item_color_get(circleHandle, "default", out r, out g, out b, out a);
106 return new Color(r, g, b, a);
110 Interop.Eext.eext_circle_object_item_color_set(circleHandle, "default", value.R, value.G, value.B, value.A);
115 /// Sets or gets the line width of the scroll bar
117 public int VerticalScrollBarLineWidth
121 return Interop.Eext.eext_circle_object_item_line_width_get(circleHandle, "default");
125 Interop.Eext.eext_circle_object_item_line_width_set(circleHandle, "default", value);
130 /// Sets or gets the redius of the scroll bar
132 public double VerticalScrollBarRadius
136 return Interop.Eext.eext_circle_object_item_radius_get(circleHandle, "default");
140 Interop.Eext.eext_circle_object_item_radius_set(circleHandle, "default", value);
145 /// Sets or gets the policy if the scroll bar is visible
148 /// ScrollBarVisiblePolicy.Auto means the vertical scrollbar is made visible if it is needed, and otherwise kept hidden.
149 /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off.
151 public ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy
156 Interop.Eext.eext_circle_object_genlist_scroller_policy_get(circleHandle, IntPtr.Zero, out policy);
157 return (ScrollBarVisiblePolicy)policy;
162 Interop.Eext.eext_circle_object_genlist_scroller_policy_get(circleHandle, out h, IntPtr.Zero);
163 Interop.Eext.eext_circle_object_genlist_scroller_policy_set(circleHandle, (int)h, (int)value);
168 /// Creates a widget handle.
170 /// <param name="parent">Parent EvasObject</param>
171 /// <returns>Handle IntPtr</returns>
172 protected override IntPtr CreateHandle(EvasObject parent)
174 var handle = base.CreateHandle(parent);
176 IntPtr surface = IntPtr.Zero;
178 if (parent is Conformant)
180 surface = Interop.Eext.eext_circle_surface_conformant_add(parent);
182 else if (parent is Naviframe)
184 surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle);
186 else if (parent is Layout)
188 surface = Interop.Eext.eext_circle_surface_layout_add(parent);
191 circleHandle = Interop.Eext.eext_circle_object_genlist_add(RealHandle, surface);
192 if (surface == IntPtr.Zero)
194 EvasObject p = parent;
195 while(!(p is Window))
199 var w = (p as Window).ScreenSize.Width;
200 var h = (p as Window).ScreenSize.Height;
201 Interop.Evas.evas_object_resize(circleHandle, w, h);
204 Interop.Eext.eext_rotary_object_event_activated_set(circleHandle, true);