summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
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