ffi-efl 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changelog +12 -0
- data/Rakefile +1 -1
- data/lib/efl/ecore.rb +17 -6
- data/lib/efl/ecore_evas.rb +78 -24
- data/lib/efl/ecore_getopt.rb +27 -23
- data/lib/efl/ecore_input.rb +1 -1
- data/lib/efl/edje.rb +11 -11
- data/lib/efl/eet.rb +20 -14
- data/lib/efl/eina.rb +1 -1
- data/lib/efl/eina_hash.rb +17 -30
- data/lib/efl/eina_list.rb +16 -25
- data/lib/efl/elementary.rb +8 -19
- data/lib/efl/evas.rb +167 -38
- data/lib/efl/ffi.rb +28 -17
- data/lib/efl/{ffi → native}/ecore.rb +9 -5
- data/lib/efl/{ffi → native}/ecore_evas.rb +27 -20
- data/lib/efl/{ffi → native}/ecore_getopt.rb +9 -5
- data/lib/efl/{ffi → native}/ecore_input.rb +9 -5
- data/lib/efl/{ffi → native}/edje.rb +14 -10
- data/lib/efl/{ffi → native}/eet.rb +9 -5
- data/lib/efl/{ffi → native}/eina.rb +9 -5
- data/lib/efl/{ffi → native}/eina_hash.rb +9 -5
- data/lib/efl/{ffi → native}/eina_list.rb +9 -5
- data/lib/efl/{ffi → native}/eina_types.rb +9 -5
- data/lib/efl/{ffi → native}/elementary.rb +70 -66
- data/lib/efl/{ffi → native}/evas.rb +11 -7
- data/lib/efl/native.rb +16 -0
- data/lib/efl.rb +1 -1
- data/spec/ecore_evas_spec.rb +325 -6
- data/spec/ecore_getopt_spec.rb +70 -104
- data/spec/ecore_input_spec.rb +6 -6
- data/spec/ecore_spec.rb +63 -60
- data/spec/edje_spec.rb +6 -6
- data/spec/eet_spec.rb +23 -22
- data/spec/eina_hash_spec.rb +53 -58
- data/spec/eina_list_spec.rb +28 -18
- data/spec/eina_spec.rb +6 -6
- data/spec/evas_spec.rb +371 -119
- data/tasks/constants.rb +4 -0
- data/test/test_edje.rb +1 -1
- data/test/test_elm_win-native.rb +38 -0
- data/test/test_evas.rb +4 -4
- metadata +32 -20
- data/test/test_elm_win.rb +0 -35
data/lib/efl/eina_list.rb
CHANGED
@@ -1,34 +1,27 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
# -*- coding: UTF-8 -*-
|
3
3
|
#
|
4
|
-
require 'efl/
|
4
|
+
require 'efl/native/eina_list'
|
5
5
|
#
|
6
|
-
class Array
|
7
|
-
def self.from_eina_list o
|
8
|
-
if o.is_a? Efl::EinaList::REinaList
|
9
|
-
o.to_ary
|
10
|
-
elsif o.is_a? FFI::Pointer
|
11
|
-
Efl::EinaList::REinaList.new(o).to_ary
|
12
|
-
else
|
13
|
-
raise ArgumentError.new "wrong argument #{o.class.name}"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
6
|
module Efl
|
18
|
-
|
7
|
+
#
|
8
|
+
module Native
|
19
9
|
#
|
20
10
|
class EinaListStruct < FFI::Struct
|
21
11
|
layout :data, :pointer,
|
22
|
-
|
12
|
+
:next, :pointer,
|
23
13
|
:prev, :pointer,
|
24
14
|
:accounting, :pointer,
|
25
|
-
:magic, :uint
|
15
|
+
:magic, :uint
|
26
16
|
end
|
17
|
+
end
|
18
|
+
#
|
19
|
+
module EinaList
|
27
20
|
#
|
28
21
|
class REinaList
|
29
22
|
include Enumerable
|
30
23
|
include Efl::ClassHelper
|
31
|
-
|
24
|
+
search_prefixes 'eina_list_'
|
32
25
|
def initialize o=nil
|
33
26
|
@ptr = (
|
34
27
|
case o
|
@@ -36,24 +29,22 @@ module Efl
|
|
36
29
|
o
|
37
30
|
when NilClass
|
38
31
|
FFI::Pointer::NULL
|
39
|
-
when self.class
|
40
|
-
o.to_ptr
|
41
32
|
when Array
|
42
|
-
o.inject(FFI::Pointer::NULL) { |p,e|
|
33
|
+
o.inject(FFI::Pointer::NULL) { |p,e| Native.eina_list_append p, e }
|
43
34
|
else
|
44
35
|
raise ArgumentError.new "wrong argument #{o.class.name}"
|
45
36
|
end
|
46
37
|
)
|
47
38
|
end
|
48
|
-
def free
|
49
|
-
|
50
|
-
Efl::EinaList.eina_list_free @ptr
|
39
|
+
def free
|
40
|
+
Native.eina_list_free @ptr
|
51
41
|
@ptr = nil
|
52
42
|
end
|
53
43
|
def each
|
44
|
+
return if not block_given?
|
54
45
|
p = @ptr
|
55
46
|
while p!=::FFI::Pointer::NULL
|
56
|
-
l =
|
47
|
+
l = Native::EinaListStruct.new p
|
57
48
|
yield l[:data]
|
58
49
|
p = l[:next]
|
59
50
|
end
|
@@ -63,11 +54,11 @@ module Efl
|
|
63
54
|
end
|
64
55
|
# for fun and tests
|
65
56
|
def append p
|
66
|
-
@ptr =
|
57
|
+
@ptr = Native.eina_list_append @ptr, p
|
67
58
|
end
|
68
59
|
alias :<< :append
|
69
60
|
def prepend p
|
70
|
-
@ptr =
|
61
|
+
@ptr = Native.eina_list_prepend @ptr, p
|
71
62
|
end
|
72
63
|
alias :unshift :prepend
|
73
64
|
end
|
data/lib/efl/elementary.rb
CHANGED
@@ -2,20 +2,9 @@
|
|
2
2
|
# -*- coding: UTF-8 -*-
|
3
3
|
#
|
4
4
|
require 'efl/evas'
|
5
|
+
require 'efl/native/elementary'
|
5
6
|
#
|
6
|
-
|
7
|
-
module Elm
|
8
|
-
extend Efl::FFIHelper
|
9
|
-
steal_ffitype Efl::Evas, :evas_smart_cb
|
10
|
-
steal_ffitype Efl::Evas, :evas_load_error
|
11
|
-
steal_ffitype Efl::Evas, :evas_callback_type
|
12
|
-
steal_ffitype Efl::Evas, :evas_object_box_data_p
|
13
|
-
end
|
14
|
-
end
|
15
|
-
#
|
16
|
-
require 'efl/ffi/elementary'
|
17
|
-
#
|
18
|
-
Efl::Evas::REvasObject.proxy_list << [Efl::Elm,'elm_'].freeze # append not prepend !
|
7
|
+
Efl::Evas::REvasObject.search_prefixes << 'elm_' # append not prepend !
|
19
8
|
#
|
20
9
|
module Efl
|
21
10
|
module Elm
|
@@ -23,30 +12,30 @@ module Efl
|
|
23
12
|
class << self
|
24
13
|
def init *args
|
25
14
|
a = args.select { |e| e.is_a? String }
|
26
|
-
return
|
15
|
+
return Native.elm_init 0, FFI::MemoryPointer::NULL if a.length==0
|
27
16
|
ptr = FFI::MemoryPointer.new :pointer, a.length
|
28
17
|
a.each_with_index do |s,i|
|
29
18
|
ptr[i].write_pointer FFI::MemoryPointer.from_string(s)
|
30
19
|
end
|
31
|
-
|
20
|
+
Native.elm_init a.length, ptr
|
32
21
|
end
|
33
22
|
end
|
34
23
|
#
|
35
24
|
class ElmWin
|
36
25
|
include Efl::ClassHelper
|
37
|
-
|
26
|
+
search_prefixes 'elm_win_', 'elm_'
|
38
27
|
def initialize parent, title, type=:elm_win_basic
|
39
|
-
@evas_object =
|
28
|
+
@evas_object = Evas::REvasObject.new Native.elm_win_add parent, title, type
|
40
29
|
@ptr = @evas_object.to_ptr
|
41
30
|
yield self,@evas_object if block_given?
|
42
31
|
end
|
43
32
|
def add e
|
44
|
-
eo =
|
33
|
+
eo = Evas::REvasObject.new Native.send "elm_#{e}_add", @ptr
|
45
34
|
yield eo if block_given?
|
46
35
|
eo
|
47
36
|
end
|
48
37
|
def smart_callback_add event_str, cb, data=FFI::MemoryPointer::NULL
|
49
|
-
|
38
|
+
Native.evas_object_smart_callback_add @ptr, event_str, cb, data
|
50
39
|
end
|
51
40
|
end
|
52
41
|
#
|
data/lib/efl/evas.rb
CHANGED
@@ -1,17 +1,11 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
# -*- coding: UTF-8 -*-
|
3
3
|
#
|
4
|
-
require 'efl/
|
4
|
+
require 'efl/native/evas'
|
5
5
|
#
|
6
6
|
module Efl
|
7
7
|
#
|
8
|
-
module
|
9
|
-
#
|
10
|
-
EVAS_ENGINE_BUFFER_DEPTH_ARGB32 = 0
|
11
|
-
EVAS_ENGINE_BUFFER_DEPTH_BGRA32 = 1
|
12
|
-
EVAS_ENGINE_BUFFER_DEPTH_RGB24 = 2
|
13
|
-
EVAS_ENGINE_BUFFER_DEPTH_BGR24 = 3
|
14
|
-
EVAS_ENGINE_BUFFER_DEPTH_RGB32 = 4
|
8
|
+
module Native
|
15
9
|
#
|
16
10
|
callback :new_update_region_cb, [:int, :int, :int, :int, :int_p], :pointer
|
17
11
|
callback :free_update_region_cb, [:int, :int, :int, :int, :pointer], :void
|
@@ -32,118 +26,253 @@ module Efl
|
|
32
26
|
:color_key_r, :int,
|
33
27
|
:color_key_g, :int,
|
34
28
|
:color_key_b, :int,
|
35
|
-
:func, EngineInfoBufferFuncStruct
|
29
|
+
:func, EngineInfoBufferFuncStruct
|
36
30
|
end
|
37
31
|
class EngineInfoBufferStruct < FFI::Struct
|
38
32
|
layout :magic, EngineInfoStruct,
|
39
33
|
:info, EngineInfoBufferInfoStruct,
|
40
34
|
# :func, EvasEngineInfoBufferFunc,
|
41
|
-
:mode, :evas_engine_render_mode
|
35
|
+
:mode, :evas_engine_render_mode
|
42
36
|
end
|
43
37
|
#
|
38
|
+
end
|
39
|
+
#
|
40
|
+
module Evas
|
41
|
+
#
|
42
|
+
EVAS_ENGINE_BUFFER_DEPTH_ARGB32 = 0
|
43
|
+
EVAS_ENGINE_BUFFER_DEPTH_BGRA32 = 1
|
44
|
+
EVAS_ENGINE_BUFFER_DEPTH_RGB24 = 2
|
45
|
+
EVAS_ENGINE_BUFFER_DEPTH_BGR24 = 3
|
46
|
+
EVAS_ENGINE_BUFFER_DEPTH_RGB32 = 4
|
47
|
+
#
|
44
48
|
class REvas
|
45
49
|
#
|
46
50
|
include Efl::ClassHelper
|
47
|
-
|
51
|
+
search_prefixes 'evas_'
|
48
52
|
#
|
49
53
|
def initialize o=nil
|
50
54
|
@ptr = (
|
51
55
|
case o
|
52
56
|
when NilClass
|
53
|
-
FFI::AutoPointer.new
|
54
|
-
when self.class
|
55
|
-
o.to_ptr
|
56
|
-
when FFI::AutoPointer
|
57
|
-
o
|
57
|
+
FFI::AutoPointer.new Native.evas_new, REvas.method(:release)
|
58
58
|
when FFI::Pointer
|
59
|
-
|
59
|
+
o
|
60
60
|
else
|
61
61
|
raise ArgumentError.new "wrong argument #{o.class.name}"
|
62
62
|
end
|
63
63
|
)
|
64
64
|
yield self if block_given?
|
65
65
|
end
|
66
|
-
def
|
67
|
-
|
68
|
-
|
66
|
+
def self.release p
|
67
|
+
Native.evas_free p unless p.nil?
|
68
|
+
end
|
69
|
+
def free
|
70
|
+
@ptr.autorelease=false if @ptr.is_a? FFI::AutoPointer
|
71
|
+
REvas.release @ptr
|
69
72
|
@ptr=nil
|
70
73
|
end
|
71
74
|
def object_add t
|
72
|
-
|
75
|
+
ts = t.to_s
|
76
|
+
o = (
|
77
|
+
case ts
|
78
|
+
when 'rectangle'
|
79
|
+
Evas::REvasRectangle.new Native.evas_object_rectangle_add @ptr
|
80
|
+
when 'line'
|
81
|
+
Evas::REvasLine.new Native.evas_object_line_add @ptr
|
82
|
+
when 'polygon'
|
83
|
+
Evas::REvasPolygon.new Native.evas_object_polygon_add @ptr
|
84
|
+
else
|
85
|
+
raise NameError.new "unknown or not implemented yet evas_object type #{ts}"
|
86
|
+
end
|
87
|
+
)
|
88
|
+
yield o if block_given?
|
89
|
+
o
|
73
90
|
end
|
74
91
|
def output_size_get
|
75
92
|
x = FFI::MemoryPointer.new :int
|
76
93
|
y = FFI::MemoryPointer.new :int
|
77
|
-
|
94
|
+
Native.evas_output_size_get @ptr, x, y
|
78
95
|
[ x.read_int, y.read_int ]
|
79
96
|
end
|
97
|
+
alias :output_size :output_size_get
|
98
|
+
alias :size :output_size_get
|
80
99
|
def output_viewport_get
|
81
100
|
x = FFI::MemoryPointer.new :int
|
82
101
|
y = FFI::MemoryPointer.new :int
|
83
102
|
w = FFI::MemoryPointer.new :int
|
84
103
|
h = FFI::MemoryPointer.new :int
|
85
|
-
|
104
|
+
Native.evas_output_viewport_get @ptr, x, y, w, h
|
86
105
|
[ x.read_int, y.read_int, w.read_int, h.read_int ]
|
87
106
|
end
|
107
|
+
alias :output_viewport :output_viewport_get
|
108
|
+
alias :viewport :output_viewport_get
|
88
109
|
def pointer_output_xy_get
|
89
110
|
x = FFI::MemoryPointer.new :int
|
90
111
|
y = FFI::MemoryPointer.new :int
|
91
|
-
|
112
|
+
Native.evas_pointer_output_xy_get @ptr, x, y
|
92
113
|
[ x.read_int, y.read_int ]
|
93
114
|
end
|
115
|
+
alias :pointer_output :pointer_output_xy_get
|
94
116
|
def pointer_canvas_xy_get
|
95
117
|
x = FFI::MemoryPointer.new :int
|
96
118
|
y = FFI::MemoryPointer.new :int
|
97
|
-
|
119
|
+
Native.evas_pointer_canvas_xy_get @ptr, x, y
|
98
120
|
[ x.read_int, y.read_int ]
|
99
121
|
end
|
122
|
+
alias :pointer_canvas :pointer_canvas_xy_get
|
100
123
|
end
|
101
124
|
#
|
102
125
|
class REvasObject
|
103
126
|
#
|
104
127
|
include Efl::ClassHelper
|
105
|
-
|
128
|
+
search_prefixes 'evas_object_', 'evas_'
|
106
129
|
#
|
107
130
|
def initialize o=nil
|
108
131
|
@ptr = (
|
109
132
|
case o
|
110
133
|
when NilClass
|
111
|
-
FFI::AutoPointer.new
|
112
|
-
when self.class
|
113
|
-
o.to_ptr
|
114
|
-
when FFI::AutoPointer
|
115
|
-
o
|
134
|
+
FFI::AutoPointer.new Native.evas_new, REvasObject.method(:release)
|
116
135
|
when FFI::Pointer
|
117
|
-
|
136
|
+
o
|
118
137
|
else
|
119
138
|
raise ArgumentError.new "wrong argument #{o.class.name}"
|
120
139
|
end
|
121
140
|
)
|
122
141
|
yield self if block_given?
|
123
142
|
end
|
124
|
-
def
|
125
|
-
|
126
|
-
|
127
|
-
|
143
|
+
def self.release p
|
144
|
+
Native.evas_object_del p unless p.nil?
|
145
|
+
end
|
146
|
+
def free
|
147
|
+
@ptr.autopointer=false if @ptr.is_a? FFI::AutoPointer
|
148
|
+
REvasObject.release @ptr
|
128
149
|
@ptr=nil
|
129
150
|
end
|
151
|
+
def evas_name
|
152
|
+
Native.evas_object_name_get @ptr
|
153
|
+
end
|
154
|
+
def evas_type
|
155
|
+
Native.evas_object_type_get @ptr
|
156
|
+
end
|
130
157
|
def geometry_get
|
131
158
|
x = FFI::MemoryPointer.new :int
|
132
159
|
y = FFI::MemoryPointer.new :int
|
133
160
|
w = FFI::MemoryPointer.new :int
|
134
161
|
h = FFI::MemoryPointer.new :int
|
135
|
-
|
162
|
+
Native.evas_object_geometry_get @ptr, x, y, w, h
|
136
163
|
[ x.read_int, y.read_int, w.read_int, h.read_int ]
|
137
164
|
end
|
165
|
+
alias :geometry :geometry_get
|
166
|
+
def size
|
167
|
+
geometry_get[2..-1]
|
168
|
+
end
|
169
|
+
def size= wh
|
170
|
+
Native.evas_object_resize @ptr, *wh
|
171
|
+
end
|
138
172
|
def color_get
|
139
173
|
r = FFI::MemoryPointer.new :int
|
140
174
|
g = FFI::MemoryPointer.new :int
|
141
175
|
b = FFI::MemoryPointer.new :int
|
142
176
|
a = FFI::MemoryPointer.new :int
|
143
|
-
|
177
|
+
Native.evas_object_color_get @ptr, r, g, b, a
|
144
178
|
[ r.read_int, g.read_int, b.read_int, a.read_int ]
|
145
179
|
end
|
180
|
+
alias :color :color_get
|
181
|
+
def evas_get
|
182
|
+
REvas.new Native.evas_object_evas_get @ptr
|
183
|
+
end
|
184
|
+
alias :evas :evas_get
|
185
|
+
def above_get
|
186
|
+
REvasObject.new Native.evas_object_above_get @ptr
|
187
|
+
end
|
188
|
+
alias :above :above_get
|
189
|
+
def below_get
|
190
|
+
REvasObject.new Native.evas_object_below_get @ptr
|
191
|
+
end
|
192
|
+
alias :below :below_get
|
193
|
+
def size_hint_min_get
|
194
|
+
w = FFI::MemoryPointer.new :int
|
195
|
+
h = FFI::MemoryPointer.new :int
|
196
|
+
Native.evas_object_size_hint_min_get @ptr, w, h
|
197
|
+
[ w.read_int, h.read_int ]
|
198
|
+
end
|
199
|
+
alias :size_hint_min :size_hint_min_get
|
200
|
+
def size_hint_max_get
|
201
|
+
w = FFI::MemoryPointer.new :int
|
202
|
+
h = FFI::MemoryPointer.new :int
|
203
|
+
Native.evas_object_size_hint_max_get @ptr, w, h
|
204
|
+
[ w.read_int, h.read_int ]
|
205
|
+
end
|
206
|
+
alias :size_hint_max :size_hint_max_get
|
207
|
+
def size_hint_request_get
|
208
|
+
w = FFI::MemoryPointer.new :int
|
209
|
+
h = FFI::MemoryPointer.new :int
|
210
|
+
Native.evas_object_size_hint_request_get @ptr, w, h
|
211
|
+
[ w.read_int, h.read_int ]
|
212
|
+
end
|
213
|
+
alias :size_hint_request :size_hint_request_get
|
214
|
+
def size_hint_aspect_get
|
215
|
+
a = FFI::MemoryPointer.new :int
|
216
|
+
w = FFI::MemoryPointer.new :int
|
217
|
+
h = FFI::MemoryPointer.new :int
|
218
|
+
Native.evas_object_size_hint_aspect_get @ptr, a, w, h
|
219
|
+
[ Native.enum_type(:evas_aspect_control)[a.read_int], w.read_int, h.read_int ]
|
220
|
+
end
|
221
|
+
alias :size_hint_aspect :size_hint_aspect_get
|
222
|
+
def size_hint_align_get
|
223
|
+
w = FFI::MemoryPointer.new :double
|
224
|
+
h = FFI::MemoryPointer.new :double
|
225
|
+
Native.evas_object_size_hint_align_get @ptr, w, h
|
226
|
+
[ w.read_double, h.read_double ]
|
227
|
+
end
|
228
|
+
alias :size_hint_align :size_hint_align_get
|
229
|
+
def size_hint_weight_get
|
230
|
+
w = FFI::MemoryPointer.new :double
|
231
|
+
h = FFI::MemoryPointer.new :double
|
232
|
+
Native.evas_object_size_hint_weight_get @ptr, w, h
|
233
|
+
[ w.read_double, h.read_double ]
|
234
|
+
end
|
235
|
+
alias :size_hint_weight :size_hint_weight_get
|
236
|
+
def size_hint_padding_get
|
237
|
+
l = FFI::MemoryPointer.new :int
|
238
|
+
r = FFI::MemoryPointer.new :int
|
239
|
+
t = FFI::MemoryPointer.new :int
|
240
|
+
b = FFI::MemoryPointer.new :int
|
241
|
+
Native.evas_object_size_hint_padding_get @ptr, l, r, t, b
|
242
|
+
[ l.read_int, r.read_int, t.read_int, b.read_int ]
|
243
|
+
end
|
244
|
+
alias :size_hint_padding :size_hint_padding_get
|
245
|
+
def data_get k
|
246
|
+
r = Native.evas_object_data_get @ptr, k
|
247
|
+
return nil if r==FFI::Pointer::NULL
|
248
|
+
r.read_string
|
249
|
+
end
|
250
|
+
alias :data :data_get
|
251
|
+
end
|
252
|
+
#
|
253
|
+
class REvasRectangle < REvasObject
|
254
|
+
end
|
255
|
+
#
|
256
|
+
class REvasLine < REvasObject
|
257
|
+
#
|
258
|
+
search_prefixes 'evas_object_line_'
|
259
|
+
#
|
260
|
+
def line_xy_get
|
261
|
+
x1 = FFI::MemoryPointer.new :int
|
262
|
+
y1 = FFI::MemoryPointer.new :int
|
263
|
+
x2 = FFI::MemoryPointer.new :int
|
264
|
+
y2 = FFI::MemoryPointer.new :int
|
265
|
+
Native.evas_object_line_xy_get @ptr, x1, y1, x2, y2
|
266
|
+
[ x1.read_int, y1.read_int, x2.read_int, y2.read_int ]
|
267
|
+
end
|
268
|
+
end
|
269
|
+
#
|
270
|
+
class REvasPolygon < REvasObject
|
271
|
+
#
|
272
|
+
search_prefixes 'evas_object_polygon_'
|
273
|
+
#
|
146
274
|
end
|
275
|
+
#
|
147
276
|
end
|
148
277
|
end
|
149
278
|
#
|
data/lib/efl/ffi.rb
CHANGED
@@ -72,40 +72,51 @@ module Efl
|
|
72
72
|
def === o; @ptr === o.to_ptr; end
|
73
73
|
def address; @ptr.address; end
|
74
74
|
def self.included kls
|
75
|
-
# create class instance @
|
76
|
-
kls.class_eval "@
|
77
|
-
# access and prepend *args to @
|
78
|
-
kls.class_eval "def self.
|
79
|
-
# on inheritance, copy ancestor's @
|
75
|
+
# create class instance @search_prefixes
|
76
|
+
kls.class_eval "@search_prefixes ||=[]"
|
77
|
+
# access and prepend *args to @search_prefixes
|
78
|
+
kls.class_eval "def self.search_prefixes *args; @search_prefixes.unshift *args unless args.empty?; @search_prefixes; end"
|
79
|
+
# on inheritance, copy ancestor's @search_prefixes
|
80
80
|
kls.class_eval <<-EOF
|
81
81
|
def self.inherited sub
|
82
|
-
sub.class_eval '@
|
83
|
-
sub.
|
82
|
+
sub.class_eval '@search_prefixes = []'
|
83
|
+
sub.search_prefixes *self.search_prefixes
|
84
84
|
end
|
85
85
|
EOF
|
86
86
|
end
|
87
87
|
def method_missing m, *args, &block
|
88
|
-
|
88
|
+
m_s = m.to_s
|
89
|
+
if m_s =~/^(.*)=$/
|
89
90
|
m_s = $1+'_set'
|
90
91
|
args_s = '*args[0]'
|
91
|
-
elsif
|
92
|
+
elsif m_s =~/^(.*)\?$/
|
92
93
|
m_s = $1+'_get'
|
93
94
|
args_s = '*args'
|
94
95
|
else
|
95
|
-
m_s = m.to_s
|
96
96
|
args_s = '*args'
|
97
97
|
end
|
98
|
-
self.class.
|
98
|
+
self.class.search_prefixes.each do |p|
|
99
99
|
sym = p+m_s
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
meth = (
|
101
|
+
if Efl::Native.respond_to? sym
|
102
|
+
sym
|
103
|
+
elsif Efl::Native.respond_to? m
|
104
|
+
m
|
105
|
+
elsif Efl::Native.respond_to? sym+'_get'
|
106
|
+
sym+'_get'
|
107
|
+
elsif Efl::Native.respond_to? m_s+'_get'
|
108
|
+
m_s+'_get'
|
109
|
+
else
|
110
|
+
nil
|
111
|
+
end
|
112
|
+
)
|
113
|
+
if not meth.nil?
|
114
|
+
self.class.class_eval "def #{m} *args, █ r=Efl::Native.#{meth}(@ptr,#{args_s}); yield r if block_given?; r; end"
|
105
115
|
return self.send m, *args, &block
|
106
116
|
end
|
107
117
|
end
|
108
|
-
|
118
|
+
return [self.to_s+' ['+self.to_ptr.to_s+']'] if m_s=~/^to_ary$/
|
119
|
+
Kernel.raise NameError.new "#{self.class.name} is unable to resolve #{m} within #{self.class.search_prefixes.inspect}"
|
109
120
|
end
|
110
121
|
end
|
111
122
|
end
|
@@ -6,16 +6,20 @@ require 'efl/ffi'
|
|
6
6
|
module Efl
|
7
7
|
#
|
8
8
|
module Ecore
|
9
|
-
#
|
10
|
-
extend Efl::FFIHelper
|
11
9
|
#
|
12
10
|
def self.method_missing m, *args, &block
|
13
11
|
sym = 'ecore_'+m.to_s
|
14
|
-
raise NameError.new "#{self.name}.#{sym} (#{m})" if not
|
15
|
-
self.module_eval "def self.#{m} *args, █ r=
|
16
|
-
self.send
|
12
|
+
raise NameError.new "#{self.name}.#{sym} (#{m})" if not Efl::Native.respond_to? sym
|
13
|
+
self.module_eval "def self.#{m} *args, █ r=Efl::Native.#{sym}(*args); yield r if block_given?; r; end"
|
14
|
+
self.send m, *args, &block
|
17
15
|
end
|
18
16
|
#
|
17
|
+
end
|
18
|
+
#
|
19
|
+
module Native
|
20
|
+
#
|
21
|
+
extend Efl::FFIHelper
|
22
|
+
#
|
19
23
|
ffi_lib 'ecore'
|
20
24
|
#
|
21
25
|
# ENUMS
|
@@ -6,16 +6,20 @@ require 'efl/ffi'
|
|
6
6
|
module Efl
|
7
7
|
#
|
8
8
|
module EcoreEvas
|
9
|
-
#
|
10
|
-
extend Efl::FFIHelper
|
11
9
|
#
|
12
10
|
def self.method_missing m, *args, &block
|
13
11
|
sym = 'ecore_evas_'+m.to_s
|
14
|
-
raise NameError.new "#{self.name}.#{sym} (#{m})" if not
|
15
|
-
self.module_eval "def self.#{m} *args, █ r=
|
16
|
-
self.send
|
12
|
+
raise NameError.new "#{self.name}.#{sym} (#{m})" if not Efl::Native.respond_to? sym
|
13
|
+
self.module_eval "def self.#{m} *args, █ r=Efl::Native.#{sym}(*args); yield r if block_given?; r; end"
|
14
|
+
self.send m, *args, &block
|
17
15
|
end
|
18
16
|
#
|
17
|
+
end
|
18
|
+
#
|
19
|
+
module Native
|
20
|
+
#
|
21
|
+
extend Efl::FFIHelper
|
22
|
+
#
|
19
23
|
ffi_lib 'ecore_evas'
|
20
24
|
#
|
21
25
|
# ENUMS
|
@@ -49,6 +53,9 @@ module Efl
|
|
49
53
|
typedef :pointer, :ecore_evas_p
|
50
54
|
#
|
51
55
|
# CALLBACKS
|
56
|
+
# void (*func) (Ecore_Evas *ee)
|
57
|
+
callback :ecore_evas_event_cb, [:ecore_evas_p], :void
|
58
|
+
#
|
52
59
|
#
|
53
60
|
# FUNCTIONS
|
54
61
|
fcts = [
|
@@ -185,35 +192,35 @@ module Efl
|
|
185
192
|
# EAPI void ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data);
|
186
193
|
[ :ecore_evas_data_set, [ :ecore_evas_p, :string, :void_p ], :void ],
|
187
194
|
# EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
188
|
-
|
195
|
+
[ :ecore_evas_callback_resize_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
189
196
|
# EAPI void ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
190
|
-
|
197
|
+
[ :ecore_evas_callback_move_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
191
198
|
# EAPI void ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
192
|
-
|
199
|
+
[ :ecore_evas_callback_show_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
193
200
|
# EAPI void ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
194
|
-
|
201
|
+
[ :ecore_evas_callback_hide_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
195
202
|
# EAPI void ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
196
|
-
|
203
|
+
[ :ecore_evas_callback_delete_request_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
197
204
|
# EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
198
|
-
|
205
|
+
[ :ecore_evas_callback_destroy_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
199
206
|
# EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
200
|
-
|
207
|
+
[ :ecore_evas_callback_focus_in_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
201
208
|
# EAPI void ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
202
|
-
|
209
|
+
[ :ecore_evas_callback_focus_out_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
203
210
|
# EAPI void ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
204
|
-
|
211
|
+
[ :ecore_evas_callback_sticky_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
205
212
|
# EAPI void ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
206
|
-
|
213
|
+
[ :ecore_evas_callback_unsticky_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
207
214
|
# EAPI void ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
208
|
-
|
215
|
+
[ :ecore_evas_callback_mouse_in_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
209
216
|
# EAPI void ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
210
|
-
|
217
|
+
[ :ecore_evas_callback_mouse_out_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
211
218
|
# EAPI void ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
212
|
-
|
219
|
+
[ :ecore_evas_callback_pre_render_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
213
220
|
# EAPI void ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
214
|
-
|
221
|
+
[ :ecore_evas_callback_post_render_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
215
222
|
# EAPI void ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
216
|
-
|
223
|
+
[ :ecore_evas_callback_pre_free_set, [:ecore_evas_p, :ecore_evas_event_cb], :void],
|
217
224
|
# EAPI Evas *ecore_evas_get(const Ecore_Evas *ee);
|
218
225
|
[ :ecore_evas_get, [ :ecore_evas_p ], :evas_p ],
|
219
226
|
# EAPI void ecore_evas_move(Ecore_Evas *ee, int x, int y);
|
@@ -6,16 +6,20 @@ require 'efl/ffi'
|
|
6
6
|
module Efl
|
7
7
|
#
|
8
8
|
module EcoreGetopt
|
9
|
-
#
|
10
|
-
extend Efl::FFIHelper
|
11
9
|
#
|
12
10
|
def self.method_missing m, *args, &block
|
13
11
|
sym = 'ecore_getopt_'+m.to_s
|
14
|
-
raise NameError.new "#{self.name}.#{sym} (#{m})" if not
|
15
|
-
self.module_eval "def self.#{m} *args, █ r=
|
16
|
-
self.send
|
12
|
+
raise NameError.new "#{self.name}.#{sym} (#{m})" if not Efl::Native.respond_to? sym
|
13
|
+
self.module_eval "def self.#{m} *args, █ r=Efl::Native.#{sym}(*args); yield r if block_given?; r; end"
|
14
|
+
self.send m, *args, &block
|
17
15
|
end
|
18
16
|
#
|
17
|
+
end
|
18
|
+
#
|
19
|
+
module Native
|
20
|
+
#
|
21
|
+
extend Efl::FFIHelper
|
22
|
+
#
|
19
23
|
ffi_lib 'ecore'
|
20
24
|
#
|
21
25
|
# ENUMS
|