fix some dynamic object deletion for sub-objects. fix some theme stuff too
authorCarsten Haitzler <raster@rasterman.com>
Thu, 27 Nov 2008 05:41:13 +0000 (05:41 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Thu, 27 Nov 2008 05:41:13 +0000 (05:41 +0000)
for popout hover.

SVN revision: 37818

data/themes/default.edc
src/lib/Elementary.h
src/lib/elm_entry.c
src/lib/elm_hover.c
src/lib/elm_widget.c

index eab6828..cbbc9b9 100644 (file)
@@ -2399,6 +2399,7 @@ collections {
         }
         part { name: "elm.swallow.slot.left";
             type: SWALLOW;
+           clip_to: "leftclip";
            description { state: "default" 0.0;
               align: 0.0 0.5;
               rel1.to: "elm.swallow.slot.middle";
@@ -2456,6 +2457,7 @@ collections {
         }
         part { name: "elm.swallow.slot.right";
             type: SWALLOW;
+           clip_to: "rightclip";
            description { state: "default" 0.0;
               align: 1.0 0.5;
               rel1.to: "elm.swallow.slot.middle";
@@ -2572,6 +2574,7 @@ collections {
         }
         part { name: "elm.swallow.slot.bottom";
             type: SWALLOW;
+           clip_to: "bottomclip";
            description { state: "default" 0.0;
               align: 0.5 1.0;
               rel1.to: "elm.swallow.slot.middle";
index e945380..df60d22 100644 (file)
@@ -192,11 +192,19 @@ extern "C" {
    /* smart callbacks called:
     */
    
+   typedef enum _Elm_Hover_Axis
+     {
+       ELM_HOVER_AXIS_NONE,
+          ELM_HOVER_AXIS_HORIZONTAL,
+          ELM_HOVER_AXIS_VERTICAL,
+          ELM_HOVER_AXIS_BOTH
+     } Elm_Hover_Axis;
    EAPI Evas_Object *elm_hover_add(Evas_Object *parent);
    EAPI void         elm_hover_target_set(Evas_Object *obj, Evas_Object *target);
    EAPI void         elm_hover_parent_set(Evas_Object *obj, Evas_Object *parent);
    EAPI void         elm_hover_content_set(Evas_Object *obj, const char *swallow, Evas_Object *content);
    EAPI void         elm_hover_style_set(Evas_Object *obj, const char *style);
+   EAPI const char  *elm_hover_best_content_location_get(Evas_Object *obj, Elm_Hover_Axis pref_axis);
    /* smart callbacks called:
     * "clicked" - the user clicked the empty space in the hover to dismiss
     */
@@ -309,24 +317,26 @@ extern "C" {
 // * left/right arrow broken with password mode for entry + utf8 chars...
 // 
 //// (incomplete - medium priority)
+// * bubble should allow style (left/right + top/bottom)
+// * hover needs a "best direction" call for where to put entries with constraints
+// * buttons need a "bigbutton" option
 // * disabled not supported
 // * tab widget focusing (not useful for touchscreen tho...)
-// * bubble should allow style (left/right + top/bottom)
 // * on the fly theme changes - test (should work)
 // * entry selection conflicts with finger scroll (make selection start/stop work on signals?)
 // * need a hold-scroll counter in elm_widget
 // * add fullscreen mode on/off for windows
 // 
 //// (more widgets/features - medium priority)
+// * need multi-sel (with button + hover + ...)
+// * need "photoframe" widget (for contact photos?)
 // * toolbar widget (edje + box + button + separators)
 // * listitem widget (simple label + icon)
 // * radio widget + group handling
 // * checkbox widget (like toggle)
 // * need separator widget (h/v)
 // * need slide-open "panel" that can hold stuff and optionally scroll
-// * need "photoframe" widget (for contact photos?)
 // * need calendar widget (select date)
-// * need multi-sel (with button + hover + ...)
 // * need slider widget
 // * need range selector (select range of values from X to Y over an interval)
 // * need "dialogbutton" widget (bigger button for bottom of wins)
index bff687c..d8cec5d 100644 (file)
@@ -110,6 +110,7 @@ _on_focus_hook(void *data, Evas_Object *obj)
 {
    Widget_Data *wd = elm_widget_data_get(obj);
    Evas_Object *top = elm_widget_top_get(obj);
+   if (!wd->editable) return;
    if (elm_widget_focus_get(obj))
      {
         evas_object_focus_set(wd->ent, 1);
index 66e9bc5..08195c1 100644 (file)
@@ -217,8 +217,8 @@ static void
 _signal_dismiss(void *data, Evas_Object *obj, const char *emission, const char *source)
 {
    Widget_Data *wd = elm_widget_data_get(data);
-   evas_object_smart_callback_call(data, "clicked", NULL);
    evas_object_hide(data);
+   evas_object_smart_callback_call(data, "clicked", NULL);
 }
 
 static void
@@ -388,3 +388,41 @@ elm_hover_style_set(Evas_Object *obj, const char *style)
    _reval_content(obj);
    _sizing_eval(obj);
 }
+
+EAPI const char *
+elm_hover_best_content_location_get(Evas_Object *obj, Elm_Hover_Axis pref_axis)
+{
+   Widget_Data *wd = elm_widget_data_get(obj);
+   Evas_Coord x = 0, y = 0, w = 0, h = 0, x2 = 0, y2 = 0, w2 = 0, h2 = 0;
+   Evas_Coord spc_l, spc_r, spc_t, spc_b;
+     
+   if (wd->parent) evas_object_geometry_get(wd->parent, &x, &y, &w, &h);
+   if (wd->hov) evas_object_geometry_get(wd->hov, &x2, &y2, &w2, &h2);
+   spc_l = x2 - x;
+   spc_r = (x + w) - (x2 + w2);
+   if (spc_l < 0) spc_l = 0;
+   if (spc_r < 0) spc_r = 0;
+   spc_t = y2 - y;
+   spc_b = (y + h) - (y2 + y2);
+   if (spc_t < 0) spc_t = 0;
+   if (spc_b < 0) spc_b = 0;
+   if (pref_axis == ELM_HOVER_AXIS_HORIZONTAL)
+     {
+        if (spc_l < spc_r) return "right";
+        else return "left";
+     }
+   else if (pref_axis == ELM_HOVER_AXIS_VERTICAL)
+     {
+        if (spc_t < spc_b) return "bottom";
+        else return "top";
+     }
+   if (spc_l < spc_r)
+     {
+        if (spc_t > spc_r) return "top";
+        else if (spc_b > spc_r) return "bottom";
+        return "right";
+     }
+   if (spc_t > spc_r) return "top";
+   else if (spc_b > spc_r) return "bottom";
+   return "left";
+}
index 20ef1bd..913fb4d 100644 (file)
@@ -55,9 +55,17 @@ static void
 _sub_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
 {
    Smart_Data *sd = data;
-   if (obj == sd->resize_obj) sd->resize_obj = NULL;
+   if (obj == sd->resize_obj)
+     {
+        sd->resize_obj = NULL;
+        evas_object_smart_callback_call(sd->obj, "sub-object-del", obj);
+     }
    else if (obj == sd->hover_obj) sd->hover_obj = NULL;
-   else sd->subobjs = eina_list_remove(sd->subobjs, obj);
+   else
+     {
+        sd->subobjs = eina_list_remove(sd->subobjs, obj);
+        evas_object_smart_callback_call(sd->obj, "sub-object-del", obj);
+     }
 }
 
 static void
@@ -180,13 +188,14 @@ elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj)
      }
    if (!strcmp(evas_object_type_get(sobj), SMART_NAME))
      {
-       sd = evas_object_smart_data_get(sobj);
-       if (sd)
+       Smart_Data *sd2 = evas_object_smart_data_get(sobj);
+       if (sd2)
          {
-            if (sd->parent_obj) elm_widget_sub_object_del(sd->parent_obj, sobj);
-            sd->parent_obj = obj;
+            if (sd2->parent_obj) elm_widget_sub_object_del(sd2->parent_obj, sobj);
+            sd2->parent_obj = obj;
          }
      }
+   evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd);
    evas_object_smart_callback_call(obj, "sub-object-add", sobj);
 }
 
@@ -201,9 +210,10 @@ elm_widget_sub_object_del(Evas_Object *obj, Evas_Object *sobj)
      }
    if (!strcmp(evas_object_type_get(sobj), SMART_NAME))
      {
-       sd = evas_object_smart_data_get(sobj);
-       if (sd) sd->parent_obj = NULL;
+       Smart_Data *sd2 = evas_object_smart_data_get(sobj);
+       if (sd2) sd->parent_obj = NULL;
      }
+   evas_object_event_callback_del(sobj, EVAS_CALLBACK_DEL, _sub_obj_del);
    evas_object_smart_callback_call(obj, "sub-object-del", sobj);
 }