efl-js: JavaScript Eolian binding

To configure elementary sources with bindings to use in nodejs add
––with-js=nodejs in configure flags in EFL compilation to generate
node files, then compile elementary normally:

path/to/efl$ configure --with-js=nodejs
path/to/efl$ make
path/to/efl$ make install

path/to/elm$ configure
path/to/efl$ make
path/to/efl$ make install

To use, you have to require elm:

elm = require('elm')

The bindings is divided in two parts: generated and manually
written. The generation uses the Eolian library for parsing Eo files
and generate C++ code that is compiled against V8 interpreter library
to create a elm.node file that can be required in a node.js instance.

@feature
devs/felipealmeida/promises
Felipe Magno de Almeida 8 years ago
parent 81bf2796c6
commit 4f44ca0a16
  1. 2
      legacy/elementary/Makefile_Eolian_Cxx_Helper.am
  2. 15
      legacy/elementary/Makefile_Eolian_Js_Helper.am
  3. 80
      legacy/elementary/configure.ac
  4. 2
      legacy/elementary/doc/Doxyfile.in
  5. 1022
      legacy/elementary/doc/examples-js.dox
  6. 7
      legacy/elementary/m4/ac_define_if.m4
  7. 8
      legacy/elementary/src/examples/Makefile.am
  8. 15
      legacy/elementary/src/examples/bg_example_01.js
  9. 19
      legacy/elementary/src/examples/bg_example_02.js
  10. 34
      legacy/elementary/src/examples/box_js_example_01.js
  11. 86
      legacy/elementary/src/examples/box_js_example_02.js
  12. 54
      legacy/elementary/src/examples/bubble_example_01.js
  13. 21
      legacy/elementary/src/examples/button_example_00.js
  14. 208
      legacy/elementary/src/examples/button_example_01.js
  15. 14
      legacy/elementary/src/examples/calendar_example_01.js
  16. 17
      legacy/elementary/src/examples/calendar_example_02.js
  17. 15
      legacy/elementary/src/examples/calendar_example_03.js
  18. 32
      legacy/elementary/src/examples/calendar_example_04.js
  19. 29
      legacy/elementary/src/examples/calendar_example_05.js
  20. 43
      legacy/elementary/src/examples/clock_example.js
  21. 42
      legacy/elementary/src/examples/datetime_example.js
  22. 33
      legacy/elementary/src/examples/icon_example_01.js
  23. 37
      legacy/elementary/src/examples/menu_example_01.js
  24. 32
      legacy/elementary/src/examples/popup_example_01.js
  25. 65
      legacy/elementary/src/examples/radio_example_01.js
  26. 41
      legacy/elementary/src/examples/separator_example_01.js
  27. 104
      legacy/elementary/src/examples/slider_example.js
  28. 90
      legacy/elementary/src/examples/spinner_example.js
  29. 34
      legacy/elementary/src/examples/table_example_01.js
  30. 38
      legacy/elementary/src/examples/table_example_02.js
  31. 38
      legacy/elementary/src/examples/thumb_example_01.js
  32. 89
      legacy/elementary/src/examples/twitter_example_01.edc
  33. 82
      legacy/elementary/src/examples/twitter_example_01.js
  34. 47
      legacy/elementary/src/lib/Makefile.am
  35. 2
      legacy/elementary/src/lib/elc_fileselector_entry.c
  36. 2
      legacy/elementary/src/lib/elc_multibuttonentry.c
  37. 2
      legacy/elementary/src/lib/elc_naviframe.c
  38. 2
      legacy/elementary/src/lib/elc_popup.c
  39. 288
      legacy/elementary/src/lib/elementary_js.cc
  40. 2
      legacy/elementary/src/lib/elm_actionslider.c
  41. 4
      legacy/elementary/src/lib/elm_actionslider.eo
  42. 2
      legacy/elementary/src/lib/elm_bubble.eo
  43. 2
      legacy/elementary/src/lib/elm_entry.c
  44. 4
      legacy/elementary/src/lib/elm_entry.eo
  45. 2
      legacy/elementary/src/lib/elm_fileselector.eo
  46. 4
      legacy/elementary/src/lib/elm_fileselector_entry.eo
  47. 2
      legacy/elementary/src/lib/elm_label.eo
  48. 2
      legacy/elementary/src/lib/elm_layout.c
  49. 24
      legacy/elementary/src/lib/elm_layout.eo
  50. 4
      legacy/elementary/src/lib/elm_multibuttonentry.eo
  51. 4
      legacy/elementary/src/lib/elm_naviframe.eo
  52. 4
      legacy/elementary/src/lib/elm_popup.eo

@ -6,7 +6,7 @@ AM_V_EOLCXX = $(am__v_EOLCXX_@AM_V@)
am__v_EOLCXX_ = $(am__v_EOLCXX_@AM_DEFAULT_V@)
am__v_EOLCXX_0 = @echo " EOLCXX " $@;
SUFFIXES += .eo.hh
SUFFIXES += .eo.hh .eo.impl.hh
%.eo.impl.hh %.eo.hh: %.eo $(_EOLIAN_CXX_DEP)
$(AM_V_EOLCXX) \

@ -0,0 +1,15 @@
if HAVE_JS
EOLIAN_JS = @eolian_js@
_EOLIAN_JS_DEP = @eolian_js@
endif
AM_V_EOLJS = $(am__v_EOLJS_@AM_V@)
am__v_EOLJS_ = $(am__v_EOLJS_@AM_DEFAULT_V@)
am__v_EOLJS_0 = @echo " EOLJS " $@;
SUFFIXES += .eo.js.cc
%.eo.js.cc: %.eo $(_EOLIAN_JS_DEP)
$(AM_V_EOLJS)$(EOLIAN_JS) $(EOLIAN_FLAGS) -o $@ $<

@ -36,6 +36,12 @@ AC_ARG_ENABLE([cxx-bindings],
[want_cxx11="${enableval}"],
[want_cxx11="yes"])
AC_ARG_ENABLE([js-bindings],
[AS_HELP_STRING([--enable-js-bindings],
[enable JS bindings. @<:@default=disabled@:>@])],
[want_js="${enableval}"],
[want_js="yes"])
# Tests
AC_ARG_WITH([tests],
@ -196,6 +202,7 @@ EFL_WITH_BIN([eldbus], [eldbus_codegen], [eldbus-codegen])
# Force the helper to try external eolian generators
AM_CONDITIONAL([HAVE_EOLIAN_GEN], [true])
AM_CONDITIONAL([HAVE_EOLIAN_CXX], [true])
AM_CONDITIONAL([HAVE_EOLIAN_JS], [true])
EFL_ENABLE_BIN([elementary-test])
EFL_ENABLE_BIN([elementary-codegen])
@ -256,13 +263,6 @@ ELM_CHECK_OPTION([eweather], [0.2.0])
ELM_CHECK_OPTION([emap], [0.1.0])
ELM_CHECK_OPTION([eweb])
PKG_CHECK_MODULES([ELEMENTARY], [${requirement_elm_pc}])
PKG_CHECK_MODULES([ELEMENTARY_PC], [${requirement_elm_pc_only}])
EFL_ENABLE_EO_API_SUPPORT
EFL_ENABLE_BETA_API_SUPPORT
if test "x${HAVE_CXX11}" = "x1" -a "x${want_cxx11}" = "xyes"; then
PKG_CHECK_MODULES([ELEMENTARY_CXX],
[
@ -294,6 +294,67 @@ else
fi
AM_CONDITIONAL([HAVE_CXX11], [test "x${have_cxx11}" = "xyes"])
if test "x${want_js}" = "xyes"; then
PKG_CHECK_MODULES([ELEMENTARY_JS],
[
eolian-js >= efl_version
eo-js >= efl_version
efl-js >= efl_version
eina-js >= efl_version
efl-cxx >= efl_version
eo-cxx >= efl_version
eina-cxx >= efl_version
],
[
requirement_elm_js_pc="${requirement_elm_js_pc} \
eolian-js >= efl_version \
eo-js >= efl_version \
efl-js >= efl_version \
eina-js >= efl_version \
efl-cxx >= efl_version \
eina-cxx >= efl_version \
eo-cxx >= efl_version \
"
have_js="yes"
dep_js=`$PKG_CONFIG --variable=want_js efl-js`
],
[have_js="no"
dep_js="none"
]
)
else
have_js="no"
dep_js="none"
fi
PKG_CHECK_MODULES([ELEMENTARY], [${requirement_elm_pc}])
if test "x${have_js}" = "xyes"; then
PKG_CHECK_MODULES([ELEMENTARY_JS], [${requirement_elm_js_pc}])
fi
PKG_CHECK_MODULES([ELEMENTARY_PC], [${requirement_elm_pc_only}])
EFL_ENABLE_EO_API_SUPPORT
EFL_ENABLE_BETA_API_SUPPORT
AM_CONDITIONAL([HAVE_JS], [test "x${have_js}" = "xyes"])
AM_CONDITIONAL([HAVE_NODEJS], [test "x${dep_js}" = "xnodejs"])
AC_DEFINE_IF([HAVE_NODEJS], [test "x${dep_js}" = "xnodejs"],
[1], [Using NodeJS])
AC_SUBST([want_js])
AC_SUBST([HAVE_NODEJS])
AM_CONDITIONAL([HAVE_JS], [test "x${dep_js}" = "xnodejs" -o "x${dep_js}" = "xlibv8" -o "x${dep_js}" = "xlibuv"])
AC_DEFINE_IF([HAVE_JS], [test "x${dep_js}" = "xnodejs" -o "x${dep_js}" = "xlibv8" -o "x${dep_js}" = "xlibuv"],
[1], [Compiling bindings for JavaScript])
AC_SUBST([HAVE_JS])
AM_CONDITIONAL([HAVE_LIBUV], [test "x${dep_js}" = "xnodejs" -o "x${dep_js}" = "xlibuv"])
AC_DEFINE_IF([HAVE_LIBUV], [test "x${dep_js}" = "xnodejs" -o "x${dep_js}" = "xlibuv"],
[1], [Compiling libuv event loop integration])
AC_SUBST([HAVE_LIBUV])
EFL_WITH_BIN([eolian-js], [eolian-js], [eolian_js])
MODULE_EDJE=`${PKG_CONFIG} --variable=module_arch edje`
AC_SUBST([MODULE_EDJE])
@ -359,6 +420,7 @@ ELEMENTARY_LIBS="${ELEMENTARY_LIBS} ${requirement_elm_libs}"
ELEMENTARY_PC_LIBS="${ELEMENTARY_PC_LIBS} ${requirement_elm_libs}"
AC_SUBST([requirement_elm_pc])
AC_SUBST([requirement_elm_js_pc])
# check unit testing library
if test "${want_tests}" = "yes"; then
@ -564,6 +626,9 @@ echo " elm_prefs_cc.............: ${elm_prefs_cc}"
echo " eolian_gen...............: ${eolian_gen}"
echo " eolian_cxx...............: ${eolian_cxx}"
echo " eldbus_codegen...........: ${eldbus_codegen}"
if test "x${have_js}" = "xyes"; then
echo " eolian_js...............: ${eolian_js}"
fi
echo
echo " Build elementary_test....: ${have_elementary_test}"
echo " Build elementary_codegen.: ${have_elementary_codegen}"
@ -573,6 +638,7 @@ echo " Examples installed.......: ${enable_install_examples}"
echo " Build elementary_config..: ${have_elementary_config}"
echo " Enable debug.............: ${want_elementary_debug}"
echo " Enable C++...............: ${have_cxx11}"
echo " Enable JavaScript........: ${have_js}"
echo
echo "Compilation................: make (or gmake)"
echo " CPPFLAGS.................: $CPPFLAGS"

@ -1,7 +1,7 @@
PROJECT_NAME = Elementary
PROJECT_NUMBER = @PACKAGE_VERSION@
OUTPUT_DIRECTORY = .
INPUT = @srcdir@/examples.dox @srcdir@/examples-cxx.dox @top_srcdir@/src/lib @srcdir@/index.doxy @top_srcdir@/src/bin/elm_prefs_cc_handlers.c
INPUT = @srcdir@/examples.dox @srcdir@/examples-cxx.dox @srcdir@/examples-js.dox @top_srcdir@/src/lib @srcdir@/index.doxy @top_srcdir@/src/bin/elm_prefs_cc_handlers.c
IMAGE_PATH = @srcdir@/img
OUTPUT_LANGUAGE = English
GENERATE_HTML = YES

File diff suppressed because it is too large Load Diff

@ -0,0 +1,7 @@
dnl use: AC_DEFINE_IF(id, testcond, val, comment)
AC_DEFUN([AC_DEFINE_IF],
[
if $2; then
AC_DEFINE($1, $3, $4)
fi
])

@ -145,7 +145,8 @@ evas3d_scene_on_button_example.c \
evas3d_object_on_button_example.c \
evas3d_map_example.edc \
evas3d_map_example.c \
track_example_01.c
track_example_01.c \
twitter_example_01.edc
if HAVE_CXX11
SRCS += \
@ -197,7 +198,8 @@ files_DATA += \
theme_example.edj \
layout_example.edj\
codegen_example.edj \
evas3d_map_example.edj
evas3d_map_example.edj \
twitter_example_01.edj
clean-local:
rm -f *.edj *.epb *.cfg *.cfg.bkp
@ -528,4 +530,4 @@ screenshots:
endif
EXTRA_DIST = dict.txt layout_example.edc theme_example.edc codegen_example.edc evas3d_map_example.edc
EXTRA_DIST = dict.txt layout_example.edc theme_example.edc codegen_example.edc evas3d_map_example.edc twitter_example_01.edc

@ -0,0 +1,15 @@
var elm = require('elm')
win = new elm.Elm.WinStandard(null);
win.setTitle("Bg Plain");
win.setAutohide(true);
bg = new elm.Elm.Bg(win);
bg.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bg);
bg.setVisible(true);
win.setSize(320,320);
win.setVisible(true);

@ -0,0 +1,19 @@
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Bg Image");
win.setAutohide(true);
bg = new elm.Elm.Bg(win);
bg.setLoadSize(20,20);
bg.setOption(elm.Elm.Bg.Option.CENTER);
//TODO: elm_app_data_dir_get
bg.setFile('../../data/images/plant_01.jpg', null);
bg.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bg);
bg.setVisible(true);
win.setSize(320, 320);
win.setVisible(true);

@ -0,0 +1,34 @@
var elm = require('elm')
win = new elm.Elm.WinStandard(null);
win.setTitle('title');
win.setAutohide(true);
bg = new elm.Elm.Bg(win);
bg.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bg);
bg.setVisible(true);
bx = new elm.Elm.Box(win);
bx.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bx);
entry = new elm.Elm.Label(win);
entry.setSize(100, 100);
entry.setText(null, "Texto");
console.log('Texto: ', entry.getText(null));
entry.setSizeHintWeight(1.0, 1.0);
entry.setSizeHintAlign(-1.0, -1.0);
entry.setWrapWidth(50);
bx.packEnd(entry);
entry.setVisible(true);
bx.setVisible(true);
win.setSize(300, 320);
win.setVisible(true);
console.log("Going to wait now\n");

@ -0,0 +1,86 @@
var efl = require('efl')
var elm = require('elm')
_add_cb = function(){
var btn = new elm.Elm.Button(win);
btn.setText("elm.text", "I do nothing");
bx.packEnd(btn);
btn.setVisible(true);
}
_clear_cb = function(){
bx.clear();
}
_unpack_cb = function(btn){
bx.unpack(btn);
btn.setColor(128, 64, 0, 128)
}
win = new elm.Elm.WinStandard(null);
win.setTitle("Box example");
win.setAutohide(true);
bg = new elm.Elm.Bg(win);
bg.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bg);
bg.setVisible(true);
bigbox = new elm.Elm.Box(win)
bigbox.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bigbox);
bx = new elm.Elm.Box(win)
bx.setSizeHintWeight(1.0, 1.0);
bx.setHorizontal(true);
bigbox.packEnd(bx);
bx.setVisible(true);
bt = new elm.Elm.Button(win);
bt.textSet("elm.text", "Add");
bx.packEnd(bt);
bt.setVisible(true);
bt.on('clicked', _add_cb);
bt = new elm.Elm.Button(win);
bt.textSet("elm.text", "Clear");
bx.packEnd(bt);
bt.setVisible(true);
bt.on('clicked', _clear_cb);
bx = new elm.Elm.Box(win)
bx.setSizeHintWeight(1.0, 1.0);
bx.setSizeHintAlign(-1.0, -1.0);
bx.setHorizontal(true);
bigbox.packEnd(bx);
bx.setVisible(true);
bt = new elm.Elm.Button(win);
bt.textSet("elm.text", "Button 1");
bx.packEnd(bt);
bt.setSizeHintWeight(1.0, 1.0);
bt.setSizeHintAlign(-1.0, -1.0);
bt.setVisible(true);
bt.on('clicked', _unpack_cb);
bt = new elm.Elm.Button(win);
bt.textSet("elm.text", "Button 2");
bx.packEnd(bt);
bt.setSizeHintWeight(1.0, 0.0);
bt.setSizeHintAlign(1.0, 0.5);
bt.setVisible(true);
bt.on('clicked', _unpack_cb);
bt = new elm.Elm.Button(win);
bt.textSet("elm.text", "Button 3");
bx.packEnd(bt);
bt.setVisible(true);
bt.on('clicked', _unpack_cb);
bigbox.setVisible(true);
win.setSize(300, 320);
win.setVisible(true);
console.log("Going to wait now\n");

@ -0,0 +1,54 @@
efl = require('efl');
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Bg Plain");
win.setAutohide(true);
bg = new elm.Elm.Bg(win);
bg.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bg);
bg.setVisible(true);
label1 = new elm.Elm.Label(win);
label1.setText(null, "Bubble with no icon, info or label");
label1.setVisible(true);
console.log(efl);
icon = new efl.Evas.Rectangle(win);
icon.setColor( 0, 0, 255, 255);
icon.setVisible(true);
bubble1 = new elm.Elm.Bubble(win);
bubble1.contentSet("icon", icon);
bubble1.setText("info", "INFO");
bubble1.setText(null, "LABEL");
bubble1.contentSet(null, label1);
bubble1.setSize(300, 100);
bubble1.setVisible(true);
corner = 0;
bubble1.on('clicked',
function()
{
++corner;
if (corner > 3)
bubble1.pos_set(corner = 0);
else
bubble1.pos_set(corner);
});
label2 = new elm.Elm.Label(win);
label2.setText(null, "Bubble with no icon, info or label");
label2.setVisible(true);
bubble2 = new elm.Elm.Bubble(win);
bubble2.contentSet(null, label2);
bubble2.setSize(200, 50);
bubble2.setPosition(0, 110);
bubble2.setVisible(true);
win.setSize(300, 200);
win.setVisible(true);

@ -0,0 +1,21 @@
efl = require('efl');
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Hello, World!");
win.setAutohide(true);
btn = new elm.Elm.Button(win);
btn.setText(null, "Good-Bye, World!");
btn.setSize(120, 30);
btn.setPosition(60, 15);
btn.setSizeHintWeight(1.0, 1.0);
btn.setSizeHintAlign(1.0, 1.0);
btn.setVisible(true);
btn.on('clicked', function () { console.log('clicked'); } );
win.setSize(240, 60);
win.setVisible(true);

@ -0,0 +1,208 @@
efl = require('efl');
elm = require('elm');
_btn_options_cb = function(_btn) {
var text = _btn.textGet("elm.text");
var lbl = text.split(": ");
var t = parseFloat(lbl[1]);
if (lbl[0] === "Initial")
{
console.log ("Initial: " + lbl[1]);
up.setAutorepeatInitialTimeout(t);
down.setAutorepeatInitialTimeout(t);
left.setAutorepeatInitialTimeout(t);
right.setAutorepeatInitialTimeout(t);
}
else if (lbl[0] === "Gap")
{
console.log ("Gap: " + lbl[1]);
up.setAutorepeatGapTimeout(t);
down.setAutorepeatGapTimeout(t);
left.setAutorepeatGapTimeout(t);
right.setAutorepeatGapTimeout(t);
}
}
_btn_cursors_move = function(_btn) {
var size = mid.getSizeHintAlign();
var ax = size[0];
var ay = size[1];
console.log ("cursor move: ", size[0], size[1]);
if (!icon_still) {
var icon = new elm.Elm.Icon(mid);
var icon_still_p = mid.contentUnset("icon");
if (icon_still_p) {
icon_still_p.setVisible(false);
}
icon.setStandard("chat");
mid.contentSet("icon", icon);
}
if (_btn.getPosition()[1] == up.getPosition()[1]) {
ay -= 0.05;
if (ay < 0.0) ay = 0.0;
}
else if (_btn.getPosition()[1] == down.getPosition()[1]) {
ay += 0.05;
if (ay > 1.0) ay = 1.0;
}
else if (_btn.getPosition()[0] == left.getPosition()[0]) {
ax -= 0.05;
if (ax < 0.0) ax = 0.0;
}
else if (_btn.getPosition()[0] == right.getPosition()[0]) {
ax += 0.05;
if (ax > 1.0) ax = 1.0;
}
mid.setSizeHintAlign(ax, ay);
}
win = new elm.Elm.WinStandard(null);
win.setTitle("Button example");
win.setAutohide(true);
icon_still = new elm.Elm.Icon(win);
mid = new elm.Elm.Button(win);
up = new elm.Elm.Button(win);
down = new elm.Elm.Button(win);
left = new elm.Elm.Button(win);
right = new elm.Elm.Button(win);
_btn_cursors_release = function() {
if (icon_still)
{
mid.contentSet("icon", icon_still);
icon_still = null;
}
}
box = new elm.Elm.Box(win);
box.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(box);
box.setVisible(true);
box_initial = new elm.Elm.Box(win);
box_initial.setHorizontal(true);
box_initial.setSizeHintWeight(1.0, 0.0);
box.packEnd(box_initial);
box_initial.setVisible(true);
btn = new elm.Elm.Button(win);
btn.setText("elm.text", "Initial: 0.0");
box_initial.packEnd(btn);
btn.setVisible(true);
btn.on('clicked', _btn_options_cb);
btn2 = new elm.Elm.Button(win);
btn2.setText("elm.text", "Initial: 1.0");
box_initial.packEnd(btn2);
btn2.setVisible(true);
btn2.on('clicked', _btn_options_cb);
btn3 = new elm.Elm.Button(win);
btn3.setText("elm.text", "Initial: 5.0");
box_initial.packEnd(btn3);
btn3.setVisible(true);
btn3.on('clicked', _btn_options_cb);
box_gap = new elm.Elm.Box(win);
box_gap.setHorizontal(true);
box_gap.setSizeHintWeight(1.0, 0.0);
box.packEnd(box_gap);
box_gap.setVisible(true);
btn4 = new elm.Elm.Button(win);
btn4.setText("elm.text", "Gap: 0.1");
box_gap.packEnd(btn4);
btn4.setVisible(true);
btn4.on('clicked', _btn_options_cb);
btn5 = new elm.Elm.Button(win);
btn5.setText("elm.text", "Gap: 0.5");
box_gap.packEnd(btn5);
btn5.setVisible(true);
btn5.on('clicked', _btn_options_cb);
btn6 = new elm.Elm.Button(win);
btn6.setText("elm.text", "Gap: 1.0");
box_gap.packEnd(btn6);
btn6.setVisible(true);
btn6.on('clicked', _btn_options_cb);
up.setAutorepeat(true);
up.setAutorepeatInitialTimeout(1.0);
up.setAutorepeatGapTimeout(0.5);
up.setSizeHintWeight(1.0, 0.0);
up.setSizeHintAlign(-1.0, 0.0);
box.packEnd(up);
up.setVisible(true);
up.on('repeated', _btn_cursors_move)
up.on('unpressed', _btn_cursors_release);
icon_up = new elm.Elm.Icon(win);
icon_up.setStandard("arrow_up");
up.contentSet("icon", icon_up);
box_inferior = new elm.Elm.Box(win);
box_inferior.setHorizontal(true);
box_inferior.setSizeHintWeight(1.0, 1.0);
box_inferior.setSizeHintAlign(-1.0, -1.0);
box.packEnd(box_inferior);
box_inferior.setVisible(true);
left.setAutorepeat(true);
left.setAutorepeatInitialTimeout(1.0);
left.setAutorepeatGapTimeout(0.5);
left.setSizeHintWeight(0.0, 1.0);
left.setSizeHintAlign(0.0, -1.0);
box_inferior.packEnd(left);
left.setVisible(true);
left.on('repeated', _btn_cursors_move)
left.on('unpressed', _btn_cursors_release);
icon_left = new elm.Elm.Icon(win);
icon_left.setStandard("arrow_left");
left.contentSet("icon", icon_left);
mid.setSizeHintWeight(1.0, 1.0);
box_inferior.packEnd(mid);
mid.setVisible(true);
icon_mid = new elm.Elm.Icon(win);
icon_mid.setStandard("close");
mid.contentSet("icon", icon_mid);
right.setAutorepeat(true);
right.setAutorepeatInitialTimeout(1.0);
right.setAutorepeatGapTimeout(0.5);
right.setSizeHintWeight(0.0, 1.0);
right.setSizeHintAlign(0.0, -1.0);
box_inferior.packEnd(right);
right.setVisible(true);
right.on('repeated', _btn_cursors_move);
right.on('unpressed', _btn_cursors_release);
icon_right = new elm.Elm.Icon(win);
icon_right.setStandard("arrow_right");
right.contentSet("icon", icon_right);
down.setAutorepeat(true);
down.setAutorepeatInitialTimeout(1.0);
down.setAutorepeatGapTimeout(0.5);
down.setSizeHintWeight(1.0, 0.0);
down.setSizeHintAlign(-1.0, 0.0);
box.packEnd(down);
down.setVisible(true);
down.on('repeated', _btn_cursors_move);
down.on('unpressed', _btn_cursors_release);
icon_down = new elm.Elm.Icon(win);
icon_down.setStandard("arrow_down");
down.contentSet("icon", icon_down);
win.setSize(300, 320);
win.setVisible(true);

@ -0,0 +1,14 @@
efl = require('efl');
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Calendar Creation Example");
win.setAutohide(true);
cal = new elm.Elm.Calendar(win);
cal.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(cal);
cal.setVisible(true);
win.setVisible(true);

@ -0,0 +1,17 @@
elm = require('elm');
//var weekdays = ["S", "M", "T", "W", "T", "F", "S"];
win = new elm.Elm.WinStandard(null);
win.setTitle("Calendar Layout Formatting Example");
win.setAutohide(true);
cal = new elm.Elm.Calendar(win);
cal.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(cal);
//cal.format_function_set(funtion);
//cal.weekdays_names_set(weekdays);
cal.setVisible(true);
win.setVisible(true);

@ -0,0 +1,15 @@
efl = require('efl');
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Calendar Min/Max Year Example");
win.setAutohide(true);
cal = new elm.Elm.Calendar(win);
cal.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(cal);
cal.setMinMaxYear(2020,2022);
cal.setVisible(true);
win.setVisible(true);

@ -0,0 +1,32 @@
elm = require('efl');
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Calendar Day Selection Example");
win.setAutohide(true);
box = new elm.Elm.Box(win);
box.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(box);
box.setVisible(true);
cal = new elm.Elm.Calendar(win);
cal.setSizeHintWeight(1.0, 1.0);
cal.setSizeHintAlign(-1.0, -1.0);
cal.setSelectMode(elm.Elm.Calendar.Select.Mode.NONE);
win.resizeObjectAdd(cal);
cal.setVisible(true);
box.packEnd(cal);
cal2 = new elm.Elm.Calendar(win);
cal2.setSizeHintWeight(1.0, 1.0);
cal2.setSizeHintAlign(-1.0, -1.0);
// selected_time_set uses tm* struct
//dateCurrent = new Date();
//dateSelected = dateCurrent.getSeconds() + 2 * 3600 * 24;
//cal2.selected_time_set(dateSelected);
cal2.setVisible(true);
box.packEnd(cal2);
win.setVisible(true);

@ -0,0 +1,29 @@
elm = require('elm');
_print_cal_info_cb = function ()
{
//var sel_time = cal.selected_time_get()
var interval = cal.getInterval();
var mm_yr = cal.getMinMaxYear();
var sel_enable = cal.getSelectMode() != elm.Elm.Calendar.Select.Mode.NONE;
var wds = cal.getWeekdaysNames();
console.log("weekdays= " + wds + ", interval= " + interval +
"\nYear_Min: "+mm_yr[0]+ ", Year_Max: "+mm_yr[1]+", Sel Enabled: "+sel_enable);
}
win = new elm.Elm.WinStandard(null);
win.setTitle("Calendar Getters Example");
win.setAutohide(true);
cal = new elm.Elm.Calendar(win);
cal.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(cal);
cal.on('changed', _print_cal_info_cb);
cal.setVisible(true);
win.setVisible(true);

@ -0,0 +1,43 @@
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Clock Example");
win.setAutohide(true);
bx = new elm.Elm.Box(win);
bx.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bx);
bx.setVisible(true);
ck = new elm.Elm.Clock(win);
bx.packEnd(ck);
ck.setVisible(true);
ck2 = new elm.Elm.Clock(win);
ck2.setShowAmPm(true);
bx.packEnd(ck2);
ck2.setVisible(true);
ck3 = new elm.Elm.Clock(win);
ck3.setShowSeconds(true);
ck3.setTime(10, 11, 12);
bx.packEnd(ck3);
ck3.setVisible(true);
ck4 = new elm.Elm.Clock(win);
ck4.setEdit(true);
ck4.setShowSeconds(true);
ck4.setShowAmPm(true);
ck4.setTime(10, 11, 12);
bx.packEnd(ck4);
ck4.setVisible(true);
ck5 = new elm.Elm.Clock(win);
ck5.setShowSeconds(true);
ck5.setEdit(true);
digedit = elm.Elm.Clock.EditMode.HOUR_UNIT | elm.Elm.Clock.EditMode.MIN_UNIT | elm.Elm.Clock.EditMode.SEC_UNIT;
ck5.setEditMode(digedit);
bx.packEnd(ck5);
ck5.setVisible(true);
win.setVisible(true);

@ -0,0 +1,42 @@
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Datetime");
win.setAutohide(true);
bg = new elm.Elm.Bg(win);
bg.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bg);
bg.setVisible(true);
bx = new elm.Elm.Box(win);
bx.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bx);
bx.setVisible(true);
datetime = new elm.Elm.Datetime(bx);
datetime.setSizeHintWeight(1.0, 1.0);
datetime.setSizeHintAlign(-1.0, 0.5);
datetime.fieldVisibleSet(elm.Elm.Datetime.FieldType.HOUR, false);
datetime.fieldVisibleSet(elm.Elm.Datetime.FieldType.MINUTE, false);
datetime.fieldVisibleSet(elm.Elm.Datetime.FieldType.AMPM, false);
bx.packEnd(datetime);
datetime.setVisible(true);
datetime = new elm.Elm.Datetime(bx);
datetime.setSizeHintWeight(1.0, 1.0);
datetime.setSizeHintAlign(-1.0, 0.5);
datetime.fieldVisibleSet(elm.Elm.Datetime.FieldType.YEAR, false);
datetime.fieldVisibleSet(elm.Elm.Datetime.FieldType.MONTH, false);
datetime.fieldVisibleSet(elm.Elm.Datetime.FieldType.DATE, false);
bx.packEnd(datetime);
datetime.setVisible(true);
datetime = new elm.Elm.Datetime(bx);
datetime.setSizeHintWeight(1.0, 1.0);
datetime.setSizeHintAlign(-1.0, 0.5);
bx.packEnd(datetime);
datetime.setVisible(true);
win.setVisible(true);

@ -0,0 +1,33 @@
efl = require('efl');
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Icon Plain");
win.setAutohide(true);
icon = new elm.Elm.Icon(win);
//icon.order_lookup_set(ELM_ICON_LOOKUP_THEME_FDO); Ja eh o default
icon.setStandard("home");
var path, group;
r = icon.getFile(path, group);
path = r[0];
gruop = r[1];
console.log("path = " + path + ", group = " + group);
var name;
name = icon.getStandard();
console.log("name = " + name);
icon.setNoScale(true);
icon.setResizable(false, true);
icon.setSmooth(false);
icon.setFillOutside(true);
icon.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(icon);
icon.setVisible(true);
win.setSize(320, 320);
win.setVisible(true);

@ -0,0 +1,37 @@
efl = require('efl');
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Menu");
win.setAutohide(true);
rect = new efl.Evas.Rectangle(win);
win.resizeObjectAdd(rect);
rect.setSizeHintMin( 0, 0);
rect.setColor( 0, 0, 0, 0);
rect.setVisible(true);
menu = new elm.Elm.Menu(win);
menu.itemAdd(null, null, "first item", null, null); // item_add nao implementado
menu_it = menu.itemAdd(null, "mail-reply-all", "second intem", null, null);
menu.itemAdd(menu_it, "object-rotate-left", "menu 1", null, null);
button = new elm.Elm.Button(win);
button.textSet("elm.text", "button - delete items");
menu_it1 = menu.itemAdd(menu_it, null, null, null, null);
menu_it1.setPartContent(null, button);
//button.event_clicked(del_it);
menu.itemSeparatorAdd(menu_it);
menu.itemAdd(menu_it, null, "third item", null, null);
menu.itemAdd(menu_it, null, "fourth item", null, null);
menu.itemAdd(menu_it, "window-new", "sub menu", null, null);
menu_it = menu.itemAdd(null, null, "third item", null, null);
menu_it.setDisabled(true);
menu.setVisible(true);
rect.on('mouse_down', function(){menu.visible_set(true)});
win.setSize(250, 350);
win.setVisible(true);

@ -0,0 +1,32 @@
efl = require('efl');
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Popup");
win.setAutohide(true);
content = new elm.Elm.Label(win);
content.setText("elm.text", "<align=center>Content</align>");
popup = new elm.Elm.Popup(win);
popup.setTimeout(3);
popup.on('timeout', function()
{
console.log("timeout");
popup.setVisible(false);
});
popup.contentSet("elm.swallow.content", content);
popup.setText("title,text", "Title");
popup.setVisible(true);
popup.on('block_clicked', function()
{
console.log("clicked")
popup.setVisible(false);
});
win.setSize(480, 800);
win.setVisible(true);

@ -0,0 +1,65 @@
elm = require('elm');
_cb = function(obj){
console.log(obj.textGet("elm.text"), "state value:", obj.getStateValue());
}
win = new elm.Elm.WinStandard(null);
win.setTitle("Radio");
win.setAutohide(true);
bx = new elm.Elm.Box(win);
bx.setHorizontal(true);
bx.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bx);
bx.setVisible(true);
radio_g = new elm.Elm.Radio(win);
radio_g.textSet("elm.text", "Radio 1");
radio_g.setStateValue(1);
radio_g.setValue(1);
ic = new elm.Elm.Icon(win);
ic.setStandard("home");
radio_g.contentSet("icon", ic);
bx.packEnd(radio_g);
radio_g.setSizeHintWeight(1.0, 1.0);
radio_g.setSizeHintAlign(-1.0, -1.0);
radio_g.on('changed', _cb);
radio_g.setVisible(true);
radio = new elm.Elm.Radio(win);
radio.textSet("elm.text", "Radio 2");
radio.setStateValue(2);
radio.groupAdd(radio_g);
ic = new elm.Elm.Icon(win);
ic.setStandard("file");
radio.contentSet("icon", ic);
bx.packEnd(radio);
radio.setSizeHintWeight(1.0, 1.0);
radio.setSizeHintAlign(-1.0, -1.0);
radio.on('changed', _cb);
radio.setVisible(true);
radio = new elm.Elm.Radio(win);
radio.textSet("elm.text", "Radio 3");
radio.setStateValue(3);
radio.groupAdd(radio_g);
bx.packEnd(radio);
radio.setSizeHintWeight(1.0, 1.0);
radio.setSizeHintAlign(-1.0, -1.0);
radio.on('changed', _cb);
radio.setVisible(true);
radio = new elm.Elm.Radio(win);
radio.textSet("elm.text", "Radio 4");
radio.setStateValue(4);
radio.groupAdd(radio_g);
bx.packEnd(radio);
radio.setSizeHintWeight(1.0, 1.0);
radio.setSizeHintAlign(-1.0, -1.0);
radio.on('changed', _cb);
radio.setVisible(true);
win.setVisible(true);

@ -0,0 +1,41 @@
efl = require('efl');
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Separator");
win.setAutohide(true);
bg = new elm.Elm.Bg(win);
bg.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bg);
bg.setVisible(true);
bx = new elm.Elm.Box(win);
bx.setHorizontal(true);
bx.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bx);
bx.setVisible(true);
rect = new efl.Evas.Rectangle(win);
rect.setColor( 0, 255, 0, 255)
rect.setSizeHintMin( 90, 200);
rect.setSizeHintWeight(1.0, 1.0);
rect.setSizeHintAlign(-1.0, -1.0);
rect.setVisible(true);
bx.packEnd(rect);
separator = new elm.Elm.Separator(win);
separator.setHorizontal(true);
separator.setVisible(true);
bx.packEnd(separator);
rect2 = new efl.Evas.Rectangle(win);
rect2.setColor( 0, 0, 255, 255);
rect2.setSizeHintMin( 90, 200);
rect2.setSizeHintWeight(1.0, 1.0);
rect2.setSizeHintAlign(-1.0, -1.0);
rect2.setVisible(true);
bx.packEnd(rect2);
win.setVisible(true);

@ -0,0 +1,104 @@
efl = require('efl');
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Slider Example");
win.setAutohide(true);
bx = new elm.Elm.Box(win);
//bx.setHorizontal(true);
bx.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bx);
bx.setVisible(true);
sl = new elm.Elm.Slider(win);
sl.setSizeHintAlign(-1.0, 0.5);
sl.setSizeHintWeight(1.0, 1.0);
bx.packEnd(sl);
sl.setVisible(true);
/* with icon, end and label */
sl = new elm.Elm.Slider(win);
sl.textSet("elm.text", "Counter");
ic = new elm.Elm.Icon(win);
ic.setStandard("home");
ic.setResizable(false, false);
sl.contentSet("icon", ic);
ic = new elm.Elm.Icon(win);
ic.setStandard("folder");
ic.setResizable(false, false);
sl.contentSet("end", ic);
sl.setSizeHintAlign(-1.0, 0.5);
sl.setSizeHintWeight(1.0, 1.0);
bx.packEnd(sl);
sl.setVisible(true);
/* value set and span size */
sl = new elm.Elm.Slider(win);
sl.setValue(1);
sl.setSpanSize(200);
sl.setSizeHintAlign(-1.0, 0.5);
sl.setSizeHintWeight(1.0, 1.0);
bx.packEnd(sl);
sl.setVisible(true);
/* with unit label and min - max */
sl = new elm.Elm.Slider(win);
sl.setUnitFormat("%1.0f units");
sl.setMinMax(0, 100);
sl.setSizeHintAlign(-1.0, 0.5);
sl.setSizeHintWeight(1.0, 1.0);
bx.packEnd(sl);
sl.setVisible(true);
/* with indicator label and inverted */
sl = new elm.Elm.Slider(win);
sl.setIndicatorFormat("%1.2f");
sl.setInverted(true);
sl.setSizeHintAlign(-1.0, 0.5);
sl.setSizeHintWeight(1.0, 1.0);
bx.packEnd(sl);
sl.setVisible(true);
/* vertical with indicator format func */
sl = new elm.Elm.Slider(win);
sl.setHorizontal(false);
//indicator_format = function()
// {
// indicator = new char[32];
// nprintf(indicator, 32, "%1.2f u", val);
// return indicator;
// }
//indicator_free = function() {console.log("free")}
//sl.indicator_format_function_set(indicator_format, indicator_free);
sl.setSizeHintAlign(0.5, -1.0);
sl.setSizeHintWeight(0.0, 1.0);
bx.packEnd(sl);
sl.setVisible(true);
/* callbacks */
sl = new elm.Elm.Slider(win);
sl.setUnitFormat("%1.3f units");
sl.setSizeHintAlign(-1.0, 0.5);
sl.setSizeHintWeight(1.0, 1.0);
bx.packEnd(sl);
sl.setVisible(true);
sl.on('changed', function(obj)
{
val = obj.value_get();
console.log("Changed to " + val);
});
sl.on('delay_changed', function(obj)
{
val = obj.value_get();
console.log("Delay changed to " + val);
});
win.setVisible(true);

@ -0,0 +1,90 @@
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Spinner Example");
win.setAutohide(true);
bx = new elm.Elm.Box(win);
bx.setSizeHintWeight(1.0, 1.0);
win.resizeObjectAdd(bx);
bx.setVisible(true);
sp = new elm.Elm.Spinner(win);
sp.setSizeHintWeight(1.0, 1.0);
sp.setSizeHintAlign(-1.0, 0.5);
bx.packEnd(sp);
sp.setVisible(true);
sp2 = new elm.Elm.Spinner(win);
sp2.setLabelFormat("Percentage %%%1.2f something");
sp2.setSizeHintWeight(1.0, 1.0);
sp2.setSizeHintAlign(-1.0, 0.5);
bx.packEnd(sp2);
sp2.setVisible(true);
sp3 = new elm.Elm.Spinner(win);
sp3.setLabelFormat("%1.1f units");
sp3.setStep(1.5);
sp3.setWrap(true);
sp3.setMinMax(-50.0, 250.0);
sp3.setSizeHintWeight(1.0, 1.0);
sp3.setSizeHintAlign(-1.0, 0.5);
bx.packEnd(sp3);
sp3.setVisible(true);
sp4 = new elm.Elm.Spinner(win);
sp4.setStyle("vertical");
sp4.setInterval(0.2);
sp4.setSizeHintWeight(1.0, 1.0);
sp4.setSizeHintAlign(-1.0, 0.5);
bx.packEnd(sp4);
sp4.setVisible(true);
sp5 = new elm.Elm.Spinner(win);
sp5.setEditable(false);
sp5.setSizeHintWeight(1.0, 1.0);
sp5.setSizeHintAlign(-1.0, 0.5);
bx.packEnd(sp5);
sp5.setVisible(true);
sp6 = new elm.Elm.Spinner(win);
sp6.setEditable(false);
sp6.setMinMax(1, 12);
sp6.specialValueAdd(1, "January");
sp6.specialValueAdd(2, "February");
sp6.specialValueAdd(3, "March");
sp6.specialValueAdd(4, "April");
sp6.specialValueAdd(5, "May");
sp6.specialValueAdd(6, "June");
sp6.specialValueAdd(7, "July");
sp6.specialValueAdd(8, "August");
sp6.specialValueAdd(9, "September");
sp6.specialValueAdd(10, "October");
sp6.specialValueAdd(11, "November");
sp6.specialValueAdd(12, "December");
sp6.setSizeHintWeight(1.0, 1.0);
sp6.setSizeHintAlign(-1.0, 0.5);
bx.packEnd(sp6);
sp6.setVisible(true);
sp7 = new elm.Elm.Spinner(win);
sp7.setSizeHintWeight(1.0, 1.0);
sp7.setSizeHintAlign(-1.0, 0.5);
bx.packEnd(sp7);
sp7.setVisible(true);
sp7.setEditable(true);
sp7.on('changed',
function(obj)
{
console.log("Value changed to " + obj.value_get());
});
sp7.on('delay_changed',
function(obj)
{
console.log("Value delay changed to " + obj.value_get());
});
win.setVisible(true);

@ -0,0 +1,34 @@
elm = require('elm');
win = new elm.Elm.WinStandard(null);
win.setTitle("Table");
win.setAutohide(true);
table = new elm.Elm.Table(win);
win.resizeObjectAdd(table);
table.setVisible(true);
table.setPadding(5, 5);
table.setHomogeneous(true);
label = new elm.Elm.Label(win);
label.setText("elm.text", "label 0");
label.setVisible(true);
table.pack(label, 0, 0, 1, 1);
label = new elm.Elm.Label(win);
label.setText("elm.text", "label 1");
label.setVisible(true);
table.pack(label, 1, 0, 1, 1);
label = new elm.Elm.Label(win);
label.setText("elm.text", "label 2");
label.setVisible(true);
table.pack(label, 0, 1, 1, 1);
label = new elm.Elm<