<html> <head> <title>Edje: embryo_timer.edc</title> <meta http-equiv="content-type" content="text/html;charset=UTF-8"> <meta name="author" content="Andres Blanc" > <link rel="icon" href="img/favicon.png" type="image/x-icon"> <link rel="shortcut icon" href="img/favicon.png" type="image/x-icon"> <link rel="icon" href="img/favicon.png" type="image/ico"> <link rel="shortcut icon" href="img/favicon.png" type="image/ico"> <link rel="stylesheet" type="text/css" href="e.css"> <link rel="stylesheet" type="text/css" href="edoxy.css"> </head> <body> <div id="container"> <div id="header"> <div class="layout"> <h1><span>Enlightenment</span></h1> <h2><span>Beauty at your fingertips</span></h2> <table cellspacing="0" cellpadding="0" width="100%"><tr> <td id="header_logo"> <a href="http://www.enlightenment.org"></a> </td> <td id="header_menu"> <table cellspacing="0" cellpadding="0" align="right"><tr> <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=home">Home</a></td> <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=news">News</a></td> <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=about">About</a></td> <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=download">Download</a></td> <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=support">Support</a></td> <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=contribute">Contribute</a></td> <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=contact">Contact</a></td> <td class="nav_passive"><a class="nav_passive" href="http://trac.enlightenment.org/e">Tracker</a></td> <td class="nav_passive"><a class="nav_passive" href="http://www.enlightenment.org/p.php?p=docs">Docs</a></td> </tr></table> </td> <td id="header_last"></td> </tr></table> <div class="doxytitle"> Edje Documentation <small>at Tue Feb 8 2011</small> </div> <div class="menu-container"> <div class="submenu"> <ul class="current"> <li><a href="files.html">Files</a></li> <li><a href="Edje__Edit_8h.html">Edje Edit API</a></li> <li><a href="examples.html">Examples</a></li> <li><a href="luaref.html">LUA scripting</a></li> <li><a href="Edje_8h.html">Edje API</a></li> <li><a href="edcref.html">EDC Reference</a></li> <li class="current"><a href="index.html">Main Page</a></li> </ul> </div> </div> <div class="clear"></div> </div> </div> <div id="content"> <div class="layout"> <!-- Generated by Doxygen 1.7.3 --> </div> <div class="header"> <div class="headertitle"> <h1>embryo_timer.edc</h1> </div> </div> <div class="contents"> <p>This example show the usage of timers in embryo.</p> <div class="fragment"><pre class="fragment">collections { group { <a name="a0"></a><a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">"main"</span>; script { <span class="keyword">public</span> timer_cb(val) { <span class="keyword">new</span> x, y, w, h; <span class="keyword">new</span> buf[32]; <span class="comment">/* set labels with object info */</span> get_geometry(PART:<span class="stringliteral">"red_rect"</span>, x, y, w, h); snprintf(buf, <span class="keyword">sizeof</span>(buf), <span class="stringliteral">"Timer called %d times."</span>, val); set_text(PART:<span class="stringliteral">"label1"</span>, buf) snprintf(buf, <span class="keyword">sizeof</span>(buf), <span class="stringliteral">"Object x: %d w: %d"</span>, x, w); set_text(PART:<span class="stringliteral">"label2"</span>, buf) <span class="comment">/* renew the timer */</span> timer(1 / 30, <span class="stringliteral">"timer_cb"</span>, val + 1); } } parts { part { <a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">"bg"</span>; <a name="a1"></a><a class="code" href="edje__data_8c.html#a0dae2edc8bfd2bedabfa38415c35f3ec">type</a>: RECT; description { state: <span class="stringliteral">"default"</span> 0.0; color: 255 255 255 255; } } part { <a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">"label1"</span>; <a class="code" href="edje__data_8c.html#a0dae2edc8bfd2bedabfa38415c35f3ec">type</a>: TEXT; description { state: <span class="stringliteral">"default"</span> 0.0; color: 0 0 0 255; text { text: <span class="stringliteral">""</span>; font: <span class="stringliteral">"Sans"</span>; size: 12; align: 0.0 0.7; } } } part { <a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">"label2"</span>; <a class="code" href="edje__data_8c.html#a0dae2edc8bfd2bedabfa38415c35f3ec">type</a>: TEXT; description { state: <span class="stringliteral">"default"</span> 0.0; color: 0 0 0 255; text { font: <span class="stringliteral">"Sans"</span>; size: 12; align: 0.0 0.8; } } } part { <a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">"red_rect"</span>; <a class="code" href="edje__data_8c.html#a0dae2edc8bfd2bedabfa38415c35f3ec">type</a>: RECT; description { state: <span class="stringliteral">"default"</span> 0.0; color: 255 0 0 255; max: 30 30; align: 0.1 0.2; } description { state: <span class="stringliteral">"default"</span> 1.0; inherit: <span class="stringliteral">"default"</span> 0.0; color: 0 0 255 255; max: 50 30; align: 0.9 0.2; } } } programs { <span class="comment">/* move the red rect back an forth in a loop */</span> program { <a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">"init"</span>; signal: <span class="stringliteral">"load"</span>; source: <span class="stringliteral">""</span>; action: STATE_SET <span class="stringliteral">"default"</span> 1.0; transition: SINUSOIDAL 1.0; target: <span class="stringliteral">"red_rect"</span>; after: <span class="stringliteral">"loop"</span>; } program { <a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">"loop"</span>; action: STATE_SET <span class="stringliteral">"default"</span> 0.0; transition: SINUSOIDAL 1.0; target: <span class="stringliteral">"red_rect"</span>; after: <span class="stringliteral">"init"</span>; } <span class="comment">/* run the timer_cb for the first time */</span> program { <a class="code" href="edje__data_8c.html#a8f8f80d37794cde9472343e4487ba3eb">name</a>: <span class="stringliteral">"init2"</span>; signal: <span class="stringliteral">"load"</span>; source: <span class="stringliteral">""</span>; script { timer_cb(0); } } } } } </pre></div> </div> </div> <div id="push"></div> </div> <!-- #content --> </div> <!-- .layout --> </div> <!-- #container --> <div id="footer"> <table><tr> <td class="copyright">Copyright ©2011 Enlightenment</td> <td class="generated">Docs generated Tue Feb 8 2011 17:28:42</td> </tr></table> </div> </body> </html>