Exactness: Removed useless bin dir. Merging that into elm_test.

SVN revision: 67934
devs/tasn/jenkins
Tom Hacohen 11 years ago
parent bb8a3bfc46
commit f51a7e4835
  1. 1
      configure.ac
  2. 2
      src/Makefile.am
  3. 69
      src/bin/Makefile.am
  4. 338
      src/bin/test_3d.c
  5. 175
      src/bin/test_actionslider.c
  6. 275
      src/bin/test_anchorblock.c
  7. 148
      src/bin/test_anchorview.c
  8. 194
      src/bin/test_bg.c
  9. 393
      src/bin/test_box.c
  10. 155
      src/bin/test_bubble.c
  11. 206
      src/bin/test_button.c
  12. 144
      src/bin/test_calendar.c
  13. 76
      src/bin/test_check.c
  14. 239
      src/bin/test_clock.c
  15. 89
      src/bin/test_colorselector.c
  16. 200
      src/bin/test_conform.c
  17. 240
      src/bin/test_ctxpopup.c
  18. 335
      src/bin/test_diskselector.c
  19. 1673
      src/bin/test_entry.c
  20. 281
      src/bin/test_fileselector.c
  21. 227
      src/bin/test_fileselector_button.c
  22. 236
      src/bin/test_fileselector_entry.c
  23. 611
      src/bin/test_flip.c
  24. 914
      src/bin/test_flip_page.c
  25. 107
      src/bin/test_flipselector.c
  26. 371
      src/bin/test_focus.c
  27. 472
      src/bin/test_gengrid.c
  28. 2003
      src/bin/test_genlist.c
  29. 626
      src/bin/test_glview.c
  30. 282
      src/bin/test_glview_simple.c
  31. 176
      src/bin/test_grid.c
  32. 162
      src/bin/test_hover.c
  33. 190
      src/bin/test_hoversel.c
  34. 31
      src/bin/test_icon.c
  35. 98
      src/bin/test_icon_desktops.c
  36. 350
      src/bin/test_index.c
  37. 114
      src/bin/test_inwin.c
  38. 68
      src/bin/test_label.c
  39. 906
      src/bin/test_launcher.c
  40. 74
      src/bin/test_layout.c
  41. 1000
      src/bin/test_list.c
  42. 121
      src/bin/test_menu.c
  43. 241
      src/bin/test_naviframe.c
  44. 295
      src/bin/test_notify.c
  45. 320
      src/bin/test_pager.c
  46. 253
      src/bin/test_panel.c
  47. 107
      src/bin/test_panes.c
  48. 199
      src/bin/test_progressbar.c
  49. 94
      src/bin/test_radio.c
  50. 114
      src/bin/test_scaling.c
  51. 260
      src/bin/test_scroller.c
  52. 96
      src/bin/test_segment_control.c
  53. 66
      src/bin/test_separator.c
  54. 190
      src/bin/test_slider.c
  55. 204
      src/bin/test_slideshow.c
  56. 81
      src/bin/test_spinner.c
  57. 340
      src/bin/test_table.c
  58. 85
      src/bin/test_toggle.c
  59. 699
      src/bin/test_toolbar.c
  60. 600
      src/bin/test_tooltip.c
  61. 590
      src/bin/test_transit.c
  62. 698
      src/bin/tsuite.c
  63. 61
      src/bin/tsuite.h

@ -42,7 +42,6 @@ PKG_CHECK_MODULES([EFL],
AC_OUTPUT([
Makefile
src/Makefile
src/bin/Makefile
src/lib/Makefile
src/scripts/Makefile
data/Makefile

@ -1,4 +1,4 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = bin lib scripts
SUBDIRS = lib scripts

@ -1,69 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib \
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
-DLOCALE_DIR=\"$(datadir)/locale\" \
@EFL_CFLAGS@
bin_PROGRAMS = exactness_raw
exactness_raw_SOURCES = \
tsuite.c \
../lib/tsuite_file_data.c \
test_3d.c \
test_actionslider.c \
test_panel.c \
test_anchorblock.c \
test_panes.c \
test_anchorview.c \
test_focus.c \
test_bg.c \
test_gengrid.c \
test_box.c \
test_genlist.c \
test_progressbar.c \
test_bubble.c \
test_radio.c \
test_button.c \
test_scaling.c \
test_calendar.c \
test_grid.c \
test_segment_control.c \
test_check.c \
test_hover.c \
test_separator.c \
test_hoversel.c \
test_slider.c \
test_colorselector.c \
test_conform.c \
test_spinner.c \
test_ctxpopup.c \
test_index.c \
test_table.c \
test_inwin.c \
test_diskselector.c \
test_label.c \
test_toggle.c \
test_entry.c \
test_toolbar.c \
test_fileselector_button.c \
test_tooltip.c \
test_fileselector.c \
test_list.c \
test_fileselector_entry.c \
test_menu.c \
test_naviframe.c \
test_notify.c \
test_scroller.c \
test_pager.c
exactness_raw_LDADD = @EFL_LIBS@
EXTRA_DIST = \
tsuite.h

@ -1,338 +0,0 @@
#include <Elementary.h>
#include "tsuite.h"
typedef struct _Point
{
Evas_Coord x, y, z, u, v;
} Point;
typedef struct _Side
{
Evas_Object *o;
Point pt[4];
} Side;
typedef struct _Cube
{
Side side[6];
} Cube;
static Cube *cube;
static double rotx = 0.0, roty = 0.0, rotz = 0.0;
static double cxo = 0.0, cyo = 0.0, focv = 256.0, z0v = 0.0;
#define POINT(n, p, xx, yy, zz, uu, vv) \
c->side[n].pt[p].x = xx; \
c->side[n].pt[p].y = yy; \
c->side[n].pt[p].z = zz; \
c->side[n].pt[p].u = uu; \
c->side[n].pt[p].v = vv
static Cube *
_cube_new(Evas *evas, Evas_Coord w, Evas_Coord h, Evas_Coord d)
{
Cube *c;
int i;
w -= (w / 2);
h -= (h / 2);
d -= (d / 2);
c = calloc(1, sizeof(Cube));
for (i = 0; i < 6; i++)
{
Evas_Object *o;
char buf[PATH_MAX];
o = evas_object_image_add(evas);
c->side[i].o = o;
snprintf(buf, sizeof(buf), "%s/images/%s",
elm_app_data_dir_get(), "twofish.jpg");
evas_object_image_file_set(o, buf, NULL);
evas_object_image_fill_set(o, 0, 0, 256, 256);
evas_object_resize(o, 256, 256);
evas_object_image_smooth_scale_set(o, 0);
evas_object_show(o);
}
POINT(0, 0, -w, -h, -d, 0, 0);
POINT(0, 1, w, -h, -d, 256, 0);
POINT(0, 2, w, h, -d, 256, 256);
POINT(0, 3, -w, h, -d, 0, 256);
POINT(1, 0, w, -h, -d, 0, 0);
POINT(1, 1, w, -h, d, 256, 0);
POINT(1, 2, w, h, d, 256, 256);
POINT(1, 3, w, h, -d, 0, 256);
POINT(2, 0, w, -h, d, 0, 0);
POINT(2, 1, -w, -h, d, 256, 0);
POINT(2, 2, -w, h, d, 256, 256);
POINT(2, 3, w, h, d, 0, 256);
POINT(3, 0, -w, -h, d, 0, 0);
POINT(3, 1, -w, -h, -d, 256, 0);
POINT(3, 2, -w, h, -d, 256, 256);
POINT(3, 3, -w, h, d, 0, 256);
POINT(4, 0, -w, -h, d, 0, 0);
POINT(4, 1, w, -h, d, 256, 0);
POINT(4, 2, w, -h, -d, 256, 256);
POINT(4, 3, -w, -h, -d, 0, 256);
POINT(5, 0, -w, h, -d, 0, 0);
POINT(5, 1, w, h, -d, 256, 0);
POINT(5, 2, w, h, d, 256, 256);
POINT(5, 3, -w, h, d, 0, 256);
return c;
}
static void
_cube_pos(Cube *c,
Evas_Coord x, Evas_Coord y, Evas_Coord z,
double dx, double dy, double dz,
Evas_Coord cx, Evas_Coord cy, Evas_Coord foc, Evas_Coord z0)
{
Evas_Map *m;
int i, j, order[6], sorted;
Evas_Coord mz[6];
m = evas_map_new(4);
evas_map_smooth_set(m, 0);
for (i = 0; i < 6; i++)
{
Evas_Coord tz[4];
for (j = 0; j < 4; j++)
{
evas_map_point_coord_set(m, j,
c->side[i].pt[j].x + x,
c->side[i].pt[j].y + y,
c->side[i].pt[j].z + z);
evas_map_point_image_uv_set(m, j,
c->side[i].pt[j].u,
c->side[i].pt[j].v);
evas_map_point_color_set(m, j, 255, 255, 255, 255);
}
evas_map_util_3d_rotate(m, dx, dy, dz, x, y, z);
evas_map_util_3d_lighting(m, -1000, -1000, -1000,
255, 255, 255,
20, 20, 20);
evas_map_util_3d_perspective(m, cx, cy, foc, z0);
if (evas_map_util_clockwise_get(m))
{
evas_object_map_enable_set(c->side[i].o, 1);
evas_object_map_set(c->side[i].o, m);
evas_object_show(c->side[i].o);
}
else
evas_object_hide(c->side[i].o);
order[i] = i;
for (j = 0; j < 4; j++)
evas_map_point_coord_get(m, j, NULL, NULL, &(tz[j]));
mz[i] = (tz[0] + tz[1] + tz[2] + tz[3]) / 4;
}
sorted = 0;
do
{
sorted = 1;
for (i = 0; i < 5; i++)
{
if (mz[order[i]] > mz[order[i + 1]])
{
j = order[i];
order[i] = order[i + 1];
order[i + 1] = j;
sorted = 0;
}
}
}
while (!sorted);
evas_object_raise(c->side[order[0]].o);
for (i = 1; i < 6; i++)
evas_object_stack_below(c->side[order[i]].o, c->side[order[i - 1]].o);
evas_map_free(m);
}
/*
static void
_cube_free(Cube *c)
{
int i;
for (i = 0; i < 6; i++) evas_object_del(c->side[i].o);
free(c);
}
*/
static void
_cube_update(Evas_Object *win, Cube *c)
{
Evas_Coord w, h;
evas_object_geometry_get(win, NULL, NULL, &w, &h);
_cube_pos(c,
(w / 2), (h / 2), 512,
rotx, roty, rotz,
(w / 2) + cxo, (h / 2) + cyo, z0v, focv);
}
void
_ch_rot_x(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
Evas_Object *win = data;
rotx = elm_slider_value_get(obj);
_cube_update(win, cube);
}
void
_ch_rot_y(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
Evas_Object *win = data;
roty = elm_slider_value_get(obj);
_cube_update(win, cube);
}
void
_ch_rot_z(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
Evas_Object *win = data;
rotz = elm_slider_value_get(obj);
_cube_update(win, cube);
}
void
_ch_cx(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
Evas_Object *win = data;
cxo = elm_slider_value_get(obj);
_cube_update(win, cube);
}
void
_ch_cy(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
Evas_Object *win = data;
cyo = elm_slider_value_get(obj);
_cube_update(win, cube);
}
void
_ch_foc(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
Evas_Object *win = data;
focv = elm_slider_value_get(obj);
_cube_update(win, cube);
}
void
_ch_z0(void *data, Evas_Object *obj, void *event_info __UNUSED__)
{
Evas_Object *win = data;
z0v = elm_slider_value_get(obj);
_cube_update(win, cube);
}
TEST_START(test_3d)
{
Evas_Object *bg, *bx, *sl;
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
cube = _cube_new(evas_object_evas_get(win), 240, 240, 240);
bx = elm_box_add(win);
evas_object_layer_set(bx, 10);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bx);
evas_object_show(bx);
sl = elm_slider_add(win);
elm_object_text_set(sl, "Rot X");
elm_slider_unit_format_set(sl, "%1.0f units");
elm_slider_span_size_set(sl, 360);
elm_slider_min_max_set(sl, 0, 360);
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_box_pack_end(bx, sl);
evas_object_smart_callback_add(sl, "changed", _ch_rot_x, win);
evas_object_show(sl);
sl = elm_slider_add(win);
elm_object_text_set(sl, "Rot Y");
elm_slider_unit_format_set(sl, "%1.0f units");
elm_slider_span_size_set(sl, 360);
elm_slider_min_max_set(sl, 0, 360);
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_box_pack_end(bx, sl);
evas_object_smart_callback_add(sl, "changed", _ch_rot_y, win);
evas_object_show(sl);
sl = elm_slider_add(win);
elm_object_text_set(sl, "Rot Z");
elm_slider_unit_format_set(sl, "%1.0f units");
elm_slider_span_size_set(sl, 360);
elm_slider_min_max_set(sl, 0, 360);
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_box_pack_end(bx, sl);
evas_object_smart_callback_add(sl, "changed", _ch_rot_z, win);
evas_object_show(sl);
sl = elm_slider_add(win);
elm_object_text_set(sl, "CX Off");
elm_slider_unit_format_set(sl, "%1.0f units");
elm_slider_span_size_set(sl, 360);
elm_slider_min_max_set(sl, -320, 320);
elm_slider_value_set(sl, cxo);
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_box_pack_end(bx, sl);
evas_object_smart_callback_add(sl, "changed", _ch_cx, win);
evas_object_show(sl);
sl = elm_slider_add(win);
elm_object_text_set(sl, "CY Off");
elm_slider_unit_format_set(sl, "%1.0f units");
elm_slider_span_size_set(sl, 360);
elm_slider_min_max_set(sl, -320, 320);
elm_slider_value_set(sl, cyo);
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_box_pack_end(bx, sl);
evas_object_smart_callback_add(sl, "changed", _ch_cy, win);
evas_object_show(sl);
sl = elm_slider_add(win);
elm_object_text_set(sl, "Foc");
elm_slider_unit_format_set(sl, "%1.0f units");
elm_slider_span_size_set(sl, 360);
elm_slider_min_max_set(sl, 1, 2000);
elm_slider_value_set(sl, focv);
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_box_pack_end(bx, sl);
evas_object_smart_callback_add(sl, "changed", _ch_foc, win);
evas_object_show(sl);
sl = elm_slider_add(win);
elm_object_text_set(sl, "Z0");
elm_slider_unit_format_set(sl, "%1.0f units");
elm_slider_span_size_set(sl, 360);
elm_slider_min_max_set(sl, -2000, 2000);
elm_slider_value_set(sl, z0v);
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_box_pack_end(bx, sl);
evas_object_smart_callback_add(sl, "changed", _ch_z0, win);
evas_object_show(sl);
evas_object_resize(win, 480, 480);
_cube_update(win, cube);
evas_object_show(win);
}
TEST_END

@ -1,175 +0,0 @@
#include <Elementary.h>
#include "tsuite.h"
static void _pos_selected_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info)
{
printf("Selection: %s\n", (char *)event_info);
printf("Label selected: %s\n", elm_actionslider_selected_label_get(obj));
}
static void
_position_change_magnetic_cb(void *data __UNUSED__, Evas_Object * obj, void *event_info)
{
if (!strcmp((char *)event_info, "left"))
elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_LEFT);
else if (!strcmp((char *)event_info, "right"))
elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_RIGHT);
}
static void
_magnet_enable_disable_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info)
{
if (!strcmp((char *)event_info, "left"))
elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_CENTER);
else if (!strcmp((char *)event_info, "right"))
elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_NONE);
}
enum _api_state
{
API_STATE_LAST
};
typedef enum _api_state api_state;
static void
set_api_state(api_data *api)
{
switch(api->state)
{ /* Put all api-changes under switch */
case API_STATE_LAST:
break;
default:
return;
}
}
static void
_api_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{ /* Will add here a SWITCH command containing code to modify test-object */
/* in accordance a->state value. */
api_data *a = data;
char str[128];
printf("clicked event on API Button: api_state=<%d>\n", a->state);
a->state++;
set_api_state(a);
sprintf(str, "Next API function (%u)", a->state);
elm_object_text_set(a->bt, str);
elm_object_disabled_set(a->bt, a->state == API_STATE_LAST);
}
TEST_START(test_actionslider)
{
Evas_Object *bg, *bx, *as;
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, 0);
evas_object_show(bg);
bx = elm_box_add(win);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0);
elm_win_resize_object_add(win, bx);
evas_object_show(bx);
api->bt = elm_button_add(win);
elm_object_text_set(api->bt, "Next API function");
evas_object_smart_callback_add(api->bt, "clicked", _api_bt_clicked, (void *) api);
elm_box_pack_end(bx, api->bt);
elm_object_disabled_set(api->bt, api->state == API_STATE_LAST);
evas_object_show(api->bt);
as = elm_actionslider_add(win);
evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_RIGHT);
elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_RIGHT);
elm_object_part_text_set(as, "left", "Snooze");
elm_object_part_text_set(as, "center", NULL);
elm_object_part_text_set(as, "right", "Stop");
elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_LEFT |
ELM_ACTIONSLIDER_RIGHT);
evas_object_smart_callback_add(as, "pos_changed",
_position_change_magnetic_cb, NULL);
evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
evas_object_show(as);
elm_box_pack_end(bx, as);
as = elm_actionslider_add(win);
evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_CENTER);
elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER);
elm_object_part_text_set(as, "left", "Snooze");
elm_object_part_text_set(as, "center", NULL);
elm_object_part_text_set(as, "right", "Stop");
elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_LEFT |
ELM_ACTIONSLIDER_RIGHT);
evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
evas_object_show(as);
elm_box_pack_end(bx, as);
as = elm_actionslider_add(win);
elm_object_style_set(as, "bar");
evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT);
elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER|
ELM_ACTIONSLIDER_RIGHT);
elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_CENTER |
ELM_ACTIONSLIDER_RIGHT);
elm_object_part_text_set(as, "left", NULL);
elm_object_part_text_set(as, "center", "Accept");
elm_object_part_text_set(as, "right", "Reject");
evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
evas_object_show(as);
elm_box_pack_end(bx, as);
as = elm_actionslider_add(win);
elm_object_style_set(as, "bar");
evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT);
elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_LEFT);
elm_object_part_text_set(as, "left", NULL);
elm_object_part_text_set(as, "center", "Accept");
elm_object_part_text_set(as, "right", "Reject");
elm_object_text_set(as, "Go");
evas_object_smart_callback_add(as, "pos_changed",
_position_change_magnetic_cb, NULL);
evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
evas_object_show(as);
elm_box_pack_end(bx, as);
as = elm_actionslider_add(win);
evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT);
elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_ALL);
elm_object_part_text_set(as, "left", "Left");
elm_object_part_text_set(as, "center", "Center");
elm_object_part_text_set(as, "right", "Right");
elm_object_text_set(as, "Go");
evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
evas_object_show(as);
elm_box_pack_end(bx, as);
as = elm_actionslider_add(win);
evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_CENTER);
elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER);
elm_object_part_text_set(as, "left", "Enable");
elm_object_part_text_set(as, "center", "Magnet");
elm_object_part_text_set(as, "right", "Disable");
evas_object_smart_callback_add(as, "pos_changed",
_magnet_enable_disable_cb, NULL);
evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
evas_object_show(as);
elm_box_pack_end(bx, as);
evas_object_resize(win, 320, 400);
evas_object_show(win);
}
TEST_END

@ -1,275 +0,0 @@
#include <Elementary.h>
#include "tsuite.h"
static void
_print_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
printf("bubble clicked\n");
}
static void
my_anchorblock_bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *av = data;
elm_anchorblock_hover_end(av);
}
static void
my_anchorblock_anchor(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *av = data;
Elm_Entry_Anchorblock_Info *ei = event_info;
Evas_Object *bt, *bx;
bt = elm_button_add(obj);
elm_object_text_set(bt, ei->name);
elm_hover_content_set(ei->hover, "middle", bt);
evas_object_show(bt);
// hints as to where we probably should put hover contents (buttons etc.).
if (ei->hover_top)
{
bx = elm_box_add(obj);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Top 1");
elm_box_pack_end(bx, bt);
evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
evas_object_show(bt);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Top 2");
elm_box_pack_end(bx, bt);
evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
evas_object_show(bt);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Top 3");
elm_box_pack_end(bx, bt);
evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
evas_object_show(bt);
elm_hover_content_set(ei->hover, "top", bx);
evas_object_show(bx);
}
if (ei->hover_bottom)
{
bt = elm_button_add(obj);
elm_object_text_set(bt, "Bot");
elm_hover_content_set(ei->hover, "bottom", bt);
evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
evas_object_show(bt);
}
if (ei->hover_left)
{
bt = elm_button_add(obj);
elm_object_text_set(bt, "Left");
elm_hover_content_set(ei->hover, "left", bt);
evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
evas_object_show(bt);
}
if (ei->hover_right)
{
bt = elm_button_add(obj);
elm_object_text_set(bt, "Right");
elm_hover_content_set(ei->hover, "right", bt);
evas_object_smart_callback_add(bt, "clicked", my_anchorblock_bt, av);
evas_object_show(bt);
}
}
static void
my_anchorblock_edge_left(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
printf("left\n");
}
static void
my_anchorblock_edge_right(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
printf("right\n");
}
static void
my_anchorblock_edge_top(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
printf("top\n");
}
static void
my_anchorblock_edge_bottom(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
printf("bottom\n");
}
static void
my_anchorblock_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Evas_Coord x, y, w, h, vw, vh;
elm_scroller_region_get(obj, &x, &y, &w, &h);
elm_scroller_child_size_get(obj, &vw, &vh);
printf("scroll %ix%i +%i+%i in %ix%i\n", w, h, x, y, vw, vh);
}
enum _api_state
{
API_STATE_LAST
};
typedef enum _api_state api_state;
static void
set_api_state(api_data *api)
{
switch(api->state)
{ /* Put all api-changes under switch */
case API_STATE_LAST:
break;
default:
return;
}
}
static void
_api_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{ /* Will add here a SWITCH command containing code to modify test-object */
/* in accordance a->state value. */
api_data *a = data;
char str[128];
printf("clicked event on API Button: api_state=<%d>\n", a->state);
a->state++;
set_api_state(a);
sprintf(str, "Next API function (%u)", a->state);
elm_object_text_set(a->bt, str);
elm_object_disabled_set(a->bt, a->state == API_STATE_LAST);
}
TEST_START(test_anchorblock)
{
Evas_Object *bg, *av, *sc, *bx, *bb, *ic;
char buf[PATH_MAX];
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
sc = elm_scroller_add(win);
evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, sc);
evas_object_smart_callback_add(sc, "edge_left", my_anchorblock_edge_left, NULL);
evas_object_smart_callback_add(sc, "edge_right", my_anchorblock_edge_right, NULL);
evas_object_smart_callback_add(sc, "edge_top", my_anchorblock_edge_top, NULL);
evas_object_smart_callback_add(sc, "edge_bottom", my_anchorblock_edge_bottom, NULL);
evas_object_smart_callback_add(sc, "scroll", my_anchorblock_scroll, NULL);
bx = elm_box_add(win);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
api->bt = elm_button_add(win);
elm_object_text_set(api->bt, "Next API function");
evas_object_smart_callback_add(api->bt, "clicked", _api_bt_clicked, (void *) api);
elm_box_pack_end(bx, api->bt);
elm_object_disabled_set(api->bt, api->state == API_STATE_LAST);
evas_object_show(api->bt);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
elm_icon_file_set(ic, buf, NULL);
elm_icon_scale_set(ic, 0, 0);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
bb = elm_bubble_add(win);
elm_object_text_set(bb, "Message 3");
elm_object_part_text_set(bb, "info", "10:32 4/11/2008");
elm_object_part_content_set(bb, "icon", ic);
evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
av = elm_anchorblock_add(win);
elm_anchorblock_hover_style_set(av, "popout");
elm_anchorblock_hover_parent_set(av, win);
elm_object_text_set(av,
"Hi there. This is the most recent message in the "
"list of messages. It has one <a href=tel:+614321234>+61 432 1234</a> "
"(phone number) to click on.");
evas_object_smart_callback_add(av, "anchor,clicked",
my_anchorblock_anchor, av);
elm_object_content_set(bb, av);
evas_object_show(av);
elm_box_pack_end(bx, bb);
evas_object_show(bb);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
elm_icon_file_set(ic, buf, NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
bb = elm_bubble_add(win);
elm_object_text_set(bb, "Message 2");
elm_object_part_text_set(bb, "info", "7:16 27/10/2008");
elm_object_part_content_set(bb, "icon", ic);
evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
av = elm_anchorblock_add(win);
elm_anchorblock_hover_style_set(av, "popout");
elm_anchorblock_hover_parent_set(av, win);
elm_object_text_set(av,
"Hey what are you doing? This is the second last message "
"Hi there. This is the most recent message in the "
"list. It's a longer one so it can wrap more and "
"contains a <a href=contact:john>John</a> contact "
"link in it to test popups on links. The idea is that "
"all SMS's are scanned for things that look like phone "
"numbers or names that are in your contacts list, and "
"if they are, they become clickable links that pop up "
"a menus of obvious actions to perform on this piece "
"of information. This of course can be later explicitly "
"done by links maybe running local apps or even being "
"web URL's too that launch the web browser and point it "
"to that URL. <item relsize=16x16 vsize=full href=emoticon/omg></item>");
evas_object_smart_callback_add(av, "anchor,clicked", my_anchorblock_anchor, av);
elm_object_content_set(bb, av);
evas_object_show(av);
elm_box_pack_end(bx, bb);
evas_object_show(bb);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
elm_icon_file_set(ic, buf, NULL);
elm_icon_scale_set(ic, 0, 0);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
bb = elm_bubble_add(win);
elm_object_text_set(bb, "Message 1");
elm_object_part_text_set(bb, "info", "20:47 18/6/2008");
elm_object_part_content_set(bb, "icon", ic);
evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
av = elm_anchorblock_add(win);
elm_anchorblock_hover_style_set(av, "popout");
elm_anchorblock_hover_parent_set(av, win);
elm_object_text_set(av, "This is a short message. <item relsize=16x16 vsize=full href=emoticon/haha></item>");
evas_object_smart_callback_add(av, "anchor,clicked",
my_anchorblock_anchor, av);
elm_object_content_set(bb, av);
evas_object_show(av);
elm_box_pack_end(bx, bb);
evas_object_show(bb);
elm_object_content_set(sc, bx);
evas_object_show(bx);
evas_object_show(sc);
evas_object_resize(win, 320, 520);
elm_object_focus_set(win, EINA_TRUE);
evas_object_show(win);
}
TEST_END

@ -1,148 +0,0 @@
#include <Elementary.h>
#include "tsuite.h"
static void
my_anchorview_bt(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *av = data;
elm_anchorview_hover_end(av);
}
static void
my_anchorview_anchor(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *av = data;
Elm_Entry_Anchorview_Info *ei = event_info;
Evas_Object *bt, *bx;
bt = elm_button_add(obj);
elm_object_text_set(bt, ei->name);
elm_hover_content_set(ei->hover, "middle", bt);
evas_object_show(bt);
// hints as to where we probably should put hover contents (buttons etc.).
if (ei->hover_top)
{
bx = elm_box_add(obj);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Top 1");
elm_box_pack_end(bx, bt);
evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
evas_object_show(bt);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Top 2");
elm_box_pack_end(bx, bt);
evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
evas_object_show(bt);
bt = elm_button_add(obj);
elm_object_text_set(bt, "Top 3");
elm_box_pack_end(bx, bt);
evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
evas_object_show(bt);
elm_hover_content_set(ei->hover, "top", bx);
evas_object_show(bx);
}
if (ei->hover_bottom)
{
bt = elm_button_add(obj);
elm_object_text_set(bt, "Bot");
elm_hover_content_set(ei->hover, "bottom", bt);
evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
evas_object_show(bt);
}
if (ei->hover_left)
{
bt = elm_button_add(obj);
elm_object_text_set(bt, "Left");
elm_hover_content_set(ei->hover, "left", bt);
evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
evas_object_show(bt);
}
if (ei->hover_right)
{
bt = elm_button_add(obj);
elm_object_text_set(bt, "Right");
elm_hover_content_set(ei->hover, "right", bt);
evas_object_smart_callback_add(bt, "clicked", my_anchorview_bt, av);
evas_object_show(bt);
}
}
enum _api_state
{
API_STATE_LAST
};
typedef enum _api_state api_state;
static void
set_api_state(api_data *api)
{
switch(api->state)
{ /* Put all api-changes under switch */
case API_STATE_LAST:
break;
default:
return;
}
}
static void
_api_bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{ /* Will add here a SWITCH command containing code to modify test-object */
/* in accordance a->state value. */
api_data *a = data;
char str[128];
printf("clicked event on API Button: api_state=<%d>\n", a->state);
a->state++;
set_api_state(a);
sprintf(str, "Next API function (%u)", a->state);
elm_object_text_set(a->bt, str);
elm_object_disabled_set(a->bt, a->state == API_STATE_LAST);
}
TEST_START(test_anchorview)
{
Evas_Object *bg, *bx, *av;
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
bx = elm_box_add(win);
elm_win_resize_object_add(win, bx); /* Resize BOX to size of window */
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
api->bt = elm_button_add(win);
elm_object_text_set(api->bt, "Next API function");
evas_object_smart_callback_add(api->bt, "clicked", _api_bt_clicked, (void *) api);
elm_box_pack_end(bx, api->bt);
elm_object_disabled_set(api->bt, api->state == API_STATE_LAST);
evas_object_show(api->bt);
av = elm_anchorview_add(win);
elm_anchorview_hover_style_set(av, "popout");
elm_anchorview_hover_parent_set(av, win);
elm_object_text_set(av,
"This is an entry widget in this window that<br>"
"uses markup <b>like this</> for styling and<br>"
"formatting <em>like this</>, as well as<br>"
"<a href=X><link>links in the text</></a>, so enter text<br>"
"in here to edit it. By the way, links are<br>"
"called <a href=anc-02>Anchors</a> so you will need<br>"
"to refer to them this way. <item relsize=16x16 vsize=full href=emoticon/guilty-smile></item>");
evas_object_size_hint_weight_set(av, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(av, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(av, "anchor,clicked", my_anchorview_anchor, av);
elm_box_pack_end(bx, av);
evas_object_show(av);
evas_object_show(bx);
evas_object_resize(win, 320, 300);
elm_object_focus_set(win, EINA_TRUE);
evas_object_show(win);
}
TEST_END

@ -1,194 +0,0 @@
#include <Elementary.h>
#include "tsuite.h"
static void
_cb_radio_changed(void *data, Evas_Object *obj, void *event __UNUSED__)
{
Evas_Object *o_bg = data;
elm_bg_option_set(o_bg, elm_radio_value_get((Evas_Object *)obj));
}
static void
_cb_overlay_changed(void *data, Evas_Object *obj, void *event __UNUSED__)
{
Evas_Object *o_bg = data;
if (elm_check_state_get(obj))
{
Evas_Object *parent, *over;
char buff[PATH_MAX];
snprintf(buff, sizeof(buff), "%s/objects/test.edj", elm_app_data_dir_get());
parent = elm_object_parent_widget_get(o_bg);
over = edje_object_add(evas_object_evas_get(parent));
edje_object_file_set(over, buff, "bg_overlay");
elm_object_content_set(o_bg, over);
}
else
elm_object_content_set(o_bg, NULL);
}
static void
_cb_color_changed(void *data, Evas_Object *obj, void *event __UNUSED__)
{
Evas_Object *o_bg = data;
double val = 0.0;
val = elm_spinner_value_get(obj);
if (val == 1.0)
elm_bg_color_set(o_bg, 255, 255, 255);
else if (val == 2.0)
elm_bg_color_set(o_bg, 255, 0, 0);
else if (val == 3.0)
elm_bg_color_set(o_bg, 0, 0, 255);
else if (val == 4.0)
elm_bg_color_set(o_bg, 0, 255, 0);
}
TEST_START(test_bg_plain)
{
Evas_Object *bg;
bg = elm_bg_add(win);
/* allow bg to expand in x & y */
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bg);
evas_object_show(bg);
/* set size hints. a minimum size for the bg. this should propagate back
* to the window thus limiting its size based off the bg as the bg is one
* of the window's resize objects. */
evas_object_size_hint_min_set(bg, 160, 160);
/* and set a maximum size. not needed very often. normally used together
* with evas_object_size_hint_min_set() at the same size to make a
* window not resizable */
evas_object_size_hint_max_set(bg, 640, 640);
/* and now just resize the window to a size you want. normally widgets
* will determine the initial size though */
evas_object_resize(win, 320, 320);
/* and show the window */
evas_object_show(win);
}
TEST_END
TEST_START(test_bg_image)
{
Evas_Object *bg;
char buf[PATH_MAX];
bg = elm_bg_add(win);
snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
elm_bg_file_set(bg, buf, NULL);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bg);
evas_object_show(bg);
evas_object_size_hint_min_set(bg, 160, 160);
evas_object_size_hint_max_set(bg, 640, 640);
evas_object_resize(win, 320, 320);
evas_object_show(win);
}
TEST_END
TEST_START(test_bg_options)
{
Evas_Object *bg;
Evas_Object *box, *hbox, *o_bg;
Evas_Object *rd, *rdg;
char buf[PATH_MAX];
bg = elm_bg_add(win);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bg);
evas_object_show(bg);
box = elm_box_add(win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, box);
evas_object_show(box);
o_bg = elm_bg_add(win);
snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
elm_bg_file_set(o_bg, buf, NULL);
evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, o_bg);
evas_object_show(o_bg);
hbox = elm_box_add(win);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
rd = elm_radio_add(win);
elm_radio_state_value_set(rd, ELM_BG_OPTION_CENTER);
elm_object_text_set(rd, "Center");
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
elm_box_pack_end(hbox, rd);
evas_object_show(rd);
rdg = rd;
rd = elm_radio_add(win);
elm_radio_state_value_set(rd, ELM_BG_OPTION_SCALE);
elm_radio_group_add(rd, rdg);
elm_object_text_set(rd, "Scale");
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
elm_box_pack_end(hbox, rd);
evas_object_show(rd);
rd = elm_radio_add(win);
elm_radio_state_value_set(rd, ELM_BG_OPTION_STRETCH);
elm_radio_group_add(rd, rdg);
elm_object_text_set(rd, "Stretch");
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
elm_box_pack_end(hbox, rd);
evas_object_show(rd);
rd = elm_radio_add(win);
elm_radio_state_value_set(rd, ELM_BG_OPTION_TILE);
elm_radio_group_add(rd, rdg);
elm_object_text_set(rd, "Tile");
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
elm_box_pack_end(hbox, rd);
evas_object_show(rd);
elm_radio_value_set(rdg, ELM_BG_OPTION_SCALE);
rd = elm_check_add(win);
elm_object_text_set(rd, "Show Overlay");
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
evas_object_smart_callback_add(rd, "changed", _cb_overlay_changed, o_bg);
elm_box_pack_end(hbox, rd);
evas_object_show(rd);
/* color choices ... this is ghetto, but we don't have a 'colorpicker'
* widget yet :( */
rd = elm_spinner_add(win);
elm_object_style_set(rd, "vertical");
elm_spinner_min_max_set(rd, 1, 4);
elm_spinner_label_format_set(rd, "%.0f");
elm_spinner_editable_set(rd, EINA_FALSE);
elm_spinner_special_value_add(rd, 1, "White");
elm_spinner_special_value_add(rd, 2, "Red");
elm_spinner_special_value_add(rd, 3, "Blue");
elm_spinner_special_value_add(rd, 4, "Green");
evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(rd, "changed", _cb_color_changed, o_bg);
elm_box_pack_end(hbox, rd);
evas_object_show(rd);
elm_box_pack_end(box, hbox);
evas_object_show(hbox);
evas_object_size_hint_min_set(bg, 160, 160);
evas_object_size_hint_max_set(bg, 640, 640);
evas_object_resize(win, 320, 320);
evas_object_show(win);
}
TEST_END

@ -1,393 +0,0 @@
#include <Elementary.h>
#include "tsuite.h"
enum _api_state
{
BOX_PACK_START,
BOX_PACK_BEFORE,
BOX_PACK_AFTER,
BOX_PADDING_SET,
BOX_ALIGN_SET,
BOX_HOMOGENEOUS_SET,
BOX_UNPACK_ALL,
BOX_CLEAR,
API_STATE_LAST
};
typedef enum _api_state api_state;
static void
set_api_state(api_data *api)
{
const Eina_List *items = elm_box_children_get(api->data);
if(!eina_list_count(items))
return;
/* use elm_box_children_get() to get list of children */
switch(api->state)
{ /* Put all api-changes under switch */
case BOX_PACK_START: /* Move last item to begining */
elm_box_unpack(api->data, eina_list_data_get(eina_list_last(items)));
elm_box_pack_start(api->data, eina_list_data_get(eina_list_last(items)));
break;
case BOX_PACK_BEFORE:
if(eina_list_count(items) > 1)
{ /* Put last item before the one preceeding it */
elm_box_unpack(api->data, eina_list_data_get(eina_list_last(items)));
elm_box_pack_before(api->data,
eina_list_data_get(eina_list_last(items)),
eina_list_nth(items, eina_list_count(items)-2));
}
break;
case BOX_PACK_AFTER:
if(eina_list_count(items) > 1)
{ /* Put item before last to last */
elm_box_unpack(api->data, eina_list_nth(items,
eina_list_count(items)-2));
elm_box_pack_after(api->data,
eina_list_nth(items, eina_list_count(items)-2),
eina_list_data_get(eina_list_last(items)));
}
break;
case BOX_PADDING_SET:
elm_box_padding_set(api->data, 30, 15);
break;
case BOX_ALIGN_SET:
elm_box_align_set(api->data, 0.25, 0.75);
break;
case BOX_HOMOGENEOUS_SET:
elm_box_homogeneous_set(api->data, EINA_TRUE);
break;
case BOX_UNPACK_ALL:
{
Eina_List *l;
Evas_Object *data;
elm_box_unpack_all(api->data);
EINA_LIST_REVERSE_FOREACH(items, l, data)
elm_box_pack_end(api->data, data);
}
break;
case BOX_CLEAR:
elm_box_clear(api->data);
break;
case API_STATE_LAST:
break;
default:
return;