Fix Box.MinimumHeight issue
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / Table.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18
19 namespace ElmSharp
20 {
21     public class Table : Container
22     {
23         int _paddingX = 0;
24         int _paddingY = 0;
25
26         public Table(EvasObject parent) : base(parent)
27         {
28         }
29
30         public bool Homogeneous
31         {
32             get
33             {
34                 return Interop.Elementary.elm_table_homogeneous_get(RealHandle);
35             }
36             set
37             {
38                 Interop.Elementary.elm_table_homogeneous_set(RealHandle, value);
39             }
40         }
41
42         public int PaddingX
43         {
44             get
45             {
46                 return _paddingX;
47             }
48             set
49             {
50                 _paddingX = value;
51                 Interop.Elementary.elm_table_padding_set(RealHandle, _paddingX, _paddingY);
52             }
53         }
54
55         public int PaddingY
56         {
57             get
58             {
59                 return _paddingY;
60             }
61             set
62             {
63                 _paddingY = value;
64                 Interop.Elementary.elm_table_padding_set(RealHandle, _paddingX, _paddingY);
65             }
66         }
67
68         public void Pack(EvasObject obj, int col, int row, int colspan, int rowspan)
69         {
70             if (obj == null)
71                 throw new ArgumentNullException("obj");
72             Interop.Elementary.elm_table_pack(RealHandle, obj, col, row, colspan, rowspan);
73             AddChild(obj);
74         }
75
76         public void Unpack(EvasObject obj)
77         {
78             if (obj == null)
79                 throw new ArgumentNullException("obj");
80             Interop.Elementary.elm_table_unpack(RealHandle, obj);
81             RemoveChild(obj);
82         }
83
84         public void Clear()
85         {
86             Interop.Elementary.elm_table_clear(RealHandle, false);
87             ClearChildren();
88         }
89
90         protected override IntPtr CreateHandle(EvasObject parent)
91         {
92             IntPtr handle = Interop.Elementary.elm_layout_add(parent);
93             Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default");
94
95             RealHandle = Interop.Elementary.elm_table_add(handle);
96             Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);
97
98             return handle;
99         }
100     }
101 }