Thanks for the help guys, here's my second version, that deals with
show/hide and applies clip_elements_set() to all elements.
On Wed, Jul 16, 2008 at 11:53 PM, Peter Wehrfritz <[EMAIL PROTECTED]>
wrote:
> Sevcsik András schrieb:
>
>> I attached a patch for esmart that adds
>> esmart_container_clip_elements_set()
>> and esmart_container_clip_elements_get(). It's my first patch, so if
>> you've
>> got any suggestion about anything, don't hesitate to tell :)
>>
>>
> Somethings need to be changed. As Hisham has said, you have of course to
> unclip or to clip the children that are already in the container, if you
> change the clipping state. Second, you have deal with the hide and show
> callbacks. If the container is hidden its elements shouldn't be visible
> either. There to ways to do this. 1. You hide the elements, too. 2. you clip
> them on the hidden clipper.
> I think the second way is better because the user can still hide and show
> the element if he wants to, without esmart_container changing this state.
>
> Peter
>
>
--
Minden jót,
Sevcsik András
Index: src/lib/esmart_container/Esmart_Container.h
===================================================================
RCS file: /var/cvs/e/e17/libs/esmart/src/lib/esmart_container/Esmart_Container.h,v
retrieving revision 1.11
diff -u -r1.11 Esmart_Container.h
--- src/lib/esmart_container/Esmart_Container.h 12 Jul 2008 06:40:36 -0000 1.11
+++ src/lib/esmart_container/Esmart_Container.h 17 Jul 2008 20:48:11 -0000
@@ -147,6 +147,18 @@
EAPI int esmart_container_layout_plugin_set(Evas_Object *container, const char *name);
+/*! \brief Set that container should clip elements
+ * @param container Object
+ * @param val Boolean value: 1 to clip elements (default), 0 to not
+ */
+EAPI void esmart_container_clip_elements_set(Evas_Object *container,
+ unsigned char val);
+
+/*! \brief Checks that container clips elements or not
+ * @param container Object
+ * @return Boolean value: 1 if clip elements, 0 if not
+ */
+EAPI unsigned char esmart_container_clip_elements_get(Evas_Object *container);
#ifdef __cplusplus
}
Index: src/lib/esmart_container/esmart_container.c
===================================================================
RCS file: /var/cvs/e/e17/libs/esmart/src/lib/esmart_container/esmart_container.c,v
retrieving revision 1.16
diff -u -r1.16 esmart_container.c
--- src/lib/esmart_container/esmart_container.c 12 Jul 2008 06:40:36 -0000 1.16
+++ src/lib/esmart_container/esmart_container.c 17 Jul 2008 20:48:11 -0000
@@ -419,6 +419,47 @@
return length;
}
+EAPI void
+esmart_container_clip_elements_set(Evas_Object *container, unsigned char val)
+{
+ Container *cont;
+ Evas_List *l;
+
+ cont = _container_fetch(container);
+ if (val)
+ evas_object_show(cont->clipper);
+ else
+ evas_object_hide(cont->clipper);
+ cont->clip_elements = val;
+
+ if (val)
+ { /* Clip all elements */
+ for (l = cont->elements; l; l = l->next)
+ {
+ Container_Element *el = l->data;
+
+ evas_object_clip_set(el->obj, cont->clipper);
+ }
+ }
+ else
+ { /* Unclip all elements */
+ for (l = cont->elements; l; l = l->next)
+ {
+ Container_Element *el = l->data;
+
+ evas_object_clip_unset(el->obj);
+ }
+ }
+}
+
+EAPI unsigned char
+esmart_container_clip_elements_get(Evas_Object *container)
+{
+ Container *cont;
+
+ cont = _container_fetch(container);
+ return cont->clip_elements;
+}
/**************** internal functions *******************/
@@ -435,7 +476,7 @@
el->obj = obj;
evas_object_data_set(obj, "Container_Element", el);
evas_object_show(obj);
-
+
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
el->orig_w = w;
el->orig_h = h;
@@ -444,9 +485,12 @@
evas_object_repeat_events_set(el->grabber, 1);
evas_object_color_set(el->grabber, 0, 0, 0, 0);
evas_object_show(el->grabber);
-
+
el->container = cont;
- evas_object_clip_set(el->obj, cont->clipper);
+
+ if (cont->clip_elements)
+ evas_object_clip_set(el->obj, cont->clipper);
+
evas_object_clip_set(el->grabber, cont->clipper);
/*
evas_object_layer_set(el->obj, evas_object_layer_get(cont->obj));
@@ -456,6 +500,7 @@
evas_object_stack_above(el->obj, cont->obj);
*/
evas_object_smart_member_add(el->obj, cont->obj);
+
evas_object_smart_member_add(el->grabber, cont->obj);
evas_object_event_callback_add(el->grabber, EVAS_CALLBACK_MOUSE_DOWN, _cb_element_down, el);
Index: src/lib/esmart_container/esmart_container_private.h
===================================================================
RCS file: /var/cvs/e/e17/libs/esmart/src/lib/esmart_container/esmart_container_private.h,v
retrieving revision 1.7
diff -u -r1.7 esmart_container_private.h
--- src/lib/esmart_container/esmart_container_private.h 12 Jul 2008 06:40:36 -0000 1.7
+++ src/lib/esmart_container/esmart_container_private.h 17 Jul 2008 20:48:11 -0000
@@ -48,6 +48,9 @@
void *data_order_change;
unsigned char changed : 1;
+
+ unsigned char clip_elements : 1; /* decide wether to clip elements to container
+ or not */
};
struct _Container_Element
Index: src/lib/esmart_container/esmart_container_smart.c
===================================================================
RCS file: /var/cvs/e/e17/libs/esmart/src/lib/esmart_container/esmart_container_smart.c,v
retrieving revision 1.7
diff -u -r1.7 esmart_container_smart.c
--- src/lib/esmart_container/esmart_container_smart.c 12 Jul 2008 06:40:36 -0000 1.7
+++ src/lib/esmart_container/esmart_container_smart.c 17 Jul 2008 20:48:11 -0000
@@ -284,22 +284,43 @@
_container_show(Evas_Object *obj)
{
Container *data;
+ Evas_List *l;
data = evas_object_smart_data_get(obj);
evas_object_show(data->clipper);
evas_object_show(data->grabber);
+
+ /* This is needed because clipping is optional */
+ if (!data->clip_elements)
+ {
+ for (l = data->elements; l; l = l->next)
+ {
+ Container_Element *el = l->data;
+
+ evas_object_clip_unset(el->obj);
+ }
+ }
}
void
_container_hide(Evas_Object *obj)
{
Container *data;
+ Evas_List *l;
data = evas_object_smart_data_get(obj);
evas_object_hide(data->clipper);
evas_object_hide(data->grabber);
+
+ /* This is needed because clipping is optional, but we use it anyway when hiding */
+ for (l = data->elements; l; l = l->next)
+ {
+ Container_Element *el = l->data;
+
+ evas_object_clip_set(el->obj, data->clipper);
+ }
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel