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