Class: Efl::Evas::REvasObject

Inherits:
Object
  • Object
show all
Includes:
ClassHelper
Defined in:
lib/efl/evas.rb,
lib/efl/ecore_evas.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ClassHelper

#===, #address, included, #method_missing, #null?, #to_a, #to_ary, #to_ptr, #to_s

Constructor Details

#initialize(a, *args, &block) ⇒ REvasObject

Returns a new instance of REvasObject



136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/efl/evas.rb', line 136

def initialize a, *args, &block
    @ptr = (
        case a
        when FFI::Pointer
            a
        when Method
            a.call(*args)
        else
            raise ArgumentError.new "wrong argument #{a.class.name}"
        end
    )
    instance_eval &block if block
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Efl::ClassHelper

Class Method Details

.release(p) ⇒ Object



149
150
151
152
153
154
155
156
157
158
# File 'lib/efl/evas.rb', line 149

def self.release p
    Native.evas_object_del p unless p.nil?
    @ri0.free if @ri0
    @ri1.free if @ri1
    @ri2.free if @ri2
    @ri3.free if @ri3
    @rd0.free if @rd0
    @rd1.free if @rd1
    @rs0.free if @rs0
end

Instance Method Details

#above_getObject Also known as: above



213
214
215
# File 'lib/efl/evas.rb', line 213

def above_get
    REvasObject.new Native.evas_object_above_get @ptr
end

#below_getObject Also known as: below



217
218
219
# File 'lib/efl/evas.rb', line 217

def below_get
    REvasObject.new Native.evas_object_below_get @ptr
end

#center_getObject Also known as: center



184
185
186
187
# File 'lib/efl/evas.rb', line 184

def center_get
    g = geometry_get
    [ g[0]+(g[2]/2.0), g[1]+(g[3]/2.0) ]
end

#center_set(x, y) ⇒ Object Also known as: center=



189
190
191
192
# File 'lib/efl/evas.rb', line 189

def center_set x, y
    g = geometry_get
    move (x-(g[2]/2.0)).to_i, (y-(g[3]/2.0)).to_i
end

#color_getObject Also known as: color



200
201
202
203
204
205
206
207
# File 'lib/efl/evas.rb', line 200

def color_get
    @ri0 ||= FFI::MemoryPointer.new :int
    @ri1 ||= FFI::MemoryPointer.new :int
    @ri2 ||= FFI::MemoryPointer.new :int
    @ri3 ||= FFI::MemoryPointer.new :int
    Native.evas_object_color_get @ptr, @ri0, @ri1, @ri2, @ri3
    [ @ri0.read_int, @ri1.read_int, @ri2.read_int, @ri3.read_int ]
end

#data_get(k) ⇒ Object Also known as: data



285
286
287
288
289
# File 'lib/efl/evas.rb', line 285

def data_get k
    r = Native.evas_object_data_get @ptr, k
    return nil if r==FFI::Pointer::NULL
    r.read_string
end

#ecore_evas_getObject Also known as: ecore_evas



118
119
120
121
# File 'lib/efl/ecore_evas.rb', line 118

def ecore_evas_get
    # EAPI Ecore_Evas *ecore_evas_object_ecore_evas_get(Evas_Object *obj);
    EcoreEvas::REcoreEvas.new Native.ecore_evas_object_ecore_evas_get @ptr
end

#evas_getObject Also known as: evas



209
210
211
# File 'lib/efl/evas.rb', line 209

def evas_get
    REvas.new Native.evas_object_evas_get @ptr
end

#evas_nameObject



169
170
171
# File 'lib/efl/evas.rb', line 169

def evas_name
    Native.evas_object_name_get @ptr
end

#evas_typeObject



172
173
174
# File 'lib/efl/evas.rb', line 172

def evas_type
    Native.evas_object_type_get @ptr
end

#freeObject



159
160
161
162
163
# File 'lib/efl/evas.rb', line 159

def free
    @ptr.autorelease=false if @ptr.is_a? FFI::AutoPointer
    REvasObject.release @ptr
    @ptr=nil
end

#geometry_getObject Also known as: geometry



175
176
177
178
179
180
181
182
# File 'lib/efl/evas.rb', line 175

def geometry_get
    @ri0 ||= FFI::MemoryPointer.new :int
    @ri1 ||= FFI::MemoryPointer.new :int
    @ri2 ||= FFI::MemoryPointer.new :int
    @ri3 ||= FFI::MemoryPointer.new :int
    Native.evas_object_geometry_get @ptr, @ri0, @ri1, @ri2, @ri3
    [ @ri0.read_int, @ri1.read_int, @ri2.read_int, @ri3.read_int ]
end

#object_box_add(&block) ⇒ Object



164
165
166
167
168
# File 'lib/efl/evas.rb', line 164

def object_box_add &block
    o = Evas::REvasBox.new FFI::AutoPointer.new Native.evas_object_box_add_to(@ptr), REvasObject.method(:release)
    o.instance_eval &block if block
    o
end

#sizeObject



194
195
196
# File 'lib/efl/evas.rb', line 194

def size
    geometry_get[2..-1]
end

#size=(wh) ⇒ Object



197
198
199
# File 'lib/efl/evas.rb', line 197

def size= wh
    Native.evas_object_resize @ptr, *wh
end

#size_hint_align_getObject Also known as: size_hint_align



254
255
256
257
258
259
# File 'lib/efl/evas.rb', line 254

def size_hint_align_get
    @rd0 ||= FFI::MemoryPointer.new :double
    @rd1 ||= FFI::MemoryPointer.new :double
    Native.evas_object_size_hint_align_get @ptr, @rd0, @rd1
    [ @rd0.read_double, @rd1.read_double ]
end

#size_hint_align_set_fillObject Also known as: size_hint_align_fill



250
251
252
# File 'lib/efl/evas.rb', line 250

def size_hint_align_set_fill
    Native.evas_object_size_hint_align_set @ptr, EVAS_HINT_FILL, EVAS_HINT_FILL
end

#size_hint_aspect_getObject Also known as: size_hint_aspect



242
243
244
245
246
247
248
# File 'lib/efl/evas.rb', line 242

def size_hint_aspect_get
    @ri0 ||= FFI::MemoryPointer.new :int
    @ri1 ||= FFI::MemoryPointer.new :int
    @ri2 ||= FFI::MemoryPointer.new :int
    Native.evas_object_size_hint_aspect_get @ptr, @ri0, @ri1, @ri2
    [ Native.enum_type(:evas_aspect_control)[@ri0.read_int], @ri1.read_int, @ri2.read_int ]
end

#size_hint_max_getObject Also known as: size_hint_max



228
229
230
231
232
233
# File 'lib/efl/evas.rb', line 228

def size_hint_max_get
    @ri0 ||= FFI::MemoryPointer.new :int
    @ri1 ||= FFI::MemoryPointer.new :int
    Native.evas_object_size_hint_max_get @ptr, @ri0, @ri1
    [ @ri0.read_int, @ri1.read_int ]
end

#size_hint_min_getObject Also known as: size_hint_min



221
222
223
224
225
226
# File 'lib/efl/evas.rb', line 221

def size_hint_min_get
    @ri0 ||= FFI::MemoryPointer.new :int
    @ri1 ||= FFI::MemoryPointer.new :int
    Native.evas_object_size_hint_min_get @ptr, @ri0, @ri1
    [ @ri0.read_int, @ri1.read_int ]
end

#size_hint_padding_getObject Also known as: size_hint_padding



276
277
278
279
280
281
282
283
# File 'lib/efl/evas.rb', line 276

def size_hint_padding_get
    @ri0 ||= FFI::MemoryPointer.new :int
    @ri1 ||= FFI::MemoryPointer.new :int
    @ri2 ||= FFI::MemoryPointer.new :int
    @ri3 ||= FFI::MemoryPointer.new :int
    Native.evas_object_size_hint_padding_get @ptr, @ri0, @ri1, @ri2, @ri3
    [ @ri0.read_int, @ri1.read_int, @ri2.read_int, @ri3.read_int ]
end

#size_hint_request_getObject Also known as: size_hint_request



235
236
237
238
239
240
# File 'lib/efl/evas.rb', line 235

def size_hint_request_get
    @ri0 ||= FFI::MemoryPointer.new :int
    @ri1 ||= FFI::MemoryPointer.new :int
    Native.evas_object_size_hint_request_get @ptr, @ri0, @ri1
    [ @ri0.read_int, @ri1.read_int ]
end

#size_hint_weight_getObject Also known as: size_hint_weight



269
270
271
272
273
274
# File 'lib/efl/evas.rb', line 269

def size_hint_weight_get
    @rd0 ||= FFI::MemoryPointer.new :double
    @rd1 ||= FFI::MemoryPointer.new :double
    Native.evas_object_size_hint_weight_get @ptr, @rd0, @rd1
    [ @rd0.read_double, @rd1.read_double ]
end

#size_hint_weight_set_expandObject Also known as: size_hint_weight_expand



261
262
263
# File 'lib/efl/evas.rb', line 261

def size_hint_weight_set_expand
    Native.evas_object_size_hint_weight_set @ptr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
end

#size_hint_weight_set_expand_fillObject Also known as: size_hint_weight_expand_fill



265
266
267
# File 'lib/efl/evas.rb', line 265

def size_hint_weight_set_expand_fill
    Native.evas_object_size_hint_weight_set @ptr, EVAS_HINT_EXPAND, EVAS_HINT_FILL
end