diff options
-rw-r--r-- | README.rdoc | 71 |
1 files changed, 41 insertions, 30 deletions
diff --git a/README.rdoc b/README.rdoc index 4c344ad..88fe7f9 100644 --- a/README.rdoc +++ b/README.rdoc @@ -12,40 +12,51 @@ A ruby-ffi binding to efl libraries (Enlightenment Foundation Libraries). == SYNOPSIS: - require 'efl/elementary' - - Efl::Elm.init - - on_exit = Proc.new do |data, evas_object, event_info| - puts "EXIT #{data.read_string}" - Efl::Elm.exit - end - - win = Efl::Elm::ElmWin.new nil, "Window name" do |w| - w.title = "My title" - w.alpha = true - w.move 300, 300 - w.resize 200, 100 - bg = Efl::Elm::ElmBg.new w do |bg| - bg.size_hint_weight_expand - bg.size_hint_align_fill - bg.evas_object_color_set 200,255,100,150 - bg.show + 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 - w.resize_object_add bg - lb = Efl::Elm::ElmLabel.new w do |lb| - lb.text = "Hello World!" - lb.size_hint_weight_set 1.0, 1.0 + 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 - lb.show - w.resize_object_add lb - w.smart_callback_add "delete,request", on_exit, FFI::MemoryPointer.from_string("my data") end - win.show + Elm.init + + win = MyWin.new "App name", "Window Title" do + alpha_set true + resize 200, 100 + center_set 600, 300 + show + end - Efl::Elm.run - Efl::Elm.shutdown + Elm.run + Elm.shutdown For more examples you may look at: @@ -76,7 +87,6 @@ Online repositories: * https://github.com/jeremyz/ffi-efl * http://cgit.asynk.ch/cgi-bin/cgit/ffi-efl/ -* https://gitorious.org/ffi-efl Gem: @@ -87,6 +97,7 @@ Gem: Special thanks to: * Lionel Orry +* The enlightenment team == LICENSE: |