summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--legacy/elementary/ChangeLog5
-rw-r--r--legacy/elementary/NEWS1
-rw-r--r--legacy/elementary/src/examples/Makefile.am6
-rw-r--r--legacy/elementary/src/lib/elm_main.c19
-rw-r--r--legacy/elementary/src/lib/elm_object_item.h73
-rw-r--r--legacy/elementary/src/lib/elm_widget.c129
-rw-r--r--legacy/elementary/src/lib/elm_widget.h5
7 files changed, 236 insertions, 2 deletions
diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog
index 973c714c9f..4eced1316e 100644
--- a/legacy/elementary/ChangeLog
+++ b/legacy/elementary/ChangeLog
@@ -1611,3 +1611,8 @@
16112013-09-12 Ryuan Choi (ryuan) 16112013-09-12 Ryuan Choi (ryuan)
1612 1612
1613 * elc_fileselector : Added "selected,invalid" smart callbacks. 1613 * elc_fileselector : Added "selected,invalid" smart callbacks.
1614
16152013-09-12 ChunEon Park (Hermet)
1616
1617 * elm_object_item : Introduces new APIs, elm_object_item_track(),
1618 elm_object_item_untrack(), elm_object_item_track_get().
diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS
index 029433f872..78c1369a82 100644
--- a/legacy/elementary/NEWS
+++ b/legacy/elementary/NEWS
@@ -89,6 +89,7 @@ Additions:
89 * Add elm_table_child_get(). 89 * Add elm_table_child_get().
90 * Add support for flip focus direction. 90 * Add support for flip focus direction.
91 * Add "selected,invalid" smart callback for fileselector. 91 * Add "selected,invalid" smart callback for fileselector.
92 * elm_object_item : Introduces new APIs, elm_object_item_track(), elm_object_item_untrack(), elm_object_item_track_get().
92 93
93Improvements: 94Improvements:
94 95
diff --git a/legacy/elementary/src/examples/Makefile.am b/legacy/elementary/src/examples/Makefile.am
index 07b29dee77..32beda884f 100644
--- a/legacy/elementary/src/examples/Makefile.am
+++ b/legacy/elementary/src/examples/Makefile.am
@@ -148,7 +148,8 @@ transit_example_03.c \
148transit_example_04.c \ 148transit_example_04.c \
149web_example_01.c \ 149web_example_01.c \
150web_example_02.c \ 150web_example_02.c \
151win_example.c 151win_example.c \
152track_example_01.c
152 153
153.edc.edj: 154.edc.edj:
154 $(EDJE_CC) $(EDJE_FLAGS) $< $@ 155 $(EDJE_CC) $(EDJE_FLAGS) $< $@
@@ -286,7 +287,8 @@ transit_example_03 \
286transit_example_04 \ 287transit_example_04 \
287web_example_01 \ 288web_example_01 \
288web_example_02 \ 289web_example_02 \
289win_example 290win_example \
291track_example_01.c
290 292
291if ELEMENTARY_WINDOWS_BUILD 293if ELEMENTARY_WINDOWS_BUILD
292efl_thread_1_SOURCES = efl_thread_win32_1.c 294efl_thread_1_SOURCES = efl_thread_win32_1.c
diff --git a/legacy/elementary/src/lib/elm_main.c b/legacy/elementary/src/lib/elm_main.c
index 17654c6c04..f3c9a1fb68 100644
--- a/legacy/elementary/src/lib/elm_main.c
+++ b/legacy/elementary/src/lib/elm_main.c
@@ -1899,3 +1899,22 @@ elm_object_item_cursor_engine_only_get(const Elm_Object_Item *it)
1899{ 1899{
1900 return elm_widget_item_cursor_engine_only_get(it); 1900 return elm_widget_item_cursor_engine_only_get(it);
1901} 1901}
1902
1903EAPI Evas_Object *
1904elm_object_item_track(Elm_Object_Item *it)
1905{
1906 return elm_widget_item_track((Elm_Widget_Item *)it);
1907}
1908
1909void
1910elm_object_item_untrack(Elm_Object_Item *it)
1911{
1912 elm_widget_item_untrack((Elm_Widget_Item *)it);
1913}
1914
1915int
1916elm_object_item_track_get(const Elm_Object_Item *it)
1917{
1918 return elm_widget_item_track_get((Elm_Widget_Item *)it);
1919}
1920
diff --git a/legacy/elementary/src/lib/elm_object_item.h b/legacy/elementary/src/lib/elm_object_item.h
index 8a0ccde906..cce8f8dfc8 100644
--- a/legacy/elementary/src/lib/elm_object_item.h
+++ b/legacy/elementary/src/lib/elm_object_item.h
@@ -652,3 +652,76 @@ EAPI void elm_object_item_cursor_engine_only_set(Elm_Obj
652 * @ingroup General 652 * @ingroup General
653 */ 653 */
654EAPI Eina_Bool elm_object_item_cursor_engine_only_get(const Elm_Object_Item *it); 654EAPI Eina_Bool elm_object_item_cursor_engine_only_get(const Elm_Object_Item *it);
655
656/**
657 * This returns track object of the item.
658 *
659 * @param it The Elementary Object Item to be tracked.
660 * @return The track object.
661 *
662 * @note This gets a rectangle object that represents the object item's internal
663 * object. If you wanna check the geometry, visibility of the item, you
664 * can call the evas apis such as evas_object_geometry_get(),
665 * evas_object_visible_get() to the track object. Note that all of the
666 * widget items may/may not have the internal object so this api may
667 * return @c NULL if the widget item doesn't have it. Additionally, the
668 * widget item is managed/controlled by the widget, the widget item could
669 * be changed(moved, resized even deleted) anytime by it's own widget's
670 * decision. So please dont' change the track object as well as don't
671 * keep the track object in your side as possible but get the track object
672 * at the moment you need to refer. Otherwise, you need to add some
673 * callbacks to the track object to track it's attributes changes.
674 *
675 * @warning After use the track object, please call the
676 * elm_object_item_untrack() paired to elm_object_item_track()
677 * definitely to free the track object properly. Don't delete the
678 * track object.
679 *
680 * @see elm_object_item_untrack()
681 * @see elm_object_item_track_get()
682 *
683 * @since 1.8
684 *
685 * @ingroup General
686 */
687EAPI Evas_Object *elm_object_item_track(Elm_Object_Item *it);
688
689/**
690 * This retrieve the track object of the item.
691 *
692 * @param it The Elementary Object Item that returned track object.
693 *
694 * @note This retrieves the track object that was returned from
695 * elm_object_item_track().
696 *
697 * @see elm_object_item_track()
698 * @see elm_object_item_track_get()
699 *
700 * @since 1.8
701 *
702 * @ingroup General
703 */
704EAPI void elm_object_item_untrack(Elm_Object_Item *it);
705
706/**
707 * Get the track object reference count.
708 *
709 * @param it The Elementary Object Item that returned track object.
710 *
711 * @note This gets the reference count for the track object. Whenever you call
712 * the elm_object_item_track(), the reference count will be increased by
713 * one. Likely the referece count will be decreased again when you call
714 * the elm_object_item_untrack(). Unless the reference count reaches to
715 * zero, the track object won't be deleted. So please be sure to call
716 * elm_object_item_untrack() paired to the elm_object_item_track() call
717 * count.
718 *
719 * @see elm_object_item_track()
720 * @see elm_object_item_track_get()
721 *
722 * @since 1.8
723 *
724 * @ingroup General
725 */
726EAPI int elm_object_item_track_get(const Elm_Object_Item *it);
727
diff --git a/legacy/elementary/src/lib/elm_widget.c b/legacy/elementary/src/lib/elm_widget.c
index c94f894da0..1aa2bbcb22 100644
--- a/legacy/elementary/src/lib/elm_widget.c
+++ b/legacy/elementary/src/lib/elm_widget.c
@@ -4867,6 +4867,68 @@ _elm_widget_orientation_set(Eo *obj __UNUSED__, void *_pd, va_list *list)
4867 if (ret) *ret = EINA_TRUE; 4867 if (ret) *ret = EINA_TRUE;
4868} 4868}
4869 4869
4870static void
4871_track_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
4872
4873static void
4874_track_obj_update(Evas_Object *track, Evas_Object *obj)
4875{
4876 //Geometry
4877 Evas_Coord x, y, w, h;
4878 evas_object_geometry_get(obj, &x, &y, &w, &h);
4879 evas_object_move(track, x, y);
4880 evas_object_resize(track, w, h);
4881
4882 //Visibility
4883 if (evas_object_visible_get(obj)) evas_object_show(track);
4884 else evas_object_hide(track);
4885}
4886
4887static void
4888_track_obj_view_update(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
4889 void *event_info EINA_UNUSED)
4890{
4891 Evas_Object *track = data;
4892 _track_obj_update(track, obj);
4893}
4894
4895static void
4896_track_obj_view_del(void *data, Evas *e EINA_UNUSED,
4897 Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
4898{
4899 Elm_Widget_Item *item = data;
4900
4901 while (evas_object_ref_get(item->track_obj) > 0)
4902 evas_object_unref(item->track_obj);
4903
4904 evas_object_event_callback_del(item->track_obj, EVAS_CALLBACK_DEL,
4905 _track_obj_del);
4906 evas_object_del(item->track_obj);
4907 item->track_obj = NULL;
4908}
4909
4910static void
4911_track_obj_del(void *data, Evas *e EINA_UNUSED,
4912 Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
4913{
4914 Elm_Widget_Item *item = data;
4915 item->track_obj = NULL;
4916
4917 if (!item->view) return;
4918
4919 evas_object_event_callback_del(item->view, EVAS_CALLBACK_RESIZE,
4920 _track_obj_view_update);
4921 evas_object_event_callback_del(item->view, EVAS_CALLBACK_MOVE,
4922 _track_obj_view_update);
4923 evas_object_event_callback_del(item->view, EVAS_CALLBACK_SHOW,
4924 _track_obj_view_update);
4925 evas_object_event_callback_del(item->view, EVAS_CALLBACK_HIDE,
4926 _track_obj_view_update);
4927 evas_object_event_callback_del(item->view, EVAS_CALLBACK_DEL,
4928 _track_obj_view_del);
4929}
4930
4931
4870/** 4932/**
4871 * @internal 4933 * @internal
4872 * 4934 *
@@ -4923,6 +4985,13 @@ _elm_widget_item_free(Elm_Widget_Item *item)
4923 if (item->access_info) 4985 if (item->access_info)
4924 eina_stringshare_del(item->access_info); 4986 eina_stringshare_del(item->access_info);
4925 4987
4988 if (item->track_obj)
4989 {
4990 evas_object_event_callback_del(item->track_obj, EVAS_CALLBACK_DEL,
4991 _track_obj_del);
4992 evas_object_del(item->track_obj);
4993 }
4994
4926 EINA_LIST_FREE(item->signals, wisd) 4995 EINA_LIST_FREE(item->signals, wisd)
4927 { 4996 {
4928 eina_stringshare_del(wisd->emission); 4997 eina_stringshare_del(wisd->emission);
@@ -5204,6 +5273,66 @@ _elm_widget_item_domain_part_text_translatable_set(Elm_Widget_Item *item,
5204 item->on_translate = EINA_FALSE; 5273 item->on_translate = EINA_FALSE;
5205} 5274}
5206 5275
5276EAPI Evas_Object *
5277elm_widget_item_track(Elm_Widget_Item *item)
5278{
5279 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
5280
5281 if (item->track_obj)
5282 {
5283 evas_object_ref(item->track_obj);
5284 return item->track_obj;
5285 }
5286
5287 if (!item->view) return NULL;
5288
5289 Evas_Object *track =
5290 evas_object_rectangle_add(evas_object_evas_get(item->widget));
5291 evas_object_color_set(track, 0, 0, 0, 0);
5292 evas_object_pass_events_set(track, EINA_TRUE);
5293 _track_obj_update(track, item->view);
5294 evas_object_event_callback_add(track, EVAS_CALLBACK_DEL, _track_obj_del,
5295 item);
5296
5297 evas_object_event_callback_add(item->view, EVAS_CALLBACK_RESIZE,
5298 _track_obj_view_update, track);
5299 evas_object_event_callback_add(item->view, EVAS_CALLBACK_MOVE,
5300 _track_obj_view_update, track);
5301 evas_object_event_callback_add(item->view, EVAS_CALLBACK_SHOW,
5302 _track_obj_view_update, track);
5303 evas_object_event_callback_add(item->view, EVAS_CALLBACK_HIDE,
5304 _track_obj_view_update, track);
5305 evas_object_event_callback_add(item->view, EVAS_CALLBACK_DEL,
5306 _track_obj_view_del, item);
5307
5308 evas_object_ref(track);
5309
5310 item->track_obj = track;
5311
5312 return track;
5313}
5314
5315void
5316elm_widget_item_untrack(Elm_Widget_Item *item)
5317{
5318 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
5319
5320 if (!item->track_obj) return;
5321 evas_object_unref(item->track_obj);
5322
5323 if (evas_object_ref_get(item->track_obj) == 0)
5324 evas_object_del(item->track_obj);
5325}
5326
5327int
5328elm_widget_item_track_get(const Elm_Widget_Item *item)
5329{
5330 ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, 0);
5331
5332 if (!item->track_obj) return 0;
5333 return evas_object_ref_get(item->track_obj);
5334}
5335
5207typedef struct _Elm_Widget_Item_Tooltip Elm_Widget_Item_Tooltip; 5336typedef struct _Elm_Widget_Item_Tooltip Elm_Widget_Item_Tooltip;
5208 5337
5209struct _Elm_Widget_Item_Tooltip 5338struct _Elm_Widget_Item_Tooltip
diff --git a/legacy/elementary/src/lib/elm_widget.h b/legacy/elementary/src/lib/elm_widget.h
index 48d8736652..6b65601136 100644
--- a/legacy/elementary/src/lib/elm_widget.h
+++ b/legacy/elementary/src/lib/elm_widget.h
@@ -579,6 +579,7 @@ struct _Elm_Widget_Item
579 Eina_List *access_order; 579 Eina_List *access_order;
580 Eina_Inlist *translate_strings; 580 Eina_Inlist *translate_strings;
581 Eina_List *signals; 581 Eina_List *signals;
582 Evas_Object *track_obj;
582 583
583 Eina_Bool disabled : 1; 584 Eina_Bool disabled : 1;
584 Eina_Bool on_translate : 1; 585 Eina_Bool on_translate : 1;
@@ -772,6 +773,10 @@ EAPI const char * _elm_widget_item_translatable_part_text_get(const Elm_Widg
772EAPI void _elm_widget_item_translate(Elm_Widget_Item *item); 773EAPI void _elm_widget_item_translate(Elm_Widget_Item *item);
773EAPI void _elm_widget_item_domain_part_text_translatable_set(Elm_Widget_Item *item, const char *part, const char *domain, Eina_Bool translatable); 774EAPI void _elm_widget_item_domain_part_text_translatable_set(Elm_Widget_Item *item, const char *part, const char *domain, Eina_Bool translatable);
774 775
776EAPI Evas_Object *elm_widget_item_track(Elm_Widget_Item *item);
777EAPI void elm_widget_item_untrack(Elm_Widget_Item *item);
778EAPI int elm_widget_item_track_get(const Elm_Widget_Item *item);
779
775/** 780/**
776 * Function to operate on a given widget's scrollabe children when necessary. 781 * Function to operate on a given widget's scrollabe children when necessary.
777 * @warning free the returned list with eina_list_free(). 782 * @warning free the returned list with eina_list_free().