summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKangho Hur <kangho.hur@samsung.com>2017-03-09 22:53:31 -0800
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2017-03-09 22:53:31 -0800
commit9167e1ada0d152e3fbe6c79b3a45fc31a8ca81fc (patch)
tree483881ba0fbe1b817b54181ec77a8ad76acbdb21
parent176c66a504564f3b6452da978f59b11407c08b7f (diff)
parent98f1cc02c60e82673d0fa3d2d9d84b07ee349c37 (diff)
downloadelm-sharp-9167e1ada0d152e3fbe6c79b3a45fc31a8ca81fc.tar.gz
elm-sharp-9167e1ada0d152e3fbe6c79b3a45fc31a8ca81fc.tar.bz2
elm-sharp-9167e1ada0d152e3fbe6c79b3a45fc31a8ca81fc.zip
Merge "Add FloatingButton" into tizen
-rw-r--r--ElmSharp.Test/ElmSharp.Test.csproj3
-rwxr-xr-xElmSharp.Test/TC/FloatingButtonTest.cs143
-rwxr-xr-xElmSharp/ElmSharp.csproj4
-rwxr-xr-x[-rw-r--r--]ElmSharp/ElmSharp/FloatingButton.cs67
-rwxr-xr-xElmSharp/Interop/Interop.Eext.FloatingButton.cs48
-rwxr-xr-xElmSharp/Interop/Interop.Elementary.FloatingButton.cs27
6 files changed, 261 insertions, 31 deletions
diff --git a/ElmSharp.Test/ElmSharp.Test.csproj b/ElmSharp.Test/ElmSharp.Test.csproj
index ac57622..55aec94 100644
--- a/ElmSharp.Test/ElmSharp.Test.csproj
+++ b/ElmSharp.Test/ElmSharp.Test.csproj
@@ -46,6 +46,7 @@
<Compile Include="TC\DateTimeSelectorTest2.cs" />
<Compile Include="TC\EntryTest2.cs" />
<Compile Include="TC\FlipSelectorTest.cs" />
+ <Compile Include="TC\FloatingButtonTest.cs" />
<Compile Include="TC\GenListTest9.cs" />
<Compile Include="TC\FocusTest1.cs" />
<Compile Include="TC\HoverselTest1.cs" />
@@ -196,4 +197,4 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
-</Project> \ No newline at end of file
+</Project>
diff --git a/ElmSharp.Test/TC/FloatingButtonTest.cs b/ElmSharp.Test/TC/FloatingButtonTest.cs
new file mode 100755
index 0000000..fe43eb2
--- /dev/null
+++ b/ElmSharp.Test/TC/FloatingButtonTest.cs
@@ -0,0 +1,143 @@
+/*
+ * 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 ElmSharp;
+
+namespace ElmSharp.Test
+{
+ class FloatingButtonTest : TestCaseBase
+ {
+ public override string TestName => "FloatingButtonTest";
+ public override string TestDescription => "To test FloatingButton";
+
+ Button _RedButton = null;
+ Button _GreenButton = null;
+
+ public Button CreateButton(Window window, string text)
+ {
+ return new Button(window)
+ {
+ Text = text,
+ AlignmentY = -1,
+ AlignmentX = -1,
+ };
+ }
+
+ public override void Run(Window window)
+ {
+ Conformant conformant = new Conformant(window);
+ conformant.Show();
+ Box box = new Box(window)
+ {
+ AlignmentY = -1,
+ AlignmentX = -1,
+ WeightX = 1,
+ WeightY = 1,
+ };
+ box.Show();
+ conformant.SetContent(box);
+
+ FloatingButton floatingButton = new FloatingButton(window)
+ {
+ Mode = FloatingButton.FloatingButtonMode.All,
+ AlignmentY = -1,
+ AlignmentX = -1,
+ WeightX = 1,
+ WeightY = 1,
+ };
+ floatingButton.Show();
+ floatingButton.Resize(700, 700);
+ floatingButton.Move(0, 400);
+
+ Box backGround = new Box(window)
+ {
+ AlignmentY = -1,
+ AlignmentX = -1,
+ WeightX = 1,
+ WeightY = 1,
+ };
+ backGround.Show();
+
+ Button button1 = CreateButton(window, "Mode change to LeftRightOnly");
+ button1.Clicked += (s, e) => {
+ if (floatingButton.Mode == FloatingButton.FloatingButtonMode.All)
+ {
+ floatingButton.Mode = FloatingButton.FloatingButtonMode.LeftRightOnly;
+ button1.Text = "Mode change to All";
+ }
+ else
+ {
+ floatingButton.Mode = FloatingButton.FloatingButtonMode.All;
+ button1.Text = "Mode change to LeftRightOnly";
+ }
+ };
+ button1.Show();
+
+ Button button2 = CreateButton(window, "MovementBlock Set");
+ button2.Clicked += (s, e) => {
+ floatingButton.MovementBlock = !floatingButton.MovementBlock;
+ if (floatingButton.MovementBlock) button2.Text = "MovementBlock Unset";
+ else button2.Text = "MovementBlock Set";
+ };
+ button2.Show();
+
+ Button button3 = CreateButton(window, "RedButton Set");
+ button3.Clicked += (s, e) => {
+ if (_RedButton == null)
+ {
+ _RedButton = CreateButton(window, "RedButton");
+ _RedButton.BackgroundColor = Color.Red;
+ floatingButton.SetPartContent("button1", _RedButton, true);
+ button3.Text = "RedButton Unset";
+ }
+ else
+ {
+ _RedButton.Unrealize();
+ _RedButton = null;
+ floatingButton.SetPartContent("button1", _RedButton, true);
+ button3.Text = "RedButton Set";
+ }
+ };
+ button3.Show();
+
+ Button button4 = CreateButton(window, "GreenButton Set");
+ button4.Clicked += (s, e) => {
+ if (_GreenButton == null)
+ {
+ _GreenButton = CreateButton(window, "GreenButton");
+ _GreenButton.BackgroundColor = Color.Green;
+ floatingButton.SetPartContent("button2", _GreenButton, true);
+ button4.Text = "GreenButton Unset";
+ }
+ else
+ {
+ _GreenButton.Unrealize();
+ _GreenButton = null;
+ floatingButton.SetPartContent("button2", _GreenButton, true);
+ button4.Text = "GreenButton Unset";
+ }
+ };
+ button4.Show();
+
+ box.PackEnd(backGround);
+ box.PackEnd(button1);
+ box.PackEnd(button2);
+ box.PackEnd(button3);
+ box.PackEnd(button4);
+ }
+ }
+} \ No newline at end of file
diff --git a/ElmSharp/ElmSharp.csproj b/ElmSharp/ElmSharp.csproj
index c135b7c..2b2261d 100755
--- a/ElmSharp/ElmSharp.csproj
+++ b/ElmSharp/ElmSharp.csproj
@@ -117,6 +117,7 @@
<Compile Include="ElmSharp\Widget.cs" />
<Compile Include="ElmSharp\Window.cs" />
<Compile Include="ElmSharp\WrapType.cs" />
+ <Compile Include="Interop\Interop.Eext.FloatingButton.cs" />
<Compile Include="Interop\Interop.Eina.cs" />
<Compile Include="Interop\Interop.Elementary.Hoversel.cs" />
<Compile Include="Interop\Interop.Elementary.FlipSelector.cs" />
@@ -131,7 +132,6 @@
<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" />
@@ -181,4 +181,4 @@
<_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>
<AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
</PropertyGroup>
-</Project> \ No newline at end of file
+</Project>
diff --git a/ElmSharp/ElmSharp/FloatingButton.cs b/ElmSharp/ElmSharp/FloatingButton.cs
index 368eef3..30ae31b 100644..100755
--- a/ElmSharp/ElmSharp/FloatingButton.cs
+++ b/ElmSharp/ElmSharp/FloatingButton.cs
@@ -20,8 +20,46 @@ namespace ElmSharp
{
public class FloatingButton : Layout
{
+ SmartEvent _clicked;
+
public FloatingButton(EvasObject parent) : base(parent)
{
+ _clicked = new SmartEvent(this, Handle, "clicked");
+ _clicked.On += (s, e) => Clicked?.Invoke(this, EventArgs.Empty);
+ }
+
+ public event EventHandler Clicked;
+
+ public FloatingButtonMode Mode
+ {
+ get
+ {
+ return (FloatingButtonMode)Interop.Eext.eext_floatingbutton_mode_get(Handle);
+ }
+ set
+ {
+ Interop.Eext.eext_floatingbutton_mode_set(Handle, (int)value);
+ }
+ }
+
+ public FloatingButtonPosition Position
+ {
+ get
+ {
+ return (FloatingButtonPosition)Interop.Eext.eext_floatingbutton_pos_get(Handle);
+ }
+ }
+
+ public bool MovementBlock
+ {
+ get
+ {
+ return Interop.Eext.eext_floatingbutton_movement_block_get(Handle);
+ }
+ set
+ {
+ Interop.Eext.eext_floatingbutton_movement_block_set(Handle, value);
+ }
}
public override int Opacity
@@ -37,9 +75,36 @@ namespace ElmSharp
}
}
+ public void SetPosition(FloatingButtonPosition position, bool animated)
+ {
+ if (animated)
+ {
+ Interop.Eext.eext_floatingbutton_pos_bring_in(Handle, (int)position);
+ }
+ else
+ {
+ Interop.Eext.eext_floatingbutton_pos_set(Handle, (int)position);
+ }
+ }
+
protected override IntPtr CreateHandle(EvasObject parent)
{
return Interop.Eext.eext_floatingbutton_add(parent.Handle);
}
+
+ public enum FloatingButtonMode
+ {
+ All,
+ LeftRightOnly,
+ }
+
+ public enum FloatingButtonPosition
+ {
+ LeftOut,
+ Left,
+ Center,
+ Right,
+ RightOut,
+ }
}
-}
+} \ No newline at end of file
diff --git a/ElmSharp/Interop/Interop.Eext.FloatingButton.cs b/ElmSharp/Interop/Interop.Eext.FloatingButton.cs
new file mode 100755
index 0000000..7ecef6a
--- /dev/null
+++ b/ElmSharp/Interop/Interop.Eext.FloatingButton.cs
@@ -0,0 +1,48 @@
+/*
+ * 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 Eext
+ {
+ [DllImport(Libraries.Eext)]
+ internal static extern IntPtr eext_floatingbutton_add(IntPtr parent);
+
+ [DllImport(Libraries.Eext)]
+ internal static extern int eext_floatingbutton_mode_get(IntPtr floatingButton);
+
+ [DllImport(Libraries.Eext)]
+ internal static extern void eext_floatingbutton_mode_set(IntPtr floatingButton, int mode);
+
+ [DllImport(Libraries.Eext)]
+ internal static extern int eext_floatingbutton_pos_get(IntPtr floatingButton);
+
+ [DllImport(Libraries.Eext)]
+ internal static extern bool eext_floatingbutton_pos_set(IntPtr floatingButton, int position);
+
+ [DllImport(Libraries.Eext)]
+ internal static extern bool eext_floatingbutton_movement_block_get(IntPtr floatingButton);
+
+ [DllImport(Libraries.Eext)]
+ internal static extern void eext_floatingbutton_movement_block_set(IntPtr floatingButton, bool block);
+
+ [DllImport(Libraries.Eext)]
+ internal static extern bool eext_floatingbutton_pos_bring_in(IntPtr floatingButton, int posposition);
+ }
+} \ No newline at end of file
diff --git a/ElmSharp/Interop/Interop.Elementary.FloatingButton.cs b/ElmSharp/Interop/Interop.Elementary.FloatingButton.cs
deleted file mode 100755
index e65dafc..0000000
--- a/ElmSharp/Interop/Interop.Elementary.FloatingButton.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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 Eext
- {
- [DllImport(Libraries.Eext)]
- internal static extern IntPtr eext_floatingbutton_add(IntPtr obj);
- }
-}