Esempio n. 1
0
        /// <summary>
        /// Prepends a new item with <see cref="GenListItemType"/> to the beginning of a given GenList widget or the beginning of the children list, if the parent is given.
        /// </summary>
        /// <param name="itemClass">The itemClass defines how to display the data.</param>
        /// <param name="data">The item data.</param>
        /// <param name="type">The genlist item type.</param>
        /// <param name="parent">The parent item, otherwise null if there is no parent item.</param>
        /// <returns>Return a newly added genlist item that contains the data and itemClass.</returns>
        /// <since_tizen> preview </since_tizen>
        public GenListItem Prepend(GenItemClass itemClass, object data, GenListItemType type, GenListItem parent)
        {
            GenListItem item = new GenListItem(data, itemClass, this);

            item.Handle = Interop.Elementary.elm_genlist_item_prepend(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, parent, (int)type, null, (IntPtr)item.Id);
            AddInternal(item);
            return(item);
        }
Esempio n. 2
0
        /// <summary>
        /// Inserts an item in a GenList 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 genlist item and its data.</param>
        /// <param name="type">The genlist item type.</param>
        /// <param name="parent">The parent item, otherwise null if there is no parent item.</param>
        /// <returns>Return a genlist item that contains the data and itemClass.</returns>
        /// <since_tizen> preview </since_tizen>
        public GenListItem InsertSorted(GenItemClass itemClass, object data, Comparison <object> comparison, GenListItemType type, GenListItem parent)
        {
            GenListItem item = new GenListItem(data, itemClass);

            Interop.Elementary.Eina_Compare_Cb compareCallback = (handle1, handle2) =>
            {
                GenListItem first  = (ItemObject.GetItemByHandle(handle1) as GenListItem) ?? item;
                GenListItem second = (ItemObject.GetItemByHandle(handle2) as GenListItem) ?? item;
                return(comparison(first.Data, second.Data));
            };

            IntPtr handle = Interop.Elementary.elm_genlist_item_sorted_insert(
                RealHandle,             // genlist handle
                itemClass.UnmanagedPtr, // item clas
                (IntPtr)item.Id,        // data
                parent,                 // parent
                (int)type,              // item type
                compareCallback,        // compare callback
                null,                   //select callback
                (IntPtr)item.Id);       // callback data

            item.Handle = handle;
            AddInternal(item);
            return(item);
        }
Esempio n. 3
0
        /// <summary>
        /// Inserts an item with <see cref="GenListItemType"/> after another item under a parent in a GenList widget.
        /// </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>
        /// <param name="type">The genlist item type.</param>
        /// <param name="parent">The parent item, otherwise null if there is no parent item.</param>
        /// <returns>Return a newly added genlist item that contains data and itemClass.</returns>
        /// <since_tizen> preview </since_tizen>
        public GenListItem InsertAfter(GenItemClass itemClass, object data, GenListItem after, GenListItemType type, GenListItem parent)
        {
            GenListItem item = new GenListItem(data, itemClass);
            // insert before the `before` list item
            IntPtr handle = Interop.Elementary.elm_genlist_item_insert_before(
                RealHandle,             // genlist handle
                itemClass.UnmanagedPtr, // item class
                (IntPtr)item.Id,        // data
                parent,                 // parent
                after,                  // after
                (int)type,              // item type
                null,                   // select callback
                (IntPtr)item.Id);       // callback data

            item.Handle = handle;
            AddInternal(item);
            return(item);
        }
Esempio n. 4
0
 /// <summary>
 /// Inserts an item with <see cref="GenListItemType"/> before another item in a GenList widget.
 /// It is the same tree level or group as the item before which it is inserted.
 /// </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>
 /// <param name="type">The genlist item type.</param>
 /// <returns>Return a newly added genlist item that contains data and itemClass.</returns>
 /// <since_tizen> preview </since_tizen>
 public GenListItem InsertBefore(GenItemClass itemClass, object data, GenListItem before, GenListItemType type)
 {
     return(InsertBefore(itemClass, data, before, type, null));
 }
Esempio n. 5
0
 /// <summary>
 /// Prepends a new item with <see cref="GenListItemType"/> to the beginning of a given genlist widget.
 /// </summary>
 /// <param name="itemClass">The itemClass defines how to display the data.</param>
 /// <param name="data">The item data.</param>
 /// <param name="type">The genlist item type.</param>
 /// <returns>Return a newly added genlist item that contains data and itemClass.</returns>
 /// <since_tizen> preview </since_tizen>
 public GenListItem Prepend(GenItemClass itemClass, object data, GenListItemType type)
 {
     return(Prepend(itemClass, data, type, null));
 }