diff options
author | JEONGHYUN YUN <jh0506.yun@samsung.com> | 2016-10-31 13:24:38 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2016-12-05 18:35:25 +0900 |
commit | 29ae5e9ea7a958ad411922275f23bd01e71adcd1 (patch) | |
tree | 1eb6b32b62632ca956b7b01d78eb0c44c71a9f66 /ElmSharp | |
parent | 10906f24247778391508603f6646640f90faf970 (diff) | |
download | elm-sharp-29ae5e9ea7a958ad411922275f23bd01e71adcd1.tar.gz elm-sharp-29ae5e9ea7a958ad411922275f23bd01e71adcd1.tar.bz2 elm-sharp-29ae5e9ea7a958ad411922275f23bd01e71adcd1.zip |
Added background color set API for Box
Change-Id: Ife6df16fb8bf03bef9c11a06a30bf55ad2541dd1
Signed-off-by: JEONGHYUN YUN <jh0506.yun@samsung.com>
Diffstat (limited to 'ElmSharp')
-rw-r--r-- | ElmSharp/ElmSharp/Box.cs | 29 | ||||
-rw-r--r-- | ElmSharp/ElmSharp/Container.cs | 5 | ||||
-rw-r--r-- | ElmSharp/theme/mobile/color_classes.edc | 7 | ||||
-rw-r--r-- | ElmSharp/theme/mobile/elm-sharp-theme-mobile.edc | 1 | ||||
-rw-r--r-- | ElmSharp/theme/mobile/widgets/layout.edc | 40 |
5 files changed, 72 insertions, 10 deletions
diff --git a/ElmSharp/ElmSharp/Box.cs b/ElmSharp/ElmSharp/Box.cs index 02ed3ad..f67d30d 100644 --- a/ElmSharp/ElmSharp/Box.cs +++ b/ElmSharp/ElmSharp/Box.cs @@ -22,46 +22,49 @@ namespace ElmSharp { private Interop.Elementary.BoxLayoutCallback _layoutCallback; - public Box(EvasObject parent) : base(parent) { } + public Box(EvasObject parent) : base(parent) + { + } + public bool IsHorizontal { get { - return Interop.Elementary.elm_box_horizontal_get(Handle); + return Interop.Elementary.elm_box_horizontal_get(GetRealHandle(Handle)); } set { - Interop.Elementary.elm_box_horizontal_set(Handle, value); + Interop.Elementary.elm_box_horizontal_set(GetRealHandle(Handle), value); } } public void PackEnd(EvasObject content) { - Interop.Elementary.elm_box_pack_end(Handle, content); + Interop.Elementary.elm_box_pack_end(GetRealHandle(Handle), content); AddChild(content); } public void PackStart(EvasObject content) { - Interop.Elementary.elm_box_pack_start(Handle, content); + Interop.Elementary.elm_box_pack_start(GetRealHandle(Handle), content); AddChild(content); } public void PackAfter(EvasObject content, EvasObject after) { - Interop.Elementary.elm_box_pack_after(Handle, content, after); + Interop.Elementary.elm_box_pack_after(GetRealHandle(Handle), content, after); AddChild(content); } public void UnPack(EvasObject content) { - Interop.Elementary.elm_box_unpack(Handle, content); + Interop.Elementary.elm_box_unpack(GetRealHandle(Handle), content); RemoveChild(content); } public void UnPackAll() { - Interop.Elementary.elm_box_unpack_all(Handle); + Interop.Elementary.elm_box_unpack_all(GetRealHandle(Handle)); ClearChildren(); } @@ -71,12 +74,18 @@ namespace ElmSharp { action(); }; - Interop.Elementary.elm_box_layout_set(Handle, _layoutCallback, IntPtr.Zero, null); + Interop.Elementary.elm_box_layout_set(GetRealHandle(Handle), _layoutCallback, IntPtr.Zero, null); } protected override IntPtr CreateHandle(EvasObject parent) { - return Interop.Elementary.elm_box_add(parent); + IntPtr handle = Interop.Elementary.elm_layout_add(parent); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default"); + + IntPtr realHandle = Interop.Elementary.elm_box_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", realHandle); + + return handle; } } } diff --git a/ElmSharp/ElmSharp/Container.cs b/ElmSharp/ElmSharp/Container.cs index 086f187..0cd27c0 100644 --- a/ElmSharp/ElmSharp/Container.cs +++ b/ElmSharp/ElmSharp/Container.cs @@ -27,6 +27,11 @@ namespace ElmSharp { } + protected virtual IntPtr GetRealHandle(IntPtr handle) + { + return Interop.Elementary.elm_object_part_content_get(handle, "elm.swallow.content"); + } + internal void AddChild(EvasObject obj) { _children.Add(obj); diff --git a/ElmSharp/theme/mobile/color_classes.edc b/ElmSharp/theme/mobile/color_classes.edc index f71991c..d10c93b 100644 --- a/ElmSharp/theme/mobile/color_classes.edc +++ b/ElmSharp/theme/mobile/color_classes.edc @@ -1,5 +1,12 @@ color_classes { /* + * Layout + */ + color_class { + name: "layout/background/bg"; + color: 0 0 0 0; + } + /* * Colorselector */ color_class { diff --git a/ElmSharp/theme/mobile/elm-sharp-theme-mobile.edc b/ElmSharp/theme/mobile/elm-sharp-theme-mobile.edc index 2a95234..d9baad4 100644 --- a/ElmSharp/theme/mobile/elm-sharp-theme-mobile.edc +++ b/ElmSharp/theme/mobile/elm-sharp-theme-mobile.edc @@ -87,6 +87,7 @@ collections { #include "widgets/entry.edc" #include "widgets/label.edc" #include "widgets/radio.edc" +#include "widgets/layout.edc" } diff --git a/ElmSharp/theme/mobile/widgets/layout.edc b/ElmSharp/theme/mobile/widgets/layout.edc new file mode 100644 index 0000000..4268a9f --- /dev/null +++ b/ElmSharp/theme/mobile/widgets/layout.edc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2010 Samsung Electronics Co., Ltd All Rights Reserved + * + * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +group { "elm/layout/background/default"; + parts { + rect { "bg"; + scale; + desc { "default"; + color_class: "layout/background/bg"; + } + } + swallow { "elm.swallow.content"; + scale; + desc { "default"; } + } + } +} |