ffi-efl 0.0.8 → 0.0.9
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/README.rdoc +1 -1
- data/lib/efl.rb +1 -5
- data/lib/efl/elementary.rb +433 -99
- data/lib/efl/evas.rb +4 -0
- data/lib/efl/ffi.rb +60 -59
- data/lib/efl/native/ecore.rb +4 -6
- data/lib/efl/native/ecore_evas.rb +0 -2
- data/lib/efl/native/ecore_getopt.rb +0 -2
- data/lib/efl/native/ecore_input.rb +0 -2
- data/lib/efl/native/edje.rb +7 -2
- data/lib/efl/native/eet.rb +0 -2
- data/lib/efl/native/eina.rb +0 -2
- data/lib/efl/native/eina_hash.rb +0 -2
- data/lib/efl/native/eina_list.rb +0 -2
- data/lib/efl/native/eina_log.rb +0 -2
- data/lib/efl/native/eina_types.rb +0 -2
- data/lib/efl/native/elementary.rb +37 -8
- data/lib/efl/native/emap.rb +0 -2
- data/lib/efl/native/evas.rb +6 -4
- data/spec/elm_spec.rb +0 -3
- data/test/test_elementary.rb +37 -10
- data/test/tests/test_actionslider.rb +132 -0
- data/test/tests/test_bg.rb +151 -0
- data/test/tests/test_box.rb +147 -0
- metadata +12 -17
data/spec/elm_spec.rb
CHANGED
@@ -187,15 +187,12 @@ describe "Efl::Elm #{Efl::Elm.version.full}" do
|
|
187
187
|
@iwin.activate
|
188
188
|
@iwin.content_set o1
|
189
189
|
@iwin.content.should == o1.to_ptr
|
190
|
-
@iwin.content?.should == o1.to_ptr
|
191
190
|
@iwin.content_get.should === o1.to_ptr
|
192
191
|
@iwin.content= o2
|
193
192
|
@iwin.content.should === o2.to_ptr
|
194
|
-
@iwin.content?.should === o2.to_ptr
|
195
193
|
@iwin.content_get.should === o2.to_ptr
|
196
194
|
@iwin.content_unset
|
197
195
|
@iwin.content.should == FFI::Pointer::NULL
|
198
|
-
@iwin.content?.should == FFI::Pointer::NULL
|
199
196
|
@iwin.content_get.should == FFI::Pointer::NULL
|
200
197
|
o1.free
|
201
198
|
o2.free
|
data/test/test_elementary.rb
CHANGED
@@ -1,8 +1,20 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
# -*- coding: UTF-8 -*-
|
3
3
|
#
|
4
|
+
require 'efl/elementary'
|
5
|
+
require 'efl/edje'
|
4
6
|
require 'efl'
|
5
7
|
#
|
8
|
+
PREFIX=`pkg-config --variable=prefix ecore`.strip
|
9
|
+
if PREFIX.empty?
|
10
|
+
puts "unable to determine Efl::PREFIX using pkg-config, images will not be available"
|
11
|
+
end
|
12
|
+
PACKAGE_DATA_DIR = File.join PREFIX, 'share', 'elementary'
|
13
|
+
|
14
|
+
Dir.glob( File.join File.dirname(__FILE__), 'tests', '*.rb').each do |f|
|
15
|
+
load f
|
16
|
+
end
|
17
|
+
#
|
6
18
|
include Efl;
|
7
19
|
#
|
8
20
|
TESTS = [
|
@@ -150,7 +162,7 @@ class TestWin < Elm::ElmWin
|
|
150
162
|
#
|
151
163
|
def initialize name, title
|
152
164
|
super FFI::MemoryPointer::NULL, name
|
153
|
-
title = title
|
165
|
+
self.title = title
|
154
166
|
feed
|
155
167
|
smart_callback_add 'delete,request', method(:on_delete)
|
156
168
|
end
|
@@ -188,7 +200,6 @@ class TestWin < Elm::ElmWin
|
|
188
200
|
li.size_hint_weight_expand
|
189
201
|
li.size_hint_align_set_fill
|
190
202
|
@bx0.pack_end li
|
191
|
-
li.show
|
192
203
|
end
|
193
204
|
@idx = Elm::ElmIndex.new self do |idx|
|
194
205
|
idx.smart_callback_add 'delay,changed', method(:index_changed)
|
@@ -197,19 +208,32 @@ class TestWin < Elm::ElmWin
|
|
197
208
|
idx.show
|
198
209
|
end
|
199
210
|
ch = nil
|
200
|
-
TESTS.each do |l,m|
|
201
|
-
|
211
|
+
TESTS.sort.each do |l,m|
|
212
|
+
icon = nil
|
213
|
+
if Tests.respond_to? m
|
214
|
+
icon = Elm::ElmIcon.new self
|
215
|
+
icon.file = "#{PACKAGE_DATA_DIR}/images/icon_00.png", nil
|
216
|
+
icon.size_hint_min = 20,20
|
217
|
+
end
|
218
|
+
it = @li.item_append l, nil, icon, method(:try_test), FFI::MemoryPointer.from_string(m.to_s)
|
219
|
+
it.del_cb_set method(:free_list_item)
|
202
220
|
if l[0]!=ch
|
203
221
|
ch = l[0]
|
204
|
-
@idx.item_append ch, it
|
222
|
+
@idx.item_append ch.to_s, it
|
205
223
|
end
|
206
224
|
end
|
207
225
|
@idx.item_go 0
|
208
226
|
@li.go
|
227
|
+
@li.show
|
209
228
|
end
|
210
229
|
#
|
211
|
-
def
|
212
|
-
|
230
|
+
def try_test data, evas_obj, event_info
|
231
|
+
fct = data.read_string
|
232
|
+
begin
|
233
|
+
Tests.send fct
|
234
|
+
rescue NoMethodError
|
235
|
+
puts "#{fct} not implemeneted yet"
|
236
|
+
end
|
213
237
|
end
|
214
238
|
#
|
215
239
|
def tg_changed data, evas_obj, event_info
|
@@ -220,13 +244,18 @@ class TestWin < Elm::ElmWin
|
|
220
244
|
Native.elm_list_item_show event_info
|
221
245
|
end
|
222
246
|
#
|
247
|
+
def free_list_item data, evas_obj, event_info
|
248
|
+
# free FFI::MemoryPointer.from_string m.to_s
|
249
|
+
data.free
|
250
|
+
end
|
251
|
+
#
|
223
252
|
def on_delete data, evas_object, event_info
|
224
253
|
Elm.exit
|
225
254
|
end
|
226
255
|
end
|
227
256
|
#
|
228
257
|
def elm_main
|
229
|
-
win = TestWin.new '
|
258
|
+
win = TestWin.new 'test_elementary', 'Elementary Tests'
|
230
259
|
win.evas_object_resize 320, 480
|
231
260
|
win.show
|
232
261
|
end
|
@@ -234,8 +263,6 @@ end
|
|
234
263
|
Elm.init
|
235
264
|
#
|
236
265
|
Native.elm_app_info_set elm_main, 'elementary', 'images/logo.png'
|
237
|
-
Native.elm_app_compile_bin_dir_set PACKAGE_BIN_DIR
|
238
|
-
Native.elm_app_compile_data_dir_set PACKAGE_DATA_DIR
|
239
266
|
#
|
240
267
|
Elm.run
|
241
268
|
Elm.shutdown
|
@@ -0,0 +1,132 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# -*- coding: UTF-8 -*-
|
3
|
+
#
|
4
|
+
module Tests
|
5
|
+
#
|
6
|
+
class TestActionSlider < Efl::Elm::ElmWin
|
7
|
+
def initialize name, title, fct
|
8
|
+
super nil, name
|
9
|
+
self.title = title
|
10
|
+
self.autodel = true
|
11
|
+
self.send fct
|
12
|
+
self.resize 320, 400
|
13
|
+
self.show
|
14
|
+
end
|
15
|
+
def simple
|
16
|
+
@bg = Elm::ElmBg.new self do |bg|
|
17
|
+
bg.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
|
18
|
+
self.resize_object_add bg
|
19
|
+
bg.show
|
20
|
+
end
|
21
|
+
@bx = Elm::ElmBox.new self do |bx|
|
22
|
+
bx.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
|
23
|
+
self.resize_object_add bx
|
24
|
+
bx.show
|
25
|
+
end
|
26
|
+
as_pos = Native.enum_type :elm_actionslider_pos
|
27
|
+
# standards calls
|
28
|
+
as = Elm::ElmActionSlider.new self do |as|
|
29
|
+
as.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
|
30
|
+
as.size_hint_align_set Evas::EVAS_HINT_FILL, 0
|
31
|
+
as.text_part = "left", "Snooze"
|
32
|
+
as.text_part = "center", nil
|
33
|
+
as.text_part = "right", "Stop"
|
34
|
+
as.indicator_pos = :elm_actionslider_right
|
35
|
+
as.magnet_pos = :elm_actionslider_right
|
36
|
+
as.enabled_pos = as_pos[:elm_actionslider_left]|as_pos[:elm_actionslider_right]
|
37
|
+
as.smart_callback_add "selected", method(:cb_pos_selected)
|
38
|
+
as.smart_callback_add "pos_changed", method(:cb_position_change_magnetic)
|
39
|
+
as.show
|
40
|
+
end
|
41
|
+
@bx.pack_end as
|
42
|
+
# use xxx_set helpers
|
43
|
+
as = Elm::ElmActionSlider.new self do |as|
|
44
|
+
as.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
|
45
|
+
as.size_hint_align_set Evas::EVAS_HINT_FILL, 0
|
46
|
+
as.texts_set "Snooze", nil, "Stop"
|
47
|
+
as.indicator_set 'c'
|
48
|
+
as.magnet_set 'c'
|
49
|
+
as.enabled_set 'lr'
|
50
|
+
as.smart_callback_add "selected", method(:cb_pos_selected)
|
51
|
+
as.show
|
52
|
+
end
|
53
|
+
@bx.pack_end as
|
54
|
+
# use xxx = helpers
|
55
|
+
as = Elm::ElmActionSlider.new self do |as|
|
56
|
+
as.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
|
57
|
+
as.size_hint_align_set Evas::EVAS_HINT_FILL, 0
|
58
|
+
as.style = "bar"
|
59
|
+
as.texts = nil, "Accept", "Reject"
|
60
|
+
as.indicator = 'l'
|
61
|
+
as.magnet = 'cr'
|
62
|
+
as.enabled = 'cr'
|
63
|
+
as.smart_callback_add "selected", method(:cb_pos_selected)
|
64
|
+
as.show
|
65
|
+
end
|
66
|
+
@bx.pack_end as
|
67
|
+
# use setup
|
68
|
+
as = Elm::ElmActionSlider.new self do |as|
|
69
|
+
as.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
|
70
|
+
as.size_hint_align_set Evas::EVAS_HINT_FILL, 0
|
71
|
+
as.style = "bar"
|
72
|
+
as.text = "Go"
|
73
|
+
as.setup [nil, "Accept", "Reject"], 'l', 'l', 'a'
|
74
|
+
as.smart_callback_add "selected", method(:cb_pos_selected)
|
75
|
+
as.smart_callback_add "pos_changed", method(:cb_position_change_magnetic)
|
76
|
+
as.show
|
77
|
+
end
|
78
|
+
@bx.pack_end as
|
79
|
+
as = Elm::ElmActionSlider.new self do |as|
|
80
|
+
as.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
|
81
|
+
as.size_hint_align_set Evas::EVAS_HINT_FILL, 0
|
82
|
+
as.text = "Go"
|
83
|
+
as.setup ["Left", "Center", "right"], 'l', 'a'
|
84
|
+
as.smart_callback_add "selected", method(:cb_pos_selected)
|
85
|
+
as.show
|
86
|
+
end
|
87
|
+
@bx.pack_end as
|
88
|
+
as = Elm::ElmActionSlider.new self do |as|
|
89
|
+
as.size_hint_weight_set Evas::EVAS_HINT_EXPAND, 0
|
90
|
+
as.size_hint_align_set Evas::EVAS_HINT_FILL, 0
|
91
|
+
as.text = "Go"
|
92
|
+
as.setup ["Enable", "Magnet", "Disable"], 'c', 'c'
|
93
|
+
as.smart_callback_add "selected", method(:cb_pos_selected)
|
94
|
+
as.smart_callback_add "pos_changed", method(:cb_magnet_enable_disable)
|
95
|
+
as.show
|
96
|
+
end
|
97
|
+
@bx.pack_end as
|
98
|
+
end
|
99
|
+
def cb_pos_selected data, evas_obj, event_info
|
100
|
+
as = Elm::ElmActionSlider.new evas_obj
|
101
|
+
puts "Selection #{event_info.null? ? 'NULL' : event_info.read_string}"
|
102
|
+
puts " label: #{Elm::ElmActionSlider.new(evas_obj).selected_label}"
|
103
|
+
end
|
104
|
+
def cb_position_change_magnetic data, evas_obj, event_info
|
105
|
+
as = Elm::ElmActionSlider.new evas_obj
|
106
|
+
return if event_info.null?
|
107
|
+
case event_info.read_string
|
108
|
+
when "left"
|
109
|
+
as.magnet_pos = :elm_actionslider_left
|
110
|
+
when "right"
|
111
|
+
as.magnet_pos = :elm_actionslider_right
|
112
|
+
end
|
113
|
+
end
|
114
|
+
def cb_magnet_enable_disable data, evas_obj, event_info
|
115
|
+
as = Elm::ElmActionSlider.new evas_obj
|
116
|
+
return if event_info.null?
|
117
|
+
case event_info.read_string
|
118
|
+
when "left"
|
119
|
+
as.magnet_pos = :elm_actionslider_center
|
120
|
+
when "right"
|
121
|
+
as.magnet_pos = :elm_actionslider_none
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
#
|
126
|
+
def self.test_actionslider
|
127
|
+
TestActionSlider.new 'actionslider', 'Actionslider', :simple
|
128
|
+
end
|
129
|
+
#
|
130
|
+
end
|
131
|
+
#
|
132
|
+
# EOF
|
@@ -0,0 +1,151 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# -*- coding: UTF-8 -*-
|
3
|
+
#
|
4
|
+
module Tests
|
5
|
+
#
|
6
|
+
class TestBg < Efl::Elm::ElmWin
|
7
|
+
def initialize name, title, fct
|
8
|
+
super nil, name
|
9
|
+
self.title = title
|
10
|
+
self.autodel = true
|
11
|
+
self.send fct
|
12
|
+
@bg.size_hint_min = 160, 160
|
13
|
+
@bg.size_hint_max = 640, 640
|
14
|
+
self.resize 320, 230
|
15
|
+
self.show
|
16
|
+
end
|
17
|
+
def plain_bg
|
18
|
+
@bg = Elm::ElmBg.new self do |bg|
|
19
|
+
bg.size_hint_weight_expand
|
20
|
+
self.resize_object_add bg
|
21
|
+
bg.show
|
22
|
+
end
|
23
|
+
end
|
24
|
+
def image_bg
|
25
|
+
@bg = Elm::ElmBg.new self do |bg|
|
26
|
+
bg.file = "#{PACKAGE_DATA_DIR}/images/plant_01.jpg", nil
|
27
|
+
bg.size_hint_weight_expand
|
28
|
+
self.resize_object_add bg
|
29
|
+
bg.show
|
30
|
+
end
|
31
|
+
end
|
32
|
+
def options_bg
|
33
|
+
plain_bg
|
34
|
+
@bx = Elm::ElmBox.new self do |bx|
|
35
|
+
bx.size_hint_weight_expand
|
36
|
+
self.resize_object_add bx
|
37
|
+
bx.show
|
38
|
+
end
|
39
|
+
@o_bg = Elm::ElmBg.new self do |bg|
|
40
|
+
bg.file = "#{PACKAGE_DATA_DIR}/images/plant_01.jpg", nil
|
41
|
+
bg.size_hint_weight_expand
|
42
|
+
bg.size_hint_align_fill
|
43
|
+
@bx.pack_end bg
|
44
|
+
bg.show
|
45
|
+
end
|
46
|
+
@hbx = Elm::ElmBox.new self do |bx|
|
47
|
+
bx.horizontal = true
|
48
|
+
bx.size_hint_weight_expand_fill
|
49
|
+
bx.size_hint_align_fill
|
50
|
+
end
|
51
|
+
@rdg = Elm::ElmRadio.new self do |r|
|
52
|
+
r.state_value = :elm_bg_option_center
|
53
|
+
r.text = "Center"
|
54
|
+
r.size_hint_weight_expand_fill
|
55
|
+
r.smart_callback_add "changed", method(:cb_radio_changed)
|
56
|
+
@hbx.pack_end r
|
57
|
+
r.show
|
58
|
+
end
|
59
|
+
Elm::ElmRadio.new self do |r|
|
60
|
+
r.state_value = :elm_bg_option_scale
|
61
|
+
r.group_add @rdg
|
62
|
+
r.text = "Scale"
|
63
|
+
r.size_hint_weight_expand_fill
|
64
|
+
r.smart_callback_add "changed", method(:cb_radio_changed)
|
65
|
+
@hbx.pack_end r
|
66
|
+
r.show
|
67
|
+
end
|
68
|
+
Elm::ElmRadio.new self do |r|
|
69
|
+
r.state_value = :elm_bg_option_stretch
|
70
|
+
r.group_add @rdg
|
71
|
+
r.text = "Stretch"
|
72
|
+
r.size_hint_weight_expand_fill
|
73
|
+
r.smart_callback_add "changed", method(:cb_radio_changed)
|
74
|
+
@hbx.pack_end r
|
75
|
+
r.show
|
76
|
+
end
|
77
|
+
Elm::ElmRadio.new self do |r|
|
78
|
+
r.state_value = :elm_bg_option_tile
|
79
|
+
r.group_add @rdg
|
80
|
+
r.text = "Tile"
|
81
|
+
r.size_hint_weight_expand_fill
|
82
|
+
r.smart_callback_add "changed", method(:cb_radio_changed)
|
83
|
+
@hbx.pack_end r
|
84
|
+
r.show
|
85
|
+
end
|
86
|
+
@rdg.value_set :elm_bg_option_scale
|
87
|
+
Elm::ElmCheck.new self do |ck|
|
88
|
+
ck.text = "Show Overlay"
|
89
|
+
ck.size_hint_weight_expand_fill
|
90
|
+
ck.smart_callback_add "changed", method(:cb_overlay_changed)
|
91
|
+
@hbx.pack_end ck
|
92
|
+
ck.show
|
93
|
+
end
|
94
|
+
Elm::ElmSpinner.new self do |sp|
|
95
|
+
sp.style = "vertical"
|
96
|
+
sp.min_max = 1, 4
|
97
|
+
sp.label_format = "%.0f"
|
98
|
+
sp.editable = false
|
99
|
+
sp.special_value_add 1, "White"
|
100
|
+
sp.special_value_add 2, "Red"
|
101
|
+
sp.special_value_add 3, "Blue"
|
102
|
+
sp.special_value_add 4, "Green"
|
103
|
+
sp.size_hint_weight_expand
|
104
|
+
sp.size_hint_align_fill
|
105
|
+
sp.smart_callback_add "changed", method(:cb_color_changed)
|
106
|
+
@hbx.pack_end sp
|
107
|
+
sp.show
|
108
|
+
end
|
109
|
+
@bx.pack_end @hbx
|
110
|
+
@hbx.show
|
111
|
+
end
|
112
|
+
def cb_radio_changed data, evas_obj, event_info
|
113
|
+
@o_bg.option = Elm::ElmRadio.new(evas_obj).value
|
114
|
+
end
|
115
|
+
def cb_overlay_changed data, evas_obj, event_info
|
116
|
+
if Elm::ElmCheck.new(evas_obj).state
|
117
|
+
over = @o_bg.parent_widget.evas.edje_object_add
|
118
|
+
over.file = "#{PACKAGE_DATA_DIR}/objects/test.edj", "bg_overlay"
|
119
|
+
@o_bg.overlay = over
|
120
|
+
else
|
121
|
+
@o_bg.overlay = FFI::Pointer::NULL
|
122
|
+
end
|
123
|
+
end
|
124
|
+
def cb_color_changed data, evas_obj, event_info
|
125
|
+
case Elm::ElmSpinner.new(evas_obj).value
|
126
|
+
when 1.0
|
127
|
+
@o_bg.color = 255, 255, 255
|
128
|
+
when 2.0
|
129
|
+
@o_bg.color = 255, 0, 0
|
130
|
+
when 3.0
|
131
|
+
@o_bg.color = 0, 0, 255
|
132
|
+
when 4.0
|
133
|
+
@o_bg.color = 0, 255, 0
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
#
|
138
|
+
def self.test_bg_plain
|
139
|
+
TestBg.new 'bg-plain', 'Bg Plain', :plain_bg
|
140
|
+
end
|
141
|
+
#
|
142
|
+
def self.test_bg_image
|
143
|
+
TestBg.new 'bg-image', 'Bg Image', :image_bg
|
144
|
+
end
|
145
|
+
def self.test_bg_options
|
146
|
+
TestBg.new 'bg-options', 'Bg Options', :options_bg
|
147
|
+
end
|
148
|
+
#
|
149
|
+
end
|
150
|
+
#
|
151
|
+
# EOF
|
@@ -0,0 +1,147 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# -*- coding: UTF-8 -*-
|
3
|
+
#
|
4
|
+
module Tests
|
5
|
+
#
|
6
|
+
class TestBox < Efl::Elm::ElmWin
|
7
|
+
def initialize name, title, fct
|
8
|
+
super nil, name
|
9
|
+
self.title = title
|
10
|
+
self.autodel = true
|
11
|
+
@bg = Elm::ElmBg.new self do |bg|
|
12
|
+
bg.size_hint_weight_expand
|
13
|
+
self.resize_object_add bg
|
14
|
+
bg.show
|
15
|
+
end
|
16
|
+
self.send fct
|
17
|
+
self.show
|
18
|
+
end
|
19
|
+
#
|
20
|
+
def box_vert
|
21
|
+
@bx = Elm::ElmBox.new self do |bx|
|
22
|
+
bx.size_hint_weight_expand
|
23
|
+
self.resize_object_add bx
|
24
|
+
bx.show
|
25
|
+
end
|
26
|
+
icons = []
|
27
|
+
(0..2).each do
|
28
|
+
icons << Elm::ElmIcon.new(self) do |ico|
|
29
|
+
ico.file = "#{PACKAGE_DATA_DIR}/images/logo_small.png", nil
|
30
|
+
ico.scale = false, false
|
31
|
+
@bx.pack_end ico
|
32
|
+
ico.show
|
33
|
+
end
|
34
|
+
end
|
35
|
+
icons[0].size_hint_align = 0.5, 0.5
|
36
|
+
icons[1].size_hint_align = 0.0, 0.5
|
37
|
+
icons[2].size_hint_align = Efl::Evas::EVAS_HINT_EXPAND, 0.5
|
38
|
+
end
|
39
|
+
#
|
40
|
+
def box_vert2
|
41
|
+
@bx = Elm::ElmBox.new self do |bx|
|
42
|
+
bx.padding = 10, 10
|
43
|
+
self.resize_object_add bx
|
44
|
+
bx.size_hint_weight_expand
|
45
|
+
bx.show
|
46
|
+
end
|
47
|
+
(1..5).each do |n|
|
48
|
+
bt = Efl::Elm::ElmButton.new self
|
49
|
+
bt.text = "Button #{n}"
|
50
|
+
bt.size_hint_align_fill
|
51
|
+
bt.size_hint_weight = 0.0, 0.0
|
52
|
+
bt.smart_callback_add "clicked", method(:del_cb)
|
53
|
+
@bx.pack_end bt
|
54
|
+
bt.show
|
55
|
+
end
|
56
|
+
end
|
57
|
+
#
|
58
|
+
def del_cb data, evas_obj, event_info
|
59
|
+
o = Efl::Elm::ElmObject.new(evas_obj)
|
60
|
+
@bx.unpack o
|
61
|
+
o.move 0, 0
|
62
|
+
o.color = 128, 64, 0, 128
|
63
|
+
end
|
64
|
+
#
|
65
|
+
def box_horiz
|
66
|
+
@bx = Elm::ElmBox.new self do |bx|
|
67
|
+
bx.horizontal = true
|
68
|
+
self.resize_object_add bx
|
69
|
+
bx.size_hint_weight_expand
|
70
|
+
bx.show
|
71
|
+
end
|
72
|
+
icons = []
|
73
|
+
(0..2).each do
|
74
|
+
icons << Elm::ElmIcon.new(self) do |ico|
|
75
|
+
ico.file = "#{PACKAGE_DATA_DIR}/images/logo_small.png", nil
|
76
|
+
ico.scale = false, false
|
77
|
+
@bx.pack_end ico
|
78
|
+
ico.show
|
79
|
+
end
|
80
|
+
end
|
81
|
+
icons[0].size_hint_align = 0.5, 0.5
|
82
|
+
icons[1].size_hint_align = 0.5, 0.0
|
83
|
+
icons[2].size_hint_align = 0.0, Efl::Evas::EVAS_HINT_EXPAND
|
84
|
+
end
|
85
|
+
#
|
86
|
+
def box_transition
|
87
|
+
@bx = Elm::ElmBox.new self do |bx|
|
88
|
+
self.resize_object_add bx
|
89
|
+
bx.size_hint_weight_expand
|
90
|
+
bx.show
|
91
|
+
end
|
92
|
+
(1..3).each do |n|
|
93
|
+
bt = Efl::Elm::ElmButton.new self
|
94
|
+
bt.text = "Button #{n}"
|
95
|
+
bt.size_hint_weight_expand
|
96
|
+
# bt.size_hint_align_fill
|
97
|
+
bt.smart_callback_add "clicked", method(:del_cb)
|
98
|
+
@bx.pack_end bt
|
99
|
+
bt.resize 100, 100
|
100
|
+
bt.show
|
101
|
+
end
|
102
|
+
@idx = 0
|
103
|
+
@transitions = [
|
104
|
+
Efl::Native.find_variable('evas_object_box_layout_vertical'),
|
105
|
+
Efl::Native.find_variable('evas_object_box_layout_horizontal'),
|
106
|
+
Efl::Native.find_variable('evas_object_box_layout_stack'),
|
107
|
+
Efl::Native.find_variable('evas_object_box_layout_homogeneous_vertical'),
|
108
|
+
Efl::Native.find_variable('evas_object_box_layout_homogeneous_horizontal'),
|
109
|
+
Efl::Native.find_variable('evas_object_box_layout_flow_vertical'),
|
110
|
+
Efl::Native.find_variable('evas_object_box_layout_flow_horizontal'),
|
111
|
+
Efl::Native.find_variable('evas_object_box_layout_stack'),
|
112
|
+
]
|
113
|
+
self.resize 300, 300
|
114
|
+
@bx.resize 300, 300
|
115
|
+
@bx.layout = @transitions[@idx], nil, nil
|
116
|
+
self.show
|
117
|
+
transition_change
|
118
|
+
end
|
119
|
+
#
|
120
|
+
def transition_change data=nil
|
121
|
+
last_layout = @transitions[@idx]
|
122
|
+
@idx = (@idx+1) % @transitions.length
|
123
|
+
next_layout = @transitions[@idx]
|
124
|
+
transition = Efl::Native.elm_box_transition_new 1.0, last_layout, nil, nil, next_layout, nil, nil, method(:transition_change), nil
|
125
|
+
transition_fct = Efl::Native.find_variable('elm_box_layout_transition')
|
126
|
+
transition_free = Efl::Native.find_variable('elm_box_transition_free')
|
127
|
+
@bx.layout = transition_fct, transition, transition_free
|
128
|
+
end
|
129
|
+
#
|
130
|
+
end
|
131
|
+
#
|
132
|
+
def self.test_box_vert
|
133
|
+
TestBox.new 'box-vert', 'Box Vert', :box_vert
|
134
|
+
end
|
135
|
+
def self.test_box_vert2
|
136
|
+
TestBox.new 'box-vert', 'Box Vert', :box_vert2
|
137
|
+
end
|
138
|
+
def self.test_box_horiz
|
139
|
+
TestBox.new 'box-horiz', 'Box Horiz', :box_horiz
|
140
|
+
end
|
141
|
+
def self.test_box_transition
|
142
|
+
TestBox.new 'box-transition', 'Box Transition', :box_transition
|
143
|
+
end
|
144
|
+
#
|
145
|
+
end
|
146
|
+
#
|
147
|
+
# EOF
|