summaryrefslogtreecommitdiffstats
path: root/lib/efl
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-05-05 12:14:03 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-05-05 12:14:03 +0200
commit36707e379932a8de7c1940b945ec9ea9d3bbb4c6 (patch)
tree705feef206253a0ddd1b346f6d7a02b7a59d21c1 /lib/efl
parent429e5812eab616a3db352b5ae84d1c2bcf9278b4 (diff)
downloadffi-efl-36707e379932a8de7c1940b945ec9ea9d3bbb4c6.zip
ffi-efl-36707e379932a8de7c1940b945ec9ea9d3bbb4c6.tar.gz
add classes : REvasRectangle, REvasLine, REvasPolygon and specs
Diffstat (limited to 'lib/efl')
-rw-r--r--lib/efl/evas.rb43
1 files changed, 39 insertions, 4 deletions
diff --git a/lib/efl/evas.rb b/lib/efl/evas.rb
index a0067e7..ff0f3bc 100644
--- a/lib/efl/evas.rb
+++ b/lib/efl/evas.rb
@@ -72,10 +72,21 @@ module Efl
@ptr=nil
end
def object_add t
- # TODO should return Objects
- r = Evas::REvasObject.new Native.send "evas_object_#{t.to_s}_add", @ptr
- yield r if block_given?
- r
+ ts = t.to_s
+ o = (
+ case ts
+ when 'rectangle'
+ Evas::REvasRectangle.new Native.evas_object_rectangle_add @ptr
+ when 'line'
+ Evas::REvasLine.new Native.evas_object_line_add @ptr
+ when 'polygon'
+ Evas::REvasPolygon.new Native.evas_object_polygon_add @ptr
+ else
+ raise NameError.new "unknown or not implemented yet evas_object type #{ts}"
+ end
+ )
+ yield o if block_given?
+ o
end
def output_size_get
x = FFI::MemoryPointer.new :int
@@ -238,6 +249,30 @@ module Efl
end
alias :data :data_get
end
+ #
+ class REvasRectangle < REvasObject
+ end
+ #
+ class REvasLine < REvasObject
+ #
+ search_prefixes 'evas_object_line_'
+ #
+ def line_xy_get
+ x1 = FFI::MemoryPointer.new :int
+ y1 = FFI::MemoryPointer.new :int
+ x2 = FFI::MemoryPointer.new :int
+ y2 = FFI::MemoryPointer.new :int
+ Native.evas_object_line_xy_get @ptr, x1, y1, x2, y2
+ [ x1.read_int, y1.read_int, x2.read_int, y2.read_int ]
+ end
+ end
+ #
+ class REvasPolygon < REvasObject
+ #
+ search_prefixes 'evas_object_polygon_'
+ #
+ end
+ #
end
end
#