summaryrefslogtreecommitdiffstats
path: root/lib/efl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/efl')
-rw-r--r--lib/efl/elementary.rb19
-rw-r--r--lib/efl/ffi.rb1
2 files changed, 8 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
#
diff --git a/lib/efl/ffi.rb b/lib/efl/ffi.rb
index 38bf16b..9425fd3 100644
--- a/lib/efl/ffi.rb
+++ b/lib/efl/ffi.rb
@@ -41,6 +41,7 @@ module Efl
def self.included m
m.class_eval "def ptr; @ptr; end"
m.class_eval "def self.func_prefixes; @func_prefixes; end"
+ m.class_eval "def self.inherited sub; sub.class_eval 'def self.func_prefixes; superclass.func_prefixes; end'; end"
end
def method_missing m, *args, &block
self.class.func_prefixes.each do |p|