diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-07 23:52:36 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-05-07 23:52:36 +0200 |
commit | a1316f56b1e1a1197e1937ce3c9ce697ee4512ab (patch) | |
tree | ebd6d526245cf645c385174432165a7b1b2703a6 /lib | |
parent | 543c92da3f49daa8e7ea4f4be3a39842c1808af2 (diff) | |
download | ffi-efl-a1316f56b1e1a1197e1937ce3c9ce697ee4512ab.zip ffi-efl-a1316f56b1e1a1197e1937ce3c9ce697ee4512ab.tar.gz |
Efl::Elm::ElmBg class + specs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/efl/elementary.rb | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/lib/efl/elementary.rb b/lib/efl/elementary.rb index 2b0cd22..5105786 100644 --- a/lib/efl/elementary.rb +++ b/lib/efl/elementary.rb @@ -4,8 +4,6 @@ require 'efl/evas' require 'efl/native/elementary' # -Efl::Evas::REvasObject.search_prefixes << 'elm_' # append not prepend ! -# module Efl module Elm # @@ -21,24 +19,41 @@ module Efl end end # - class ElmWin - include Efl::ClassHelper - search_prefixes 'elm_win_', 'elm_' - def initialize parent, title, type=:elm_win_basic - @evas_object = Evas::REvasObject.new Native.elm_win_add parent, title, type - @ptr = @evas_object.to_ptr - yield self,@evas_object if block_given? - end - def add e - eo = Evas::REvasObject.new Native.send "elm_#{e}_add", @ptr - yield eo if block_given? - eo + class ElmWin < Efl::Evas::REvasObject + # + search_prefixes 'elm_win_' + # + def initialize parent, title, type=:elm_win_basic, &block + super Native.method(:elm_win_add), parent, title, type, &block end def smart_callback_add event_str, cb, data=FFI::MemoryPointer::NULL Native.evas_object_smart_callback_add @ptr, event_str, cb, data end end # + class ElmBg < Efl::Evas::REvasObject + # + search_prefixes 'elm_bg_' + # + def initialize parent, &block + super Native.method(:elm_bg_add), parent, &block + end + def file_get + f = FFI::MemoryPointer.new :pointer + g = FFI::MemoryPointer.new :pointer + Native.elm_bg_file_get @ptr, f, g + [ f.read_pointer.read_string, g.read_pointer.read_string ] + end + alias :file :file_get + def color_get + r = FFI::MemoryPointer.new :int + g = FFI::MemoryPointer.new :int + b = FFI::MemoryPointer.new :int + Native.elm_bg_color_get @ptr, r, g, b + [ r.read_int, g.read_int, b.read_int ] + end + alias :color :color_get + end end end # |