diff options
author | chungryeol lim <cdark.lim@samsung.com> | 2016-12-16 14:54:29 +0900 |
---|---|---|
committer | chungryeol lim <cdark.lim@samsung.com> | 2016-12-26 21:44:51 +0900 |
commit | 25256d3af9366a33b82553a58dfb3b1da868d412 (patch) | |
tree | 2da10adfd853e3e2cc590db28ad1fc29d9f97593 /ElmSharp | |
parent | 61f9eb3847a0b33a00ef790745173d49d02bd389 (diff) | |
download | elm-sharp-25256d3af9366a33b82553a58dfb3b1da868d412.tar.gz elm-sharp-25256d3af9366a33b82553a58dfb3b1da868d412.tar.bz2 elm-sharp-25256d3af9366a33b82553a58dfb3b1da868d412.zip |
Add NaviItem.TitleBarBackgroundColor property
Change-Id: Ic444c2b7fda2c03de81e341604cac9f3ff65ad21
Signed-off-by: chungryeol lim <cdark.lim@samsung.com>
Diffstat (limited to 'ElmSharp')
-rw-r--r-- | ElmSharp/ElmSharp/ItemObject.cs | 15 | ||||
-rw-r--r-- | ElmSharp/ElmSharp/NaviItem.cs | 22 | ||||
-rwxr-xr-x | ElmSharp/Interop/Interop.Elementary.cs | 9 |
3 files changed, 46 insertions, 0 deletions
diff --git a/ElmSharp/ElmSharp/ItemObject.cs b/ElmSharp/ElmSharp/ItemObject.cs index 9b9847a..b2dbd58 100644 --- a/ElmSharp/ElmSharp/ItemObject.cs +++ b/ElmSharp/ElmSharp/ItemObject.cs @@ -109,6 +109,21 @@ namespace ElmSharp return Interop.Elementary.elm_object_item_part_text_get(Handle, part); } + public void SetPartColor(string part, Color color) + { + Interop.Elementary.elm_object_item_color_class_color_set(Handle, part, color.R * color.A / 255, + color.G * color.A / 255, + color.B * color.A / 255, + color.A); + } + + public Color GetPartColor(string part) + { + int r, g, b, a; + Interop.Elementary.elm_object_item_color_class_color_get(Handle, part, out r, out g, out b, out a); + return new Color((int)(r / (a / 255.0)), (int)(g / (a / 255.0)), (int)(b / (a / 255.0)), a); + } + public static implicit operator IntPtr(ItemObject obj) { if (obj == null) diff --git a/ElmSharp/ElmSharp/NaviItem.cs b/ElmSharp/ElmSharp/NaviItem.cs index d2be412..3e92445 100644 --- a/ElmSharp/ElmSharp/NaviItem.cs +++ b/ElmSharp/ElmSharp/NaviItem.cs @@ -22,6 +22,7 @@ namespace ElmSharp { EvasObject _content; bool _isPopped; + Color _barBackgroundColor = Color.Default; Interop.Elementary.Elm_Naviframe_Item_Pop_Cb _popped; NaviItem(IntPtr handle, EvasObject content) : base(handle) @@ -56,6 +57,27 @@ namespace ElmSharp } } + public Color TitleBarBackgroundColor + { + get + { + return _barBackgroundColor; + } + set + { + if (value.IsDefault) + { + Console.WriteLine("ItemObject instance doesn't support to set TitleBarBackgroundColor to Color.Default."); + //TODO. Soon we will support the "elm_object_item_color_class_del" function in EFL. + } + else + { + SetPartColor("bg_title", value); + _barBackgroundColor = value; + } + } + } + protected override void OnInvalidate() { if (!_isPopped) diff --git a/ElmSharp/Interop/Interop.Elementary.cs b/ElmSharp/Interop/Interop.Elementary.cs index c96a471..4488d14 100755 --- a/ElmSharp/Interop/Interop.Elementary.cs +++ b/ElmSharp/Interop/Interop.Elementary.cs @@ -173,6 +173,15 @@ internal static partial class Interop } [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_color_class_color_set(IntPtr it, string part, int r, int g, int b, int a); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_color_class_color_get(IntPtr obj, string part, out int r, out int g, out int b, out int a); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_color_class_del(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] internal static extern void elm_object_item_part_text_set(IntPtr obj, string part, string label); [DllImport(Libraries.Elementary)] |