elm toolbar/naviframe: Added more documentation about elm_object and
authorDaniel Juyung Seo <seojuyung2@gmail.com>
Mon, 12 Dec 2011 23:53:26 +0000 (23:53 +0000)
committerDaniel Juyung Seo <seojuyung2@gmail.com>
Mon, 12 Dec 2011 23:53:26 +0000 (23:53 +0000)
elm_object_item common APIs support. This needs to be done for other
widgets which support elm_object/elm_object_item.

SVN revision: 66122

src/lib/Elementary.h.in
src/lib/elm_genlist.c
src/lib/els_scroller.c

index f98d3c9..7b8901c 100644 (file)
@@ -15339,6 +15339,13 @@ extern "C" {
     * Default text parts of the toolbar items that you can use for are:
     * @li "default" - label of the toolbar item
     *  
+    * Supported elm_object_item common APIs.
+    * @li elm_object_item_disabled_set
+    * @li elm_object_item_text_set
+    * @li elm_object_item_part_text_set
+    * @li elm_object_item_text_get
+    * @li elm_object_item_part_text_get
+    *
     * List of examples:
     * @li @ref toolbar_example_01
     * @li @ref toolbar_example_02
@@ -29703,6 +29710,22 @@ extern "C" {
     * @li "default" - Title label in the title area
     * @li "subtitle" - Sub-title label in the title area
     *
+    * Supported elm_object common APIs.
+    * @li elm_object_signal_emit
+    *
+    * Supported elm_object_item common APIs.
+    * @li elm_object_item_text_set
+    * @li elm_object_item_part_text_set
+    * @li elm_object_item_text_get
+    * @li elm_object_item_part_text_get
+    * @li elm_object_item_content_set
+    * @li elm_object_item_part_content_set
+    * @li elm_object_item_content_get
+    * @li elm_object_item_part_content_get
+    * @li elm_object_item_content_unset
+    * @li elm_object_item_part_content_unset
+    * @li elm_object_item_signal_emit
+    *
     * @ref tutorial_naviframe gives a good overview of the usage of the API.
     */
 
index 75b25fa..6f9e953 100644 (file)
@@ -5,6 +5,7 @@
 #include "elm_priv.h"
 #include "els_scroller.h"
 #include "elm_genlist.h"
+#include "els_pan.h"
 
 #define MAX_ITEMS_PER_BLOCK 32
 #define REORDER_EFFECT_TIME 0.5
@@ -137,6 +138,7 @@ static void      _item_auto_scroll(Widget_Data *wd);
 static void      _elm_genlist_clear(Evas_Object *obj, Eina_Bool standby);
 
 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
+static void _pan_child_size_get(Evas_Object *obj, Evas_Coord  *w, Evas_Coord  *h);
 
 static const char SIG_ACTIVATED[] = "activated";
 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
@@ -2154,6 +2156,7 @@ _item_position(Elm_Gen_Item *it,
    evas_event_freeze(evas_object_evas_get(it->wd->obj));
    evas_object_resize(view, it->item->w, it->item->h);
    evas_object_move(view, it_x, it_y);
+//fprintf(stderr, "it: %p, x %d y %d\n", view, it_x, it_y);
    evas_object_show(view);
    evas_event_thaw(evas_object_evas_get(it->wd->obj));
    evas_event_thaw_eval(evas_object_evas_get(it->wd->obj));
@@ -2218,6 +2221,7 @@ _item_block_position(Item_Block *itb,
                          }
                        if (!it->item->move_effect_enabled)
                          {
+//fprintf(stderr, "it %p itb->y %d it->y %d pan_y %d oy %d\n", it, itb->y, it->y, it->wd->pan_y, oy);
                             if (it->item->mode_view)
                                _item_position(it, it->item->mode_view, it->item->scrl_x,
                                               it->item->scrl_y);
@@ -2284,6 +2288,29 @@ _must_recalc_idler(void *data)
 }
 
 static void
+_scroll_item(Widget_Data *wd)
+{
+   wd->show_item->item->showme = EINA_FALSE;
+   if (wd->bring_in)
+     elm_smart_scroller_region_bring_in(wd->scr,
+                                        wd->show_item->x +
+                                        wd->show_item->item->block->x,
+                                        wd->show_item->y +
+                                        wd->show_item->item->block->y,
+                                        wd->show_item->item->block->w,
+                                        wd->show_item->item->h);
+   else
+     elm_smart_scroller_child_region_show(wd->scr,
+                                          wd->show_item->x +
+                                          wd->show_item->item->block->x,
+                                          wd->show_item->y +
+                                          wd->show_item->item->block->y,
+                                          wd->show_item->item->block->w,
+                                          wd->show_item->item->h);
+   wd->show_item = NULL;
+}
+
+static void
 _calc_job(void *data)
 {
    Widget_Data *wd = data;
@@ -2292,6 +2319,8 @@ _calc_job(void *data)
    int in = 0;
    Eina_Bool minw_change = EINA_FALSE;
    Eina_Bool did_must_recalc = EINA_FALSE;
+   Evas_Coord pan_w = 0, pan_h = 0;
+   static Eina_Bool check_scroll = EINA_FALSE;
    if (!wd) return;
 
    evas_object_geometry_get(wd->pan_smart, NULL, NULL, &ow, &wd->h);
@@ -2339,27 +2368,25 @@ _calc_job(void *data)
         itb->h = itb->minh;
         y += itb->h;
         in += itb->count;
+
         if ((showme) && (wd->show_item) && (!wd->show_item->item->queued))
+          check_scroll = EINA_TRUE;
+        if (check_scroll)
           {
-             wd->show_item->item->showme = EINA_FALSE;
-             if (wd->bring_in)
-               elm_smart_scroller_region_bring_in(wd->scr,
-                                                  wd->show_item->x +
-                                                  wd->show_item->item->block->x,
-                                                  wd->show_item->y +
-                                                  wd->show_item->item->block->y,
-                                                  wd->show_item->item->block->w,
-                                                  wd->show_item->item->h);
-             else
-               elm_smart_scroller_child_region_show(wd->scr,
-                                                    wd->show_item->x +
-                                                    wd->show_item->item->block->x,
-                                                    wd->show_item->y +
-                                                    wd->show_item->item->block->y,
-                                                    wd->show_item->item->block->w,
-                                                    wd->show_item->item->h);
-             wd->show_item = NULL;
+             _pan_child_size_get(wd->pan_smart, &pan_w, &pan_h);
+             if (ELM_RECTS_INTERSECT(
+                   0, 0, pan_w, pan_h,
+                   wd->show_item->x + wd->show_item->item->block->x,
+                   wd->show_item->y + wd->show_item->item->block->y,
+                   wd->show_item->item->block->w,
+                   wd->show_item->item->h
+                   ))
+               {
+                  _scroll_item(wd);
+                  check_scroll = EINA_FALSE;
+               }
           }
+//fprintf(stderr, "bring in %d %d %d %d : pan child %d %d\n", wd->show_item->x + wd->show_item->item->block->x, wd->show_item->y + wd->show_item->item->block->y, wd->show_item->item->block->w, wd->show_item->item->h, pan_w, pan_h);
      }
    if (minw_change)
      {
@@ -2497,6 +2524,7 @@ _pan_set(Evas_Object *obj,
    //   if (x > ow) x = ow;
    //   if (y > oh) y = oh;
    if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
+//fprintf(stderr, "pan_y %d\n", y);
    sd->wd->pan_x = x;
    sd->wd->pan_y = y;
 
index 327698c..5c329be 100644 (file)
@@ -367,6 +367,7 @@ elm_smart_scroller_bounce_animator_disabled_set(Evas_Object *obj, Eina_Bool disa
 
         if (sd->scrollto.y.animator)
           {
+//fprintf(stderr, "%s %d\n", __func__, __LINE__);
              ecore_animator_del(sd->scrollto.y.animator);
              sd->scrollto.y.animator = NULL;
           }
@@ -539,6 +540,7 @@ _smart_scrollto_y_animator(void *data)
    Evas_Coord px, py;
    double t, tt;
 
+//fprintf(stderr, "%s %d\n", __func__, __LINE__);
    t = ecore_loop_time_get();
    tt = (t - sd->scrollto.y.t_start) / (sd->scrollto.y.t_end - sd->scrollto.y.t_start);
    tt = 1.0 - tt;
@@ -552,10 +554,12 @@ _smart_scrollto_y_animator(void *data)
         elm_smart_scroller_child_pos_set(sd->smart_obj, px, py);
         _update_wanted_coordinates(sd, px, py);
         sd->scrollto.y.animator = NULL;
+fprintf(stderr, "%s %d x %d y %d\n", __func__, __LINE__, px, py);
         if ((!sd->scrollto.x.animator) && (!sd->down.bounce_x_animator))
           _smart_anim_stop(sd->smart_obj);
         return ECORE_CALLBACK_CANCEL;
      }
+fprintf(stderr, "%s %d x %d y %d\n", __func__, __LINE__, px, py);
    elm_smart_scroller_child_pos_set(sd->smart_obj, px, py);
    _update_wanted_coordinates(sd, px, py);
 
@@ -580,11 +584,13 @@ _smart_scrollto_y(Smart_Data *sd, double t_in, Evas_Coord pos_y)
    t = ecore_loop_time_get();
    sd->pan_func.get(sd->pan_obj, &px, &py);
    sd->scrollto.y.start = py;
+fprintf(stderr, "%s %d y.end %d\n", __func__, __LINE__, pos_y);
    sd->scrollto.y.end = pos_y;
    sd->scrollto.y.t_start = t;
    sd->scrollto.y.t_end = t + t_in;
    if (!sd->scrollto.y.animator)
      {
+//fprintf(stderr, "%s %d\n", __func__, __LINE__);
         sd->scrollto.y.animator = ecore_animator_add(_smart_scrollto_y_animator, sd);
         if (!sd->scrollto.x.animator)
           _smart_anim_start(sd->smart_obj);
@@ -967,6 +973,8 @@ bounce_eval(Smart_Data *sd)
                {
                   if (sd->scrollto.y.animator)
                     {
+
+//fprintf(stderr, "%s %d\n", __func__, __LINE__);
                        ecore_animator_del(sd->scrollto.y.animator);
                        sd->scrollto.y.animator = NULL;
                     }
@@ -1022,6 +1030,8 @@ elm_smart_scroller_child_pos_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
         if (y - miny > my) y = my + miny;
      }
 
+//fprintf(stderr, "x %d y %d\n", x, y);
+   if ((px == x) && (py == y)) return;
    sd->pan_func.set(sd->pan_obj, x, y);
    if ((px != x) || (py != y))
      edje_object_signal_emit(sd->edje_obj, "elm,action,scroll", "elm");
@@ -1107,6 +1117,7 @@ _elm_smart_scroller_child_region_show_internal(Evas_Object *obj, Evas_Coord *_x,
      }
    if (sd->scrollto.y.animator)
      {
+//fprintf(stderr, "%s %d\n", __func__, __LINE__);
         ecore_animator_del(sd->scrollto.y.animator);
         sd->scrollto.y.animator = NULL;
      }
@@ -1470,9 +1481,11 @@ _elm_smart_scroller_wanted_region_set(Evas_Object *obj)
    INTERNAL_ENTRY;
    Evas_Coord ww, wh, wx = sd->wx;
 
+//fprintf(stderr, "%s %d animator : %p\n", __func__, __LINE__, sd->scrollto.y.animator);
    if (sd->down.now || sd->down.momentum_animator ||
        sd->down.bounce_x_animator || sd->down.bounce_y_animator ||
-       sd->down.hold_animator || sd->down.onhold_animator) return;
+       sd->down.hold_animator || sd->down.onhold_animator ||
+       sd->scrollto.x.animator || sd->scrollto.y.animator) return;
 
    sd->child.resized = EINA_FALSE;
 
@@ -1604,6 +1617,7 @@ _smart_pan_pan_changed_hook(void *data, Evas_Object *obj __UNUSED__, void *event
      }
    if (sd->scrollto.y.animator)
      {
+//fprintf(stderr, "%s %d\n", __func__, __LINE__);
         ecore_animator_del(sd->scrollto.y.animator);
         sd->scrollto.y.animator = NULL;
      }
@@ -1672,6 +1686,7 @@ _smart_event_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
      }
    if (sd->scrollto.y.animator)
      {
+//fprintf(stderr, "%s %d\n", __func__, __LINE__);
         ecore_animator_del(sd->scrollto.y.animator);
         sd->scrollto.y.animator = NULL;
      }
@@ -1732,6 +1747,7 @@ _smart_event_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSE
           }
         if (sd->scrollto.y.animator)
           {
+//fprintf(stderr, "%s %d\n", __func__, __LINE__);
              ecore_animator_del(sd->scrollto.y.animator);
              sd->scrollto.y.animator = NULL;
           }
@@ -2537,9 +2553,10 @@ _smart_scrollbar_read(Smart_Data *sd)
    edje_object_part_drag_value_get(sd->edje_obj, "elm.dragable.hbar", &vx, NULL);
    sd->pan_func.max_get(sd->pan_obj, &mx, &my);
    sd->pan_func.min_get(sd->pan_obj, &minx, &miny);
-   x = vx * (double)mx + minx;
-   y = vy * (double)my + miny;
+   x = round(vx * (double)mx + minx);
+   y = round(vy * (double)my + miny);
    sd->pan_func.get(sd->pan_obj, &px, &py);
+fprintf(stderr, "y %d vy %f my %d miny %d\n", y, vy, my, miny);
    sd->pan_func.set(sd->pan_obj, x, y);
    if ((px != x) || (py != y))
      edje_object_signal_emit(sd->edje_obj, "elm,action,scroll", "elm");