elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
elm_scroller_child_size_get(obj, &max_x, &max_y);
- if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
+ if ((!strcmp(ev->keyname, "Left")) ||
+ ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
{
x -= step_x;
}
- else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
+ else if ((!strcmp(ev->keyname, "Right")) ||
+ ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)))
{
x += step_x;
}
- else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
+ else if ((!strcmp(ev->keyname, "Up")) ||
+ ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string)))
{
y -= step_y;
}
- else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
+ else if ((!strcmp(ev->keyname, "Down")) ||
+ ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string)))
{
y += step_y;
}
- else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
+ else if ((!strcmp(ev->keyname, "Home")) ||
+ ((!strcmp(ev->keyname, "KP_Home")) && (!ev->string)))
{
y = 0;
}
- else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
+ else if ((!strcmp(ev->keyname, "End")) ||
+ ((!strcmp(ev->keyname, "KP_End")) && (!ev->string)))
{
y = max_y - v_h;
}
- else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior")))
+ else if ((!strcmp(ev->keyname, "Prior")) ||
+ ((!strcmp(ev->keyname, "KP_Prior")) && (!ev->string)))
{
if (page_y < 0)
y -= -(page_y * v_h) / 100;
else
y -= page_y;
}
- else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next")))
+ else if ((!strcmp(ev->keyname, "Next")) ||
+ ((!strcmp(ev->keyname, "KP_Next")) && (!ev->string)))
{
if (page_y < 0)
y += -(page_y * v_h) / 100;
cur = wd->content;
/* Try Focus cycle in subitem */
- if ((elm_widget_can_focus_get(cur)) || (elm_widget_child_can_focus_get(cur)))
- return elm_widget_focus_next_get(cur, dir, next);
+ if (elm_widget_focus_get(obj))
+ {
+ if ((elm_widget_can_focus_get(cur)) || (elm_widget_child_can_focus_get(cur)))
+ return elm_widget_focus_next_get(cur, dir, next);
+ }
/* Return */
*next = (Evas_Object *)obj;
evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
}
+Evas_Object *
+_elm_scroller_edje_object_get(Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ return elm_smart_scroller_edje_object_get(wd->scr);
+}
+
+static void
+_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd;
+ if (part && strcmp(part, "default")) return;
+ wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->content == content) return;
+ if (wd->content) evas_object_del(wd->content);
+ wd->content = content;
+ if (content)
+ {
+ elm_widget_on_show_region_hook_set(content, _show_region_hook, obj);
+ elm_widget_sub_object_add(obj, content);
+ if (wd->scr)
+ elm_smart_scroller_child_set(wd->scr, content);
+ evas_object_event_callback_add(content,
+ EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ }
+ _sizing_eval(obj);
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *part)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd;
+ if (part && strcmp(part, "default")) return NULL;
+ wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ return wd->content;
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *part)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd;
+ Evas_Object *content;
+ if (part && strcmp(part, "default")) return NULL;
+ wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ if (!wd->content) return NULL;
+ content = wd->content;
+ elm_widget_sub_object_del(obj, wd->content);
+ evas_object_event_callback_del_full(wd->content,
+ EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_part_unswallow(elm_smart_scroller_edje_object_get(wd->scr),
+ wd->content);
+ wd->content = NULL;
+ return content;
+}
+
EAPI Evas_Object *
elm_scroller_add(Evas_Object *parent)
{
elm_widget_can_focus_set(obj, EINA_TRUE);
elm_widget_event_hook_set(obj, _event_hook);
elm_widget_focus_region_hook_set(obj, _focus_region_hook);
+ elm_widget_content_set_hook_set(obj, _content_set_hook);
+ elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_content_unset_hook_set(obj, _content_unset_hook);
wd->widget_name = eina_stringshare_add("scroller");
wd->widget_base = eina_stringshare_add("base");
return obj;
}
-Evas_Object *
-_elm_scroller_edje_object_get(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return elm_smart_scroller_edje_object_get(wd->scr);
-}
-
-EAPI void
-elm_scroller_content_set(Evas_Object *obj, Evas_Object *content)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->content == content) return;
- if (wd->content) evas_object_del(wd->content);
- wd->content = content;
- if (content)
- {
- elm_widget_on_show_region_hook_set(content, _show_region_hook, obj);
- elm_widget_sub_object_add(obj, content);
- if (wd->scr)
- elm_smart_scroller_child_set(wd->scr, content);
- evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- }
- _sizing_eval(obj);
-}
-
-EAPI Evas_Object *
-elm_scroller_content_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->content;
-}
-
-EAPI Evas_Object *
-elm_scroller_content_unset(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Object *content;
- if (!wd) return NULL;
- if (!wd->content) return NULL;
- content = wd->content;
- elm_widget_sub_object_del(obj, wd->content);
- edje_object_part_unswallow(elm_smart_scroller_edje_object_get(wd->scr), wd->content);
- wd->content = NULL;
- return content;
-}
-
EAPI void
elm_scroller_custom_widget_base_theme_set(Evas_Object *obj, const char *widget, const char *base)
{
return evas_object_propagate_events_get(wd->scr);
}
+
+EAPI void
+elm_scroller_gravity_set(Evas_Object *obj, double x, double y)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ elm_smart_scroller_gravity_set(wd->scr, x, y);
+}
+
+EAPI void
+elm_scroller_gravity_get(const Evas_Object *obj, double *x, double *y)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ elm_smart_scroller_gravity_get(wd->scr, x, y);
+}