summaryrefslogtreecommitdiffstats
path: root/test/test_button-native.rb
diff options
context:
space:
mode:
authorMarius Hanne <marius.hanne@sourceagency.org>2013-02-18 15:43:24 +0100
committerMarius Hanne <marius.hanne@sourceagency.org>2013-02-18 15:47:14 +0100
commit14030eb7e06e6b4acd8ada00291dbf196b31234c (patch)
treec047cdd3c42d39dec594c31c2f40f596838bc842 /test/test_button-native.rb
parentf72de68ba9365398cf17c07594ce0ef666ab5992 (diff)
downloadffi-efl-14030eb7e06e6b4acd8ada00291dbf196b31234c.zip
ffi-efl-14030eb7e06e6b4acd8ada00291dbf196b31234c.tar.gz
examples for ElmButton
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