Hello, I've often found useful to remove items from an elm_box, and the
new elm_box_clear function helps me a lot, by the way in some
circumstances I'd prefer not to delete the items I've packed in the box,
but just to unbox them.
So I've added these two new API:
EAPI void elm_box_unpack(Evas_Object *obj, Evas_Object *subobj);
EAPI void elm_box_unpack_all(Evas_Object *obj);
Patch is attached, please let me know if it can be merged, since I'm
just using them in a my project and if they can't be accepted I must
find another way.
PS: I don't know if it's a right thing using elm_widget_sub_object_del
in els_box.c, but it's the only way to remove all the widget subitems
when using the "unpack_all" function.
Index: src/lib/els_box.h
===================================================================
--- src/lib/els_box.h (revisione 42406)
+++ src/lib/els_box.h (copia locale)
@@ -6,5 +6,6 @@
int _els_smart_box_pack_end (Evas_Object *obj, Evas_Object *child);
int _els_smart_box_pack_before (Evas_Object *obj, Evas_Object *child, Evas_Object *before);
int _els_smart_box_pack_after (Evas_Object *obj, Evas_Object *child, Evas_Object *after);
-void _els_smart_box_unpack (Evas_Object *obj);
+void _els_smart_box_unpack (Evas_Object *obj, Evas_Object *child);
+void _els_smart_box_unpack_all (Evas_Object *obj);
void _els_smart_box_clear (Evas_Object *obj);
Index: src/lib/Elementary.h.in
===================================================================
--- src/lib/Elementary.h.in (revisione 42406)
+++ src/lib/Elementary.h.in (copia locale)
@@ -289,6 +289,8 @@
EAPI void elm_box_pack_before(Evas_Object *obj, Evas_Object *subobj, Evas_Object *before);
EAPI void elm_box_pack_after(Evas_Object *obj, Evas_Object *subobj, Evas_Object *after);
EAPI void elm_box_clear(Evas_Object *obj);
+ EAPI void elm_box_unpack(Evas_Object *obj, Evas_Object *subobj);
+ EAPI void elm_box_unpack_all(Evas_Object *obj);
/* smart callbacks called:
*/
Index: src/lib/elm_box.c
===================================================================
--- src/lib/elm_box.c (revisione 42406)
+++ src/lib/elm_box.c (copia locale)
@@ -238,3 +238,37 @@
Widget_Data *wd = elm_widget_data_get(obj);
_els_smart_box_clear(wd->box);
}
+
+/**
+ * This unpack a box item
+ *
+ * This unpack the selected member from the box object, but does not delete
+ * the box itself or the packed items.
+ *
+ * @param obj The box object
+ *
+ * @ingroup Box
+ */
+EAPI void
+elm_box_unpack(Evas_Object *obj, Evas_Object *subobj)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ _els_smart_box_unpack(wd->box, subobj);
+}
+
+/**
+ * This unpack the box items
+ *
+ * This unpack all members from the box object, but does not delete
+ * the box itself or the packed items.
+ *
+ * @param obj The box object
+ *
+ * @ingroup Box
+ */
+EAPI void
+elm_box_unpack_all(Evas_Object *obj)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ _els_smart_box_unpack_all(wd->box);
+}
Index: src/lib/els_box.c
===================================================================
--- src/lib/els_box.c (revisione 42406)
+++ src/lib/els_box.c (copia locale)
@@ -153,15 +153,16 @@
}
void
-_els_smart_box_unpack(Evas_Object *obj)
+_els_smart_box_unpack(Evas_Object *obj, Evas_Object *child)
{
Smart_Data *sd;
if (!obj) return;
- sd = evas_object_smart_data_get(evas_object_smart_parent_get(obj));
+ sd = evas_object_smart_data_get(obj);
if (!sd) return;
- sd->items = eina_list_remove(sd->items, obj);
- _smart_disown(obj);
+ sd->items = eina_list_remove(sd->items, child);
+ elm_widget_sub_object_del(obj, child);
+ _smart_disown(child);
if (!sd->deleting)
{
if (!evas_object_clipees_get(sd->clip))
@@ -171,6 +172,20 @@
}
void
+_els_smart_box_unpack_all(Evas_Object *obj)
+{
+ Smart_Data *sd;
+
+ sd = evas_object_smart_data_get(obj);
+ if (!sd) return;
+ while (sd->items)
+ {
+ Evas_Object *child = sd->items->data;
+ _els_smart_box_unpack(obj, child);
+ }
+}
+
+void
_els_smart_box_clear(Evas_Object *obj)
{
Smart_Data *sd;
@@ -222,7 +237,7 @@
static void
_smart_item_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
- _els_smart_box_unpack(obj);
+ _els_smart_box_unpack(evas_object_smart_parent_get(obj), obj);
}
static void
@@ -507,7 +522,7 @@
Evas_Object *child;
child = sd->items->data;
- _els_smart_box_unpack(child);
+ _els_smart_box_unpack(obj, child);
}
evas_object_del(sd->clip);
free(sd);
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel