Beispiel #1
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);
        }
Beispiel #2
0
        internal static GenListItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info)
        {
            GenListItem item = ItemObject.GetItemByHandle(info) as GenListItem;

            return(new GenListItemEventArgs {
                Item = item
            });
        }
Beispiel #3
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);
        }
Beispiel #4
0
 /// <summary>
 /// Shows the given item with the position type in a genlist.
 /// When animated is true, the genlist will jump to the given item and display it (by animatedly scrolling), if it is not fully visible. This may use animation and take sometime.
 /// When animated is false, the genlist will jump to the given item and display it (by jumping to that position), if it is not fully visible.
 /// </summary>
 /// <param name="item">The item to display.</param>
 /// <param name="position">The position to show the given item to <see cref="ScrollToPosition"/>.</param>
 /// <param name="animated">The animated indicates how to display the item, by scrolling or by jumping.</param>
 /// <since_tizen> preview </since_tizen>
 public void ScrollTo(GenListItem item, ScrollToPosition position, bool animated)
 {
     if (animated)
     {
         Interop.Elementary.elm_genlist_item_bring_in(item.Handle, (Interop.Elementary.Elm_Genlist_Item_Scrollto_Type)position);
     }
     else
     {
         Interop.Elementary.elm_genlist_item_show(item.Handle, (Interop.Elementary.Elm_Genlist_Item_Scrollto_Type)position);
     }
 }
Beispiel #5
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, this);

            // insert before the `before` list item
            item.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
            AddInternal(item);
            return(item);
        }
Beispiel #6
0
 void AddInternal(GenListItem item)
 {
     _children.Add(item);
     item.Deleted += Item_Deleted;
 }
Beispiel #7
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));
 }
Beispiel #8
0
 /// <summary>
 /// Inserts an item 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>
 /// <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)
 {
     return(InsertBefore(itemClass, data, before, GenListItemType.Normal));
 }