forked from enlightenment/efl
efl_ui_scrollbar: change scrollbar state when theme is reloaded.
Scrollbar visible state is not synchronized when theme is reloaded. Differential Revision: https://phab.enlightenment.org/D10649
This commit is contained in:
parent
bac185e8f3
commit
fbb77e7d1c
|
@ -60,6 +60,18 @@ interface Efl.Ui.Scrollbar
|
|||
and $[1.0] (the bottom side of the thumb is touching the bottom edge of the widget).]]
|
||||
}
|
||||
}
|
||||
@property bar_visibility {
|
||||
[[Current visibility state of the scrollbars.
|
||||
This is useful in @Efl.Ui.Scrollbar_Mode.auto mode where EFL decides if the scrollbars
|
||||
are shown or hidden. See also the @[.bar,show] and @[.bar,hide] events.
|
||||
]]
|
||||
get {
|
||||
}
|
||||
values {
|
||||
hbar: bool; [[Whether the horizontal scrollbar is currently visible.]]
|
||||
vbar: bool; [[Whether the vertical scrollbar is currently visible.]]
|
||||
}
|
||||
}
|
||||
bar_visibility_update @protected @beta{
|
||||
[[Update bar visibility.
|
||||
|
||||
|
|
|
@ -2187,6 +2187,13 @@ _efl_ui_scrollbar_v_visibility_adjust(Eo *obj)
|
|||
if (scroll_v_vis_change) _efl_ui_scroll_manager_scrollbar_v_visibility_apply(sd);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_scroll_manager_efl_ui_scrollbar_bar_visibility_get(const Eo *obj EINA_UNUSED, Efl_Ui_Scroll_Manager_Data *sd, Eina_Bool *hbar, Eina_Bool *vbar)
|
||||
{
|
||||
if (hbar) *hbar = sd->hbar_visible;
|
||||
if (vbar) *vbar = sd->vbar_visible;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_scroll_manager_efl_ui_scrollbar_bar_visibility_update(Eo *obj, Efl_Ui_Scroll_Manager_Data *sd EINA_UNUSED)
|
||||
{
|
||||
|
|
|
@ -39,6 +39,7 @@ class @beta Efl.Ui.Scroll.Manager extends Efl.Object implements
|
|||
Efl.Ui.Scrollbar.bar_mode { get; set; }
|
||||
Efl.Ui.Scrollbar.bar_size { get; }
|
||||
Efl.Ui.Scrollbar.bar_position { get; set; }
|
||||
Efl.Ui.Scrollbar.bar_visibility { get; }
|
||||
Efl.Ui.Scrollbar.bar_visibility_update;
|
||||
Efl.Ui.Scrollable.scroll;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,20 @@ _scroll_connector_reload_cb(void *data,
|
|||
const char *source EINA_UNUSED)
|
||||
{
|
||||
Scroll_Connector_Context *ctx = data;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(ctx->obj, wd);
|
||||
Eina_Bool hbar_visible = EINA_FALSE, vbar_visible = EINA_FALSE;
|
||||
|
||||
efl_ui_scrollbar_bar_visibility_get(ctx->smanager, &hbar_visible, &vbar_visible);
|
||||
|
||||
if (hbar_visible)
|
||||
efl_layout_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,on", "efl");
|
||||
else
|
||||
efl_layout_signal_emit(wd->resize_obj, "efl,horizontal_bar,visible,off", "efl");
|
||||
|
||||
if (vbar_visible)
|
||||
efl_layout_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,on", "efl");
|
||||
else
|
||||
efl_layout_signal_emit(wd->resize_obj, "efl,vertical_bar,visible,off", "efl");
|
||||
|
||||
efl_ui_scrollbar_bar_visibility_update(ctx->smanager);
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ EFL_START_TEST(placement_test_group)
|
|||
r = efl_gfx_entity_geometry_get(core_item[i]);
|
||||
|
||||
ck_assert_int_eq(r.x, 1);
|
||||
ck_assert_int_eq(r.y, 21+(i - 1)*40);
|
||||
ck_assert_int_eq(r.y, 22+(i - 1)*40);
|
||||
ck_assert_int_eq(r.w, 183); // 200 - 2px border - X for the width of the scrollbar.
|
||||
ck_assert_int_eq(r.h, 40);
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ EFL_START_TEST(placement_test_group)
|
|||
r = efl_gfx_entity_geometry_get(core_item[i]);
|
||||
|
||||
ck_assert_int_eq(r.x, 1);
|
||||
ck_assert_int_eq(r.y, 1+(i-2)*40);
|
||||
ck_assert_int_eq(r.y, 2+(i-2)*40);
|
||||
ck_assert_int_eq(r.w, 183); // 200 - 2px border - X for the width of the scrollbar.
|
||||
ck_assert_int_eq(r.h, 40);
|
||||
}
|
||||
|
|
|
@ -144,7 +144,58 @@ EFL_START_TEST(efl_ui_test_scroller_events)
|
|||
}
|
||||
EFL_END_TEST
|
||||
|
||||
EFL_START_TEST(efl_ui_test_scroller_scrollbar)
|
||||
{
|
||||
Eo *sc;
|
||||
|
||||
Eo *win = win_add();
|
||||
Eina_Bool hbar_visible = EINA_FALSE, vbar_visible = EINA_FALSE;
|
||||
efl_gfx_entity_size_set(win, EINA_SIZE2D(500, 500));
|
||||
|
||||
sc = efl_add(EFL_UI_SCROLLER_CLASS, win,
|
||||
efl_ui_scrollbar_bar_mode_set(efl_added, EFL_UI_SCROLLBAR_MODE_AUTO, EFL_UI_SCROLLBAR_MODE_AUTO),
|
||||
efl_content_set(win, efl_added));
|
||||
|
||||
/*Scrollbar auto mode test.*/
|
||||
efl_loop_iterate(efl_main_loop_get());
|
||||
|
||||
efl_ui_scrollbar_bar_visibility_get(sc, &hbar_visible, &vbar_visible);
|
||||
ck_assert(hbar_visible == EINA_FALSE);
|
||||
ck_assert(vbar_visible == EINA_FALSE);
|
||||
|
||||
/*Scrollbar auto mode test.*/
|
||||
efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas_object_evas_get(sc),
|
||||
efl_gfx_entity_size_set(efl_added, EINA_SIZE2D(5000, 5000)),
|
||||
efl_content_set(sc, efl_added));
|
||||
|
||||
efl_loop_iterate(efl_main_loop_get());
|
||||
|
||||
efl_ui_scrollbar_bar_visibility_get(sc, &hbar_visible, &vbar_visible);
|
||||
ck_assert(hbar_visible == EINA_TRUE);
|
||||
ck_assert(vbar_visible == EINA_TRUE);
|
||||
|
||||
/*Scrollbar off mode test.*/
|
||||
efl_ui_scrollbar_bar_mode_set(sc, EFL_UI_SCROLLBAR_MODE_OFF, EFL_UI_SCROLLBAR_MODE_OFF);
|
||||
|
||||
efl_loop_iterate(efl_main_loop_get());
|
||||
|
||||
efl_ui_scrollbar_bar_visibility_get(sc, &hbar_visible, &vbar_visible);
|
||||
ck_assert(hbar_visible == EINA_FALSE);
|
||||
ck_assert(vbar_visible == EINA_FALSE);
|
||||
|
||||
/*Scrollbar on mode test.*/
|
||||
efl_ui_scrollbar_bar_mode_set(sc, EFL_UI_SCROLLBAR_MODE_ON, EFL_UI_SCROLLBAR_MODE_ON);
|
||||
|
||||
efl_loop_iterate(efl_main_loop_get());
|
||||
|
||||
efl_ui_scrollbar_bar_visibility_get(sc, &hbar_visible, &vbar_visible);
|
||||
ck_assert(hbar_visible == EINA_TRUE);
|
||||
ck_assert(vbar_visible == EINA_TRUE);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
void efl_ui_test_scroller(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, efl_ui_test_scroller_events);
|
||||
tcase_add_test(tc, efl_ui_test_scroller_scrollbar);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue