Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_container.c ewl_enums.h ewl_image.c ewl_misc.c ewl_text.c 
        ewl_textarea.c ewl_widget.c ewl_widget.h 


Log Message:
Fix a condition where a newly added widget might not be realized. Added a flag
for marking widgets as used internally. Also changed the widget so that it
doesn't require clipping at its bounds.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_container.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -3 -r1.52 -r1.53
--- ewl_container.c     19 Nov 2003 20:18:34 -0000      1.52
+++ ewl_container.c     22 Nov 2003 20:01:01 -0000      1.53
@@ -627,7 +627,7 @@
        if (!EWL_CONTAINER(w)->children)
                DRETURN(DLEVEL_STABLE);
 
-       if (REALIZED(w))
+       if (REALIZED(w) && w->fx_clip_box)
                evas_object_layer_set(EWL_CONTAINER(w)->clip_box,
                                evas_object_layer_get(w->fx_clip_box));
 
@@ -669,9 +669,11 @@
 
        evas_object_move(c->clip_box, CURRENT_X(w), CURRENT_Y(w));
        evas_object_resize(c->clip_box, CURRENT_W(w), CURRENT_H(w));
-       evas_object_clip_set(c->clip_box, w->fx_clip_box);
-       evas_object_layer_set(c->clip_box,
-                       evas_object_layer_get(w->fx_clip_box));
+       if (w->fx_clip_box) {
+               evas_object_clip_set(c->clip_box, w->fx_clip_box);
+               evas_object_layer_set(c->clip_box,
+                               evas_object_layer_get(w->fx_clip_box));
+       }
 
        if (!c->children || ewd_list_is_empty(c->children))
                DRETURN(DLEVEL_STABLE);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_enums.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -r1.41 -r1.42
--- ewl_enums.h 16 Oct 2003 20:54:25 -0000      1.41
+++ ewl_enums.h 22 Nov 2003 20:01:02 -0000      1.42
@@ -104,27 +104,29 @@
        EWL_FLAG_VISIBLE_SHOWN = 0x10000,
        EWL_FLAG_VISIBLE_REALIZED = 0x20000,
        EWL_FLAG_VISIBLE_OBSCURED = 0x40000,
+       EWL_FLAG_VISIBLE_NOCLIP = 0x80000,
 
-       EWL_FLAG_PROPERTY_RECURSIVE = 0x80000,
-       EWL_FLAG_PROPERTY_TOPLEVEL = 0x100000,
+       EWL_FLAG_PROPERTY_RECURSIVE = 0x100000,
+       EWL_FLAG_PROPERTY_TOPLEVEL = 0x200000,
+       EWL_FLAG_PROPERTY_INTERNAL = 0x400000,
 
        /*
         * Flags to indicate queues this object is on.
         */
-       EWL_FLAG_QUEUED_CSCHEDULED = 0x200000,
-       EWL_FLAG_QUEUED_RSCHEDULED = 0x400000,
-       EWL_FLAG_QUEUED_DSCHEDULED = 0x800000,
+       EWL_FLAG_QUEUED_CSCHEDULED = 0x800000,
+       EWL_FLAG_QUEUED_RSCHEDULED = 0x1000000,
+       EWL_FLAG_QUEUED_DSCHEDULED = 0x2000000,
 
        /*
         * The state enum specifies the current state of a widget, ie. has it
         * been clicked, does it have the keyboard focus, etc.
         */
        EWL_FLAG_STATE_NORMAL = 0,
-       EWL_FLAG_STATE_HILITED = 0x1000000,
-       EWL_FLAG_STATE_PRESSED = 0x2000000,
-       EWL_FLAG_STATE_SELECTED = 0x4000000,
-       EWL_FLAG_STATE_DND = 0x8000000,
-       EWL_FLAG_STATE_DISABLED = 0x10000000
+       EWL_FLAG_STATE_HILITED = 0x4000000,
+       EWL_FLAG_STATE_PRESSED = 0x8000000,
+       EWL_FLAG_STATE_SELECTED = 0x10000000,
+       EWL_FLAG_STATE_DND = 0x20000000,
+       EWL_FLAG_STATE_DISABLED = 0x40000000
 };
 
 #define EWL_FLAG_FILL_NORMAL (EWL_FLAG_FILL_FILL)
@@ -138,10 +140,10 @@
 
 #define EWL_FLAGS_VISIBLE_MASK (EWL_FLAG_VISIBLE_HIDDEN | \
                EWL_FLAG_VISIBLE_SHOWN | EWL_FLAG_VISIBLE_REALIZED | \
-               EWL_FLAG_VISIBLE_OBSCURED)
+               EWL_FLAG_VISIBLE_OBSCURED | EWL_FLAG_VISIBLE_NOCLIP)
 
 #define  EWL_FLAGS_PROPERTY_MASK (EWL_FLAG_PROPERTY_RECURSIVE | \
-               EWL_FLAG_PROPERTY_TOPLEVEL)
+               EWL_FLAG_PROPERTY_TOPLEVEL | EWL_FLAG_PROPERTY_INTERNAL)
 
 #define  EWL_FLAGS_QUEUED_MASK (EWL_FLAG_QUEUED_CSCHEDULED | \
                EWL_FLAG_QUEUED_RSCHEDULED | EWL_FLAG_QUEUED_DSCHEDULED)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_image.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- ewl_image.c 19 Nov 2003 20:18:34 -0000      1.36
+++ ewl_image.c 22 Nov 2003 20:01:02 -0000      1.37
@@ -257,7 +257,8 @@
        }
 
        evas_object_layer_set(i->image, ewl_widget_get_layer_sum(w));
-       evas_object_clip_set(i->image, w->fx_clip_box);
+       if (w->fx_clip_box)
+               evas_object_clip_set(i->image, w->fx_clip_box);
        evas_object_image_size_get(i->image, &i->ow, &i->oh);
        evas_object_show(i->image);
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_misc.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- ewl_misc.c  20 Nov 2003 02:21:29 -0000      1.53
+++ ewl_misc.c  22 Nov 2003 20:01:02 -0000      1.54
@@ -329,6 +329,8 @@
                                        EWL_FLAG_VISIBLE_OBSCURED);
                        if (w->fx_clip_box)
                                evas_object_hide(w->fx_clip_box);
+                       else if (w->theme_object)
+                               evas_object_hide(w->theme_object);
                        /* FIXME: This might be a good idea.
                        if (w->theme_object)
                                edje_object_freeze(w->theme_object);
@@ -339,6 +341,8 @@
                                        EWL_FLAG_VISIBLE_OBSCURED);
                        if (w->fx_clip_box)
                                evas_object_show(w->fx_clip_box);
+                       else if (w->theme_object)
+                               evas_object_show(w->theme_object);
                        /* FIXME: This might be a good idea.
                        if (w->theme_object)
                                edje_object_thaw(w->theme_object);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_text.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -3 -r1.56 -r1.57
--- ewl_text.c  19 Nov 2003 20:18:36 -0000      1.56
+++ ewl_text.c  22 Nov 2003 20:01:02 -0000      1.57
@@ -615,7 +615,8 @@
        /*
         * Adjust the clip box for the estyle and then display it.
         */
-       evas_object_clip_set(t->estyle, w->fx_clip_box);
+       if (w->fx_clip_box)
+               evas_object_clip_set(t->estyle, w->fx_clip_box);
        evas_object_layer_set(t->estyle, ewl_widget_get_layer_sum(w));
        evas_object_show(t->estyle);
 
@@ -677,7 +678,8 @@
                DRETURN(DLEVEL_STABLE);
 
 
-       evas_object_clip_set(t->estyle, w->fx_clip_box);
+       if (w->fx_clip_box)
+               evas_object_clip_set(t->estyle, w->fx_clip_box);
        evas_object_layer_set(t->estyle, ewl_widget_get_layer_sum(w));
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_textarea.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- ewl_textarea.c      19 Nov 2003 20:18:36 -0000      1.21
+++ ewl_textarea.c      22 Nov 2003 20:01:02 -0000      1.22
@@ -209,7 +209,8 @@
                etox_context_set_color(etox_get_context(ta->etox), r, g, b, a);
        }
 
-       evas_object_clip_set(ta->etox, w->fx_clip_box);
+       if (w->fx_clip_box)
+               evas_object_clip_set(ta->etox, w->fx_clip_box);
 
        /*
         * Now set the text and display it.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_widget.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -3 -r1.88 -r1.89
--- ewl_widget.c        19 Nov 2003 20:18:36 -0000      1.88
+++ ewl_widget.c        22 Nov 2003 20:01:02 -0000      1.89
@@ -512,9 +512,15 @@
                if (!op)
                        ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
                                        ewl_widget_child_destroy_cb, NULL);
-               if (REALIZED(w) && VISIBLE(w)) {
-                       ewl_callback_call(w, EWL_CALLBACK_REPARENT);
-                       ewl_container_call_child_add(EWL_CONTAINER(p), w);
+               if (VISIBLE(w)) {
+                       if (REALIZED(w)) {
+                               ewl_callback_call(w, EWL_CALLBACK_REPARENT);
+                               ewl_container_call_child_add(EWL_CONTAINER(p),
+                                                            w);
+                       }
+                       else {
+                               ewl_realize_request(w);
+                       }
                }
        }
 
@@ -587,7 +593,7 @@
        /*
         * Modify the current layer of the objects if realized.
         */
-       if (REALIZED(w)) {
+       if (REALIZED(w) && w->fx_clip_box) {
                int temp;
 
                temp = evas_object_layer_get(w->fx_clip_box) + layer - LAYER(w);
@@ -631,7 +637,7 @@
                w = w->parent;
        }
 
-       if (REALIZED(w))
+       if (REALIZED(w) && w->fx_clip_box)
                sum += evas_object_layer_get(w->fx_clip_box);
        else
                sum += LAYER(w);
@@ -705,6 +711,103 @@
                        (REALIZED(w) ? "realized" : "not realized"));
 }
 
+/**
+ * @param w: the widget to mark as internally used
+ * @param val: a boolean to indicate the state of the internal flag
+ * @return Returns no value.
+ * @brief Marks a widget as one used internally to another container.
+ *
+ * Indicate whether a widget is to be used as an internal decoration on
+ * another widget. This allows for using some of the standard container
+ * functions to access the contents of complex widgets w/o fear of damaging
+ * internal layout structure.
+ */
+void ewl_widget_set_internal(Ewl_Widget *w, unsigned int val)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       if (val)
+               ewl_object_add_flags(EWL_OBJECT(w), EWL_FLAG_PROPERTY_INTERNAL,
+                               EWL_FLAGS_PROPERTY_MASK);
+       else
+               ewl_object_remove_flags(EWL_OBJECT(w),
+                               EWL_FLAG_PROPERTY_INTERNAL,
+                               EWL_FLAGS_PROPERTY_MASK);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param w: the widget to query the state of the internal flag
+ * @return Returns TRUE if the widget is marked internal, otherwise FALSE.
+ * @brief Checks the widget for the internal flag.
+ */
+unsigned int ewl_widget_is_internal(Ewl_Widget *w)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       if (ewl_object_has_flags(EWL_OBJECT(w), EWL_FLAG_PROPERTY_INTERNAL,
+                               EWL_FLAGS_PROPERTY_MASK))
+               DRETURN_INT(TRUE, DLEVEL_STABLE);
+
+       DRETURN_INT(FALSE, DLEVEL_STABLE);
+}
+
+/**
+ * @param w: the widget to mark as unclipped
+ * @param val: the state of the clipping flag
+ * @return Returns no value.
+ * @brief Marks whether the widget should be clipped at it's boundaries.
+ */
+void ewl_widget_set_clipped(Ewl_Widget *w, unsigned int val)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       if (val)
+               ewl_object_remove_flags(EWL_OBJECT(w), EWL_FLAG_VISIBLE_NOCLIP,
+                               EWL_FLAGS_VISIBLE_MASK);
+       else
+               ewl_object_add_flags(EWL_OBJECT(w), EWL_FLAG_VISIBLE_NOCLIP,
+                               EWL_FLAGS_VISIBLE_MASK);
+
+       if (!REALIZED(w) || (val && w->fx_clip_box) ||
+                       (!val && !w->fx_clip_box))
+               DRETURN(DLEVEL_STABLE);
+
+       if (val) {
+               Ewl_Embed *emb;
+
+               emb = ewl_embed_find_by_widget(w);
+               if (!emb || !emb->evas)
+                       DRETURN(DLEVEL_STABLE);
+
+               w->fx_clip_box = evas_object_rectangle_add(emb->evas);
+               ewl_widget_configure(w);
+       }
+       else {
+               ewl_evas_object_destroy(w->fx_clip_box);
+               w->fx_clip_box = NULL;
+       }
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @param w: the widget to check if it clips it's theme object
+ * @return Returns TRUE if the widget clips, otherwise FALSE.
+ * @brief Checks if a widget clips it's theme object.
+ */
+unsigned int ewl_widget_is_clipped(Ewl_Widget *w)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+
+       if (ewl_object_has_flags(EWL_OBJECT(w), EWL_FLAG_VISIBLE_NOCLIP,
+                       EWL_FLAGS_VISIBLE_MASK))
+               DRETURN_INT(FALSE, DLEVEL_STABLE);
+
+       DRETURN_INT(TRUE, DLEVEL_STABLE);
+}
+
 /*
  * Perform the series of operations common to every widget when
  * they are destroyed. This should ALWAYS be the the last callback
@@ -806,15 +909,19 @@
         * Create the fx clip box where special fx can be drawn to affect the
         * entire contents of the widget
         */
-       w->fx_clip_box = evas_object_rectangle_add(emb->evas);
-       evas_object_layer_set(w->fx_clip_box, ewl_widget_get_layer_sum(w));
+       if (!ewl_object_get_flags(EWL_OBJECT(w), EWL_FLAG_VISIBLE_NOCLIP))
+               w->fx_clip_box = evas_object_rectangle_add(emb->evas);
+
+       if (w->fx_clip_box)
+               evas_object_layer_set(w->fx_clip_box,
+                               ewl_widget_get_layer_sum(w));
 
        pc = EWL_CONTAINER(w->parent);
 
        /*
         * Clip the fx_clip_box to the parent clip_box.
         */
-       if (pc && pc->clip_box)
+       if (pc && pc->clip_box && w->fx_clip_box)
                evas_object_clip_set(w->fx_clip_box, pc->clip_box);
 
        /*
@@ -1009,9 +1116,9 @@
 void ewl_widget_reparent_cb(Ewl_Widget * w, void *ev_data, void *user_data)
 {
        int             layer;
-       Evas           *oevas;
        Ewl_Container  *pc;
        Ewl_Embed      *emb;
+       Evas           *oevas = NULL;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
@@ -1024,7 +1131,11 @@
         * If the new parent is on a different evas, we must re-realize it.
         */
        if (REALIZED(w)) {
-               oevas = evas_object_evas_get(w->fx_clip_box);
+               if (w->fx_clip_box)
+                       oevas = evas_object_evas_get(w->fx_clip_box);
+               else if (w->theme_object)
+                       oevas = evas_object_evas_get(w->theme_object);
+
                emb = ewl_embed_find_by_widget(w);
                if (!emb || oevas != emb->evas)
                        ewl_widget_unrealize(w);
@@ -1039,7 +1150,8 @@
 
                        layer = ewl_widget_get_layer_sum(EWL_WIDGET(pc)) +
                                LAYER(w);
-                       evas_object_layer_set(w->fx_clip_box, layer);
+                       if (w->fx_clip_box)
+                               evas_object_layer_set(w->fx_clip_box, layer);
                        if (w->theme_object)
                                evas_object_layer_set(w->theme_object, layer);
                }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_widget.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ewl_widget.h        19 Nov 2003 20:18:36 -0000      1.37
+++ ewl_widget.h        22 Nov 2003 20:01:03 -0000      1.38
@@ -144,6 +144,12 @@
 void            ewl_widget_set_layer(Ewl_Widget *w, int layer);
 int             ewl_widget_get_layer(Ewl_Widget *w);
 
+void            ewl_widget_set_internal(Ewl_Widget *w, unsigned int val);
+unsigned int    ewl_widget_is_internal(Ewl_Widget *w);
+
+void            ewl_widget_set_clipped(Ewl_Widget *w, unsigned int val);
+unsigned int    ewl_widget_is_clipped(Ewl_Widget *w);
+
 /**
  * @def LAYER(w)
  * Used to retrieve the layer of a widget.




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to