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