summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-05-06 11:44:11 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-05-06 11:44:11 +0200
commit4d29e81efe848224e8f4eec0b3f82ccb7632149d (patch)
tree5a4d717a1275edd980843b3b5c79e1e202ccbdc7 /lib
parent86c7bb0aa79ddea6fd26c4525af0fbf212658d1b (diff)
downloadffi-efl-4d29e81efe848224e8f4eec0b3f82ccb7632149d.zip
ffi-efl-4d29e81efe848224e8f4eec0b3f82ccb7632149d.tar.gz
add REvasBox class, change REvasObject initialization schema
Diffstat (limited to 'lib')
-rw-r--r--lib/efl/evas.rb48
1 files changed, 28 insertions, 20 deletions
diff --git a/lib/efl/evas.rb b/lib/efl/evas.rb
index 3614784..1730882 100644
--- a/lib/efl/evas.rb
+++ b/lib/efl/evas.rb
@@ -71,25 +71,20 @@ module Efl
REvas.release @ptr
@ptr=nil
end
- def object_rectangle_add
- o = Evas::REvasRectangle.new FFI::AutoPointer.new Native.evas_object_rectangle_add(@ptr), REvasObject.method(:release)
- yield o if block_given?
- o
+ def object_rectangle_add &block
+ REvasRectangle.new Native.method(:evas_object_rectangle_add), @ptr, &block
end
- def object_line_add
- o = Evas::REvasLine.new FFI::AutoPointer.new Native.evas_object_line_add(@ptr), REvasObject.method(:release)
- yield o if block_given?
- o
+ def object_line_add &block
+ Evas::REvasLine.new Native.method(:evas_object_line_add), @ptr, &block
end
- def object_polygon_add
- o = Evas::REvasPolygon.new FFI::AutoPointer.new Native.evas_object_polygon_add(@ptr), REvasObject.method(:release)
- yield o if block_given?
- o
+ def object_polygon_add &block
+ Evas::REvasPolygon.new Native.method(:evas_object_polygon_add), @ptr, &block
end
- def object_text_add
- o = Evas::REvasText.new FFI::AutoPointer.new Native.evas_object_text_add(@ptr), REvasObject.method(:release)
- yield o if block_given?
- o
+ def object_text_add &block
+ Evas::REvasText.new Native.method(:evas_object_text_add), @ptr, &block
+ end
+ def object_box_add &block
+ Evas::REvasBox.new Native.method(:evas_object_box_add), @ptr, &block
end
def output_size_get
x = FFI::MemoryPointer.new :int
@@ -130,15 +125,17 @@ module Efl
include Efl::ClassHelper
search_prefixes 'evas_object_', 'evas_'
#
- def initialize o=nil
+ def initialize *args
@ptr = (
- case o
+ case args[0]
when NilClass
FFI::AutoPointer.new Native.evas_new, REvasObject.method(:release)
when FFI::Pointer
- o
+ args[0]
+ when Method
+ FFI::AutoPointer.new args[0].call(args[1]), REvasObject.method(:release)
else
- raise ArgumentError.new "wrong argument #{o.class.name}"
+ raise ArgumentError.new "wrong argument #{args[0].class.name}"
end
)
yield self if block_given?
@@ -151,6 +148,11 @@ module Efl
REvasObject.release @ptr
@ptr=nil
end
+ def object_box_add
+ o = Evas::REvasBox.new FFI::AutoPointer.new Native.evas_object_box_add_to(@ptr), REvasObject.method(:release)
+ yield o if block_given?
+ o
+ end
def evas_name
Native.evas_object_name_get @ptr
end
@@ -351,6 +353,12 @@ module Efl
end
alias :outline_color :outline_color_get
end
+ #
+ class REvasBox < REvasObject
+ #
+ search_prefixes 'evas_object_box_'
+ #
+ end
end
end
#