forked from enlightenment/efl
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. @featuredevs/felipealmeida/promises
parent
81bf2796c6
commit
4f44ca0a16
52 changed files with 2805 additions and 46 deletions
@ -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 $@ $< |
||||
|
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 |
||||
]) |
@ -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< |