diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/efl/ecore_evas.rb | 68 |
1 files changed, 57 insertions, 11 deletions
diff --git a/lib/efl/ecore_evas.rb b/lib/efl/ecore_evas.rb index cb08d30..c1372f6 100644 --- a/lib/efl/ecore_evas.rb +++ b/lib/efl/ecore_evas.rb @@ -10,33 +10,79 @@ module Efl class REcoreEvas include Efl::ClassHelper proxy_list [Efl::EcoreEvas,'ecore_evas_'].freeze - def initialize o=nil, &block + def initialize o=nil @ptr = ( case o when NilClass - FFI::AutoPointer.new Efl::EcoreEvas.ecore_evas_new(nil, 0, 0, 0, 0, nil), method(:free) - when self.class - o.to_ptr - when FFI::AutoPointer - o + FFI::AutoPointer.new Efl::EcoreEvas.ecore_evas_new(nil, 0, 0, 0, 0, nil), REcoreEvas.method(:release) + when Hash + FFI::AutoPointer.new Efl::EcoreEvas.ecore_evas_new(o[:engine_name], o[:x], o[:y], o[:w], o[:h], o[:extra_options]), REcoreEvas.method(:release) when FFI::Pointer - FFI::AutoPointer.new o, method(:free) + o else raise ArgumentError.new "wrong argument #{o.class.name}" end ) yield self if block_given? end + def self.release p + Efl::EcoreEvas.ecore_evas_free p unless p.nil? + end def free p=nil - return Efl::EcoreEvas.ecore_evas_free p unless p.nil? - Efl::EcoreEvas.ecore_evas_free @ptr - @ptr.free + @ptr.autorelease=false + REcoreEvas.release @ptr @ptr=nil end - def get + def geometry_get + x = FFI::MemoryPointer.new :int + y = FFI::MemoryPointer.new :int + w = FFI::MemoryPointer.new :int + h = FFI::MemoryPointer.new :int + Efl::EcoreEvas.ecore_evas_geometry_get @ptr, x, y, w, h + [ x.read_int, y.read_int, w.read_int, h.read_int ] + end + alias :geometry :geometry_get + def size + geometry_get[2..-1] + end + def size= wh + Efl::Evas.evas_object_resize @ptr, *wh + end + def name_class_get + n = FFI::MemoryPointer.new :pointer + c = FFI::MemoryPointer.new :pointer + Efl::EcoreEvas.ecore_evas_name_class_get @ptr, n, c + [ n.read_pointer.read_string, c.read_pointer.read_string ] + end + def size_min_get + w = FFI::MemoryPointer.new :int + h = FFI::MemoryPointer.new :int + Efl::EcoreEvas.ecore_evas_size_min_get @ptr, w, h + [ w.read_int, h.read_int ] + end + def size_max_get + w = FFI::MemoryPointer.new :int + h = FFI::MemoryPointer.new :int + Efl::EcoreEvas.ecore_evas_size_max_get @ptr, w, h + [ w.read_int, h.read_int ] + end + def size_base_get + w = FFI::MemoryPointer.new :int + h = FFI::MemoryPointer.new :int + Efl::EcoreEvas.ecore_evas_size_base_get @ptr, w, h + [ w.read_int, h.read_int ] + end + def size_step_get + w = FFI::MemoryPointer.new :int + h = FFI::MemoryPointer.new :int + Efl::EcoreEvas.ecore_evas_size_step_get @ptr, w, h + [ w.read_int, h.read_int ] + end + def evas # EAPI Evas *ecore_evas_get(const Ecore_Evas *ee); Efl::Evas::REvas.new Efl::EcoreEvas.ecore_evas_get @ptr end + alias :get :evas def object_image_new # EAPI Evas_Object *ecore_evas_object_image_new(Ecore_Evas *ee_target); Efl::Evas::REvasObject.new Efl::EcoreEvas.ecore_evas_object_image_new @prt |