[NUI] Refine codes to reduce code duplication (#1096)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TableView.cs
1 /*
2  * Copyright(c) 2019 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             View ret = this.GetInstanceSafely<View>(cPtr);
316             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
317
318             Children.Remove(ret);
319
320             return ret;
321         }
322
323         /// <summary>
324         /// Finds the child's layout position.
325         /// </summary>
326         /// <param name="child">The child to search for.</param>
327         /// <param name="position">The position for the child.</param>
328         /// <returns>True if the child was included in this TableView.</returns>
329         /// <since_tizen> 3 </since_tizen>
330         public bool FindChildPosition(View child, TableView.CellPosition position)
331         {
332             bool ret = Interop.TableView.TableView_FindChildPosition(swigCPtr, View.getCPtr(child), TableView.CellPosition.getCPtr(position));
333             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334             return ret;
335         }
336
337         /// <summary>
338         /// Inserts a new row to the given index.
339         /// </summary>
340         /// <param name="rowIndex">The rowIndex of the new row.</param>
341         /// <since_tizen> 3 </since_tizen>
342         public void InsertRow(uint rowIndex)
343         {
344             Interop.TableView.TableView_InsertRow(swigCPtr, rowIndex);
345             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
346         }
347
348         /// <summary>
349         /// Deletes a row from the given index.<br />
350         /// Removed elements are deleted.<br />
351         /// </summary>
352         /// <param name="rowIndex">The rowIndex of the row to delete.</param>
353         /// <since_tizen> 3 </since_tizen>
354         public void DeleteRow(uint rowIndex)
355         {
356             Interop.TableView.TableView_DeleteRow__SWIG_0(swigCPtr, rowIndex);
357             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
358         }
359
360         /// <summary>
361         /// Inserts a new column to the given index.
362         /// </summary>
363         /// <param name="columnIndex">The columnIndex of the new column.</param>
364         /// <since_tizen> 3 </since_tizen>
365         public void InsertColumn(uint columnIndex)
366         {
367             Interop.TableView.TableView_InsertColumn(swigCPtr, columnIndex);
368             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
369         }
370
371         /// <summary>
372         /// Deletes a column from the given index.<br />
373         /// Removed elements are deleted.<br />
374         /// </summary>
375         /// <param name="columnIndex">The columnIndex of the column to delete.</param>
376         /// <since_tizen> 3 </since_tizen>
377         public void DeleteColumn(uint columnIndex)
378         {
379             Interop.TableView.TableView_DeleteColumn__SWIG_0(swigCPtr, columnIndex);
380             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
381         }
382
383         /// <summary>
384         /// Resizes the TableView.
385         /// </summary>
386         /// <param name="rows">The rows for the table.</param>
387         /// <param name="columns">The columns for the table.</param>
388         /// <since_tizen> 3 </since_tizen>
389         public void Resize(uint rows, uint columns)
390         {
391             Interop.TableView.TableView_Resize__SWIG_0(swigCPtr, rows, columns);
392             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
393         }
394
395         /// <summary>
396         /// Sets the horizontal and the vertical padding between cells.
397         /// </summary>
398         /// <param name="padding">Width and height.</param>
399         /// <since_tizen> 3 </since_tizen>
400         public void SetCellPadding(Size2D padding)
401         {
402             Interop.TableView.TableView_SetCellPadding(swigCPtr, Size2D.getCPtr(padding));
403             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
404         }
405
406         /// <summary>
407         /// Gets the current padding as width and height.
408         /// </summary>
409         /// <returns>The current padding as width and height.</returns>
410         /// <since_tizen> 3 </since_tizen>
411         public Vector2 GetCellPadding()
412         {
413             Vector2 ret = new Vector2(Interop.TableView.TableView_GetCellPadding(swigCPtr), true);
414             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
415             return ret;
416         }
417
418         /// <summary>
419         /// Specifies this row as fitting its height to its children.
420         /// </summary>
421         /// <param name="rowIndex">The row to set.</param>
422         /// <since_tizen> 3 </since_tizen>
423         public void SetFitHeight(uint rowIndex)
424         {
425             Interop.TableView.TableView_SetFitHeight(swigCPtr, rowIndex);
426             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
427         }
428
429         /// <summary>
430         /// Checks if the row is a fit row.
431         /// </summary>
432         /// <param name="rowIndex">The row to check.</param>
433         /// <returns>True if the row is fit.</returns>
434         /// <since_tizen> 3 </since_tizen>
435         public bool IsFitHeight(uint rowIndex)
436         {
437             bool ret = Interop.TableView.TableView_IsFitHeight(swigCPtr, rowIndex);
438             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
439             return ret;
440         }
441
442         /// <summary>
443         /// Specifies this column as fitting its width to its children.
444         /// </summary>
445         /// <param name="columnIndex">The column to set.</param>
446         /// <since_tizen> 3 </since_tizen>
447         public void SetFitWidth(uint columnIndex)
448         {
449             Interop.TableView.TableView_SetFitWidth(swigCPtr, columnIndex);
450             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
451         }
452
453         /// <summary>
454         /// Checks if the column is a fit column.
455         /// </summary>
456         /// <param name="columnIndex">The column to check.</param>
457         /// <returns>True if the column is fit.</returns>
458         /// <since_tizen> 3 </since_tizen>
459         public bool IsFitWidth(uint columnIndex)
460         {
461             bool ret = Interop.TableView.TableView_IsFitWidth(swigCPtr, columnIndex);
462             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
463             return ret;
464         }
465
466         /// <summary>
467         /// Sets a row to have a fixed height.<br />
468         /// Setting a fixed height of 0 has no effect.<br />
469         /// </summary>
470         /// <param name="rowIndex">The rowIndex for row with a fixed height.</param>
471         /// <param name="height">The height in world coordinate units.</param>
472         /// <since_tizen> 3 </since_tizen>
473         public void SetFixedHeight(uint rowIndex, float height)
474         {
475             Interop.TableView.TableView_SetFixedHeight(swigCPtr, rowIndex, height);
476             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
477         }
478
479         /// <summary>
480         /// Gets a row's fixed height.
481         /// </summary>
482         /// <param name="rowIndex">The row index with a fixed height.</param>
483         /// <returns>height The height in world coordinate units.</returns>
484         /// <since_tizen> 3 </since_tizen>
485         public float GetFixedHeight(uint rowIndex)
486         {
487             float ret = Interop.TableView.TableView_GetFixedHeight(swigCPtr, rowIndex);
488             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
489             return ret;
490         }
491
492         /// <summary>
493         /// Sets a row to have a relative height. Relative height means percentage of
494         /// the remainder of the table height after subtracting padding and fixed height rows.<br />
495         /// Setting a relative height of 0 has no effect.<br />
496         /// </summary>
497         /// <param name="rowIndex">The rowIndex for row with a relative height.</param>
498         /// <param name="heightPercentage">The height percentage between 0.0f and 1.0f.</param>
499         /// <since_tizen> 3 </since_tizen>
500         public void SetRelativeHeight(uint rowIndex, float heightPercentage)
501         {
502             Interop.TableView.TableView_SetRelativeHeight(swigCPtr, rowIndex, heightPercentage);
503             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
504         }
505
506         /// <summary>
507         /// Gets a row's relative height.
508         /// </summary>
509         /// <param name="rowIndex">The row index with a relative height.</param>
510         /// <returns>Height in percentage units, between 0.0f and 1.0f.</returns>
511         /// <since_tizen> 3 </since_tizen>
512         public float GetRelativeHeight(uint rowIndex)
513         {
514             float ret = Interop.TableView.TableView_GetRelativeHeight(swigCPtr, rowIndex);
515             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
516             return ret;
517         }
518
519         /// <summary>
520         /// Sets a column to have a fixed width.<br />
521         /// Setting a fixed width of 0 has no effect.<br />
522         /// </summary>
523         /// <param name="columnIndex">The columnIndex for column with a fixed width.</param>
524         /// <param name="width">The width in world coordinate units.</param>
525         /// <since_tizen> 3 </since_tizen>
526         public void SetFixedWidth(uint columnIndex, float width)
527         {
528             Interop.TableView.TableView_SetFixedWidth(swigCPtr, columnIndex, width);
529             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
530         }
531
532         /// <summary>
533         /// Gets a column's fixed width.
534         /// </summary>
535         /// <param name="columnIndex">The column index with a fixed width.</param>
536         /// <returns>Width in world coordinate units.</returns>
537         /// <since_tizen> 3 </since_tizen>
538         public float GetFixedWidth(uint columnIndex)
539         {
540             float ret = Interop.TableView.TableView_GetFixedWidth(swigCPtr, columnIndex);
541             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
542             return ret;
543         }
544
545         /// <summary>
546         /// Sets a column to have a relative width. Relative width means percentage of
547         /// the remainder of the table width after subtracting padding and fixed width columns.<br />
548         /// Setting a relative width of 0 has no effect.<br />
549         /// </summary>
550         /// <param name="columnIndex">The columnIndex for column with a fixed width.</param>
551         /// <param name="widthPercentage">The widthPercentage between 0.0f and 1.0f.</param>
552         /// <since_tizen> 3 </since_tizen>
553         public void SetRelativeWidth(uint columnIndex, float widthPercentage)
554         {
555             Interop.TableView.TableView_SetRelativeWidth(swigCPtr, columnIndex, widthPercentage);
556             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
557         }
558
559         /// <summary>
560         /// Gets a column's relative width.
561         /// </summary>
562         /// <param name="columnIndex">The column index with a relative width.</param>
563         /// <returns>Width in percentage units, between 0.0f and 1.0f.</returns>
564         /// <since_tizen> 3 </since_tizen>
565         public float GetRelativeWidth(uint columnIndex)
566         {
567             float ret = Interop.TableView.TableView_GetRelativeWidth(swigCPtr, columnIndex);
568             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
569             return ret;
570         }
571
572         /// <summary>
573         /// Sets the alignment on a cell.<br />
574         /// Cells without calling this function have the default values of left and top respectively.<br />
575         /// </summary>
576         /// <param name="position">The cell to set alignment on.</param>
577         /// <param name="horizontal">The horizontal alignment.</param>
578         /// <param name="vertical">The vertical alignment.</param>
579         /// <since_tizen> 3 </since_tizen>
580         public void SetCellAlignment(TableView.CellPosition position, HorizontalAlignmentType horizontal, VerticalAlignmentType vertical)
581         {
582             Interop.TableView.TableView_SetCellAlignment(swigCPtr, TableView.CellPosition.getCPtr(position), (int)horizontal, (int)vertical);
583             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
584         }
585
586         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TableView obj)
587         {
588             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
589         }
590
591         /// <summary>
592         /// Dispose
593         /// </summary>
594         /// <param name="type">The dispose type</param>
595         /// <since_tizen> 3 </since_tizen>
596         protected override void Dispose(DisposeTypes type)
597         {
598             if (disposed)
599             {
600                 return;
601             }
602
603             //Release your own unmanaged resources here.
604             //You should not access any managed member here except static instance.
605             //because the execution order of Finalizes is non-deterministic.
606
607             if (swigCPtr.Handle != global::System.IntPtr.Zero)
608             {
609                 if (swigCMemOwn)
610                 {
611                     swigCMemOwn = false;
612                     Interop.TableView.delete_TableView(swigCPtr);
613                 }
614                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
615             }
616
617             base.Dispose(type);
618         }
619
620         /// <summary>
621         /// Class to specify the layout position for the child view.
622         /// </summary>
623         /// <since_tizen> 3 </since_tizen>
624         public class CellPosition : Disposable
625         {
626             /// <summary>
627             /// swigCMemOwn
628             /// </summary>
629             /// <since_tizen> 3 </since_tizen>
630             protected bool swigCMemOwn;
631             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
632
633             /// <summary>
634             /// The constructor.
635             /// </summary>
636             /// <param name="rowIndex">The row index initialized.</param>
637             /// <param name="columnIndex">The column index initialized.</param>
638             /// <param name="rowSpan">The row span initialized.</param>
639             /// <param name="columnSpan">The column span initialized.</param>
640             /// <since_tizen> 3 </since_tizen>
641             public CellPosition(uint rowIndex, uint columnIndex, uint rowSpan, uint columnSpan) : this(Interop.TableView.new_TableView_CellPosition__SWIG_0(rowIndex, columnIndex, rowSpan, columnSpan), true)
642             {
643                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
644             }
645
646             /// <summary>
647             /// The constructor to initialize values to defaults for convenience.
648             /// </summary>
649             /// <param name="rowIndex">The row index initialized.</param>
650             /// <param name="columnIndex">The column index initialized.</param>
651             /// <param name="rowSpan">The row span initialized.</param>
652             /// <since_tizen> 3 </since_tizen>
653             public CellPosition(uint rowIndex, uint columnIndex, uint rowSpan) : this(Interop.TableView.new_TableView_CellPosition__SWIG_1(rowIndex, columnIndex, rowSpan), true)
654             {
655                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
656             }
657
658             /// <summary>
659             /// The constructor to initialize values to defaults for convenience.
660             /// </summary>
661             /// <param name="rowIndex">The row index initialized.</param>
662             /// <param name="columnIndex">The column index initialized.</param>
663             /// <since_tizen> 3 </since_tizen>
664             public CellPosition(uint rowIndex, uint columnIndex) : this(Interop.TableView.new_TableView_CellPosition__SWIG_2(rowIndex, columnIndex), true)
665             {
666                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
667             }
668
669             /// <summary>
670             /// The constructor to initialize values to default for convenience.
671             /// </summary>
672             /// <param name="rowIndex">The row index initialized.</param>
673             /// <since_tizen> 3 </since_tizen>
674             public CellPosition(uint rowIndex) : this(Interop.TableView.new_TableView_CellPosition__SWIG_3(rowIndex), true)
675             {
676                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
677             }
678
679             /// <summary>
680             /// The default constructor.
681             /// </summary>
682             /// <since_tizen> 3 </since_tizen>
683             public CellPosition() : this(Interop.TableView.new_TableView_CellPosition__SWIG_4(), true)
684             {
685                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
686             }
687
688             internal CellPosition(global::System.IntPtr cPtr, bool cMemoryOwn)
689             {
690                 swigCMemOwn = cMemoryOwn;
691                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
692             }
693
694             /// <summary>
695             /// The index of a row.
696             /// </summary>
697             /// <since_tizen> 3 </since_tizen>
698             [Obsolete("Please do not use! This will be deprecated! Please use RowIndex instead!")]
699             [EditorBrowsable(EditorBrowsableState.Never)]
700             public uint rowIndex
701             {
702                 set
703                 {
704                     Interop.TableView.TableView_CellPosition_rowIndex_set(swigCPtr, value);
705                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
706                 }
707                 get
708                 {
709                     uint ret = Interop.TableView.TableView_CellPosition_rowIndex_get(swigCPtr);
710                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
711                     return ret;
712                 }
713             }
714
715             /// <summary>
716             /// The index or position of a row.
717             /// </summary>
718             /// <since_tizen> 5 </since_tizen>
719             public uint RowIndex
720             {
721                 get
722                 {
723                     uint ret = Interop.TableView.TableView_CellPosition_rowIndex_get(swigCPtr);
724                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
725                     return ret;
726                 }
727             }
728
729
730             /// <summary>
731             /// The index of a column.
732             /// </summary>
733             /// <since_tizen> 3 </since_tizen>
734             [Obsolete("Please do not use! This will be deprecated! Please use ColumnIndex instead!")]
735             [EditorBrowsable(EditorBrowsableState.Never)]
736             public uint columnIndex
737             {
738                 set
739                 {
740                     Interop.TableView.TableView_CellPosition_columnIndex_set(swigCPtr, value);
741                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
742                 }
743                 get
744                 {
745                     uint ret = Interop.TableView.TableView_CellPosition_columnIndex_get(swigCPtr);
746                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
747                     return ret;
748                 }
749             }
750
751             /// <summary>
752             /// The index or position of a column.
753             /// </summary>
754             /// <since_tizen> 5 </since_tizen>
755             public uint ColumnIndex
756             {
757                 get
758                 {
759                     uint ret = Interop.TableView.TableView_CellPosition_columnIndex_get(swigCPtr);
760                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
761                     return ret;
762                 }
763             }
764
765             /// <summary>
766             /// The span of a row.
767             /// </summary>
768             /// <since_tizen> 3 </since_tizen>
769             [Obsolete("Please do not use! This will be deprecated! Please use RowSpan instead!")]
770             [EditorBrowsable(EditorBrowsableState.Never)]
771             public uint rowSpan
772             {
773                 set
774                 {
775                     Interop.TableView.TableView_CellPosition_rowSpan_set(swigCPtr, value);
776                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
777                 }
778                 get
779                 {
780                     uint ret = Interop.TableView.TableView_CellPosition_rowSpan_get(swigCPtr);
781                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
782                     return ret;
783                 }
784             }
785
786             /// <summary>
787             /// The span of a row.
788             /// </summary>
789             /// <since_tizen> 5 </since_tizen>
790             public uint RowSpan
791             {
792                 get
793                 {
794                     uint ret = Interop.TableView.TableView_CellPosition_rowSpan_get(swigCPtr);
795                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
796                     return ret;
797                 }
798             }
799
800             /// <summary>
801             /// The span of a column.
802             /// </summary>
803             /// <since_tizen> 3 </since_tizen>
804             [Obsolete("Please do not use! This will be deprecated! Please use ColumnSpan instead!")]
805             [EditorBrowsable(EditorBrowsableState.Never)]
806             public uint columnSpan
807             {
808                 set
809                 {
810                     Interop.TableView.TableView_CellPosition_columnSpan_set(swigCPtr, value);
811                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
812                 }
813                 get
814                 {
815                     uint ret = Interop.TableView.TableView_CellPosition_columnSpan_get(swigCPtr);
816                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
817                     return ret;
818                 }
819             }
820
821             /// <summary>
822             /// The span of a column.
823             /// </summary>
824             /// <since_tizen> 5 </since_tizen>
825             public uint ColumnSpan
826             {
827                 get
828                 {
829                     uint ret = Interop.TableView.TableView_CellPosition_columnSpan_get(swigCPtr);
830                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
831                     return ret;
832                 }
833             }
834
835             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CellPosition obj)
836             {
837                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
838             }
839
840             /// <summary>
841             /// Dispose.
842             /// </summary>
843             /// <param name="type">DisposeTypes</param>
844             /// <since_tizen> 3 </since_tizen>
845             protected override void Dispose(DisposeTypes type)
846             {
847                 if (disposed)
848                 {
849                     return;
850                 }
851
852                 //Release your own unmanaged resources here.
853                 //You should not access any managed member here except static instance.
854                 //because the execution order of Finalizes is non-deterministic.
855
856                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
857                 {
858                     if (swigCMemOwn)
859                     {
860                         swigCMemOwn = false;
861                         Interop.TableView.delete_TableView_CellPosition(swigCPtr);
862                     }
863                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
864                 }
865                 base.Dispose(type);
866             }
867         }
868
869         internal new class Property
870         {
871             internal static readonly int ROWS = Interop.TableView.TableView_Property_ROWS_get();
872             internal static readonly int COLUMNS = Interop.TableView.TableView_Property_COLUMNS_get();
873             internal static readonly int CELL_PADDING = Interop.TableView.TableView_Property_CELL_PADDING_get();
874             internal static readonly int LAYOUT_ROWS = Interop.TableView.TableView_Property_LAYOUT_ROWS_get();
875             internal static readonly int LAYOUT_COLUMNS = Interop.TableView.TableView_Property_LAYOUT_COLUMNS_get();
876         }
877
878         internal class ChildProperty
879         {
880             internal static readonly int CELL_INDEX = Interop.TableView.TableView_ChildProperty_CELL_INDEX_get();
881             internal static readonly int ROW_SPAN = Interop.TableView.TableView_ChildProperty_ROW_SPAN_get();
882             internal static readonly int COLUMN_SPAN = Interop.TableView.TableView_ChildProperty_COLUMN_SPAN_get();
883             internal static readonly int CELL_HORIZONTAL_ALIGNMENT = Interop.TableView.TableView_ChildProperty_CELL_HORIZONTAL_ALIGNMENT_get();
884             internal static readonly int CELL_VERTICAL_ALIGNMENT = Interop.TableView.TableView_ChildProperty_CELL_VERTICAL_ALIGNMENT_get();
885         }
886     }
887 }