diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-04-21 14:57:25 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-04-21 14:57:25 +0200 |
commit | a0ebdf466949c9e60a68f9ebbd7ab373018c07d6 (patch) | |
tree | 997b707bd3779ea669ee2147acc47ef60e7ea623 /lib/efl/elementary.rb | |
parent | 5b1ec744cc7251d1f6d9478b705550cd1be2f002 (diff) | |
download | ffi-efl-a0ebdf466949c9e60a68f9ebbd7ab373018c07d6.zip ffi-efl-a0ebdf466949c9e60a68f9ebbd7ab373018c07d6.tar.gz |
use inherited to give subclassess access to @func_prefixes, ElmWin uses Efl::Helper
Diffstat (limited to 'lib/efl/elementary.rb')
-rw-r--r-- | lib/efl/elementary.rb | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/efl/elementary.rb b/lib/efl/elementary.rb index ba263a8..cf06717 100644 --- a/lib/efl/elementary.rb +++ b/lib/efl/elementary.rb @@ -19,26 +19,21 @@ module Efl end end # - class ElmWin < Efl::Evas::EvasObject - attr_reader :evas_object + class ElmWin + include Efl::Helper + @func_prefixes = [ 'elm_win_', 'elm_' ].freeze def initialize parent, title, type=:elm_win_basic @evas_object = Evas::EvasObject.new Efl::API.elm_win_add parent, title, type - yield self if block_given? + @ptr = @evas_object.ptr + yield self,@evas_object if block_given? end def add e - eo = Evas::EvasObject.new Efl::API.send "elm_#{e}_add", @evas_object.ptr + eo = Evas::EvasObject.new Efl::API.send "elm_#{e}_add", @ptr yield eo if block_given? eo end def smart_callback_add event_str, cb, data=FFI::MemoryPointer::NULL - Efl::API.evas_object_smart_callback_add @evas_object.ptr, event_str, cb, data - end - def method_missing m, *args, &block - [ 'elm_win_', 'elm_' ].each do |s| - sym = s+m.to_s - return Efl::API.send( sym, @evas_object.ptr, *args, &block ) if Efl::API.respond_to? sym - end - Efl::API.send m + Efl::API.evas_object_smart_callback_add @ptr, event_str, cb, data end end # |