English Review: NUI_BaseComponents (#422)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TableView.cs
1 /*
2  * Copyright(c) 2017 Samsung Electronics Co., Ltd.
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
18 using System;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
22
23 namespace Tizen.NUI.BaseComponents
24 {
25
26     /// <summary>
27     /// TableView is a layout container for aligning child actors in a grid like layout.<br />
28     /// TableView constraints the X and the Y position and the width and the height of the child actors.<br />
29     /// The Z position and depth are left intact so that the 3D model actors can also be laid out
30     /// in a grid without loosing their depth scaling.<br />
31     /// </summary>
32     /// <since_tizen> 3 </since_tizen>
33     public class TableView : View
34     {
35         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
36         [EditorBrowsable(EditorBrowsableState.Never)]
37         public static readonly BindableProperty RowsProperty = BindableProperty.Create("Rows", typeof(int), typeof(TableView), default(int), propertyChanged: (bindable, oldValue, newValue) =>
38         {
39             var tableView = (TableView)bindable;
40             if (newValue != null)
41             {
42                 Tizen.NUI.Object.SetProperty(tableView.swigCPtr, TableView.Property.ROWS, new Tizen.NUI.PropertyValue((int)newValue));
43             }
44         },
45         defaultValueCreator:(bindable) =>
46         {
47             var tableView = (TableView)bindable;
48             int temp = 0;
49             Tizen.NUI.Object.GetProperty(tableView.swigCPtr, TableView.Property.ROWS).Get(out temp);
50             return temp;
51         });
52         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
53         [EditorBrowsable(EditorBrowsableState.Never)]
54         public static readonly BindableProperty ColumnsProperty = BindableProperty.Create("Columns", typeof(int), typeof(TableView), default(int), propertyChanged: (bindable, oldValue, newValue) =>
55         {
56             var tableView = (TableView)bindable;
57             if (newValue != null)
58             {
59                 Tizen.NUI.Object.SetProperty(tableView.swigCPtr, TableView.Property.COLUMNS, new Tizen.NUI.PropertyValue((int)newValue));
60             }
61         },
62         defaultValueCreator:(bindable) =>
63         {
64             var tableView = (TableView)bindable;
65             int temp = 0;
66             Tizen.NUI.Object.GetProperty(tableView.swigCPtr, TableView.Property.COLUMNS).Get(out temp);
67             return temp;
68         });
69         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
70         [EditorBrowsable(EditorBrowsableState.Never)]
71         public static readonly BindableProperty CellPaddingProperty = BindableProperty.Create("CellPadding", typeof(Vector2), typeof(TableView), Vector2.Zero, propertyChanged: (bindable, oldValue, newValue) =>
72         {
73             var tableView = (TableView)bindable;
74             if (newValue != null)
75             {
76                 Tizen.NUI.Object.SetProperty(tableView.swigCPtr, TableView.Property.CELL_PADDING, new Tizen.NUI.PropertyValue((Vector2)newValue));
77             }
78         },
79         defaultValueCreator:(bindable) =>
80         {
81             var tableView = (TableView)bindable;
82             Vector2 temp = new Vector2(0.0f, 0.0f);
83             Tizen.NUI.Object.GetProperty(tableView.swigCPtr, TableView.Property.CELL_PADDING).Get(temp);
84             return temp;
85         });
86         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
87         [EditorBrowsable(EditorBrowsableState.Never)]
88         public static readonly BindableProperty LayoutRowsProperty = BindableProperty.Create("LayoutRows", typeof(PropertyMap), typeof(TableView), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
89         {
90             var tableView = (TableView)bindable;
91             if (newValue != null)
92             {
93                 Tizen.NUI.Object.SetProperty(tableView.swigCPtr, TableView.Property.LAYOUT_ROWS, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
94             }
95         },
96         defaultValueCreator:(bindable) =>
97         {
98             var tableView = (TableView)bindable;
99             PropertyMap temp = new PropertyMap();
100             Tizen.NUI.Object.GetProperty(tableView.swigCPtr, TableView.Property.LAYOUT_ROWS).Get(temp);
101             return temp;
102         });
103         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
104         [EditorBrowsable(EditorBrowsableState.Never)]
105         public static readonly BindableProperty LayoutColumnsProperty = BindableProperty.Create("LayoutColumns", typeof(PropertyMap), typeof(TableView), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
106         {
107             var tableView = (TableView)bindable;
108             if (newValue != null)
109             {
110                 Tizen.NUI.Object.SetProperty(tableView.swigCPtr, TableView.Property.LAYOUT_COLUMNS, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
111             }
112         },
113         defaultValueCreator:(bindable) =>
114         {
115             var tableView = (TableView)bindable;
116             PropertyMap temp = new PropertyMap();
117             Tizen.NUI.Object.GetProperty(tableView.swigCPtr, TableView.Property.LAYOUT_COLUMNS).Get(temp);
118             return temp;
119         });
120
121
122         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
123
124         internal TableView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TableView_SWIGUpcast(cPtr), cMemoryOwn)
125         {
126             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
127         }
128
129         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TableView obj)
130         {
131             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
132         }
133
134         /// <summary>
135         /// Dispose
136         /// </summary>
137         /// <param name="type">The dispose type</param>
138         /// <since_tizen> 3 </since_tizen>
139         protected override void Dispose(DisposeTypes type)
140         {
141             if (disposed)
142             {
143                 return;
144             }
145
146             if (type == DisposeTypes.Explicit)
147             {
148                 //Called by User
149                 //Release your own managed resources here.
150                 //You should release all of your own disposable objects here.
151             }
152
153             //Release your own unmanaged resources here.
154             //You should not access any managed member here except static instance.
155             //because the execution order of Finalizes is non-deterministic.
156
157             if (swigCPtr.Handle != global::System.IntPtr.Zero)
158             {
159                 if (swigCMemOwn)
160                 {
161                     swigCMemOwn = false;
162                     NDalicPINVOKE.delete_TableView(swigCPtr);
163                 }
164                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
165             }
166
167             base.Dispose(type);
168         }
169
170
171         internal new class Property
172         {
173             internal static readonly int ROWS = NDalicPINVOKE.TableView_Property_ROWS_get();
174             internal static readonly int COLUMNS = NDalicPINVOKE.TableView_Property_COLUMNS_get();
175             internal static readonly int CELL_PADDING = NDalicPINVOKE.TableView_Property_CELL_PADDING_get();
176             internal static readonly int LAYOUT_ROWS = NDalicPINVOKE.TableView_Property_LAYOUT_ROWS_get();
177             internal static readonly int LAYOUT_COLUMNS = NDalicPINVOKE.TableView_Property_LAYOUT_COLUMNS_get();
178         }
179
180         internal class ChildProperty
181         {
182             internal static readonly int CELL_INDEX = NDalicPINVOKE.TableView_ChildProperty_CELL_INDEX_get();
183             internal static readonly int ROW_SPAN = NDalicPINVOKE.TableView_ChildProperty_ROW_SPAN_get();
184             internal static readonly int COLUMN_SPAN = NDalicPINVOKE.TableView_ChildProperty_COLUMN_SPAN_get();
185             internal static readonly int CELL_HORIZONTAL_ALIGNMENT = NDalicPINVOKE.TableView_ChildProperty_CELL_HORIZONTAL_ALIGNMENT_get();
186             internal static readonly int CELL_VERTICAL_ALIGNMENT = NDalicPINVOKE.TableView_ChildProperty_CELL_VERTICAL_ALIGNMENT_get();
187         }
188
189         /// <summary>
190         /// Class to specify the layout position for the child view.
191         /// </summary>
192         /// <since_tizen> 3 </since_tizen>
193         public class CellPosition : global::System.IDisposable
194         {
195             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
196             /// <summary>
197             /// swigCMemOwn
198             /// </summary>
199             /// <since_tizen> 3 </since_tizen>
200             protected bool swigCMemOwn;
201
202             internal CellPosition(global::System.IntPtr cPtr, bool cMemoryOwn)
203             {
204                 swigCMemOwn = cMemoryOwn;
205                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
206             }
207
208             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CellPosition obj)
209             {
210                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
211             }
212
213             //A Flag to check who called Dispose(). (By User or DisposeQueue)
214             private bool isDisposeQueued = false;
215             /// <summary>
216             /// A Flat to check if it is already disposed.
217             /// </summary>
218             /// <since_tizen> 3 </since_tizen>
219             protected bool disposed = false;
220
221             /// <summary>
222             /// Dispose.
223             /// </summary>
224             /// <since_tizen> 3 </since_tizen>
225             ~CellPosition()
226             {
227                 if (!isDisposeQueued)
228                 {
229                     isDisposeQueued = true;
230                     DisposeQueue.Instance.Add(this);
231                 }
232             }
233
234             /// <summary>
235             /// Dispose.
236             /// </summary>
237             /// <since_tizen> 3 </since_tizen>
238             public void Dispose()
239             {
240                 //Throw excpetion if Dispose() is called in separate thread.
241                 if (!Window.IsInstalled())
242                 {
243                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
244                 }
245
246                 if (isDisposeQueued)
247                 {
248                     Dispose(DisposeTypes.Implicit);
249                 }
250                 else
251                 {
252                     Dispose(DisposeTypes.Explicit);
253                     System.GC.SuppressFinalize(this);
254                 }
255             }
256
257             /// <summary>
258             /// Dispose.
259             /// </summary>
260             /// <param name="type">DisposeTypes</param>
261             /// <since_tizen> 3 </since_tizen>
262             protected virtual void Dispose(DisposeTypes type)
263             {
264                 if (disposed)
265                 {
266                     return;
267                 }
268
269                 if (type == DisposeTypes.Explicit)
270                 {
271                     //Called by User
272                     //Release your own managed resources here.
273                     //You should release all of your own disposable objects here.
274                 }
275
276                 //Release your own unmanaged resources here.
277                 //You should not access any managed member here except static instance.
278                 //because the execution order of Finalizes is non-deterministic.
279
280                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
281                 {
282                     if (swigCMemOwn)
283                     {
284                         swigCMemOwn = false;
285                         NDalicPINVOKE.delete_TableView_CellPosition(swigCPtr);
286                     }
287                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
288                 }
289                 disposed = true;
290             }
291
292             /// <summary>
293             /// The constructor.
294             /// </summary>
295             /// <param name="rowIndex">The row index initialized.</param>
296             /// <param name="columnIndex">The column index initialized.</param>
297             /// <param name="rowSpan">The row span initialized.</param>
298             /// <param name="columnSpan">The column span initialized.</param>
299             /// <since_tizen> 3 </since_tizen>
300             public CellPosition(uint rowIndex, uint columnIndex, uint rowSpan, uint columnSpan) : this(NDalicPINVOKE.new_TableView_CellPosition__SWIG_0(rowIndex, columnIndex, rowSpan, columnSpan), true)
301             {
302                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
303             }
304
305             /// <summary>
306             /// The constructor to initialize values to defaults for convenience.
307             /// </summary>
308             /// <param name="rowIndex">The row index initialized.</param>
309             /// <param name="columnIndex">The column index initialized.</param>
310             /// <param name="rowSpan">The row span initialized.</param>
311             /// <since_tizen> 3 </since_tizen>
312             public CellPosition(uint rowIndex, uint columnIndex, uint rowSpan) : this(NDalicPINVOKE.new_TableView_CellPosition__SWIG_1(rowIndex, columnIndex, rowSpan), true)
313             {
314                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
315             }
316
317             /// <summary>
318             /// The constructor to initialize values to defaults for convenience.
319             /// </summary>
320             /// <param name="rowIndex">The row index initialized.</param>
321             /// <param name="columnIndex">The column index initialized.</param>
322             /// <since_tizen> 3 </since_tizen>
323             public CellPosition(uint rowIndex, uint columnIndex) : this(NDalicPINVOKE.new_TableView_CellPosition__SWIG_2(rowIndex, columnIndex), true)
324             {
325                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
326             }
327
328             /// <summary>
329             /// The constructor to initialize values to default for convenience.
330             /// </summary>
331             /// <param name="rowIndex">The row index initialized.</param>
332             /// <since_tizen> 3 </since_tizen>
333             public CellPosition(uint rowIndex) : this(NDalicPINVOKE.new_TableView_CellPosition__SWIG_3(rowIndex), true)
334             {
335                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
336             }
337
338             /// <summary>
339             /// The default constructor.
340             /// </summary>
341             /// <since_tizen> 3 </since_tizen>
342             public CellPosition() : this(NDalicPINVOKE.new_TableView_CellPosition__SWIG_4(), true)
343             {
344                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
345             }
346
347             /// <summary>
348             /// The index of a row.
349             /// </summary>
350             /// <since_tizen> 3 </since_tizen>
351             [Obsolete("Please do not use! This will be deprecated! Please use RowIndex instead!")]
352             [EditorBrowsable(EditorBrowsableState.Never)]
353             public uint rowIndex
354             {
355                 set
356                 {
357                     NDalicPINVOKE.TableView_CellPosition_rowIndex_set(swigCPtr, value);
358                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
359                 }
360                 get
361                 {
362                     uint ret = NDalicPINVOKE.TableView_CellPosition_rowIndex_get(swigCPtr);
363                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
364                     return ret;
365                 }
366             }
367
368             /// <summary>
369             /// The index or position of a row.
370             /// </summary>
371             /// <since_tizen> 5 </since_tizen>
372             /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
373             [EditorBrowsable(EditorBrowsableState.Never)]
374             public uint RowIndex
375             {
376                 get
377                 {
378                     uint ret = NDalicPINVOKE.TableView_CellPosition_rowIndex_get(swigCPtr);
379                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
380                     return ret;
381                 }
382             }
383
384
385             /// <summary>
386             /// The index of a column.
387             /// </summary>
388             /// <since_tizen> 3 </since_tizen>
389             [Obsolete("Please do not use! This will be deprecated! Please use ColumnIndex instead!")]
390             [EditorBrowsable(EditorBrowsableState.Never)]
391             public uint columnIndex
392             {
393                 set
394                 {
395                     NDalicPINVOKE.TableView_CellPosition_columnIndex_set(swigCPtr, value);
396                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
397                 }
398                 get
399                 {
400                     uint ret = NDalicPINVOKE.TableView_CellPosition_columnIndex_get(swigCPtr);
401                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
402                     return ret;
403                 }
404             }
405
406             /// <summary>
407             /// The index or position of a column.
408             /// </summary>
409             /// <since_tizen> 5 </since_tizen>
410             /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
411             [EditorBrowsable(EditorBrowsableState.Never)]
412             public uint ColumnIndex
413             {
414                 get
415                 {
416                     uint ret = NDalicPINVOKE.TableView_CellPosition_columnIndex_get(swigCPtr);
417                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
418                     return ret;
419                 }
420             }
421
422             /// <summary>
423             /// The span of a row.
424             /// </summary>
425             /// <since_tizen> 3 </since_tizen>
426             [Obsolete("Please do not use! This will be deprecated! Please use RowSpan instead!")]
427             [EditorBrowsable(EditorBrowsableState.Never)]
428             public uint rowSpan
429             {
430                 set
431                 {
432                     NDalicPINVOKE.TableView_CellPosition_rowSpan_set(swigCPtr, value);
433                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
434                 }
435                 get
436                 {
437                     uint ret = NDalicPINVOKE.TableView_CellPosition_rowSpan_get(swigCPtr);
438                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
439                     return ret;
440                 }
441             }
442
443             /// <summary>
444             /// The span of a row.
445             /// </summary>
446             /// <since_tizen> 5 </since_tizen>
447             /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
448             [EditorBrowsable(EditorBrowsableState.Never)]
449             public uint RowSpan
450             {
451                 get
452                 {
453                     uint ret = NDalicPINVOKE.TableView_CellPosition_rowSpan_get(swigCPtr);
454                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
455                     return ret;
456                 }
457             }
458
459             /// <summary>
460             /// The span of a column.
461             /// </summary>
462             /// <since_tizen> 3 </since_tizen>
463             [Obsolete("Please do not use! This will be deprecated! Please use ColumnSpan instead!")]
464             [EditorBrowsable(EditorBrowsableState.Never)]
465             public uint columnSpan
466             {
467                 set
468                 {
469                     NDalicPINVOKE.TableView_CellPosition_columnSpan_set(swigCPtr, value);
470                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
471                 }
472                 get
473                 {
474                     uint ret = NDalicPINVOKE.TableView_CellPosition_columnSpan_get(swigCPtr);
475                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
476                     return ret;
477                 }
478             }
479
480             /// <summary>
481             /// The span of a column.
482             /// </summary>
483             /// <since_tizen> 5 </since_tizen>
484             /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
485             [EditorBrowsable(EditorBrowsableState.Never)]
486             public uint ColumnSpan
487             {
488                 get
489                 {
490                     uint ret = NDalicPINVOKE.TableView_CellPosition_columnSpan_get(swigCPtr);
491                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
492                     return ret;
493                 }
494             }
495
496
497         }
498
499         /// <summary>
500         /// Creates the default TableView view.
501         /// </summary>
502         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
503         [EditorBrowsable(EditorBrowsableState.Never)]
504         public TableView() : this(NDalicPINVOKE.TableView_New(1, 1), true)
505         {
506             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
507         }
508
509         /// <summary>
510         /// Creates the TableView view.
511         /// </summary>
512         /// <param name="initialRows">Initial rows for the table.</param>
513         /// <param name="initialColumns">Initial columns for the table.</param>
514         /// <since_tizen> 3 </since_tizen>
515         public TableView(uint initialRows, uint initialColumns) : this(NDalicPINVOKE.TableView_New(initialRows, initialColumns), true)
516         {
517             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
518
519         }
520
521         /// <summary>
522         /// The Copy constructor. Creates another handle that points to the same real object.
523         /// </summary>
524         /// <param name="handle">Handle to copy from.</param>
525         /// <since_tizen> 3 </since_tizen>
526         public TableView(TableView handle) : this(NDalicPINVOKE.new_TableView__SWIG_1(TableView.getCPtr(handle)), true)
527         {
528             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
529         }
530
531         /// <summary>
532         /// Adds a child to the table.<br />
533         /// If the row or column index is outside the table, the table gets resized bigger.<br />
534         /// </summary>
535         /// <param name="child">The child to add.</param>
536         /// <param name="position">The position for the child.</param>
537         /// <returns>True if the addition succeeded, and false if the cell is already occupied.</returns>
538         /// <since_tizen> 3 </since_tizen>
539         public bool AddChild(View child, TableView.CellPosition position)
540         {
541             bool ret = NDalicPINVOKE.TableView_AddChild(swigCPtr, View.getCPtr(child), TableView.CellPosition.getCPtr(position));
542             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
543             return ret;
544         }
545
546         /// <summary>
547         /// Returns a child from the given layout position.
548         /// </summary>
549         /// <param name="position">The position in the table.</param>
550         /// <returns>Child that was in the cell or an uninitialized handle.</returns>
551         /// <since_tizen> 3 </since_tizen>
552         public View GetChildAt(TableView.CellPosition position)
553         {
554             //to fix memory leak issue, match the handle count with native side.
555             IntPtr cPtr = NDalicPINVOKE.TableView_GetChildAt(swigCPtr, TableView.CellPosition.getCPtr(position));
556             HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
557             View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View;
558             NDalicPINVOKE.delete_BaseHandle(CPtr);
559             CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
560
561             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
562             return ret;
563         }
564
565         /// <summary>
566         /// Removes a child from the given layout position.
567         /// </summary>
568         /// <param name="position">The position for the child to remove.</param>
569         /// <returns>Child that was removed or an uninitialized handle.</returns>
570         /// <since_tizen> 3 </since_tizen>
571         public View RemoveChildAt(TableView.CellPosition position)
572         {
573             //to fix memory leak issue, match the handle count with native side.
574             IntPtr cPtr = NDalicPINVOKE.TableView_RemoveChildAt(swigCPtr, TableView.CellPosition.getCPtr(position));
575             HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
576             View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View;
577             NDalicPINVOKE.delete_BaseHandle(CPtr);
578             CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
579
580             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
581             return ret;
582         }
583
584         /// <summary>
585         /// Finds the child's layout position.
586         /// </summary>
587         /// <param name="child">The child to search for.</param>
588         /// <param name="position">The position for the child.</param>
589         /// <returns>True if the child was included in this TableView.</returns>
590         /// <since_tizen> 3 </since_tizen>
591         public bool FindChildPosition(View child, TableView.CellPosition position)
592         {
593             bool ret = NDalicPINVOKE.TableView_FindChildPosition(swigCPtr, View.getCPtr(child), TableView.CellPosition.getCPtr(position));
594             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
595             return ret;
596         }
597
598         /// <summary>
599         /// Inserts a new row to the given index.
600         /// </summary>
601         /// <param name="rowIndex">The rowIndex of the new row.</param>
602         /// <since_tizen> 3 </since_tizen>
603         public void InsertRow(uint rowIndex)
604         {
605             NDalicPINVOKE.TableView_InsertRow(swigCPtr, rowIndex);
606             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
607         }
608
609         /// <summary>
610         /// Deletes a row from the given index.<br />
611         /// Removed elements are deleted.<br />
612         /// </summary>
613         /// <param name="rowIndex">The rowIndex of the row to delete.</param>
614         /// <since_tizen> 3 </since_tizen>
615         public void DeleteRow(uint rowIndex)
616         {
617             NDalicPINVOKE.TableView_DeleteRow__SWIG_0(swigCPtr, rowIndex);
618             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
619         }
620
621         /// <summary>
622         /// Inserts a new column to the given index.
623         /// </summary>
624         /// <param name="columnIndex">The columnIndex of the new column.</param>
625         /// <since_tizen> 3 </since_tizen>
626         public void InsertColumn(uint columnIndex)
627         {
628             NDalicPINVOKE.TableView_InsertColumn(swigCPtr, columnIndex);
629             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
630         }
631
632         /// <summary>
633         /// Deletes a column from the given index.<br />
634         /// Removed elements are deleted.<br />
635         /// </summary>
636         /// <param name="columnIndex">The columnIndex of the column to delete.</param>
637         /// <since_tizen> 3 </since_tizen>
638         public void DeleteColumn(uint columnIndex)
639         {
640             NDalicPINVOKE.TableView_DeleteColumn__SWIG_0(swigCPtr, columnIndex);
641             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
642         }
643
644         /// <summary>
645         /// Resizes the TableView.
646         /// </summary>
647         /// <param name="rows">The rows for the table.</param>
648         /// <param name="columns">The columns for the table.</param>
649         /// <since_tizen> 3 </since_tizen>
650         public void Resize(uint rows, uint columns)
651         {
652             NDalicPINVOKE.TableView_Resize__SWIG_0(swigCPtr, rows, columns);
653             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
654         }
655
656         /// <summary>
657         /// Sets the horizontal and the vertical padding between cells.
658         /// </summary>
659         /// <param name="padding">Width and height.</param>
660         /// <since_tizen> 3 </since_tizen>
661         public void SetCellPadding(Size2D padding)
662         {
663             NDalicPINVOKE.TableView_SetCellPadding(swigCPtr, Size2D.getCPtr(padding));
664             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
665         }
666
667         /// <summary>
668         /// Gets the current padding as width and height.
669         /// </summary>
670         /// <returns>The current padding as width and height.</returns>
671         /// <since_tizen> 3 </since_tizen>
672         public Vector2 GetCellPadding()
673         {
674             Vector2 ret = new Vector2(NDalicPINVOKE.TableView_GetCellPadding(swigCPtr), true);
675             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
676             return ret;
677         }
678
679         /// <summary>
680         /// Specifies this row as fitting its height to its children.
681         /// </summary>
682         /// <param name="rowIndex">The row to set.</param>
683         /// <since_tizen> 3 </since_tizen>
684         public void SetFitHeight(uint rowIndex)
685         {
686             NDalicPINVOKE.TableView_SetFitHeight(swigCPtr, rowIndex);
687             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
688         }
689
690         /// <summary>
691         /// Checks if the row is a fit row.
692         /// </summary>
693         /// <param name="rowIndex">The row to check.</param>
694         /// <returns>True if the row is fit.</returns>
695         /// <since_tizen> 3 </since_tizen>
696         public bool IsFitHeight(uint rowIndex)
697         {
698             bool ret = NDalicPINVOKE.TableView_IsFitHeight(swigCPtr, rowIndex);
699             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
700             return ret;
701         }
702
703         /// <summary>
704         /// Specifies this column as fitting its width to its children.
705         /// </summary>
706         /// <param name="columnIndex">The column to set.</param>
707         /// <since_tizen> 3 </since_tizen>
708         public void SetFitWidth(uint columnIndex)
709         {
710             NDalicPINVOKE.TableView_SetFitWidth(swigCPtr, columnIndex);
711             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
712         }
713
714         /// <summary>
715         /// Checks if the column is a fit column.
716         /// </summary>
717         /// <param name="columnIndex">The column to check.</param>
718         /// <returns>True if the column is fit.</returns>
719         /// <since_tizen> 3 </since_tizen>
720         public bool IsFitWidth(uint columnIndex)
721         {
722             bool ret = NDalicPINVOKE.TableView_IsFitWidth(swigCPtr, columnIndex);
723             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
724             return ret;
725         }
726
727         /// <summary>
728         /// Sets a row to have a fixed height.<br />
729         /// Setting a fixed height of 0 has no effect.<br />
730         /// </summary>
731         /// <param name="rowIndex">The rowIndex for row with a fixed height.</param>
732         /// <param name="height">The height in world coordinate units.</param>
733         /// <since_tizen> 3 </since_tizen>
734         public void SetFixedHeight(uint rowIndex, float height)
735         {
736             NDalicPINVOKE.TableView_SetFixedHeight(swigCPtr, rowIndex, height);
737             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
738         }
739
740         /// <summary>
741         /// Gets a row's fixed height.
742         /// </summary>
743         /// <param name="rowIndex">The row index with a fixed height.</param>
744         /// <returns>height The height in world coordinate units.</returns>
745         /// <since_tizen> 3 </since_tizen>
746         public float GetFixedHeight(uint rowIndex)
747         {
748             float ret = NDalicPINVOKE.TableView_GetFixedHeight(swigCPtr, rowIndex);
749             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
750             return ret;
751         }
752
753         /// <summary>
754         /// Sets a row to have a relative height. Relative height means percentage of
755         /// the remainder of the table height after subtracting padding and fixed height rows.<br />
756         /// Setting a relative height of 0 has no effect.<br />
757         /// </summary>
758         /// <param name="rowIndex">The rowIndex for row with a relative height.</param>
759         /// <param name="heightPercentage">The height percentage between 0.0f and 1.0f.</param>
760         /// <since_tizen> 3 </since_tizen>
761         public void SetRelativeHeight(uint rowIndex, float heightPercentage)
762         {
763             NDalicPINVOKE.TableView_SetRelativeHeight(swigCPtr, rowIndex, heightPercentage);
764             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
765         }
766
767         /// <summary>
768         /// Gets a row's relative height.
769         /// </summary>
770         /// <param name="rowIndex">The row index with a relative height.</param>
771         /// <returns>Height in percentage units, between 0.0f and 1.0f.</returns>
772         /// <since_tizen> 3 </since_tizen>
773         public float GetRelativeHeight(uint rowIndex)
774         {
775             float ret = NDalicPINVOKE.TableView_GetRelativeHeight(swigCPtr, rowIndex);
776             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777             return ret;
778         }
779
780         /// <summary>
781         /// Sets a column to have a fixed width.<br />
782         /// Setting a fixed width of 0 has no effect.<br />
783         /// </summary>
784         /// <param name="columnIndex">The columnIndex for column with a fixed width.</param>
785         /// <param name="width">The width in world coordinate units.</param>
786         /// <since_tizen> 3 </since_tizen>
787         public void SetFixedWidth(uint columnIndex, float width)
788         {
789             NDalicPINVOKE.TableView_SetFixedWidth(swigCPtr, columnIndex, width);
790             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
791         }
792
793         /// <summary>
794         /// Gets a column's fixed width.
795         /// </summary>
796         /// <param name="columnIndex">The column index with a fixed width.</param>
797         /// <returns>Width in world coordinate units.</returns>
798         /// <since_tizen> 3 </since_tizen>
799         public float GetFixedWidth(uint columnIndex)
800         {
801             float ret = NDalicPINVOKE.TableView_GetFixedWidth(swigCPtr, columnIndex);
802             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
803             return ret;
804         }
805
806         /// <summary>
807         /// Sets a column to have a relative width. Relative width means percentage of
808         /// the remainder of the table width after subtracting padding and fixed width columns.<br />
809         /// Setting a relative width of 0 has no effect.<br />
810         /// </summary>
811         /// <param name="columnIndex">The columnIndex for column with a fixed width.</param>
812         /// <param name="widthPercentage">The widthPercentage between 0.0f and 1.0f.</param>
813         /// <since_tizen> 3 </since_tizen>
814         public void SetRelativeWidth(uint columnIndex, float widthPercentage)
815         {
816             NDalicPINVOKE.TableView_SetRelativeWidth(swigCPtr, columnIndex, widthPercentage);
817             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
818         }
819
820         /// <summary>
821         /// Gets a column's relative width.
822         /// </summary>
823         /// <param name="columnIndex">The column index with a relative width.</param>
824         /// <returns>Width in percentage units, between 0.0f and 1.0f.</returns>
825         /// <since_tizen> 3 </since_tizen>
826         public float GetRelativeWidth(uint columnIndex)
827         {
828             float ret = NDalicPINVOKE.TableView_GetRelativeWidth(swigCPtr, columnIndex);
829             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
830             return ret;
831         }
832
833         /// <summary>
834         /// Sets the alignment on a cell.<br />
835         /// Cells without calling this function have the default values of left and top respectively.<br />
836         /// </summary>
837         /// <param name="position">The cell to set alignment on.</param>
838         /// <param name="horizontal">The horizontal alignment.</param>
839         /// <param name="vertical">The vertical alignment.</param>
840         /// <since_tizen> 3 </since_tizen>
841         public void SetCellAlignment(TableView.CellPosition position, HorizontalAlignmentType horizontal, VerticalAlignmentType vertical)
842         {
843             NDalicPINVOKE.TableView_SetCellAlignment(swigCPtr, TableView.CellPosition.getCPtr(position), (int)horizontal, (int)vertical);
844             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
845         }
846
847         /// <summary>
848         /// Enumeration for describing how the size of a row or column has been set.
849         /// </summary>
850         /// <since_tizen> 3 </since_tizen>
851         public enum LayoutPolicy
852         {
853             /// <summary>
854             /// Fixed with the given value.
855             /// </summary>
856             /// <since_tizen> 3 </since_tizen>
857             Fixed,
858             /// <summary>
859             /// Calculated as percentage of the remainder after subtracting Padding and Fixed height/width.
860             /// </summary>
861             /// <since_tizen> 3 </since_tizen>
862             Relative,
863             /// <summary>
864             ///  Default policy, get the remainder of the 100% (after subtracting Fixed, Fit and Relative height/ width) divided evenly between 'fill' rows/columns.
865             /// </summary>
866             /// <since_tizen> 3 </since_tizen>
867             Fill,
868             /// <summary>
869             /// Fit around its children.
870             /// </summary>
871             /// <since_tizen> 3 </since_tizen>
872             Fit
873         }
874
875         /// <summary>
876         /// The amount of rows in the table.
877         /// </summary>
878         /// <since_tizen> 3 </since_tizen>
879         public int Rows
880         {
881             get
882             {
883                 return (int)GetValue(RowsProperty);
884             }
885             set
886             {
887                 SetValue(RowsProperty, value);
888                 NotifyPropertyChanged();
889             }
890         }
891         /// <summary>
892         /// The amount of columns in the table.
893         /// </summary>
894         /// <since_tizen> 3 </since_tizen>
895         public int Columns
896         {
897             get
898             {
899                 return (int)GetValue(ColumnsProperty);
900             }
901             set
902             {
903                 SetValue(ColumnsProperty, value);
904                 NotifyPropertyChanged();
905             }
906         }
907         /// <summary>
908         /// Padding between cells.
909         /// </summary>
910         /// <since_tizen> 3 </since_tizen>
911         public Vector2 CellPadding
912         {
913             get
914             {
915                 return (Vector2)GetValue(CellPaddingProperty);
916             }
917             set
918             {
919                 SetValue(CellPaddingProperty, value);
920                 NotifyPropertyChanged();
921             }
922         }
923
924         /// <summary>
925         /// The number of layout rows.
926         /// </summary>
927         /// <since_tizen> 3 </since_tizen>
928         public PropertyMap LayoutRows
929         {
930             get
931             {
932                 return (PropertyMap)GetValue(LayoutRowsProperty);
933             }
934             set
935             {
936                 SetValue(LayoutRowsProperty, value);
937                 NotifyPropertyChanged();
938             }
939         }
940
941         /// <summary>
942         /// The number of layout columns.
943         /// </summary>
944         /// <since_tizen> 3 </since_tizen>
945         public PropertyMap LayoutColumns
946         {
947             get
948             {
949                 return (PropertyMap)GetValue(LayoutColumnsProperty);
950             }
951             set
952             {
953                 SetValue(LayoutColumnsProperty, value);
954                 NotifyPropertyChanged();
955             }
956         }
957
958     }
959 }