#include "private.h"
+#include <assert.h>
-typedef struct _Elm_Params_Scroller
-{
+typedef struct _Elm_Params_Scroller Elm_Params_Scroller;
+
+struct _Elm_Params_Scroller {
Elm_Params base;
+ Evas_Object *content;
const char *h_policy;
const char *v_policy;
Eina_Bool bounce_exist: 1;
Eina_Bool h_bounce_exists:1;
Eina_Bool v_bounce:1;
Eina_Bool v_bounce_exists:1;
-}Elm_Params_Scroller;
+};
static const char* scroller_policy_choices[] = {"auto", "on", "off", NULL};
else
elm_scroller_bounce_set(obj, h_bounce, p->v_bounce);
}
+ if (p->content) {
+ elm_scroller_content_set(obj, p->content);
+ }
}
static Eina_Bool
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
{
elm_scroller_policy_get(obj, &policy_h, &policy_v);
- v_policy = _scroller_vertical_policy_setting_get(param->s);
+ v_policy = _scroller_policy_setting_get(param->s);
if (v_policy == ELM_SCROLLER_POLICY_LAST) return EINA_FALSE;
elm_scroller_policy_set(obj, policy_h, v_policy);
return EINA_TRUE;
}
}
+ if (!strcmp(param->name, "content")
+ && param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
+ {
+ Evas_Object *content = external_common_param_edje_object_get(obj, param);
+ if ((strcmp(param->s, "")) && (!content))
+ return EINA_FALSE;
+ elm_scroller_content_set(obj, content);
+ return EINA_TRUE;
+ }
ERR("unknown parameter '%s' of type '%s'",
param->name, edje_external_param_type_str(param->type));
return EINA_TRUE;
}
}
+ if (!strcmp(param->name, "content"))
+ {
+ /* not easy to get content name back from live object */
+ return EINA_FALSE;
+ }
ERR("unknown parameter '%s' of type '%s'",
param->name, edje_external_param_type_str(param->type));
mem->v_bounce = param->i;
mem->v_bounce_exists = EINA_TRUE;
}
+ if (!strcmp(param->name, "content"))
+ mem->content = external_common_param_edje_object_get(obj, param);
}
return mem;
static Evas_Object *external_scroller_content_get(void *data __UNUSED__,
const Evas_Object *obj, const char *content)
{
- ERR("so content");
+ if (!strcmp(content, "content"))
+ return elm_scroller_content_get(obj);
+
+ ERR("unknown content '%s'", content);
return NULL;
}
}
static Edje_External_Param_Info external_scroller_params[] = {
+ DEFINE_EXTERNAL_COMMON_PARAMS,
EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("horizontal policy", "auto", scroller_policy_choices),
EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("vertical policy", "auto", scroller_policy_choices),
EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal bounce"),
EDJE_EXTERNAL_PARAM_INFO_BOOL("vertical bounce"),
+ EDJE_EXTERNAL_PARAM_INFO_STRING("content"),
EDJE_EXTERNAL_PARAM_INFO_SENTINEL
};
}
/**
+ * Get the content of the scroller widget
+ *
+ * Return the content object which is set for this widget
+ *
+ * @param obj The slider object
+ * @return The content that is being used
+ *
+ * @ingroup Scroller
+ */
+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;
+}
+
+/**
* Unset the content of the scroller widget
*
* Unparent and return the content object which was set for this widget
}
/**
+ * Get the bounce mode
+ *
+ * @param obj The Scroller object
+ * @param h_bounce Allow bounce horizontally
+ * @param v_bounce Allow bounce vertically
+ *
+ * @ingroup Scroller
+ */
+EAPI void
+elm_scroller_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_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
+}
+
+/**
* Set scroll page size relative to viewport size
*
* The scroller is sapale of limiting scrolling by the user to "pages". That