From 02ca327cc3ed22267c8cf5fd7a577a9995607f8e Mon Sep 17 00:00:00 2001 From: "jh5.cho" Date: Thu, 16 Feb 2017 10:21:35 +0900 Subject: [PATCH] Add Additional Method for ColorSelector - Following ColorSelector methods are added: AddPaletteColor(), ClearPalette() - New methods are added to implement RFC16, ColorPickerControl http://suprem.sec.samsung.net/confluence/display/SPTDTLC/%5BFormsTizen%5D+RFC+16+-+ColorPickerControl Change-Id: I224c4fca1f87d2edc68974de4818126f42792f77 --- ElmSharp/ElmSharp.csproj | 1 + ElmSharp/ElmSharp/ColorSelector.cs | 12 ++++++ ElmSharp/ElmSharp/ColorSelectorItem.cs | 44 ++++++++++++++++++++++ ElmSharp/Interop/Interop.Elementary.ColorPicker.cs | 2 +- 4 files changed, 58 insertions(+), 1 deletion(-) mode change 100644 => 100755 ElmSharp/ElmSharp/ColorSelector.cs create mode 100755 ElmSharp/ElmSharp/ColorSelectorItem.cs mode change 100644 => 100755 ElmSharp/Interop/Interop.Elementary.ColorPicker.cs diff --git a/ElmSharp/ElmSharp.csproj b/ElmSharp/ElmSharp.csproj index 463f68a..cc0f20c 100755 --- a/ElmSharp/ElmSharp.csproj +++ b/ElmSharp/ElmSharp.csproj @@ -56,6 +56,7 @@ + diff --git a/ElmSharp/ElmSharp/ColorSelector.cs b/ElmSharp/ElmSharp/ColorSelector.cs old mode 100644 new mode 100755 index 1b0d251..524a96f --- a/ElmSharp/ElmSharp/ColorSelector.cs +++ b/ElmSharp/ElmSharp/ColorSelector.cs @@ -88,6 +88,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/ElmSharp/ElmSharp/ColorSelectorItem.cs b/ElmSharp/ElmSharp/ColorSelectorItem.cs new file mode 100755 index 0000000..4ee5f7a --- /dev/null +++ b/ElmSharp/ElmSharp/ColorSelectorItem.cs @@ -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); + } + } + } + } +} diff --git a/ElmSharp/Interop/Interop.Elementary.ColorPicker.cs b/ElmSharp/Interop/Interop.Elementary.ColorPicker.cs old mode 100644 new mode 100755 index b61c98b..231fc9d --- a/ElmSharp/Interop/Interop.Elementary.ColorPicker.cs +++ b/ElmSharp/Interop/Interop.Elementary.ColorPicker.cs @@ -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); -- 2.7.4