internal static GenGridItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info) { GenGridItem item = ItemObject.GetItemByHandle(info) as GenGridItem; return(new GenGridItemEventArgs { Item = item }); }
/// <summary> /// Inserts an item after another in a GenGrid widget. This inserts an item after another in the gengrid. /// </summary> /// <param name="itemClass">The itemClass defines how to display the data.</param> /// <param name="data">The item data.</param> /// <param name="after">The item after which to place this new one.</param> /// <returns>Return a gengrid item that contains the data and itemClass.</returns> /// <seealso cref="GenItemClass"/> /// <seealso cref="GenGridItem"/> /// <since_tizen> preview </since_tizen> public GenGridItem InsertAfter(GenItemClass itemClass, object data, GenGridItem after) { GenGridItem item = new GenGridItem(data, itemClass, this); item.Handle = Interop.Elementary.elm_gengrid_item_insert_after(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, after, null, (IntPtr)item.Id); AddInternal(item); return(item); }
/// <summary> /// Prepends a new item to a given GenGrid widget. This adds an item to the beginning of the gengrid. /// </summary> /// <param name="itemClass">The itemClass defines how to display the data.</param> /// <param name="data">The item data.</param> /// <returns>Return a gengrid item that contains the data and itemClass.</returns> /// <seealso cref="GenItemClass"/> /// <seealso cref="GenGridItem"/> /// <since_tizen> preview </since_tizen> public GenGridItem Prepend(GenItemClass itemClass, object data) { GenGridItem item = new GenGridItem(data, itemClass, this); item.Handle = Interop.Elementary.elm_gengrid_item_prepend(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, null, (IntPtr)item.Id); AddInternal(item); return(item); }
/// <summary> /// Inserts an item before another in a GenGrid widget. This inserts an item before another in the gengrid. /// </summary> /// <param name="itemClass">The itemClass defines how to display the data.</param> /// <param name="data">The item data.</param> /// <param name="before">The item before which to place this new one.</param> /// <returns>Return a gengrid item that contains the data and itemClass.</returns> /// <seealso cref="GenItemClass"/> /// <seealso cref="GenGridItem"/> /// <since_tizen> preview </since_tizen> public GenGridItem InsertBefore(GenItemClass itemClass, object data, GenGridItem before) { GenGridItem item = new GenGridItem(data, itemClass); IntPtr handle = Interop.Elementary.elm_gengrid_item_insert_before(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, before, null, (IntPtr)item.Id); item.Handle = handle; AddInternal(item); return(item); }
/// <summary> /// Shows a given item to the visible area of a gengrid. /// </summary> /// <param name="item">The gengrid item to display.</param> /// <param name="position">The position of the item in the viewport.</param> /// <param name="animated">The type of how to show the item.</param> /// <remarks> /// If animated is true, the gengrid shows the item by scrolling if it's not fully visible. /// If animated is false, the gengrid shows the item by jumping if it's not fully visible. /// </remarks> /// <seealso cref="ScrollToPosition"/> /// <since_tizen> preview </since_tizen> public void ScrollTo(GenGridItem item, ScrollToPosition position, bool animated) { if (animated) { Interop.Elementary.elm_gengrid_item_bring_in(item.Handle, (int)position); } else { Interop.Elementary.elm_gengrid_item_show(item.Handle, (int)position); } }
/// <summary> /// Inserts an item in a GenGrid widget using a user-defined sort function. /// </summary> /// <param name="itemClass">The itemClass defines how to display the data.</param> /// <param name="data">The item data.</param> /// <param name="comparison">User defined comparison function that defines the sort order based on the gengrid item and its data.</param> /// <returns>Return a gengrid item that contains the data and itemClass.</returns> /// <since_tizen> preview </since_tizen> public GenGridItem InsertSorted(GenItemClass itemClass, object data, Comparison <object> comparison) { GenGridItem item = new GenGridItem(data, itemClass, this); Interop.Elementary.Eina_Compare_Cb compareCallback = (handle1, handle2) => { GenGridItem first = (ItemObject.GetItemByHandle(handle1) as GenGridItem) ?? item; GenGridItem second = (ItemObject.GetItemByHandle(handle2) as GenGridItem) ?? item; return(comparison(first.Data, second.Data)); }; item.Handle = Interop.Elementary.elm_gengrid_item_sorted_insert(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, compareCallback, null, (IntPtr)item.Id); AddInternal(item); return(item); }
void AddInternal(GenGridItem item) { _children.Add(item); item.Deleted += Item_Deleted; }