Enlightenment CVS committal

Author  : doursse
Project : e17
Module  : proto

Dir     : e17/proto/etk/src/lib


Modified Files:
        etk_combobox.h etk_combobox.c 


Log Message:
api++ for the combobox (remove item, clear and get nth item

===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_combobox.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- etk_combobox.h      28 Mar 2006 07:24:57 -0000      1.5
+++ etk_combobox.h      9 Apr 2006 10:39:52 -0000       1.6
@@ -112,6 +112,10 @@
 Etk_Combobox_Item *etk_combobox_item_append(Etk_Combobox *combobox, ...);
 Etk_Combobox_Item *etk_combobox_item_append_valist(Etk_Combobox *combobox, 
va_list args);
 
+Etk_Combobox_Item *etk_combobox_nth_item_get(Etk_Combobox *combobox, int 
index);
+void etk_combobox_item_remove(Etk_Combobox *combobox, Etk_Combobox_Item *item);
+void etk_combobox_clear(Etk_Combobox *combobox);
+
 void etk_combobox_item_data_set(Etk_Combobox_Item *item, void *data);
 void etk_combobox_item_data_set_full(Etk_Combobox_Item *item, void *data, void 
(*free_cb)(void *data));
 void *etk_combobox_item_data_get(Etk_Combobox_Item *item);
===================================================================
RCS file: /cvs/e/e17/proto/etk/src/lib/etk_combobox.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- etk_combobox.c      7 Apr 2006 15:36:11 -0000       1.6
+++ etk_combobox.c      9 Apr 2006 10:39:52 -0000       1.7
@@ -365,6 +365,62 @@
 }
 
 /**
+ * @brief Returns an item from the combobox
+ * @param combobox a combobox
+ * @param index the number of the item to get
+ */
+Etk_Combobox_Item *etk_combobox_nth_item_get(Etk_Combobox *combobox, int index)
+{
+   Etk_Combobox_Item *item;
+
+   if (!combobox)
+      return NULL;
+
+   /* Evas lists check the validity of the index */
+   item = evas_list_nth(combobox->items, index);
+   return item;
+}
+
+/**
+ * @brief Removes an item from the combobox
+ * @param combobox a combobox
+ * @param item the item to remove
+ * @see etk_combobox_nth_item_get
+ */
+void etk_combobox_item_remove(Etk_Combobox *combobox, Etk_Combobox_Item *item)
+{
+   if (!combobox || !item)
+      return;
+
+   combobox->items = evas_list_remove(combobox->items, item);
+   if (item == combobox->active_item)
+   {
+     if (combobox->items)
+       etk_combobox_active_item_set(combobox, combobox->items->data);
+     else
+       etk_combobox_active_item_set(combobox, NULL);
+   }
+   etk_object_destroy (ETK_OBJECT(item));
+}
+
+/**
+ * @brief Removes all items from the combobox
+ * @param combobox a combobox
+ */
+void etk_combobox_clear(Etk_Combobox *combobox)
+{
+   if (!combobox)
+      return;
+
+   while (combobox->items)
+   {
+      etk_object_destroy (combobox->items->data);
+      combobox->items = evas_list_remove_list(combobox->items, 
combobox->items);
+   }
+   etk_combobox_active_item_set(combobox, NULL);
+}
+
+/**
  * @brief Sets the data associated to the combobox item
  * @param item a combobox item
  * @param data the data to associate to the combobox item




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to