summaryrefslogtreecommitdiffstats
path: root/test/test_elm_win.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-02-27 12:40:31 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2012-02-27 12:40:31 +0100
commitcc1a6927302bb16e9b7b1b2bf8b95d3f3f3e3fe3 (patch)
tree0a9cd8817b0cec9d864cfc49d632a6dce6014731 /test/test_elm_win.rb
parent158d6652a78d74b7e2fa5b7c13a4abddd8b22cf5 (diff)
downloadffi-efl-cc1a6927302bb16e9b7b1b2bf8b95d3f3f3e3fe3.zip
ffi-efl-cc1a6927302bb16e9b7b1b2bf8b95d3f3f3e3fe3.tar.gz
add test/test_elm_win.rb
Diffstat (limited to 'test/test_elm_win.rb')
-rw-r--r--test/test_elm_win.rb51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/test_elm_win.rb b/test/test_elm_win.rb
new file mode 100644
index 0000000..9bf00ca
--- /dev/null
+++ b/test/test_elm_win.rb
@@ -0,0 +1,51 @@
+#! /usr/bin/env ruby
+# -*- coding: UTF-8 -*-
+#
+require 'efl/elm/elm_win'
+require 'efl/elm/elm_bg'
+require 'efl/elm/elm_label'
+#
+include Efl
+#
+class MyWin < Elm::ElmWin
+ #
+ def initialize name, title, &block
+ super FFI::MemoryPointer::NULL, name, &block
+ title = title
+ feed
+ smart_callback_add "delete,request", method(:on_delete), FFI::MemoryPointer.from_string("my data")
+ end
+ def feed
+ @bg = Elm::ElmBg.new(self) do
+ size_hint_weight_expand
+ evas_object_color_set 200,255,100,150
+ show
+ end
+ resize_object_add @bg
+ @lb = Elm::ElmLabel.new(self) do
+ text_set "Hello World!"
+ size_hint_align_fill
+ size_hint_weight_expand
+ show
+ end
+ resize_object_add @lb
+ end
+ def on_delete data, evas_object, event_info
+ puts "EXIT #{data.read_string}"
+ Elm.exit
+ end
+end
+#
+Elm.init
+#
+win = MyWin.new "App name", "Window Title" do
+ alpha_set true
+ resize 200, 100
+ center_set 600, 300
+ show
+end
+#
+Elm.run
+Elm.shutdown
+#
+# EOF