/po/stamp-po
/doc/Doxyfile
/src/examples/actionslider_example_01
-<<<<<<< HEAD
-/doc/widget_preview_button1
-/doc/widget_preview_button2
-/doc/widget_preview_button3
-/config.guess.cdbs-orig
-/config.sub.cdbs-orig
-/config/slp/base.cfg
-/debian/files
-/debian/*.log
-/debian/*.substvars
-/debian/libelm-bin/
-/debian/libelm-dbg/
-/debian/libelm-dev/
-/debian/*.debhelper
-/debian/libelm/
-/debian/stamp-*
-/debian/tmp/
-=======
/doc/widget_preview_*
/doc/widgets/widget_preview_*
src/examples/bg_example_01
src/examples/web_example
src/examples/win_example
src/examples/dayselector_example
->>>>>>> remotes/origin/upstream
+/config.guess.cdbs-orig
+/config.sub.cdbs-orig
+/config/slp/base.cfg
+/debian/files
+/debian/*.log
+/debian/*.substvars
+/debian/libelm-bin/
+/debian/libelm-dbg/
+/debian/libelm-dev/
+/debian/*.debhelper
+/debian/libelm/
+/debian/stamp-*
+/debian/tmp/
-<<<<<<< HEAD
-Elementary - a basic widget set that is easy to use based on EFL for mobile
-touch-screen devices.
-
-=======
Elementary - a basic widget set library that is easy to use and is based on EFL.
It provides the basic building blocks for creating applications and user interfaces.
following link.
http://docs.enlightenment.org/auto/elementary/
->>>>>>> remotes/origin/upstream
MAINTAINERCLEANFILES = Makefile.in
-<<<<<<< HEAD
SUBDIRS = default standard illume slp
-=======
-SUBDIRS = default standard illume
->>>>>>> remotes/origin/upstream
EET_EET = @eet_eet@
value "zoom_friction" double: 0.5;
value "thumbscroll_border_friction" double: 0.5;
value "thumbscroll_sensitivity_friction" double: 0.25;
-<<<<<<< HEAD
-=======
value "scroll_smooth_amount" double: 0.0;
value "scroll_smooth_history_weight" double: 0.3;
value "scroll_smooth_future_time" double: 0.0;
value "scroll_smooth_time_window" double: 0.2;
->>>>>>> remotes/origin/upstream
value "scale" double: 1.0;
value "bgpixmap" int: 0;
value "compositing" int: 1;
value "finger_size" int: 40;
value "fps" double: 60.0;
value "theme" string: "default";
-<<<<<<< HEAD
- value "modules" string: "";
-=======
value "modules" string: "datetime_input_ctxpopup>datetime/api";
->>>>>>> remotes/origin/upstream
value "tooltip_delay" double: 1.0;
value "cursor_engine_only" uchar: 1;
value "focus_highlight_enable" uchar: 0;
value "glayer_rotate_angular_tolerance" double: 2.0;
value "glayer_line_min_length" double: 1.0;
value "glayer_line_distance_tolerance" double: 3.0;
-<<<<<<< HEAD
- value "glayer_line_angular_tolerance" double: 20.0
- value "glayer_flick_time_limit_ms" uint: 120; /* ms to finish flick */
- value "glayer_long_tap_start_timeout" double: 1.2; /* sec to start long-tap */
- value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */
-=======
value "glayer_line_angular_tolerance" double: 20.0;
value "glayer_flick_time_limit_ms" uint: 120; /* ms to finish flick */
value "glayer_long_tap_start_timeout" double: 1.2; /* sec to start long-tap */
value "week_start" int: 1;
value "weekend_start" int: 6;
value "weekend_len" int: 2;
->>>>>>> remotes/origin/upstream
}
value "zoom_friction" double: 0.5;
value "thumbscroll_border_friction" double: 0.5;
value "thumbscroll_sensitivity_friction" double: 0.25;
-<<<<<<< HEAD
value "scroll_smooth_time_interval" double: 0.008;
-=======
->>>>>>> remotes/origin/upstream
value "scroll_smooth_amount" double: 1.0;
value "scroll_smooth_history_weight" double: 0.3;
value "scroll_smooth_future_time" double: 0.0;
value "finger_size" int: 40;
value "fps" double: 60.0;
value "theme" string: "default";
-<<<<<<< HEAD
- value "modules" string: "";
-=======
value "modules" string: "datetime_input_ctxpopup>datetime/api";
->>>>>>> remotes/origin/upstream
value "tooltip_delay" double: 1.0;
value "cursor_engine_only" uchar: 1;
value "focus_highlight_enable" uchar: 0;
value "glayer_flick_time_limit_ms" uint: 100; /* ms to finish flick */
value "glayer_long_tap_start_timeout" double: 1.2; /* sec to start long-tap */
value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */
-<<<<<<< HEAD
-=======
value "week_start" int: 1;
value "weekend_start" int: 6;
value "weekend_len" int: 2;
->>>>>>> remotes/origin/upstream
}
value "finger_size" int: 5;
value "fps" double: 60.0;
value "theme" string: "default-desktop";
-<<<<<<< HEAD
- value "modules" string: "";
-=======
value "modules" string: "datetime_input_ctxpopup>datetime/api";
->>>>>>> remotes/origin/upstream
value "tooltip_delay" double: 1.0;
value "cursor_engine_only" uchar: 1;
value "focus_highlight_enable" uchar: 0;
value "glayer_flick_time_limit_ms" uint: 120; /* ms to finish flick */
value "glayer_long_tap_start_timeout" double: 1.2; /* sec to start long-tap */
value "glayer_continues_enable" uchar: 1; /* Continues gesture enabled */
-<<<<<<< HEAD
-=======
value "week_start" int: 1;
value "weekend_start" int: 6;
value "weekend_len" int: 2;
->>>>>>> remotes/origin/upstream
}
+++ /dev/null
-#include <Elementary.h>
-#include "elm_priv.h"
-
-typedef struct _Widget_Data Widget_Data;
-typedef struct _Elm_Anchorblock_Item_Provider Elm_Anchorblock_Item_Provider;
-
-struct _Widget_Data
-{
- Evas_Object *entry;
- Evas_Object *hover_parent;
- Evas_Object *pop, *hover;
- Eina_List *item_providers;
- const char *hover_style;
-};
-
-struct _Elm_Anchorblock_Item_Provider
-{
- Evas_Object *(*func) (void *data, Evas_Object *anchorblock, const char *item);
- void *data;
-};
-
-static const char *widtype = NULL;
-
-static const char SIG_ANCHOR_CLICKED[] = "anchor,clicked";
-static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_ANCHOR_CLICKED, ""}, /* TODO: declare the type properly, as data is
- * being passed
- */
- {NULL, NULL}
-};
-
-static void _del_pre_hook(Evas_Object *obj);
-static void _del_hook(Evas_Object *obj);
-static void _sizing_eval(Evas_Object *obj);
-static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
-
-static void
-_del_pre_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- evas_object_event_callback_del_full(wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- elm_anchorblock_hover_end(obj);
- elm_anchorblock_hover_parent_set(obj, NULL);
-}
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Elm_Anchorblock_Item_Provider *ip;
- if (!wd) return;
- if (wd->hover_style) eina_stringshare_del(wd->hover_style);
- EINA_LIST_FREE(wd->item_providers, ip)
- {
- free(ip);
- }
- free(wd);
-}
-
-static void
-_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_widget_mirrored_set(wd->hover, rtl);
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- _elm_widget_mirrored_reload(obj);
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
- if (!wd) return;
- evas_object_size_hint_min_get(wd->entry, &minw, &minh);
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, maxw, maxh);
-}
-
-static void
-_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- _sizing_eval(data);
-}
-
-static void
-_hover_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- elm_anchorblock_hover_end(data);
-}
-
-static void
-_anchor_clicked(void *data, Evas_Object *obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Elm_Entry_Anchor_Info *info = event_info;
- Evas_Object *hover_parent;
- Elm_Entry_Anchorblock_Info ei;
- Evas_Coord x, w, y, h, px, py;
- if (!wd) return;
- wd->pop = elm_icon_add(obj);
- evas_object_move(wd->pop, info->x, info->y);
- evas_object_resize(wd->pop, info->w, info->h);
- wd->hover = elm_hover_add(obj);
- elm_widget_mirrored_set(wd->hover, elm_widget_mirrored_get((Evas_Object *) data));
- if (wd->hover_style)
- elm_object_style_set(wd->hover, wd->hover_style);
- hover_parent = wd->hover_parent;
- if (!hover_parent) hover_parent = obj;
- elm_hover_parent_set(wd->hover, hover_parent);
- elm_hover_target_set(wd->hover, wd->pop);
- ei.name = info->name;
- ei.button = info->button;
- ei.hover = wd->hover;
- ei.anchor.x = info->x;
- ei.anchor.y = info->y;
- ei.anchor.w = info->w;
- ei.anchor.h = info->h;
- evas_object_geometry_get(hover_parent, &x, &y, &w, &h);
- ei.hover_parent.x = x;
- ei.hover_parent.y = y;
- ei.hover_parent.w = w;
- ei.hover_parent.h = h;
- px = info->x + (info->w / 2);
- py = info->y + (info->h / 2);
- ei.hover_left = 1;
- if (px < (x + (w / 3))) ei.hover_left = 0;
- ei.hover_right = 1;
- if (px > (x + ((w * 2) / 3))) ei.hover_right = 0;
- ei.hover_top = 1;
- if (py < (y + (h / 3))) ei.hover_top = 0;
- ei.hover_bottom = 1;
- if (py > (y + ((h * 2) / 3))) ei.hover_bottom = 0;
-
- if (elm_widget_mirrored_get(wd->hover))
- { /* Swap right and left because they switch sides in RTL */
- Eina_Bool tmp = ei.hover_left;
- ei.hover_left = ei.hover_right;
- ei.hover_right = tmp;
- }
-
- evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei);
- evas_object_smart_callback_add(wd->hover, "clicked", _hover_clicked, data);
- evas_object_show(wd->hover);
-}
-
-static void
-_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- wd->hover_parent = NULL;
-}
-
-static Evas_Object *
-_item_provider(void *data, Evas_Object *entry __UNUSED__, const char *item)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Eina_List *l;
- Elm_Anchorblock_Item_Provider *ip;
-
- EINA_LIST_FOREACH(wd->item_providers, l, ip)
- {
- Evas_Object *o;
-
- o = ip->func(ip->data, data, item);
- if (o) return o;
- }
- return NULL;
-}
-
-static void
-_elm_anchorblock_text_set(Evas_Object *obj, const char *item, const char *text)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (item && strcmp(item, "default")) return;
- if (!wd) return;
- elm_object_text_set(wd->entry, text);
- if (wd->hover) evas_object_del(wd->hover);
- if (wd->pop) evas_object_del(wd->pop);
- wd->hover = NULL;
- wd->pop = NULL;
- _sizing_eval(obj);
-}
-
-static const char*
-_elm_anchorblock_text_get(const Evas_Object *obj, const char *item)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (item && strcmp(item, "default")) return NULL;
- if (!wd) return NULL;
- return elm_object_text_get(wd->entry);
-}
-
-EAPI Evas_Object *
-elm_anchorblock_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
- ELM_SET_WIDTYPE(widtype, "anchorblock");
- elm_widget_type_set(obj, "anchorblock");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_pre_hook_set(obj, _del_pre_hook);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_can_focus_set(obj, EINA_TRUE);
- elm_widget_text_set_hook_set(obj, _elm_anchorblock_text_set);
- elm_widget_text_get_hook_set(obj, _elm_anchorblock_text_get);
-
- wd->entry = elm_entry_add(parent);
- elm_entry_item_provider_prepend(wd->entry, _item_provider, obj);
- elm_widget_resize_object_set(obj, wd->entry);
- elm_entry_editable_set(wd->entry, 0);
- evas_object_size_hint_weight_set(wd->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
-
- elm_object_text_set(wd->entry, "");
-
- evas_object_smart_callback_add(wd->entry, "anchor,clicked",
- _anchor_clicked, obj);
-
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
- _sizing_eval(obj);
-
- // TODO: convert Elementary to subclassing of Evas_Smart_Class
- // TODO: and save some bytes, making descriptions per-class and not instance!
- evas_object_smart_callbacks_descriptions_set(obj, _signals);
- return obj;
-}
-
-EAPI void
-elm_anchorblock_text_set(Evas_Object *obj, const char *text)
-{
- _elm_anchorblock_text_set(obj, NULL, text);
-}
-
-EAPI const char*
-elm_anchorblock_text_get(const Evas_Object *obj)
-{
- return _elm_anchorblock_text_get(obj, NULL);
-}
-
-EAPI void
-elm_anchorblock_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->hover_parent)
- evas_object_event_callback_del_full(wd->hover_parent, EVAS_CALLBACK_DEL, _parent_del, obj);
- wd->hover_parent = parent;
- if (wd->hover_parent)
- evas_object_event_callback_add(wd->hover_parent, EVAS_CALLBACK_DEL, _parent_del, obj);
-}
-
-EAPI Evas_Object *
-elm_anchorblock_hover_parent_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->hover_parent;
-}
-
-EAPI void
-elm_anchorblock_hover_style_set(Evas_Object *obj, const char *style)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- eina_stringshare_replace(&wd->hover_style, style);
-}
-
-EAPI const char *
-elm_anchorblock_hover_style_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->hover_style;
-}
-
-EAPI void
-elm_anchorblock_hover_end(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->hover) evas_object_del(wd->hover);
- if (wd->pop) evas_object_del(wd->pop);
- wd->hover = NULL;
- wd->pop = NULL;
-}
-
-EAPI void
-elm_anchorblock_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorblock, const char *item), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- EINA_SAFETY_ON_NULL_RETURN(func);
- Elm_Anchorblock_Item_Provider *ip = calloc(1, sizeof(Elm_Anchorblock_Item_Provider));
- if (!ip) return;
- ip->func = func;
- ip->data = data;
- wd->item_providers = eina_list_append(wd->item_providers, ip);
-}
-
-EAPI void
-elm_anchorblock_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorblock, const char *item), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- EINA_SAFETY_ON_NULL_RETURN(func);
- Elm_Anchorblock_Item_Provider *ip = calloc(1, sizeof(Elm_Anchorblock_Item_Provider));
- if (!ip) return;
- ip->func = func;
- ip->data = data;
- wd->item_providers = eina_list_prepend(wd->item_providers, ip);
-}
-
-EAPI void
-elm_anchorblock_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorblock, const char *item), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- Elm_Anchorblock_Item_Provider *ip;
- if (!wd) return;
- EINA_SAFETY_ON_NULL_RETURN(func);
- EINA_LIST_FOREACH(wd->item_providers, l, ip)
- {
- if ((ip->func == func) && (ip->data == data))
- {
- wd->item_providers = eina_list_remove_list(wd->item_providers, l);
- free(ip);
- return;
- }
- }
-}
+++ /dev/null
-/**
- * @defgroup Anchorblock Anchorblock
- *
- * @image html img/widget/anchorblock/preview-00.png
- * @image latex img/widget/anchorblock/preview-00.eps
- *
- * Anchorblock is for displaying text that contains markup with anchors
- * like <c>\<a href=1234\>something\</\></c> in it.
- *
- * Besides being styled differently, the anchorblock widget provides the
- * necessary functionality so that clicking on these anchors brings up a
- * popup with user defined content such as "call", "add to contacts" or
- * "open web page". This popup is provided using the @ref Hover widget.
- *
- * This widget emits the following signals:
- * @li "anchor,clicked": will be called when an anchor is clicked. The
- * @p event_info parameter on the callback will be a pointer of type
- * ::Elm_Entry_Anchorblock_Info.
- *
- * @see Anchorview
- * @see Entry
- * @see Hover
- *
- * Default text parts of the anchorblock widget that you can use for are:
- * @li "default" - A label of the anchorblock
- *
- * Supported elm_object common APIs.
- * @li elm_object_part_text_set
- * @li elm_object_part_text_get
- *
- * Since examples are usually better than plain words, we might as well
- * try @ref tutorial_anchorblock_example "one".
- */
-
-/**
- * @addtogroup Anchorblock
- * @{
- */
-
-/**
- * @typedef Elm_Entry_Anchorblock_Info
- *
- * The info sent in the callback for "anchor,clicked" signals emitted by
- * the Anchorblock widget.
- */
-typedef struct _Elm_Entry_Anchorblock_Info Elm_Entry_Anchorblock_Info;
-
-/**
- * @struct _Elm_Entry_Anchorblock_Info
- *
- * The info sent in the callback for "anchor,clicked" signals emitted by
- * the Anchorblock widget.
- */
-struct _Elm_Entry_Anchorblock_Info
-{
- const char *name; /**< Name of the anchor, as indicated in its href
- attribute */
- int button; /**< The mouse button used to click on it */
- Evas_Object *hover; /**< The hover object to use for the popup */
- struct
- {
- Evas_Coord x, y, w, h;
- } anchor, /**< Geometry selection of text used as anchor */
- hover_parent; /**< Geometry of the object used as parent by the
- hover */
- Eina_Bool hover_left : 1; /**< Hint indicating if there's space
- for content on the left side of
- the hover. Before calling the
- callback, the widget will make the
- necessary calculations to check
- which sides are fit to be set with
- content, based on the position the
- hover is activated and its distance
- to the edges of its parent object
- */
- Eina_Bool hover_right : 1; /**< Hint indicating content fits on
- the right side of the hover.
- See @ref hover_left */
- Eina_Bool hover_top : 1; /**< Hint indicating content fits on top
- of the hover. See @ref hover_left */
- Eina_Bool hover_bottom : 1; /**< Hint indicating content fits
- below the hover. See @ref
- hover_left */
-};
-
-/**
- * Add a new Anchorblock object
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- */
-EAPI Evas_Object *elm_anchorblock_add(Evas_Object *parent);
-
-/**
- * Set the parent of the hover popup
- *
- * Sets the parent object to use by the hover created by the anchorblock
- * when an anchor is clicked. See @ref Hover for more details on this.
- *
- * @param obj The anchorblock object
- * @param parent The object to use as parent for the hover
- */
-EAPI void elm_anchorblock_hover_parent_set(Evas_Object *obj, Evas_Object *parent);
-
-/**
- * Get the parent of the hover popup
- *
- * Get the object used as parent for the hover created by the anchorblock
- * widget. See @ref Hover for more details on this.
- * If no parent is set, the same anchorblock object will be used.
- *
- * @param obj The anchorblock object
- * @return The object used as parent for the hover, NULL if none is set.
- */
-EAPI Evas_Object *elm_anchorblock_hover_parent_get(const Evas_Object *obj);
-
-/**
- * Set the style that the hover should use
- *
- * When creating the popup hover, anchorblock will request that it's
- * themed according to @p style.
- *
- * @param obj The anchorblock object
- * @param style The style to use for the underlying hover
- *
- * @see elm_object_style_set()
- */
-EAPI void elm_anchorblock_hover_style_set(Evas_Object *obj, const char *style);
-
-/**
- * Get the style that the hover should use
- *
- * Get the style, the hover created by anchorblock will use.
- *
- * @param obj The anchorblock object
- * @return The style to use by the hover. NULL means the default is used.
- *
- * @see elm_object_style_set()
- */
-EAPI const char *elm_anchorblock_hover_style_get(const Evas_Object *obj);
-
-/**
- * Ends the hover popup in the anchorblock
- *
- * When an anchor is clicked, the anchorblock widget will create a hover
- * object to use as a popup with user provided content. This function
- * terminates this popup, returning the anchorblock to its normal state.
- *
- * @param obj The anchorblock object
- */
-EAPI void elm_anchorblock_hover_end(Evas_Object *obj);
-
-/**
- * Appends a custom item provider to the given anchorblock
- *
- * Appends the given function to the list of items providers. This list is
- * called, one function at a time, with the given @p data pointer, the
- * anchorblock object and, in the @p item parameter, the item name as
- * referenced in its href string. Following functions in the list will be
- * called in order until one of them returns something different to NULL,
- * which should be an Evas_Object which will be used in place of the item
- * element.
- *
- * Items in the markup text take the form \<item relsize=16x16 vsize=full
- * href=item/name\>\</item\>
- *
- * @param obj The anchorblock object
- * @param func The function to add to the list of providers
- * @param data User data that will be passed to the callback function
- *
- * @see elm_entry_item_provider_append()
- */
-EAPI void elm_anchorblock_item_provider_append(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorblock, const char *item), void *data);
-
-/**
- * Prepend a custom item provider to the given anchorblock
- *
- * Like elm_anchorblock_item_provider_append(), but it adds the function
- * @p func to the beginning of the list, instead of the end.
- *
- * @param obj The anchorblock object
- * @param func The function to add to the list of providers
- * @param data User data that will be passed to the callback function
- */
-EAPI void elm_anchorblock_item_provider_prepend(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorblock, const char *item), void *data);
-
-/**
- * Remove a custom item provider from the list of the given anchorblock
- *
- * Removes the function and data pairing that matches @p func and @p data.
- * That is, unless the same function and same user data are given, the
- * function will not be removed from the list. This allows us to add the
- * same callback several times, with different @p data pointers and be
- * able to remove them later without conflicts.
- *
- * @param obj The anchorblock object
- * @param func The function to remove from the list
- * @param data The data matching the function to remove from the list
- */
-EAPI void elm_anchorblock_item_provider_remove(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorblock, const char *item), void *data);
-
-/**
- * @}
- */
+++ /dev/null
-#include <Elementary.h>
-#include "elm_priv.h"
-
-typedef struct _Widget_Data Widget_Data;
-typedef struct _Elm_Anchorview_Item_Provider Elm_Anchorview_Item_Provider;
-
-struct _Widget_Data
-{
- Evas_Object *scroller, *entry;
- Evas_Object *hover_parent;
- Evas_Object *pop, *hover;
- Eina_List *item_providers;
- const char *hover_style;
-};
-
-struct _Elm_Anchorview_Item_Provider
-{
- Evas_Object *(*func) (void *data, Evas_Object *anchorview, const char *item);
- void *data;
-};
-
-static const char *widtype = NULL;
-
-static const char SIG_ANCHOR_CLICKED[] = "anchor,clicked";
-static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_ANCHOR_CLICKED, ""}, /* TODO: declare the type properly, as data is
- * being passed
- */
- {NULL, NULL}
-};
-
-static void _del_pre_hook(Evas_Object *obj);
-static void _del_hook(Evas_Object *obj);
-static void _sizing_eval(Evas_Object *obj);
-static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
-
-static void
-_del_pre_hook(Evas_Object *obj)
-{
- elm_anchorview_hover_end(obj);
- elm_anchorview_hover_parent_set(obj, NULL);
-}
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Elm_Anchorview_Item_Provider *ip;
- if (!wd) return;
- if (wd->hover_style) eina_stringshare_del(wd->hover_style);
- EINA_LIST_FREE(wd->item_providers, ip)
- {
- free(ip);
- }
- free(wd);
-}
-
-static void
-_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_widget_mirrored_set(wd->hover, rtl);
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- _elm_widget_mirrored_reload(obj);
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
- if (!wd) return;
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, maxw, maxh);
-}
-
-static void
-_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- _sizing_eval(data);
-}
-
-static void
-_hover_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- elm_anchorview_hover_end(data);
-}
-
-static void
-_anchor_clicked(void *data, Evas_Object *obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Elm_Entry_Anchor_Info *info = event_info;
- Evas_Object *hover_parent;
- Elm_Entry_Anchorview_Info ei;
- Evas_Coord x, w, y, h, px, py;
- if (!wd) return;
- wd->pop = elm_icon_add(obj);
- evas_object_move(wd->pop, info->x, info->y);
- evas_object_resize(wd->pop, info->w, info->h);
- wd->hover = elm_hover_add(obj);
- elm_widget_mirrored_set(wd->hover, elm_widget_mirrored_get((Evas_Object *) data));
- if (wd->hover_style) elm_object_style_set(wd->hover, wd->hover_style);
- hover_parent = wd->hover_parent;
- if (!hover_parent) hover_parent = obj;
- elm_hover_parent_set(wd->hover, hover_parent);
- elm_hover_target_set(wd->hover, wd->pop);
- ei.name = info->name;
- ei.button = info->button;
- ei.hover = wd->hover;
- ei.anchor.x = info->x;
- ei.anchor.y = info->y;
- ei.anchor.w = info->w;
- ei.anchor.h = info->h;
- evas_object_geometry_get(hover_parent, &x, &y, &w, &h);
- ei.hover_parent.x = x;
- ei.hover_parent.y = y;
- ei.hover_parent.w = w;
- ei.hover_parent.h = h;
- px = info->x + (info->w / 2);
- py = info->y + (info->h / 2);
- ei.hover_left = 1;
- if (px < (x + (w / 3))) ei.hover_left = 0;
- ei.hover_right = 1;
- if (px > (x + ((w * 2) / 3))) ei.hover_right = 0;
- ei.hover_top = 1;
- if (py < (y + (h / 3))) ei.hover_top = 0;
- ei.hover_bottom = 1;
- if (py > (y + ((h * 2) / 3))) ei.hover_bottom = 0;
-
- if (elm_widget_mirrored_get(wd->hover))
- { /* Swap right and left because they switch sides in RTL */
- Eina_Bool tmp = ei.hover_left;
- ei.hover_left = ei.hover_right;
- ei.hover_right = tmp;
- }
-
- evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei);
- evas_object_smart_callback_add(wd->hover, "clicked", _hover_clicked, data);
- evas_object_show(wd->hover);
-}
-
-static void
-_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- wd->hover_parent = NULL;
-}
-
-static Evas_Object *
-_item_provider(void *data, Evas_Object *entry __UNUSED__, const char *item)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Eina_List *l;
- Elm_Anchorview_Item_Provider *ip;
-
- EINA_LIST_FOREACH(wd->item_providers, l, ip)
- {
- Evas_Object *o;
-
- o = ip->func(ip->data, data, item);
- if (o) return o;
- }
- return NULL;
-}
-
-static void
-_elm_anchorview_text_set(Evas_Object *obj, const char *item, const char *text)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (item && strcmp(item, "default")) return;
- if (!wd) return;
- elm_object_text_set(wd->entry, text);
- if (wd->hover) evas_object_del(wd->hover);
- if (wd->pop) evas_object_del(wd->pop);
- wd->hover = NULL;
- wd->pop = NULL;
- _sizing_eval(obj);
-}
-
-static const char*
-_elm_anchorview_text_get(const Evas_Object *obj, const char *item)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (item && strcmp(item, "default")) return NULL;
- if (!wd) return NULL;
- return elm_object_text_get(wd->entry);
-}
-
-EAPI Evas_Object *
-elm_anchorview_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
- ELM_SET_WIDTYPE(widtype, "anchorview");
- elm_widget_type_set(obj, "anchorview");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_pre_hook_set(obj, _del_pre_hook);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_can_focus_set(obj, EINA_TRUE);
- elm_widget_text_set_hook_set(obj, _elm_anchorview_text_set);
- elm_widget_text_get_hook_set(obj, _elm_anchorview_text_get);
-
- wd->scroller = elm_scroller_add(parent);
- elm_widget_resize_object_set(obj, wd->scroller);
- wd->entry = elm_entry_add(parent);
- elm_entry_item_provider_prepend(wd->entry, _item_provider, obj);
- elm_entry_editable_set(wd->entry, 0);
- evas_object_size_hint_weight_set(wd->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_object_content_set(wd->scroller, wd->entry);
- evas_object_show(wd->entry);
-
- evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
-
- elm_object_text_set(wd->entry, "");
-
- evas_object_smart_callback_add(wd->entry, "anchor,clicked",
- _anchor_clicked, obj);
-
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
- _sizing_eval(obj);
-
- // TODO: convert Elementary to subclassing of Evas_Smart_Class
- // TODO: and save some bytes, making descriptions per-class and not instance!
- evas_object_smart_callbacks_descriptions_set(obj, _signals);
- return obj;
-}
-
-EAPI void
-elm_anchorview_text_set(Evas_Object *obj, const char *text)
-{
- _elm_anchorview_text_set(obj, NULL, text);
-}
-
-EAPI const char*
-elm_anchorview_text_get(const Evas_Object *obj)
-{
- return _elm_anchorview_text_get(obj, NULL);
-}
-
-EAPI void
-elm_anchorview_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->hover_parent)
- evas_object_event_callback_del_full(wd->hover_parent, EVAS_CALLBACK_DEL, _parent_del, obj);
- wd->hover_parent = parent;
- if (wd->hover_parent)
- evas_object_event_callback_add(wd->hover_parent, EVAS_CALLBACK_DEL, _parent_del, obj);
-}
-
-EAPI Evas_Object *
-elm_anchorview_hover_parent_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->hover_parent;
-}
-
-EAPI void
-elm_anchorview_hover_style_set(Evas_Object *obj, const char *style)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- eina_stringshare_replace(&wd->hover_style, style);
-}
-
-EAPI const char *
-elm_anchorview_hover_style_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->hover_style;
-}
-
-EAPI void
-elm_anchorview_hover_end(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->hover) evas_object_del(wd->hover);
- if (wd->pop) evas_object_del(wd->pop);
- wd->hover = NULL;
- wd->pop = NULL;
-}
-
-EAPI void
-elm_anchorview_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_scroller_bounce_set(wd->scroller, h_bounce, v_bounce);
-}
-
-EAPI void
-elm_anchorview_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_scroller_bounce_get(wd->scroller, h_bounce, v_bounce);
-}
-
-EAPI void
-elm_anchorview_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorview, const char *item), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- EINA_SAFETY_ON_NULL_RETURN(func);
- Elm_Anchorview_Item_Provider *ip = calloc(1, sizeof(Elm_Anchorview_Item_Provider));
- if (!ip) return;
- ip->func = func;
- ip->data = data;
- wd->item_providers = eina_list_append(wd->item_providers, ip);
-}
-
-EAPI void
-elm_anchorview_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorview, const char *item), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- EINA_SAFETY_ON_NULL_RETURN(func);
- Elm_Anchorview_Item_Provider *ip = calloc(1, sizeof(Elm_Anchorview_Item_Provider));
- if (!ip) return;
- ip->func = func;
- ip->data = data;
- wd->item_providers = eina_list_prepend(wd->item_providers, ip);
-}
-
-EAPI void
-elm_anchorview_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *anchorview, const char *item), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- Elm_Anchorview_Item_Provider *ip;
- if (!wd) return;
- EINA_SAFETY_ON_NULL_RETURN(func);
- EINA_LIST_FOREACH(wd->item_providers, l, ip)
- {
- if ((ip->func == func) && (ip->data == data))
- {
- wd->item_providers = eina_list_remove_list(wd->item_providers, l);
- free(ip);
- return;
- }
- }
-}
+++ /dev/null
-/**
- * @defgroup Anchorview Anchorview
- *
- * @image html img/widget/anchorview/preview-00.png
- * @image latex img/widget/anchorview/preview-00.eps
- *
- * Anchorview is for displaying text that contains markup with anchors
- * like <c>\<a href=1234\>something\</\></c> in it.
- *
- * Besides being styled differently, the anchorview widget provides the
- * necessary functionality so that clicking on these anchors brings up a
- * popup with user defined content such as "call", "add to contacts" or
- * "open web page". This popup is provided using the @ref Hover widget.
- *
- * This widget is very similar to @ref Anchorblock, so refer to that
- * widget for an example. The only difference Anchorview has is that the
- * widget is already provided with scrolling functionality, so if the
- * text set to it is too large to fit in the given space, it will scroll,
- * whereas the @ref Anchorblock widget will keep growing to ensure all the
- * text can be displayed.
- *
- * This widget emits the following signals:
- * @li "anchor,clicked": will be called when an anchor is clicked. The
- * @p event_info parameter on the callback will be a pointer of type
- * ::Elm_Entry_Anchorview_Info.
- *
- * See @ref Anchorblock for an example on how to use both of them.
- *
- * @see Anchorblock
- * @see Entry
- * @see Hover
- *
- * @{
- */
-
-/**
- * @typedef Elm_Entry_Anchorview_Info
- *
- * The info sent in the callback for "anchor,clicked" signals emitted by
- * the Anchorview widget.
- */
-typedef struct _Elm_Entry_Anchorview_Info Elm_Entry_Anchorview_Info;
-
-/**
- * @struct _Elm_Entry_Anchorview_Info
- *
- * The info sent in the callback for "anchor,clicked" signals emitted by
- * the Anchorview widget.
- */
-struct _Elm_Entry_Anchorview_Info
-{
- const char *name; /**< Name of the anchor, as indicated in its href
- attribute */
- int button; /**< The mouse button used to click on it */
- Evas_Object *hover; /**< The hover object to use for the popup */
- struct
- {
- Evas_Coord x, y, w, h;
- } anchor, /**< Geometry selection of text used as anchor */
- hover_parent; /**< Geometry of the object used as parent by the
- hover */
- Eina_Bool hover_left : 1; /**< Hint indicating if there's space
- for content on the left side of
- the hover. Before calling the
- callback, the widget will make the
- necessary calculations to check
- which sides are fit to be set with
- content, based on the position the
- hover is activated and its distance
- to the edges of its parent object
- */
- Eina_Bool hover_right : 1; /**< Hint indicating content fits on
- the right side of the hover.
- See @ref hover_left */
- Eina_Bool hover_top : 1; /**< Hint indicating content fits on top
- of the hover. See @ref hover_left */
- Eina_Bool hover_bottom : 1; /**< Hint indicating content fits
- below the hover. See @ref
- hover_left */
-};
-
-/**
- * Add a new Anchorview object
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- */
-EAPI Evas_Object *elm_anchorview_add(Evas_Object *parent);
-
-/**
- * Set the parent of the hover popup
- *
- * Sets the parent object to use by the hover created by the anchorview
- * when an anchor is clicked. See @ref Hover for more details on this.
- * If no parent is set, the same anchorview object will be used.
- *
- * @param obj The anchorview object
- * @param parent The object to use as parent for the hover
- */
-EAPI void elm_anchorview_hover_parent_set(Evas_Object *obj, Evas_Object *parent);
-
-/**
- * Get the parent of the hover popup
- *
- * Get the object used as parent for the hover created by the anchorview
- * widget. See @ref Hover for more details on this.
- *
- * @param obj The anchorview object
- * @return The object used as parent for the hover, NULL if none is set.
- */
-EAPI Evas_Object *elm_anchorview_hover_parent_get(const Evas_Object *obj);
-
-/**
- * Set the style that the hover should use
- *
- * When creating the popup hover, anchorview will request that it's
- * themed according to @p style.
- *
- * @param obj The anchorview object
- * @param style The style to use for the underlying hover
- *
- * @see elm_object_style_set()
- */
-EAPI void elm_anchorview_hover_style_set(Evas_Object *obj, const char *style);
-
-/**
- * Get the style that the hover should use
- *
- * Get the style the hover created by anchorview will use.
- *
- * @param obj The anchorview object
- * @return The style to use by the hover. NULL means the default is used.
- *
- * @see elm_object_style_set()
- */
-EAPI const char *elm_anchorview_hover_style_get(const Evas_Object *obj);
-
-/**
- * Ends the hover popup in the anchorview
- *
- * When an anchor is clicked, the anchorview widget will create a hover
- * object to use as a popup with user provided content. This function
- * terminates this popup, returning the anchorview to its normal state.
- *
- * @param obj The anchorview object
- */
-EAPI void elm_anchorview_hover_end(Evas_Object *obj);
-
-/**
- * Set bouncing behaviour when the scrolled content reaches an edge
- *
- * Tell the internal scroller object whether it should bounce or not
- * when it reaches the respective edges for each axis.
- *
- * @param obj The anchorview object
- * @param h_bounce Whether to bounce or not in the horizontal axis
- * @param v_bounce Whether to bounce or not in the vertical axis
- *
- * @see elm_scroller_bounce_set()
- */
-EAPI void elm_anchorview_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
-
-/**
- * Get the set bouncing behaviour of the internal scroller
- *
- * Get whether the internal scroller should bounce when the edge of each
- * axis is reached scrolling.
- *
- * @param obj The anchorview object
- * @param h_bounce Pointer where to store the bounce state of the horizontal
- * axis
- * @param v_bounce Pointer where to store the bounce state of the vertical
- * axis
- *
- * @see elm_scroller_bounce_get()
- */
-EAPI void elm_anchorview_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
-
-/**
- * Appends a custom item provider to the given anchorview
- *
- * Appends the given function to the list of items providers. This list is
- * called, one function at a time, with the given @p data pointer, the
- * anchorview object and, in the @p item parameter, the item name as
- * referenced in its href string. Following functions in the list will be
- * called in order until one of them returns something different to NULL,
- * which should be an Evas_Object which will be used in place of the item
- * element.
- *
- * Items in the markup text take the form \<item relsize=16x16 vsize=full
- * href=item/name\>\</item\>
- *
- * @param obj The anchorview object
- * @param func The function to add to the list of providers
- * @param data User data that will be passed to the callback function
- *
- * @see elm_entry_item_provider_append()
- */
-EAPI void elm_anchorview_item_provider_append(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorview, const char *item), void *data);
-
-/**
- * Prepend a custom item provider to the given anchorview
- *
- * Like elm_anchorview_item_provider_append(), but it adds the function
- * @p func to the beginning of the list, instead of the end.
- *
- * @param obj The anchorview object
- * @param func The function to add to the list of providers
- * @param data User data that will be passed to the callback function
- */
-EAPI void elm_anchorview_item_provider_prepend(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorview, const char *item), void *data);
-
-/**
- * Remove a custom item provider from the list of the given anchorview
- *
- * Removes the function and data pairing that matches @p func and @p data.
- * That is, unless the same function and same user data are given, the
- * function will not be removed from the list. This allows us to add the
- * same callback several times, with different @p data pointers and be
- * able to remove them later without conflicts.
- *
- * @param obj The anchorview object
- * @param func The function to remove from the list
- * @param data The data matching the function to remove from the list
- */
-EAPI void elm_anchorview_item_provider_remove(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * anchorview, const char *item), void *data);
-
-/**
- * @}
- */
+++ /dev/null
-#include <Elementary.h>
-#include "elm_priv.h"
-#include "els_scroller.h"
-
-// FIXME: this is NOT the carousel - yet!
-
-typedef struct _Widget_Data Widget_Data;
-
-struct _Widget_Data
-{
- Evas_Object *scr, *bx;
- Eina_List *items;
- int icon_size;
-};
-
-struct _Elm_Carousel_Item
-{
- Evas_Object *obj, *base, *icon;
- const char *label;
- Evas_Smart_Cb func;
- const void *data;
- Eina_Bool selected : 1;
-};
-
-static const char *widtype = NULL;
-static void _del_hook(Evas_Object *obj);
-static void _theme_hook(Evas_Object *obj);
-static void _sizing_eval(Evas_Object *obj);
-
-static void
-_item_show(Elm_Carousel_Item *it)
-{
- Widget_Data *wd = elm_widget_data_get(it->obj);
- Evas_Coord x, y, w, h, bx, by;
- if (!wd) return;
- evas_object_geometry_get(wd->bx, &bx, &by, NULL, NULL);
- evas_object_geometry_get(it->base, &x, &y, &w, &h);
- elm_smart_scroller_child_region_show(wd->scr, x - bx, y - by, w, h);
-}
-
-static void
-_item_select(Elm_Carousel_Item *it)
-{
- Elm_Carousel_Item *it2;
- Widget_Data *wd = elm_widget_data_get(it->obj);
- Evas_Object *obj2;
- const Eina_List *l;
- if (!wd) return;
- if (it->selected) return;
- EINA_LIST_FOREACH(wd->items, l, it2)
- {
- if (it2->selected)
- {
- it2->selected = EINA_FALSE;
- edje_object_signal_emit(it2->base, "elm,state,unselected", "elm");
- break;
- }
- }
- it->selected = EINA_TRUE;
- edje_object_signal_emit(it->base, "elm,state,selected", "elm");
- _item_show(it);
- obj2 = it->obj;
- if (it->func) it->func((void *)(it->data), it->obj, it);
- evas_object_smart_callback_call(obj2, "clicked", it);
-}
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- free(wd);
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- const Eina_List *l;
- const Elm_Carousel_Item *it;
- if (!wd) return;
- EINA_LIST_FOREACH(wd->items, l, it)
- {
- Evas_Coord mw, mh;
-
- if (it->selected)
- edje_object_signal_emit(it->base, "elm,state,selected", "elm");
- _elm_theme_object_set(obj, it->base, "carousel", "item", elm_widget_style_get(obj));
- edje_object_scale_set(it->base, elm_widget_scale_get(obj) * _elm_config->scale);
- if (it->icon)
- {
- edje_extern_object_min_size_set(it->icon,
- (double)wd->icon_size * _elm_config->scale,
- (double)wd->icon_size * _elm_config->scale);
- edje_object_part_swallow(it->base, "elm.swallow.icon", it->icon);
- }
- edje_object_part_text_set(it->base, "elm.text", it->label);
- edje_object_size_min_calc(it->base, &mw, &mh);
- evas_object_size_hint_min_set(it->base, mw, mh);
- evas_object_size_hint_max_set(it->base, 9999, mh);
- }
- _sizing_eval(obj);
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
- Evas_Coord vw = 0, vh = 0;
- if (!wd) return;
- edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh);
- evas_object_resize(wd->scr, 500, 500);
- evas_object_size_hint_min_get(wd->bx, &minw, &minh);
- evas_object_resize(wd->bx, minw, minh);
- elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
- minw = minw + (500 - vw);
- minh = minh + (500 - vh);
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, maxw, maxh);
-}
-
-static void
-_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Evas_Coord mw, mh, vw, vh, w, h;
- const Eina_List *l;
- Elm_Carousel_Item *it;
- if (!wd) return;
- elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
- evas_object_size_hint_min_get(wd->bx, &mw, &mh);
- evas_object_geometry_get(wd->bx, NULL, NULL, &w, &h);
- if (vw >= mw)
- {
- if (w != vw) evas_object_resize(wd->bx, vw, h);
- }
- EINA_LIST_FOREACH(wd->items, l, it)
- {
- if (it->selected)
- {
- _item_show(it);
- break;
- }
- }
-
-}
-
-static void
-_select(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
-{
- _item_select(data);
-}
-
-EAPI Evas_Object *
-elm_carousel_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- obj = elm_widget_add(e);
- ELM_SET_WIDTYPE(widtype, "carousel");
- elm_widget_type_set(obj, "carousel");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_can_focus_set(obj, 0);
-
- wd->scr = elm_smart_scroller_add(e);
- elm_smart_scroller_widget_set(wd->scr, obj);
- elm_smart_scroller_object_theme_set(obj, wd->scr, "carousel", "base", "default");
- elm_widget_resize_object_set(obj, wd->scr);
- elm_smart_scroller_policy_set(wd->scr,
- ELM_SMART_SCROLLER_POLICY_AUTO,
- ELM_SMART_SCROLLER_POLICY_OFF);
-
- wd->icon_size = 32;
-
- wd->bx = evas_object_box_add(e);
- evas_object_box_layout_set(wd->bx,
- evas_object_box_layout_homogeneous_horizontal, NULL, NULL);
- elm_widget_sub_object_add(obj, wd->bx);
- elm_smart_scroller_child_set(wd->scr, wd->bx);
- evas_object_show(wd->bx);
-
- evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE,
- _resize, obj);
-
- _sizing_eval(obj);
- return obj;
-}
-
-EAPI Elm_Carousel_Item *
-elm_carousel_item_add(Evas_Object *obj, Evas_Object *icon, const char *label, Evas_Smart_Cb func, const void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- Evas_Coord mw, mh;
- Elm_Carousel_Item *it = calloc(1, sizeof(Elm_Carousel_Item));
-
- if (!it) return NULL;
- wd->items = eina_list_append(wd->items, it);
- it->obj = obj;
- it->label = eina_stringshare_add(label);
- it->icon = icon;
- it->func = func;
- it->data = data;
- it->base = edje_object_add(evas_object_evas_get(obj));
- _elm_theme_object_set(obj, it->base, "carousel", "item", elm_widget_style_get(obj));
- edje_object_signal_callback_add(it->base, "elm,action,click", "elm",
- _select, it);
- elm_widget_sub_object_add(obj, it->base);
- if (it->icon)
- {
- edje_extern_object_min_size_set(it->icon,
- (double)wd->icon_size * _elm_config->scale,
- (double)wd->icon_size * _elm_config->scale);
- edje_object_part_swallow(it->base, "elm.swallow.icon", it->icon);
- evas_object_show(it->icon);
- elm_widget_sub_object_add(obj, it->icon);
- }
- edje_object_part_text_set(it->base, "elm.text", it->label);
- edje_object_size_min_calc(it->base, &mw, &mh);
- evas_object_size_hint_weight_set(it->base, 0.0, 0.0);
- evas_object_size_hint_align_set(it->base, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_min_set(it->base, mw, mh);
- evas_object_size_hint_max_set(it->base, 9999, mh);
- evas_object_box_append(wd->bx, it->base);
- evas_object_show(it->base);
- _sizing_eval(obj);
- return it;
-}
-
-EAPI void
-elm_carousel_item_del(Elm_Carousel_Item *it)
-{
- Widget_Data *wd = elm_widget_data_get(it->obj);
- Evas_Object *obj2 = it->obj;
- if (!wd) return;
- wd->items = eina_list_remove(wd->items, it);
- eina_stringshare_del(it->label);
- if (it->icon) evas_object_del(it->icon);
- evas_object_del(it->base);
- free(it);
- _theme_hook(obj2);
-}
-
-EAPI void
-elm_carousel_item_select(Elm_Carousel_Item *item)
-{
- _item_select(item);
-}
+++ /dev/null
-#include <locale.h>
-#include <Elementary.h>
-#include "elm_priv.h"
-
-/**
- * @defgroup Datefield Datefield
- * @ingroup Elementary
- *
- * This is a date edit field. it is used to input date and time using
- * diskselector integrated ctxpopup.
- *
- * Datefield Format can be like "%b %d, %Y %I : %M %p".
- * Maximum allowed format length is 32 chars.
- * Format can include separators for each individual datefield item.
- * Each separator can be a maximum of 6 UTF-8 bytes.
- * Space is also taken as a separator.
- * Following are the allowed set of format specifiers for each datefield item.
- * These specifiers can be arranged at any order as per user requirement and
- * their value will be replaced in the format as mentioned below.
- * %Y : The year as a decimal number including the century.
- * %y : The year as a decimal number without a century (range 00 to 99)
- * %m : The month as a decimal number (range 01 to 12).
- * %b : The abbreviated month name according to the current locale.
- * %B : The full month name according to the current locale.
- * %d : The day of the month as a decimal number (range 01 to 31).
- * %I : The hour as a decimal number using a 12-hour clock (range 01 to 12).
- * %H : The hour as a decimal number using a 24-hour clock (range 00 to 23).
- * %k : The hour (24-hour clock) as a decimal number (range 0 to 23). single
- * digits are preceded by a blank.
- * %l : The hour (12-hour clock) as a decimal number (range 1 to 12); single
- * digits are preceded by a blank.
- * %M : The minute as a decimal number (range 00 to 59).
- * %p : Either 'AM' or 'PM' according to the given time value, or the
- * corresponding strings for the current locale. Noon is treated as 'PM'
- * and midnight as 'AM'
- * %P : Like %p but in lowercase: 'am' or 'pm' or a corresponding string for
- * the current locale.
- * For more reference, see the below link:
- * http://www.gnu.org/s/hello/manual/libc.html#Formatting-Calendar-Time
- * Default format is taken as per the system display language and Region format.
- *
- */
-
-typedef struct _Widget_Data Widget_Data;
-
-#define DATEFIELD_TYPE_COUNT 6
-#define BUFFER_SIZE 64
-#define MAX_FORMAT_LEN 32
-#define MAX_SEPARATOR_LEN 6
-#define MAX_ITEM_FORMAT_LEN 3
-#define DISKSELECTOR_ITEMS_NUM_MIN 4
-
-// Interface between EDC & C code. Item names & signal names.
-// Values 0 to 6 are valid range, can be substituted for %d.
-#define EDC_DATEFIELD_ENABLE_SIG_STR "elm,state,enabled"
-#define EDC_DATEFIELD_DISABLE_SIG_STR "elm,state,disabled"
-#define EDC_DATEFIELD_FOCUSIN_SIG_STR "elm,action,focus"
-#define EDC_DATEFIELD_FOCUSOUT_SIG_STR "elm,action,unfocus"
-#define EDC_PART_ITEM_STR "item%d"
-#define EDC_PART_SEPARATOR_STR "separator%d"
-#define EDC_PART_ITEM_OVER_STR "item%d.over"
-#define EDC_PART_ITEM_ENABLE_SIG_STR "item%d,enable"
-#define EDC_PART_ITEM_DISABLE_SIG_STR "item%d,disable"
-#define EDC_PART_ITEM_FOCUSIN_SIG_STR "item%d,focus,in"
-#define EDC_PART_ITEM_FOCUSOUT_SIG_STR "item%d,focus,out"
-#define EDC_PART_ITEM_STYLE_DEFAULT_SIG_STR "item%d,style,default"
-#define EDC_PART_ITEM_STYLE_AMPM_SIG_STR "item%d,style,ampm"
-
-#define DEFAULT_FORMAT "%b %d, %Y %I : %M %p"
-
-typedef struct _Format_Map
-{
- Elm_Datefield_ItemType type;
- char fmt_char[5];
- int def_min;
- int def_max;
-}Format_Map;
-
-static const Format_Map mapping[DATEFIELD_TYPE_COUNT] = {
- { ELM_DATEFIELD_YEAR, "Yy", 70, 137 },
- { ELM_DATEFIELD_MONTH, "mbB", 0, 11 },
- { ELM_DATEFIELD_DATE, "d", 1, 31 },
- { ELM_DATEFIELD_HOUR, "IHkl", 0, 23 },
- { ELM_DATEFIELD_MINUTE, "M", 0, 59 },
- { ELM_DATEFIELD_AMPM, "pP", 0, 1 }
-};
-
-static int _days_in_month[12] = { 31, 28, 31, 30, 31, 30,
- 31, 31, 30, 31, 30, 31 };
-
-typedef enum _Elm_Datefield_HourType
- {
- ELM_DATEFIELD_HOUR_12 = 1000,
- ELM_DATEFIELD_HOUR_24,
- ELM_DATEFIELD_HOUR_NA
- } Elm_Datefield_HourType;
-
-
-typedef struct _Datefield_Item
-{
- char fmt[MAX_ITEM_FORMAT_LEN];
- Elm_Datefield_ItemType type;
- Elm_Datefield_HourType hour_type;
- const char *content; //string to be displayed
- const char *separator;
- int location; //location of the item as per the current format
- int *value;
- int min, max;
- int default_min, default_max;
- Eina_Bool fmt_exist:1; //if item format is present or not
- Eina_Bool enabled:1; //if item is to be shown or not
- Eina_Bool abs_min:1;
- Eina_Bool abs_max:1;
-} Datefield_Item;
-
-struct _Widget_Data
-{
- Evas_Object *base;
- struct tm *time;
- int ampm;
- Datefield_Item *item_list; //Fixed set of items, so no Eina list.
- Evas_Object *ctxpopup;
- Datefield_Item *selected_it;
- char format[MAX_FORMAT_LEN];
- Eina_Bool user_format:1; //whether user set format or the default format.
-};
-
-typedef struct _DiskItem_Data
-{
- Evas_Object *datefield;
- unsigned int sel_item_value;
-} DiskItem_Data;
-
-static const char *widtype = NULL;
-
-static void _del_hook(Evas_Object *obj);
-static void _on_focus_hook(void *data __UNUSED__, Evas_Object *obj);
-static void _disable_hook(Evas_Object *obj);
-static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
-static void _sizing_eval(Evas_Object *obj);
-static void _theme_hook(Evas_Object *obj);
-static void _ctxpopup_dismissed_cb(void *data, Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__);
-static void _datefield_resize_cb(void *data, Evas *e __UNUSED__,Evas_Object *obj
- __UNUSED__, void *event_info __UNUSED__);
-static void _datefield_move_cb(void *data, Evas *e __UNUSED__,Evas_Object *obj
- __UNUSED__, void *event_info __UNUSED__);
-
-static void _update_items(Evas_Object *obj);
-static void _field_value_set(Evas_Object * obj, Elm_Datefield_ItemType type,
- int value, Eina_Bool adjust_time);
-static void _diskselector_cb(void *data, Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__);
-static void _ampm_clicked (void *data);
-static void _diskselector_item_free_cb(void *data, Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__);
-static void _load_field_options(Evas_Object * data, Evas_Object *diskselector,
- Datefield_Item *it);
-static void _datefield_clicked_cb(void *data, Evas_Object *obj __UNUSED__,
- const char *emission __UNUSED__, const char *source);
-static void _format_reload(Evas_Object *obj);
-static void _item_list_init(Evas_Object *obj);
-
-static const char SIG_CHANGED[] = "changed";
-static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_CHANGED, ""},
- {NULL, NULL}
-};
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd;
- Datefield_Item *tmp;
- unsigned int idx;
-
- wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->time) free(wd->time);
- for (idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++ )
- {
- tmp = wd->item_list + idx;
- eina_stringshare_replace(&tmp->content, NULL);
- eina_stringshare_replace(&tmp->separator, NULL);
- }
- if (wd->item_list) free(wd->item_list);
- evas_object_del(wd->ctxpopup);
-
- free(wd);
-}
-
-static void
-_disable_hook(Evas_Object *obj)
-{
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd || !wd->base) return;
- if (elm_widget_disabled_get(obj))
- {
- evas_object_hide(wd->ctxpopup);
- edje_object_signal_emit(wd->base, EDC_DATEFIELD_DISABLE_SIG_STR,"elm");
- }
- else
- edje_object_signal_emit(wd->base, EDC_DATEFIELD_ENABLE_SIG_STR, "elm");
-}
-
-static void
-_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
-{
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd ) return;
- if (elm_widget_focus_get(obj))
- edje_object_signal_emit(wd->base, EDC_DATEFIELD_FOCUSIN_SIG_STR, "elm");
- else
- edje_object_signal_emit(wd->base, EDC_DATEFIELD_FOCUSOUT_SIG_STR, "elm");
-}
-
-static void
-_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
-{
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd) return;
- evas_object_hide(wd->ctxpopup);
- edje_object_mirrored_set(wd->base, rtl);
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd;
- Evas_Coord minw = -1, minh = -1;
-
- wd = elm_widget_data_get(obj);
- if (!wd || !wd->base) return;
- edje_object_size_min_calc(wd->base, &minw, &minh);
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, -1, -1);
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd;
- Datefield_Item *it;
- char buf[BUFFER_SIZE];
- unsigned int idx;
- //Evas_Object *diskselector;
-
- wd = elm_widget_data_get(obj);
- if (!wd || !wd->base) return;
- _elm_theme_object_set(obj, wd->base, "datefield", "base",
- elm_widget_style_get(obj));
- _elm_widget_mirrored_reload(obj);
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
-
- snprintf(buf, sizeof(buf), "datefield/%s", elm_object_style_get(obj));
- elm_object_style_set(wd->ctxpopup, buf);
- /*//Enabled once elm_object_content_get() API comes to git.
- if (diskselector = elm_object_content_get(wd->ctxpopup))
- elm_object_style_set(diskselector, buf);*/
- edje_object_scale_set(wd->base,elm_widget_scale_get(obj)*_elm_config->scale);
-
- if (elm_widget_disabled_get(obj))
- edje_object_signal_emit(wd->base, EDC_DATEFIELD_DISABLE_SIG_STR,"elm");
- else
- edje_object_signal_emit(wd->base, EDC_DATEFIELD_ENABLE_SIG_STR, "elm");
-
- for (idx= 0; idx < DATEFIELD_TYPE_COUNT; idx++ )
- {
- it = wd->item_list + idx;
- if (it->fmt_exist && it->enabled )
- {
- snprintf(buf, sizeof(buf), EDC_PART_ITEM_STR, it->location);
- edje_object_part_text_set(wd->base, buf, it->content);
- snprintf(buf, sizeof(buf), EDC_PART_SEPARATOR_STR, it->location);
- edje_object_part_text_set(wd->base, buf, it->separator);
- snprintf(buf, sizeof(buf), EDC_PART_ITEM_ENABLE_SIG_STR,
- it->location);
- edje_object_signal_emit(wd->base, buf, "elm");
- if (it->type == ELM_DATEFIELD_AMPM)
- snprintf(buf, sizeof(buf), EDC_PART_ITEM_STYLE_AMPM_SIG_STR,
- it->location);
- else
- snprintf(buf, sizeof(buf), EDC_PART_ITEM_STYLE_DEFAULT_SIG_STR,
- it->location);
- edje_object_signal_emit(wd->base, buf, "elm");
- }
- else
- {
- snprintf(buf, sizeof(buf),EDC_PART_ITEM_DISABLE_SIG_STR,
- it->location);
- edje_object_signal_emit(wd->base, buf, "elm");
- }
- }
- edje_object_message_signal_process(wd->base);
- _sizing_eval(obj);
-}
-
-static void
-_ctxpopup_dismissed_cb(void *data, Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__)
-{
- Widget_Data *wd;
- Evas_Object *diskselector;
- char buf[BUFFER_SIZE];
-
- wd = elm_widget_data_get(data);
- if (!wd || !wd->base) return;
- diskselector = elm_ctxpopup_content_unset(wd->ctxpopup);
- if (diskselector) evas_object_del(diskselector);
-
- if (wd->selected_it)
- {
- snprintf(buf, sizeof(buf), EDC_PART_ITEM_FOCUSOUT_SIG_STR,
- wd->selected_it->location);
- edje_object_signal_emit(wd->base, buf, "elm");
- wd->selected_it = NULL;
- }
-}
-
-static void
-_datefield_resize_cb(void *data, Evas *e __UNUSED__,Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__)
-{
- Widget_Data *wd;
-
- wd = elm_widget_data_get(data);
- if (!wd) return;
- evas_object_hide(wd->ctxpopup);
-}
-
-static void
-_datefield_move_cb(void *data, Evas *e __UNUSED__,Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__)
-{
- Widget_Data *wd;
-
- wd = elm_widget_data_get(data);
- if (!wd) return;
- evas_object_hide(wd->ctxpopup);
-}
-
-static void
-_contextual_field_limit_get(Evas_Object * obj, Datefield_Item * it,
- Eina_Bool hr_fmt_check, int *range_min, int *range_max)
-{
- Widget_Data *wd;
- Datefield_Item * tmp;
- unsigned int idx;
- int ctx_max;
- Eina_Bool min_limit = EINA_TRUE;
- Eina_Bool max_limit = EINA_TRUE;
-
- wd = elm_widget_data_get(obj);
- if (!wd || !it) return;
-
- //Top to down check for current field relative min/max limit
- if (!it->abs_min || !it->abs_max )
- {
- for (idx = ELM_DATEFIELD_YEAR; idx < it->type; idx++)
- {
- tmp = wd->item_list + idx;
- if (max_limit && (*(tmp->value) < tmp->max)) max_limit= EINA_FALSE;
- if (min_limit && (*(tmp->value) > tmp->min)) min_limit= EINA_FALSE;
- }
- }
-
- if (it->abs_min || min_limit) (*range_min) = it->min;
- else (*range_min) = it->default_min;
-
- if (it->abs_max || max_limit) (*range_max) = it->max;
- else (*range_max) = it->default_max;
-
- ctx_max = it->default_max;
- if (it->type == ELM_DATEFIELD_DATE )
- {
- ctx_max = _days_in_month[wd->time->tm_mon];
- // Check for Leap year Feb.
- if (__isleap((wd->time->tm_year)) && wd->time->tm_mon == 1) ctx_max= 29;
- }
- else if (it->type == ELM_DATEFIELD_HOUR && hr_fmt_check &&
- it->hour_type == ELM_DATEFIELD_HOUR_12 ) ctx_max = 11;
-
- if (*range_max > ctx_max) *range_max = ctx_max;
-}
-
-static void
-_update_items(Evas_Object *obj)
-{
- Widget_Data *wd;
- Datefield_Item *it;
- char buf[BUFFER_SIZE];
- unsigned int idx= 0;
-
- wd = elm_widget_data_get(obj);
- if (!wd || !wd->base) return;
- for (idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++ )
- {
- it = wd->item_list + idx;
- if ( it->fmt_exist && it->enabled )
- {
- strftime(buf, BUFFER_SIZE, it->fmt, wd->time);
-
- // FIXME: no locale string availble from Libc...
- if ((!strncmp(buf, "",1)) && (it->type == ELM_DATEFIELD_AMPM))
- {
- if (wd->ampm) strncpy(buf, E_("PM"), BUFFER_SIZE);
- else strncpy(buf, E_("AM"), BUFFER_SIZE);
- }
- eina_stringshare_replace(&it->content, buf);
- snprintf(buf, sizeof(buf), EDC_PART_ITEM_STR, it->location);
- edje_object_part_text_set(wd->base, buf, it->content);
- }
- }
-}
-
-static void
-_field_value_set(Evas_Object * obj, Elm_Datefield_ItemType item_type, int value,
- Eina_Bool adjust_time)
-{
- Widget_Data *wd;
- Datefield_Item * it;
- unsigned int idx;
- int min, max;
- Eina_Bool value_changed = EINA_FALSE;
-
- wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (item_type == ELM_DATEFIELD_AMPM)
- {
- if ( value == wd->ampm ) return;
- item_type = ELM_DATEFIELD_HOUR;
- value = (wd->time->tm_hour + 12) % 24;
- adjust_time = EINA_FALSE;
- }
-
- it = wd->item_list + item_type;
- _contextual_field_limit_get(obj, it, EINA_FALSE, &min, &max);
-
- //12 hr format & PM then add 12 to value.
- if (adjust_time && it->type == ELM_DATEFIELD_HOUR &&
- it->hour_type == ELM_DATEFIELD_HOUR_12 && wd->ampm && value < 12)
- value += 12;
-
- if (value < min) value = min;
- else if (value > max) value = max;
- if ( *(it->value) == value) return;
- *(it->value) = value;
- value_changed = EINA_TRUE;
-
- //Validate & reset lower order fields
- for ( idx = item_type+1; idx < DATEFIELD_TYPE_COUNT; idx++ )
- {
- it = wd->item_list + idx;
- _contextual_field_limit_get(obj, it, EINA_FALSE, &min, &max);
- //Validate current value against context based Min/Max restriction.
- if (*it->value < min)
- {
- *it->value = min;
- value_changed = EINA_TRUE;
- }
- else if (*it->value > max)
- {
- *it->value = max;
- value_changed = EINA_TRUE;
- }
- }
- //update AM/PM state
- wd->ampm = (wd->time->tm_hour > 11 );
- _update_items(obj);
-
- if (value_changed)
- evas_object_smart_callback_call(obj, SIG_CHANGED, NULL);
-}
-
-static void
-_diskselector_cb(void *data, Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__)
-{
- DiskItem_Data *cb_data;
- Widget_Data *wd;
-
- cb_data = (DiskItem_Data *)data;
- if (!cb_data) return;
- wd = elm_widget_data_get(cb_data->datefield);
- if (!wd ) return;
-
- _field_value_set(cb_data->datefield, wd->selected_it->type,
- cb_data->sel_item_value, EINA_TRUE);
-
- evas_object_hide(wd->ctxpopup);
-}
-
-static void
-_ampm_clicked (void *data)
-{
- Widget_Data *wd;
- char buf[BUFFER_SIZE];
-
- wd = elm_widget_data_get(data);
- if (!wd || !wd->base) return;
-
- _field_value_set( data, ELM_DATEFIELD_AMPM, !wd->ampm, EINA_FALSE );
-
- snprintf(buf, sizeof(buf), EDC_PART_ITEM_FOCUSOUT_SIG_STR,
- wd->selected_it->location);
- edje_object_signal_emit(wd->base, buf, "elm");
- wd->selected_it = NULL;
-}
-
-static void
-_diskselector_item_free_cb(void *data, Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__)
-{
- if (data) free(data);
-}
-\r
-static void
-_load_field_options(Evas_Object * data, Evas_Object *diskselector,
- Datefield_Item *it)
-{
- Widget_Data *wd;
- DiskItem_Data *disk_data;
- Elm_Object_Item *item;
- int idx, min, max, selected_val;
- int text_len, max_len = 0;
- char item_label[BUFFER_SIZE];
- int cur_val, date_val;
-
- wd = elm_widget_data_get(data);
- if (!wd) return;
-
- cur_val = *(it->value);
- date_val = wd->time->tm_mday;
- _contextual_field_limit_get(data, it, EINA_TRUE, &min, &max );
-
- selected_val = *(it->value);
- wd->time->tm_mday = 1;
- // If 12hr format & PM, reduce 12
- if (it->hour_type == ELM_DATEFIELD_HOUR_12 && wd->ampm) selected_val -= 12;
-
- for (idx = min; idx <= max; idx++)\r
- {
- *(it->value) = idx;
- strftime(item_label, BUFFER_SIZE, it->fmt, wd->time );
- text_len = strlen(item_label);
- if (text_len > max_len ) max_len = text_len; //Store max. label length
-
- if (idx == selected_val) //Selected Item, dont attach a callback handler
- {
- item = elm_diskselector_item_append(diskselector, item_label,
- NULL, NULL, NULL);
- elm_diskselector_item_selected_set(item, EINA_TRUE);
- }
- else
- {
- disk_data = (DiskItem_Data *) malloc (sizeof(DiskItem_Data));
- disk_data->datefield = data;
- disk_data->sel_item_value = idx;
- item = elm_diskselector_item_append(diskselector,
- item_label, NULL, _diskselector_cb, disk_data);
- elm_diskselector_item_del_cb_set(item, _diskselector_item_free_cb);
- }
- }
- *(it->value) = cur_val;
- wd->time->tm_mday = date_val;
- elm_diskselector_side_label_length_set(diskselector, max_len);
-}
-
-static void
-_datefield_clicked_cb(void *data, Evas_Object *obj __UNUSED__,
- const char *emission __UNUSED__, const char *source)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Evas_Object *diskselector;
- const Evas_Object *edj_part;
- char buf[BUFFER_SIZE];
- unsigned int idx = 0, idx1 = 0, display_item_num;
- Evas_Coord x = 0, y = 0, w = 0, h = 0;
- Evas_Coord disksel_width;
-
- if (!wd || !wd->base) return;
- if (elm_widget_disabled_get(data)) return;
-
- wd->selected_it = NULL;
- //Locate the selected Index & Selected Datefield_Item
- for (idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++ )
- {
- snprintf(buf, sizeof(buf), EDC_PART_ITEM_OVER_STR, idx);
- if (!strncmp(buf, source, sizeof(buf)))
- {
- for (idx1 = 0; idx1 < DATEFIELD_TYPE_COUNT; idx1++ )
- {
- if ((wd->item_list + idx1)->location == (int)idx)
- {
- wd->selected_it = wd->item_list + idx1;
- break;
- }
- }
- break;
- }
- }
-
- if ( !wd->selected_it || !wd->selected_it->fmt_exist
- || !wd->selected_it->enabled ) return;
- snprintf(buf, sizeof(buf), EDC_PART_ITEM_FOCUSIN_SIG_STR,
- wd->selected_it->location);
- edje_object_signal_emit(wd->base, buf, "elm");
-
- if ( wd->selected_it->type == ELM_DATEFIELD_AMPM )
- {
- _ampm_clicked (data);
- return;
- }
-
- //Recreating diskselector everytime due to diskselector behavior
- diskselector = elm_diskselector_add(elm_widget_top_get(data));
- snprintf(buf, sizeof(buf), "datefield/%s", elm_object_style_get(data));
- elm_object_style_set(diskselector, buf);
-
- //Load the options list
- _load_field_options(data, diskselector, wd->selected_it);
-
- elm_ctxpopup_direction_priority_set(wd->ctxpopup, ELM_CTXPOPUP_DIRECTION_DOWN,
- ELM_CTXPOPUP_DIRECTION_UP, -1, -1);
- elm_object_content_set(wd->ctxpopup, diskselector);
- snprintf(buf,sizeof(buf), EDC_PART_ITEM_STR, wd->selected_it->location);
- edj_part = edje_object_part_object_get(wd->base, buf);
- evas_object_geometry_get(edj_part, &x, &y, &w, &h);
- evas_object_move(wd->ctxpopup, (x+w/2), (y+h));
-
- //If the direction of Ctxpopup is upwards, move it to the top of datefield
- if (elm_ctxpopup_direction_get (wd->ctxpopup) == ELM_CTXPOPUP_DIRECTION_UP)
- {
- elm_ctxpopup_direction_priority_set(wd->ctxpopup, ELM_CTXPOPUP_DIRECTION_UP,
- ELM_CTXPOPUP_DIRECTION_DOWN, -1, -1);
- evas_object_move(wd->ctxpopup, (x+w/2), y);
- }
- evas_object_show(wd->ctxpopup);
-
- evas_object_geometry_get(diskselector, NULL, NULL, &disksel_width, NULL);
- display_item_num = disksel_width / (w + elm_finger_size_get());
- //odd number of items leads to auto selection.
- //making as event number of item to prevent auto selection.
- if (display_item_num%2) display_item_num-=1;
- if (display_item_num < DISKSELECTOR_ITEMS_NUM_MIN)
- display_item_num = DISKSELECTOR_ITEMS_NUM_MIN;
-
- elm_diskselector_display_item_num_set(diskselector, display_item_num);
- elm_diskselector_round_set(diskselector, EINA_TRUE);
-}
-
-static unsigned int
-_parse_format( Evas_Object *obj )
-{
- Widget_Data *wd;
- Datefield_Item *it = NULL;
- unsigned int len = 0, idx, location = 0;
- char separator[MAX_SEPARATOR_LEN];
- char *fmt_ptr;
- char cur;
- Eina_Bool fmt_parsing = EINA_FALSE, sep_parsing = EINA_FALSE,
- sep_lookup = EINA_FALSE;
-
- wd = elm_widget_data_get(obj);
- fmt_ptr = wd->format;
-
- while ( (cur = *fmt_ptr ) )
- {
- if (fmt_parsing)
- {
- for ( idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++ )
- {
- if ( strchr( mapping[idx].fmt_char, cur ) )
- {
- it = wd->item_list + idx;
- //Ignore the items already have or disabled
- //valid formats, means already parsed & repeated, ignore.
- if (!it->enabled || it->location != -1) break;
- it->fmt[1] = cur;
-
- //set the hour display format 12h/24h
- if (it->type == ELM_DATEFIELD_HOUR)
- {
- if (cur == 'H' || cur == 'k' )
- it->hour_type = ELM_DATEFIELD_HOUR_24;
- else if (cur == 'I' || cur == 'l' )
- it->hour_type = ELM_DATEFIELD_HOUR_12;
- }
- else it->hour_type = ELM_DATEFIELD_HOUR_NA;
-
- it->fmt_exist = EINA_TRUE;
- it->location = location++;
- fmt_parsing = EINA_FALSE;
- sep_lookup = EINA_TRUE;
- len = 0;
- break;
- }
- }
- }
-
- if (cur == '%')
- {
- fmt_parsing = EINA_TRUE;
- sep_parsing = EINA_FALSE;
- // Set the separator to previous Item
- separator[len] = 0;
- if (it) eina_stringshare_replace(&it->separator, separator);
- }
- if (sep_parsing && (len < MAX_SEPARATOR_LEN-1)) separator[len++] = cur;
- if (sep_lookup) sep_parsing = EINA_TRUE;
- sep_lookup = EINA_FALSE;
- fmt_ptr++;
- }
- // Return the number of valid items parsed.
- return location;
-}
-
-static void
-_format_reload(Evas_Object *obj)
-{
- Widget_Data *wd;
- Datefield_Item *it;
- char buf[BUFFER_SIZE];
- unsigned int idx, location;
- char *def_fmt;
-
- wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- // fetch the format from locale specific po file.
- if (!wd->user_format )
- {
- def_fmt = E_("DateTimeFormat");
- if (!strncmp(def_fmt, "DateTimeFormat", sizeof("DateTimeFormat")))
- strncpy(wd->format, DEFAULT_FORMAT, MAX_FORMAT_LEN );
- else
- strncpy(wd->format, def_fmt, MAX_FORMAT_LEN );
- }
-
- //reset all the items to disable state
- for ( idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++ )
- {
- it = wd->item_list + idx;
- eina_stringshare_replace(&it->content, NULL);
- it->fmt_exist = EINA_FALSE;
- it->location = -1;
- }
- location = _parse_format( obj );
-
- //assign locations to disabled fields for uniform usage
- for (idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++)
- {
- it = wd->item_list + idx;
- if (it->location == -1) it->location = location++;
-
- if (it->fmt_exist && it->enabled)
- {
- snprintf(buf, sizeof(buf), EDC_PART_ITEM_ENABLE_SIG_STR,
- it->location);
- edje_object_signal_emit(wd->base, buf, "elm");
- if (it->type == ELM_DATEFIELD_AMPM)
- snprintf(buf, sizeof(buf), EDC_PART_ITEM_STYLE_AMPM_SIG_STR,
- it->location);
- else
- snprintf(buf, sizeof(buf), EDC_PART_ITEM_STYLE_DEFAULT_SIG_STR,
- it->location);
- edje_object_signal_emit(wd->base, buf, "elm");
- }
- else
- {
- snprintf(buf, sizeof(buf),EDC_PART_ITEM_DISABLE_SIG_STR,
- it->location);
- edje_object_signal_emit(wd->base, buf, "elm");
- }
- snprintf(buf, sizeof(buf), EDC_PART_SEPARATOR_STR, it->location+1);
- edje_object_part_text_set(wd->base, buf, it->separator);
- }
- edje_object_message_signal_process(wd->base);
- _update_items(obj);
-}
-
-static void
-_item_list_init(Evas_Object *obj)
-{
- Widget_Data *wd;
- Datefield_Item *it;
- char buf[BUFFER_SIZE];
- unsigned int idx;
- time_t t;
-
- wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- wd->item_list = calloc(1, DATEFIELD_TYPE_COUNT * sizeof(Datefield_Item));
- wd->time = calloc(1, sizeof(struct tm));
- t = time(NULL);
- localtime_r(&t, wd->time);
-
- (wd->item_list + ELM_DATEFIELD_YEAR)->value = &wd->time->tm_year;
- (wd->item_list + ELM_DATEFIELD_MONTH)->value = &wd->time->tm_mon;
- (wd->item_list + ELM_DATEFIELD_DATE)->value = &wd->time->tm_mday;
- (wd->item_list + ELM_DATEFIELD_HOUR)->value = &wd->time->tm_hour;
- (wd->item_list + ELM_DATEFIELD_MINUTE)->value = &wd->time->tm_min;
- (wd->item_list + ELM_DATEFIELD_AMPM)->value = &wd->ampm;
- wd->ampm = (wd->time->tm_hour > 11 );
-
- for (idx = 0; idx < DATEFIELD_TYPE_COUNT; idx++)
- {
- it = wd->item_list + idx;
- it->type = ELM_DATEFIELD_YEAR + idx;
- it->fmt[0] = '%';
- it->fmt_exist = EINA_FALSE;
- it->enabled = EINA_TRUE;
- it->min = mapping[idx].def_min;
- it->default_min = mapping[idx].def_min;
- it->max = mapping[idx].def_max;
- it->default_max = mapping[idx].def_max;
- snprintf(buf, sizeof(buf), EDC_PART_ITEM_OVER_STR, idx);
- edje_object_signal_callback_add(wd->base, "mouse,clicked,1", buf,
- _datefield_clicked_cb, obj);
- }
-}
-
-/**
- * @brief Add a new datefield Widget
- * The date format and strings are based on current locale
- *
- * @param[in] parent The parent object
- * @return The new object or NULL if it cannot be created
- *
- * @ingroup Datefield
- */
-EAPI Evas_Object *
-elm_datefield_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
- ELM_SET_WIDTYPE(widtype, "datefield");
- elm_widget_type_set(obj, widtype);
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_on_focus_hook_set( obj, _on_focus_hook, NULL );
- elm_widget_disable_hook_set(obj, _disable_hook);
- elm_widget_can_focus_set(obj, EINA_TRUE);
-
- wd->base = edje_object_add(e);
- elm_widget_resize_object_set(obj, wd->base);
- _elm_theme_object_set(obj, wd->base, "datefield", "base", "default");
- evas_object_smart_callbacks_descriptions_set(obj, _signals);
-
- _item_list_init(obj);
- _format_reload(obj);
-
- wd->ctxpopup = elm_ctxpopup_add(elm_widget_top_get(obj));
- elm_object_style_set(wd->ctxpopup, "datefield/default");
- elm_ctxpopup_horizontal_set(wd->ctxpopup, EINA_TRUE);
- evas_object_size_hint_weight_set(wd->ctxpopup, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->ctxpopup, EVAS_HINT_FILL,EVAS_HINT_FILL);
- evas_object_smart_callback_add(wd->ctxpopup, "dismissed",
- _ctxpopup_dismissed_cb, obj);
- evas_object_event_callback_add(wd->base, EVAS_CALLBACK_RESIZE,
- _datefield_resize_cb, obj);
- evas_object_event_callback_add(wd->base, EVAS_CALLBACK_MOVE,
- _datefield_move_cb, obj);
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
-
- return obj;
-}
-
-/**
- * Set the format of datefield. Formats can be like "%b %d, %Y %I : %M %p".
- * Maximum allowed format length is 32 chars.
- * Format can include separators for each individual datefield item.
- * Each separator can be a maximum of 6 UTF-8 bytes.
- * Space is also taken as a separator.
- * Following are the allowed set of format specifiers for each datefield item.
- * These specifiers can be arranged at any order as per user requirement and
- * their value will be replaced in the format as mentioned below.
- * %Y : The year as a decimal number including the century.
- * %y : The year as a decimal number without a century (range 00 to 99)
- * %m : The month as a decimal number (range 01 to 12).
- * %b : The abbreviated month name according to the current locale.
- * %B : The full month name according to the current locale.
- * %d : The day of the month as a decimal number (range 01 to 31).
- * %I : The hour as a decimal number using a 12-hour clock (range 01 to 12).
- * %H : The hour as a decimal number using a 24-hour clock (range 00 to 23).
- * %k : The hour (24-hour clock) as a decimal number (range 0 to 23). single
- * digits are preceded by a blank.
- * %l : The hour (12-hour clock) as a decimal number (range 1 to 12); single
- * digits are preceded by a blank.
- * %M : The minute as a decimal number (range 00 to 59).
- * %p : Either 'AM' or 'PM' according to the given time value, or the
- * corresponding strings for the current locale. Noon is treated as 'PM'
- * and midnight as 'AM'
- * %P : Like %p but in lowercase: 'am' or 'pm' or a corresponding string for
- * the current locale.
- * Default format is taken as per the system display language and Region format.
- *
- * @param[in] obj The datefield object
- * @param[in] fmt The date format
- *
- */
-EAPI void
-elm_datefield_format_set(Evas_Object *obj, const char *fmt)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (fmt)
- {
- strncpy( wd->format, fmt, MAX_FORMAT_LEN );
- wd->user_format = EINA_TRUE;
- }
- else wd->user_format = EINA_FALSE;
-
- _format_reload(obj);
-}
-
-/**
- * Get the format of datefield. Formats can be like "%b %d, %Y %I : %M %p".
- * Maximum allowed format length is 32 chars.
- * Format can include separators for each individual datefield item.
- * Each separator can be a maximum of 6 UTF-8 bytes.
- * Space is also taken as a separator.
- * Following are the allowed set of format specifiers for each datefield item.
- * These specifiers can be arranged at any order as per user requirement and
- * their value will be replaced in the format as mentioned below.
- * %Y : The year as a decimal number including the century.
- * %y : The year as a decimal number without a century (range 00 to 99)
- * %m : The month as a decimal number (range 01 to 12).
- * %b : The abbreviated month name according to the current locale.
- * %B : The full month name according to the current locale.
- * %d : The day of the month as a decimal number (range 01 to 31).
- * %I : The hour as a decimal number using a 12-hour clock (range 01 to 12).
- * %H : The hour as a decimal number using a 24-hour clock (range 00 to 23).
- * %k : The hour (24-hour clock) as a decimal number (range 0 to 23). single
- * digits are preceded by a blank.
- * %l : The hour (12-hour clock) as a decimal number (range 1 to 12); single
- * digits are preceded by a blank.
- * %M : The minute as a decimal number (range 00 to 59).
- * %p : Either 'AM' or 'PM' according to the given time value, or the
- * corresponding strings for the current locale. Noon is treated as 'PM'
- * and midnight as 'AM'
- * %P : Like %p but in lowercase: 'am' or 'pm' or a corresponding string for
- * the current locale.
- * Default format is taken as per the system display language and Region format.
- *
- * @param[in] obj The datefield object
- * @return date format string. ex) %b %d, %Y %I : %M %p
- *
- */
-EAPI char *
-elm_datefield_format_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd ) return NULL;
- return strdup(wd->format);
-}
-
-/**
- * @brief Set the selected value of the datefield
- * Year : years since 1900. Negative value represents year below 1900. (
- * year value -30 represents 1870). Year default range is from 70 to 137.
- * Month value range is from 0 to 11
- * Date value range is from 1 to 31 according to the month value.
- * The hour value should be set according to 24hr format (0~23)
- * Minute value range is from 0 to 59.
- * AM/PM. Value 0 for AM and 1 for PM.
- * If the value is beyond the range,
- * a) Value is less than Min range value, then Min range value is set.
- * b) Greater than Max range value, then Max Range value is set.
- * Both Min and Max range of individual fields are bound to the current context.
- *
- * @param[in] obj The datefield object
- * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
- * @param[in] value The data to be set. ex. year/month/date/hour/minute/ampm
- *
- * @ingroup Datefield
- */
-EAPI void
-elm_datefield_item_value_set(Evas_Object *obj, Elm_Datefield_ItemType itemtype,
- int value)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd;
- Datefield_Item *it;
-
- wd = elm_widget_data_get(obj);
- if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return;
-
- it = wd->item_list + itemtype;
- _field_value_set(obj, it->type, value, EINA_FALSE);
-}
-
-/**
- * @brief Get Current value date of the datefield
- * Year : years since 1900. Negative value represents year below 1900. (
- * year value -30 represents 1870). Year default range is from 70 to 137.
- * Month value range is from 0 to 11
- * Date value range is from 1 to 31 according to the month value.
- * The hour value should be set according to 24hr format (0~23)
- * Minute value range is from 0 to 59.
- * AM/PM. Value 0 for AM and 1 for PM.
- * If the value is beyond the range,
- * a) Value is less than Min range value, then Min range value is set.
- * b) Greater than Max range value, then Max Range value is set.
- * Both Min and Max range of individual fields are bound to the current context.
- *
- * @param[in] obj The datefield object
- * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
- * @return int The value of the field.
- *
- * @ingroup Datefield
- */
-EAPI int
-elm_datefield_item_value_get(const Evas_Object *obj, Elm_Datefield_ItemType
- itemtype)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) -1;
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return -1;
-
- return (*(wd->item_list + itemtype)->value);
-}
-
-
-/**
- * @brief Enable/Disable an item of the datefield
- *
- * @param[in] obj The datefield object
- * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
- * @param[in] enable Item is Enabled or disabled.
- *
- * @ingroup Datefield
- */
-
-EAPI void
-elm_datefield_item_enabled_set(Evas_Object *obj, Elm_Datefield_ItemType itemtype,
- Eina_Bool enable)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd;
- Datefield_Item *it;
-
- wd = elm_widget_data_get(obj);
- if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return;
-
- it = wd->item_list + itemtype;
- if ( it->enabled == enable ) return;
- it->enabled = enable;
- _format_reload(obj);
-}
-
-/**
- * @brief Get whether the item is Enabled/Disabled
- *
- * @param[in] obj The datefield object
- * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
- * @return EINA_TRUE = Item is Enabled or EINA_FALSE = disabled.
- *
- * @ingroup Datefield
- */
-
-EAPI Eina_Bool
-elm_datefield_item_enabled_get(const Evas_Object *obj, Elm_Datefield_ItemType itemtype)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd;
- Datefield_Item *it;
-
- wd = elm_widget_data_get(obj);
- if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return EINA_FALSE;
-
- it = wd->item_list + itemtype;
- return it->enabled;
-}
-
-/**
- * @brief Get lower boundary of the datefield
- * Year : years since 1900. Negative value represents year below 1900. (
- * year value -30 represents 1870). Year default range is from 70 to 137.
- * Month default value range is from 0 to 11
- * Date default value range is from 1 to 31 according to the month value.
- * Hour default value will be in terms of 24 hr format (0~23)
- * Minute default value range will be from 0 to 59.
- * AM/PM. Value 0 for AM and 1 for PM.
- * If the value is beyond the range,
- * a) Value is less than Min range value, then Min range value is set.
- * b) Greater than Max range value, then Max Range value is set.
- * Both Min and Max range of individual fields are bound to the current context.
- *
- * @param[in] obj The datefield object
- * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
- * @param[in] value The minimum value of the field that is to be set.
- * @ingroup Datefield
- */
-EAPI void
-elm_datefield_item_min_set(Evas_Object *obj, Elm_Datefield_ItemType itemtype,
- int value, Eina_Bool abs_limit)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd;
- Datefield_Item *it;
-
- wd = elm_widget_data_get(obj);
- if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return;
-
- it = wd->item_list + itemtype;
- if ( it->type != ELM_DATEFIELD_YEAR && value < it->default_min )
- it->min = it->default_min;
- else
- it->min = value;
-
- if(it->min > it->max ) it->max = it->min;
- it->abs_min = abs_limit;
- _field_value_set(obj, it->type, *(it->value), EINA_FALSE); // Trigger the validation
-}
-
-/**
- * @brief Get lower boundary of the datefield
- * Year : years since 1900. Negative value represents year below 1900. (
- * year value -30 represents 1870). Year default range is from 70 to 137.
- * Year default range is from 70 to 137.
- * Month default value range is from 0 to 11
- * Date default value range is from 1 to 31 according to the month value.
- * Hour default value will be in terms of 24 hr format (0~23)
- * Minute default value range will be from 0 to 59.
- * AM/PM. Value 0 for AM and 1 for PM.
- * If the value is beyond the range,
- * a) Value is less than Min range value, then Min range value is set.
- * b) Greater than Max range value, then Max Range value is set.
- * Both Min and Max range of individual fields are bound to the current context.
- *
- * @param[in] obj The datefield object
- * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
- * @return int The minimum value of the field.
- *
- * @ingroup Datepicker
- */
-EAPI int
-elm_datefield_item_min_get(const Evas_Object *obj, Elm_Datefield_ItemType
- itemtype)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) -1;
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return -1;
-
- return ((wd->item_list + itemtype)->min);
-}
-
-/**
- * @brief Get whether the minimum value of the item is absolute or not
- *
- * @param[in] obj The datefield object
- * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
- * @return EINA_TRUE = Minimim is absolute or EINA_FALSE = Minimum is relative.
- *
- * @ingroup Datefield
- */
-
-EAPI Eina_Bool
-elm_datefield_item_min_is_absolute(const Evas_Object *obj,
- Elm_Datefield_ItemType itemtype)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return EINA_FALSE;
-
- return ((wd->item_list + itemtype)->abs_min);
-}
-
-/**
- * @brief Set upper boundary of the datefield
- * Year : years since 1900. Negative value represents year below 1900. (
- * year value -30 represents 1870). Year default range is from 70 to 137.
- * Month:default value range is from 0 to 11
- * Date : default value range is from 1 to 31 according to the month value.
- * Hour : default value will be in terms of 24 hr format (0~23)
- * Minute : default value range will be from 0 to 59.
- * AM/PM: Value 0 for AM and 1 for PM.
- * If the value is beyond the contextual range,
- * a) Value is less than Min range value, then Min range value is set.
- * b) Greater than Max range value, then Max Range value is set.
- * Both Min and Max range of individual fields are bound to the current context.
- *
- * @param[in] obj The datefield object
- * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
- * @param[in] value The maximum field value that is to be set.
- *
- * @ingroup Datefield
- */
-EAPI void
-elm_datefield_item_max_set(Evas_Object *obj, Elm_Datefield_ItemType itemtype,
- int value, Eina_Bool abs_limit )
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd;
- Datefield_Item *it;
-
- wd = elm_widget_data_get(obj);
- if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return;
-
- it = wd->item_list + itemtype;
- if (it->type != ELM_DATEFIELD_YEAR && value > it->default_max )
- it->max = it->default_max;
- else
- it->max = value;
-
- if(it->max < it->min) it->min = it->max;
- it->abs_max = abs_limit;
-
- _field_value_set(obj, it->type, *(it->value), EINA_FALSE); // Trigger the validation
-}
-
-/**
- * @brief Get upper boundary of the datefield
- * Year : years since 1900. Negative value represents year below 1900. (
- * year value -30 represents 1870). Year default range is from 70 to 137.
- * Month default value range is from 0 to 11
- * Date default value range is from 1 to 31 according to the month value.
- * Hour default value will be in terms of 24 hr format (0~23)
- * Minute default value range will be from 0 to 59.
- * AM/PM. Value 0 for AM and 1 for PM.
- * If the value is beyond the range,
- * a) Value is less than Min range value, then Min range value is set.
- * b) Greater than Max range value, then Max Range value is set.
- * Both Min and Max range of individual fields are bound to the current context.
- *
- * @param[in] obj The datefield object
- * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
- * @return int The maximum value of the field.
- *
- * @ingroup Datefield
- */
-EAPI int
-elm_datefield_item_max_get(const Evas_Object *obj, Elm_Datefield_ItemType
- itemtype)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) -1;
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return -1;
-
- return ((wd->item_list + itemtype)->max);
-}
-
-/**
- * @brief Get whether the max value of the item is absolute or not
- *
- * @param[in] obj The datefield object
- * @param[in] itemtype The field type of datefield. ELM_DATEFIELD_YEAR etc.
- * @return EINA_TRUE = Max is absolute or EINA_FALSE = Max is relative.
- *
- * @ingroup Datefield
- */
-
-EAPI Eina_Bool
-elm_datefield_item_max_is_absolute(const Evas_Object *obj,
- Elm_Datefield_ItemType itemtype)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd || itemtype > ELM_DATEFIELD_AMPM ) return EINA_FALSE;
-
- return ((wd->item_list + itemtype)->abs_max);
-}
-
+++ /dev/null
- /* datefield */
-
- typedef enum _Elm_Datefield_ItemType
- {
- ELM_DATEFIELD_YEAR = 0,
- ELM_DATEFIELD_MONTH,
- ELM_DATEFIELD_DATE,
- ELM_DATEFIELD_HOUR,
- ELM_DATEFIELD_MINUTE,
- ELM_DATEFIELD_AMPM
- } Elm_Datefield_ItemType;
-
- EAPI Evas_Object *elm_datefield_add(Evas_Object *parent);
- EAPI void elm_datefield_format_set(Evas_Object *obj, const char *fmt);
- EAPI char *elm_datefield_format_get(const Evas_Object *obj);
- EAPI void elm_datefield_item_enabled_set(Evas_Object *obj, Elm_Datefield_ItemType itemtype, Eina_Bool enable);
- EAPI Eina_Bool elm_datefield_item_enabled_get(const Evas_Object *obj, Elm_Datefield_ItemType itemtype);
- EAPI void elm_datefield_item_value_set(Evas_Object *obj, Elm_Datefield_ItemType itemtype, int value);
- EAPI int elm_datefield_item_value_get(const Evas_Object *obj, Elm_Datefield_ItemType itemtype);
- EAPI void elm_datefield_item_min_set(Evas_Object *obj, Elm_Datefield_ItemType itemtype, int value, Eina_Bool abs_limit);
- EAPI int elm_datefield_item_min_get(const Evas_Object *obj, Elm_Datefield_ItemType itemtype);
- EAPI Eina_Bool elm_datefield_item_min_is_absolute(const Evas_Object *obj, Elm_Datefield_ItemType itemtype);
- EAPI void elm_datefield_item_max_set(Evas_Object *obj, Elm_Datefield_ItemType itemtype, int value, Eina_Bool abs_limit);
- EAPI int elm_datefield_item_max_get(const Evas_Object *obj, Elm_Datefield_ItemType itemtype);
- EAPI Eina_Bool elm_datefield_item_max_is_absolute(const Evas_Object *obj, Elm_Datefield_ItemType itemtype);
-
- /* smart callbacks called:
- * "changed" - when datefield value is changed, this signal is sent.
- */
-
+++ /dev/null
-#include <Elementary.h>
-#include "elm_priv.h"
-
-/**
- * @defgroup Editfield Editfield
- * @ingroup Elementary
- *
- * This is an editfield. It supports guide text and eraser feature.
- *
- * Smart callbacks that you can add are:
- *
- * focused - This signal is emitted when an editfield is focused.
- *
- * unfocused - This signal is emitted when an editfield is unfocused.
- *
- */
-
-//#define ERASER_PADDING (10)
-
-typedef struct _Widget_Data Widget_Data;
-
-struct _Widget_Data
-{
- Evas_Object *base;
- Evas_Object *entry;
- const char *label;
- const char *guide_text;
- Eina_Bool needs_size_calc:1;
- Eina_Bool show_guide_text:1;
- Eina_Bool editing:1;
- Eina_Bool single_line:1;
- Eina_Bool eraser_show:1;
-};
-
-static const char *widtype = NULL;
-static void _del_hook(Evas_Object *obj);
-static void _theme_hook(Evas_Object *obj);
-static void _sizing_eval(Evas_Object *obj);
-static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _on_focus_hook(void *data, Evas_Object *obj);
-static Eina_Bool _empty_entry(Evas_Object *entry);
-
-static const char SIG_FOCUSED[] = "focused";
-static const char SIG_UNFOCUSED[] = "unfocused";
-
-static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_FOCUSED, ""},
- {SIG_UNFOCUSED, ""},
- {NULL, NULL}
-};
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->label) eina_stringshare_del(wd->label);
- if (wd->guide_text) eina_stringshare_del(wd->guide_text);
- free(wd);
-}
-
-static void
-_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd || !wd->base) return;
- if (!elm_widget_focus_get(obj))
- {
- wd->editing = EINA_FALSE;
- edje_object_signal_emit(wd->base, "elm,state,over,show", "elm");
- edje_object_signal_emit(wd->base, "elm,state,eraser,hidden", "elm");
- if(_empty_entry(wd->entry))
- {
- if(wd->guide_text)
- {
- edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
- edje_object_signal_emit(wd->base, "elm,state,guidetext,visible", "elm");
- wd->show_guide_text = EINA_TRUE;
- }
- }
- evas_object_smart_callback_call(obj, SIG_UNFOCUSED, NULL);
- }
- else
- {
- edje_object_signal_emit(wd->base, "elm,state,over,hide", "elm");
- if ((!wd->single_line) && (!wd->editing)) //FIXME : after fixing TEXTBLOCK, this should be deleted
- {
- elm_object_focus(wd->entry);
- elm_entry_cursor_end_set(wd->entry);
- wd->editing = EINA_TRUE;
- }
- if(!(_empty_entry(wd->entry)) && (wd->eraser_show))
- edje_object_signal_emit(wd->base, "elm,state,eraser,show", "elm");
- if(wd->guide_text)
- {
- edje_object_signal_emit(wd->base, "elm,state,guidetext,hidden", "elm");
- wd->show_guide_text = EINA_FALSE;
- }
- evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL);
- }
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- char buf[4096];
- if (!wd || !wd->base) return;
- _elm_theme_object_set(obj, wd->base, "editfield", "base", elm_widget_style_get(obj));
- snprintf(buf, sizeof(buf), "editfield/%s", elm_widget_style_get(obj));
- elm_object_style_set(wd->entry, buf);
- edje_object_part_swallow(wd->base, "elm.swallow.content", wd->entry);
- if(!wd->editing)
- edje_object_signal_emit(wd->base, "elm,state,over,show", "elm");
- else
- edje_object_signal_emit(wd->base, "elm,state,over,hide", "elm");
- if(wd->single_line)
- edje_object_signal_emit(wd->base, "elm,state,text,singleline", "elm");
- else
- edje_object_signal_emit(wd->base, "elm,state,text,multiline", "elm");
- if(wd->show_guide_text)
- {
- if(_empty_entry(wd->entry))
- {
- if(wd->guide_text)
- {
- edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
- edje_object_signal_emit(wd->base, "elm,state,guidetext,visible", "elm");
- }
- }
- }
- _sizing_eval(obj);
-}
-
-static void
-_changed_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->needs_size_calc)
- {
- _sizing_eval(obj);
- wd->needs_size_calc = EINA_FALSE;
- }
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1;
- if (!wd) return;
- elm_coords_finger_size_adjust(1, &minw, 1, &minh);
- edje_object_size_min_restricted_calc(wd->base, &minw, &minh, minw, minh);
- evas_object_size_hint_min_set(obj, minw, minh);
-}
-
-static void
-_request_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->needs_size_calc) return;
- wd->needs_size_calc = EINA_TRUE;
- evas_object_smart_changed(obj);
-}
-
-static void
-_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- _request_sizing_eval(data);
-}
-
-static void
-_show_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
- if (wd->single_line && !wd->editing) // FIXME : single_line is not needed for this conditional state after TEXTBLOCK fixing
- {
- elm_object_focus(wd->entry);
- elm_entry_cursor_end_set(wd->entry);
- wd->editing = EINA_TRUE;
- }
-}
-
-static Eina_Bool
-_empty_entry(Evas_Object *entry)
-{
- const char* text;
- char *strip_text;
- int len = 0;
- text = elm_entry_entry_get(entry);
- if(!text) return EINA_TRUE;
- strip_text = elm_entry_markup_to_utf8(text);
- if (strip_text) {
- len = strlen(strip_text);
- free(strip_text);
- }
- if(len == 0)
- return EINA_TRUE;
- else
- return EINA_FALSE;
-}
-
-static void
-_entry_changed_cb(void *data, Evas_Object *obj, void* event_info __UNUSED__)
-{
- Evas_Object *ef_obj = (Evas_Object *)data;
- Widget_Data *wd = elm_widget_data_get(ef_obj);
- if(!wd || !wd->base) return;
- if(wd->single_line)
- {
- if(elm_entry_password_get(wd->entry))
- {
- edje_object_signal_emit(wd->base, "elm,state,password,set", "elm");
- edje_object_part_text_set(wd->base, "elm.content.password", elm_entry_entry_get(wd->entry));
- }
- else
- {
- edje_object_signal_emit(wd->base, "elm,state,password,unset", "elm");
- edje_object_part_text_set(wd->base, "elm.content.single", elm_entry_entry_get(wd->entry));
- }
- }
-// else // Add after TEXTBLOCK fix
-// edje_object_part_text_set(wd->base, "elm.content.multi", elm_entry_entry_get(wd->entry));
- if(!_empty_entry(wd->entry))
- {
- if(wd->eraser_show && elm_object_focus_get(obj))
- edje_object_signal_emit(wd->base, "elm,state,eraser,show", "elm");
- if(wd->guide_text)
- {
- edje_object_signal_emit(wd->base, "elm,state,guidetext,hidden", "elm");
- wd->show_guide_text = EINA_FALSE;
- }
- }
- else
- {
- if(wd->eraser_show)
- edje_object_signal_emit(wd->base, "elm,state,eraser,hidden", "elm");
- if(!elm_object_focus_get(wd->entry))
- {
- if(wd->guide_text)
- {
- edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
- edje_object_signal_emit(wd->base, "elm,state,guidetext,visible", "elm");
- wd->show_guide_text = EINA_TRUE;
- }
- }
- }
-}
-
-static void
-_signal_mouse_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if(!wd || !wd->base) return;
- if(!strcmp(source, "eraser"))
- {
- elm_entry_entry_set(wd->entry, "");
- edje_object_signal_emit(wd->base, "elm,state,eraser,hidden", "elm");
- }
-}
-
-static void
-_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- edje_object_signal_emit(wd->base, emission, source);
-}
-
-
-/**
- * Add a new editfield object
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- *
- * @ingroup Editfield
- */
-EINA_DEPRECATED Evas_Object *
-elm_editfield_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- e = evas_object_evas_get(parent);
- if (e == NULL) return NULL;
- wd = ELM_NEW(Widget_Data);
- obj = elm_widget_add(e);
- ELM_SET_WIDTYPE(widtype, "editfield");
- elm_widget_type_set(obj, "editfield");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_changed_hook_set(obj, _changed_hook);
- elm_widget_on_focus_hook_set( obj, _on_focus_hook, NULL );
- elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
- elm_widget_can_focus_set(obj, EINA_TRUE);
-
- wd->base = edje_object_add(e);
- _elm_theme_object_set(obj, wd->base, "editfield", "base", "default");
- elm_widget_resize_object_set(obj, wd->base);
- edje_object_signal_callback_add(wd->base, "mouse,clicked,1", "*",
- _signal_mouse_clicked, obj);
- wd->editing = EINA_FALSE;
- wd->single_line = EINA_FALSE;
- wd->eraser_show = EINA_TRUE;
-
- wd->entry = elm_entry_add(obj);
- elm_object_style_set(wd->entry, "editfield");
- evas_object_size_hint_weight_set(wd->entry, 0, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->entry, 0, EVAS_HINT_FILL);
- evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
- evas_object_event_callback_add(wd->entry, EVAS_CALLBACK_SHOW, _show_cb, obj);
- edje_object_part_swallow(wd->base, "elm.swallow.content", wd->entry);
- evas_object_smart_callback_add(wd->entry, "changed", _entry_changed_cb, obj);
- elm_widget_sub_object_add(obj, wd->entry);
- evas_object_show(wd->entry);
- evas_object_smart_callbacks_descriptions_set(obj, _signals);
- _sizing_eval(obj);
-
- return obj;
-}
-
-/**
- * Set the label of editfield
- *
- * @param obj The editfield object
- * @param label The label text
- *
- * @ingroup Editfield
- */
-EINA_DEPRECATED void
-elm_editfield_label_set(Evas_Object *obj, const char *label)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype);
- if (!wd || !wd->base)
- return;
- if (wd->label)
- eina_stringshare_del(wd->label);
- if (label)
- {
- wd->label = eina_stringshare_add(label);
- edje_object_signal_emit(wd->base, "elm,state,text,visible", "elm");
- }
- else
- {
- wd->label = NULL;
- edje_object_signal_emit(wd->base, "elm,state,text,hidden", "elm");
- }
- edje_object_message_signal_process(wd->base);
- edje_object_part_text_set(wd->base, "elm.text", label);
- _sizing_eval(obj);
-}
-
-/**
- * Get the label used on the editfield object
- *
- * @param obj The editfield object
- * @return label text
- *
- * @ingroup Editfield
- */
-EINA_DEPRECATED const char*
-elm_editfield_label_get(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- if (!wd || !wd->base) return NULL;
- return wd->label;
-}
-
-/**
- * Set the guidance text used on the editfield object
- *
- * @param obj The editfield object
- * @return label text
- *
- * @ingroup Editfield
- */
-EINA_DEPRECATED void
-elm_editfield_guide_text_set(Evas_Object *obj, const char *text)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype);
- if (!wd || !wd->base) return;
- if (wd->guide_text)
- eina_stringshare_del(wd->guide_text);
- if (text)
- {
- wd->guide_text = eina_stringshare_add(text);
- edje_object_part_text_set(wd->base, "elm.guidetext", wd->guide_text);
- wd->show_guide_text = EINA_TRUE;
- }
- else
- wd->guide_text = NULL;
-}
-
-/**
- * Get the guidance text used on the editfield object
- *
- * @param obj The editfield object
- * @return label text
- *
- * @ingroup Editfield
- */
-EINA_DEPRECATED const char*
-elm_editfield_guide_text_get(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- if (!wd || !wd->base)
- return NULL;
- return wd->guide_text;
-}
-
-/**
- * Get the entry of the editfield object
- *
- * @param obj The editfield object
- * @return entry object
- *
- * @ingroup Editfield
- */
-EINA_DEPRECATED Evas_Object *
-elm_editfield_entry_get(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- if (!wd) return NULL;
- return wd->entry;
-}
-
-/**
- * Set entry object style as single-line or multi-line.
- *
- * @param obj The editfield object
- * @param single_line 1 if single-line , 0 if multi-line
- *
- * @ingroup Editfield
- */
-EINA_DEPRECATED void
-elm_editfield_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype);
- if (!wd || !wd->base || (wd->single_line == single_line))
- return;
- wd->single_line = !!single_line;
- elm_entry_single_line_set(wd->entry, single_line);
- if(single_line)
- {
- elm_entry_scrollable_set(wd->entry, EINA_TRUE);
- elm_entry_single_line_set(wd->entry,EINA_TRUE);
- edje_object_signal_emit(wd->base, "elm,state,text,singleline", "elm");
- }
- else
- {
- elm_entry_scrollable_set(wd->entry, EINA_FALSE);
- elm_entry_single_line_set(wd->entry,EINA_FALSE);
- edje_object_signal_emit(wd->base, "elm,state,text,multiline", "elm");
- }
- if (!wd->editing)
- edje_object_signal_emit(wd->base, "elm,state,over,show", "elm");
-}
-
-/**
- * Get the current entry object style(single-line or multi-line)
- *
- * @param obj The editfield object
- * @return 1 if single-line , 0 if multi-line
- *
- * @ingroup Editfield
- */
-EINA_DEPRECATED Eina_Bool
-elm_editfield_entry_single_line_get(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- if (!wd || !wd->base) return EINA_FALSE;
- return wd->single_line;
-}
-
-/**
- * Set enable user to clean all of text.
- *
- * @param obj The editfield object
- * @param visible If true, the eraser is visible and user can clean all of text by using eraser.
- * If false, the eraser is invisible.
- *
- * @ingroup Editfield
- */
-EINA_DEPRECATED void
-elm_editfield_eraser_set(Evas_Object *obj, Eina_Bool visible)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype);
- if (!wd || !wd->base) return;
- wd->eraser_show = !!visible;
- if (!visible)
- edje_object_signal_emit(wd->base, "elm,state,eraser,hidden", "elm");
-}
-
-/**
- * Get the current state of erase (visible/invisible)
- *
- * @param obj The editfield object
- * @return 1 if visible, 0 if invisible
- *
- * @ingroup Editfield
- */
-EINA_DEPRECATED Eina_Bool
-elm_editfield_eraser_get(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- if (!wd || !wd->base) return EINA_FALSE;
- return wd->eraser_show;
-}
-
-/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
+++ /dev/null
-#include <Elementary.h>
-#include <Elementary_Cursor.h>
-#include "elm_priv.h"
-#include "els_scroller.h"
-#include "elm_gen.h"
-
-/* TEMPORARY */
-#undef ELM_CHECK_WIDTYPE
-#define ELM_CHECK_WIDTYPE(obj, widtype) \
- if ((!obj) || (!elm_gen_type_check((obj), __func__))) return
-#undef ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN
-#define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, ...) \
- ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
- ELM_CHECK_WIDTYPE(WIDGET((it)), widtype) __VA_ARGS__;
-
-static const char *_gengrid = NULL;
-static const char *_genlist = NULL;
-
-struct _Widget_Data
-{
- Eina_Inlist_Sorted_State *state;
- Evas_Object *obj;
- Evas_Object *scr; /* a smart scroller object which is used internally in genlist */
- Evas_Object *pan_smart; /* "elm_genlist_pan" evas smart object. this is an extern pan of smart scroller(scr). */
- Eina_List *selected;
- Eina_List *group_items;
- Eina_Inlist *items; /* inlist of all items */
- Elm_Gen_Item *reorder_it; /* item currently being repositioned */
- Elm_Gen_Item *last_selected_item;
- Pan *pan; /* pan_smart object's smart data */
- Ecore_Job *calc_job;
- int walking;
- int item_width, item_height;
- int group_item_width, group_item_height;
- int minw, minh;
- long count;
- Evas_Coord pan_x, pan_y;
- Eina_Bool reorder_mode : 1;
- Eina_Bool on_hold : 1;
- Eina_Bool multi : 1;
- Eina_Bool no_select : 1;
- Eina_Bool wasselected : 1;
- Eina_Bool always_select : 1;
- Eina_Bool clear_me : 1;
- Eina_Bool h_bounce : 1;
- Eina_Bool v_bounce : 1;
- Ecore_Cb del_cb, calc_cb, sizing_cb;
- Ecore_Cb clear_cb;
-};
-
-static const char SIG_ACTIVATED[] = "activated";
-static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
-static const char SIG_SELECTED[] = "selected";
-static const char SIG_UNSELECTED[] = "unselected";
-static const char SIG_EXPANDED[] = "expanded";
-static const char SIG_CONTRACTED[] = "contracted";
-static const char SIG_EXPAND_REQUEST[] = "expand,request";
-static const char SIG_CONTRACT_REQUEST[] = "contract,request";
-static const char SIG_REALIZED[] = "realized";
-static const char SIG_UNREALIZED[] = "unrealized";
-static const char SIG_DRAG_START_UP[] = "drag,start,up";
-static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
-static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
-static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
-static const char SIG_DRAG_STOP[] = "drag,stop";
-static const char SIG_DRAG[] = "drag";
-static const char SIG_LONGPRESSED[] = "longpressed";
-static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
-static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
-static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
-static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
-static const char SIG_SCROLL_EDGE_TOP[] = "scroll,edge,top"; // TODO : remove this
-static const char SIG_SCROLL_EDGE_BOTTOM[] = "scroll,edge,bottom"; // TODO : remove this
-static const char SIG_SCROLL_EDGE_LEFT[] = "scroll,edge,left"; // TODO : remove this
-static const char SIG_SCROLL_EDGE_RIGHT[] = "scroll,edge,right"; // TODO : remove this
-static const char SIG_EDGE_TOP[] = "edge,top";
-static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
-static const char SIG_EDGE_LEFT[] = "edge,left";
-static const char SIG_EDGE_RIGHT[] = "edge,right";
-static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left";
-static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right";
-static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up";
-static const char SIG_MULTI_SWIPE_DOWN[] = "multi,swipe,down";
-static const char SIG_MULTI_PINCH_OUT[] = "multi,pinch,out";
-static const char SIG_MULTI_PINCH_IN[] = "multi,pinch,in";
-static const char SIG_SWIPE[] = "swipe";
-static const char SIG_MOVED[] = "moved";
-
-/* THIS FUNCTION IS HACKY AND TEMPORARY!!! */
-Eina_Bool
-elm_gen_type_check(const Evas_Object *obj,
- const char *func)
-{
- const char *provided, *expected = "(unknown)";
- static int abort_on_warn = -1;
- provided = elm_widget_type_get(obj);
- if (!_genlist) _genlist = eina_stringshare_add("genlist");
- if (!_gengrid) _gengrid = eina_stringshare_add("gengrid");
- if (EINA_LIKELY(provided == _genlist) || EINA_LIKELY(provided == _gengrid))
- return EINA_TRUE;
- if ((!provided) || (!provided[0]))
- {
- provided = evas_object_type_get(obj);
- if ((!provided) || (!provided[0]))
- provided = "(unknown)";
- }
- ERR("Passing Object: %p in function: %s, of type: '%s' when expecting type: '%s'", obj, func, provided, expected);
- if (abort_on_warn == -1)
- {
- if (getenv("ELM_ERROR_ABORT")) abort_on_warn = 1;
- else abort_on_warn = 0;
- }
- if (abort_on_warn == 1) abort();
- return EINA_FALSE;
-}
-
-static const char *
-_item_text_hook(Elm_Gen_Item *it, const char *part)
-{
- if (!it->itc->func.text_get) return NULL;
- return edje_object_part_text_get(VIEW(it), part);
-}
-
-static Evas_Object *
-_item_content_get_hook(Elm_Gen_Item *it, const char *part)
-{
- return edje_object_part_swallow_get(VIEW(it), part);
-}
-
-static void
-_item_content_set_hook(Elm_Gen_Item *it, const char *part, Evas_Object *content)
-{
- edje_object_part_swallow(VIEW(it), part, content);
-}
-
-static Evas_Object *
-_item_content_unset_hook(Elm_Gen_Item *it, const char *part)
-{
- Evas_Object *obj;
-
- obj = edje_object_part_swallow_get(VIEW(it), part);
- if (!obj) return NULL;
- edje_object_part_unswallow(VIEW(it), obj);
- return obj;
-}
-
-#if 0
-static Eina_Bool
-_deselect_all_items(Widget_Data *wd)
-{
- if (!wd->selected) return EINA_FALSE;
- while (wd->selected)
- elm_gengrid_item_selected_set(wd->selected->data, EINA_FALSE);
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_item_multi_select_left(Widget_Data *wd)
-{
- if (!wd->selected) return EINA_FALSE;
-
- Elm_Gengrid_Item *prev = elm_gengrid_item_prev_get(wd->last_selected_item);
- if (!prev) return EINA_TRUE;
- if (elm_gengrid_item_selected_get(prev))
- {
- elm_gengrid_item_selected_set(wd->last_selected_item, EINA_FALSE);
- wd->last_selected_item = prev;
- elm_gengrid_item_show(wd->last_selected_item);
- }
- else
- {
- elm_gengrid_item_selected_set(prev, EINA_TRUE);
- elm_gengrid_item_show(prev);
- }
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_item_multi_select_right(Widget_Data *wd)
-{
- if (!wd->selected) return EINA_FALSE;
-
- Elm_Gengrid_Item *next = elm_gengrid_item_next_get(wd->last_selected_item);
- if (!next) return EINA_TRUE;
- if (elm_gengrid_item_selected_get(next))
- {
- elm_gengrid_item_selected_set(wd->last_selected_item, EINA_FALSE);
- wd->last_selected_item = next;
- elm_gengrid_item_show(wd->last_selected_item);
- }
- else
- {
- elm_gengrid_item_selected_set(next, EINA_TRUE);
- elm_gengrid_item_show(next);
- }
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_item_multi_select_up(Widget_Data *wd)
-{
- unsigned int i;
- Eina_Bool r = EINA_TRUE;
-
- if (!wd->selected) return EINA_FALSE;
-
- for (i = 0; (r) && (i < wd->nmax); i++)
- r &= _item_multi_select_left(wd);
-
- return r;
-}
-
-static Eina_Bool
-_item_multi_select_down(Widget_Data *wd)
-{
- unsigned int i;
- Eina_Bool r = EINA_TRUE;
-
- if (!wd->selected) return EINA_FALSE;
-
- for (i = 0; (r) && (i < wd->nmax); i++)
- r &= _item_multi_select_right(wd);
-
- return r;
-}
-
-static Eina_Bool
-_item_single_select_up(Widget_Data *wd)
-{
- unsigned int i;
-
- Elm_Gengrid_Item *prev;
-
- if (!wd->selected)
- {
- prev = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last);
- while ((prev) && (prev->delete_me))
- prev = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
- elm_gengrid_item_selected_set(prev, EINA_TRUE);
- elm_gengrid_item_show(prev);
- return EINA_TRUE;
- }
- else prev = elm_gengrid_item_prev_get(wd->last_selected_item);
-
- if (!prev) return EINA_FALSE;
-
- for (i = 1; i < wd->nmax; i++)
- {
- Elm_Gengrid_Item *tmp = elm_gengrid_item_prev_get(prev);
- if (!tmp) return EINA_FALSE;
- prev = tmp;
- }
-
- _deselect_all_items(wd);
-
- elm_gengrid_item_selected_set(prev, EINA_TRUE);
- elm_gengrid_item_show(prev);
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_item_single_select_down(Widget_Data *wd)
-{
- unsigned int i;
-
- Elm_Gengrid_Item *next;
-
- if (!wd->selected)
- {
- next = ELM_GENGRID_ITEM_FROM_INLIST(wd->items);
- while ((next) && (next->delete_me))
- next = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
- elm_gengrid_item_selected_set(next, EINA_TRUE);
- elm_gengrid_item_show(next);
- return EINA_TRUE;
- }
- else next = elm_gengrid_item_next_get(wd->last_selected_item);
-
- if (!next) return EINA_FALSE;
-
- for (i = 1; i < wd->nmax; i++)
- {
- Elm_Gengrid_Item *tmp = elm_gengrid_item_next_get(next);
- if (!tmp) return EINA_FALSE;
- next = tmp;
- }
-
- _deselect_all_items(wd);
-
- elm_gengrid_item_selected_set(next, EINA_TRUE);
- elm_gengrid_item_show(next);
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_item_single_select_left(Widget_Data *wd)
-{
- Elm_Gengrid_Item *prev;
- if (!wd->selected)
- {
- prev = ELM_GENGRID_ITEM_FROM_INLIST(wd->items->last);
- while ((prev) && (prev->delete_me))
- prev = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
- }
- else prev = elm_gengrid_item_prev_get(wd->last_selected_item);
-
- if (!prev) return EINA_FALSE;
-
- _deselect_all_items(wd);
-
- elm_gengrid_item_selected_set(prev, EINA_TRUE);
- elm_gengrid_item_show(prev);
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_item_single_select_right(Widget_Data *wd)
-{
- Elm_Gengrid_Item *next;
- if (!wd->selected)
- {
- next = ELM_GENGRID_ITEM_FROM_INLIST(wd->items);
- while ((next) && (next->delete_me))
- next = ELM_GENGRID_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
- }
- else next = elm_gengrid_item_next_get(wd->last_selected_item);
-
- if (!next) return EINA_FALSE;
-
- _deselect_all_items(wd);
-
- elm_gengrid_item_selected_set(next, EINA_TRUE);
- elm_gengrid_item_show(next);
- return EINA_TRUE;
-}
-#endif
-
-
-static void
-_item_select(Elm_Gen_Item *it)
-{
- if ((it->wd->no_select) || (it->delete_me) || (it->mode_set)) return;
- if (!it->selected)
- {
- it->selected = EINA_TRUE;
- it->wd->selected = eina_list_append(it->wd->selected, it);
- }
- else if (!it->wd->always_select) return;
-
- evas_object_ref(WIDGET(it));
- it->walking++;
- it->wd->walking++;
- if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), it);
- if (!it->delete_me)
- evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it);
- it->walking--;
- it->wd->walking--;
- evas_object_unref(WIDGET(it));
- if ((it->wd->clear_me) && (!it->wd->walking))
- elm_gen_clear(WIDGET(it));
- else
- {
- if ((!it->walking) && (it->delete_me))
- {
- if (!it->relcount) it->del_cb(it);
- }
- else
- it->wd->last_selected_item = it;
- }
-}
-/******************************************************************************/
-void
-elm_gen_item_unrealize(Elm_Gen_Item *it,
- Eina_Bool calc)
-{
- Evas_Object *content;
-
- if (!it->realized) return;
- if (it->wd->reorder_it == it) return;
- evas_event_freeze(evas_object_evas_get(WIDGET(it)));
- if (!calc)
- evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it);
- if (it->long_timer)
- {
- ecore_timer_del(it->long_timer);
- it->long_timer = NULL;
- }
-
- elm_widget_stringlist_free(it->labels);
- it->labels = NULL;
- elm_widget_stringlist_free(it->contents);
- it->contents = NULL;
- elm_widget_stringlist_free(it->states);
- it->states = NULL;
-
- EINA_LIST_FREE(it->content_objs, content)
- evas_object_del(content);
-
- it->unrealize_cb(it);
-
- it->realized = EINA_FALSE;
- it->want_unrealize = EINA_FALSE;
- evas_event_thaw(evas_object_evas_get(WIDGET(it)));
- evas_event_thaw_eval(evas_object_evas_get(WIDGET(it)));
-}
-
-void
-elm_gen_item_del_notserious(Elm_Gen_Item *it)
-{
- elm_widget_item_pre_notify_del(it);
- it->delete_me = EINA_TRUE;
- if (it->selected) it->wd->selected = eina_list_remove(it->wd->selected, it);
-
- if (it->itc->func.del)
- it->itc->func.del((void *)it->base.data, WIDGET(it));
-}
-
-void
-elm_gen_item_del_serious(Elm_Gen_Item *it)
-{
- elm_gen_item_del_notserious(it);
- it->wd->items = eina_inlist_remove(it->wd->items, EINA_INLIST_GET(it));
- if (it->tooltip.del_cb)
- it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
- it->wd->walking -= it->walking;
- if (it->long_timer) ecore_timer_del(it->long_timer);
- if (it->group)
- it->wd->group_items = eina_list_remove(it->wd->group_items, it);
-
- if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
- it->wd->calc_job = ecore_job_add(it->wd->calc_cb, it->wd);
- free(it->item);
- it->item = NULL;
- elm_widget_item_del(it);
-}
-
-Elm_Gen_Item *
-elm_gen_item_new(Widget_Data *wd,
- const Elm_Gen_Item_Class *itc,
- const void *data,
- Elm_Gen_Item *parent,
- Evas_Smart_Cb func,
- const void *func_data)
-{
- Elm_Gen_Item *it;
-
- it = elm_widget_item_new(wd->obj, Elm_Gen_Item);
- if (!it) return NULL;
- it->wd = wd;
- it->itc = itc;
- it->base.data = data;
- it->parent = parent;
- it->func.func = func;
- it->func.data = func_data;
- elm_widget_item_content_get_hook_set(it, _item_content_get_hook);
- elm_widget_item_content_set_hook_set(it, _item_content_set_hook);
- elm_widget_item_content_unset_hook_set(it, _item_content_unset_hook);
- /* TEMPORARY */
- it->sel_cb = (Ecore_Cb)_item_select;
-
- elm_widget_item_text_get_hook_set(it, _item_text_hook);
- return it;
-}
-/******************************************************************************/
-
-EAPI void
-elm_gen_item_selected_set(Elm_Gen_Item *it,
- Eina_Bool selected)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
- Widget_Data *wd = it->wd;
- if (!wd) return;
- if ((it->delete_me) || (it->disabled)) return;
- selected = !!selected;
- if (it->selected == selected) return;
-
- if (selected)
- {
- if (!wd->multi)
- {
- while (wd->selected)
- {
- if (it->unhighlight_cb) it->unhighlight_cb(wd->selected->data);
- it->unsel_cb(wd->selected->data);
- }
- }
- it->highlight_cb(it);
- _item_select(it);
- return;
- }
- if (it->unhighlight_cb) it->unhighlight_cb(it);
- it->unsel_cb(it);
-}
-
-EAPI void
-elm_gen_clear(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (wd->state)
- {
- eina_inlist_sorted_state_free(wd->state);
- wd->state = NULL;
- }
-
- if (wd->walking > 0)
- {
- Elm_Gen_Item *it;
- wd->clear_me = 1;
- EINA_INLIST_FOREACH(wd->items, it)
- it->delete_me = 1;
- return;
- }
- evas_event_freeze(evas_object_evas_get(wd->obj));
- while (wd->items)
- {
- Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
- it->del_cb(it);
- }
- wd->clear_me = 0;
- if (wd->calc_job)
- {
- ecore_job_del(wd->calc_job);
- wd->calc_job = NULL;
- }
- if (wd->selected) wd->selected = eina_list_free(wd->selected);
- if (wd->clear_cb) wd->clear_cb(wd);
- wd->pan_x = 0;
- wd->pan_y = 0;
- wd->minw = 0;
- wd->minh = 0;
- wd->count = 0;
- if (wd->pan_smart)
- {
- evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
- evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
- }
- if (wd->sizing_cb) wd->sizing_cb(wd->obj);
- elm_smart_scroller_child_region_show(wd->scr, 0, 0, 0, 0);
- evas_event_thaw(evas_object_evas_get(wd->obj));
- evas_event_thaw_eval(evas_object_evas_get(wd->obj));
-}
-
-EAPI Eina_Bool
-elm_gen_item_selected_get(const Elm_Gen_Item *it)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
- return it->selected;
-}
-
-EAPI void
-elm_gen_always_select_mode_set(Evas_Object *obj,
- Eina_Bool always_select)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- wd->always_select = always_select;
-}
-
-EAPI Eina_Bool
-elm_gen_always_select_mode_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return EINA_FALSE;
- return wd->always_select;
-}
-
-EAPI void
-elm_gen_no_select_mode_set(Evas_Object *obj,
- Eina_Bool no_select)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- wd->no_select = no_select;
-}
-
-EAPI Eina_Bool
-elm_gen_no_select_mode_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return EINA_FALSE;
- return wd->no_select;
-}
-
-EAPI void
-elm_gen_bounce_set(Evas_Object *obj,
- Eina_Bool h_bounce,
- Eina_Bool v_bounce)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
- wd->h_bounce = h_bounce;
- wd->v_bounce = v_bounce;
-}
-
-EAPI void
-elm_gen_bounce_get(const Evas_Object *obj,
- Eina_Bool *h_bounce,
- Eina_Bool *v_bounce)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (h_bounce) *h_bounce = wd->h_bounce;
- if (v_bounce) *v_bounce = wd->v_bounce;
-}
-
-EAPI void
-elm_gen_page_relative_set(Evas_Object *obj,
- double h_pagerel,
- double v_pagerel)
-{
- Evas_Coord pagesize_h;
- Evas_Coord pagesize_v;
-
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- elm_smart_scroller_paging_get(wd->scr, NULL, NULL, &pagesize_h, &pagesize_v);
- elm_smart_scroller_paging_set(wd->scr, h_pagerel, v_pagerel, pagesize_h,
- pagesize_v);
-}
-
-EAPI void
-elm_gen_page_relative_get(const Evas_Object *obj, double *h_pagerel, double *v_pagerel)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- elm_smart_scroller_paging_get(wd->scr, h_pagerel, v_pagerel, NULL, NULL);
-}
-
-EAPI void
-elm_gen_page_size_set(Evas_Object *obj,
- Evas_Coord h_pagesize,
- Evas_Coord v_pagesize)
-{
- double pagerel_h;
- double pagerel_v;
-
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_smart_scroller_paging_get(wd->scr, &pagerel_h, &pagerel_v, NULL, NULL);
- elm_smart_scroller_paging_set(wd->scr, pagerel_h, pagerel_v, h_pagesize,
- v_pagesize);
-}
-
-EAPI void
-elm_gen_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->scr)
- elm_smart_scroller_current_page_get(wd->scr, h_pagenumber, v_pagenumber);
-}
-
-EAPI void
-elm_gen_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->scr)
- elm_smart_scroller_last_page_get(wd->scr, h_pagenumber, v_pagenumber);
-}
-
-EAPI void
-elm_gen_page_show(const Evas_Object *obj, int h_pagenumber, int v_pagenumber)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->scr)
- elm_smart_scroller_page_show(wd->scr, h_pagenumber, v_pagenumber);
-}
-
-EAPI void
-elm_gen_page_bring_in(const Evas_Object *obj, int h_pagenumber, int v_pagenumber)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->scr)
- elm_smart_scroller_page_bring_in(wd->scr, h_pagenumber, v_pagenumber);
-}
-
-EAPI Elm_Gen_Item *
-elm_gen_first_item_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- if (!wd->items) return NULL;
- Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
- while ((it) && (it->delete_me))
- it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
- return it;
-}
-
-EAPI Elm_Gen_Item *
-elm_gen_last_item_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- if (!wd->items) return NULL;
- Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
- while ((it) && (it->delete_me))
- it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
- return it;
-}
-
-EAPI Elm_Gen_Item *
-elm_gen_item_next_get(const Elm_Gen_Item *it)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
- while (it)
- {
- it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
- if ((it) && (!it->delete_me)) break;
- }
- return (Elm_Gen_Item *)it;
-}
-
-EAPI Elm_Gen_Item *
-elm_gen_item_prev_get(const Elm_Gen_Item *it)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
- while (it)
- {
- it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev);
- if ((it) && (!it->delete_me)) break;
- }
- return (Elm_Gen_Item *)it;
-}
-
-EAPI Evas_Object *
-elm_gen_item_widget_get(const Elm_Gen_Item *it)
-{
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
- return WIDGET(it);
-}
+++ /dev/null
-#include <stdio.h>
-#include <math.h>
-#include <Elementary.h>
-#include "elm_priv.h"
-
-typedef struct _Widget_Data Widget_Data;
-
-#define ANI_STEP (14 * elm_scale_get())
-#define ANI_TIME (0.005)
-#define ANI_TIME_MSEC (12)
-#define CLICK_TIME_MAX (180)
-#define CLICK_WIDTH_MIN (elm_finger_size_get() >> 1)
-#define FLICK_TIME_MAX (200)
-#define FLICK_WIDTH_MIN (elm_finger_size_get() >> 2)
-#define MOVE_STEP (3)
-#define STEP_WEIGHT_DEF (1)
-#define STEP_WEIGHT_MAX (2)
-#define STEP_WEIGHT_MIN (0)
-#define MOVING_IMAGE_SIZE (128)
-#define MAX_ZOOM_SIZE (6)
-#define INTERVAL_WIDTH (15)
-#define MULTITOUCHDEVICE (11)
-
-// Enumeration for layout.
-enum
-{
- BLOCK_LEFT = 0,
- BLOCK_CENTER,
- BLOCK_RIGHT,
- BLOCK_MAX
-};
-
-// Image Slider Item.
-struct _Imageslider_Item
-{
- Evas_Object *obj;
- const char *photo_file;
- void (*func) (void *data, Evas_Object *obj, void *event_info);
- void *data;
-};
-
-// Image Slider Widget Data.
-struct _Widget_Data
-{
- Evas_Object *ly[BLOCK_MAX];
- Evas_Object *clip;
- Eina_List *its;
- Eina_List *cur;
- Evas_Coord x, y, w, h;
- Evas_Object *obj;
- Ecore_Idler *queue_idler;
- Ecore_Timer *anim_timer;
-
- Evas_Coord_Point down_pos;
- Evas_Coord move_x;
- Evas_Coord move_y;
- Evas_Coord dest_x;
- struct timeval tv;
- unsigned int timestamp;
- int step;
- int move_cnt;
- int ani_lock:1;
- int moving:1;
-};
-
-// Global value declaration.
-static const char *widtype = NULL;
-
-static const char SIG_CLICKED[] = "clicked";
-
-// Internal function declaration.
-static void _del_hook(Evas_Object *obj);
-
-static void _theme_hook(Evas_Object *obj);
-
-static void _sizing_eval(Evas_Object *obj);
-
-static void _imageslider_move(void *data, Evas * e, Evas_Object *obj, void *event_info);
-static void _imageslider_resize(void *data, Evas * e, Evas_Object *obj, void *event_info);
-static void _imageslider_show(void *data, Evas * e, Evas_Object *obj, void *event_info);
-static void _imageslider_hide(void *data, Evas * e, Evas_Object *obj, void *event_info);
-static void _imageslider_update(Widget_Data * wd);
-
-static void _imageslider_update_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord y, Evas_Coord w);
-
-static void _imageslider_obj_shift(Widget_Data * wd, Eina_Bool left);
-
-static void _imageslider_obj_move(Widget_Data * wd, Evas_Coord step);
-
-static Eina_Bool _icon_to_image(void *data);
-
-static int _check_drag(int state, void *data);
-
-static void _anim(Widget_Data * wd);
-
-static Eina_Bool _timer_cb(void *data);
-
-static void _ev_imageslider_down_cb(void *data, Evas * e, Evas_Object *obj, void *event_info);
-static void _ev_imageslider_up_cb(void *data, Evas * e, Evas_Object *obj, void *event_info);
-static void _ev_imageslider_move_cb(void *data, Evas * e, Evas_Object *obj, void *event_info);
-
-// Whenever the Image Slider item is deleted, Call this funtion.
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
-
- if (!wd) return;
-
- if (wd->its)
- {
- eina_list_free(wd->its);
- wd->its = NULL;
- }
-
- if (wd->queue_idler)
- {
- ecore_idler_del(wd->queue_idler);
- wd->queue_idler = NULL;
- }
-
- if (wd->anim_timer)
- {
- ecore_timer_del(wd->anim_timer);
- wd->anim_timer = NULL;
- }
-
- if (wd) free(wd);
-}
-
-// Whenever require processing theme, Call this function
-static void
-_theme_hook(Evas_Object *obj)
-{
- int i = 0;
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
-
- for (i = 0; i < BLOCK_MAX; i++)
- {
- if (wd->ly[i])
- elm_layout_theme_set(wd->ly[i], "imageslider", "base",
- elm_object_style_get(obj));
- evas_object_show(wd->ly[i]);
- }
- _imageslider_update(wd);
- _sizing_eval(obj);
-}
-
-// Resize Image Slider item.
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Evas *e;
-
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd)
- return;
-
- e = evas_object_evas_get(wd->obj);
-
- _imageslider_move(obj, e, obj, NULL);
- _imageslider_resize(obj, e, obj, NULL);
-}
-
-// Whenever MOVE event occurs, Call this function.
-static void
-_imageslider_move(void *data, Evas * e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
-{
- Widget_Data *wd;
-
- Evas_Coord x, y;
-
- if (!data)
- return;
-
- wd = elm_widget_data_get((Evas_Object *) data);
- if (!wd)
- return;
-
- evas_object_geometry_get(obj, &x, &y, NULL, NULL);
- wd->x = x;
- wd->y = y;
-
- _imageslider_update_pos(wd, wd->x, wd->y, wd->w);
-}
-
-// Whenever RESIZE event occurs, Call this fucntion.
-static void
-_imageslider_resize(void *data, Evas * e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
-{
- int i;
-
- Widget_Data *wd;
-
- Evas_Coord w, h;
-
- if (!data)
- return;
-
- wd = elm_widget_data_get((Evas_Object *) data);
- if (!wd)
- return;
-
- evas_object_geometry_get(obj, NULL, NULL, &w, &h);
- DBG("%d %d -resize\n", w, h);
- wd->w = w;
- wd->h = h;
-
- for (i = 0; i < BLOCK_MAX; i++)
- {
- evas_object_resize(wd->ly[i], w, h);
- }
-
- _imageslider_update_pos(wd, wd->x, wd->y, wd->w);
-
-}
-
-// Whenever SHOW event occurs, Call this function.
-static void
-_imageslider_show(void *data, Evas * e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Widget_Data *wd;
-
- if (!data)
- {
- return;
- }
-
- wd = elm_widget_data_get((Evas_Object *) data);
- if (!wd) return;
-
- evas_object_show(wd->clip);
-}
-
-// Whenever HIDE event occurs, Call this function.
-static void
-_imageslider_hide(void *data, Evas * e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Widget_Data *wd;
-
- if (!data) return;
-
- wd = elm_widget_data_get((Evas_Object *) data);
- if (!wd) return;
- evas_object_hide(wd->clip);
-}
-
-// Update Image Slider item position.
-static void
-_imageslider_update_pos(Widget_Data * wd, Evas_Coord x, Evas_Coord y, Evas_Coord w)
-{
- evas_object_move(wd->ly[BLOCK_LEFT], x - (w + INTERVAL_WIDTH), y);
- evas_object_move(wd->ly[BLOCK_CENTER], x, y);
- evas_object_move(wd->ly[BLOCK_RIGHT], x + (w + INTERVAL_WIDTH), y);
-}
-
-// Shift next/previous Image Slider item in layouts.
-static void
-_imageslider_obj_shift(Widget_Data * wd, Eina_Bool left)
-{
- if (!left)
- {
- Evas_Object *ly_temp;
- ly_temp = wd->ly[BLOCK_LEFT];
- wd->ly[BLOCK_LEFT] = wd->ly[BLOCK_CENTER];
- wd->ly[BLOCK_CENTER] = wd->ly[BLOCK_RIGHT];
- wd->ly[BLOCK_RIGHT] = ly_temp;
- elm_object_part_content_set(wd->ly[BLOCK_RIGHT], "swl.photo", NULL);
- }
- else
- {
- Evas_Object *ly_temp;
- ly_temp = wd->ly[BLOCK_RIGHT];
- wd->ly[BLOCK_RIGHT] = wd->ly[BLOCK_CENTER];
- wd->ly[BLOCK_CENTER] = wd->ly[BLOCK_LEFT];
- wd->ly[BLOCK_LEFT] = ly_temp;
- elm_object_part_content_set(wd->ly[BLOCK_LEFT], "swl.photo", NULL);
- }
-}
-
-// Move the current Image Slider item and update.
-static void
-_imageslider_obj_move(Widget_Data * wd, Evas_Coord step)
-{
- if (step > 0)
- {
- wd->cur = eina_list_next(wd->cur);
- if (wd->cur == NULL)
- {
- wd->cur = eina_list_last(wd->its);
- wd->step = ANI_STEP;
- }
- else
- {
- wd->step = -ANI_STEP;
- wd->move_x += wd->w;
- _imageslider_obj_shift(wd, EINA_FALSE);
- }
- wd->moving = EINA_TRUE;
- }
- else if (step < 0)
- {
- wd->cur = eina_list_prev(wd->cur);
- if (wd->cur == NULL)
- {
- wd->cur = wd->its;
- wd->step = -ANI_STEP;
- }
- else
- {
- wd->step = ANI_STEP;
- wd->move_x -= wd->w;
- _imageslider_obj_shift(wd, EINA_TRUE);
- }
- wd->moving = EINA_TRUE;
- }
- else
- {
- if (wd->move_x < 0)
- wd->step = ANI_STEP;
- else
- wd->step = -ANI_STEP;
- wd->moving = EINA_FALSE;
- }
-
- _imageslider_update(wd);
-}
-
-// Whenever MOUSE DOWN event occurs, Call this function.
-static void
-_ev_imageslider_down_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
-{
- Widget_Data *wd = data;
- Evas_Event_Mouse_Down *ev = event_info;
-
- if (wd->ani_lock)
- return;
-
- wd->down_pos = ev->canvas;
- wd->timestamp = ev->timestamp;
- wd->move_cnt = MOVE_STEP;
-}
-
-// Whenever MOUSE UP event occurs, Call this function.
-// And make Click Event also.
-static void
-_ev_imageslider_up_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
-{
- Widget_Data *wd = data;
-
- Evas_Event_Mouse_Up *ev = event_info;
-
- Evas_Coord step;
-
- int interval;
-
- if (wd->ani_lock) return;
-
- step = wd->down_pos.x - ev->canvas.x;
- interval = ev->timestamp - wd->timestamp;
- if (step == 0 || interval == 0)
- {
- DBG("case1: emit CLICK event\n");
- evas_object_smart_callback_call(wd->obj, SIG_CLICKED, NULL);
- return;
- }
- if (interval < CLICK_TIME_MAX)
- {
- if (step < CLICK_WIDTH_MIN && step > CLICK_WIDTH_MIN)
- {
- DBG("case2: emit CLICK event\n");
- evas_object_smart_callback_call(wd->obj, SIG_CLICKED, NULL);
- return;
- }
- }
-
- if (interval < FLICK_TIME_MAX)
- {
- if (step < FLICK_WIDTH_MIN && step > FLICK_WIDTH_MIN)
- {
- DBG("ev_imageslider_up_cb-black zone (1)\n");
-
- _imageslider_obj_move(wd, 0);
- }
- else
- {
- DBG("ev_imageslider_up_cb-black zone (2)\n");
-
- _imageslider_obj_move(wd, step);
- }
-
- }
- else
- {
- step = (wd->x - wd->move_x) << 1;
- if (step <= wd->w && step >= -(wd->w))
- {
- DBG("ev_imageslider_up_cb-white zone (1)\n");
-
- _imageslider_obj_move(wd, 0);
- }
- else
- {
- DBG("ev_imageslider_up_cb-white zone (2)\n");
-
- _imageslider_obj_move(wd, step);
- }
- }
-}
-
-// Whenever MOUSE MOVE event occurs, Call this
-static void
-_ev_imageslider_move_cb(void *data, Evas * e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
-{
- int idx = 0;
- Evas_Coord step;
- Widget_Data *wd = data;
- Evas_Event_Mouse_Move *ev = event_info;
-
- if (wd->ani_lock) return;
- if (wd->move_cnt == MOVE_STEP)
- {
- wd->move_cnt = 0;
-
- if (ev->buttons)
- {
- step = ev->cur.canvas.x - wd->down_pos.x;
- if (step > 0)
- idx = BLOCK_LEFT;
- else
- idx = BLOCK_RIGHT;
- wd->move_x = wd->x + ((ev->cur.canvas.x - wd->down_pos.x));
- wd->move_y = wd->y + ((ev->cur.canvas.y - wd->down_pos.y));
- _imageslider_update_pos(wd, wd->move_x, wd->y, wd->w);
- }
- }
- wd->move_cnt++;
-}
-
-static inline double
-time_get(Evas_Coord x, Evas_Coord w)
-{
- double time;
-
- time = (-sin(x / w) + 1) / 500;
-
- if (time == 0)
- time = ANI_TIME;
-
- return time;
-}
-
-static Eina_Bool
-_icon_to_image(void *data)
-{
- Widget_Data *wd = data;
-
- wd->moving = 0;
- _imageslider_update(wd);
-
- if (wd->queue_idler)
- wd->queue_idler = NULL;
- return ECORE_CALLBACK_CANCEL;
-}
-
-static int
-_check_drag(int state, void *data)
-{
- Widget_Data *wd = data;
-
- Elm_Imageslider_Item *it;
-
- Evas_Coord ix = 0, iy = 0, iw = 0, ih = 0;
-
- double dx = 0, dy = 0;
-
- Eina_List *l[BLOCK_MAX];
-
- Evas_Object *eo = NULL;
-
- l[BLOCK_LEFT] = eina_list_prev(wd->cur);
- l[BLOCK_CENTER] = wd->cur;
- l[BLOCK_RIGHT] = eina_list_next(wd->cur);
-
- it = eina_list_data_get(l[state]);
-
- eo = elm_object_part_content_get(wd->ly[state], "swl.photo");
- if (eo)
- evas_object_geometry_get(eo, &ix, &iy, &iw, &ih);
- edje_object_part_drag_value_get(elm_layout_edje_get(wd->ly[state]), "swl.photo", &dx, &dy);
-
- if ((iw != wd->w) || ((dx != 0) || (dy != 0)))
- {
- elm_object_part_content_set(wd->ly[state], "swl.photo", NULL);
- }
- else
- return 1;
-
- return 0;
-}
-
-static Eina_Bool
-_timer_cb(void *data)
-{
- Widget_Data *wd;
-
- Elm_Imageslider_Item *it;
-
- struct timeval tv;
-
- int t = 0;
- int ret = 0;
-
- wd = data;
- if (!wd->ani_lock)
- {
- if (wd->anim_timer)
- wd->anim_timer = NULL;
- return ECORE_CALLBACK_CANCEL;
- }
- gettimeofday(&tv, NULL);
-
- t = (tv.tv_sec - wd->tv.tv_sec) * 1000 + (tv.tv_usec - wd->tv.tv_usec) / 1000;
- gettimeofday(&wd->tv, NULL);
-
- t = t / ANI_TIME_MSEC;
- if (t <= STEP_WEIGHT_MIN)
- t = STEP_WEIGHT_DEF;
- else if (t > STEP_WEIGHT_MAX)
- t = STEP_WEIGHT_MAX;
-
- wd->move_x += (wd->step) * t;
-
- if (wd->step < 0 && wd->move_x < wd->x)
- wd->move_x = wd->x;
- else if (wd->step > 0 && wd->move_x > wd->x)
- wd->move_x = wd->x;
-
- _imageslider_update_pos(wd, wd->move_x, wd->y, wd->w);
-
- if (wd->move_x == wd->x)
- {
- wd->ani_lock = EINA_FALSE;
- if (wd->cur)
- {
- it = eina_list_data_get(wd->cur);
- if (it->func)
- it->func(it->data, wd->obj, it);
- }
- if (wd->cur)
- {
- it = eina_list_data_get(wd->cur);
- evas_object_smart_callback_call(wd->obj, "changed", it);
- }
-
- ret = _check_drag(BLOCK_LEFT, wd);
- ret = _check_drag(BLOCK_RIGHT, wd);
-
- if (!wd->queue_idler)
- wd->queue_idler = ecore_idler_add(_icon_to_image, wd);
-
- if (wd->anim_timer)
- wd->anim_timer = NULL;
-
- return ECORE_CALLBACK_CANCEL;
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
-static void
-_anim(Widget_Data * wd)
-{
- Evas_Coord w;
-
- if (wd->x == wd->move_x)
- {
- _imageslider_update_pos(wd, wd->move_x, wd->y, wd->w);
- return;
- }
-
- wd->ani_lock = EINA_TRUE;
-
- w = wd->move_x;
- gettimeofday(&wd->tv, NULL);
-
- if (!wd->anim_timer)
- wd->anim_timer = ecore_timer_add(ANI_TIME, _timer_cb, wd);
-}
-
-// Update Image Slider Items.
-static void
-_imageslider_update(Widget_Data * wd)
-{
- int i;
-
- Eina_List *l[BLOCK_MAX];
-
- Elm_Imageslider_Item *it;
-
- Evas_Object *eo;
-
- if (!wd) return;
-
- if (!wd->cur) return;
-
- l[BLOCK_LEFT] = eina_list_prev(wd->cur);
- l[BLOCK_CENTER] = wd->cur;
- l[BLOCK_RIGHT] = eina_list_next(wd->cur);
-
- for (i = 0; i < BLOCK_MAX; i++)
- {
- eo = elm_object_part_content_get((const Evas_Object*)wd->ly[i], "swl.photo");
- if (!l[i])
- {
- elm_object_part_content_set(wd->ly[i], "swl.photo", NULL);
- }
- else
- {
- it = eina_list_data_get(l[i]);
- if (!it)
- return;
-
- if (!eo)
- {
- eo = elm_image_add(wd->obj);
- //elm_image_prescale_set(eo, wd->w);
- elm_image_file_set(eo, it->photo_file, NULL);
- elm_object_part_content_set(wd->ly[i], "swl.photo", eo);
- }
- }
- }
- _anim(wd);
-}
-
-EAPI Evas_Object *
-elm_imageslider_add(Evas_Object *parent)
-{
- int i;
-
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
- ELM_SET_WIDTYPE(widtype, "imageslider");
- elm_widget_type_set(obj, "imageslider");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
-
- wd->clip = evas_object_rectangle_add(e);
- elm_widget_sub_object_add(obj, wd->clip);
- elm_widget_resize_object_set(obj, wd->clip);
-
- for (i = 0; i < BLOCK_MAX; i++)
- {
- wd->ly[i] = elm_layout_add(obj);
- elm_layout_theme_set(wd->ly[i], "imageslider", "base", "default");
- elm_widget_sub_object_add(obj, wd->ly[i]);
- evas_object_smart_member_add(wd->ly[i], obj);
-
- evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_DOWN, _ev_imageslider_down_cb, wd);
- evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_UP, _ev_imageslider_up_cb, wd);
- evas_object_event_callback_add(wd->ly[i], EVAS_CALLBACK_MOUSE_MOVE, _ev_imageslider_move_cb, wd);
- evas_object_clip_set(wd->ly[i], wd->clip);
- evas_object_show(wd->ly[i]);
- }
-
- wd->obj = obj;
- evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _imageslider_resize, obj);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _imageslider_move, obj);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _imageslider_show, obj);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _imageslider_hide, obj);
-
- _sizing_eval(obj);
- return obj;
-}
-
-EAPI Elm_Imageslider_Item *
-elm_imageslider_item_append(Evas_Object *obj, const char *photo_file, Elm_Imageslider_Cb func, void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd;
-
- Elm_Imageslider_Item *it;
-
- if (!obj || !(wd = elm_widget_data_get(obj)))
- return NULL;
-
- it = (Elm_Imageslider_Item *) calloc(1, sizeof(Elm_Imageslider_Item));
- if (!it)
- return NULL;
- it->photo_file = eina_stringshare_add(photo_file);
- it->func = func;
- it->data = data;
- it->obj = obj;
- wd->its = eina_list_append(wd->its, it);
-
- if (!wd->cur)
- wd->cur = wd->its;
- _imageslider_update(wd);
- return it;
-}
-
-EAPI Elm_Imageslider_Item *
-elm_imageslider_item_append_relative(Evas_Object *obj, const char *photo_file, Elm_Imageslider_Cb func, unsigned int index, void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd;
-
- Elm_Imageslider_Item *it;
-
- DBG("New elm_imageslider_item_append_relative()\n");
-
- if (!obj || !(wd = elm_widget_data_get(obj)))
- return NULL;
-
- it = (Elm_Imageslider_Item *) calloc(1, sizeof(Elm_Imageslider_Item));
- if (!it)
- return NULL;
-
- it->obj = obj;
- it->photo_file = eina_stringshare_add(photo_file);
- it->func = func;
- it->data = data;
-
- wd->its = eina_list_append_relative(wd->its, it, eina_list_nth(wd->its,
- index - 2));
-
- if (!wd->cur)
- wd->cur = wd->its;
- _imageslider_update(wd);
- return it;
-}
-
-EAPI Elm_Imageslider_Item *
-elm_imageslider_item_prepend(Evas_Object *obj, const char *photo_file, Elm_Imageslider_Cb func, void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd;
-
- Elm_Imageslider_Item *it;
-
- if (!obj || !(wd = elm_widget_data_get(obj)))
- return NULL;
-
- it = (Elm_Imageslider_Item *) calloc(1, sizeof(Elm_Imageslider_Item));
- it->photo_file = eina_stringshare_add(photo_file);
- it->func = func;
- it->data = data;
- it->obj = obj;
- wd->its = eina_list_prepend(wd->its, it);
- if (!wd->cur)
- wd->cur = wd->its;
- _imageslider_update(wd);
- return it;
-}
-
-EAPI void
-elm_imageslider_item_del(Elm_Imageslider_Item * it)
-{
- Widget_Data *wd;
-
- Elm_Imageslider_Item *_it;
-
- Eina_List *l;
-
- if (!it || !(wd = elm_widget_data_get(it->obj)))
- return;
-
- EINA_LIST_FOREACH(wd->its, l, _it)
- {
- if (_it == it)
- {
- if (l == wd->cur)
- wd->cur = eina_list_prev(wd->cur);
- wd->its = eina_list_remove(wd->its, it);
- if (!wd->cur)
- wd->cur = wd->its;
- break;
- }
- }
- _imageslider_update(wd);
-}
-
-EAPI Elm_Imageslider_Item *
-elm_imageslider_selected_item_get(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd;
-
- if (!obj || (!(wd = elm_widget_data_get(obj))))
- return NULL;
-
- if (!wd->cur)
- return NULL;
-
- return eina_list_data_get(wd->cur);
-}
-
-EAPI Eina_Bool
-elm_imageslider_item_selected_get(Elm_Imageslider_Item * it)
-{
- Widget_Data *wd;
-
- if (!it || !it->obj || (!(wd = elm_widget_data_get(it->obj))))
- return EINA_FALSE;
-
- if (!wd->cur)
- return EINA_FALSE;
-
- if (eina_list_data_get(wd->cur) == it)
- return EINA_TRUE;
- else
- return EINA_FALSE;
-}
-
-EAPI void
-elm_imageslider_item_selected_set(Elm_Imageslider_Item * it)
-{
- int i;
-
- Widget_Data *wd;
-
- Elm_Imageslider_Item *_it;
-
- Eina_List *l;
-
- Evas_Object *eo;
-
- if (!it || !it->obj || (!(wd = elm_widget_data_get(it->obj))))
- return;
-
- EINA_LIST_FOREACH(wd->its, l, _it)
- {
- if (_it == it)
- wd->cur = l;
- }
-
- for (i = 0; i < BLOCK_MAX; i++)
- {
- eo = elm_object_part_content_get(wd->ly[i], "swl.photo");
- if (eo)
- elm_object_part_content_set(wd->ly[i], "swl.photo", NULL);
- }
- _imageslider_update(wd);
-}
-
-EAPI const char *
-elm_imageslider_item_photo_file_get(Elm_Imageslider_Item * it)
-{
- if (!it) return NULL;
-
- return it->photo_file;
-}
-
-EAPI void
-elm_imageslider_item_photo_file_set(Elm_Imageslider_Item *it, const char *photo_file)
-{
- if (!it) return;
- ELM_CHECK_WIDTYPE(it->obj, widtype);
-
- if (photo_file)
- {
- eina_stringshare_replace(&(it->photo_file), photo_file);
- elm_imageslider_item_update(it);
- }
-}
-
-EAPI Elm_Imageslider_Item *
-elm_imageslider_item_prev(Elm_Imageslider_Item * it)
-{
- Widget_Data *wd;
-
- Elm_Imageslider_Item *_it;
-
- Eina_List *l;
-
- if (!it || (!(wd = elm_widget_data_get(it->obj))))
- return NULL;
-
- EINA_LIST_FOREACH(wd->its, l, _it)
- {
- if (_it == it)
- {
- l = eina_list_prev(l);
- if (!l)
- break;
- return eina_list_data_get(l);
- }
- }
- return NULL;
-}
-
-EAPI Elm_Imageslider_Item *
-elm_imageslider_item_next(Elm_Imageslider_Item * it)
-{
- Widget_Data *wd;
-
- Elm_Imageslider_Item *_it;
-
- Eina_List *l;
-
- if (!it || (!(wd = elm_widget_data_get(it->obj))))
- return NULL;
-
- EINA_LIST_FOREACH(wd->its, l, _it)
- {
- if (_it == it)
- {
- l = eina_list_next(l);
- if (!l)
- break;
- return eina_list_data_get(l);
- }
- }
- return NULL;
-}
-
-EAPI void
-elm_imageslider_prev(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd;
-
- if (!obj || (!(wd = elm_widget_data_get(obj))))
- return;
- if (wd->ani_lock)
- return;
- _imageslider_obj_move(wd, -1);
-}
-
-EAPI void
-elm_imageslider_next(Evas_Object * obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd;
-
- if (!obj || (!(wd = elm_widget_data_get(obj))))
- return;
- if (wd->ani_lock)
- return;
- _imageslider_obj_move(wd, 1);
-}
-
-EAPI void
-elm_imageslider_item_update(Elm_Imageslider_Item *it)
-{
- Widget_Data *wd;
-
- if (!it || (!(wd = elm_widget_data_get(it->obj)))) return;
- ELM_CHECK_WIDTYPE(it->obj, widtype);
-
- if (wd->ani_lock) return;
- if (it == eina_list_data_get(eina_list_prev(wd->cur)))
- elm_object_part_content_set(wd->ly[BLOCK_LEFT], "swl.photo", NULL);
- else if (it == eina_list_data_get(wd->cur))
- elm_object_part_content_set(wd->ly[BLOCK_CENTER], "swl.photo", NULL);
- else if (it == eina_list_data_get(eina_list_next(wd->cur)))
- elm_object_part_content_set(wd->ly[BLOCK_RIGHT], "swl.photo", NULL);
- _imageslider_update(wd);
-}
+++ /dev/null
- /**
- * @defgroup Imageslider Imageslider
- * @ingroup Elementary
- * @addtogroup Imageslider
- * @{
- *
- * By flicking images on the screen,
- * you can see the images in specific path.
- */
- typedef struct _Imageslider_Item Elm_Imageslider_Item;
- typedef void (*Elm_Imageslider_Cb)(void *data, Evas_Object *obj, void *event_info);
-
- /**
- * Add an Image Slider widget
- *
- * @param parent The parent object
- * @return The new Image slider object or NULL if it cannot be created
- */
- EAPI Evas_Object *elm_imageslider_add(Evas_Object *parent) EINA_ARG_NONNULL(1);
- /**
- * Append an Image Slider item
- *
- * @param obj The Image Slider object
- * @param photo_file photo file path
- * @param func callback function
- * @param data callback data
- * @return The Image Slider item handle or NULL
- */
- EAPI Elm_Imageslider_Item *elm_imageslider_item_append(Evas_Object *obj, const char *photo_file, Elm_Imageslider_Cb func, void *data) EINA_ARG_NONNULL(1);
- /**
- * Insert an Image Slider item into the Image Slider Widget by using the given index.
- *
- * @param obj The Image Slider object
- * @param photo_file photo file path
- * @param func callback function
- * @param index required position
- * @param data callback data
- * @return The Image Slider item handle or NULL
- */
- EAPI Elm_Imageslider_Item *elm_imageslider_item_append_relative(Evas_Object *obj, const char *photo_file, Elm_Imageslider_Cb func, unsigned int index, void *data) EINA_ARG_NONNULL(1);
- /**
- * Prepend Image Slider item
- *
- * @param obj The Image Slider object
- * @param photo_file photo file path
- * @param func callback function
- * @param data callback data
- * @return The imageslider item handle or NULL
- */
- EAPI Elm_Imageslider_Item *elm_imageslider_item_prepend(Evas_Object *obj, const char *photo_file, Elm_Imageslider_Cb func, void *data) EINA_ARG_NONNULL(1);
- /**
- * Delete the selected Image Slider item
- *
- * @param it The selected Image Slider item handle
- */
- EAPI void elm_imageslider_item_del(Elm_Imageslider_Item *it) EINA_ARG_NONNULL(1);
- /**
- * Get the selected Image Slider item
- *
- * @param obj The Image Slider object
- * @return The selected Image Slider item or NULL
- */
- EAPI Elm_Imageslider_Item *elm_imageslider_selected_item_get(Evas_Object *obj) EINA_ARG_NONNULL(1);
- /**
- * Get whether an Image Slider item is selected or not
- *
- * @param it the selected Image Slider item
- * @return EINA_TRUE or EINA_FALSE
- */
- EAPI Eina_Bool elm_imageslider_item_selected_get(Elm_Imageslider_Item *it) EINA_ARG_NONNULL(1);
- /**
- * Set the selected Image Slider item
- *
- * @param it The Imaga Slider item
- */
- EAPI void elm_imageslider_item_selected_set(Elm_Imageslider_Item *it) EINA_ARG_NONNULL(1);
- /**
- * Get the photo file path of given Image Slider item
- *
- * @param it The Image Slider item
- * @return The photo file path or NULL;
- */
- EAPI const char *elm_imageslider_item_photo_file_get(Elm_Imageslider_Item *it) EINA_ARG_NONNULL(1);
- /**
- * Sets the photo file path of given Image Slider item
- *
- * @param it The Image Slider item
- * @param photo_file The photo file path or NULL;
- */
- EAPI Elm_Imageslider_Item *elm_imageslider_item_prev(Elm_Imageslider_Item *it) EINA_ARG_NONNULL(1);
- /**
- * Get the previous Image Slider item
- *
- * @param it The Image Slider item
- * @return The previous Image Slider item or NULL
- */
- EAPI Elm_Imageslider_Item *elm_imageslider_item_next(Elm_Imageslider_Item *it) EINA_ARG_NONNULL(1);
- /**
- * Get the next Image Slider item
- *
- * @param it The Image Slider item
- * @return The next Image Slider item or NULL
- */
- EAPI void elm_imageslider_prev(Evas_Object *obj) EINA_ARG_NONNULL(1);
- /**
- * Move to the previous Image Slider item
- *
- * @param obj The Image Slider object
- */
- EAPI void elm_imageslider_next(Evas_Object *obj) EINA_ARG_NONNULL(1);
- /**
- * Move to the next Image Slider item
- *
- * @param obj The Image Slider object
- */
- EAPI void elm_imageslider_item_photo_file_set(Elm_Imageslider_Item *it, const char *photo_file) EINA_ARG_NONNULL(1,2);
- /**
- * Updates an Image Slider item
- *
- * @param it The Image Slider item
- */
- EAPI void elm_imageslider_item_update(Elm_Imageslider_Item *it) EINA_ARG_NONNULL(1);
- /**
- * @}
- */
-
+++ /dev/null
-#include <Elementary.h>
-#include "elm_priv.h"
-
-/**
- * @defgroup NoContents NoContents
- * @ingroup Elementary
- *
- */
-
-typedef struct _Widget_Data Widget_Data;
-
-struct _Widget_Data
-{
- Evas_Object *noc;
- Evas_Object *custom;
- const char *label;
-};
-
-static const char *widtype = NULL;
-static void _del_hook(Evas_Object *obj);
-static void _theme_hook(Evas_Object *obj);
-static void _sizing_eval(Evas_Object *obj);
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- free(wd);
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- _elm_theme_object_set(obj, wd->noc, "nocontents", "base", elm_widget_style_get(obj));
- edje_object_part_text_set(wd->noc, "elm.text", wd->label);
- edje_object_message_signal_process(wd->noc);
- edje_object_scale_set(wd->noc, elm_widget_scale_get(obj) * _elm_config->scale);
- _sizing_eval(obj);
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
- if (!wd) return;
- edje_object_size_min_calc(wd->noc, &minw, &minh);
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, maxw, maxh);
- evas_object_size_hint_align_set(obj, maxw, maxh);
-}
-
-/**
- * Add a nocontents object to @p parent
- *
- * @param parent The parent object
- *
- * @return The nocontents object, or NULL upon failure
- *
- * @ingroup NoContents
- */
-EAPI Evas_Object *
-elm_nocontents_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- obj = elm_widget_add(e);
- ELM_SET_WIDTYPE(widtype, "nocontents");
- elm_widget_type_set(obj, "nocontents");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_can_focus_set(obj, 0);
-
- wd->label = NULL;
- wd->custom = NULL;
-
- wd->noc = edje_object_add(e);
- _elm_theme_object_set(obj, wd->noc, "nocontents", "base", "default");
- elm_widget_resize_object_set(obj, wd->noc);
- _sizing_eval(obj);
- return obj;
-}
-
-/**
- * Set the label on the nocontents object
- *
- * @param obj The nocontents object
- * @param label The label will be used on the nocontents object
- *
- * @ingroup NoContents
- */
-EAPI void
-elm_nocontents_label_set(Evas_Object *obj, const char *label)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (!label) label = "";
- eina_stringshare_replace(&wd->label, label);
- edje_object_part_text_set(wd->noc, "elm.text", label);
- _sizing_eval(obj);
-}
-
-/**
- * Get the label used on the nocontents object
- *
- * @param obj The nocontentsl object
- * @return The string inside the label
- * @ingroup NoContents
- */
-EAPI const char *
-elm_nocontents_label_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->label;
-}
-
-/**
- * Set the custom object used on the nocontents object
- *
- * @param obj The nocontentsl object
- * @param custom The custom object will be used on the nocontents object
- * @ingroup NoContents
- */
-EAPI void
-elm_nocontents_custom_set(const Evas_Object *obj, Evas_Object *custom)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
- if (!custom) return;
- elm_widget_sub_object_add((Evas_Object *)obj, custom);
- edje_object_part_swallow(wd->noc, "custom", custom);
- wd->custom = custom;
-}
-
-/**
- * Get the custom object used on the nocontents object
- *
- * @param obj The nocontentsl object
- * @return The custom object inside the nocontents
- * @ingroup NoContents
- */
-EAPI Evas_Object *
-elm_nocontents_custom_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->custom;
-}
+++ /dev/null
- /* NoContents */
- EAPI Evas_Object *elm_nocontents_add(Evas_Object *parent);
- EAPI void elm_nocontents_label_set(Evas_Object *obj, const char *label);
- EAPI const char *elm_nocontents_label_get(const Evas_Object *obj);
- EAPI void elm_nocontents_custom_set(const Evas_Object *obj, Evas_Object *custom);
- EAPI Evas_Object *elm_nocontents_custom_get(const Evas_Object *obj);
-
+++ /dev/null
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-#include <Elementary.h>
-#include "elm_priv.h"
-
-/**
- * @defgroup PageControl PageControl
- * @ingroup Elementary
- *
- * A page control is a succession of dots centered in the control.
- * Each dot corresponds to a page in the application's document (or other data-model entity),
- * with the white dot indicating the currently viewed page.
- */
-
-typedef struct _Widget_Data Widget_Data;
-typedef struct _Page_Item Page_Item;
-
-struct _Widget_Data
-{
- Evas_Object *base;
- Evas_Object *hbox;
- unsigned int page_count;
- Eina_List *page_list;
- unsigned int cur_page_id;
- Evas_Object *parent;
- double scale_factor;
-};
-
-struct _Page_Item
-{
- Evas_Object *obj;
- Evas_Object *base;
- unsigned int page_id;
-};
-
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- _elm_theme_object_set(obj, wd->base, "pagecontrol", "base", elm_widget_style_get(obj));
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1;
-
- if (!wd) return;
-
- elm_coords_finger_size_adjust(1, &minw, 1, &minh);
- edje_object_size_min_restricted_calc(wd->base, &minw, &minh, minw, minh);
- elm_coords_finger_size_adjust(1, &minw, 1, &minh);
- evas_object_size_hint_min_set(obj, -1, -1);
- evas_object_size_hint_max_set(obj, -1, -1);
-}
-
-static void
-_item_free(Evas_Object *obj, Page_Item *it)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (!it) return;
-
- if (wd->page_list)
- wd->page_list = eina_list_remove(wd->page_list, it);
-
- if (it->base) evas_object_del(it->base);
-
- free(it);
-}
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Page_Item *it;
- Eina_List *l, *clear = NULL;
- if (!wd) return;
-
- EINA_LIST_FOREACH(wd->page_list, l, it) clear = eina_list_append(clear, it);
- EINA_LIST_FREE(clear, it) _item_free(obj, it);
- free(wd);
-}
-
-static Page_Item *
-_page_find(Evas_Object *obj, unsigned int index)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
-
- Page_Item *it;
- Eina_List *l;
-
- unsigned int i = 0;
- EINA_LIST_FOREACH(wd->page_list, l, it)
- {
- if (i == index) return it;
- i++;
- }
-
- return NULL;
-}
-
-static void
-_indicator_clicked_cb(void *data, Evas_Object *obj,
- const char *emission __UNUSED__,
- const char *source __UNUSED__)
-{
- Evas_Object *wd_obj = (Evas_Object *)data;
- Widget_Data *wd = elm_widget_data_get(wd_obj);
- if (!wd) return;
-
- Page_Item *it;
- Eina_List *l;
-
- unsigned int page_id = 0;
- EINA_LIST_FOREACH(wd->page_list, l, it)
- {
- if (it->base == obj)
- page_id = it->page_id;
- }
-
- if (page_id == wd->cur_page_id) return;
-
- it = _page_find(wd_obj, wd->cur_page_id);
- if (!it) return;
-
- edje_object_signal_emit(it->base, "elm,state,indicator,off", "elm");
-
- it = _page_find(wd_obj, page_id);
- if (!it) return;
-
- edje_object_signal_emit(it->base, "elm,state,indicator,on", "elm");
- wd->cur_page_id = page_id;
- evas_object_smart_callback_call(it->obj, "changed", NULL);
-}
-
-static Page_Item *
-_create_item(Evas_Object *obj, unsigned int page_id)
-{
- Page_Item *it;
- Evas_Coord mw, mh;
- it = calloc(1, sizeof(Page_Item));
- if (!it) return NULL;
-
- it->obj = obj;
- it->page_id = page_id;
-
- it->base = edje_object_add(evas_object_evas_get(obj));
-
- char pi_name[128];
- sprintf(pi_name, "default_%d", page_id+1);
- _elm_theme_object_set(obj, it->base, "page", "item", pi_name);
- edje_object_size_min_restricted_calc(it->base, &mw, &mh, 0, 0);
- evas_object_size_hint_weight_set(it->base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(it->base, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- evas_object_resize(it->base, mw, mh);
- evas_object_size_hint_min_set(it->base, mw, mh);
- evas_object_size_hint_max_set(it->base, mw, mh);
-
- edje_object_signal_callback_add(it->base, "clicked", "indicator_clicked", _indicator_clicked_cb, obj);
-
- return it;
-}
-
-static void
-_layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data)
-{
- Widget_Data *wd = data;
-
- if (!wd) return;
-
- _els_box_layout(o, priv, 1, 0, elm_widget_mirrored_get(o)); /* making box layout non homogenous */
-
- return;
-}
-
-/**
- * Add a new pagecontrol to the parent
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- *
- * @ingroup PageControl
- */
-EAPI Evas_Object *
-elm_page_control_add(Evas_Object *parent)
-{
- if (!parent) return NULL;
-
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- obj = elm_widget_add(e);
- elm_widget_type_set(obj, "pagecontrol");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
-
- wd->base = edje_object_add(e);
- _elm_theme_object_set(obj, wd->base, "pagecontrol", "base", "default");
- elm_widget_resize_object_set(obj, wd->base);
-
- wd->scale_factor = elm_scale_get();
- if ( wd->scale_factor == 0.0 )
- wd->scale_factor = 1.0;
-
- wd->hbox = evas_object_box_add(e);
- evas_object_size_hint_weight_set(wd->hbox, 0, 0);
-
- evas_object_box_layout_set(wd->hbox, _layout, wd, NULL);
- elm_widget_sub_object_add(obj, wd->hbox);
-
- edje_object_part_swallow(wd->base, "elm.swallow.page", wd->hbox);
-
- evas_object_show(wd->hbox);
-
- wd->parent = parent;
- wd->page_count = 0;
- wd->cur_page_id = 0;
-
- _sizing_eval(obj);
-
- return obj;
-}
-
-/**
- * The number of pages for the pagecontrol to show as dots.
- * @param obj The pagecontrol object
- * @param page_count Number of pages
- *
- * @ingroup PageControl
- */
-EAPI void
-elm_page_control_page_count_set(Evas_Object *obj, unsigned int page_count)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (!page_count) return;
-
- Page_Item *it;
- Evas_Coord mw, mh;
-
- unsigned int i;
- for (i = 0; i < page_count; i++)
- {
- it = _create_item(obj, i);
- wd->page_list = eina_list_append(wd->page_list, it);
- if (i == 0)
- {
- edje_object_signal_emit(it->base, "elm,state,indicator,on", "elm");
- evas_object_geometry_get(it->base, NULL, NULL, &mw, &mh);
- }
-
- evas_object_show(it->base);
-
- evas_object_box_append(wd->hbox, it->base);
- evas_object_smart_calculate(wd->hbox);
- }
-
- int width = mw*page_count;
- evas_object_resize(wd->hbox, width, mh);
- evas_object_size_hint_min_set(wd->hbox, width, mh);
- evas_object_size_hint_max_set(wd->hbox, width, mh);
- evas_object_smart_calculate(wd->hbox);
- wd->page_count = page_count;
-}
-
-/**
- * Set current/displayed page to given page number or id.
- * @param obj The pagecontrol object
- * @param page_id Page number or Page Id
- *
- * @ingroup PageControl
- */
-EAPI void
-elm_page_control_page_id_set(Evas_Object *obj, unsigned int page_id)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if(page_id >= wd->page_count || page_id == wd->cur_page_id) return;
-
- Page_Item *it;
- it = _page_find(obj, wd->cur_page_id);
- if (!it) return;
-
- edje_object_signal_emit(it->base, "elm,state,indicator,off", "elm");
- it = _page_find(obj, page_id);
- if (!it) return;
-
- edje_object_signal_emit(it->base, "elm,state,indicator,on", "elm");
- wd->cur_page_id=page_id;
-}
-
-/**
- * Get current/displayed page number or id.
- * @param obj The pagecontrol object
- * @return The current/displayed page id/number.
- *
- * @ingroup PageControl
- */
-EAPI unsigned int
-elm_page_control_page_id_get(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return -1;
-
- return wd->cur_page_id;
-}
-
+++ /dev/null
- EAPI Evas_Object *elm_page_control_add(Evas_Object *parent);
- EAPI void elm_page_control_page_count_set(Evas_Object *obj, unsigned int page_count);
- EAPI void elm_page_control_page_id_set(Evas_Object *obj, unsigned int page_id);
- EAPI unsigned int elm_page_control_page_id_get(Evas_Object *obj);
-
+++ /dev/null
-#include <Elementary.h>
-#include "elm_priv.h"
-
-<<<<<<< HEAD
-typedef struct _Widget_Data Widget_Data;
-typedef struct _Item Item;
-
-struct _Widget_Data
-{
- Eina_List *stack;
- Item *top, *oldtop;
- Evas_Object *rect, *clip;
-};
-
-struct _Item
-{
- Evas_Object *obj, *base, *content;
- Evas_Coord minw, minh;
- Eina_Bool popme : 1;
-};
-
-static const char *widtype = NULL;
-static void _del_hook(Evas_Object *obj);
-static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
-static void _theme_hook(Evas_Object *obj);
-static void _sizing_eval(Evas_Object *obj);
-static void _changed_size_hints(void *data,
- Evas *e,
- Evas_Object *obj,
- void *event_info);
-static void _content_del(void *data,
- Evas *e,
- Evas_Object *obj,
- void *event_info);
-static Eina_List *_item_get(Evas_Object *obj, Evas_Object *content);
-
-static const char SIG_HIDE_FINISHED[] = "hide,finished";
-static const char SIG_SHOW_FINISHED[] = "show,finished";
-
-static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_HIDE_FINISHED, ""},
- {SIG_SHOW_FINISHED, ""},
- {NULL, NULL}
-};
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- free(wd);
-}
-
-static void
-_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- Item *it;
- if (!wd) return;
- EINA_LIST_FOREACH(wd->stack, l, it)
- edje_object_mirrored_set(it->base, rtl);
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- Item *it;
- if (!wd) return;
- _elm_widget_mirrored_reload(obj);
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
- EINA_LIST_FOREACH(wd->stack, l, it)
- {
- _elm_theme_object_set(obj, it->base, "pager", "base",
- elm_widget_style_get(obj));
- edje_object_scale_set(it->base, elm_widget_scale_get(obj) *
- _elm_config->scale);
- }
- _sizing_eval(obj);
-}
-
-static Eina_List *
-_item_get(Evas_Object *obj, Evas_Object *content)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Item *it;
- Eina_List *l;
- if (!wd) return NULL;
-
- EINA_LIST_FOREACH(wd->stack, l, it)
- {
- if (it->content == content)
- return l;
- }
-
- return NULL;
-}
-
-static Eina_Bool
-_elm_pager_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Object *cur;
-
- if ((!wd) || (!wd->top))
- return EINA_FALSE;
-
- cur = wd->top->content;
-
- /* Try Focus cycle in subitem */
- return elm_widget_focus_next_get(cur, dir, next);
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1;
- Eina_List *l;
- Item *it;
- if (!wd) return;
- EINA_LIST_FOREACH(wd->stack, l, it)
- {
- if (it->minw > minw) minw = it->minw;
- if (it->minh > minh) minh = it->minh;
- }
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, -1, -1);
-}
-
-static void
-_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Item *it = data;
- Evas_Coord minw = -1, minh = -1;
- evas_object_size_hint_min_get(it->content, &minw, &minh);
- // FIXME: why is this needed? how does edje get this unswallowed or
- // lose its callbacks to edje
- edje_object_part_swallow(it->base, "elm.swallow.content", it->content);
- edje_object_size_min_calc(it->base, &it->minw, &it->minh);
- _sizing_eval(it->obj);
-}
-
-static void
-_eval_top(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Item *ittop;
- if (!wd) return;
- if (!wd->stack) return;
- ittop = eina_list_last(wd->stack)->data;
- if (ittop != wd->top)
- {
- Evas_Object *o;
- const char *onshow, *onhide;
-
- if (wd->top)
- {
- o = wd->top->base;
- if (wd->top->popme)
- {
- edje_object_signal_emit(o, "elm,action,pop", "elm");
- wd->stack = eina_list_remove(wd->stack, wd->top);
- }
- else
- edje_object_signal_emit(o, "elm,action,hide", "elm");
- onhide = edje_object_data_get(o, "onhide");
- if (onhide)
- {
- if (!strcmp(onhide, "raise")) evas_object_raise(o);
- else if (!strcmp(onhide, "lower")) evas_object_lower(o);
- }
- }
- wd->oldtop = wd->top;
- wd->top = ittop;
- o = wd->top->base;
- evas_object_show(o);
- if (wd->oldtop)
- {
- if (elm_object_focus_get(wd->oldtop->content))
- elm_widget_focused_object_clear(wd->oldtop->content);
- if (wd->oldtop->popme)
- edje_object_signal_emit(o, "elm,action,show", "elm");
- else
- edje_object_signal_emit(o, "elm,action,push", "elm");
- }
- else
- edje_object_signal_emit(o, "elm,action,push", "elm");
- onshow = edje_object_data_get(o, "onshow");
- if (onshow)
- {
- if (!strcmp(onshow, "raise")) evas_object_raise(o);
- else if (!strcmp(onshow, "lower")) evas_object_lower(o);
- }
- }
-}
-
-static void
-_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Evas_Coord x, y;
- Eina_List *l;
- Item *it;
- if (!wd) return;
- evas_object_geometry_get(obj, &x, &y, NULL, NULL);
- EINA_LIST_FOREACH(wd->stack, l, it)
- evas_object_move(it->base, x, y);
-}
-
-static void
-_content_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Eina_List *l;
- Item *it;
- if (!wd) return;
- l = _item_get(data, obj);
- if (!l) return;
- it = l->data;
- wd->stack = eina_list_remove_list(wd->stack, l);
- evas_object_event_callback_del_full
- (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, it);
- evas_object_del(it->base);
- _eval_top(data);
- free(it);
-}
-
-static void
-_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Evas_Coord w, h;
- Eina_List *l;
- Item *it;
- if (!wd) return;
- evas_object_geometry_get(obj, NULL, NULL, &w, &h);
- EINA_LIST_FOREACH(wd->stack, l, it) evas_object_resize(it->base, w, h);
-}
-
-static void
-_show_finished_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
-{
- Item *it = data;
- Evas_Object *obj = it->obj;
- Evas_Object *content = it->content;
-
- evas_object_smart_callback_call(obj, SIG_SHOW_FINISHED, content);
-}
-
-static void
-_hide_finished_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
-{
- Item *it = data;
- Evas_Object *obj2 = it->obj;
- Evas_Object *content = it->content;
-
- if (it->popme)
- {
- evas_object_del(it->base);
- evas_object_event_callback_del_full(content,
- EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints,
- it);
- evas_object_event_callback_del(content,
- EVAS_CALLBACK_DEL,
- _content_del);
- evas_object_del(content);
- free(it);
- }
- else
- {
- evas_object_hide(it->base);
- edje_object_signal_emit(it->base, "elm,action,reset", "elm");
- edje_object_message_signal_process(it->base);
- evas_object_hide(content);
- }
- evas_object_smart_callback_call(obj2, SIG_HIDE_FINISHED, content);
- _sizing_eval(obj2);
-}
-
-EAPI Evas_Object *
-elm_pager_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
- ELM_SET_WIDTYPE(widtype, "pager");
- elm_widget_type_set(obj, "pager");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_focus_next_hook_set(obj, _elm_pager_focus_next_hook);
- elm_widget_can_focus_set(obj, EINA_FALSE);
-
- wd->clip = evas_object_rectangle_add(e);
- elm_widget_resize_object_set(obj, wd->clip);
- elm_widget_sub_object_add(obj, wd->clip);
-
- wd->rect = evas_object_rectangle_add(e);
- elm_widget_sub_object_add(obj, wd->rect);
- evas_object_color_set(wd->rect, 255, 255, 255, 0);
- evas_object_clip_set(wd->rect, wd->clip);
-
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, obj);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
-
- evas_object_smart_callbacks_descriptions_set(obj, _signals);
-
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
- _sizing_eval(obj);
- return obj;
-}
-
-EAPI void
-elm_pager_content_push(Evas_Object *obj, Evas_Object *content)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord x, y, w, h;
- Item *it;
-
- if ((!wd) || (!content)) return;
- if (_item_get(obj, content)) return;
-
- it = ELM_NEW(Item);
- if (!it) return;
- it->obj = obj;
- it->content = content;
- it->base = edje_object_add(evas_object_evas_get(obj));
- evas_object_smart_member_add(it->base, obj);
- evas_object_geometry_get(obj, &x, &y, &w, &h);
- evas_object_move(it->base, x, y);
- evas_object_resize(it->base, w, h);
- evas_object_clip_set(it->base, wd->clip);
- elm_widget_sub_object_add(obj, it->base);
- elm_widget_sub_object_add(obj, it->content);
- _elm_theme_object_set(obj,
- it->base,
- "pager",
- "base",
- elm_widget_style_get(obj));
- edje_object_signal_callback_add
- (it->base, "elm,action,show,finished", "", _show_finished_cb, it);
- edje_object_signal_callback_add(it->base,
- "elm,action,hide,finished",
- "",
- _hide_finished_cb,
- it);
- evas_object_event_callback_add(it->content,
- EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints,
- it);
- evas_object_event_callback_add(it->content,
- EVAS_CALLBACK_DEL,
- _content_del,
- obj);
- edje_object_part_swallow(it->base, "elm.swallow.content", it->content);
- edje_object_size_min_calc(it->base, &it->minw, &it->minh);
- evas_object_data_set(it->base, "_elm_leaveme", obj);
- evas_object_show(it->content);
- wd->stack = eina_list_append(wd->stack, it);
- _eval_top(obj);
- _sizing_eval(obj);
-}
-
-EAPI void
-elm_pager_content_pop(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *ll;
- Item *it;
- if (!wd) return;
- if (!wd->stack) return;
- it = eina_list_last(wd->stack)->data;
- it->popme = EINA_TRUE;
- ll = eina_list_last(wd->stack);
- if (ll)
- {
- ll = ll->prev;
- if (!ll)
- {
- Evas_Object *o;
- const char *onhide;
-
- wd->top = it;
- o = wd->top->base;
- edje_object_signal_emit(o, "elm,action,pop", "elm");
- wd->stack = eina_list_remove(wd->stack, it);
- onhide = edje_object_data_get(o, "onhide");
- if (onhide)
- {
- if (!strcmp(onhide, "raise")) evas_object_raise(o);
- else if (!strcmp(onhide, "lower")) evas_object_lower(o);
- }
- wd->top = NULL;
- }
- else
- {
- it = ll->data;
- elm_pager_content_promote(obj, it->content);
- }
- }
-}
-
-EAPI void
-elm_pager_content_promote(Evas_Object *obj, Evas_Object *content)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- if (!wd) return;
- l = _item_get(obj, content);
- if (!l) return;
-
- wd->stack = eina_list_demote_list(wd->stack, l);
- _eval_top(obj);
-}
-
-EAPI Evas_Object *
-elm_pager_content_bottom_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- Item *it;
- if (!wd) return NULL;
- if (!wd->stack) return NULL;
- it = wd->stack->data;
- return it->content;
-}
-
-EAPI Evas_Object *
-elm_pager_content_top_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- if (!wd->top) return NULL;
- return wd->top->content;
-=======
-/* FIXME:
- * 1. Possibly remove those callbacks and just use the naviframe ones.
- * 2. I can create a different object, but it can wait until inheritance
- * is implemented, too annoying atm. */
-static void
-_push_finished(void *data __UNUSED__, Evas_Object *obj, void *event_info)
-{
- evas_object_smart_callback_call(obj, "show,finished", event_info);
-}
-
-static void
-_pop_finished(void *data __UNUSED__, Evas_Object *obj, void *event_info)
-{
- evas_object_smart_callback_call(obj, "hide,finished", event_info);
-}
-
-EINA_DEPRECATED EAPI Evas_Object *
-elm_pager_add(Evas_Object *parent)
-{
- Evas_Object *nf = elm_naviframe_add(parent);
- evas_object_smart_callback_add(nf, "push,finished", _push_finished, NULL);
- evas_object_smart_callback_add(nf, "pop,finished", _pop_finished, NULL);
- return nf;
-}
-
-EINA_DEPRECATED EAPI void
-elm_pager_content_push(Evas_Object *obj, Evas_Object *content)
-{
- Elm_Object_Item *it;
- it = elm_naviframe_item_push(obj, NULL, NULL, NULL, content, NULL);
- elm_naviframe_item_title_visible_set(it, EINA_FALSE);
-}
-
-EINA_DEPRECATED EAPI void
-elm_pager_content_pop(Evas_Object *obj)
-{
- elm_naviframe_item_pop(obj);
-}
-
-EINA_DEPRECATED EAPI void
-elm_pager_content_promote(Evas_Object *obj, Evas_Object *content)
-{
- Eina_List *items = elm_naviframe_items_get(obj);
- Eina_List *itr;
- Elm_Object_Item *it;
- EINA_LIST_FOREACH(items, itr, it)
- {
- if (elm_object_item_content_get(it) == content)
- {
- elm_naviframe_item_promote(it);
- break;
- }
- }
- eina_list_free(items);
-}
-
-EINA_DEPRECATED EAPI Evas_Object *
-elm_pager_content_bottom_get(const Evas_Object *obj)
-{
- Elm_Object_Item *it;
- it = elm_naviframe_bottom_item_get(obj);
- return elm_object_item_content_get(it);
-}
-
-EINA_DEPRECATED EAPI Evas_Object *
-elm_pager_content_top_get(const Evas_Object *obj)
-{
- Elm_Object_Item *it;
- it = elm_naviframe_top_item_get(obj);
- return elm_object_item_content_get(it);
-}
-
-EINA_DEPRECATED EAPI void
-elm_pager_item_style_default_set(Evas_Object *obj, const char *style)
-{
- elm_object_style_set(obj, style);
-}
-
-EINA_DEPRECATED EAPI const char *
-elm_pager_item_style_default_get(const Evas_Object *obj)
-{
- return elm_object_style_get(obj);
->>>>>>> remotes/origin/upstream
-}
+++ /dev/null
-/**
- * @defgroup Pager Pager
- *
- * @image html img/widget/pager/preview-00.png
- * @image latex img/widget/pager/preview-00.eps
- *
- * @brief Widget that allows flipping between one or more “pages”
- * of objects.
- *
- * The flipping between pages of objects is animated. All content
- * in the pager is kept in a stack, being the last content added
- * (visible one) on the top of that stack.
- *
- * Objects can be pushed or popped from the stack or deleted as
- * well. Pushes and pops will animate the widget accordingly to its
- * style (a pop will also delete the child object once the
- * animation is finished). Any object already in the pager can be
- * promoted to the top (from its current stacking position) through
- * the use of elm_pager_content_promote(). New objects are pushed
- * to the top with elm_pager_content_push(). When the top item is
- * no longer wanted, simply pop it with elm_pager_content_pop() and
- * it will also be deleted. If an object is no longer needed and is
- * not the top item, just delete it as normal. You can query which
- * objects are the top and bottom with
- * elm_pager_content_bottom_get() and elm_pager_content_top_get().
- *
- * Signals that you can add callbacks for are:
- * - @c "show,finished" - when a new page is actually shown on the top
- * - @c "hide,finished" - when a previous page is hidden
- *
- * Only after the first of that signals the child object is
- * guaranteed to be visible, as in @c evas_object_visible_get().
- *
- * This widget has the following styles available:
- * - @c "default"
- * - @c "fade"
- * - @c "fade_translucide"
- * - @c "fade_invisible"
- *
- * @note These styles affect only the flipping animations on the
- * default theme; the appearance when not animating is unaffected
- * by them.
- *
- * @ref tutorial_pager gives a good overview of the usage of the API.
- * @{
- */
-
-/**
- * Add a new pager to the parent
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- *
- * @ingroup Pager
- */
-EAPI Evas_Object *elm_pager_add(Evas_Object *parent);
-
-/**
- * @brief Push an object to the top of the pager stack (and show it).
- *
- * @param obj The pager object
- * @param content The object to push
- *
- * The object pushed becomes a child of the pager, it will be controlled and
- * deleted when the pager is deleted.
- *
- * @note If the content is already in the stack use
- * elm_pager_content_promote().
- * @warning Using this function on @p content already in the stack results in
- * undefined behavior.
- */
-EAPI void elm_pager_content_push(Evas_Object *obj, Evas_Object *content);
-
-/**
- * @brief Pop the object that is on top of the stack
- *
- * @param obj The pager object
- *
- * This pops the object that is on the top(visible) of the pager, makes it
- * disappear, then deletes the object. The object that was underneath it on
- * the stack will become visible.
- */
-EAPI void elm_pager_content_pop(Evas_Object *obj);
-
-/**
- * @brief Moves an object already in the pager stack to the top of the stack.
- *
- * @param obj The pager object
- * @param content The object to promote
- *
- * This will take the @p content and move it to the top of the stack as
- * if it had been pushed there.
- *
- * @note If the content isn't already in the stack use
- * elm_pager_content_push().
- * @warning Using this function on @p content not already in the stack
- * results in undefined behavior.
- */
-EAPI void elm_pager_content_promote(Evas_Object *obj, Evas_Object *content);
-
-/**
- * @brief Return the object at the bottom of the pager stack
- *
- * @param obj The pager object
- * @return The bottom object or NULL if none
- */
-EAPI Evas_Object *elm_pager_content_bottom_get(const Evas_Object *obj);
-
-/**
- * @brief Return the object at the top of the pager stack
- *
- * @param obj The pager object
- * @return The top object or NULL if none
- */
-EAPI Evas_Object *elm_pager_content_top_get(const Evas_Object *obj);
-
-/**
- * @}
- */
+++ /dev/null
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-#include <Elementary.h>
-#include "elm_priv.h"
-
-typedef struct _Widget_Data Widget_Data;
-
-struct _Widget_Data
-{
- Evas_Object *base, *ef, *cancel_btn;
- Eina_Bool cancel_btn_ani_flag;
- Eina_Bool cancel_btn_show_mode;
- Eina_Bool boundary_mode;
- Ecore_Idler *idler;
-};
-
-static const char *widtype = NULL;
-static void _del_hook(Evas_Object *obj);
-static void _theme_hook(Evas_Object *obj);
-static void _on_focus_hook(void *data, Evas_Object *obj);
-static void _sizing_eval(Evas_Object *obj);
-static void _clicked(void *data, Evas_Object *obj,
- const char *emission, const char *source);
-static void _changed(void *data, Evas_Object *obj, void *event_info);
-static void _cancel_clicked(void *data, Evas_Object *obj, void *event_info);
-
-static void _del_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
- if (wd->idler) ecore_idler_del(wd->idler);
-
- free(wd);
-}
-
-static void _theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- char buf[4096];
-
- if (!wd) return;
-
- _elm_theme_object_set(obj, wd->base, "searchbar", "base", elm_widget_style_get(obj));
-
- if (wd->ef)
- edje_object_part_swallow(wd->base, "search_textfield", wd->ef);
- if (wd->cancel_btn)
- edje_object_part_swallow(wd->base, "button_cancel", wd->cancel_btn);
-
- snprintf(buf, sizeof(buf), "searchbar/%s", elm_widget_style_get(obj));
- elm_object_style_set(wd->ef, buf);
-
- snprintf(buf, sizeof(buf), "searchbar/%s", elm_widget_style_get(obj));
- elm_object_style_set(wd->cancel_btn, buf);
-
- edje_object_scale_set(wd->cancel_btn, elm_widget_scale_get(obj) * _elm_config->scale);
- _sizing_eval(obj);
-}
-
-static void
-_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd || !wd->base)
- return;
- if (elm_widget_focus_get(obj))
- {
- elm_object_focus(wd->ef);
- if (wd->cancel_btn_show_mode)
- {
- if (wd->cancel_btn_ani_flag) edje_object_signal_emit(wd->base, "CANCELIN", "PROG");
- else edje_object_signal_emit(wd->base, "CANCELSHOW", "PROG");
- }
- }
- else
- {
- if (wd->cancel_btn_ani_flag) edje_object_signal_emit(wd->base, "CANCELOUT", "PROG");
- else edje_object_signal_emit(wd->base, "CANCELHIDE", "PROG");
- }
-}
-
-static void _sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
-
- if (!wd) return;
- elm_coords_finger_size_adjust(1, &minw, 1, &minh);
- edje_object_size_min_restricted_calc(wd->base, &minw, &minh, minw, minh);
- elm_coords_finger_size_adjust(1, &minw, 1, &minh);
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, maxw, maxh);
-}
-
-static void _clicked(void *data, Evas_Object *obj __UNUSED__,
- const char *emission __UNUSED__, const char *source __UNUSED__)
-{
- evas_object_smart_callback_call(data, "clicked", NULL);
-}
-
-static Eina_Bool _delay_changed(void *data)
-{
- Widget_Data *wd = elm_widget_data_get(data);
-
- if (!wd) return ECORE_CALLBACK_CANCEL;
-
- evas_object_smart_callback_call(data, "delay-changed", NULL);
- wd->idler = NULL;
- return ECORE_CALLBACK_CANCEL;
-}
-
-static void _changed(void *data, Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
-
- if (!wd) return;
- if (!wd->idler)
- wd->idler = ecore_idler_add(_delay_changed, data);
-}
-
-static void _cancel_clicked(void *data, Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
-
- const char* text;
- text = elm_entry_entry_get(elm_editfield_entry_get(wd->ef));
- if (text != NULL && strlen(text) > 0)
- elm_entry_entry_set(elm_editfield_entry_get(wd->ef), NULL);
- elm_object_unfocus(data);
- evas_object_smart_callback_call(data, "cancel,clicked", NULL);
-}
-
-static void
-_searchsymbol_clicked(void *data, Evas_Object *obj __UNUSED__,
- const char *emission __UNUSED__,
- const char *source __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
-
- if (!wd) return;
- evas_object_smart_callback_call(data, "searchsymbol,clicked", NULL);
-}
-
-static void
-_elm_searchbar_text_set(Evas_Object *obj, const char *item, const char *text)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (item && strcmp(item, "default")) return;
- if (!wd) return;
- elm_entry_entry_set(elm_editfield_entry_get(wd->ef), text);
-}
-
-static const char *
-_elm_searchbar_text_get(const Evas_Object *obj, const char *item)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (item && strcmp(item, "default")) return NULL;
- if (!wd) return NULL;
- return elm_entry_entry_get(elm_editfield_entry_get(wd->ef));
-}
-
-
-EINA_DEPRECATED Evas_Object *elm_searchbar_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
- char buf[4096];
-
- ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
- ELM_SET_WIDTYPE(widtype, "searchbar");
- elm_widget_type_set(obj, "searchbar");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_on_focus_hook_set( obj, _on_focus_hook, NULL);
- elm_widget_can_focus_set(obj, EINA_TRUE);
- elm_widget_text_set_hook_set(obj, _elm_searchbar_text_set);
- elm_widget_text_get_hook_set(obj, _elm_searchbar_text_get);
-
- wd->base = edje_object_add(e);
- _elm_theme_object_set(obj, wd->base, "searchbar", "base", "default");
- elm_widget_resize_object_set(obj, wd->base);
-
- // Add Entry
- wd->ef = elm_editfield_add(obj);
- elm_object_style_set(wd->ef, "searchbar/default");
-
- edje_object_part_swallow(wd->base, "search_textfield", wd->ef);
- elm_editfield_guide_text_set(wd->ef, E_("Search"));
- elm_editfield_entry_single_line_set(wd->ef, EINA_TRUE);
- elm_editfield_eraser_set(wd->ef, EINA_TRUE);
- evas_object_smart_callback_add(elm_editfield_entry_get(wd->ef), "changed", _changed, obj);
- edje_object_signal_callback_add(wd->base, "mouse,clicked,1", "*", _clicked, obj);
- edje_object_signal_callback_add(wd->base, "elm,action,click", "", _searchsymbol_clicked, obj);
-
- // Add Button
- wd->cancel_btn = elm_button_add(obj);
- edje_object_part_swallow(wd->base, "button_cancel", wd->cancel_btn);
- snprintf(buf, sizeof(buf), "searchbar/%s", elm_widget_style_get(obj));
- elm_object_style_set(wd->cancel_btn, buf);
- elm_object_text_set(wd->cancel_btn, E_("Cancel"));
- evas_object_smart_callback_add(wd->cancel_btn, "clicked", _cancel_clicked, obj);
-
- wd->cancel_btn_ani_flag = EINA_FALSE;
- wd->cancel_btn_show_mode = EINA_TRUE;
- wd->boundary_mode = EINA_TRUE;
-
- _sizing_eval(obj);
-
- return obj;
-}
-
-EINA_DEPRECATED void elm_searchbar_text_set(Evas_Object *obj, const char *entry)
-{
- _elm_searchbar_text_set(obj, NULL, entry);
-}
-
-EINA_DEPRECATED const char* elm_searchbar_text_get(Evas_Object *obj)
-{
- return _elm_searchbar_text_get(obj, NULL);
-}
-
-EINA_DEPRECATED Evas_Object *elm_searchbar_entry_get(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
-
- return elm_editfield_entry_get(wd->ef);
-}
-
-EINA_DEPRECATED Evas_Object *elm_searchbar_editfield_get(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd || !wd->ef) return NULL;
-
- return wd->ef;
-}
-
-EINA_DEPRECATED void elm_searchbar_cancel_button_animation_set(Evas_Object *obj, Eina_Bool cancel_btn_ani_flag)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (wd->cancel_btn_ani_flag == cancel_btn_ani_flag) return;
- else wd->cancel_btn_ani_flag = cancel_btn_ani_flag;
-}
-
-EINA_DEPRECATED void elm_searchbar_cancel_button_set(Evas_Object *obj, Eina_Bool visible)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (wd->cancel_btn_show_mode == visible) return;
- else wd->cancel_btn_show_mode = visible;
-
- if (!visible)
- {
- if (wd->cancel_btn_ani_flag)
- edje_object_signal_emit(wd->base, "CANCELOUT", "PROG");
- else
- edje_object_signal_emit(wd->base, "CANCELHIDE", "PROG");
- }
- _sizing_eval(obj);
-}
-
-EINA_DEPRECATED void elm_searchbar_clear(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (wd->cancel_btn_show_mode)
- {
- if (wd->cancel_btn_ani_flag)
- edje_object_signal_emit(wd->base, "CANCELOUT", "PROG");
- else
- edje_object_signal_emit(wd->base, "CANCELHIDE", "PROG");
- }
-// elm_entry_entry_set(elm_editfield_entry_get(wd->ef), NULL);
-}
-
-EINA_DEPRECATED void elm_searchbar_boundary_rect_set(Evas_Object *obj, Eina_Bool boundary)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (wd->boundary_mode == boundary) return;
- else wd->boundary_mode = boundary;
-
- if (wd->boundary_mode)
- {
- edje_object_signal_emit(wd->base, "BDSHOW", "PROG");
- }
- else
- {
- edje_object_signal_emit(wd->base, "BDHIDE", "PROG");
- }
- _sizing_eval(obj);
-}
+++ /dev/null
-#include <Elementary.h>
-#include "elm_priv.h"
-
-
-
-#define MAX_ITEM_NUM (9)
-#define MAX_MOVE_INTERVAL (0.2)
-#define ELM_MAX(v1, v2) (((v1) > (v2)) ? (v1) : (v2))
-#define ROT_RIGHT (5)
-#define ROT_LEFT (-5)
-#define MAX_SHOWN_ITEM (3)
-
-struct _Stackedicon_Item
-{
- Evas_Object *parent;
- Evas_Object *ly;
- Evas_Object *ic;
- Evas_Object *pad;
- const char *path;
- int index;
- Evas_Coord x, y, w, h;
- Evas_Coord mw, mh;
- Eina_Bool exist : 1;
-};
-
-typedef struct _Widget_Data Widget_Data;
-struct _Widget_Data
-{
- Evas_Object *base;
- int interval_x, interval_y;
- unsigned int time;
- Ecore_Animator *animator;
- Eina_List *list;
- Evas_Coord x, y, w, h;
- Eina_Bool visible: 1;
-
- /* fake img */
- Evas_Object *fake_img;
- int r, g, b, a;
- int mdx, mdy, mmx, mmy;
- Eina_Bool move_start: 1;
- Eina_Bool on_update;
-};
-
-static const char *widtype = NULL;
-static void _del_hook(Evas_Object *obj);
-static void _theme_hook(Evas_Object *obj);
-static void _sizing_eval(Evas_Object *obj);
-static void _del_image(void *data);
-static void _del_all_image(void *data);
-static unsigned int _current_time_get(void);
-static void _icon_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _icon_move_to_zero(Evas_Object *obj);
-static Eina_Bool _icon_move_to_zero_cb(void *data);
-static void _icon_move_map(void *data, int interval_x, int interval_y);
-static void _icon_map_pos(Evas_Object *obj, int index, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
-static void _calc_item_size(int w, int h, int iw, int ih, int *res_w, int *res_h);
-static void _add_image(Evas_Object *obj, void *data);
-static void _fake_img_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _fake_img_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _fake_img_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _add_image_to_buffer(Evas_Object *obj, Evas* e, void *data);
-static Evas_Object * _create_fake_image(Evas_Object *obj);
-static void _show_all_image(Evas_Object *obj);
-static void _hide_all_image(Evas_Object *obj);
-static void _hide_hidden_image(Evas_Object *obj);
-static void _update_stackedicon(Evas_Object *obj);
-static void _resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _show_cb(void *data, Evas * e, Evas_Object * obj, void *event_info);
-static void _hide_cb(void *data, Evas * e, Evas_Object * obj, void *event_info);
-static void _event_init(Evas_Object *obj);
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- Elm_Stackedicon_Item *it;
- if (!wd) return;
-
- if (wd->animator)
- {
- ecore_animator_del(wd->animator);
- wd->animator = NULL;
- }
-
- _del_all_image(wd);
-
- if (wd->list)
- {
- EINA_LIST_FOREACH(wd->list, l, it)
- if (it) free(it);
- eina_list_free(wd->list);
- wd->list = NULL;
- }
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- Elm_Stackedicon_Item *it;
- if (!wd) return;
-
- _elm_theme_object_set(obj, wd->base, "stackedicon", "base", elm_widget_style_get(obj));
- if (wd->fake_img) edje_object_part_swallow(wd->base, "elm.bg.swallow", wd->fake_img);
- edje_object_scale_set(wd->base, elm_widget_scale_get(obj) * _elm_config->scale);
-
- EINA_LIST_FOREACH(wd->list, l, it)
- {
- if (it->ly) _elm_theme_object_set(obj, it->ly, "stackedicon", "icon", elm_widget_style_get(obj));
- if (it->ic) edje_object_part_swallow(it->ly, "contents", it->ic);
- if (it->pad) edje_object_part_swallow(it->ly, "shadow", it->pad);
- edje_object_scale_set(it->ly, elm_widget_scale_get(obj) * _elm_config->scale);
- }
- _update_stackedicon(obj);
- _sizing_eval(obj);
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1;
- Evas_Coord w, h;
- if (!wd) return;
-
- edje_object_size_min_restricted_calc(wd->base, &minw, &minh, minw, minh);
- evas_object_size_hint_min_get(obj, &w, &h);
- if (w > minw) minw = w;
- if (h > minh) minh = h;
- evas_object_size_hint_min_set(obj, minw, minh);
-}
-
-static void
-_del_image(void *data)
-{
- Elm_Stackedicon_Item *it = (Elm_Stackedicon_Item *)data;
-
- if (it->ly)
- {
- evas_object_del(it->ly);
- evas_object_del(it->ic);
- evas_object_del(it->pad);
- it->ly = NULL;
- it->ic = NULL;
- it->pad = NULL;
- it->exist = EINA_FALSE;
- }
-}
-
-static void
-_del_all_image(void *data)
-{
- Widget_Data *wd = (Widget_Data *)data;
- Eina_List *l;
- Elm_Stackedicon_Item *it = NULL;
- if (!wd) return;
-
- EINA_LIST_FOREACH(wd->list, l, it)
- if (it && it->exist) _del_image(it);
-}
-
-static void
-_icon_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Elm_Stackedicon_Item *it = data;
- if (!it) return;
- Widget_Data *wd = elm_widget_data_get(it->parent);
- if (!wd) return;
-
- Evas_Coord x, y;
-
- if (it->exist && it->ly)
- {
- evas_object_geometry_get(obj, &x, &y, NULL, NULL);
- _icon_map_pos(it->ly, it->index, x, y, it->w, it->h);
- }
-}
-
-static void
-_fake_img_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Evas_Event_Mouse_Down *ev = event_info;
- Eina_List *l;
- Elm_Stackedicon_Item *it = NULL;
- if (!wd) return;
-
- wd->mdx = ev->output.x;
- wd->mdy = ev->output.y;
-
- it = NULL;
- EINA_LIST_REVERSE_FOREACH(wd->list, l, it)
- {
- if (it)
- {
- if (!it->exist) _add_image(data, it);
- evas_object_move(it->ly, wd->x + wd->w/2 - it->mw/2, wd->y + wd->h/2 - it->mh/2);
- if (wd->visible) evas_object_show(it->ly);
- }
- }
-
- EINA_LIST_REVERSE_FOREACH(wd->list, l, it)
- if (it && it->exist) evas_object_raise(it->ly);
-
- evas_object_color_set(wd->fake_img, 0, 0, 0, 0);
- wd->move_start = TRUE;
-}
-
-static void
-_fake_img_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Evas_Event_Mouse_Move *ev = event_info;
- if (!wd || !ev->buttons) return;
-
- if (wd->move_start == TRUE)
- {
- evas_object_smart_callback_call(data, "drag,start", NULL);
- _show_all_image(data);
- wd->move_start = FALSE;
- }
-
- wd->mmx = ev->cur.output.x;
- wd->mmy = ev->cur.output.y;
-
- wd->interval_x = wd->mmx - wd->mdx;
- wd->interval_y = wd->mmy - wd->mdy;
-
- _icon_move_map(wd, wd->x + wd->interval_x, wd->y + wd->interval_y);
-}
-
-static void
-_fake_img_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- double interval = 0.0;
- if (!wd) return;
-
- interval = sqrt(wd->interval_x*wd->interval_x + wd->interval_y*wd->interval_y);
-
- if (((double)(interval/wd->h) > MAX_MOVE_INTERVAL))
- {
- wd->interval_x = 0;
- wd->interval_y = 0;
-
- _icon_move_map(wd, wd->x, wd->y);
- _hide_hidden_image(data);
- evas_object_smart_callback_call(data, "expanded", NULL);
- evas_object_smart_callback_call(data, "drag,stop", NULL);
- }
- else
- {
- wd->mdx = 0;
- wd->mdy = 0;
- wd->mmx = 0;
- wd->mmx = 0;
-
- if (wd->animator)
- {
- ecore_animator_del(wd->animator);
- wd->animator = NULL;
- }
- wd->time = _current_time_get();
- wd->animator= ecore_animator_add(_icon_move_to_zero_cb, data);
- }
-}
-
-static unsigned int
-_current_time_get(void)
-{
- struct timeval timev;
- gettimeofday(&timev, NULL);
- return ((timev.tv_sec * 1000) + ((timev.tv_usec) / 1000));
-}
-
-static void
-_icon_move_to_zero(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- double t;
- int x, y;
- if (!wd) return;
-
- t = ELM_MAX(0.0, _current_time_get() - wd->time) / 100;
-
- if (t <= 1.0)
- {
- x = (1 * sin((t / 2.0) * (M_PI / 2)) * wd->interval_x);
- y = (1 * sin((t / 2.0) * (M_PI / 2)) * wd->interval_y);
- }
- else
- {
- x = wd->interval_x;
- y = wd->interval_y;
- }
-
- if ( y == wd->interval_y)
- {
- ecore_animator_del(wd->animator);
- wd->animator = NULL;
- wd->interval_x = 0;
- wd->interval_y = 0;
- _icon_move_map(wd, wd->x, wd->y);
- _hide_hidden_image(obj);
- evas_object_smart_callback_call(obj, "clicked", NULL);
- evas_object_smart_callback_call(obj, "drag,stop", NULL);
- }
- else
- {
- _icon_move_map(wd, wd->x + wd->interval_x - x, wd->y + wd->interval_y - y);
- }
-}
-
-static Eina_Bool
-_icon_move_to_zero_cb(void *data)
-{
- Evas_Object *obj = (Evas_Object *)data;
- _icon_move_to_zero(obj);
-
- return EXIT_FAILURE;
-}
-
-static void
-_icon_move_map(void *data, int interval_x, int interval_y)
-{
- Widget_Data *wd = (Widget_Data *)data;
- int i = 0;
- int num;
- int x = 0, y = 0;
- if (!wd) return;
- num = eina_list_count(wd->list);
-
- for (i =0; i < num; i++)
- {
- Elm_Stackedicon_Item *it = NULL;
- it = (Elm_Stackedicon_Item *)eina_list_nth(wd->list, i);
-
- if (it != NULL)
- {
- x = wd->x + wd->w/2 - it->mw/2 + ((interval_x - wd->x)/num)*(num -i);
- y = wd->y + wd->h/2 - it->mh/2 + ((interval_y - wd->y)/num)*(num -i);
- evas_object_move(it->ly, x, y);
- }
- }
-}
-
-static void
-_icon_map_pos(Evas_Object *obj, int index, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
-{
- Evas_Map *m;
- int degree = 0;
-
- if ((index % 3) == 1)
- degree = ROT_RIGHT;
- else if ((index % 3) == 2)
- degree = ROT_LEFT;
-
- m = evas_map_new(4);
- evas_map_util_points_populate_from_geometry(m, x, y, w, h, 0);
- evas_map_util_3d_rotate(m, 0, 0, degree, x + w/2, y + h/2, 0);
- evas_map_util_3d_perspective(m, x + w/2, y + h/2, 0, 10000);
- evas_map_smooth_set(m, 1);
- evas_map_alpha_set(m, 1);
- evas_object_map_set(obj, m);
- evas_object_map_enable_set(obj, 1);
- evas_map_free(m);
-}
-
-static void
-_calc_item_size(int w, int h, int iw, int ih, int *res_w, int *res_h)
-{
- if (iw>ih)
- {
- if (w*ih/iw > h)
- {
- *res_w = h*iw/ih;
- *res_h = h;
- }
- else
- {
- *res_w = w;
- *res_h = w*ih/iw;
- }
- }
- else
- {
- if (h*iw/ih > w)
- {
- *res_w = w;
- *res_h = w*h/(h*iw/ih);
- }
- else
- {
- *res_w = h*iw/ih;
- *res_h = h;
- }
- }
-}
-
-static void
-_add_image(Evas_Object *obj, void *data)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Elm_Stackedicon_Item *it = (Elm_Stackedicon_Item *)data;
- Evas_Object *ly = NULL;
- Evas_Object *ic = NULL;
- Evas_Object *pad = NULL;
- int iw, ih;
- if (!wd || !it) return;
-
- ly = edje_object_add(evas_object_evas_get(obj));
- if (!ly) return;
- _elm_theme_object_set(obj, ly, "stackedicon", "icon", elm_widget_style_get(obj));
- evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_widget_sub_object_add(obj, ly);
-
- ic = evas_object_image_add(evas_object_evas_get(obj));
- if (!ic) return;
- evas_object_image_load_size_set(ic, wd->w/2, wd->h/2);
- evas_object_image_file_set(ic, it->path, NULL);
- evas_object_image_size_get(ic, &iw, &ih);
- if (!iw || !ih) return;
-
- _calc_item_size(wd->w - 2, wd->h - 2, iw, ih, &it->w, &it->h);
-
- evas_object_image_fill_set(ic, 0, 0, it->w, it->h);
- evas_object_size_hint_min_set(ly, it->w, it->h);
- evas_object_resize(ly, it->w, it->h);
-
- evas_object_image_filled_set(ic, 1);
- edje_object_part_swallow(ly, "contents", ic);
-
- pad = evas_object_rectangle_add(evas_object_evas_get(obj));
- if (!pad) return;
- evas_object_size_hint_align_set(pad, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_color_set(pad, 0, 0, 0, it->index*25);
- edje_object_part_swallow(ly, "shadow", pad);
-
- evas_object_event_callback_add(ly, EVAS_CALLBACK_MOVE, _icon_move_cb, it);
-
- it->mw = it->w;
- it->mh = it->h;
- it->ly = ly;
- it->ic = ic;
- it->pad = pad;
- it->exist = EINA_TRUE;
-}
-
-static void
-_add_image_to_buffer(Evas_Object *obj, Evas* e, void *data)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Elm_Stackedicon_Item *it = (Elm_Stackedicon_Item *)data;
- Evas_Object *ly = NULL;
- Evas_Object *ic = NULL;
- int iw, ih, res_w, res_h;
- if (!wd || !it) return;
-
- // FIXME: add an opaque rectangle because of alpha bug of evas_map.
- Evas_Object* rect = evas_object_rectangle_add( e );
- if (!rect) return;
- evas_object_resize( rect, 1, 1);
- evas_object_move(rect, wd->w/2, wd->h/2);
- evas_object_color_set( rect, 0, 0, 0, 255 );
- evas_object_show( rect );
-
- ly = edje_object_add(e);
- if (!ly) return;
- _elm_theme_object_set(obj, ly, "stackedicon", "icon", elm_widget_style_get(obj));
- evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
- ic = evas_object_image_add(e);
- if (!ic) return;
- evas_object_image_alpha_set(ic, EINA_TRUE);
- evas_object_image_load_size_set(ic, wd->w/2, wd->h/2);
- evas_object_image_file_set(ic, it->path, NULL);
- evas_object_image_size_get(ic, &iw, &ih);
- if (!iw || !ih) return;
-
- _calc_item_size(wd->w - 2, wd->h - 2, iw, ih, &res_w, &res_h);
-
- evas_object_image_fill_set(ic, 0, 0, res_w, res_h);
- evas_object_image_filled_set(ic, 1);
- edje_object_part_swallow(ly, "contents", ic);
-
- evas_object_resize(ly, res_w, res_h);
- evas_object_move(ly, (wd->w - res_w)/2, (wd->h - res_h)/2);
- evas_object_show(ly);
-
- _icon_map_pos(ly, it->index, (wd->w - res_w)/2, (wd->h - res_h)/2, res_w, res_h);
-}
-
-static Evas_Object *
-_create_fake_image(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Object *eo = NULL;
- Eina_List *l = NULL;
- Elm_Stackedicon_Item *it = NULL;
- if (!wd) return NULL;
-
- // create fake_img
- eo = evas_object_image_add(evas_object_evas_get(obj));
- if (!eo) return NULL;
- elm_widget_sub_object_add(obj, eo);
- evas_object_image_alpha_set(eo,EINA_TRUE);
- evas_object_image_data_set(eo, NULL);
- evas_object_image_size_set(eo, wd->w, wd->h);
- evas_object_image_fill_set(eo, 0, 0, wd->w, wd->h);
- edje_object_part_swallow(wd->base, "elm.bg.swallow", eo);
-
- // create ecore_evas (buffer)
- Ecore_Evas* ee = ecore_evas_buffer_new( wd->w, wd->h );
- Evas* e = ecore_evas_get( ee );
-
- // add shown icons
- EINA_LIST_REVERSE_FOREACH(wd->list, l, it)
- {
- if (it)
- {
- if (it->index >= MAX_SHOWN_ITEM) continue;
- _add_image_to_buffer(obj, e, it);
- }
- }
- ecore_evas_show( ee );
-
-
- // copy buffer to data(mem)
- unsigned char* data = (unsigned char*) calloc( 1, sizeof( unsigned char ) * 4 * wd->w * wd->h );
- memcpy( data, (unsigned char*) ecore_evas_buffer_pixels_get( ee ), sizeof( unsigned char ) * 4 * wd->w * wd->h );
- ecore_evas_free( ee );
-
- // copy data to fake_img
- evas_object_image_data_copy_set(eo, data);
- evas_object_image_data_update_add(eo, 0, 0, wd->w, wd->h);
- evas_object_resize(eo, wd->w, wd->h);
-
- evas_object_color_get(eo, &wd->r, &wd->g, &wd->b, &wd->a);
-
- // add mouse events callback
- evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_DOWN, _fake_img_mouse_down_cb, obj);
- evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_MOVE, _fake_img_mouse_move_cb, obj);
- evas_object_event_callback_add(eo, EVAS_CALLBACK_MOUSE_UP, _fake_img_mouse_up_cb, obj);
-
- return eo;
-}
-
-static void
-_update_stackedicon(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd || ((wd->w == 1) && (wd->h == 1))) return;
-
- if (!wd->fake_img)
- {
- wd->fake_img = _create_fake_image(obj);
- }
- else if (wd->on_update)
- {
- wd->on_update = FALSE;
- elm_widget_sub_object_del(obj, wd->fake_img);
- edje_object_part_unswallow(wd->base, wd->fake_img);
- evas_object_del(wd->fake_img);
- wd->fake_img = NULL;
- wd->fake_img = _create_fake_image(obj);
- }
-}
-
-static void _show_all_image(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- int i = 0;
-
- for (i =0; i < eina_list_count (wd->list); i++)
- {
- Elm_Stackedicon_Item *it = NULL;
- it = (Elm_Stackedicon_Item *)eina_list_nth(wd->list, i);
-
- if (it != NULL)
- {
- if (it->exist == EINA_TRUE)
- {
- evas_object_show(it->ly);
- }
- }
- }
-}
-
-static void _hide_all_image(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- int i = 0;
-
- for (i =0; i < eina_list_count (wd->list); i++)
- {
- Elm_Stackedicon_Item *it = NULL;
- it = (Elm_Stackedicon_Item *)eina_list_nth(wd->list, i);
-
- if (it != NULL)
- {
- if (it->exist == EINA_TRUE)
- {
- evas_object_hide(it->ly);
- }
- }
- }
-}
-
-static void _hide_hidden_image(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- Elm_Stackedicon_Item *it = NULL;
- if (!wd) return;
-
- EINA_LIST_REVERSE_FOREACH(wd->list, l, it)
- {
- if (it->ly) evas_object_hide(it->ly);
- }
- evas_object_color_set(wd->fake_img, wd->r, wd->g, wd->b, wd->a);
-}
-
-static void
-_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Evas_Coord w, h;
- if (!wd) return;
-
- evas_object_geometry_get(obj, NULL, NULL, &w, &h);
- wd->w = w;
- wd->h = h;
-
- _update_stackedicon(data);
-}
-
-static void
-_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- Evas_Coord x, y;
- if (!wd) return;
-
- evas_object_geometry_get(obj, &x, &y, NULL, NULL);
- wd->x = x;
- wd->y = y;
-
- _update_stackedicon(data);
-}
-
-static void
-_show_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
-
- wd->visible = EINA_TRUE;
- _update_stackedicon(data);
-}
-
-static void
-_hide_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd) return;
-
- wd->visible = EINA_FALSE;
- _hide_all_image(data);
-}
-
-static void
-_event_init(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move_cb, obj);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _show_cb, obj);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide_cb, obj);
-}
-
-EAPI Evas_Object *
-elm_stackedicon_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- obj = elm_widget_add(e);
- ELM_SET_WIDTYPE(widtype, "stackedicon");
- elm_widget_type_set(obj, "stackedicon");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
-
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
-
- wd->base = edje_object_add(e);
- _elm_theme_object_set(obj, wd->base, "stackedicon", "base", "default");
- elm_widget_resize_object_set(obj, wd->base);
-
- wd->w = 1;
- wd->h = 1;
-
- _event_init(obj);
- _sizing_eval(obj);
-
- return obj;
-}
-
-EAPI Elm_Stackedicon_Item *elm_stackedicon_item_append(Evas_Object *obj, const char *path)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- Elm_Stackedicon_Item *it;
- if (!wd) return NULL;
- if (eina_list_count(wd->list) >= MAX_ITEM_NUM) return NULL;
-
- it = (Elm_Stackedicon_Item *)calloc(1, sizeof(Elm_Stackedicon_Item));
- it->path = eina_stringshare_add(path);
- it->parent = obj;
- it->ly = NULL;
- it->ic = NULL;
- it->pad = NULL;
- it->index = eina_list_count(wd->list);
- it->exist = EINA_FALSE;
- wd->list = eina_list_append(wd->list, it);
-
- if (it->index < MAX_SHOWN_ITEM)
- {
- wd->on_update = TRUE;
- _update_stackedicon(obj);
- }
-
- return it;
-}
-
-EAPI Elm_Stackedicon_Item *elm_stackedicon_item_prepend(Evas_Object *obj, const char *path)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- Elm_Stackedicon_Item *it;
- if (!wd) return NULL;
- if (eina_list_count(wd->list) >= MAX_ITEM_NUM) return NULL;
-
- it = (Elm_Stackedicon_Item *)calloc(1, sizeof(Elm_Stackedicon_Item));
- it->path = eina_stringshare_add(path);
- it->parent = obj;
- it->ly = NULL;
- it->ic = NULL;
- it->pad = NULL;
- it->index = eina_list_count(wd->list);
- it->exist = EINA_FALSE;
- wd->list = eina_list_prepend(wd->list, it);
-
- if (it->index < MAX_SHOWN_ITEM)
- {
- wd->on_update = TRUE;
- _update_stackedicon(obj);
- }
-
- return it;
-}
-
-EAPI void elm_stackedicon_item_del(Elm_Stackedicon_Item *it)
-{
- if (!it) return;
- ELM_CHECK_WIDTYPE(it->parent, widtype);
- Evas_Object *obj = it->parent;
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_List *l;
- Elm_Stackedicon_Item *_it = NULL;
- int i = 0;
- if (!wd) return;
-
- if (it->index < MAX_SHOWN_ITEM) wd->on_update = TRUE;
-
- if (it->exist == EINA_TRUE) _del_image(it);
- wd->list = eina_list_remove(wd->list, it);
- free(it);
-
- EINA_LIST_FOREACH(wd->list, l, _it)
- if (_it->ly) _it->index = i++;
-
- _update_stackedicon(obj);
-}
-
-EAPI Eina_List *elm_stackedicon_item_list_get(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->list;
-}
+++ /dev/null
- /**
- * @defgroup Stackedicon Stackedicon
- * @ingroup Elementary
- * @addtogroup Stackedicon
- * @{
- *
- * This is a Stackedicon.
- * smart callback called:
- * "expanded" - This signal is emitted when a stackedicon is expanded.
- * "clicked" - This signal is emitted when a stackedicon is clicked.
- *
- * available styles:
- * default
- */
- typedef struct _Stackedicon_Item Elm_Stackedicon_Item;
- /**
- * Add a new stackedicon to the parent
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- */
- EAPI Evas_Object *elm_stackedicon_add(Evas_Object *parent);
- /**
- * This appends a path to the stackedicon
- *
- * @param obj The stackedicon object
- * @param path The image full path
- * @return The new item or NULL if it cannot be created
- */
- EAPI Elm_Stackedicon_Item *elm_stackedicon_item_append(Evas_Object *obj, const char *path);
- /**
- * This prepends a path to the stackedicon
- *
- * @param obj The stackedicon object
- * @param path The image full path
- * @return The new item or NULL if it cannot be created
- */
- EAPI Elm_Stackedicon_Item *elm_stackedicon_item_prepend(Evas_Object *obj, const char *path);
- /**
- * This delete a path at the stackedicon
- *
- * @param Elm_Stackedicon_Item The delete item
- */
- EAPI void elm_stackedicon_item_del(Elm_Stackedicon_Item *it);
- /**
- * Get item list from the stackedicon
- *
- * @param obj The stackedicon object
- * @return The item list or NULL if it cannot be created
- */
- EAPI Eina_List *elm_stackedicon_item_list_get(Evas_Object *obj);
- /**
- * @}
- */
-
+++ /dev/null
-#include <Elementary.h>
-#include "elm_priv.h"
-
-typedef struct _Widget_Data Widget_Data;
-
-struct _Widget_Data
-{
- Evas_Object *win;
- Evas_Object *edje_obj;
- Evas_Object *icon;
- Evas_Object *button;
- Ecore_Event_Handler *rotation_event_handler;
- const char *label;
- int noti_height;
- int angle;
- Elm_Tickernoti_Mode mode;
- Elm_Tickernoti_Orient orient;
-};
-
-static const char *widtype = NULL;
-static void _del_hook(Evas_Object *obj);
-static void _theme_hook(Evas_Object *obj);
-static void _sizing_eval(Evas_Object *obj);
-static void _update_geometry_on_rotation(Evas_Object *obj, int angle, int *x, int *y, int *w);
-
-static const char SIG_CLICKED[] = "clicked";
-static const char SIG_HIDDEN[] = "hide";
-static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_CLICKED, ""},
- {SIG_HIDDEN, ""},
- {NULL, NULL}
-};
-
-static void
-_del_job(void *data)
-{
- evas_object_del(data);
-}
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Evas_Object *parent;
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
- parent = elm_widget_parent_get(obj);
- if (wd->rotation_event_handler)
- ecore_event_handler_del(wd->rotation_event_handler);
- if (wd->win) ecore_job_add(_del_job, parent);
- evas_object_del(wd->edje_obj);
- wd->edje_obj = NULL;
- free(wd);
-}
-
-static void
-_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
- edje_object_mirrored_set(wd->edje_obj, rtl);
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- char *data_win_height = NULL;
- Evas_Coord w;
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
- _elm_widget_mirrored_reload(obj);
- _mirrored_set(obj, elm_widget_mirrored_get(obj));
-
- _elm_theme_object_set(wd->win, wd->edje_obj, "tickernoti",
- "base", elm_widget_style_get(obj));
-
- /* tickernoti detail height set */
- data_win_height = (char *)edje_object_data_get(wd->edje_obj, "height");
- if (data_win_height != NULL && elm_scale_get() > 0.0)
- wd->noti_height = (int)(elm_scale_get() * atoi(data_win_height));
-
- evas_object_geometry_get(wd->win, NULL, NULL, &w, NULL);
- evas_object_resize(wd->win, w, wd->noti_height);
-
- edje_object_signal_emit(wd->edje_obj, "effect,show", "elm");/*goes too late*/
- edje_object_message_signal_process(wd->edje_obj);
- edje_object_scale_set(wd->edje_obj, elm_widget_scale_get(obj) * _elm_config->scale);
-
- _sizing_eval(obj);
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1;
-
- if (!wd) return;
- elm_coords_finger_size_adjust(1, &minw, 1, &minh);
- edje_object_size_min_restricted_calc(wd->edje_obj, &minw, &minh, minw, minh);
- evas_object_size_hint_min_set(obj, minw, minh);
-}
-
-#ifdef HAVE_ELEMENTARY_X
-static void
-_update_window_hints(Evas_Object *obj)
-{
- Ecore_X_Window xwin;
- Ecore_X_Atom _notification_level_atom;
- int level;
- // elm_win_xwindow_get() must call after elm_win_alpha_set()
- xwin = elm_win_xwindow_get(obj);
-
- ecore_x_icccm_hints_set(xwin, 0, ECORE_X_WINDOW_STATE_HINT_NONE, 0, 0, 0, 0, 0);
- ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
- ecore_x_netwm_opacity_set(xwin, 0);
- // Create atom for notification level
- _notification_level_atom = ecore_x_atom_get("_E_ILLUME_NOTIFICATION_LEVEL");
-
- // HIGH:150, NORMAL:100, LOW:50
- level = 100;
-
- // Set notification level of the window
- ecore_x_window_prop_property_set(xwin, _notification_level_atom, ECORE_X_ATOM_CARDINAL, 32, &level, 1);
-}
-#endif
-
-static void _hide_cb(void *data, Evas_Object *obj __UNUSED__,
- const char *emission __UNUSED__,
- const char *source __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
-
- if (!wd) return;
- evas_object_hide(wd->win);
- evas_object_smart_callback_call(data, SIG_HIDDEN, NULL);
-}
-
-static void _clicked_cb(void *data, Evas_Object *obj __UNUSED__,
- const char *emission __UNUSED__,
- const char *source __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
-
- if (!wd) return;
- evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
-}
-
-static Evas_Object
-*_create_window(Evas_Object *parent, const char *name)
-{
- Evas_Object *win;
-
- win = elm_win_add(parent, name, ELM_WIN_BASIC);
- elm_win_title_set(win, name);
- elm_win_borderless_set(win, EINA_TRUE);
- elm_win_autodel_set(win, EINA_TRUE);
- elm_win_alpha_set(win, EINA_TRUE);
- evas_object_size_hint_weight_set(win, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(win, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
-#ifdef HAVE_ELEMENTARY_X
- // set top window
- _update_window_hints(win);
-#endif
- return win;
-}
-
-static void
-_win_rotated(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- int x = 0, y = 0, w = 0, angle = 0;
-
- if (!wd) return;
- angle = elm_win_rotation_get(wd->win);
- if (angle % 90) return;
- angle %= 360;
- if (angle < 0) angle += 360;
- wd->angle = angle;
- _update_geometry_on_rotation(obj, wd->angle, &x, &y, &w);
- evas_object_move(wd->win, x, y);
- evas_object_resize(wd->win, w, wd->noti_height);
-#ifdef HAVE_ELEMENTARY_X
- _update_window_hints(wd->win);
-#endif
-}
-
-static Eina_Bool
-_prop_change(void *data, int type __UNUSED__, void *event)
-{
-#ifdef HAVE_ELEMENTARY_X
- Ecore_X_Event_Window_Property *ev;
- Widget_Data *wd = elm_widget_data_get(data);
-
- if (!wd) return ECORE_CALLBACK_PASS_ON;
- ev = event;
- if (ev->atom == ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE)
- {
- if (ev->win == elm_win_xwindow_get(wd->win))
- {
- _win_rotated(data);
- }
- }
- return ECORE_CALLBACK_PASS_ON;
-#endif
-}
-
-static void
-_create_tickernoti(Evas_Object *obj)
-{
-#ifdef HAVE_ELEMENTARY_X
- Evas_Coord w;
-#endif
- Widget_Data *wd = elm_widget_data_get(obj);
- char *data_win_height = NULL;
- Evas *e;
-
- if (!wd) return;
-
- evas_object_move(wd->win, 0, 0);
- e = evas_object_evas_get(wd->win);
-
- wd->edje_obj = edje_object_add(e);
- _elm_theme_object_set(wd->win, wd->edje_obj, "tickernoti", "base", "default");
- elm_win_resize_object_add(wd->win, wd->edje_obj);
-
- // tickernoti height setting
- data_win_height = (char *)edje_object_data_get(wd->edje_obj, "height");
- if (data_win_height != NULL && elm_scale_get() > 0.0)
- wd->noti_height = (int)(elm_scale_get() * atoi(data_win_height));
-
-#ifdef HAVE_ELEMENTARY_X
- ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, NULL);
- evas_object_size_hint_min_set(wd->edje_obj, w, wd->noti_height);
- evas_object_resize(wd->win, w, wd->noti_height);
- wd->rotation_event_handler = ecore_event_handler_add(
- ECORE_X_EVENT_WINDOW_PROPERTY, _prop_change, obj);
-#endif
-
- edje_object_signal_callback_add(wd->edje_obj, "request,hide", "", _hide_cb, obj);
- edje_object_signal_callback_add(wd->edje_obj, "clicked", "", _clicked_cb, obj);
- evas_object_show(wd->edje_obj);
-}
-
-static void
-_disable_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
-//TODO: To stop the event in case of being disabled
-}
-
-static void
-_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
- void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
-#ifdef HAVE_ELEMENTARY_X
- _update_window_hints(wd->win);
-#endif
- evas_object_show(wd->win);
- edje_object_signal_emit(wd->edje_obj, "effect,show", "elm");
- edje_object_message_signal_process(wd->edje_obj);
-}
-
-static void
-_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
- void *event_info __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
- evas_object_hide(wd->win);
-}
-
-static void _tickernoti_hide_cb(void *data, Evas_Object *obj __UNUSED__,
- void *event_info __UNUSED__)
-{
- Widget_Data *wd = data;
-
- if (!wd) return;
-
- edje_object_signal_emit(wd->edje_obj, "effect,hide", "elm");
- edje_object_message_signal_process(wd->edje_obj);
-}
-
-static void
-_update_geometry_on_rotation(Evas_Object *obj, int angle, int *x, int *y, int *w)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
-
-#ifdef HAVE_ELEMENTARY_X
- Evas_Coord root_w, root_h;
-
- /*
- * manually calculate win_tickernoti_indi window position & size
- * - win_indi is not full size window
- */
- ecore_x_window_size_get(ecore_x_window_root_first_get(), &root_w, &root_h);
- // rotate win
- switch(angle)
- {
- case 90:
- *w = root_h;
- if (wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM)
- *x = root_w - wd->noti_height;
- break;
- case 270:
- *w = root_h;
- if (!(wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM))
- *x = root_w - wd->noti_height;
- break;
- case 180:
- *w = root_w;
- if (!wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM)
- *y = root_h - wd->noti_height;
- break;
- case 0:
- default:
- *w = root_w;
- if (wd->orient == ELM_TICKERNOTI_ORIENT_BOTTOM)
- *y = root_h - wd->noti_height;
- break;
- }
-#endif
-}
-
-static void
-_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Object *sub = event_info;
- if (!wd) return;
- if (sub == wd->icon)
- wd->icon = NULL;
- if (sub == wd->button)
- wd->button = NULL;
-}
-
-static void
-_elm_tickernoti_label_set(Evas_Object *obj, const char *part, const char *label)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
- if (part && strcmp(part, "default")) return;
- eina_stringshare_replace(&wd->label, label);
- edje_object_part_text_set(wd->edje_obj, "elm.text", wd->label);
- _sizing_eval(obj);
-}
-
-const char *
-_elm_tickernoti_label_get(const Evas_Object *obj, const char *part)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (part && strcmp(part, "default")) return NULL;
- if (!wd) return NULL;
- return wd->label;
-}
-
-static void
-_elm_tickernoti_icon_set(Evas_Object *obj, Evas_Object *icon)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
- if (wd->icon == icon) return;
- if (wd->icon) evas_object_del(wd->icon);
- wd->icon = icon;
- if (icon)
- {
- elm_widget_sub_object_add(obj, icon);
- edje_object_part_swallow(wd->edje_obj, "icon", icon);
- }
-}
-
-static void
-_elm_tickernoti_button_set(Evas_Object *obj, Evas_Object *button)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
- if (wd->button == button) return;
- if (wd->button) evas_object_del(wd->button);
- wd->button = button;
- if (button)
- {
- elm_widget_sub_object_add(obj, button);
- edje_object_part_swallow(wd->edje_obj, "button", button);
- evas_object_smart_callback_add(wd->button, "clicked", _tickernoti_hide_cb, wd);
- }
-}
-
-static void
-_elm_tickernoti_content_part_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd || !part) return;
- if (!part || !strcmp(part, "icon"))
- {
- _elm_tickernoti_icon_set(obj, content);
- return;
- }
- else if (!strcmp(part, "button"))
- {
- _elm_tickernoti_button_set(obj, content);
- return;
- }
-}
-
-static Evas_Object *
-_elm_tickernoti_icon_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->icon;
-}
-
-static Evas_Object *
-_elm_tickernoti_button_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->button;
-}
-
-static Evas_Object *
-_elm_tickernoti_content_part_get_hook(Evas_Object *obj, const char *part)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd || !part) return NULL;
- if (!part || !strcmp(part, "icon"))
- return _elm_tickernoti_icon_get(obj);
- else if (!strcmp(part, "button"))
- return _elm_tickernoti_button_get(obj);
- return NULL;
-}
-
-static Evas_Object *
-_elm_tickernoti_icon_unset(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Evas_Object *icon;
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd || !wd->icon) return NULL;
- icon = wd->icon;
- elm_widget_sub_object_del(obj, wd->icon);
- edje_object_part_unswallow(wd->edje_obj, icon);
- wd->icon = NULL;
- return icon;
-}
-
-static Evas_Object *
-_elm_tickernoti_button_unset(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Evas_Object *button;
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd || !wd->button) return NULL;
- button = wd->button;
- elm_widget_sub_object_del(obj, wd->button);
- edje_object_part_unswallow(wd->edje_obj, button);
- wd->button = NULL;
- return button;
-}
-
-static Evas_Object *
-_elm_tickernoti_content_part_unset_hook(Evas_Object *obj, const char *part)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd || !part) return NULL;
- if (!strcmp(part, "icon"))
- return _elm_tickernoti_icon_unset(obj);
- else if (!strcmp(part, "button"))
- return _elm_tickernoti_button_unset(obj);
- return NULL;
-}
-
-EAPI Evas_Object *
-elm_tickernoti_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- wd = ELM_NEW(Widget_Data);
- wd->win = _create_window(parent, "noti-window");
-
- e = evas_object_evas_get(wd->win);
- obj = elm_widget_add(e);
- ELM_SET_WIDTYPE(widtype, "tickernoti");
- elm_widget_type_set(obj, widtype);
- elm_widget_sub_object_add(wd->win, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_can_focus_set(obj, 0);
- elm_widget_disable_hook_set(obj, _disable_hook);
-
- wd->orient = ELM_TICKERNOTI_ORIENT_TOP;
-
- _create_tickernoti(obj);
- elm_widget_text_set_hook_set(obj, _elm_tickernoti_label_set);
- elm_widget_text_get_hook_set(obj, _elm_tickernoti_label_get);
- elm_widget_content_set_hook_set(obj, _elm_tickernoti_content_part_set_hook);
- elm_widget_content_get_hook_set(obj, _elm_tickernoti_content_part_get_hook);
- elm_widget_content_unset_hook_set(obj, _elm_tickernoti_content_part_unset_hook);
- evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, NULL);
-
- evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _show, NULL);
- evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _hide, NULL);
- evas_object_smart_callbacks_descriptions_set(obj, _signals);
- return obj;
-}
-
-EAPI int
-elm_tickernoti_rotation_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) -1;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return -1;
- return wd->angle;
-}
-
-EAPI void
-elm_tickernoti_rotation_set(Evas_Object *obj, int angle)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
- if (angle % 90) return;
- angle %= 360;
- if (angle < 0) angle += 360;
- wd->angle = angle;
- elm_win_rotation_set(wd->win, angle);
- _win_rotated(obj);
-}
-
-EAPI void
-elm_tickernoti_orient_set(Evas_Object *obj, Elm_Tickernoti_Orient orient)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
-
-#ifdef HAVE_ELEMENTARY_X
- Evas_Coord root_w, root_h;
-#endif
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return;
- if (orient >= ELM_TICKERNOTI_ORIENT_LAST) return;
-
-#ifdef HAVE_ELEMENTARY_X
- ecore_x_window_size_get(ecore_x_window_root_first_get(), &root_w, &root_h);
-#endif
-
- switch(orient) {
- case ELM_TICKERNOTI_ORIENT_BOTTOM:
-#ifdef HAVE_ELEMENTARY_X
- evas_object_move(wd->win, 0, root_h - wd->noti_height);
-#endif
- wd->orient = ELM_TICKERNOTI_ORIENT_BOTTOM;
- break;
- case ELM_TICKERNOTI_ORIENT_TOP:
- default:
-#ifdef HAVE_ELEMENTARY_X
- evas_object_move(wd->win, 0, 0);
-#endif
- wd->orient = ELM_TICKERNOTI_ORIENT_TOP;
- break;
- }
-#ifdef HAVE_ELEMENTARY_X
- _update_window_hints(wd->win);
-#endif
-}
-
-EAPI Elm_Tickernoti_Orient
-elm_tickernoti_orient_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) -1;
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd) return ELM_TICKERNOTI_ORIENT_LAST;
- return wd->orient;
-}
-
-EAPI Evas_Object *
-elm_tickernoti_win_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->win;
-}
-
-EAPI void
-elm_tickernoti_detailview_label_set(Evas_Object *obj, const char *label)
-{
- _elm_tickernoti_label_set(obj, NULL, label);
-}
-
-EAPI const char *
-elm_tickernoti_detailview_label_get(const Evas_Object *obj)
-{
- return _elm_tickernoti_label_get(obj, NULL);
-}
-
-EAPI void
-elm_tickernoti_detailview_button_set(Evas_Object *obj, Evas_Object *button)
-{
- _elm_tickernoti_button_set(obj, button);
-}
-
-EAPI Evas_Object *
-elm_tickernoti_detailview_button_get(const Evas_Object *obj)
-{
- return _elm_tickernoti_button_get(obj);
-}
-
-EAPI void
-elm_tickernoti_detailview_icon_set(Evas_Object *obj, Evas_Object *icon)
-{
- _elm_tickernoti_icon_set(obj, icon);
-}
-
-EAPI Evas_Object *
-elm_tickernoti_detailview_icon_get(const Evas_Object *obj)
-{
- return _elm_tickernoti_icon_get(obj);
-}
-
-EAPI Elm_Tickernoti_Mode
-elm_tickernoti_mode_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) -1;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return -1;
- return wd->mode;
-}
-
-EAPI void
-elm_tickernoti_mode_set(Evas_Object *obj, Elm_Tickernoti_Mode mode)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- switch(mode){
- case ELM_TICKERNOTI_DEFAULT:
- case ELM_TICKERNOTI_DETAILVIEW:
- wd->mode = mode;
- break;
- default:
- break;
- }
-}
-
-EAPI Evas_Object *
-elm_tickernoti_detailview_get(const Evas_Object *obj)
-{
- return elm_tickernoti_win_get(obj);
-}
-
-EAPI void
-elm_tickernoti_orientation_set(Evas_Object *obj, Elm_Tickernoti_Orient orient)
-{
- elm_tickernoti_orient_set(obj, orient);
-}
-
-EAPI Elm_Tickernoti_Orient
-elm_tickernoti_orientation_get(const Evas_Object *obj)
-{
- return elm_tickernoti_orient_get(obj);
-}
-
-EAPI void
-elm_tickernoti_label_set(Evas_Object *obj, const char *label)
-{
- _elm_tickernoti_label_set(obj, NULL, label);
-}
-
-EAPI const char *
-elm_tickernoti_label_get(const Evas_Object *obj)
-{
- return _elm_tickernoti_label_get(obj, NULL);
-}
-
-EAPI void
-elm_tickernoti_button_set(Evas_Object *obj, Evas_Object *button)
-{
- _elm_tickernoti_button_set(obj, button);
-}
-
-EAPI Evas_Object *
-elm_tickernoti_button_get(const Evas_Object *obj)
-{
- return _elm_tickernoti_button_get(obj);
-}
-
-EAPI void
-elm_tickernoti_icon_set(Evas_Object *obj, Evas_Object *icon)
-{
- _elm_tickernoti_icon_set(obj, icon);
-}
-
-EAPI Evas_Object *
-elm_tickernoti_icon_get(const Evas_Object *obj)
-{
- return _elm_tickernoti_icon_get(obj);
-}
+++ /dev/null
- /**
- * @defgroup TickerNoti TickerNoti
- * @ingroup Elementary
- *
- * This is a notification widget which can be used to display some short information.
- *
- * Signals that you can add callback for are:
- * @li "clicked" - tickernoti object has been clicked, except at the
- * swallow/button region
- * @li "hide" - tickernoti is completely hidden. In case of
- * any hide animation, this signal is emitted after the animation.
- *
- * Default contents parts of a tickernoti object that you can use for are:
- * @li "icon" - The icon in tickernoti object
- * @li "button" - The button in tickernoti object
- *
- * Default text parts of the tickernoti object that you can use for are:
- * @li "default" - textual content in the tickernoti object
- *
- * Supported elm_object common APIs.
- * @li elm_object_text_set
- * @li elm_object_part_text_set
- * @li elm_object_part_content_set
- *
- */
-
- /**
- * @addtogroup Tickernoti
- * @{
- */
- typedef enum
- {
- ELM_TICKERNOTI_ORIENT_TOP = 0,
- ELM_TICKERNOTI_ORIENT_BOTTOM,
- ELM_TICKERNOTI_ORIENT_LAST
- } Elm_Tickernoti_Orient;
-
- /**
- * Add a tickernoti object to @p parent
- *
- * @param parent The parent object
- *
- * @return The tickernoti object, or NULL upon failure
- */
- EAPI Evas_Object *elm_tickernoti_add (Evas_Object *parent);
- /**
- * Set the orientation of the tickernoti object
- *
- * @param obj The tickernoti object
- * @param orient The orientation of tickernoti object
- */
- EAPI void elm_tickernoti_orient_set (Evas_Object *obj, Elm_Tickernoti_Orient orient) EINA_ARG_NONNULL(1);
- /**
- * Get the orientation of the tickernoti object
- *
- * @param obj The tickernotil object
- * @return The orientation of tickernotil object
- */
- EAPI Elm_Tickernoti_Orient elm_tickernoti_orient_get (const Evas_Object *obj) EINA_ARG_NONNULL(1);
- /**
- * Get the rotation of tickernoti object
- *
- * @param obj The tickernotil object
- * @return The rotation angle
- */
- EAPI int elm_tickernoti_rotation_get (const Evas_Object *obj) EINA_ARG_NONNULL(1);
- /**
- * Set the rotation angle for the tickernoti object
- *
- * @param obj The tickernoti object
- * @param angle The rotation angle(in degree) will be used on the tickernoti object
- */
- EAPI void elm_tickernoti_rotation_set (Evas_Object *obj, int angle) EINA_ARG_NONNULL(1);
- /**
- * Get the view window(elm_win) on the tickernoti object
- *
- * @param obj The tickernotil object
- * @return internal view window(elm_win) object
- */
- EAPI Evas_Object *elm_tickernoti_win_get (const Evas_Object *obj) EINA_ARG_NONNULL(1);
- /* #### Below APIs and data structures are going to be deprecated, announcment will be made soon ####*/
- /**
- * @deprecated
- */
- typedef enum
- {
- ELM_TICKERNOTI_DEFAULT,
- ELM_TICKERNOTI_DETAILVIEW
- } Elm_Tickernoti_Mode;
- /**
- * Set the detail label on the tickernoti object
- *
- * @param obj The tickernoti object
- * @param label The label will be used on the tickernoti object
- * @deprecated use elm_object_text_set() instead
- */
- EINA_DEPRECATED EAPI void elm_tickernoti_detailview_label_set (Evas_Object *obj, const char *label) EINA_ARG_NONNULL(1);
- /**
- * Get the detail label used on the tickernoti object
- *
- * @param obj The tickernotil object
- * @return The string inside the label
- * @deprecated use elm_object_text_get() instead
- */
- EINA_DEPRECATED EAPI const char *elm_tickernoti_detailview_label_get (const Evas_Object *obj)EINA_ARG_NONNULL(1);
- /**
- * Set the button object used on the tickernoti object
- *
- * @param obj The tickernotil object
- * @param button The button object will be used on the tickernoti object
- * @deprecated use elm_object_part_content_set() instead with "button" as part name
- */
- EINA_DEPRECATED EAPI void elm_tickernoti_detailview_button_set (Evas_Object *obj, Evas_Object *button) EINA_ARG_NONNULL(2);
- /**
- * Get the button object used on the tickernoti object
- *
- * @param obj The tickernotil object
- * @return The button object inside the tickernoti
- * @deprecated use elm_object_part_content_get() instead with "button" as part name
- */
- EINA_DEPRECATED EAPI Evas_Object *elm_tickernoti_detailview_button_get (const Evas_Object *obj) EINA_ARG_NONNULL(1);
- /**
- * Set the detail icon object used on the tickernoti object
- *
- * @param obj The tickernotil object
- * @param icon The icon object will be used on the tickernoti object
- * @deprecated use elm_object_part_content_set() instead with "icon" as part name
- */
- EINA_DEPRECATED EAPI void elm_tickernoti_detailview_icon_set (Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
- /**
- * Get the detail icon object used on the tickernoti object
- *
- * @param obj The tickernotil object
- * @return The icon object inside the tickernoti
- * @deprecated use elm_object_part_content_get() instead with "icon" as part name
- */
- EINA_DEPRECATED EAPI Evas_Object *elm_tickernoti_detailview_icon_get (const Evas_Object *obj) EINA_ARG_NONNULL(1);
- /**
- * Get the view mode on the tickernoti object
- *
- * @param obj The tickernotil object
- * @return The internal window used
- * @deprecated use elm_tickernoti_win_get instead when internal window object is needed
- */
- EINA_DEPRECATED EAPI Evas_Object *elm_tickernoti_detailview_get (const Evas_Object *obj) EINA_ARG_NONNULL(1);
- /**
- * Set the view mode used on the tickernoti object
- *
- * @param obj The tickernotil object
- * @param mode The view mode will be used on the tickernoti object
- * @deprecated removed as now styles are used. Use elm_object_style_set instead.
- */
- EINA_DEPRECATED EAPI void elm_tickernoti_mode_set (Evas_Object *obj, Elm_Tickernoti_Mode mode) EINA_ARG_NONNULL(1);
- /**
- * Get the current mode of the tickernoti object
- *
- * @param obj The tickernotil object
- * @return the mode of the object. Can be ELM_TICKERNOTI_DEFAULT/ELM_TICKERNOTI_DETAILVIEW
- */
- EINA_DEPRECATED EAPI Elm_Tickernoti_Mode elm_tickernoti_mode_get (const Evas_Object *obj) EINA_ARG_NONNULL(1);
- /**
- * Set the orientation of the tickernoti object
- *
- * @param obj The tickernoti object
- * @param orient The orientation of tickernoti object
- * @deprecated use elm_tickernoti_orient_set() instead
- */
- EINA_DEPRECATED EAPI void elm_tickernoti_orientation_set (Evas_Object *obj, Elm_Tickernoti_Orient orient) EINA_ARG_NONNULL(1);
- /**
- * Get the orientation of the tickernoti object
- *
- * @param obj The tickernotil object
- * @return The orientation of tickernotil object
- * @deprecated use elm_tickernoti_orient_get() instead
- */
- EINA_DEPRECATED EAPI Elm_Tickernoti_Orient elm_tickernoti_orientation_get (const Evas_Object *obj) EINA_ARG_NONNULL(1);
- /**
- * Set the label on the tickernoti object
- *
- * @param obj The tickernoti object
- * @param label The label will be used on the tickernoti object
- * @deprecated use elm_object_text_set()
- */
- EINA_DEPRECATED EAPI void elm_tickernoti_label_set (Evas_Object *obj, const char *label) EINA_ARG_NONNULL(1);
- /**
- * Get the label used on the tickernoti object
- *
- * @param obj The tickernotil object
- * @return The string inside the label
- * @deprecated use elm_object_text_get() instead
- */
- EINA_DEPRECATED EAPI const char *elm_tickernoti_label_get (const Evas_Object *obj) EINA_ARG_NONNULL(1);
- /**
- * Set the icon object of the tickernoti object
- *
- * @param obj The tickernotil object
- * @param icon The icon object will be used on the tickernoti object
- * @deprecated use elm_object_part_content_set() instead with "icon" as part name
- */
- EINA_DEPRECATED EAPI void elm_tickernoti_icon_set (Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
- /**
- * Get the icon object of the tickernoti object
- *
- * @param obj The tickernotil object
- * @return The icon object inside the tickernoti
- * @deprecated use elm_object_part_content_get() instead with "icon" as part name
- */
- EINA_DEPRECATED EAPI Evas_Object *elm_tickernoti_icon_get (const Evas_Object *obj) EINA_ARG_NONNULL(1);
- /**
- * Set the action button object used on the tickernoti object
- *
- * @param obj The tickernotil object
- * @param button The button object will be used on the tickernoti object
- * @deprecated use elm_object_part_content_set() instead with "button" as part name
- */
- EINA_DEPRECATED EAPI void elm_tickernoti_button_set (Evas_Object *obj, Evas_Object *button) EINA_ARG_NONNULL(1);
- /**
- * Get the action button object used on the tickernoti object
- *
- * @param obj The tickernotil object
- * @return The button object inside the tickernoti
- * @deprecated use elm_object_part_content_get() instead with "button" as part name
- */
- EINA_DEPRECATED EAPI Evas_Object *elm_tickernoti_button_get (const Evas_Object *obj) EINA_ARG_NONNULL(1);
- /**
- * @}
- */
-