Jonathan Atton (Watchwolf) <jonathan.atton@gmail.com>
Brian Wang <brian.wang.0721@gmail.com>
Mike Blumenkrantz (zmike) <mike@zentific.com>
+Saumsung Electronics <tbd>
+Samsung SAIT <tbd>
-# get rid of that stupid cache mechanism
-rm -f config.cache
-
-AC_INIT([elementary], [0.6.0.063], [enlightenment-devel@lists.sourceforge.net])
-release="ver-pre-svn-05"
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+m4_define([v_maj], [0])
+m4_define([v_min], [7])
+m4_define([v_mic], [0])
+m4_define([v_rev], m4_esyscmd([(svnversion . | grep -v exported || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
+m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])
+##-- When released, remove the dnl on the below line
+dnl m4_undefine([v_rev])
+##-- When doing snapshots - change soname. remove dnl on below line
+m4_define([relname], [ver-pre-svn-06])
+m4_define([v_rel], [-release relname])
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+m4_ifdef([v_rev], [m4_define([v_ver], [v_maj.v_min.v_mic.v_rev])],
+[m4_define([v_ver], [v_maj.v_min.v_mic])])
+m4_define([lt_rev], m4_eval(v_maj + v_min))
+m4_define([lt_cur], v_mic)
+m4_define([lt_age], v_min)
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+
+AC_INIT([elementary], [v_ver], [enlightenment-devel@lists.sourceforge.net])
AC_PREREQ(2.52)
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
AC_PROG_LIBTOOL
-VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'`
-VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'`
-VMIC=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $3);}'`
-SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'`
-version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN"
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
+m4_ifdef([v_rel], , [m4_define([v_rel], [])])
+AC_DEFINE_UNQUOTED(VMAJ, [v_maj], [Major version])
+AC_DEFINE_UNQUOTED(VMIN, [v_min], [Minor version])
+AC_DEFINE_UNQUOTED(VMIC, [v_mic], [Micro version])
+AC_DEFINE_UNQUOTED(VREV, [v_rev], [Revison])
+version_info="lt_rev:lt_cur:lt_age"
+release_info="v_rel"
AC_SUBST(version_info)
+AC_SUBST(release_info)
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+VMAJ=v_maj
+VMIN=v_min
+AC_SUBST(VMAJ)
+AC_SUBST(VMIN)
case "$host_os" in
mingw32ce* | cegcc*)
MODULE_ARCH="$host_os-$host_cpu"
;;
*)
- release_info="-release $release"
- MODULE_ARCH="$host_os-$host_cpu-$release"
+ MODULE_ARCH="$host_os-$host_cpu-relname"
;;
esac
AC_SUBST(release_info)
ecore >= 0.9.9
ecore-evas >= 0.9.9
ecore-file >= 0.9.9
- edje >= 0.9.91
+ edje >= 0.9.9
]
)
alias: "elm/list/base/default";
alias: "elm/genlist/base/default";
alias: "elm/carousel/base/default";
- alias: "elm/grid/base/default";
+ alias: "elm/gengrid/base/default";
script {
public sbvis_v, sbvis_h, sbalways_v, sbalways_h, sbvis_timer;
program { name: "up";
signal: "mouse,down,1";
source: "t";
- action: SIGNAL_EMIT "elm,action,up" "";
+ action: SIGNAL_EMIT "elm,action,up,start" "";
+ }
+ program { name: "up,stop";
+ signal: "mouse,up,1";
+ source: "t";
+ action: SIGNAL_EMIT "elm,action,up,stop" "";
}
program { name: "down";
signal: "mouse,down,1";
source: "b";
- action: SIGNAL_EMIT "elm,action,down" "";
+ action: SIGNAL_EMIT "elm,action,down,start" "";
+ }
+ program { name: "down,stop";
+ signal: "mouse,up,1";
+ source: "b";
+ action: SIGNAL_EMIT "elm,action,down,stop" "";
}
}
}
program { name: "up";
signal: "mouse,down,1";
source: "t";
- action: SIGNAL_EMIT "elm,action,up" "";
+ action: SIGNAL_EMIT "elm,action,up,start" "";
+ }
+ program { name: "up,stop";
+ signal: "mouse,up,1";
+ source: "t";
+ action: SIGNAL_EMIT "elm,action,up,stop" "";
}
program { name: "down";
signal: "mouse,down,1";
source: "b";
- action: SIGNAL_EMIT "elm,action,down" "";
+ action: SIGNAL_EMIT "elm,action,down,start" "";
+ }
+ program { name: "down,stop";
+ signal: "mouse,up,1";
+ source: "b";
+ action: SIGNAL_EMIT "elm,action,down,stop" "";
}
}
}
}
///////////////////////////////////////////////////////////////////////////////
- group { name: "elm/grid/cell/default/default";
+ group { name: "elm/gengrid/item/default/default";
data.item: "labels" "elm.text";
data.item: "icons" "elm.swallow.icon elm.swallow.end";
images {
}
}
}
- group { name: "elm/grid/cell/default_style/default";
+ group { name: "elm/gengrid/item/default_style/default";
styles
{
- style { name: "grid_style";
+ style { name: "gengrid_style";
base: "font=Sans font_size=10 align=left valign=0.5 color=#000";
tag: "br" "\n";
tag: "hilight" "+ font=Sans:style=Bold";
tag: "b" "+ font=Sans:style=Bold";
tag: "tab" "\t";
}
- style { name: "grid_selected_style";
+ style { name: "gengrid_selected_style";
base: "font=Sans font_size=10 align=left valign=0.5 color=#fff";
tag: "br" "\n";
tag: "hilight" "+ font=Sans:style=Bold";
offset: -1 -5;
}
text {
- style: "grid_style";
+ style: "gengrid_style";
min: 1 1;
}
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
text {
- style: "grid_selected_style";
+ style: "gengrid_selected_style";
}
}
}
}
}
+ group {
+ name: "elm/panel/base/right";
+ images
+ {
+ image: "bt_base1.png" COMP;
+ image: "bt_hilight.png" COMP;
+ image: "bt_shine.png" COMP;
+ image: "bt_glow.png" COMP;
+ image: "bt_dis_base.png" COMP;
+ image: "icon_arrow_left.png" COMP;
+ image: "icon_arrow_right.png" COMP;
+ }
+ parts
+ {
+ part
+ {
+ name: "bg";
+ type: RECT;
+ mouse_events: 0;
+ description
+ {
+ state: "default" 0.0;
+ color: 255 255 255 0;
+ rel1.relative: 1 0;
+ rel2.offset: -31 0;
+ }
+ description
+ {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ rel1.relative: 0 0;
+ }
+ }
+ part
+ {
+ name: "base";
+ type: IMAGE;
+ mouse_events: 0;
+ description
+ {
+ state: "default" 0.0;
+ rel1
+ {
+ offset: 20 0;
+ to_x: "bg";
+ }
+ rel2.offset: -1 -1;
+ image
+ {
+ normal: "bt_dis_base.png";
+ border: 4 4 4 4;
+ }
+ }
+ }
+ part
+ {
+ name: "clipper";
+ type: RECT;
+ mouse_events: 0;
+ description
+ {
+ state: "default" 0.0;
+ rel1
+ {
+ offset: 4 4;
+ to: "base";
+ }
+ rel2
+ {
+ offset: -5 -5;
+ to: "base";
+ }
+ }
+ }
+ part
+ {
+ name: "elm.swallow.content";
+ type: SWALLOW;
+ clip_to: "clipper";
+ description
+ {
+ state: "default" 0.0;
+ rel1.to: "clipper";
+ rel2.to: "clipper";
+ }
+ }
+ part
+ {
+ name: "btn";
+ type: IMAGE;
+ mouse_events: 1;
+ description
+ {
+ state: "default" 0.0;
+ max: 32 48;
+ fixed: 1 1;
+ align: 1 0.5;
+ rel1
+ {
+ to_x: "bg";
+ }
+ rel2
+ {
+ offset: 2 0;
+ relative: 0.0 1;
+ to_x: "base";
+ }
+ image
+ {
+ normal: "bt_base1.png";
+ border: 5 0 4 12;
+ }
+ fill.smooth: 0;
+ }
+ description
+ {
+ state: "clicked" 0.0;
+ inherit: "default" 0.0;
+ }
+ }
+ part
+ {
+ name: "btn_over";
+ type: IMAGE;
+ mouse_events: 0;
+ description
+ {
+ state: "default" 0.0;
+ rel1.to: "btn";
+ rel2
+ {
+ relative: 1.0 0.5;
+ to: "btn";
+ }
+ image
+ {
+ normal: "bt_hilight.png";
+ border: 7 0 7 0;
+ }
+ }
+ }
+ part
+ {
+ name: "btn_over2";
+ type: IMAGE;
+ mouse_events: 1;
+ repeat_events: 1;
+ ignore_flags: ON_HOLD;
+ description
+ {
+ state: "default" 0.0;
+ rel1.to: "btn";
+ rel2.to: "btn";
+ image
+ {
+ normal: "bt_shine.png";
+ border: 7 0 7 7;
+ }
+ }
+ }
+ part
+ {
+ name: "btn_over3";
+ type: IMAGE;
+ mouse_events: 1;
+ repeat_events: 1;
+ description
+ {
+ state: "default" 0.0;
+ color: 255 255 255 0;
+ rel1.to: "btn";
+ rel2.to: "btn";
+ image
+ {
+ normal: "bt_glow.png";
+ border: 12 12 12 12;
+ }
+ fill.smooth: 0;
+ }
+ description
+ {
+ state: "clicked" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ color: 255 255 255 255;
+ }
+ }
+ part
+ {
+ name: "btn_icon";
+ type: IMAGE;
+ repeat_events: 1;
+ description
+ {
+ state: "default" 0.0;
+ rel1.to: "btn";
+ rel2.to: "btn";
+ align: 0.5 0.5;
+ min: 16 16;
+ max: 16 16;
+ image.normal: "icon_arrow_left.png";
+ }
+ description
+ {
+ state: "visible" 0.0;
+ inherit: "default" 0.0;
+ image.normal: "icon_arrow_right.png";
+ }
+ }
+ }
+ programs
+ {
+ program
+ {
+ name: "show";
+ signal: "elm,action,show";
+ source: "elm";
+ action: STATE_SET "visible" 0.0;
+ target: "bg";
+ target: "btn_icon";
+ transition: LINEAR 0.5;
+ }
+ program
+ {
+ name: "show2";
+ signal: "show";
+ action: STATE_SET "default" 0.0;
+ target: "bg";
+ target: "btn_icon";
+ after: "show3";
+ }
+ program
+ {
+ name: "show3";
+ action: STATE_SET "visible" 0.0;
+ target: "bg";
+ target: "btn_icon";
+ transition: LINEAR 0.5;
+ }
+ program
+ {
+ name: "hide";
+ signal: "elm,action,hide";
+ source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "bg";
+ target: "btn_icon";
+ transition: LINEAR 0.5;
+ }
+ program
+ {
+ name: "btn_click";
+ signal: "mouse,down,1";
+ source: "btn_over2";
+ action: STATE_SET "clicked" 0.0;
+ target: "btn";
+ }
+ program
+ {
+ name: "btn_unclick";
+ signal: "mouse,up,1";
+ source: "btn_over2";
+ action: STATE_SET "default" 0.0;
+ target: "btn";
+ }
+ program
+ {
+ name: "btn_click2";
+ signal: "mouse,down,1";
+ source: "btn_over3";
+ action: STATE_SET "clicked" 0.0;
+ target: "btn_over3";
+ }
+ program
+ {
+ name: "btn_unclick2";
+ signal: "mouse,up,1";
+ source: "btn_over3";
+ action: STATE_SET "default" 0.0;
+ transition: DECELERATE 0.5;
+ target: "btn_over3";
+ }
+ program
+ {
+ name: "btn_unclick3";
+ signal: "mouse,up,1";
+ source: "btn_over2";
+ action: SIGNAL_EMIT "elm,action,panel,toggle" "";
+ }
+ }
+ }
+
///////////////////////////////////////////////////////////////////////////////
group { name: "elm/conformant/base/default";
parts {
-Revision 48959
-Last Changed Rev 48945
+Revision 49550
+Last Changed Rev 49550
test_fileselector_button.c \
test_toggle.c \
test_table.c \
-test_grid.c \
+test_gengrid.c \
test_clock.c \
test_layout.c \
test_hover.c \
elm_separator_horizontal_set(sp, 1);
evas_object_size_hint_weight_set(sp, 1.0, 0.0);
evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
- elm_table_pack(base, sl, 0, 2, 2, 1);
+ elm_table_pack(base, sp, 0, 2, 2, 1);
evas_object_show(sp);
sl = elm_slider_add(win);
_exit_timer(void *data)
{
elm_exit();
+ return 0;
}
/* this is your elementary main function - it MUSt be called IMMEDIATELY
interactive = 0;
}
}
- /* put ere any init specific to this app like parsing args etc. */
+ /* put here any init specific to this app like parsing args etc. */
if (!quiet)
{
status_win(); /* create main window */
void test_genlist5(void *data, Evas_Object *obj, void *event_info);
void test_genlist6(void *data, Evas_Object *obj, void *event_info);
void test_table(void *data, Evas_Object *obj, void *event_info);
-void test_grid(void *data, Evas_Object *obj, void *event_info);
+void test_gengrid(void *data, Evas_Object *obj, void *event_info);
void test_pager(void *data, Evas_Object *obj, void *event_info);
void test_win_state(void *data, Evas_Object *obj, void *event_info);
void test_win_state2(void *data, Evas_Object *obj, void *event_info);
void test_scroller2(void *data, Evas_Object *obj, void *event_info);
void test_spinner(void *data, Evas_Object *obj, void *event_info);
void test_index(void *data, Evas_Object *obj, void *event_info);
+void test_index2(void *data, Evas_Object *obj, void *event_info);
void test_photocam(void *data, Evas_Object *obj, void *event_info);
void test_photo(void *data, Evas_Object *obj, void *event_info);
void test_thumb(void *data, Evas_Object *obj, void *event_info);
void test_weather(void *data, Evas_Object *obj, void *event_info);
void test_flip(void *data, Evas_Object *obj, void *event_info);
void test_flip2(void *data, Evas_Object *obj, void *event_info);
+void test_flip3(void *data, Evas_Object *obj, void *event_info);
void test_label(void *data, Evas_Object *obj, void *event_info);
void test_conformant(void *data, Evas_Object *obj, void *event_info);
void test_multi(void *data, Evas_Object *obj, void *event_info);
ADD_TEST("Genlist 4", test_genlist4);
ADD_TEST("Genlist 5", test_genlist5);
ADD_TEST("Genlist Tree", test_genlist6);
- ADD_TEST("Scrolled Grid", test_grid);
+ ADD_TEST("GenGrid", test_gengrid);
ADD_TEST("Checks", test_check);
ADD_TEST("Radios", test_radio);
ADD_TEST("Pager", test_pager);
ADD_TEST("Scroller 2", test_scroller2);
ADD_TEST("Spinner", test_spinner);
ADD_TEST("Index", test_index);
+ ADD_TEST("Index 2", test_index2);
ADD_TEST("Photocam", test_photocam);
ADD_TEST("Photo", test_photo);
ADD_TEST("Thumb", test_thumb);
ADD_TEST("Weather", test_weather);
ADD_TEST("Flip", test_flip);
ADD_TEST("Flip 2", test_flip2);
+ ADD_TEST("Flip 3", test_flip3);
ADD_TEST("Label", test_label);
ADD_TEST("Conformant", test_conformant);
ADD_TEST("Multi Touch", test_multi);
evas_object_resize(win, 320, 480);
evas_object_show(win);
}
+
+void
+test_flip3(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *win, *bg, *bx, *bx2, *bx3, *bx4, *bx5, *fl, *fl_f, *fl_b, *o,
+ *bt, *ly, *lb;
+ char buf[PATH_MAX];
+
+ win = elm_win_add(NULL, "flip flip", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Flip Flip");
+ elm_win_autodel_set(win, 1);
+
+ 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);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ fl = elm_flip_add(win);
+ evas_object_size_hint_align_set(fl, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(fl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, fl);
+
+ bx3 = elm_box_add(win);
+ evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bx3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(bx3);
+
+ fl_f = elm_flip_add(win);
+ evas_object_size_hint_align_set(fl_f, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(fl_f, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ bx5 = elm_box_add(win);
+ evas_object_size_hint_align_set(bx5, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bx5, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(bx5);
+
+ o = elm_bg_add(win);
+ evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ snprintf(buf, sizeof(buf), "%s/images/%s", PACKAGE_DATA_DIR, "sky_01.jpg");
+ elm_bg_file_set(o, buf, NULL);
+ evas_object_show(o);
+ elm_box_pack_end(bx5, o);
+
+ lb = elm_label_add(win);
+ evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0);
+ elm_label_label_set(lb, "Front Flip - Front");
+ evas_object_show(lb);
+ elm_box_pack_end(bx5, lb);
+
+ elm_flip_content_front_set(fl_f, bx5);
+
+ bx5 = elm_box_add(win);
+ evas_object_size_hint_align_set(bx5, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bx5, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(bx5);
+
+ o = elm_bg_add(win);
+ evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ snprintf(buf, sizeof(buf), "%s/images/%s", PACKAGE_DATA_DIR, "sky_02.jpg");
+ elm_bg_file_set(o, buf, NULL);
+ evas_object_show(o);
+ elm_box_pack_end(bx5, o);
+
+ lb = elm_label_add(win);
+ evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0);
+ elm_label_label_set(lb, "Front Flip - Back");
+ evas_object_show(lb);
+ elm_box_pack_end(bx5, lb);
+
+ elm_flip_content_back_set(fl_f, bx5);
+
+ evas_object_show(fl_f);
+ elm_box_pack_end(bx3, fl_f);
+
+ lb = elm_label_add(win);
+ evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0);
+ elm_label_label_set(lb, "Main Flip - Front");
+ evas_object_show(lb);
+ elm_box_pack_end(bx3, lb);
+
+ bx4 = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx4, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(bx4);
+
+ fl_b = elm_flip_add(win);
+ evas_object_size_hint_align_set(fl_b, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(fl_b, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ bx5 = elm_box_add(win);
+ evas_object_size_hint_align_set(bx5, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bx5, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(bx5);
+
+ o = elm_bg_add(win);
+ evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ snprintf(buf, sizeof(buf), "%s/images/%s", PACKAGE_DATA_DIR, "sky_03.jpg");
+ elm_bg_file_set(o, buf, NULL);
+ evas_object_show(o);
+ elm_box_pack_end(bx5, o);
+
+ lb = elm_label_add(win);
+ evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0);
+ elm_label_label_set(lb, "Back Flip - Front");
+ evas_object_show(lb);
+ elm_box_pack_end(bx5, lb);
+
+ elm_flip_content_front_set(fl_b, bx5);
+
+ bx5 = elm_box_add(win);
+ evas_object_size_hint_align_set(bx5, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bx5, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(bx5);
+
+ o = elm_bg_add(win);
+ evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ snprintf(buf, sizeof(buf), "%s/images/%s", PACKAGE_DATA_DIR, "sky_04.jpg");
+ elm_bg_file_set(o, buf, NULL);
+ evas_object_show(o);
+ elm_box_pack_end(bx5, o);
+
+ lb = elm_label_add(win);
+ evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0);
+ elm_label_label_set(lb, "Back Flip - Back");
+ evas_object_show(lb);
+ elm_box_pack_end(bx5, lb);
+
+ elm_flip_content_back_set(fl_b, bx5);
+
+ evas_object_show(fl_b);
+ elm_box_pack_end(bx4, fl_b);
+
+ lb = elm_label_add(win);
+ evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0);
+ elm_label_label_set(lb, "Main Flip - Back");
+ elm_box_pack_end(bx4, lb);
+ evas_object_show(lb);
+
+ elm_flip_content_front_set(fl, bx3);
+ elm_flip_content_back_set(fl, bx4);
+
+ evas_object_show(fl);
+
+ bx2 = elm_box_add(win);
+ elm_box_horizontal_set(bx2, 1);
+ evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
+
+ bt = elm_button_add(win);
+ elm_button_label_set(bt, "Main Flip");
+ evas_object_smart_callback_add(bt, "clicked", my_fl_1, fl);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
+ elm_box_pack_end(bx2, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_button_label_set(bt, "Front Flip");
+ evas_object_smart_callback_add(bt, "clicked", my_fl_1, fl_f);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
+ elm_box_pack_end(bx2, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_button_label_set(bt, "Back Flip");
+ evas_object_smart_callback_add(bt, "clicked", my_fl_1, fl_b);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
+ elm_box_pack_end(bx2, bt);
+ evas_object_show(bt);
+
+ elm_box_pack_end(bx, bx2);
+ evas_object_show(bx2);
+
+ evas_object_resize(win, 320, 480);
+ evas_object_show(win);
+}
#endif
--- /dev/null
+#include <Elementary.h>
+#ifndef ELM_LIB_QUICKLAUNCH
+typedef struct _Testitem
+{
+ Elm_Gengrid_Item *item;
+ const char *path;
+ int mode;
+ int onoff;
+} Testitem;
+
+static Elm_Gengrid_Item_Class gic;
+
+static void
+grid_drag_up(void *data, Evas_Object *obj, void *event_info)
+{
+ printf("Drag up: %p\n", event_info);
+}
+
+static void
+grid_drag_right(void *data, Evas_Object *obj, void *event_info)
+{
+ printf("Drag right: %p\n", event_info);
+}
+
+static void
+grid_drag_down(void *data, Evas_Object *obj, void *event_info)
+{
+ printf("Drag down: %p\n", event_info);
+}
+
+static void
+grid_drag_left(void *data, Evas_Object *obj, void *event_info)
+{
+ printf("Drag left: %p\n", event_info);
+}
+
+static void
+grid_drag_stop(void *data, Evas_Object *obj, void *event_info)
+{
+ printf("Drag stop: %p\n", event_info);
+}
+
+static void
+grid_selected(void *data, Evas_Object *obj, void *event_info)
+{
+ printf("Selected: %p\n", event_info);
+}
+
+static void
+grid_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+ printf("Clicked: %p\n", event_info);
+}
+
+static void
+grid_longpress(void *data, Evas_Object *obj, void *event_info)
+{
+ printf("longpress %p\n", event_info);
+}
+
+static void
+grid_item_check_changed(void *data, Evas_Object *obj, void *event_info)
+{
+ Testitem *ti = data;
+ ti->onoff = elm_check_state_get(obj);
+ printf("item %p onoff = %i\n", ti, ti->onoff);
+}
+
+char *
+grid_label_get(const void *data, Evas_Object *obj, const char *part)
+{
+ const Testitem *ti = data;
+ char buf[256];
+ snprintf(buf, sizeof(buf), "Photo %s", ti->path);
+ return strdup(buf);
+}
+
+Evas_Object *
+grid_icon_get(const void *data, Evas_Object *obj, const char *part)
+{
+ const Testitem *ti = data;
+ if (!strcmp(part, "elm.swallow.icon"))
+ {
+
+ Evas_Object *icon = elm_bg_add(obj);
+ elm_bg_file_set(icon, ti->path, NULL);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ evas_object_show(icon);
+ return icon;
+ }
+ else if (!strcmp(part, "elm.swallow.end"))
+ {
+ Evas_Object *ck;
+ ck = elm_check_add(obj);
+ evas_object_propagate_events_set(ck, 0);
+ elm_check_state_set(ck, ti->onoff);
+ evas_object_smart_callback_add(ck, "changed", grid_item_check_changed, data);
+ evas_object_show(ck);
+ return ck;
+ }
+ return NULL;
+}
+
+Eina_Bool
+grid_state_get(const void *data, Evas_Object *obj, const char *part)
+{
+ return EINA_FALSE;
+}
+
+void
+grid_del(const void *data, Evas_Object *obj)
+{
+}
+
+static void
+grid_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ printf("sel item data [%p] on grid obj [%p], pointer [%p]\n", data, obj, event_info);
+}
+
+void
+test_gengrid(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *win, *bg, *grid;
+ static Testitem ti[144];
+ int i, j, n;
+ char buf[PATH_MAX];
+ const char *img[9] =
+ {
+ "panel_01.jpg",
+ "plant_01.jpg",
+ "rock_01.jpg",
+ "rock_02.jpg",
+ "sky_01.jpg",
+ "sky_02.jpg",
+ "sky_03.jpg",
+ "sky_04.jpg",
+ "wood_01.jpg",
+ };
+
+ win = elm_win_add(NULL, "grid", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Grid");
+ elm_win_autodel_set(win, 1);
+
+ 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);
+
+ grid = elm_gengrid_add(win);
+ elm_gengrid_item_size_set(grid, 150, 150);
+ elm_gengrid_horizontal_set(grid, EINA_FALSE);
+ elm_gengrid_multi_select_set(grid, EINA_TRUE);
+ evas_object_smart_callback_add(grid, "selected", grid_selected, NULL);
+ evas_object_smart_callback_add(grid, "clicked", grid_clicked, NULL);
+ evas_object_smart_callback_add(grid, "longpressed", grid_longpress, NULL);
+ evas_object_smart_callback_add(grid, "drag,start,up", grid_drag_up, NULL);
+ evas_object_smart_callback_add(grid, "drag,start,right", grid_drag_right, NULL);
+ evas_object_smart_callback_add(grid, "drag,start,down", grid_drag_down, NULL);
+ evas_object_smart_callback_add(grid, "drag,start,left", grid_drag_left, NULL);
+ evas_object_smart_callback_add(grid, "drag,stop", grid_drag_stop, NULL);
+ evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ gic.item_style = "default";
+ gic.func.label_get = grid_label_get;
+ gic.func.icon_get = grid_icon_get;
+ gic.func.state_get = grid_state_get;
+ gic.func.del = grid_del;
+
+ n = 0;
+ for (i = 0; i < 12 * 12; i++)
+ {
+ snprintf(buf, sizeof(buf), "%s/images/%s", PACKAGE_DATA_DIR, img[n]);
+ n = (n + 1) % 9;
+ ti[i].mode = i;
+ ti[i].path = eina_stringshare_add(buf);
+ ti[i].item = elm_gengrid_item_append(grid, &gic, &(ti[i]), grid_sel, NULL);
+ if (!(i % 5))
+ elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE);
+ }
+
+ evas_object_show(grid);
+ elm_win_resize_object_add(win, grid);
+
+ evas_object_resize(win, 600, 600);
+ evas_object_show(win);
+}
+#endif
#include <Elementary.h>
#ifndef ELM_LIB_QUICKLAUNCH
+
+/* Hint:
+ * In this example some calls to elm_genlist_item_append() are used which give the
+ * value of an int as 'item data' and 'func data' after casting into (void*). For
+ * sure this works only on architectures where sizeof(int)==sizeof(void*).
+ * For real world usage you should hold a data structure or value in your
+ * application and then give only a pointer to this data as data pointer.
+ */
+
typedef struct _Testitem
{
Elm_Genlist_Item *item;
evas_object_resize(win, 320, 480);
evas_object_show(win);
}
+
+/***********/
+
+typedef struct _Test_Index2_Elements
+{
+ Evas_Object *entry, *lst, *id;
+} Test_Index2_Elements;
+
+void
+test_index2_del(void *data, Evas_Object *obj, void *event_info)
+{
+ /* FIXME it won't be called if elm_test main window is closed */
+ free(data);
+}
+
+int
+test_index2_cmp(const void *data1, const void *data2)
+{
+ const char *label1, *label2;
+ const Elm_List_Item *it1 = data1;
+ const Elm_List_Item *it2 = data2;
+
+ label1 = elm_list_item_label_get(it1);
+ label2 = elm_list_item_label_get(it2);
+
+ return strcasecmp(label1, label2);
+}
+
+int
+test_index2_icmp(const void *data1, const void *data2)
+{
+ const char *label1, *label2;
+ const Elm_Index_Item *it1 = data1;
+ const Elm_Index_Item *it2 = data2;
+
+ label1 = elm_index_item_letter_get(it1);
+ label2 = elm_index_item_letter_get(it2);
+
+ return strcasecmp(label1, label2);
+}
+
+void
+test_index2_it_add(void *data, Evas_Object *obj, void *event_info)
+{
+ Test_Index2_Elements *gui = data;
+ Elm_List_Item *it;
+ const char *label;
+ char letter[2];
+
+ label = elm_scrolled_entry_entry_get(gui->entry);
+ snprintf(letter, sizeof(letter), "%c", label[0]);
+ it = elm_list_item_sorted_insert(gui->lst, label, NULL, NULL, NULL, NULL,
+ test_index2_cmp);
+ elm_index_item_sorted_insert(gui->id, letter, it, test_index2_icmp,
+ test_index2_cmp);
+ elm_list_go(gui->lst);
+ /* FIXME it's not showing the recently added item */
+ elm_list_item_show(it);
+}
+
+void
+test_index2_it_del(void *data, Evas_Object *obj, void *event_info)
+{
+ Test_Index2_Elements *gui = data;
+ const char *label, *label_next;
+ Elm_List_Item *it, *it_next;
+
+ it = elm_list_selected_item_get(obj);
+ it_next = elm_list_item_next(it);
+
+ if (!it_next)
+ {
+ elm_index_item_del(gui->id, it);
+ elm_list_item_del(it);
+ return;
+ }
+
+ label = elm_list_item_label_get(it);
+ label_next = elm_list_item_label_get(it_next);
+
+ if (label[0] == label_next[0])
+ {
+ Elm_Index_Item *iit;
+ iit = elm_index_item_find(gui->id, it);
+ elm_index_item_data_set(iit, it_next);
+ }
+ else
+ elm_index_item_del(gui->id, it);
+
+ elm_list_item_del(it);
+}
+
+void
+test_index2_id_changed(void *data, Evas_Object *obj, void *event_info)
+{
+ elm_list_item_show(event_info);
+}
+
+void
+test_index2(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *win, *bg, *box, *bt;
+ Test_Index2_Elements *gui;
+
+ gui = malloc(sizeof(*gui));
+
+ win = elm_win_add(NULL, "sorted-index-list", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Sorted Index and List");
+ evas_object_smart_callback_add(win, "delete-request", test_index2_del, gui);
+ elm_win_autodel_set(win, 1);
+
+ 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);
+
+ 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);
+
+ gui->id = elm_index_add(win);
+ evas_object_size_hint_weight_set(gui->id, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, gui->id);
+ evas_object_smart_callback_add(gui->id, "delay,changed",
+ test_index2_id_changed, NULL);
+ evas_object_show(gui->id);
+
+ gui->entry = elm_scrolled_entry_add(win);
+ elm_scrolled_entry_entry_set(gui->entry, "Label");
+ elm_scrolled_entry_single_line_set(gui->entry, EINA_TRUE);
+ evas_object_size_hint_weight_set(gui->entry, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_fill_set(gui->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(box, gui->entry);
+ evas_object_show(gui->entry);
+
+ bt = elm_button_add(win);
+ elm_button_label_set(bt, "Add");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(box, bt);
+ evas_object_smart_callback_add(bt, "clicked", test_index2_it_add, gui);
+ evas_object_show(bt);
+
+ gui->lst = elm_list_add(win);
+ elm_box_pack_end(box, gui->lst);
+ evas_object_size_hint_weight_set(gui->lst, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_fill_set(gui->lst, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(gui->lst, "selected", test_index2_it_del,
+ gui);
+ elm_list_go(gui->lst);
+ evas_object_show(gui->lst);
+
+ evas_object_resize(win, 320, 480);
+ evas_object_show(win);
+}
#endif
static Elm_Genlist_Item_Class itc;
+static void _bstatus(void *data, Evas_Object *obj, void *event_info);
+static void _tstatus(void *data, Evas_Object *obj, void *event_info);
static char *_label_get(const void *data, Evas_Object *obj, const char *source);
static Evas_Object *_icon_get(const void *data, Evas_Object *obj, const char *source);
static Eina_Bool _state_get(const void *data, Evas_Object *obj, const char *source);
static void _fill_list(Evas_Object *obj);
static Eina_Bool _dir_has_subs(const char *path);
-void
-test_panel(void *data, Evas_Object *obj, void *event_info)
+static void
+_tstatus(void *data, Evas_Object *obj, void *event_info)
{
- Evas_Object *win, *bg, *panel, *bx;
- Evas_Object *list;
-
- win = elm_win_add(NULL, "panel", ELM_WIN_BASIC);
- elm_win_title_set(win, "Panel");
- elm_win_autodel_set(win, 1);
-
- 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);
- evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(bx);
-
- panel = elm_panel_add(win);
- elm_panel_orient_set(panel, ELM_PANEL_ORIENT_LEFT);
- evas_object_size_hint_weight_set(panel, 0.0, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(panel, 0.0, EVAS_HINT_FILL);
-
- itc.item_style = "default";
- itc.func.label_get = _label_get;
- itc.func.icon_get = _icon_get;
- itc.func.state_get = _state_get;
- itc.func.del = _item_del;
-
- list = elm_genlist_add(win);
- evas_object_size_hint_min_set(list, 100, -1);
- evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_show(list);
-
- elm_panel_content_set(panel, list);
+ char *status;
- elm_box_pack_end(bx, panel);
- evas_object_show(panel);
+ if (elm_panel_hidden_get((Evas_Object*)data))
+ status = "hidden";
+ else status = "shown";
+ printf("The top panel is currently %s\n", status);
+ elm_toolbar_item_unselect_all(obj);
+}
- _fill_list(list);
+static void
+_bstatus(void *data, Evas_Object *obj, void *event_info)
+{
+ char *status;
- evas_object_resize(win, 300, 300);
- evas_object_show(win);
+ if (elm_panel_hidden_get((Evas_Object*)data))
+ status = "hidden";
+ else status = "shown";
+ printf("The bottom panel is currently %s\n", status);
+ elm_toolbar_item_unselect_all(obj);
}
static char *
return result;
}
+void
+test_panel(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *win, *bg, *panel, *bx, *vbx, *toolbar, *ic;
+ char buf[PATH_MAX];
+ Evas_Object *list;
+
+ win = elm_win_add(NULL, "panel", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Panel");
+ elm_win_autodel_set(win, 1);
+
+ 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);
+
+ vbx = elm_box_add(win);
+ elm_win_resize_object_add(win, vbx);
+ evas_object_size_hint_weight_set(vbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(vbx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(vbx);
+
+ bx = elm_box_add(win);
+ elm_box_horizontal_set(bx, EINA_TRUE);
+ 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);
+ evas_object_show(bx);
+
+ panel = elm_panel_add(win);
+ elm_panel_orient_set(panel, ELM_PANEL_ORIENT_TOP);
+ evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ toolbar = elm_toolbar_add(win);
+ elm_toolbar_homogenous_set(toolbar, 0);
+ elm_toolbar_scrollable_set(toolbar, 0);
+ evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(toolbar);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
+ elm_icon_file_set(ic, buf, NULL);
+ elm_toolbar_item_add(toolbar, ic, "Hello", _tstatus, panel);
+
+ elm_panel_content_set(panel, toolbar);
+ elm_box_pack_end(vbx, panel);
+ evas_object_show(panel);
+
+ panel = elm_panel_add(win);
+ elm_panel_orient_set(panel, ELM_PANEL_ORIENT_LEFT);
+ evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(panel, 0, EVAS_HINT_FILL);
+
+ itc.item_style = "default";
+ itc.func.label_get = _label_get;
+ itc.func.icon_get = _icon_get;
+ itc.func.state_get = _state_get;
+ itc.func.del = _item_del;
+
+ list = elm_genlist_add(win);
+ evas_object_size_hint_min_set(list, 100, -1);
+ evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(list);
+
+ elm_panel_content_set(panel, list);
+
+ elm_box_pack_end(bx, panel);
+ evas_object_show(panel);
+
+ _fill_list(list);
+
+ panel = elm_panel_add(win);
+ elm_panel_orient_set(panel, ELM_PANEL_ORIENT_RIGHT);
+ evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(panel, 1, EVAS_HINT_FILL);
+
+ list = elm_genlist_add(win);
+ evas_object_size_hint_min_set(list, 100, -1);
+ evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(list);
+
+ elm_panel_content_set(panel, list);
+
+ elm_box_pack_end(bx, panel);
+ evas_object_show(panel);
+
+ _fill_list(list);
+
+ elm_box_pack_end(vbx, bx);
+
+ panel = elm_panel_add(win);
+ elm_panel_orient_set(panel, ELM_PANEL_ORIENT_BOTTOM);
+ evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ toolbar = elm_toolbar_add(win);
+ elm_toolbar_homogenous_set(toolbar, 0);
+ elm_toolbar_scrollable_set(toolbar, 0);
+ evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(toolbar);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
+ elm_icon_file_set(ic, buf, NULL);
+ elm_toolbar_item_add(toolbar, ic, "Hello", _bstatus, panel);
+
+ elm_panel_content_set(panel, toolbar);
+ elm_box_pack_end(vbx, panel);
+ evas_object_show(panel);
+
+ evas_object_resize(win, 320, 400);
+ evas_object_show(win);
+}
+
+
#endif
}
static void
-_close_win(void *data, Evas *e, void *event_info)
+_close_win(void *data, Evas_Object *obj, void *event_info)
{
evas_object_del(data);
}
extern "C" {
#endif
+#define ELM_VERSION_MAJOR @VMAJ@
+#define ELM_VERSION_MINOR @VMIN@
+
+ typedef struct _Elm_Version
+ {
+ int major;
+ int minor;
+ int micro;
+ int revision;
+ } Elm_Version;
+
+ EAPI extern Elm_Version *elm_version;
+
/* handy macros */
#define ELM_RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && (((x) + (w)) > (xx)) && (((y) + (h)) > (yy)))
#define ELM_PI 3.14159265358979323846
EAPI Evas_Coord elm_finger_size_get(void);
EAPI void elm_finger_size_set(Evas_Coord size);
EAPI void elm_finger_size_all_set(Evas_Coord size);
-
+
+ EAPI Eina_Bool elm_object_focus_get(Evas_Object *obj);
EAPI void elm_object_focus(Evas_Object *obj);
EAPI void elm_object_unfocus(Evas_Object *obj);
EAPI void elm_object_focus_allow_set(Evas_Object *obj, Eina_Bool enable);
EAPI void elm_fileselector_button_icon_set(Evas_Object *obj, Evas_Object *icon);
EAPI Evas_Object *elm_fileselector_button_icon_get(const Evas_Object *obj);
EAPI void elm_fileselector_button_window_title_set(Evas_Object *obj, const char *title);
- EAPI const char *elm_fileselector_button_window_title_get(Evas_Object *obj);
+ EAPI const char *elm_fileselector_button_window_title_get(const Evas_Object *obj);
EAPI void elm_fileselector_button_window_size_set(Evas_Object *obj, Evas_Coord width, Evas_Coord height);
- EAPI void elm_fileselector_button_window_size_get(Evas_Object *obj, Evas_Coord *width, Evas_Coord *height);
+ EAPI void elm_fileselector_button_window_size_get(const Evas_Object *obj, Evas_Coord *width, Evas_Coord *height);
EAPI void elm_fileselector_button_path_set(Evas_Object *obj, const char *path);
- EAPI const char *elm_fileselector_button_path_get(Evas_Object *obj);
+ EAPI const char *elm_fileselector_button_path_get(const Evas_Object *obj);
EAPI void elm_fileselector_button_expandable_set(Evas_Object *obj, Eina_Bool value);
- EAPI Eina_Bool elm_fileselector_button_expandable_get(Evas_Object *obj);
+ EAPI Eina_Bool elm_fileselector_button_expandable_get(const Evas_Object *obj);
EAPI void elm_fileselector_button_folder_only_set(Evas_Object *obj, Eina_Bool value);
- EAPI Eina_Bool elm_fileselector_button_folder_only_get(Evas_Object *obj);
+ EAPI Eina_Bool elm_fileselector_button_folder_only_get(const Evas_Object *obj);
EAPI void elm_fileselector_button_is_save_set(Evas_Object *obj, Eina_Bool value);
- EAPI Eina_Bool elm_fileselector_button_is_save_get(Evas_Object *obj);
+ EAPI Eina_Bool elm_fileselector_button_is_save_get(const Evas_Object *obj);
EAPI void elm_fileselector_button_inwin_mode_set(Evas_Object *obj, Eina_Bool value);
- EAPI Eina_Bool elm_fileselector_button_inwin_mode_get(Evas_Object *obj);
+ EAPI Eina_Bool elm_fileselector_button_inwin_mode_get(const Evas_Object *obj);
EAPI void elm_fileselector_button_selected_set(Evas_Object *obj, const char *path);
EAPI const char *elm_fileselector_button_selected_get(const Evas_Object *obj);
EAPI void elm_table_unpack(Evas_Object *obj, Evas_Object *subobj);
EAPI void elm_table_clear(Evas_Object *obj, Eina_Bool clear);
- typedef struct _Elm_Grid_Cell_Class Elm_Grid_Cell_Class;
- typedef struct _Elm_Grid_Cell_Class_Func Elm_Grid_Cell_Class_Func;
- typedef struct _Elm_Grid_Cell Elm_Grid_Cell;
- typedef char *(*GridCellLabelGetFunc) (const void *data, Evas_Object *obj, const char *part);
- typedef Evas_Object *(*GridCellIconGetFunc) (const void *data, Evas_Object *obj, const char *part);
- typedef Eina_Bool (*GridCellStateGetFunc) (const void *data, Evas_Object *obj, const char *part);
- typedef void (*GridCellDelFunc) (const void *data, Evas_Object *obj);
-
- struct _Elm_Grid_Cell_Class
+ typedef struct _Elm_Gengrid_Item_Class Elm_Gengrid_Item_Class;
+ typedef struct _Elm_Gengrid_Item_Class_Func Elm_Gengrid_Item_Class_Func;
+ typedef struct _Elm_Gengrid_Item Elm_Gengrid_Item;
+ typedef char *(*GridItemLabelGetFunc) (const void *data, Evas_Object *obj, const char *part);
+ typedef Evas_Object *(*GridItemIconGetFunc) (const void *data, Evas_Object *obj, const char *part);
+ typedef Eina_Bool (*GridItemStateGetFunc) (const void *data, Evas_Object *obj, const char *part);
+ typedef void (*GridItemDelFunc) (const void *data, Evas_Object *obj);
+
+ struct _Elm_Gengrid_Item_Class
{
const char *item_style;
- struct _Elm_Grid_Cell_Class_Func
+ struct _Elm_Gengrid_Item_Class_Func
{
- GridCellLabelGetFunc label_get;
- GridCellIconGetFunc icon_get;
- GridCellStateGetFunc state_get;
- GridCellDelFunc del;
+ GridItemLabelGetFunc label_get;
+ GridItemIconGetFunc icon_get;
+ GridItemStateGetFunc state_get;
+ GridItemDelFunc del;
} func;
};
- EAPI Evas_Object *elm_scrolled_grid_add(Evas_Object *parent);
- EAPI void elm_scrolled_grid_cell_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
- EAPI void elm_scrolled_grid_cell_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
- EAPI void elm_scrolled_grid_align_set(Evas_Object *obj, double align_x, double align_y);
- EAPI void elm_scrolled_grid_align_get(const Evas_Object *obj, double *align_x, double *align_y);
- EAPI void elm_scrolled_grid_cell_del(Elm_Grid_Cell *cell);
- EAPI void elm_scrolled_grid_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select);
- EAPI Eina_Bool elm_scrolled_grid_always_select_mode_get(const Evas_Object *obj);
- EAPI void elm_scrolled_grid_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select);
- EAPI Eina_Bool elm_scrolled_grid_no_select_mode_get(const Evas_Object *obj);
- EAPI void elm_scrolled_grid_multi_select_set(Evas_Object *obj, Eina_Bool multi);
- EAPI Eina_Bool elm_scrolled_grid_multi_select_get(const Evas_Object *obj);
- EAPI void elm_scrolled_grid_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
- EAPI void elm_scrolled_grid_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
- EAPI void elm_scrolled_grid_horizontal_set(Evas_Object *obj, Eina_Bool setting);
- EAPI void elm_scrolled_grid_clear(Evas_Object *obj);
- EAPI void *elm_scrolled_grid_cell_data_get(Elm_Grid_Cell *cell);
- EAPI void elm_scrolled_grid_cell_pos_get(const Elm_Grid_Cell *cell, unsigned int *x, unsigned int *y);
- EAPI Eina_Bool elm_scrolled_grid_cell_selected_get(const Elm_Grid_Cell *cell);
- EAPI const Evas_Object *elm_scrolled_grid_cell_object_get(Elm_Grid_Cell *cell);
- EAPI const Eina_List *elm_scrolled_grid_selected_cells_get(const Evas_Object *obj);
- EAPI Elm_Grid_Cell *elm_scrolled_grid_cell_add(Evas_Object *obj, const Elm_Grid_Cell_Class *gcc, const void *data, Evas_Smart_Cb func, const void *func_data);
+ EAPI Evas_Object *elm_gengrid_add(Evas_Object *parent);
+ EAPI void elm_gengrid_item_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
+ EAPI void elm_gengrid_item_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
+ EAPI void elm_gengrid_align_set(Evas_Object *obj, double align_x, double align_y);
+ EAPI void elm_gengrid_align_get(const Evas_Object *obj, double *align_x, double *align_y);
+ EAPI void elm_gengrid_item_del(Elm_Gengrid_Item *item);
+ EAPI void elm_gengrid_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select);
+ EAPI Eina_Bool elm_gengrid_always_select_mode_get(const Evas_Object *obj);
+ EAPI void elm_gengrid_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select);
+ EAPI Eina_Bool elm_gengrid_no_select_mode_get(const Evas_Object *obj);
+ EAPI void elm_gengrid_multi_select_set(Evas_Object *obj, Eina_Bool multi);
+ EAPI Eina_Bool elm_gengrid_multi_select_get(const Evas_Object *obj);
+ EAPI void elm_gengrid_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
+ EAPI void elm_gengrid_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
+ EAPI void elm_gengrid_horizontal_set(Evas_Object *obj, Eina_Bool setting);
+ EAPI void elm_gengrid_clear(Evas_Object *obj);
+ EAPI void *elm_gengrid_item_data_get(Elm_Gengrid_Item *item);
+ EAPI void elm_gengrid_item_pos_get(const Elm_Gengrid_Item *item, unsigned int *x, unsigned int *y);
+ EAPI void elm_gengrid_item_selected_set(Elm_Gengrid_Item *item, Eina_Bool selected);
+ EAPI Eina_Bool elm_gengrid_item_selected_get(const Elm_Gengrid_Item *item);
+ EAPI const Evas_Object *elm_gengrid_item_object_get(Elm_Gengrid_Item *item);
+ EAPI const Eina_List *elm_gengrid_selected_items_get(const Evas_Object *obj);
+ EAPI Elm_Gengrid_Item *elm_gengrid_item_append(Evas_Object *obj, const Elm_Gengrid_Item_Class *gcc, const void *data, Evas_Smart_Cb func, const void *func_data);
/* smart callbacks called:
*
- * selected - User has selected a cell.
- * unselected - User has unselected a cell.
- * clicked - User has double-clicked a cell.
- * realized - An evas object for a cell was built.
+ * selected - User has selected a item.
+ * unselected - User has unselected a item.
+ * clicked - User has double-clicked a item.
+ * realized - An evas object for a item was built.
* scroll - the content has been scrolled (moved).
* "scroll,drag,start" - dragging the contents around has started.
* "scroll,drat,stop" - dragging the contents around has stopped.
- * drag - grid is being dragged.
- * "drag,start,up" - grid has been dragged (not scrolled) up.
- * "drag,start,down" - grid has been dragged (not scrolled) down.
- * "drag,start,left" - grid has been dragged (not scrolled) left.
- * "drag,start,rigth" - grid has been dragged (nto scrolled) right.
- * "drag,stop" - grid is not being dragged.
+ * drag - Gengrid is being dragged.
+ * "drag,start,up" - Gengrid has been dragged (not scrolled) up.
+ * "drag,start,down" - Gengrid has been dragged (not scrolled) down.
+ * "drag,start,left" - Gengrid has been dragged (not scrolled) left.
+ * "drag,start,rigth" - Gengrid has been dragged (nto scrolled) right.
+ * "drag,stop" - Gengrid is not being dragged.
*/
EAPI Evas_Object *elm_clock_add(Evas_Object *parent);
EAPI void elm_clock_time_get(const Evas_Object *obj, int *hrs, int *min, int *sec);
EAPI void elm_clock_edit_set(Evas_Object *obj, Eina_Bool edit);
EAPI Eina_Bool elm_clock_edit_get(const Evas_Object *obj);
- EAPI void elm_clock_digit_edit_set(Evas_Object *obj, unsigned int digedit);
- EAPI unsigned int elm_clock_digit_edit_get(const Evas_Object *obj);
+ EAPI void elm_clock_digit_edit_set(Evas_Object *obj, Elm_Clock_Digedit digedit);
+ EAPI Elm_Clock_Digedit elm_clock_digit_edit_get(const Evas_Object *obj);
EAPI void elm_clock_show_am_pm_set(Evas_Object *obj, Eina_Bool am_pm);
EAPI Eina_Bool elm_clock_show_am_pm_get(const Evas_Object *obj);
EAPI void elm_clock_show_seconds_set(Evas_Object *obj, Eina_Bool seconds);
EAPI Evas_Object *elm_thumb_add(Evas_Object *parent);
EAPI void elm_thumb_file_set(Evas_Object *obj, const char *file, const char *key);
EAPI void elm_thumb_file_get(const Evas_Object *obj, const char **file, const char **key);
+ EAPI void elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key);
EAPI void elm_thumb_keep_aspect_set(Evas_Object *obj, Eina_Bool setting);
EAPI Eina_Bool elm_thumb_keep_aspect_get(const Evas_Object *obj);
EAPI void elm_thumb_align_set(Evas_Object *obj, float x_align, float y_align);
* vertical (two up/down buttons at the right side and text left aligned)
*/
+ typedef struct _Elm_Index_Item Elm_Index_Item;
EAPI Evas_Object *elm_index_add(Evas_Object *parent);
EAPI void elm_index_active_set(Evas_Object *obj, Eina_Bool active);
EAPI void elm_index_item_level_set(Evas_Object *obj, int level);
EAPI void elm_index_item_prepend(Evas_Object *obj, const char *letter, const void *item);
EAPI void elm_index_item_append_relative(Evas_Object *obj, const char *letter, const void *item, const void *relative);
EAPI void elm_index_item_prepend_relative(Evas_Object *obj, const char *letter, const void *item, const void *relative);
+ EAPI void elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, const void *item, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func);
EAPI void elm_index_item_del(Evas_Object *obj, const void *item);
+ EAPI Elm_Index_Item *elm_index_item_find(Evas_Object *obj, const void *item);
EAPI void elm_index_item_clear(Evas_Object *obj);
EAPI void elm_index_item_go(Evas_Object *obj, int level);
+ EAPI void *elm_index_item_data_get(const Elm_Index_Item *item);
+ EAPI void elm_index_item_data_set(Elm_Index_Item *it, const void *data);
+ EAPI const char *elm_index_item_letter_get(const Elm_Index_Item *item);
/* smart callbacks called:
* "changed" - when the selected index item changes
* "delay,changed" - when the selected index item changes, but after some small idle period
elm_toggle.c \
elm_frame.c \
elm_table.c \
-elm_scrolled_grid.c \
+elm_gengrid.c \
elm_clock.c \
elm_layout.c \
elm_hover.c \
static const char SIG_CLICKED[] = "clicked";
static const char SIG_UNPRESSED[] = "unpressed";
static const char SIG_FILE_CHOSEN[] = "file,chosen";
-static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_CLICKED, ""},
- {SIG_UNPRESSED, ""},
- {SIG_FILE_CHOSEN, "s"},
- {NULL, NULL}
+static const Evas_Smart_Cb_Description _signals[] =
+{
+ {SIG_CLICKED, ""},
+ {SIG_UNPRESSED, ""},
+ {SIG_FILE_CHOSEN, "s"},
+ {NULL, NULL}
};
static void
edje_object_signal_emit(wd->btn, "elm,state,icon,hidden", "elm");
edje_object_part_text_set(wd->btn, "elm.text", wd->btn_label);
edje_object_message_signal_process(wd->btn);
- edje_object_scale_set(wd->btn, elm_widget_scale_get(obj) * \
- _elm_config->scale);
+ edje_object_scale_set(wd->btn,
+ elm_widget_scale_get(obj) * _elm_config->scale);
_sizing_eval(obj);
}
static void
_signal_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
{
-
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
}
}
- if (!wd->inwin_mode || win_fallback)
+ if ((!wd->inwin_mode) || (win_fallback))
{
win = _new_window_add(wd);
evas_object_data_set(fs_btn, "win", win);
evas_object_smart_callback_add(wd->fs, "done", _selection_done, fs_btn);
evas_object_show(wd->fs);
- if (wd->inwin_mode && !win_fallback)
+ if ((wd->inwin_mode) && (!win_fallback))
{
elm_win_inwin_content_set(iw, wd->fs);
elm_win_inwin_activate(iw);
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
-
eina_stringshare_replace(&wd->fsd.path, path);
}
* @ingroup File_Selector_Button
*/
EAPI const char *
-elm_fileselector_button_window_title_get(Evas_Object *obj)
+elm_fileselector_button_window_title_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
-
wd->w = width;
wd->h = height;
}
* @ingroup File_Selector_Button
*/
EAPI void
-elm_fileselector_button_window_size_get(Evas_Object *obj, Evas_Coord *width, Evas_Coord *height)
+elm_fileselector_button_window_size_get(const Evas_Object *obj, Evas_Coord *width, Evas_Coord *height)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
-
if (width) *width = wd->w;
if (height) *height = wd->h;
}
* @ingroup File_Selector_Button
*/
EAPI const char *
-elm_fileselector_button_path_get(Evas_Object *obj)
+elm_fileselector_button_path_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
-
wd->fsd.expandable = value;
}
* @ingroup File_Selector_Button
*/
EAPI Eina_Bool
-elm_fileselector_button_expandable_get(Evas_Object *obj)
+elm_fileselector_button_expandable_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 wd->fsd.expandable;
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
-
wd->fsd.folder_only = value;
}
* @ingroup File_Selector_Button
*/
EAPI Eina_Bool
-elm_fileselector_button_folder_only_get(Evas_Object *obj)
+elm_fileselector_button_folder_only_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 wd->fsd.folder_only;
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
-
wd->fsd.is_save = value;
}
* @ingroup File_Selector_Button
*/
EAPI Eina_Bool
-elm_fileselector_button_is_save_get(Evas_Object *obj)
+elm_fileselector_button_is_save_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 wd->fsd.is_save;
}
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
-
wd->inwin_mode = value;
}
* @ingroup File_Selector_Button
*/
EAPI Eina_Bool
-elm_fileselector_button_inwin_mode_get(Evas_Object *obj)
+elm_fileselector_button_inwin_mode_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 wd->inwin_mode;
}
* widget.
*
* Signals that you can add callbacks for are:
- * "changed" - The text within the entry was changed
- * "activated" - The entry has received focus and the cursor
- * "press" - The entry has been clicked
- * "longpressed" - The entry has been clicked for a couple seconds
- * "clicked" - The entry has been clicked
- * "clicked,double" - The entry has been double clicked
- * "focused" - The entry has received focus
- * "unfocused" - The entry has lost focus
- * "selection,paste" - A paste action has occurred
- * "selection,copy" - A copy action has occurred
- * "selection,cut" - A cut action has occurred
- * "selection,start" - A selection has begun
- * "selection,changed" - The selection has changed
- * "selection,cleared" - The selection has been cleared
- * "cursor,changed" - The cursor has changed
- * "anchor,clicked" - The anchor has been clicked
+ * - "changed" - The text within the entry was changed
+ * - "activated" - The entry has received focus and the cursor
+ * - "press" - The entry has been clicked
+ * - "longpressed" - The entry has been clicked for a couple seconds
+ * - "clicked" - The entry has been clicked
+ * - "clicked,double" - The entry has been double clicked
+ * - "focused" - The entry has received focus
+ * - "unfocused" - The entry has lost focus
+ * - "selection,paste" - A paste action has occurred
+ * - "selection,copy" - A copy action has occurred
+ * - "selection,cut" - A cut action has occurred
+ * - "selection,start" - A selection has begun
+ * - "selection,changed" - The selection has changed
+ * - "selection,cleared" - The selection has been cleared
+ * - "cursor,changed" - The cursor has changed
+ * - "anchor,clicked" - The anchor has been clicked
*/
typedef struct _Widget_Data Widget_Data;
EAPI Eina_Bool
elm_scrolled_entry_cursor_next(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) 0;
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return 0;
+ if (!wd) return EINA_FALSE;
return elm_entry_cursor_next(wd->entry);
}
EAPI Eina_Bool
elm_scrolled_entry_cursor_prev(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) 0;
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return 0;
+ if (!wd) return EINA_FALSE;
return elm_entry_cursor_prev(wd->entry);
}
EAPI Eina_Bool
elm_scrolled_entry_cursor_up(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) 0;
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return 0;
+ if (!wd) return EINA_FALSE;
return elm_entry_cursor_up(wd->entry);
}
EAPI Eina_Bool
elm_scrolled_entry_cursor_down(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) 0;
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return 0;
+ if (!wd) return EINA_FALSE;
return elm_entry_cursor_down(wd->entry);
}
EAPI Eina_Bool
elm_scrolled_entry_cursor_is_format_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) 0;
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return 0;
+ if (!wd) return EINA_FALSE;
return elm_entry_cursor_is_format_get(wd->entry);
}
EAPI Eina_Bool
elm_scrolled_entry_cursor_is_visible_format_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) 0;
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return 0;
+ if (!wd) return EINA_FALSE;
return elm_entry_cursor_is_visible_format_get(wd->entry);
}
EAPI Eina_Bool
elm_scrolled_entry_context_menu_disabled_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype) 0;
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return 0;
+ if (!wd) return EINA_FALSE;
return elm_entry_context_menu_disabled_get(wd->entry);
}
struct _Widget_Data
{
Evas_Object *clk;
+ double interval;
Eina_Bool seconds : 1;
Eina_Bool am_pm : 1;
Eina_Bool edit : 1;
- unsigned int digedit;
+ Elm_Clock_Digedit digedit;
int hrs, min, sec;
Evas_Object *digit[6];
Evas_Object *ampm;
- Ecore_Timer *ticker;
- struct
+ Evas_Object *sel_obj;
+ Ecore_Timer *ticker, *spin;
+ struct
{
int hrs, min, sec;
char ampm;
Eina_Bool seconds : 1;
Eina_Bool am_pm : 1;
Eina_Bool edit : 1;
- unsigned int digedit;
+ Elm_Clock_Digedit digedit;
} cur;
};
static void _del_hook(Evas_Object *obj);
static void _theme_hook(Evas_Object *obj);
static int _ticker(void *data);
-static void _signal_clock_val_up(void *data, Evas_Object *obj, const char *emission, const char *source);
-static void _signal_clock_val_down(void *data, Evas_Object *obj, const char *emission, const char *source);
+static int _signal_clock_val_up(void *data);
+static int _signal_clock_val_down(void *data);
static void _time_update(Evas_Object *obj);
static void
}
if (wd->ampm) evas_object_del(wd->ampm);
if (wd->ticker) ecore_timer_del(wd->ticker);
+ if (wd->spin) ecore_timer_del(wd->spin);
free(wd);
}
return 0;
}
-static void
-_signal_clock_val_up(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
+static int
+_signal_clock_val_up(void *data)
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
if (!wd->edit) return;
- if (obj == wd->digit[0])
+ if (!wd->sel_obj) return;
+ if (wd->sel_obj == wd->digit[0])
{
wd->hrs = wd->hrs + 10;
if (wd->hrs >= 24) wd->hrs -= 24;
}
- if (obj == wd->digit[1])
+ if (wd->sel_obj == wd->digit[1])
{
wd->hrs = wd->hrs + 1;
if (wd->hrs >= 24) wd->hrs -= 24;
}
- if (obj == wd->digit[2])
+ if (wd->sel_obj == wd->digit[2])
{
wd->min = wd->min + 10;
if (wd->min >= 60) wd->min -= 60;
}
- if (obj == wd->digit[3])
+ if (wd->sel_obj == wd->digit[3])
{
wd->min = wd->min + 1;
if (wd->min >= 60) wd->min -= 60;
}
- if (obj == wd->digit[4])
+ if (wd->sel_obj == wd->digit[4])
{
wd->sec = wd->sec + 10;
if (wd->sec >= 60) wd->sec -= 60;
}
- if (obj == wd->digit[5])
+ if (wd->sel_obj == wd->digit[5])
{
wd->sec = wd->sec + 1;
if (wd->sec >= 60) wd->sec -= 60;
}
- if (obj == wd->ampm)
+ if (wd->sel_obj == wd->ampm)
{
wd->hrs = wd->hrs + 12;
if (wd->hrs > 23) wd->hrs -= 24;
}
+ wd->interval = wd->interval / 1.05;
+ ecore_timer_interval_set(wd->spin, wd->interval);
_time_update(data);
evas_object_smart_callback_call(data, "changed", NULL);
+ return ECORE_CALLBACK_RENEW;
}
-static void
-_signal_clock_val_down(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
+static int
+_signal_clock_val_down(void *data)
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
if (!wd->edit) return;
- if (obj == wd->digit[0])
+ if (!wd->sel_obj) return;
+ if (wd->sel_obj == wd->digit[0])
{
wd->hrs = wd->hrs - 10;
if (wd->hrs < 0) wd->hrs += 24;
}
- if (obj == wd->digit[1])
+ if (wd->sel_obj == wd->digit[1])
{
wd->hrs = wd->hrs - 1;
if (wd->hrs < 0) wd->hrs += 24;
}
- if (obj == wd->digit[2])
+ if (wd->sel_obj == wd->digit[2])
{
wd->min = wd->min - 10;
if (wd->min < 0) wd->min += 60;
}
- if (obj == wd->digit[3])
+ if (wd->sel_obj == wd->digit[3])
{
wd->min = wd->min - 1;
if (wd->min < 0) wd->min += 60;
}
- if (obj == wd->digit[4])
+ if (wd->sel_obj == wd->digit[4])
{
wd->sec = wd->sec - 10;
if (wd->sec < 0) wd->sec += 60;
}
- if (obj == wd->digit[5])
+ if (wd->sel_obj == wd->digit[5])
{
wd->sec = wd->sec - 1;
if (wd->sec < 0) wd->sec += 60;
}
- if (obj == wd->ampm)
+ if (wd->sel_obj == wd->ampm)
{
wd->hrs = wd->hrs - 12;
if (wd->hrs < 0) wd->hrs += 24;
}
+ wd->interval = wd->interval / 1.05;
+ ecore_timer_interval_set(wd->spin, wd->interval);
_time_update(data);
evas_object_smart_callback_call(data, "changed", NULL);
+ return ECORE_CALLBACK_RENEW;
+}
+
+static void
+_signal_clock_val_up_start(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return;
+ wd->interval = 0.85;
+ wd->sel_obj = obj;
+ if (wd->spin) ecore_timer_del(wd->spin);
+ wd->spin = ecore_timer_add(wd->interval, _signal_clock_val_up, data);
+ _signal_clock_val_up(data);
+}
+
+static void
+_signal_clock_val_down_start(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return;
+ wd->interval = 0.85;
+ wd->sel_obj = obj;
+ if (wd->spin) ecore_timer_del(wd->spin);
+ wd->spin = ecore_timer_add(wd->interval, _signal_clock_val_down, data);
+ _signal_clock_val_down(data);
+}
+
+static void
+_signal_clock_val_change_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return;
+ if (wd->spin) ecore_timer_del(wd->spin);
+ wd->spin = NULL;
+ wd->sel_obj = NULL;
}
static void
_elm_config->scale);
if (wd->edit && (wd->digedit & (1 << i)))
edje_object_signal_emit(wd->digit[i], "elm,state,edit,on", "elm");
- edje_object_signal_callback_add(wd->digit[i], "elm,action,up", "",
- _signal_clock_val_up, obj);
- edje_object_signal_callback_add(wd->digit[i], "elm,action,down", "",
- _signal_clock_val_down, obj);
+ edje_object_signal_callback_add(wd->digit[i], "elm,action,up,start",
+ "", _signal_clock_val_up_start, obj);
+ edje_object_signal_callback_add(wd->digit[i], "elm,action,up,stop",
+ "", _signal_clock_val_change_stop, obj);
+ edje_object_signal_callback_add(wd->digit[i], "elm,action,down,start",
+ "", _signal_clock_val_down_start, obj);
+ edje_object_signal_callback_add(wd->digit[i], "elm,action,down,stop",
+ "", _signal_clock_val_change_stop, obj);
mw = mh = -1;
elm_coords_finger_size_adjust(1, &mw, 2, &mh);
edje_object_size_min_restricted_calc(wd->digit[i], &mw, &mh, mw, mh);
_elm_config->scale);
if (wd->edit)
edje_object_signal_emit(wd->ampm, "elm,state,edit,on", "elm");
- edje_object_signal_callback_add(wd->ampm, "elm,action,up", "",
- _signal_clock_val_up, obj);
- edje_object_signal_callback_add(wd->ampm, "elm,action,down", "",
- _signal_clock_val_down, obj);
+ edje_object_signal_callback_add(wd->ampm, "elm,action,up,start",
+ "", _signal_clock_val_up_start, obj);
+ edje_object_signal_callback_add(wd->ampm, "elm,action,up,stop",
+ "", _signal_clock_val_change_stop, obj);
+ edje_object_signal_callback_add(wd->ampm, "elm,action,down,start",
+ "", _signal_clock_val_down_start, obj);
+ edje_object_signal_callback_add(wd->ampm, "elm,action,down,stop",
+ "", _signal_clock_val_change_stop, obj);
mw = mh = -1;
elm_coords_finger_size_adjust(1, &mw, 2, &mh);
edje_object_size_min_restricted_calc(wd->ampm, &mw, &mh, mw, mh);
*
* @ingroup Clock
*/
-EAPI unsigned int
+EAPI Elm_Clock_Digedit
elm_clock_digit_edit_get(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) 0;
_atom[ATOM_E_CONFIG],
_atom[ATOM_E_CONFIG],
8, &data, &size))
- return 0;
+ return EINA_FALSE;
else
_atom_config = _atom[ATOM_E_CONFIG];
}
if (size < 1)
{
free(data);
- return 0;
+ return EINA_FALSE;
}
config_data = eet_data_descriptor_decode(_config_edd, data, size);
free(data);
- if (!config_data) return 0;
+ if (!config_data) return EINA_FALSE;
_config_free();
_elm_config = config_data;
_config_apply();
_elm_rescale();
- return 1;
+ return EINA_TRUE;
}
static int
static void
_env_get(void)
{
- char buf[PATH_MAX], *p, *s;
+ char *s;
s = getenv("ELM_ENGINE");
if (s)
* vsize=ascent or vsize=full. the href=NAME sets the item name. Entry
* supports a list of emoticon names by default. These are:
*
- * emoticon/angry
- * emoticon/angry-shout
- * emoticon/crazy-laugh
- * emoticon/evil-laugh
- * emoticon/evil
- * emoticon/goggle-smile
- * emoticon/grumpy
- * emoticon/grumpy-smile
- * emoticon/guilty
- * emoticon/guilty-smile
- * emoticon/haha
- * emoticon/half-smile
- * emoticon/happy-panting
- * emoticon/happy
- * emoticon/indifferent
- * emoticon/kiss
- * emoticon/knowing-grin
- * emoticon/laugh
- * emoticon/little-bit-sorry
- * emoticon/love-lots
- * emoticon/love
- * emoticon/minimal-smile
- * emoticon/not-happy
- * emoticon/not-impressed
- * emoticon/omg
- * emoticon/opensmile
- * emoticon/smile
- * emoticon/sorry
- * emoticon/squint-laugh
- * emoticon/surprised
- * emoticon/suspicious
- * emoticon/tongue-dangling
- * emoticon/tongue-poke
- * emoticon/uh
- * emoticon/unhappy
- * emoticon/very-sorry
- * emoticon/what
- * emoticon/wink
- * emoticon/worried
- * emoticon/wtf
+ * - emoticon/angry
+ * - emoticon/angry-shout
+ * - emoticon/crazy-laugh
+ * - emoticon/evil-laugh
+ * - emoticon/evil
+ * - emoticon/goggle-smile
+ * - emoticon/grumpy
+ * - emoticon/grumpy-smile
+ * - emoticon/guilty
+ * - emoticon/guilty-smile
+ * - emoticon/haha
+ * - emoticon/half-smile
+ * - emoticon/happy-panting
+ * - emoticon/happy
+ * - emoticon/indifferent
+ * - emoticon/kiss
+ * - emoticon/knowing-grin
+ * - emoticon/laugh
+ * - emoticon/little-bit-sorry
+ * - emoticon/love-lots
+ * - emoticon/love
+ * - emoticon/minimal-smile
+ * - emoticon/not-happy
+ * - emoticon/not-impressed
+ * - emoticon/omg
+ * - emoticon/opensmile
+ * - emoticon/smile
+ * - emoticon/sorry
+ * - emoticon/squint-laugh
+ * - emoticon/surprised
+ * - emoticon/suspicious
+ * - emoticon/tongue-dangling
+ * - emoticon/tongue-poke
+ * - emoticon/uh
+ * - emoticon/unhappy
+ * - emoticon/very-sorry
+ * - emoticon/what
+ * - emoticon/wink
+ * - emoticon/worried
+ * - emoticon/wtf
*
* These are built-in currently, but you can add your own item provieer that
* can create inlined objects in the text and fill the space allocated to the
* See the entry test for some more examples of use of this.
*
* Signals that you can add callbacks for are:
- * "changed" - The text within the entry was changed
- * "activated" - The entry has received focus and the cursor
- * "press" - The entry has been clicked
- * "longpressed" - The entry has been clicked for a couple seconds
- * "clicked" - The entry has been clicked
- * "clicked,double" - The entry has been double clicked
- * "focused" - The entry has received focus
- * "unfocused" - The entry has lost focus
- * "selection,paste" - A paste action has occurred
- * "selection,copy" - A copy action has occurred
- * "selection,cut" - A cut action has occurred
- * "selection,start" - A selection has begun
- * "selection,changed" - The selection has changed
- * "selection,cleared" - The selection has been cleared
- * "cursor,changed" - The cursor has changed
- * "anchor,clicked" - The anchor has been clicked
+ * - "changed" - The text within the entry was changed
+ * - "activated" - The entry has received focus and the cursor
+ * - "press" - The entry has been clicked
+ * - "longpressed" - The entry has been clicked for a couple seconds
+ * - "clicked" - The entry has been clicked
+ * - "clicked,double" - The entry has been double clicked
+ * - "focused" - The entry has received focus
+ * - "unfocused" - The entry has lost focus
+ * - "selection,paste" - A paste action has occurred
+ * - "selection,copy" - A copy action has occurred
+ * - "selection,cut" - A cut action has occurred
+ * - "selection,start" - A selection has begun
+ * - "selection,changed" - The selection has changed
+ * - "selection,cleared" - The selection has been cleared
+ * - "cursor,changed" - The cursor has changed
+ * - "anchor,clicked" - The anchor has been clicked
*/
typedef struct _Mod_Api Mod_Api;
_store_selection(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- const char *sel = edje_object_part_text_selection_get(wd->ent, "elm.text");
+ const char *sel;
+
if (!wd) return;
+ sel = edje_object_part_text_selection_get(wd->ent, "elm.text");
eina_stringshare_replace(&wd->cut_sel, sel);
}
wd->front.content = content;
if (content)
{
- elm_widget_sub_object_add(content, obj);
+ elm_widget_sub_object_add(obj, content);
evas_object_smart_member_add(content, obj);
evas_object_clip_set(content, wd->front.clip);
evas_object_event_callback_add(content,
wd->back.content = content;
if (content)
{
- elm_widget_sub_object_add(content, obj);
+ elm_widget_sub_object_add(obj, content);
evas_object_smart_member_add(content, obj);
evas_object_clip_set(content, wd->back.clip);
evas_object_event_callback_add(content,
--- /dev/null
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+#include <Elementary.h>
+#include "elm_priv.h"
+
+/**
+ * @defgroup Gengrid Gengrid
+ *
+ * This widget aims to position objects in a grid layout while actually
+ * building only the visible ones, using the same idea as genlist: the user
+ * define a class for each item, specifying functions that will be called at
+ * object creation and deletion.
+ *
+ * Signals that you can add callbacks for are:
+ *
+ * clicked - The user has double-clicked a item. The event_info parameter is
+ * the Gengrid item that was double-clicked.
+ *
+ * selected - The user has made an item selected. The event_info parameter is
+ * the Gengrid item that was selected.
+ *
+ * unselected - The user has made an item unselected. The event_info parameter
+ * is the Gengrid item that was unselected.
+ *
+ * realized - This is called when the item in the Gengrid is created as a real
+ * evas object. event_info is the Gengrid item that was created. The object may be
+ * deleted at any time, so it is up to the caller to not use the object pointer
+ * from elm_gengrid_item_object_get() in a way where it may point to
+ * freed objects.
+ *
+ * drag,start,up - Called when the item in the Gengrid has been dragged (not
+ * scrolled) up.
+ *
+ * drag,start,down - Called when the item in the Gengrid has been dragged (not
+ * scrolled) down.
+ *
+ * drag,start,left - Called when the item in the Gengrid has been dragged (not
+ * scrolled) left.
+ *
+ * drag,start,right - Called when the item in the Gengrid has been dragged (not
+ * scrolled) right.
+ *
+ * drag,stop - Called when the item in the Gengrid has stopped being dragged.
+ *
+ * drag - Called when the item in the Gengrid is being dragged.
+ *
+ * scroll - called when the content has been scrolled (moved).
+ *
+ * scroll,drag,start - called when dragging the content has started.
+ *
+ * scroll,drag,stop - called when dragging the content has stopped.
+ *
+ *
+ * A item in the Gengrid can have 0 or more text labels (they can be regular text
+ * or textblock - that's up to the style to determine), 0 or more icons (which
+ * are simply objects swallowed into the Gengrid item) and 0 or more boolean states
+ * that can be used for check, radio or other indicators by the edje theme style.
+ * A item may be one of several styles (Elementary provides 1 by default -
+ * "default", but this can be extended by system or application custom
+ * themes/overlays/extensions).
+ *
+ * In order to implement the ability to add and delete items on the fly, Gengrid
+ * implements a class/callback system where the application provides a structure
+ * with information about that type of item (Gengrid may contain multiple different
+ * items with different classes, states and styles). Gengrid will call the functions
+ * in this struct (methods) when a item is "realized" (that is created
+ * dynamically while scrolling). All objects will simply be deleted when no
+ * longer needed with evas_object_del(). The Elm_GenGrid_Item_Class structure
+ * contains the following members:
+ *
+ * item_style - This is a constant string and simply defines the name of the
+ * item style. It must be specified and the default should be "default".
+ *
+ * func.label_get - This function is called when an actual item object is
+ * created. The data parameter is the one passed to elm_gengrid_item_append()
+ * and related item creation functions. The obj parameter is the Gengrid object and
+ * the part parameter is the string name of the text part in the edje design that
+ * is listed as one of the possible labels that can be set. This function must
+ * return a strdup'()ed string as the caller will free() it when done.
+ *
+ * func.icon_get - This function is called when an actual item object is
+ * created. The data parameter is the one passed to elm_gengrid_item_append()
+ * and related item creation functions. The obj parameter is the Gengrid object and
+ * the part parameter is the string name of the icon part in the edje design that
+ * is listed as one of the possible icons that can be set. This must return NULL
+ * for no object or a valid object. The object will be deleted by Gengrid on
+ * shutdown or when the item is unrealized.
+ *
+ * func.state_get - This function is called when an actual item object is
+ * created. The data parameter is the one passed to elm_gengrid_item_append()
+ * and related item creation functions. The obj parameter is the Gengrid object and
+ * the part parameter is the string name of th state part in the edje design that
+ * is listed as one of the possible states that can be set. Return 0 for false
+ * and 1 for true. Gengrid will emit a signal to the edje object with
+ * "elm,state,XXX,active" "elm" when true (the default is false), where XXX is
+ * the name of the part.
+ *
+ * func.del - This is called when elm_gengrid_item_del() is called on a
+ * item or elm_gengrid_clear() is called on the Gengrid. This is intended for
+ * use when actual Gengrid items are deleted, so any backing data attached to the
+ * item (e.g. its data parameter on creation) can be deleted.
+ *
+ * If the application wants multiple items to be able to be selected,
+ * elm_gengrid_multi_select_set() can enable this. If the Gengrid is
+ * single-selection only (the default), then elm_gengrid_select_item_get()
+ * will return the selected item, if any, or NULL if none is selected. If the
+ * Gengrid is multi-select then elm_gengrid_selected_items_get() will return a
+ * list (that is only valid as long as no items are modified (added, deleted,
+ * selected or unselected).
+ *
+ * If a item changes (state of boolean changes, label or icons change), then use
+ * elm_gengrid_item_update() to have Gengrid update the item with the new
+ * state. Gengrid will re-realize the item thus call the functions in the
+ * _Elm_Gengrid_Item_Class for that item.
+ *
+ * To programmatically (un)select a item use elm_gengrid_item_selected_set().
+ * To get its selected state use elm_gengrid_item_selected_get(). To make a
+ * item disabled (unable to be selected and appear differently) use
+ * elm_gengrid_item_disable_set() to set this and
+ * elm_gengrid_item_disable_get() to get the disabled state.
+ *
+ * Cells will only call their selection func and callback when first becoming
+ * selected. Any further clicks will do nothing, unless you enable always
+ * select with elm_gengrid_always_select_mode_set(). This means event if
+ * selected, every click will make the selected callbacks be called.
+ * elm_gengrid_no_select_mode_set() will turn off the ability to select
+ * items entirely and they will neither appear selected nor call selected
+ * callback function.
+ *
+ * Remember that you can create new styles and add your own theme augmentation
+ * per application with elm_theme_extension_add(). If you absolutely must have a
+ * specific style that overrides any theme the user or system sets up you can use
+ * elm_theme_overlay_add() to add such a file.
+ *
+ * --
+ * TODO:
+ * * Handle non-homogeneous objects too.
+ */
+
+typedef struct _Widget_Data Widget_Data;
+typedef struct _Pan Pan;
+
+#define PRELOAD 1
+
+struct _Elm_Gengrid_Item
+{
+ Evas_Object *base, *spacer;
+ const Elm_Gengrid_Item_Class *gic;
+ Ecore_Timer *long_timer;
+ Widget_Data *wd;
+ Eina_List *labels, *icons, *states, *icon_objs;
+ const void *data;
+ struct
+ {
+ Evas_Smart_Cb func;
+ const void *data;
+ } func;
+
+ Evas_Coord x, y, dx, dy;
+ int relcount;
+
+ Eina_Bool want_unrealize : 1;
+ Eina_Bool realized : 1;
+ Eina_Bool dragging : 1;
+ Eina_Bool down : 1;
+ Eina_Bool delete_me : 1;
+ Eina_Bool display_only : 1;
+ Eina_Bool disabled : 1;
+ Eina_Bool selected : 1;
+ Eina_Bool hilighted : 1;
+ Eina_Bool walking : 1;
+};
+
+struct _Widget_Data
+{
+ Evas_Object *self, *scr;
+ Evas_Object *pan_smart;
+ Pan *pan;
+ Eina_List *items;
+ Ecore_Job *calc_job;
+ Eina_List *selected;
+ double align_x, align_y;
+
+ Evas_Coord pan_x, pan_y;
+ Evas_Coord item_width, item_height; /* Each item size */
+ Evas_Coord minw, minh; /* Total obj size */
+ unsigned int nmax;
+
+ Eina_Bool horizontal : 1;
+ Eina_Bool on_hold : 1;
+ Eina_Bool longpressed : 1;
+ Eina_Bool multi : 1;
+ Eina_Bool no_select : 1;
+ Eina_Bool wasselected : 1;
+ Eina_Bool always_select : 1;
+};
+
+struct _Pan
+{
+ Evas_Object_Smart_Clipped_Data __clipped_data;
+ Widget_Data *wd;
+};
+
+static const char *widtype = NULL;
+static void _item_hilight(Elm_Gengrid_Item *item);
+static void _item_unrealize(Elm_Gengrid_Item *item);
+static void _item_select(Elm_Gengrid_Item *item);
+static void _item_unselect(Elm_Gengrid_Item *item);
+
+static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
+
+static void
+_theme_hook(Evas_Object *obj)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ elm_smart_scroller_object_theme_set(obj, wd->scr, "gengrid", "base",
+ elm_widget_style_get(obj));
+}
+
+static void
+_del_hook(Evas_Object *obj)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->calc_job) ecore_job_del(wd->calc_job);
+ evas_object_del(wd->pan_smart);
+ wd->pan_smart = NULL;
+ elm_gengrid_clear(obj);
+ free(wd);
+}
+
+static void
+_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
+{
+ Elm_Gengrid_Item *item = data;
+ Evas_Event_Mouse_Move *ev = event_info;
+ Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
+
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
+ {
+ if (!item->wd->on_hold) {
+ item->wd->on_hold = EINA_TRUE;
+ _item_unselect(item);
+ }
+ }
+ if ((item->dragging) && (item->down))
+ {
+ if (item->long_timer)
+ {
+ ecore_timer_del(item->long_timer);
+ item->long_timer = NULL;
+ }
+ evas_object_smart_callback_call(item->wd->self, "drag", item);
+ return;
+ }
+ if ((!item->down) || (item->wd->longpressed))
+ {
+ if (item->long_timer)
+ {
+ ecore_timer_del(item->long_timer);
+ item->long_timer = NULL;
+ }
+ return;
+ }
+ if (!item->display_only)
+ elm_coords_finger_size_adjust(1, &minw, 1, &minh);
+ evas_object_geometry_get(obj, &x, &y, NULL, NULL);
+ x = ev->cur.canvas.x - x;
+ y = ev->cur.canvas.y - y;
+ dx = x - item->dx;
+ adx = dx;
+ if (adx < 0) adx = -dx;
+ dy = y - item->dy;
+ ady = dy;
+ if (ady < 0) ady = -dy;
+ minw /= 2;
+ minh /= 2;
+ if ((adx > minw) || (ady > minh))
+ {
+ item->dragging = 1;
+ if (item->long_timer)
+ {
+ ecore_timer_del(item->long_timer);
+ item->long_timer = NULL;
+ }
+ if (item->wd->wasselected)
+ _item_unselect(item);
+ item->wd->wasselected = 0;
+ if (dy < 0)
+ {
+ if (ady > adx)
+ evas_object_smart_callback_call(item->wd->self, "drag,start,up",
+ item);
+ else
+ {
+ if (dx < 0)
+ evas_object_smart_callback_call(item->wd->self,
+ "drag,start,left", item);
+ }
+ }
+ else
+ {
+ if (ady > adx)
+ evas_object_smart_callback_call(item->wd->self,
+ "drag,start,down", item);
+ else
+ {
+ if (dx < 0)
+ evas_object_smart_callback_call(item->wd->self,
+ "drag,start,left", item);
+ else
+ evas_object_smart_callback_call(item->wd->self,
+ "drag,start,right", item);
+ }
+ }
+ }
+}
+
+static int
+_long_press(void *data)
+{
+ Elm_Gengrid_Item *item = data;
+
+ item->long_timer = NULL;
+ if ((item->disabled) || (item->dragging)) return 0;
+ item->wd->longpressed = EINA_TRUE;
+ evas_object_smart_callback_call(item->wd->self, "longpressed", item);
+ return 0;
+}
+
+static void
+_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info)
+{
+ Elm_Gengrid_Item *item = data;
+ Evas_Event_Mouse_Down *ev = event_info;
+ Evas_Coord x, y;
+
+ if (ev->button != 1) return;
+ item->down = 1;
+ item->dragging = 0;
+ evas_object_geometry_get(obj, &x, &y, NULL, NULL);
+ item->dx = ev->canvas.x - x;
+ item->dy = ev->canvas.y - y;
+ item->wd->longpressed = EINA_FALSE;
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) item->wd->on_hold = EINA_TRUE;
+ else item->wd->on_hold = EINA_FALSE;
+ item->wd->wasselected = item->selected;
+ _item_hilight(item);
+ if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
+ evas_object_smart_callback_call(item->wd->self, "clicked", item);
+ if (item->long_timer) ecore_timer_del(item->long_timer);
+ if (item->realized)
+ item->long_timer = ecore_timer_add(1.0, _long_press, item);
+ else
+ item->long_timer = NULL;
+}
+
+static void
+_mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Elm_Gengrid_Item *item = data;
+ Evas_Event_Mouse_Up *ev = event_info;
+ Eina_Bool dragged = EINA_FALSE;
+
+ if (ev->button != 1) return;
+ item->down = EINA_FALSE;
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) item->wd->on_hold = EINA_TRUE;
+ else item->wd->on_hold = EINA_FALSE;
+ if (item->long_timer)
+ {
+ ecore_timer_del(item->long_timer);
+ item->long_timer = NULL;
+ }
+ if (item->dragging)
+ {
+ item->dragging = EINA_FALSE;
+ evas_object_smart_callback_call(item->wd->self, "drag,stop", item);
+ dragged = EINA_TRUE;
+ }
+ if (item->wd->on_hold)
+ {
+ item->wd->longpressed = EINA_FALSE;
+ item->wd->on_hold = EINA_FALSE;
+ return;
+ }
+ if (item->wd->longpressed)
+ {
+ item->wd->longpressed = EINA_FALSE;
+ if (!item->wd->wasselected)
+ _item_unselect(item);
+ item->wd->wasselected = EINA_FALSE;
+ return;
+ }
+ if (dragged)
+ {
+ if (item->want_unrealize)
+ _item_unrealize(item);
+ }
+ if ((item->disabled) || dragged) return;
+ if (item->wd->multi)
+ {
+ if (!item->selected)
+ {
+ _item_hilight(item);
+ _item_select(item);
+ }
+ else _item_unselect(item);
+ }
+ else
+ {
+ if (!item->selected)
+ {
+ while (item->wd->selected) _item_unselect(item->wd->selected->data);
+ }
+ else
+ {
+ const Eina_List *l, *l_next;
+ Elm_Gengrid_Item *item2;
+
+ EINA_LIST_FOREACH_SAFE(item->wd->selected, l, l_next, item2)
+ if (item2 != item) _item_unselect(item2);
+ }
+ _item_hilight(item);
+ _item_select(item);
+ }
+}
+
+static void
+_item_hilight(Elm_Gengrid_Item *item)
+{
+ if ((item->wd->no_select) || (item->delete_me) || (item->hilighted)) return;
+ edje_object_signal_emit(item->base, "elm,state,selected", "elm");
+ item->hilighted = EINA_TRUE;
+}
+
+static void
+_item_realize(Elm_Gengrid_Item *item)
+{
+ char buf[1024];
+
+ if ((item->realized) || (item->delete_me)) return;
+ item->base = edje_object_add(evas_object_evas_get(item->wd->self));
+ edje_object_scale_set(item->base, elm_widget_scale_get(item->wd->self) *
+ _elm_config->scale);
+ evas_object_smart_member_add(item->base, item->wd->pan_smart);
+ elm_widget_sub_object_add(item->wd->self, item->base);
+ _elm_theme_object_set(item->wd->self, item->base, "gengrid", "item/default",
+ elm_widget_style_get(item->wd->self));
+ item->spacer = evas_object_rectangle_add(evas_object_evas_get(item->wd->self));
+ evas_object_color_set(item->spacer, 0, 0, 0, 0);
+ elm_widget_sub_object_add(item->wd->self, item->spacer);
+ evas_object_size_hint_min_set(item->spacer, 2 * _elm_config->scale, 1);
+ edje_object_part_swallow(item->base, "elm.swallow.pad", item->spacer);
+
+ if (item->gic->func.label_get)
+ {
+ const Eina_List *l;
+ const char *key;
+
+ item->labels = _elm_stringlist_get(edje_object_data_get(item->base,
+ "labels"));
+ EINA_LIST_FOREACH(item->labels, l, key)
+ {
+ char *s = item->gic->func.label_get(item->data, item->wd->self,
+ l->data);
+ if (s)
+ {
+ edje_object_part_text_set(item->base, l->data, s);
+ free(s);
+ }
+ }
+ }
+
+ if (item->gic->func.icon_get)
+ {
+ const Eina_List *l;
+ const char *key;
+
+ item->icons = _elm_stringlist_get(edje_object_data_get(item->base,
+ "icons"));
+ EINA_LIST_FOREACH(item->icons, l, key)
+ {
+ Evas_Object *ic = item->gic->func.icon_get(item->data,
+ item->wd->self,
+ l->data);
+ if (ic)
+ {
+ item->icon_objs = eina_list_append(item->icon_objs, ic);
+ edje_object_part_swallow(item->base, key, ic);
+ evas_object_show(ic);
+ elm_widget_sub_object_add(item->wd->self, ic);
+ }
+ }
+ }
+
+ if (item->gic->func.state_get)
+ {
+ const Eina_List *l;
+ const char *key;
+
+ item->states = _elm_stringlist_get(edje_object_data_get(item->base,
+ "states"));
+ EINA_LIST_FOREACH(item->states, l, key)
+ {
+ Eina_Bool on = item->gic->func.state_get(item->data,
+ item->wd->self, l->data);
+ if (on)
+ {
+ snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
+ edje_object_signal_emit(item->base, buf, "elm");
+ }
+ }
+ }
+
+ if (!item->wd->item_width && !item->wd->item_height)
+ {
+ edje_object_size_min_restricted_calc(item->base,
+ &item->wd->item_width, &item->wd->item_height,
+ item->wd->item_width, item->wd->item_height);
+ elm_coords_finger_size_adjust(1, &item->wd->item_width,
+ 1, &item->wd->item_height);
+ }
+
+ evas_object_event_callback_add(item->base, EVAS_CALLBACK_MOUSE_DOWN,
+ _mouse_down, item);
+ evas_object_event_callback_add(item->base, EVAS_CALLBACK_MOUSE_UP,
+ _mouse_up, item);
+ evas_object_event_callback_add(item->base, EVAS_CALLBACK_MOUSE_MOVE,
+ _mouse_move, item);
+
+ if (item->selected)
+ edje_object_signal_emit(item->base, "elm,state,selected", "elm");
+ if (item->disabled)
+ edje_object_signal_emit(item->base, "elm,state,disabled", "elm");
+
+ evas_object_show(item->base);
+ item->realized = EINA_TRUE;
+ item->want_unrealize = EINA_FALSE;
+}
+
+static void
+_item_unrealize(Elm_Gengrid_Item *item)
+{
+ Evas_Object *icon;
+
+ if (!item->realized) return;
+ if (item->long_timer)
+ {
+ ecore_timer_del(item->long_timer);
+ item->long_timer = NULL;
+ }
+ evas_object_del(item->base);
+ item->base = NULL;
+ evas_object_del(item->spacer);
+ item->spacer = NULL;
+ _elm_stringlist_free(item->labels);
+ item->labels = NULL;
+ _elm_stringlist_free(item->icons);
+ item->icons = NULL;
+ _elm_stringlist_free(item->states);
+
+ EINA_LIST_FREE(item->icon_objs, icon)
+ evas_object_del(icon);
+
+ item->states = NULL;
+ item->realized = EINA_FALSE;
+ item->want_unrealize = EINA_FALSE;
+}
+
+static void
+_item_place(Elm_Gengrid_Item *item, Evas_Coord cx, Evas_Coord cy)
+{
+ Evas_Coord x, y, ox, oy, cvx, cvy, cvw, cvh;
+ Evas_Coord tch, tcw, alignw = 0, alignh = 0, vw, vh;
+
+ item->x = cx;
+ item->y = cy;
+ evas_object_geometry_get(item->wd->self, &ox, &oy, &vw, &vh);
+ evas_output_viewport_get(evas_object_evas_get(item->wd->self),
+ &cvx, &cvy, &cvw, &cvh);
+
+ /* Preload rows/columns at each side of the Gengrid */
+ cvx -= PRELOAD * item->wd->item_width;
+ cvy -= PRELOAD * item->wd->item_height;
+ cvw += 2 * PRELOAD * item->wd->item_width;
+ cvh += 2 * PRELOAD * item->wd->item_height;
+
+ tch = ((vh/item->wd->item_height)*item->wd->item_height);
+ alignh = (vh - tch)*item->wd->align_y;
+
+ tcw = ((vw/item->wd->item_width)*item->wd->item_width);
+ alignw = (vw - tcw)*item->wd->align_x;
+
+ if (item->wd->horizontal && item->wd->minw < vw)
+ {
+ int columns;
+
+ columns = eina_list_count(item->wd->items)/(vh/item->wd->item_height);
+ if (eina_list_count(item->wd->items) % (vh/item->wd->item_height))
+ columns++;
+
+ tcw = item->wd->item_width * columns;
+ alignw = (vw - tcw)*item->wd->align_x;
+ }
+ else if (item->wd->horizontal && item->wd->minw > vw)
+ alignw = 0;
+ if (!item->wd->horizontal && item->wd->minh < vh)
+ {
+ int rows;
+
+ rows = eina_list_count(item->wd->items)/(vw/item->wd->item_width);
+ if (eina_list_count(item->wd->items) % (vw/item->wd->item_width))
+ rows++;
+
+ tch = item->wd->item_height * rows;
+ alignh = (vh - tch)*item->wd->align_y;
+ }
+ else if (!item->wd->horizontal && item->wd->minh > vh)
+ alignh = 0;
+ x = cx * item->wd->item_width - item->wd->pan_x + ox + alignw;
+ y = cy * item->wd->item_height - item->wd->pan_y + oy + alignh;
+
+ if (ELM_RECTS_INTERSECT(x, y, item->wd->item_width, item->wd->item_height,
+ cvx, cvy, cvw, cvh))
+ {
+ Eina_Bool was_realized = item->realized;
+ _item_realize(item);
+ if (!was_realized)
+ evas_object_smart_callback_call(item->wd->self, "realized", item);
+ evas_object_move(item->base, x, y);
+ evas_object_resize(item->base, item->wd->item_width,
+ item->wd->item_height);
+ }
+ else
+ _item_unrealize(item);
+}
+
+static Elm_Gengrid_Item *
+_item_create(Widget_Data *wd, const Elm_Gengrid_Item_Class *gic,
+ const void *data, Evas_Smart_Cb func, const void *func_data)
+{
+ Elm_Gengrid_Item *item;
+
+ item = calloc(1, sizeof(*item));
+ if (!item) return NULL;
+ item->wd = wd;
+ item->gic = gic;
+ item->data = data;
+ item->func.func = func;
+ item->func.data = func_data;
+ return item;
+}
+
+static void
+_item_del(Elm_Gengrid_Item *item)
+{
+ if (item->selected)
+ item->wd->selected = eina_list_remove(item->wd->selected, item);
+ if (item->realized) _item_unrealize(item);
+ if ((!item->delete_me) && (item->gic->func.del))
+ item->gic->func.del(item->data, item->wd->self);
+ item->delete_me = EINA_TRUE;
+ item->wd->items = eina_list_remove(item->wd->items, item);
+ if (item->long_timer) ecore_timer_del(item->long_timer);
+ free(item);
+}
+
+static void
+_item_select(Elm_Gengrid_Item *item)
+{
+ if ((item->wd->no_select) || (item->delete_me)) return;
+ if (item->selected)
+ {
+ if (item->wd->always_select) goto call;
+ return;
+ }
+ item->selected = EINA_TRUE;
+ item->wd->selected = eina_list_append(item->wd->selected, item);
+call:
+ item->walking++;
+ if (item->func.func) item->func.func((void *)item->func.data, item->wd->self,
+ item);
+ if (!item->delete_me)
+ evas_object_smart_callback_call(item->wd->self, "selected", item);
+ item->walking--;
+ if ((item->walking == 0) && (item->delete_me))
+ if (item->relcount == 0) _item_del(item);
+}
+
+static void
+_item_unselect(Elm_Gengrid_Item *item)
+{
+ if ((item->delete_me) || (!item->hilighted)) return;
+ edje_object_signal_emit(item->base, "elm,state,unselected", "elm");
+ item->hilighted = EINA_FALSE;
+ if (item->selected)
+ {
+ item->selected = EINA_FALSE;
+ item->wd->selected = eina_list_remove(item->wd->selected, item);
+ evas_object_smart_callback_call(item->wd->self, "unselected", item);
+ }
+}
+
+static void
+_calc_job(void *data)
+{
+ Widget_Data *wd = data;
+ Evas_Coord minw = 0, minh = 0, nmax = 0, cvw, cvh;
+ int count;
+
+ evas_object_geometry_get(wd->self, NULL, NULL, &cvw, &cvh);
+ if (wd->horizontal && wd->item_height)
+ nmax = cvh / wd->item_height;
+ else if (wd->item_width)
+ nmax = cvw / wd->item_width;
+
+ if (nmax)
+ {
+ count = eina_list_count(wd->items);
+ if (wd->horizontal)
+ {
+ minw = ceil(count / (float)nmax) * wd->item_width;
+ minh = nmax * wd->item_height;
+ }
+ else
+ {
+ minw = nmax * wd->item_width;
+ minh = ceil(count / (float)nmax) * wd->item_height;
+ }
+ }
+
+ if ((minw != wd->minw) || (minh != wd->minh))
+ {
+ wd->minh = minh;
+ wd->minw = minw;
+ evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
+ }
+
+ wd->nmax = nmax;
+ wd->calc_job = NULL;
+ evas_object_smart_changed(wd->pan_smart);
+}
+
+static void
+_pan_add(Evas_Object *obj)
+{
+ Pan *sd;
+ Evas_Object_Smart_Clipped_Data *cd;
+
+ _pan_sc.add(obj);
+ cd = evas_object_smart_data_get(obj);
+ sd = ELM_NEW(Pan);
+ if (!sd) return;
+ sd->__clipped_data = *cd;
+ free(cd);
+ evas_object_smart_data_set(obj, sd);
+}
+
+static void
+_pan_del(Evas_Object *obj)
+{
+ Pan *sd = evas_object_smart_data_get(obj);
+
+ if (!sd) return;
+ _pan_sc.del(obj);
+}
+
+static void
+_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
+{
+ Pan *sd = evas_object_smart_data_get(obj);
+ if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
+ sd->wd->pan_x = x;
+ sd->wd->pan_y = y;
+ evas_object_smart_changed(obj);
+}
+
+static void
+_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
+{
+ Pan *sd = evas_object_smart_data_get(obj);
+ if (x) *x = sd->wd->pan_x;
+ if (y) *y = sd->wd->pan_y;
+}
+
+static void
+_pan_child_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
+{
+ Pan *sd = evas_object_smart_data_get(obj);
+ if (w) *w = sd->wd->minw;
+ if (h) *h = sd->wd->minh;
+}
+
+static void
+_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
+{
+ Pan *sd = evas_object_smart_data_get(obj);
+ Evas_Coord ow, oh;
+
+ if (!sd) return;
+ evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
+ if (x)
+ *x = (ow < sd->wd->minw) ? sd->wd->minw - ow : 0;
+ if (y)
+ *y = (oh < sd->wd->minh) ? sd->wd->minh - oh : 0;
+}
+
+static void
+_pan_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
+{
+ Pan *sd = evas_object_smart_data_get(obj);
+ Evas_Coord ow, oh;
+
+ evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
+ if ((ow == w) && (oh == h)) return;
+ if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
+ sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
+}
+
+static void
+_pan_calculate(Evas_Object *obj)
+{
+ Pan *sd = evas_object_smart_data_get(obj);
+ Evas_Coord cx = 0, cy = 0;
+ Eina_List *l;
+ Elm_Gengrid_Item *item;
+
+ if (!sd) return;
+ if (!sd->wd->nmax) return;
+
+ EINA_LIST_FOREACH(sd->wd->items, l, item)
+ {
+ _item_place(item, cx, cy);
+ if (sd->wd->horizontal)
+ {
+ cy = (cy + 1) % sd->wd->nmax;
+ if (!cy) cx++;
+ }
+ else
+ {
+ cx = (cx + 1) % sd->wd->nmax;
+ if (!cx) cy++;
+ }
+ }
+}
+
+static void
+_pan_move(Evas_Object *obj, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__)
+{
+ Pan *sd = evas_object_smart_data_get(obj);
+ if (!sd) return;
+ if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
+ sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
+}
+
+static void
+_hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ elm_smart_scroller_hold_set(wd->scr, 1);
+}
+
+static void
+_hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ elm_smart_scroller_hold_set(wd->scr, 0);
+}
+
+static void
+_freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ elm_smart_scroller_freeze_set(wd->scr, 1);
+}
+
+static void
+_freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ elm_smart_scroller_freeze_set(wd->scr, 0);
+}
+
+static void
+_scr_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ evas_object_smart_callback_call(data, "scroll,drag,start", NULL);
+}
+
+static void
+_scr_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ evas_object_smart_callback_call(data, "scroll,drag,stop", NULL);
+}
+
+static void
+_scr_scroll(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ evas_object_smart_callback_call(data, "scroll", NULL);
+}
+
+/**
+ * Add a new Gengrid object.
+ *
+ * @param parent The parent object.
+ * @return The new object or NULL if it cannot be created.
+ *
+ * @see elm_gengrid_item_size_set()
+ * @see elm_gengrid_horizontal_set()
+ * @see elm_gengrid_item_append()
+ * @see elm_gengrid_item_del()
+ * @see elm_gengrid_clear()
+ *
+ * @ingroup Gengrid
+ */
+EAPI Evas_Object *
+elm_gengrid_add(Evas_Object *parent)
+{
+ Evas_Object *obj;
+ Evas *e;
+ Evas_Coord minw, minh;
+ Widget_Data *wd;
+ static Evas_Smart *smart = NULL;
+
+ wd = ELM_NEW(Widget_Data);
+ e = evas_object_evas_get(parent);
+ obj = elm_widget_add(e);
+ ELM_SET_WIDTYPE(widtype, "gengrid");
+ elm_widget_type_set(obj, "gengrid");
+ elm_widget_sub_object_add(parent, obj);
+ elm_widget_data_set(obj, wd);
+ elm_widget_del_hook_set(obj, _del_hook);
+ elm_widget_theme_hook_set(obj, _theme_hook);
+
+ wd->scr = elm_smart_scroller_add(e);
+ elm_smart_scroller_widget_set(wd->scr, obj);
+ elm_smart_scroller_object_theme_set(obj, wd->scr, "gengrid", "base", "default");
+ elm_widget_resize_object_set(obj, wd->scr);
+
+ evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
+ evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
+ evas_object_smart_callback_add(wd->scr, "scroll", _scr_scroll, obj);
+
+ elm_smart_scroller_bounce_allow_set(wd->scr, 1, 1);
+
+ wd->self = obj;
+ wd->align_x = 0.5;
+ wd->align_y = 0.5;
+
+ evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
+ evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
+ evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
+ evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
+
+ if (!smart)
+ {
+ static Evas_Smart_Class sc;
+
+ evas_object_smart_clipped_smart_set(&_pan_sc);
+ sc = _pan_sc;
+ sc.name = "elm_gengrid_pan";
+ sc.version = EVAS_SMART_CLASS_VERSION;
+ sc.add = _pan_add;
+ sc.del = _pan_del;
+ sc.resize = _pan_resize;
+ sc.move = _pan_move;
+ sc.calculate = _pan_calculate;
+ smart = evas_smart_class_new(&sc);
+ }
+ if (smart)
+ {
+ wd->pan_smart = evas_object_smart_add(e, smart);
+ wd->pan = evas_object_smart_data_get(wd->pan_smart);
+ wd->pan->wd = wd;
+ }
+
+ elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
+ _pan_set, _pan_get,
+ _pan_max_get, _pan_child_size_get);
+
+ return obj;
+}
+
+/**
+ * Set the size for the item of the Gengrid.
+ *
+ * @param obj The Gengrid object.
+ * @param w The item's width.
+ * @param h The item's height;
+ *
+ * @see elm_gengrid_item_size_get()
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_item_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->item_width == w && wd->item_height == h) return;
+ wd->item_width = w;
+ wd->item_height = h;
+ if (wd->calc_job) ecore_job_del(wd->calc_job);
+ wd->calc_job = ecore_job_add(_calc_job, wd);
+}
+
+/**
+ * Get the size of the item of the Gengrid.
+ *
+ * @param obj The Gengrid object.
+ * @param w Pointer to the item's width.
+ * @param h Pointer to the item's height.
+ *
+ * @see elm_gengrid_item_size_get()
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_item_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (w) *w = wd->item_width;
+ if (h) *h = wd->item_height;
+}
+
+/**
+ * Set item's alignment within the scroller.
+ *
+ * @param obj The Gengrid object.
+ * @param align_x The x alignment (0 <= x <= 1).
+ * @param align_y The y alignment (0 <= y <= 1).
+ *
+ * @see elm_gengrid_align_get()
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_align_set(Evas_Object *obj, double align_x, double align_y)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+
+ if (align_x > 1.0)
+ align_x = 1.0;
+ else if (align_x < 0.0)
+ align_x = 0.0;
+ wd->align_x = align_x;
+
+ if (align_y > 1.0)
+ align_y = 1.0;
+ else if (align_y < 0.0)
+ align_y = 0.0;
+ wd->align_y = align_y;
+}
+
+/**
+ * Get the alignenment set for the Gengrid object.
+ *
+ * @param obj The Gengrid object.
+ * @param align_x Pointer to x alignenment.
+ * @param align_y Pointer to y alignenment.
+ *
+ * @see elm_gengrid_align_set()
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_align_get(const Evas_Object *obj, double *align_x, double *align_y)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (align_x) *align_x = wd->align_x;
+ if (align_y) *align_y = wd->align_y;
+}
+
+/**
+ * Add item to the end of the Gengrid.
+ *
+ * @param obj The Gengrid object.
+ * @param gic The item class for the item.
+ * @param data The item data.
+ * @param func Convenience function called when item is selected.
+ * @param func_data Data passed to @p func above.
+ * @return A handle to the item added or NULL if not possible.
+ *
+ * @see elm_gengrid_item_del()
+ *
+ * @ingroup Gengrid
+ */
+EAPI Elm_Gengrid_Item *
+elm_gengrid_item_append(Evas_Object *obj, const Elm_Gengrid_Item_Class *gic,
+ const void *data, Evas_Smart_Cb func,
+ const void *func_data)
+{
+ Elm_Gengrid_Item *item;
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+
+ item = _item_create(wd, gic, data, func, func_data);
+ if (!item) return NULL;
+
+ wd->items = eina_list_append(wd->items, item);
+ wd->no_select = EINA_FALSE;
+
+ if (wd->calc_job) ecore_job_del(wd->calc_job);
+ wd->calc_job = ecore_job_add(_calc_job, wd);
+
+ return item;
+}
+
+/**
+ * Remove a item from the Gengrid.
+ *
+ * @param item The item to be removed.
+ * @return @c EINA_TRUE on success or @c EINA_FALSE otherwise.
+ *
+ * @see elm_gengrid_clear() to remove all items of the Gengrid.
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_item_del(Elm_Gengrid_Item *item)
+{
+ if (!item) return;
+ if ((item->relcount > 0) || (item->walking > 0))
+ {
+ item->delete_me = EINA_TRUE;
+ if (item->selected)
+ item->wd->selected = eina_list_remove(item->wd->selected, item);
+ if (item->gic->func.del) item->gic->func.del(item->data, item->wd->self);
+ return;
+ }
+
+ _item_del(item);
+
+ if (item->wd->calc_job) ecore_job_del(item->wd->calc_job);
+ item->wd->calc_job = ecore_job_add(_calc_job, item->wd);
+}
+
+/**
+ * Set for what direction the Gengrid will expand.
+ *
+ * @param obj The Gengrid object.
+ * @param setting If @c EINA_TRUE the Gengrid will expand horizontally or
+ * vertically if @c EINA_FALSE.
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_horizontal_set(Evas_Object *obj, Eina_Bool setting)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (setting == wd->horizontal) return;
+ wd->horizontal = setting;
+
+ /* Update the items to conform to the new layout */
+ if (wd->calc_job) ecore_job_del(wd->calc_job);
+ wd->calc_job = ecore_job_add(_calc_job, wd);
+}
+
+/**
+ * Clear the Gengrid
+ *
+ * This clears all items in the Gengrid, leaving it empty.
+ *
+ * @param obj The Gengrid object.
+ *
+ * @see elm_gengrid_item_del() to remove just one item.
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_clear(Evas_Object *obj)
+{
+ Eina_List *l, *l_next;
+ Elm_Gengrid_Item *item;
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ if (wd->calc_job)
+ {
+ ecore_job_del(wd->calc_job);
+ wd->calc_job = NULL;
+ }
+
+ EINA_LIST_FOREACH_SAFE(wd->items, l, l_next, item)
+ {
+ if (item->realized) _item_unrealize(item);
+ if (item->gic->func.del) item->gic->func.del(item->data, wd->self);
+ if (item->long_timer) ecore_timer_del(item->long_timer);
+ free(item);
+ wd->items = eina_list_remove_list(wd->items, l);
+ }
+
+ if (wd->selected)
+ {
+ eina_list_free(wd->selected);
+ wd->selected = NULL;
+ }
+
+ wd->pan_x = 0;
+ wd->pan_y = 0;
+ wd->minw = 0;
+ wd->minh = 0;
+ evas_object_size_hint_min_set(wd->pan_smart, wd->minw, wd->minh);
+ evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
+}
+
+/**
+ * Get the real evas object of the Gengrid item
+ *
+ * This returns the actual evas object used for the specified Gengrid item.
+ * This may be NULL as it may not be created, and may be deleted at any time
+ * by Gengrid. Do not modify this object (move, resize, show, hide etc.) as
+ * Gengrid is controlling it. This function is for querying, emitting custom
+ * signals or hooking lower level callbacks for events. Do not delete this
+ * object under any circumstances.
+ *
+ * @param item The Gengrid item.
+ * @return the evas object associated to this item.
+ *
+ * @see elm_gengrid_item_data_get()
+ *
+ * @ingroup Gengrid
+ */
+EAPI const Evas_Object *
+elm_gengrid_item_object_get(Elm_Gengrid_Item *item)
+{
+ if (!item) return NULL;
+ return item->base;
+}
+
+/**
+ * Returns the data associated to a item
+ *
+ * This returns the data value passed on the elm_gengrid_item_append() and
+ * related item addition calls.
+ *
+ * @param item The Gengrid item.
+ * @return the data associated to this item.
+ *
+ * @see elm_gengrid_item_append()
+ * @see elm_gengrid_item_object_get()
+ *
+ * @ingroup Gengrid
+ */
+EAPI void *
+elm_gengrid_item_data_get(Elm_Gengrid_Item *item)
+{
+ if (!item) return NULL;
+ return (void *)item->data;
+}
+
+/**
+ * Get the item's coordinates.
+ *
+ * This returns the logical position of the item whithin the Gengrid.
+ *
+ * @param item The Gengrid item.
+ * @param x The x-axis coordinate pointer.
+ * @param y The y-axis coordinate pointer.
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_item_pos_get(const Elm_Gengrid_Item *item, unsigned int *x, unsigned int *y)
+{
+ if (!item) return;
+ if (x) *x = item->x;
+ if (y) *y = item->y;
+}
+
+/**
+ * Enable or disable multi-select in the Gengrid.
+ *
+ * This enables (EINA_TRUE) or disables (EINA_FALSE) multi-select in the Gengrid.
+ * This allows more than 1 item to be selected.
+ *
+ * @param obj The Gengrid object.
+ * @param multi Multi-select enabled/disabled
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_multi_select_set(Evas_Object *obj, Eina_Bool multi)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ wd->multi = multi;
+}
+
+/**
+ * Get if multi-select in Gengrid is enabled or disabled
+ *
+ * @param obj The Gengrid object
+ * @return Multi-select enable/disable
+ * (EINA_TRUE = enabled / EINA_FALSE = disabled)
+ *
+ * @ingroup Gengrid
+ */
+EAPI Eina_Bool
+elm_gengrid_multi_select_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 wd->multi;
+}
+
+/**
+ * Get the selected item in the Gengrid
+ *
+ * This gets the selected item in the Gengrid (if multi-select is enabled only
+ * the first item in the list is selected - which is not very useful, so see
+ * elm_gengrid_selected_items_get() for when multi-select is used).
+ *
+ * If no item is selected, NULL is returned.
+ *
+ * @param obj The Gengrid object.
+ * @return The selected item, or NULL if none.
+ *
+ * @ingroup Gengrid
+ */
+EAPI Elm_Gengrid_Item *
+elm_gengrid_selected_item_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ if (wd->selected) return wd->selected->data;
+ return NULL;
+}
+
+/**
+ * Get a list of selected items in the Gengrid.
+ *
+ * This returns a list of the selected items. This list pointer is only valid
+ * so long as no items are selected or unselected (or unselected implictly by
+ * deletion). The list contains Elm_Gengrid_Item pointers.
+ *
+ * @param obj The Gengrid object.
+ * @return The list of selected items, or NULL if none are selected.
+ *
+ * @ingroup Gengrid
+ */
+EAPI const Eina_List *
+elm_gengrid_selected_items_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->selected;
+}
+
+/**
+ * Set the selected state of a item.
+ *
+ * This sets the selected state of a item. If multi-select is not enabled and
+ * selected is EINA_TRUE, previously selected items are unselected.
+ *
+ * @param item The item
+ * @param selected The selected state.
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_item_selected_set(Elm_Gengrid_Item *item, Eina_Bool selected)
+{
+ Widget_Data *wd = elm_widget_data_get(item->wd->self);
+ if (!wd) return;
+ if (!item || item->delete_me) return;
+ selected = !!selected;
+ if (item->selected == selected) return;
+
+ if (selected)
+ {
+ if (!wd->multi)
+ {
+ while (wd->selected)
+ _item_unselect(wd->selected->data);
+ }
+ _item_hilight(item);
+ _item_select(item);
+ }
+ else
+ _item_unselect(item);
+}
+
+/**
+ * Get the selected state of a item.
+ *
+ * This gets the selected state of a item (1 selected, 0 not selected).
+ *
+ * @param item The item
+ * @return The selected state
+ *
+ * @ingroup Gengrid
+ */
+EAPI Eina_Bool
+elm_gengrid_item_selected_get(const Elm_Gengrid_Item *item)
+{
+ if (!item) return EINA_FALSE;
+ return item->selected;
+}
+
+/**
+ * Sets the disabled state of a item.
+ *
+ * A disabled item cannot be selected or unselected. It will also change
+ * appearance to disabled. This sets the disabled state (1 disabled, 0 not
+ * disabled).
+ *
+ * @param item The item
+ * @param disabled The disabled state
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_item_disabled_set(Elm_Gengrid_Item *item, Eina_Bool disabled)
+{
+ if (!item) return;
+ if (item->disabled == disabled) return;
+ if (item->delete_me) return;
+ item->disabled = disabled;
+ if (item->realized)
+ {
+ if (item->disabled)
+ edje_object_signal_emit(item->base, "elm,state,disabled", "elm");
+ else
+ edje_object_signal_emit(item->base, "elm,state,enabled", "elm");
+ }
+}
+
+/**
+ * Get the disabled state of a item.
+ *
+ * This gets the disabled state of the given item.
+ *
+ * @param item The item
+ * @return The disabled state
+ *
+ * @ingroup Gengrid
+ */
+EAPI Eina_Bool
+elm_gengrid_item_disabled_get(const Elm_Gengrid_Item *item)
+{
+ if (!item) return EINA_FALSE;
+ if (item->delete_me) return EINA_FALSE;
+ return item->disabled;
+}
+
+/**
+ * Set the always select mode.
+ *
+ * Cells will only call their selection func and callback when first becoming
+ * selected. Any further clicks will do nothing, unless you enable always select
+ * with elm_gengrid_always_select_mode_set(). This means even if selected,
+ * every click will make the selected callbacks be called.
+ *
+ * @param obj The Gengrid object
+ * @param always_select The always select mode (EINA_TRUE = on, EINA_FALSE = off)
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ wd->always_select = always_select;
+}
+
+/**
+ * Get the always select mode.
+ *
+ * @param obj The Gengrid object.
+ * @return The always select mode (EINA_TRUE = on, EINA_FALSE = off)
+ *
+ * @ingroup Gengrid
+ */
+EAPI Eina_Bool
+elm_gengrid_always_select_mode_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 wd->always_select;
+}
+
+/**
+ * Set no select mode.
+ *
+ * This will turn off the ability to select items entirely and they will
+ * neither appear selected nor call selected callback functions.
+ *
+ * @param obj The Gengrid object
+ * @param no_select The no select mode (EINA_TRUE = on, EINA_FALSE = off)
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_no_select_mode_set(Evas_Object *obj, Eina_Bool no_select)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ wd->no_select = no_select;
+}
+
+/**
+ * Gets no select mode.
+ *
+ * @param obj The Gengrid object
+ * @return The no select mode (EINA_TRUE = on, EINA_FALSE = off)
+ *
+ * @ingroup Gengrid
+ */
+EAPI Eina_Bool
+elm_gengrid_no_select_mode_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 wd->no_select;
+}
+
+/**
+ * Set bounce mode.
+ *
+ * This will enable or disable the scroller bounce mode for the Gengrid. See
+ * elm_scroller_bounce_set() for details.
+ *
+ * @param obj The Gengrid object
+ * @param h_bounce Allow bounce horizontally
+ * @param v_bounce Allow bounce vertically
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_bounce_set(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_set(wd->scr, h_bounce, v_bounce);
+}
+
+/**
+ * Get the bounce mode
+ *
+ * @param obj The Gengrid object
+ * @param h_bounce Allow bounce horizontally
+ * @param v_bounce Allow bounce vertically
+ *
+ * @ingroup Gengrid
+ */
+EAPI void
+elm_gengrid_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);
+}
{
Elm_Genlist_Item *it = data;
Evas_Event_Mouse_Up *ev = event_info;
- Eina_Bool dragged = 0;
+ Eina_Bool dragged = EINA_FALSE;
if (ev->button != 1) return;
it->down = 0;
Widget_Data *wd = elm_widget_data_get(obj);
Eina_List *list = NULL;
Item_Block *itb;
- Eina_Bool done = 0;
+ Eina_Bool done = EINA_FALSE;
if (!wd) return NULL;
EINA_INLIST_FOREACH(wd->blocks, itb)
{
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
+ if (!wd) return NULL;
return wd->target;
}
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
+ if (!wd) return NULL;
return wd->parent;
}
*/
typedef struct _Widget_Data Widget_Data;
-typedef struct _Item Item;
struct _Widget_Data
{
Eina_Bool down : 1;
};
-struct _Item
+struct _Elm_Index_Item
{
Evas_Object *obj;
const char *letter;
static void _sizing_eval(Evas_Object *obj);
static void _index_box_auto_fill(Evas_Object *obj, Evas_Object *box, int level);
static void _index_box_clear(Evas_Object *obj, Evas_Object *box, int level);
-static void _item_free(Item *it);
+static void _item_free(Elm_Index_Item *it);
static void
_del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- Item *it;
+ Elm_Index_Item *it;
Eina_List *l, *clear = NULL;
if (!wd) return;
_index_box_clear(obj, wd->bx[wd->level], wd->level);
evas_object_size_hint_max_set(obj, maxw, maxh);
}
-static Item *
+static Elm_Index_Item *
_item_new(Evas_Object *obj, const char *letter, const void *item)
{
Widget_Data *wd = elm_widget_data_get(obj);
- Item *it;
+ Elm_Index_Item *it;
if (!wd) return NULL;
- it = calloc(1, sizeof(Item));
+ it = calloc(1, sizeof(Elm_Index_Item));
if (!it) return NULL;
it->obj = obj;
it->letter = eina_stringshare_add(letter);
return it;
}
-static Item *
+static Elm_Index_Item *
_item_find(Evas_Object *obj, const void *item)
{
Widget_Data *wd = elm_widget_data_get(obj);
Eina_List *l;
- Item *it;
+ Elm_Index_Item *it;
if (!wd) return NULL;
EINA_LIST_FOREACH(wd->items, l, it)
if (it->data == item) return it;
}
static void
-_item_free(Item *it)
+_item_free(Elm_Index_Item *it)
{
Widget_Data *wd = elm_widget_data_get(it->obj);
if (!wd) return;
{
Widget_Data *wd = elm_widget_data_get(obj);
Eina_List *l;
- Item *it;
+ Elm_Index_Item *it;
Evas_Coord mw, mh, w, h;
int i = 0;
if (!wd) return;
{
Widget_Data *wd = elm_widget_data_get(obj);
Eina_List *l;
- Item *it;
+ Elm_Index_Item *it;
if (!wd) return;
if (!wd->level_active[level]) return;
EINA_LIST_FOREACH(wd->items, l, it)
_sel_eval(Evas_Object *obj, Evas_Coord evx, Evas_Coord evy)
{
Widget_Data *wd = elm_widget_data_get(obj);
- Item *it, *it_closest, *it_last;
+ Elm_Index_Item *it, *it_closest, *it_last;
Eina_List *l;
Evas_Coord x, y, w, h, bx, by, bw, bh, xx, yy;
double cdv = 0.5;
Evas_Coord dist;
- Eina_Bool change = 0;
+ Eina_Bool change = EINA_FALSE;
char *label = NULL, *last = NULL;
int i;
if (!wd) return;
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
Eina_List *l;
- Item *it;
+ Elm_Index_Item *it;
if (!wd) return NULL;
EINA_LIST_FOREACH(wd->items, l, it)
if ((it->selected) && (it->level == level)) return it->data;
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- Item *it;
+ Elm_Index_Item *it;
if (!wd) return;
it = _item_new(obj, letter, item);
if (!it) return;
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- Item *it;
+ Elm_Index_Item *it;
if (!wd) return;
it = _item_new(obj, letter, item);
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- Item *it, *it_rel;
+ Elm_Index_Item *it, *it_rel;
if (!wd) return;
if (!relative)
{
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- Item *it, *it_rel;
+ Elm_Index_Item *it, *it_rel;
if (!wd) return;
if (!relative)
{
}
/**
+ * Insert a new @p item into the sorted index @p obj in @p letter.
+ *
+ * @param obj The index object
+ * @param letter Letter under which the item should be indexed
+ * @param item The item to put in the index
+ * @param cmp_func The function called for the sort of index items.
+ * @param cmp_data_func The function called for the sort of the data. It will
+ * be used when cmp_func return 0. It means the index item already exists.
+ * So, to decide which data item should be pointed by the index item, a function
+ * to compare them is needed. If this function is not provided, index items
+ * will be duplicated. If cmp_data_func returns a non-negative value, the
+ * previous index item data will be replaced by the inserted @p item. So
+ * if the previous data need to be free, it should be done in this function,
+ * because the reference will be lost.
+ *
+ * @ingroup Index
+ */
+EAPI void
+elm_index_item_sorted_insert(Evas_Object *obj, const char *letter, const void *item, Eina_Compare_Cb cmp_func, Eina_Compare_Cb cmp_data_func)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Eina_List *lnear;
+ Elm_Index_Item *it;
+ int cmp;
+
+ if (!wd) return;
+ if (!(wd->items))
+ {
+ elm_index_item_append(obj, letter, item);
+ return;
+ }
+
+ it = _item_new(obj, letter, item);
+ if (!it) return;
+
+ lnear = eina_list_search_sorted_near_list(wd->items, cmp_func, it, &cmp);
+ if (cmp < 0)
+ wd->items = eina_list_append_relative_list(wd->items, it, lnear);
+ else if (cmp > 0)
+ wd->items = eina_list_prepend_relative_list(wd->items, it, lnear);
+ else
+ {
+ /* If cmp_data_func is not provided, append a duplicated item */
+ if (!cmp_data_func)
+ wd->items = eina_list_append_relative_list(wd->items, it, lnear);
+ else
+ {
+ Elm_Index_Item *p_it = eina_list_data_get(lnear);
+ if (cmp_data_func(p_it->data, it->data) >= 0)
+ p_it->data = it->data;
+ _item_free(it);
+ }
+ }
+
+ _index_box_clear(obj, wd->bx[wd->level], wd->level);
+}
+
+/**
* Remove an item from the index.
*
* @param obj The index object
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- Item *it;
+ Elm_Index_Item *it;
if (!wd) return;
it = _item_find(obj, item);
if (!it) return;
}
/**
+ * Find an index item using item data.
+ *
+ * @param obj The index object
+ * @param item The item pointed by index item
+ * @return The index item pointing to @p item
+ *
+ * @ingroup Index
+ */
+EAPI Elm_Index_Item *
+elm_index_item_find(Evas_Object *obj, const void *item)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ return _item_find(obj, item);
+}
+
+/**
* Clears an index of its items.
*
* @param obj The index object.
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- Item *it;
+ Elm_Index_Item *it;
Eina_List *l, *clear = NULL;
if (!wd) return;
_index_box_clear(obj, wd->bx[wd->level], wd->level);
_index_box_auto_fill(obj, wd->bx[0], 0);
if (wd->level == 1) _index_box_auto_fill(obj, wd->bx[1], 1);
}
+
+/**
+ * Returns the data associated with the item.
+ *
+ * @param it The list item
+ * @return The data associated with @p it
+ *
+ * @ingroup Index
+ */
+EAPI void *
+elm_index_item_data_get(const Elm_Index_Item *it)
+{
+ if (!it) return NULL;
+ return (void *)it->data;
+}
+
+/**
+ * Set the data item from the index item
+ *
+ * This set a new data value.
+ *
+ * @param it The item
+ * @param data The new data pointer to set
+ *
+ * @ingroup Index
+ */
+EAPI void
+elm_index_item_data_set(Elm_Index_Item *it, const void *data)
+{
+ if (!it) return;
+ it->data = data;
+}
+
+/**
+ * Gets the letter of the item.
+ *
+ * @param it The list item
+ * @return The letter of @p it
+ *
+ * @ingroup Index
+ */
+EAPI const char *
+elm_index_item_letter_get(const Elm_Index_Item *it)
+{
+ if (!it) return NULL;
+ return it->letter;
+}
+
#include <Elementary.h>
#include "elm_priv.h"
+static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV };
+EAPI Elm_Version *elm_version = &_version;
+
/**
* @defgroup Start Getting Started
*
*/
static int _elm_signal_exit(void *data, int ev_type, void *ev);
-#ifdef HAVE_ELEMENTARY_X
-static int _elm_window_property_change(void *data, int ev_type, void *ev);
-#endif
char *_elm_appname = NULL;
const char *_elm_data_dir = NULL;
}
#ifdef ELM_EDBUS
-static Eina_Bool _elm_need_e_dbus = 0;
+static Eina_Bool _elm_need_e_dbus = EINA_FALSE;
#endif
EAPI void
elm_need_e_dbus(void)
}
#ifdef ELM_EFREET
-static Eina_Bool _elm_need_efreet = 0;
+static Eina_Bool _elm_need_efreet = EINA_FALSE;
#endif
EAPI void
elm_need_efreet(void)
evas_init();
edje_init();
ecore_evas_init(); // FIXME: check errors
+ ecore_imf_init();
_elm_module_init();
_elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
_elm_unneed_e_dbus();
_elm_unneed_ethumb();
_elm_module_shutdown();
+ ecore_imf_shutdown();
ecore_evas_shutdown();
edje_shutdown();
evas_shutdown();
*/
/**
+ * Get the focus of the object
+ *
+ * This gets the focused property of the object.
+ *
+ * @param obj The object
+ * @return 1 if the object is focused, 0 if not.
+ * @ingroup Focus
+ */
+EAPI Eina_Bool
+elm_object_focus_get(Evas_Object *obj)
+{
+ return elm_widget_focus_get(obj);
+}
+
+/**
* Set the focus to the object
*
- * This sets the focus target forkeyboard input to be the object indicated.
+ * This sets the focus target for keyboard input to be the object indicated.
*
* @param obj The object
* @ingroup Focus
}
/**
- * Set the focus to the object
+ * Remove the focus from the object
*
- * This sets the focus target forkeyboard input to be the object indicated.
+ * This removes the focus target for keyboard input from be the object
+ * indicated.
*
* @param obj The object
* @ingroup Focus
EAPI Eina_Bool
elm_menu_item_disabled_get(Elm_Menu_Item *item)
{
- if (!item) return 0;
+ if (!item) return EINA_FALSE;
return item->disabled;
}
EAPI Eina_Bool
elm_menu_item_is_separator(Elm_Menu_Item *item)
{
- if (!item) return 0;
+ if (!item) return EINA_FALSE;
return item->separator;
}
* ELM_PANEL_ORIENT_BOTTOM
* ELM_PANEL_ORIENT_LEFT
* ELM_PANEL_ORIENT_RIGHT
- * NOTE: Only LEFT orientation is implemented.
+ * NOTE: Only LEFT and RIGHT orientations are implemented.
*
* THIS WIDGET IS UNDER CONSTRUCTION!
*/
* ELM_PANEL_ORIENT_LEFT
* ELM_PANEL_ORIENT_RIGHT
*
- * NOTE: Currently all orientations but LEFT are unimplemented.
+ * NOTE: Only LEFT and RIGHT orientations are implemented.
*
* @ingroup Panel
*/
break;
case ELM_PANEL_ORIENT_LEFT:
elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "left");
+ break;
case ELM_PANEL_ORIENT_RIGHT:
+ elm_smart_scroller_object_theme_set(obj, wd->scr, "panel", "base", "right");
break;
default:
break;
EAPI Eina_Bool
elm_photo_file_set(Evas_Object *obj, const char *file)
{
- ELM_CHECK_WIDTYPE(obj, widtype) 0;
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return 0;
+ if (!wd) return EINA_FALSE;
if (!_els_smart_icon_file_key_set(wd->img, file, NULL))
- return 0;
+ return EINA_FALSE;
_sizing_eval(obj);
- return 1;
+ return EINA_TRUE;
}
/**
for (x = 0; x < g->gw; x++)
{
int tn, xx, yy, ww, hh;
- Eina_Bool visible = 0;
+ Eina_Bool visible = EINA_FALSE;
tn = (y * g->gw) + x;
xx = g->grid[tn].out.x;
if (!wd) return;
if (wd->label) eina_stringshare_del(wd->label);
if (wd->delay) ecore_timer_del(wd->delay);
+ if (wd->spin) ecore_timer_del(wd->spin);
if (wd->special_values)
EINA_LIST_FREE(wd->special_values, sv)
{
new_val = wd->val_max;
}
- if (new_val == wd->val) return 0;
+ if (new_val == wd->val) return EINA_FALSE;
wd->val = new_val;
evas_object_smart_callback_call(obj, "changed", NULL);
if (wd->delay) ecore_timer_del(wd->delay);
wd->delay = ecore_timer_add(0.2, _delay_change, obj);
- return 1;
+ return EINA_TRUE;
}
static void
len = 0;
EINA_LIST_FOREACH(th->themes, l, f)
{
- len + strlen(f);
+ len += strlen(f);
if (l->next) len += 1;
}
tmp = alloca(len + 1);
} children;
const char *file;
const char *key;
+ struct
+ {
+ const char *file;
+ const char *key;
+ } thumb;
Ecore_Event_Handler *eeh;
int id;
Elm_Thumb_Animation_Setting anim_setting;
elm_widget_sub_object_add(wd->self, wd->children.view);
edje_object_part_swallow(wd->children.frm, "elm.swallow.content",
wd->children.view);
+ eina_stringshare_replace(&(wd->thumb.file), thumb_path);
+ eina_stringshare_replace(&(wd->thumb.key), thumb_key);
edje_object_signal_emit(wd->children.frm, EDJE_SIGNAL_GENERATE_STOP, "elm");
evas_object_smart_callback_call(wd->self, SIG_GENERATE_STOP, NULL);
return;
#endif
#ifdef ELM_ETHUMB
-static Eina_Bool _elm_need_ethumb = 0;
+static Eina_Bool _elm_need_ethumb = EINA_FALSE;
static void _on_die_cb(void *, Ethumb_Client *);
}
}
+ eina_stringshare_replace(&(wd->thumb.file), NULL);
+ eina_stringshare_replace(&(wd->thumb.key), NULL);
+
#ifdef HAVE_ELEMENTARY_ETHUMB
if ((file_replaced || key_replaced) && evas_object_visible_get(obj))
_thumb_show(wd);
* @param key Pointer to key.
*
* @see elm_thumb_file_set()
+ * @see elm_thumb_path_get()
* @see elm_thumb_animate()
*
* @ingroup Thumb
}
/**
+ * Get the path and key to the image or video generated by ethumb.
+ *
+ * One just need to make sure that the thumbnail was generated before getting
+ * its path; otherwise, the path will be NULL. One way to do that is by asking
+ * for the path when/after the "generate,stop" smart callback is called.
+ *
+ * @param obj The thumb object.
+ * @param file Pointer to thumb path.
+ * @param key Pointer to thumb key.
+ *
+ * @see elm_thumb_file_get()
+ *
+ * @ingroup Thumb
+ */
+EAPI void
+elm_thumb_path_get(const Evas_Object *obj, const char **file, const char **key)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (file)
+ *file = wd->thumb.file;
+ if (key)
+ *key = wd->thumb.key;
+}
+
+/**
* Set the animation state for the thumb object. If its content is an animated
* video, you may start/stop the animation or tell it to play continuously and
* looping.
EAPI Eina_Bool
elm_toolbar_scrollable_get(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
+ if (!wd) return EINA_FALSE;
return wd->scrollable;
}
EAPI Eina_Bool
elm_toolbar_homogenous_get(Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
+ if (!wd) return EINA_FALSE;
return wd->homogeneous;
}
}
/**
+ * Unselect the specified toolbar item.
+ *
+ * @param item The toolbar item
+ *
+ * @ingroup Toolbar
+ */
+EAPI void
+elm_toolbar_item_unselect(Elm_Toolbar_Item *item)
+{
+ if ((!item) || (!item->selected)) return;
+ item->selected = EINA_FALSE;
+ edje_object_signal_emit(item->base, "elm,state,unselected", "elm");
+}
+
+/**
* Set the alignment of the items.
*
* @param obj The toolbar object
EAPI Eina_List *
elm_toolbar_item_get_all(Evas_Object *obj)
{
- Eina_List *l;
- Elm_Toolbar_Item *it;
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
EAPI Elm_Toolbar_Item *
elm_toolbar_item_get_first(Evas_Object *obj)
{
- Eina_List *l;
Elm_Toolbar_Item *it;
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
EAPI Elm_Toolbar_Item *
elm_toolbar_item_get_last(Evas_Object *obj)
{
- Eina_List *l, *last;
+ Eina_List *last;
Elm_Toolbar_Item *it;
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
EAPI Eina_Bool
elm_widget_drag_lock_x_get(Evas_Object *obj)
{
- API_ENTRY return 0;
+ API_ENTRY return EINA_FALSE;
printf("check %p x lock %i\n", obj, sd->drag_x_locked);
return sd->drag_x_locked;
}
EAPI Eina_Bool
elm_widget_drag_lock_y_get(Evas_Object *obj)
{
- API_ENTRY return 0;
+ API_ENTRY return EINA_FALSE;
printf("check %p y lock %i\n", obj, sd->drag_y_locked);
return sd->drag_y_locked;
}
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
- if (!sd) return 0;
+ if (!sd) return EINA_FALSE;
/* smart code here */
if (sd->size != 0)
evas_object_image_load_size_set(sd->obj, sd->size, sd->size);
evas_object_image_file_set(sd->obj, file, key);
if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE)
- return 0;
+ return EINA_FALSE;
_smart_reconfigure(sd);
- return 1;
+ return EINA_TRUE;
}
Eina_Bool
Smart_Data *sd;
sd = evas_object_smart_data_get(obj);
- if (!sd) return 0;
+ if (!sd) return EINA_FALSE;
/* smart code here */
if (sd->obj) evas_object_del(sd->obj);
sd->obj = edje_object_add(evas_object_evas_get(obj));
evas_object_smart_member_add(sd->obj, obj);
if (!edje_object_file_set(sd->obj, file, part))
- return 0;
+ return EINA_FALSE;
_smart_reconfigure(sd);
- return 1;
+ return EINA_TRUE;
}
void
{
if ((sd->pagerel_h == 0.0) && (sd->pagesize_h == 0) &&
(sd->pagerel_v == 0.0) && (sd->pagesize_v == 0))
- return 0;
- return 1;
+ return EINA_FALSE;
+ return EINA_TRUE;
}
static Evas_Coord
switch (dir)
{
case LEFT:
- if (px > 0) return 1;
+ if (px > 0) return EINA_TRUE;
break;
case RIGHT:
- if (px < mx) return 1;
+ if (px < mx) return EINA_TRUE;
break;
case UP:
- if (py > 0) return 1;
+ if (py > 0) return EINA_TRUE;
break;
case DOWN:
- if (py < my) return 1;
+ if (py < my) return EINA_TRUE;
break;
default:
break;
}
- return 0;
+ return EINA_FALSE;
}
static int
elm_widget_drag_lock_y_set(sd->widget, 0);
}
}
- return 1;
+ return EINA_TRUE;
}
static void
}
if (start) _smart_drag_start(sd->smart_obj);
}
- return 1;
+ return EINA_TRUE;
}
static void