2 font: "Vera.ttf" "default";
6 image: "bubble.png" COMP;
14 --// stick object private/local vars here
18 --// Functions to print tables.
19 local print_table, print_table_start;
21 function print_table_start(table, space, name)
22 print(space .. name .. ": ");
24 print_table(table, space .. " ");
28 function print_table(table, space)
29 for k, v in pairs(table) do
30 if type(v) == "table" then
31 print_table_start(v, space, k);
32 elseif type(v) == "string" then
33 print(space .. k .. ': "' .. v .. '";')
35 print(space .. k .. ": " .. v .. ";")
42 D = {}; --// data is empty table to start
43 edje_geom = edje.geom();
46 D.edje:file("plain/edje/group");
48 D.edje:resize(edje_geom.w, edje_geom.h);
51 edje.text_class("test_text_class", "Sans:style=Bold", 10);
53 --// send some random edje message
54 edje.messagesend(7, "none" );
55 edje.messagesend(7, "sig", "lua message signal", "luaSource");
56 edje.messagesend(7, "str", "hello world");
57 edje.messagesend(7, "int", 987);
58 edje.messagesend(7, "float", 987.321);
59 edje.messagesend(7, "strset", {"hello", "there", "world"});
60 edje.messagesend(7, "intset", {1, 2, 3});
61 edje.messagesend(7, "floatset", {1.1, 2.2, 3.3});
62 edje.messagesend(7, "strint", "hello world", 7);
63 edje.messagesend(7, "strfloat", "hello world", 7.654);
64 edje.messagesend(7, "strintset","hello world", {1, 2, 3});
66 edje.emit("lua signal", "luaSource");
70 print("lua::move x=" .. x .. " x=" .. y);
74 function resize (w, h)
75 print("lua::resize w=" .. w .. " h=" .. h);
79 function message (id, type, ...)
80 print("lua::message id=" .. id .. " type=" .. type);
81 --// handle your message type here. check id + type then use the
82 --// vararg appropriately. they are the same as the params passed
83 --// to edje:messagesend() (if any are passed at all). Any array
84 --// arguments are passed as a single table.
86 if ("none" == type) then
87 print("lua::message no args");
88 elseif ("strset" == type) then
90 print_table_start(strs, "", "lua::message strings");
91 elseif ("intset" == type) then
93 print_table_start(ints, "", "lua::message ints");
94 elseif ("floatset" == type) then
96 print_table_start(floats, "", "lua::message floats");
97 elseif ("strintset" == type) then
99 print("lua::message " .. str);
100 print_table_start(ints, "", "lua::message ints");
101 elseif ("strfloatset" == type) then
103 print("lua::message " .. str);
104 print_table_start(floats, "", "lua::message floats");
106 print("lua::message " .. ... );
110 function signal (sig, src)
111 print("lua::signal sig=|" .. sig .. "| src=" .. src .. "|");
116 // The group name NEEDS a / in it,
117 // or the part below that tries to swallow it won't work.
118 // Leaving just the lua part visible.
124 local bubbleCols = 8;
125 local bubbleRows = 6;
127 --// Functions to print tables.
128 local print_table, print_table_start;
130 function print_table_start(table, space, name)
131 print(space .. name .. ": ");
133 print_table(table, space .. " ");
137 function print_table(table, space)
138 for k, v in pairs(table) do
139 if type(v) == "table" then
140 print_table_start(v, space, k);
141 elseif type(v) == "string" then
142 print(space .. k .. ': "' .. v .. '";')
144 print(space .. k .. ": " .. v .. ";")
150 for i = 1, bubbleRows do
152 for j = 1, bubbleCols do
153 image = edje.image();
154 image:image("bubble.png");
156 table.insert(row, image);
158 table.insert(bubbles, row);
161 function resize (w, h)
162 for i = 1, bubbleRows do
163 for j = 1, bubbleCols do
166 bubbles[i][j]:geom((j - 1) * w1, (i - 1) * h1, w1, h1);
167 if ((1 == i) or (1 == j) or (bubbleRows == i) or (bubbleCols == j)) then
168 bubbles[i][j]:color(0, 255, 0, 200);
170 bubbles[i][j]:color(math.random(200) + 55, 0, math.random(255) + 55, 200);
176 function message (id, type, ...)
177 print("bubbles::message id=" .. id .. " type=" .. type);
178 --// handle your message type here. check id + type then use the
179 --// vararg appropriately. they are the same as the params passed
180 --// to edje:messagesend() (if any are passed at all). Any array
181 --// arguments are passed as a single table.
183 if ("none" == type) then
184 print("bubbles::message no args");
185 elseif ("strset" == type) then
187 print_table_start(strs, "", "bubbles::message strings");
188 elseif ("intset" == type) then
190 print_table_start(ints, "", "bubbles::message ints");
191 elseif ("floatset" == type) then
193 print_table_start(floats, "", "bubbles::message floats");
194 elseif ("strintset" == type) then
196 print("bubbles::message " .. str);
197 print_table_start(ints, "", "bubbles::message ints");
198 elseif ("strfloatset" == type) then
200 print("bubbles::message " .. str);
201 print_table_start(floats, "", "bubbles::message floats");
203 print("bubbles::message " .. ... );
207 function signal (sig, src)
208 print("bubbles::signal sig=|" .. sig .. "| src=|" .. src .. "|");
214 name: "plain/edje/group";
221 state: "default" 0.0;
226 // A lua group embedded in an edje group.
230 source: "bubbles/lua";
232 description { state: "default" 0.0; visible: 1; }
244 text: "This is test text.";
245 text_class: "test_text_class";
250 program { name: "show_signals";
257 snprintf(buf, 128, "edje::signal sig=%s sig=%s", sig, src);
258 set_text(PART:"some_text", buf);
268 public set_text_string() {
271 idx = get_int(str_idx);
274 get_str(global_str0, tmp, 1024);
276 get_str(global_str1, tmp, 1024);
278 get_str(global_str2, tmp, 1024);
281 set_text(PART:"some_text", tmp);
282 send_message(MSG_STRING, 1, tmp);
285 public message(Msg_Type:type, id, ...) {
286 if (type == MSG_STRING) {
290 getsarg(3, text, 64);
291 snprintf(buf, 128, "embryo::message |%s|", text);
292 set_text(PART:"some_text", buf);