diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-01 09:19:01 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-01 09:19:01 +0200 |
commit | 67b6e2f3cee8b602f87c78bef3963f5832ca1ab6 (patch) | |
tree | 86d7f7a33edae7dffdd33f73c0fb55299ecf386b /test | |
parent | f95e9909e93dd1ddb9d19ccd36be34a3a84ddd44 (diff) | |
download | ffi-efl-67b6e2f3cee8b602f87c78bef3963f5832ca1ab6.zip ffi-efl-67b6e2f3cee8b602f87c78bef3963f5832ca1ab6.tar.gz |
add test_edje and data
Diffstat (limited to 'test')
-rw-r--r-- | test/edje_test.edc | 84 | ||||
-rw-r--r-- | test/edje_test.edj | bin | 0 -> 7357 bytes | |||
-rw-r--r-- | test/test_edje.rb | 47 |
3 files changed, 131 insertions, 0 deletions
diff --git a/test/edje_test.edc b/test/edje_test.edc new file mode 100644 index 0000000..a228014 --- /dev/null +++ b/test/edje_test.edc @@ -0,0 +1,84 @@ +// compile: edje_cc edje_example.edc +collections { + group { + name: "my_group"; // must be the same as in edje_example.c + parts { + part { + name: "background"; + type: RECT; // plain boring rectangle + mouse_events: 0; // we don't need any mouse event on the background + // just one state "default" + description { + state: "default" 0.0; // must always exist + color: 255 255 255 255; // white + // define part coordinates: + rel1 { // top-left point at (0, 0) [WIDTH * 0 + 0, HEIGHT * 0 + 0] + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { // bottom-right point at (WIDTH * 1.0 - 1, HEIGHT * 1.0 - 1) + relative: 1.0 1.0; + offset: -1 -1; + } + } + } + part { + name: "text"; + type: TEXT; + mouse_events: 1; // we want to change the color on mouse-over + // 2 states, one "default" and another "over" to be used + // on mouse over effect + description { + state: "default" 0.0; + color: 255 0 0 255; // red + // define part coordinates: + rel1 { // top-left at (WIDTH * 0.1 + 5, HEIGHT * 0.2 + 10) + relative: 0.1 0.2; + offset: 5 10; + } + rel2 { // bottom-right at (WIDTH * 0.9 - 6, HEIGHT * 0.8 - 11) + relative: 0.9 0.8; + offset: -6 -11; + } + // define text specific state details + text { + font: "Sans"; /* using fontconfig name! */ + size: 10; + text: "hello world"; + } + } + description { + state: "over" 0.0; + inherit: "default" 0.0; // copy everything from "default" at this point + color: 0 255 0 255; // override color, now it is green + } + } + // do programs to change color on text mouse in/out (over) + programs { + program { + // what triggers this program: + signal: "mouse,in"; + source: "text"; + // what this program does: + action: STATE_SET "over" 0.0; + target: "text"; + // do the state-set in a nice interpolation animation + // using linear time in 0.1 second + transition: LINEAR 0.1; + } + program { + // what triggers this program: + signal: "mouse,out"; + source: "text"; + // what this program does: + action: STATE_SET "default" 0.0; + target: "text"; + // do the state-set in a nice interpolation animation + // using linear time in 0.1 second + transition: LINEAR 0.1; + } + } + } + } +} + diff --git a/test/edje_test.edj b/test/edje_test.edj Binary files differnew file mode 100644 index 0000000..6486444 --- /dev/null +++ b/test/edje_test.edj diff --git a/test/test_edje.rb b/test/test_edje.rb new file mode 100644 index 0000000..c63203c --- /dev/null +++ b/test/test_edje.rb @@ -0,0 +1,47 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'efl/eina' +require 'efl/evas' +require 'efl/ecore' +require 'efl/ecore_evas' +require 'efl/edje' +# +Efl::Eina::init +Efl::Evas::init +Efl::Ecore::init +Efl::EcoreEvas::init +Efl::Edje::init +# +WIDTH=320 +HEIGHT=240 +EDJE_FILE=File.join File.dirname(__FILE__),'edje_test.edj' +# +def create_my_group canvas, txt + #edje = edje_object_add(canvas); + edje = canvas.edje_object_add + if not edje.file_set EDJE_FILE, "my_group" + puts "unable to open #{EDJE_FILE}" + exit 1 + end + edje.part_text_set "text", txt unless txt.nil? + edje.move 0, 0 + edje.resize WIDTH, HEIGHT + edje.show + edje +end +# +txt = ( ARGV.length>0 ? ARGV[0] : nil ) +# +window = Efl::EcoreEvas::REcoreEvas.new { |w| + w.resize WIDTH, HEIGHT +} +# +canvas = window.get +edje = create_my_group canvas, txt +window.show +# +Efl::Ecore.main_loop_begin +# +edje.free +window.free |