Merge "Do not use layout for Label and Entry." into tizen
authorJeonghyun Yun <jh0506.yun@samsung.com>
Tue, 21 Feb 2017 04:51:29 +0000 (20:51 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 21 Feb 2017 04:51:29 +0000 (20:51 -0800)
src/ElmSharp/ElmSharp.Net45.csproj [changed mode: 0644->0755]
src/ElmSharp/ElmSharp.csproj
src/ElmSharp/ElmSharp/ColorSelector.cs
src/ElmSharp/ElmSharp/ColorSelectorItem.cs [new file with mode: 0755]
src/ElmSharp/ElmSharp/ContextPopup.cs
src/ElmSharp/ElmSharp/FlipSelector.cs [new file with mode: 0644]
src/ElmSharp/ElmSharp/FlipSelectorItem.cs [new file with mode: 0644]
src/ElmSharp/Interop/Interop.Elementary.ColorPicker.cs [changed mode: 0644->0755]
src/ElmSharp/Interop/Interop.Elementary.FlipSelector.cs [new file with mode: 0644]
test/ElmSharp.Test/ElmSharp.Test.csproj [changed mode: 0644->0755]
test/ElmSharp.Test/TC/FlipSelectorTest.cs [new file with mode: 0644]

old mode 100644 (file)
new mode 100755 (executable)
index 9d53b09..d210cf3
@@ -59,6 +59,7 @@
     <Compile Include="ElmSharp\Conformant.cs" />
     <Compile Include="ElmSharp\Container.cs" />
     <Compile Include="ElmSharp\ContextPopup.cs" />
+    <Compile Include="ElmSharp\ColorSelectorItem.cs" />
     <Compile Include="ElmSharp\ContextPopupItem.cs" />
     <Compile Include="ElmSharp\DateChangedEventArgs.cs" />
     <Compile Include="ElmSharp\DateTimeSelector.cs" />
     <Compile Include="ElmSharp\EcoreMainloop.cs" />
     <Compile Include="ElmSharp\EcoreSynchronizationContext.cs" />
     <Compile Include="ElmSharp\EdjeObject.cs" />
-    <Compile Include="ElmSharp\Elementary.cs" />
     <Compile Include="ElmSharp\ElmScrollConfig.cs" />
+    <Compile Include="ElmSharp\Elementary.cs" />
     <Compile Include="ElmSharp\Entry.cs" />
     <Compile Include="ElmSharp\EvasKeyEventArgs.cs" />
     <Compile Include="ElmSharp\EvasMap.cs" />
     <Compile Include="ElmSharp\EvasObject.cs" />
     <Compile Include="ElmSharp\EvasObjectEvent.cs" />
+    <Compile Include="ElmSharp\FlipSelector.cs" />
+    <Compile Include="ElmSharp\FlipSelectorItem.cs" />
+    <Compile Include="ElmSharp\FloatingButton.cs" />
     <Compile Include="ElmSharp\GenGrid.cs" />
     <Compile Include="ElmSharp\GenGridItem.cs" />
     <Compile Include="ElmSharp\GenItem.cs" />
     <Compile Include="ElmSharp\Widget.cs" />
     <Compile Include="ElmSharp\Window.cs" />
     <Compile Include="ElmSharp\WrapType.cs" />
-    <Compile Include="Interop\Interop.Ecore.cs" />
     <Compile Include="Interop\Interop.Eina.cs" />
+    <Compile Include="Interop\Interop.Elementary.FlipSelector.cs" />
+    <Compile Include="Interop\Interop.Eo.cs" />
+    <Compile Include="Interop\Interop.Ecore.cs" />
     <Compile Include="Interop\Interop.Elementary.Bg.cs" />
     <Compile Include="Interop\Interop.Elementary.Box.cs" />
     <Compile Include="Interop\Interop.Elementary.Button.cs" />
     <Compile Include="Interop\Interop.Elementary.CtxPopup.cs" />
     <Compile Include="Interop\Interop.Elementary.DateTimePicker.cs" />
     <Compile Include="Interop\Interop.Elementary.Entry.cs" />
+    <Compile Include="Interop\Interop.Elementary.FloatingButton.cs" />
     <Compile Include="Interop\Interop.Elementary.GenGridView.cs" />
     <Compile Include="Interop\Interop.Elementary.GenListView.cs" />
     <Compile Include="Interop\Interop.Elementary.GestureLayer.cs" />
     <Compile Include="Interop\Interop.Elementary.Table.cs" />
     <Compile Include="Interop\Interop.Elementary.Toolbar.cs" />
     <Compile Include="Interop\Interop.Elementary.Win.cs" />
-    <Compile Include="Interop\Interop.Eo.cs" />
     <Compile Include="Interop\Interop.Evas.cs" />
     <Compile Include="Interop\Interop.Evas.Image.cs" />
     <Compile Include="Interop\Interop.Libc.cs" />
   <Target Name="AfterBuild">
   </Target>
   -->
-</Project>
+</Project>
\ No newline at end of file
index 463f68a..4f35a2a 100755 (executable)
@@ -56,6 +56,7 @@
     <Compile Include="ElmSharp\Conformant.cs" />
     <Compile Include="ElmSharp\Container.cs" />
     <Compile Include="ElmSharp\ContextPopup.cs" />
+    <Compile Include="ElmSharp\ColorSelectorItem.cs" />
     <Compile Include="ElmSharp\ContextPopupItem.cs" />
     <Compile Include="ElmSharp\DateChangedEventArgs.cs" />
     <Compile Include="ElmSharp\DateTimeSelector.cs" />
@@ -71,6 +72,8 @@
     <Compile Include="ElmSharp\EvasMap.cs" />
     <Compile Include="ElmSharp\EvasObject.cs" />
     <Compile Include="ElmSharp\EvasObjectEvent.cs" />
+    <Compile Include="ElmSharp\FlipSelector.cs" />
+    <Compile Include="ElmSharp\FlipSelectorItem.cs" />
     <Compile Include="ElmSharp\FloatingButton.cs" />
     <Compile Include="ElmSharp\GenGrid.cs" />
     <Compile Include="ElmSharp\GenGridItem.cs" />
     <Compile Include="ElmSharp\Window.cs" />
     <Compile Include="ElmSharp\WrapType.cs" />
     <Compile Include="Interop\Interop.Eina.cs" />
+    <Compile Include="Interop\Interop.Elementary.FlipSelector.cs" />
     <Compile Include="Interop\Interop.Eo.cs" />
     <Compile Include="Interop\Interop.Ecore.cs" />
     <Compile Include="Interop\Interop.Elementary.Bg.cs" />
     <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>
     <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
   </PropertyGroup>
-</Project>
\ No newline at end of file
+</Project>
index 283e100..137aa41 100755 (executable)
@@ -101,6 +101,18 @@ namespace ElmSharp
             }
         }
 
+        public ColorSelectorItem AddPaletteColor(Color color)
+        {
+            ColorSelectorItem item = new ColorSelectorItem();
+            item.Handle = Interop.Elementary.elm_colorselector_palette_color_add(Handle, color.R, color.G, color.B, color.A);
+            return item;
+        }
+
+        public void ClearPalette()
+        {
+            Interop.Elementary.elm_colorselector_palette_clear(Handle);
+        }
+
         protected override IntPtr CreateHandle(EvasObject parent)
         {
             return Interop.Elementary.elm_colorselector_add(parent.Handle);
diff --git a/src/ElmSharp/ElmSharp/ColorSelectorItem.cs b/src/ElmSharp/ElmSharp/ColorSelectorItem.cs
new file mode 100755 (executable)
index 0000000..4ee5f7a
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace ElmSharp
+{
+    public class ColorSelectorItem : ItemObject
+    {
+        internal ColorSelectorItem() : base(IntPtr.Zero)
+        {
+        }
+
+        public Color Color
+        {
+            get
+            {
+                int r, g, b, a;
+                Interop.Elementary.elm_colorselector_palette_item_color_get(Handle, out r, out g, out b, out a);
+                return Color.FromRgba(r, g, b, a);
+            }
+            set
+            {
+                if (Handle != IntPtr.Zero)
+                {
+                    Interop.Elementary.elm_colorselector_palette_item_color_set(Handle, value.R, value.G, value.B, value.A);
+                }
+            }
+        }
+    }
+}
index 2970af1..e812c8c 100755 (executable)
@@ -82,11 +82,26 @@ namespace ElmSharp
             }
         }
 
+        public void Clear()
+        {
+            Interop.Elementary.elm_ctxpopup_clear(Handle);
+        }
+
         public void SetDirectionPriorty(ContextPopupDirection first, ContextPopupDirection second, ContextPopupDirection third, ContextPopupDirection fourth)
         {
             Interop.Elementary.elm_ctxpopup_direction_priority_set(RealHandle, (int)first, (int)second, (int)third, (int)fourth);
         }
 
+        public void GetDirectionPriority(out ContextPopupDirection first, out ContextPopupDirection second, out ContextPopupDirection third, out ContextPopupDirection fourth)
+        {
+            int firstOut, secondOut, thirdOut, fourthOut;
+            Interop.Elementary.elm_ctxpopup_direction_priority_get(Handle, out firstOut, out secondOut, out thirdOut, out fourthOut);
+            first = (ContextPopupDirection)firstOut;
+            second = (ContextPopupDirection)secondOut;
+            third = (ContextPopupDirection)thirdOut;
+            fourth = (ContextPopupDirection)fourthOut;
+        }
+
         public ContextPopupItem Append(string label)
         {
             return Append(label, null);
diff --git a/src/ElmSharp/ElmSharp/FlipSelector.cs b/src/ElmSharp/ElmSharp/FlipSelector.cs
new file mode 100644 (file)
index 0000000..3a58f8e
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace ElmSharp
+{
+    public class FlipSelector : Layout
+    {
+        SmartEvent _selected;
+        SmartEvent _overflowed;
+        SmartEvent _underflowed;
+
+        public FlipSelector(EvasObject parent) : base(parent)
+        {
+            _selected = new SmartEvent(this, Handle, "selected");
+            _overflowed = new SmartEvent(this, Handle, "overflowed");
+            _underflowed = new SmartEvent(this, Handle, "underflowed");
+
+            _selected.On += SelectedChanged;
+            _overflowed.On += OverflowedChanged;
+            _underflowed.On += UnderflowedChanged;
+        }
+
+        public event EventHandler Selected;
+        public event EventHandler Overflowed;
+        public event EventHandler Underflowed;
+
+        public double Interval
+        {
+            get
+            {
+                return Interop.Elementary.elm_flipselector_first_interval_get(Handle);
+            }
+            set
+            {
+                Interop.Elementary.elm_flipselector_first_interval_set(Handle, value);
+            }
+        }
+
+        public FlipSelectorItem SelectedItem
+        {
+            get
+            {
+                IntPtr handle = Interop.Elementary.elm_flipselector_selected_item_get(Handle);
+                return ItemObject.GetItemByHandle(handle) as FlipSelectorItem;
+            }
+        }
+
+        public FlipSelectorItem FirstItem
+        {
+            get
+            {
+                IntPtr handle = Interop.Elementary.elm_flipselector_first_item_get(Handle);
+                return ItemObject.GetItemByHandle(handle) as FlipSelectorItem;
+            }
+        }
+
+        public FlipSelectorItem LastItem
+        {
+            get
+            {
+                IntPtr handle = Interop.Elementary.elm_flipselector_last_item_get(Handle);
+                return ItemObject.GetItemByHandle(handle) as FlipSelectorItem;
+            }
+        }
+
+        public FlipSelectorItem Append(string text)
+        {
+            FlipSelectorItem item = new FlipSelectorItem(text);
+            item.Handle = Interop.Elementary.elm_flipselector_item_append(Handle, text, null, (IntPtr)item.Id);
+            return item;
+        }
+
+        public FlipSelectorItem Prepend(string text)
+        {
+            FlipSelectorItem item = new FlipSelectorItem(text);
+            item.Handle = Interop.Elementary.elm_flipselector_item_prepend(Handle, text, null, (IntPtr)item.Id);
+            return item;
+        }
+
+        public void Remove(FlipSelectorItem item)
+        {
+            if (item as FlipSelectorItem != null)
+                item.Delete();
+        }
+
+        public void Next()
+        {
+            Interop.Elementary.elm_flipselector_flip_next(Handle);
+        }
+
+        public void Prev()
+        {
+            Interop.Elementary.elm_flipselector_flip_prev(Handle);
+        }
+
+        protected override IntPtr CreateHandle(EvasObject parent)
+        {
+            return Interop.Elementary.elm_flipselector_add(parent.Handle);
+        }
+
+        void SelectedChanged(object sender, EventArgs e)
+        {
+            SelectedItem?.SendSelected();
+            Selected?.Invoke(this, EventArgs.Empty);
+        }
+
+        void OverflowedChanged(object sender, EventArgs e)
+        {
+            Overflowed?.Invoke(this, e);
+        }
+
+        void UnderflowedChanged(object sender, EventArgs e)
+        {
+            Underflowed?.Invoke(this, e);
+        }
+    }
+}
diff --git a/src/ElmSharp/ElmSharp/FlipSelectorItem.cs b/src/ElmSharp/ElmSharp/FlipSelectorItem.cs
new file mode 100644 (file)
index 0000000..a957acf
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace ElmSharp
+{
+    public class FlipSelectorItem : ItemObject
+    {
+        public string Text { get; private set; }
+
+        public event EventHandler Selected;
+
+        public FlipSelectorItem(string text) : base(IntPtr.Zero)
+        {
+            Text = text;
+        }
+
+        internal void SendSelected()
+        {
+            Selected?.Invoke(this, EventArgs.Empty);
+        }
+    }
+}
old mode 100644 (file)
new mode 100755 (executable)
index b61c98b..231fc9d
@@ -70,7 +70,7 @@ internal static partial class Interop
         internal static extern void elm_colorselector_palette_item_color_get(IntPtr obj, out int r, out int g, out int b, out int a);
 
         [DllImport(Libraries.Elementary)]
-        internal static extern int elm_colorselector_palette_item_color_set(IntPtr obj, int r, int g, int b, int a);
+        internal static extern void elm_colorselector_palette_item_color_set(IntPtr obj, int r, int g, int b, int a);
 
         [DllImport(Libraries.Elementary)]
         internal static extern bool elm_colorselector_palette_item_selected_get(IntPtr obj);
diff --git a/src/ElmSharp/Interop/Interop.Elementary.FlipSelector.cs b/src/ElmSharp/Interop/Interop.Elementary.FlipSelector.cs
new file mode 100644 (file)
index 0000000..9768571
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+    internal static partial class Elementary
+    {
+        [DllImport(Libraries.Elementary)]
+        internal static extern IntPtr elm_flipselector_add(IntPtr parent);
+
+        [DllImport(Libraries.Elementary)]
+        internal static extern double elm_flipselector_first_interval_get(IntPtr flipSelector);
+
+        [DllImport(Libraries.Elementary)]
+        internal static extern void elm_flipselector_first_interval_set(IntPtr flipSelector, double interval);
+
+        [DllImport(Libraries.Elementary)]
+        internal static extern IntPtr elm_flipselector_item_append(IntPtr flipSelector, string text, Evas.SmartCallback func, IntPtr data);
+
+        [DllImport(Libraries.Elementary)]
+        internal static extern IntPtr elm_flipselector_item_prepend(IntPtr flipSelector, string text, Evas.SmartCallback func, IntPtr data);
+
+        [DllImport(Libraries.Elementary)]
+        internal static extern void elm_flipselector_flip_next(IntPtr flipSelector);
+
+        [DllImport(Libraries.Elementary)]
+        internal static extern void elm_flipselector_flip_prev(IntPtr flipSelector);
+
+        [DllImport(Libraries.Elementary)]
+        internal static extern IntPtr elm_flipselector_selected_item_get(IntPtr flipSelector);
+
+        [DllImport(Libraries.Elementary)]
+        internal static extern IntPtr elm_flipselector_first_item_get(IntPtr flipSelector);
+
+        [DllImport(Libraries.Elementary)]
+        internal static extern IntPtr elm_flipselector_last_item_get(IntPtr flipSelector);
+    }
+}
old mode 100644 (file)
new mode 100755 (executable)
index 78f3556..74232bd
@@ -45,6 +45,7 @@
     <Compile Include="TC\BackgroundTest3.cs" />
     <Compile Include="TC\DateTimeSelectorTest2.cs" />
     <Compile Include="TC\EntryTest2.cs" />
+    <Compile Include="TC\FlipSelectorTest.cs" />
     <Compile Include="TC\GenListTest9.cs" />
     <Compile Include="TC\NaviframeTest3.cs" />
     <Compile Include="TC\ScreenInformationTest.cs" />
       </FlavorProperties>
     </VisualStudio>
   </ProjectExtensions>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/test/ElmSharp.Test/TC/FlipSelectorTest.cs b/test/ElmSharp.Test/TC/FlipSelectorTest.cs
new file mode 100644 (file)
index 0000000..0c2a85d
--- /dev/null
@@ -0,0 +1,113 @@
+using System;
+using ElmSharp;
+
+namespace ElmSharp.Test
+{
+    public class FlipSelectorTest : TestCaseBase
+    {
+        public override string TestName => "FlipSelectorTest";
+        public override string TestDescription => "To test FlipSelector";
+
+        public override void Run(Window window)
+        {
+            Conformant conformant = new Conformant(window);
+            conformant.Show();
+
+            Box outterBox = new Box(window)
+            {
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+                WeightY = 1,
+                IsHorizontal = false,
+            };
+            outterBox.Show();
+
+            Box box = new Box(window)
+            {
+                AlignmentX = -1,
+                AlignmentY = -1,
+                WeightX = 1,
+                WeightY = 1,
+                IsHorizontal = true,
+            };
+            box.Show();
+
+            FlipSelector flip = new FlipSelector(window)
+            {
+                Interval = 1.0,
+            };
+
+            flip.Append("two");
+            flip.Prepend("one");
+
+            flip.Show();
+            box.PackEnd(flip);
+
+            conformant.SetContent(outterBox);
+            outterBox.PackEnd(box);
+
+            Button prev = new Button(window)
+            {
+                AlignmentX = -1,
+                WeightX = 1,
+                Text = "Prev"
+            };
+            prev.Clicked += (s, e) => { flip.Prev(); };
+            prev.Show();
+
+            Button next = new Button(window)
+            {
+                AlignmentX = -1,
+                WeightX = 1,
+                Text = "next"
+            };
+            next.Clicked += (s, e) => { flip.Next(); };
+            next.Show();
+
+            Button prepend = new Button(window)
+            {
+                AlignmentX = -1,
+                WeightX = 1,
+                Text = "prepend"
+            };
+            prepend.Clicked += (s, e) => {
+
+                var random = new Random();
+                int value = random.Next(99);
+                flip.Prepend(value.ToString());
+            };
+            prepend.Show();
+
+            Button append = new Button(window)
+            {
+                AlignmentX = -1,
+                WeightX = 1,
+                Text = "append"
+            };
+            append.Clicked += (s, e) => {
+
+                var random = new Random();
+                int value = random.Next(99);
+                flip.Append(value.ToString());
+            };
+            append.Show();
+
+            Button remove = new Button(window)
+            {
+                AlignmentX = -1,
+                WeightX = 1,
+                Text = "remove"
+            };
+            remove.Clicked += (s, e) => { flip.Remove(flip.SelectedItem); };
+            remove.Show();
+
+            outterBox.PackEnd(box);
+            outterBox.PackEnd(prev);
+            outterBox.PackEnd(next);
+            outterBox.PackEnd(append);
+            outterBox.PackEnd(prepend);
+            outterBox.PackEnd(remove);
+        }
+    }
+}