From: Myungjae Lee <mjae.lee@samsung.com>
Subject: [E-devel] [PATCH] elm scroller, scrolled entry: events propagation, min size It's not possible to connect event handler such as EVAS_CALLBACK_KEY_UP to elm_scrolled_entry because the scroller inside the scrolled entry does not propagate events. So this is the patch for adding events propagation set function to scroller and setting it to EINA_TRUE in elm scrolled entry. And one more thing in scrolled entry, while evaluating its size, scrolled entry does not consider its min size. (It just refers to the min size of its scroller object instead of scrolled entry object.) So here in the attached patch, scrolled entry compares its min size to the min size of the scroller object and set the bigger one to its min size to keep the min size set by intent. looks good - some mistakes you made. you forgot the patch that adds elm_scroller_propagate_events_set() to Elementary.h.in .... i added it for you. but remember to include it in your patch next time. Also the documentation could be a LOT better! i fixed that for you too. also - you could have added a elm_scroller_propagate_events_get(). i added that too for you. oh.. and you didn't use ELM_CHECK_WIDTYPE(). SVN revision: 55609
This commit is contained in:
parent
19daef4293
commit
809e800133
|
@ -781,6 +781,9 @@ extern "C" {
|
|||
EAPI void elm_scroller_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_scroller_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagation);
|
||||
EAPI Eina_Bool elm_scroller_propagate_events_get(const Evas_Object *obj);
|
||||
|
||||
/* smart callbacks called:
|
||||
* "edge,left"
|
||||
* "edge,right"
|
||||
|
|
|
@ -129,12 +129,15 @@ static void
|
|||
_sizing_eval(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd;
|
||||
Evas_Coord minw, minh;
|
||||
|
||||
Evas_Coord minw, minh, minw_scr, minh_scr;
|
||||
wd = elm_widget_data_get(obj);
|
||||
if (!wd)
|
||||
return;
|
||||
evas_object_size_hint_min_get(wd->scroller, &minw, &minh);
|
||||
if (!wd) return;
|
||||
|
||||
evas_object_size_hint_min_get(obj, &minw, &minh);
|
||||
evas_object_size_hint_min_get(wd->scroller, &minw_scr, &minh_scr);
|
||||
if (minw < minw_scr) minw = minw_scr;
|
||||
if (minh < minh_scr) minh = minh_scr;
|
||||
|
||||
evas_object_size_hint_min_set(obj, minw, minh);
|
||||
if (wd->single_line)
|
||||
evas_object_size_hint_max_set(obj, -1, minh);
|
||||
|
@ -386,6 +389,7 @@ elm_scrolled_entry_add(Evas_Object *parent)
|
|||
evas_object_size_hint_weight_set(wd->scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(wd->scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_scroller_bounce_set(wd->scroller, EINA_FALSE, EINA_FALSE);
|
||||
elm_scroller_propagate_events_set(wd->scroller, EINA_TRUE);
|
||||
evas_object_show(wd->scroller);
|
||||
|
||||
wd->entry = elm_entry_add(obj);
|
||||
|
|
|
@ -874,3 +874,46 @@ elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_
|
|||
if ((!wd) || (!wd->scr)) return;
|
||||
elm_smart_scroller_region_bring_in(wd->scr, x, y, w, h);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set event propagation on a scroller
|
||||
*
|
||||
* This enables or disabled event propagation from the scroller content to
|
||||
* the scroller and its parent. By default event propagation is disabled.
|
||||
*
|
||||
* @param obj The scroller object
|
||||
* @param propagation If propagation is enabled or not
|
||||
*
|
||||
* @ingroup Scroller
|
||||
*/
|
||||
EAPI void
|
||||
elm_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagation)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
|
||||
evas_object_propagate_events_set(wd->scr, propagation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get event propagation for a scroller
|
||||
*
|
||||
* This gets the event propagation for a scroller. See
|
||||
* elm_scroller_propagate_events_set() for more information
|
||||
*
|
||||
* @param obj The scroller object
|
||||
* @return The propagation state
|
||||
*
|
||||
* @ingroup Scroller
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_scroller_propagate_events_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 evas_object_propagate_events_get(wd->scr);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue