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.
18 using System.Collections.Generic;
22 public class FlipSelector : Layout
25 SmartEvent _overflowed;
26 SmartEvent _underflowed;
28 public FlipSelector(EvasObject parent) : base(parent)
30 _selected = new SmartEvent(this, Handle, "selected");
31 _overflowed = new SmartEvent(this, Handle, "overflowed");
32 _underflowed = new SmartEvent(this, Handle, "underflowed");
34 _selected.On += SelectedChanged;
35 _overflowed.On += OverflowedChanged;
36 _underflowed.On += UnderflowedChanged;
39 public event EventHandler Selected;
40 public event EventHandler Overflowed;
41 public event EventHandler Underflowed;
43 public double Interval
47 return Interop.Elementary.elm_flipselector_first_interval_get(Handle);
51 Interop.Elementary.elm_flipselector_first_interval_set(Handle, value);
55 public FlipSelectorItem SelectedItem
59 IntPtr handle = Interop.Elementary.elm_flipselector_selected_item_get(Handle);
60 return ItemObject.GetItemByHandle(handle) as FlipSelectorItem;
64 public FlipSelectorItem FirstItem
68 IntPtr handle = Interop.Elementary.elm_flipselector_first_item_get(Handle);
69 return ItemObject.GetItemByHandle(handle) as FlipSelectorItem;
73 public FlipSelectorItem LastItem
77 IntPtr handle = Interop.Elementary.elm_flipselector_last_item_get(Handle);
78 return ItemObject.GetItemByHandle(handle) as FlipSelectorItem;
82 public FlipSelectorItem Append(string text)
84 FlipSelectorItem item = new FlipSelectorItem(text);
85 item.Handle = Interop.Elementary.elm_flipselector_item_append(Handle, text, null, (IntPtr)item.Id);
89 public FlipSelectorItem Prepend(string text)
91 FlipSelectorItem item = new FlipSelectorItem(text);
92 item.Handle = Interop.Elementary.elm_flipselector_item_prepend(Handle, text, null, (IntPtr)item.Id);
96 public void Remove(FlipSelectorItem item)
98 if (item as FlipSelectorItem != null)
104 Interop.Elementary.elm_flipselector_flip_next(Handle);
109 Interop.Elementary.elm_flipselector_flip_prev(Handle);
112 protected override IntPtr CreateHandle(EvasObject parent)
114 return Interop.Elementary.elm_flipselector_add(parent.Handle);
117 void SelectedChanged(object sender, EventArgs e)
119 SelectedItem?.SendSelected();
120 Selected?.Invoke(this, EventArgs.Empty);
123 void OverflowedChanged(object sender, EventArgs e)
125 Overflowed?.Invoke(this, e);
128 void UnderflowedChanged(object sender, EventArgs e)
130 Underflowed?.Invoke(this, e);