elm_panel: Add get function in scrollable_content_size property

Summary:
Added get function for getting the size of the scrollable panel.
Additionally, added some exception handling code in scrollable_content_size_set

Reviewers: woohyun, eunue

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4549
This commit is contained in:
JEONGHYUN YUN 2017-01-05 10:26:29 +09:00 committed by Jean-Philippe Andre
parent 459a23244f
commit 401488cea7
2 changed files with 39 additions and 20 deletions

View File

@ -1405,32 +1405,45 @@ _elm_panel_elm_widget_disable(Eo *obj, Elm_Panel_Data *sd)
return EINA_TRUE;
}
EOLIAN static double
_elm_panel_scrollable_content_size_get(Eo *obj EINA_UNUSED, Elm_Panel_Data *sd)
{
return sd->content_size_ratio;
}
EOLIAN static void
_elm_panel_scrollable_content_size_set(Eo *obj, Elm_Panel_Data *sd, double ratio)
{
Evas_Coord w, h;
if (ratio < 0) ratio = 0;
else if (ratio > 1.0) ratio = 1.0;
sd->content_size_ratio = ratio;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
switch (sd->orient)
{
case ELM_PANEL_ORIENT_TOP:
case ELM_PANEL_ORIENT_BOTTOM:
// vertical
evas_object_resize(sd->scr_ly, w, (1 + sd->content_size_ratio) * h);
evas_object_size_hint_min_set(sd->scr_panel, w, (sd->content_size_ratio * h));
evas_object_size_hint_min_set(sd->scr_event, w, h);
break;
case ELM_PANEL_ORIENT_LEFT:
case ELM_PANEL_ORIENT_RIGHT:
// horizontal
evas_object_resize(sd->scr_ly, (1 + sd->content_size_ratio) * w, h);
evas_object_size_hint_min_set(sd->scr_panel, (sd->content_size_ratio * w), h);
evas_object_size_hint_min_set(sd->scr_event, w, h);
break;
}
if (sd->scrollable)
{
Evas_Coord w, h;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
elm_layout_sizing_eval(obj);
switch (sd->orient)
{
case ELM_PANEL_ORIENT_TOP:
case ELM_PANEL_ORIENT_BOTTOM:
// vertical
evas_object_resize(sd->scr_ly, w, (1 + sd->content_size_ratio) * h);
evas_object_size_hint_min_set(sd->scr_panel, w, (sd->content_size_ratio * h));
evas_object_size_hint_min_set(sd->scr_event, w, h);
break;
case ELM_PANEL_ORIENT_LEFT:
case ELM_PANEL_ORIENT_RIGHT:
// horizontal
evas_object_resize(sd->scr_ly, (1 + sd->content_size_ratio) * w, h);
evas_object_size_hint_min_set(sd->scr_panel, (sd->content_size_ratio * w), h);
evas_object_size_hint_min_set(sd->scr_event, w, h);
break;
}
elm_layout_sizing_eval(obj);
}
}
EOLIAN static Eina_Bool

View File

@ -59,6 +59,12 @@ class Elm.Panel (Elm.Layout, Elm.Interface_Scrollable,
set {
[[Set the size of the scrollable panel.]]
}
get {
[[Get the size of the scrollable panel.
@since 1.19
]]
}
values {
ratio: double; [[Size ratio]]
}