summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-04-21 21:41:39 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-04-21 21:41:39 +0200
commit4139d95eb3fef9bc8178a5182920703a1052ec35 (patch)
tree60caafae5d81880fece7e76548f4e44511b37505 /test
parent343b7e3e3b03bdb814a8c11e7688a0770ce99bc7 (diff)
downloadffi-efl-4139d95eb3fef9bc8178a5182920703a1052ec35.zip
ffi-efl-4139d95eb3fef9bc8178a5182920703a1052ec35.tar.gz
fix elm_win_class
Diffstat (limited to 'test')
-rw-r--r--test/elm_win_class.rb28
1 files changed, 15 insertions, 13 deletions
diff --git a/test/elm_win_class.rb b/test/elm_win_class.rb
index 4dae894..7934551 100644
--- a/test/elm_win_class.rb
+++ b/test/elm_win_class.rb
@@ -5,43 +5,45 @@ require 'efl/elementary'
#
include Efl
#
-puts Elm.init
-
+DATA = FFI::MemoryPointer.from_string("my data")
+#
class MyWin < Elm::ElmWin
def initialize name, title
super FFI::MemoryPointer::NULL, name
title_set title
feed
- smart_callback_add "delete,request", method(:exit)
+ smart_callback_add "delete,request", method(:exit), DATA
end
def feed
+ # using block
@bg = add 'bg' do |bg|
bg.size_hint_weight_set 1.0, 1.0
bg.show
end
resize_object_add @bg.ptr
@lb = add 'label'do |lb|
- lb.elm_label_label_set "Hello World!"
- lb.size_hint_weight_set 1.0, 1.0
- lb.show
+ lb.elm_label_label_set "Hello World!" # complete function name
+ lb.size_hint_weight_set 1.0, 1.0 # implicit evas_object function name prefix
end
+ @lb.show
resize_object_add @lb.ptr
end
- def exit *args
- puts "EXIT"
- Efl::API.elm_exit();
+ def exit data, evas_object, event_info
+ puts "EXIT #{data.read_string}"
+ Elm.exit
end
end
#
-win = MyWin.new "App name", "Window Title" do |w|
- eo = w.evas_object
+Elm.init
+#
+win = MyWin.new "App name", "Window Title" do |w,eo|
eo.move 300, 300
eo.resize 200, 100
eo.show
end
-
+#
Elm.run
-puts Elm.shutdown
+Elm.shutdown
#
# EOF