1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
require 'efl/evas'
require 'efl/native/elementary'
#
module Efl
#
module Native
#
class ElmGenlistItemClassStruct < FFI::Struct
layout :item_style, :string,
:label_get, :pointer,
:icon_get, :pointer,
:state_get, :pointer,
:del, :pointer,
:moved, :pointer,
:mode_item_style, :string,
end
#
end
#
module Elm
#
def self.version
Native::VersionStruct.new(Native.elm_version)
end
#
module Helper
def self.included kls
def kls.constructor meth
self.class_eval <<-EOF
def initialize ptr, &block
if ptr.is_a? FFI::Pointer
super ptr, &block
else
super Native.method(:#{meth}), ptr, &block
end
end
EOF
end
end
end
#
class << self
def init *args
a = args.select { |e| e.is_a? String }
return Native.elm_init 0, FFI::MemoryPointer::NULL if a.length==0
ptr = FFI::MemoryPointer.new :pointer, a.length
a.each_with_index do |s,i|
ptr[i].write_pointer FFI::MemoryPointer.from_string(s)
end
Native.elm_init a.length, ptr
end
end
#
class ElmWin < Efl::Evas::REvasObject
#
search_prefixes 'elm_win_', 'elm_object_'
#
def initialize parent, title, type=:elm_win_basic, &block
super Native.method(:elm_win_add), parent, title, type, &block
end
def smart_callback_add event_str, cb, data=FFI::MemoryPointer::NULL
Native.evas_object_smart_callback_add @ptr, event_str, cb, data
end
def inwin_add
ElmInWin.new @ptr
end
def screen_position_get
x = FFI::MemoryPointer.new :int
y = FFI::MemoryPointer.new :int
Native.elm_win_screen_position_get @ptr, x, y
[ x.read_int, y.read_int ]
end
alias :screen_position :screen_position_get
end
#
class ElmInWin < Efl::Evas::REvasObject
#
search_prefixes 'elm_win_inwin_', 'elm_win_', 'elm_object_'
#
def initialize parent, &block
super Native.method(:elm_win_inwin_add), parent, &block
end
end
#
class ElmBg < Efl::Evas::REvasObject
#
include Helper
constructor :elm_bg_add
search_prefixes 'elm_bg_', 'elm_object_'
#
def file_get
f = FFI::MemoryPointer.new :pointer
g = FFI::MemoryPointer.new :pointer
Native.elm_bg_file_get @ptr, f, g
[ f.read_pointer.read_string, g.read_pointer.read_string ]
end
alias :file :file_get
def color_get
r = FFI::MemoryPointer.new :int
g = FFI::MemoryPointer.new :int
b = FFI::MemoryPointer.new :int
Native.elm_bg_color_get @ptr, r, g, b
[ r.read_int, g.read_int, b.read_int ]
end
alias :color :color_get
end
#
class ElmLayout < Efl::Evas::REvasObject
#
include Helper
constructor :elm_layout_add
search_prefixes 'elm_layout_', 'elm_object_'
#
def edje_get &block
Efl::Edje::REdje.new Native.method(:elm_layout_edje_get), @ptr, &block
end
alias :edje :edje_get
end
#
class ElmBox < Efl::Evas::REvasObject
#
include Helper
constructor :elm_box_add
search_prefixes 'elm_box_', 'elm_object_'
#
def padding_get
x = FFI::MemoryPointer.new :int
y = FFI::MemoryPointer.new :int
Native::elm_box_padding_get @ptr, x, y
[ x.read_int, y.read_int ]
end
alias :padding :padding_get
#
def align_get
x = FFI::MemoryPointer.new :float
y = FFI::MemoryPointer.new :float
Native::elm_box_align_get @ptr, x, y
[ x.read_float, y.read_float ]
end
alias :align :padding_get
#
def children_get
Efl::EinaList::REinaList.new Native.elm_box_children_get @ptr
end
alias :children :children_get
end
#
class ElmList < Efl::Evas::REvasObject
#
include Helper
constructor :elm_list_add
search_prefixes 'elm_list_', 'elm_object_'
#
end
#
class ElmIcon < Efl::Evas::REvasObject
#
include Helper
constructor :elm_icon_add
search_prefixes 'elm_icon_', 'elm_object_'
#
def scale_set args
Native.elm_icon_scale_set @ptr, *args
end
alias :scale= :scale_set
end
#
class ElmLabel < Efl::Evas::REvasObject
#
include Helper
constructor :elm_label_add
search_prefixes 'elm_label_', 'elm_object_'
#
end
#
class ElmPager < Efl::Evas::REvasObject
#
include Helper
constructor :elm_pager_add
search_prefixes 'elm_pager_', 'elm_object_'
#
end
#
class ElmPanel < Efl::Evas::REvasObject
#
include Helper
constructor :elm_panel_add
search_prefixes 'elm_panel_', 'elm_object'
#
end
#
class ElmDiskSelector < Efl::Evas::REvasObject
#
include Helper
constructor :elm_diskselector_add
search_prefixes 'elm_diskselector_', 'elm_object'
#
def item_selected_set it, b
Native::elm_diskselector_item_selected_set it, b
end
alias :item_selected= :item_selected_set
end
#
class ElmDiskSelectorItem < Efl::Evas::REvasObject
#
search_prefixes 'elm_diskselector_item_', 'elm_object'
#
def data_get
Native::elm_diskselector_item_data_get @ptr
end
alias :data :data_get
end
#
class ElmNotify < Efl::Evas::REvasObject
#
include Helper
constructor :elm_notify_add
search_prefixes 'elm_notify_', 'elm_object'
#
end
#
class ElmEntry < Efl::Evas::REvasObject
#
include Helper
constructor :elm_entry_add
search_prefixes 'elm_entry_', 'elm_object'
#
end
#
class ElmFlipSelector < Efl::Evas::REvasObject
#
include Helper
constructor :elm_flipselector_add
search_prefixes 'elm_flipselector_', 'elm_object'
#
def item_append label, cb, data
ElmFlipSelectorItem.new Native::elm_flipselector_item_append @ptr, label, cb, data
end
#
def selected_item_get
ElmFlipSelectorItem.new Native::elm_flipselector_selected_item_get @ptr
end
alias :selected_item :selected_item_get
end
#
class ElmFlipSelectorItem < Efl::Evas::REvasObject
#
search_prefixes 'elm_flipselector_item_', 'elm_object'
#
end
#
class ElmHoversel < Efl::Evas::REvasObject
#
include Helper
constructor :elm_hoversel_add
search_prefixes 'elm_hoversel_', 'elm_object'
#
def item_add label, icon_file=nil, icon_type=:elm_icon_none, cb=nil, data=nil
ElmHoverselItem.new Native::elm_hoversel_item_add @ptr, label, icon_file, icon_type, cb, data
end
end
#
class ElmHoverselItem < Efl::Evas::REvasObject
#
search_prefixes 'elm_hoversel_item_', 'elm_object'
#
end
#
end
end
#
# EOF
|