2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 public class Box : Container
23 private Interop.Elementary.BoxLayoutCallback _layoutCallback;
25 public Box(EvasObject parent) : base(parent)
29 public bool IsHorizontal
33 return Interop.Elementary.elm_box_horizontal_get(RealHandle);
37 Interop.Elementary.elm_box_horizontal_set(RealHandle, value);
41 public void PackEnd(EvasObject content)
43 Interop.Elementary.elm_box_pack_end(RealHandle, content);
47 public void PackStart(EvasObject content)
49 Interop.Elementary.elm_box_pack_start(RealHandle, content);
53 public void PackAfter(EvasObject content, EvasObject after)
55 Interop.Elementary.elm_box_pack_after(RealHandle, content, after);
59 public void UnPack(EvasObject content)
61 Interop.Elementary.elm_box_unpack(RealHandle, content);
65 public void UnPackAll()
67 Interop.Elementary.elm_box_unpack_all(RealHandle);
71 public void SetLayoutCallback(Action action)
73 _layoutCallback = (obj, priv, data) =>
77 Interop.Elementary.elm_box_layout_set(RealHandle, _layoutCallback, IntPtr.Zero, null);
80 public override void SetPartColor(string part, Color color)
82 Interop.Elementary.elm_object_color_class_color_set(Handle, part, color.R * color.A / 255,
83 color.G * color.A / 255,
84 color.B * color.A / 255,
88 public override Color GetPartColor(string part)
91 Interop.Elementary.elm_object_color_class_color_get(Handle, part, out r, out g, out b, out a);
92 return new Color((int)(r / (a / 255.0)), (int)(g / (a / 255.0)), (int)(b / (a / 255.0)), a);
95 protected override IntPtr CreateHandle(EvasObject parent)
97 IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
98 Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default");
100 RealHandle = Interop.Elementary.elm_box_add(handle);
101 Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);