summaryrefslogtreecommitdiffstats
path: root/test/test_button-native.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-02-19 00:33:42 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2013-02-19 00:33:42 +0100
commit745d270cc955b01264e9f11297ec6bd3ab2fb47d (patch)
tree14f78b460fde86fda3ef68623c63d8908e9fbcf4 /test/test_button-native.rb
parentf72de68ba9365398cf17c07594ce0ef666ab5992 (diff)
parent554927f7bad42cd1e5c25c4877646b284c736edd (diff)
downloadffi-efl-745d270cc955b01264e9f11297ec6bd3ab2fb47d.zip
ffi-efl-745d270cc955b01264e9f11297ec6bd3ab2fb47d.tar.gz
Merge pull request #4 from mhanne/examples
Examples for ElmButton, ElmList, ElmGenList
Diffstat (limited to 'test/test_button-native.rb')
-rw-r--r--test/test_button-native.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/test_button-native.rb b/test/test_button-native.rb
new file mode 100644
index 0000000..5a805b2
--- /dev/null
+++ b/test/test_button-native.rb
@@ -0,0 +1,39 @@
+#! /usr/bin/env ruby
+# -*- coding: UTF-8 -*-
+#
+require 'efl/native/elm/elm_win'
+require 'efl/native/elm/elm_bg'
+require 'efl/native/elm/elm_button'
+require 'efl/native/elm/elm_object'
+#
+include Efl::Native
+#
+elm_init 0, FFI::MemoryPointer::NULL
+#
+def on_click data, object, event
+ elm_exit
+end
+#
+win = elm_win_add(nil, "Greetings", 0)
+elm_win_title_set(win, "Hello, World!")
+elm_win_autodel_set(win, true)
+elm_policy_set(0, 1)
+evas_object_resize(win, 240, 60)
+evas_object_show(win)
+#
+bg = elm_bg_add(win)
+evas_object_size_hint_weight_set(bg, 1.0, 1.0)
+elm_win_resize_object_add(win, bg)
+evas_object_show(bg)
+#
+btn = elm_button_add(win)
+elm_object_part_text_set(btn, nil, "Good-Bye, World!")
+evas_object_smart_callback_add(btn, "clicked", method(:on_click), nil)
+evas_object_resize(btn, 120, 30)
+evas_object_move(btn, 60, 15)
+evas_object_show(btn)
+#
+elm_run
+elm_shutdown
+#
+# EOF