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
|
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
module Tests
#
class TestBg < Efl::Elm::ElmWin
def initialize name, title, fct
super nil, name
self.title = title
self.autodel = true
self.send fct
@bg.size_hint_min = 160, 160
@bg.size_hint_max = 640, 640
self.resize 320, 230
self.show
end
def plain_bg
@bg = Elm::ElmBg.new self do |bg|
bg.size_hint_weight_expand
self.resize_object_add bg
bg.show
end
end
def image_bg
@bg = Elm::ElmBg.new self do |bg|
bg.file = "#{PACKAGE_DATA_DIR}/images/plant_01.jpg", nil
bg.size_hint_weight_expand
self.resize_object_add bg
bg.show
end
end
def options_bg
plain_bg
@bx = Elm::ElmBox.new self do |bx|
bx.size_hint_weight_expand
self.resize_object_add bx
bx.show
end
@o_bg = Elm::ElmBg.new self do |bg|
bg.file = "#{PACKAGE_DATA_DIR}/images/plant_01.jpg", nil
bg.size_hint_weight_expand
bg.size_hint_align_fill
@bx.pack_end bg
bg.show
end
@hbx = Elm::ElmBox.new self do |bx|
bx.horizontal = true
bx.size_hint_weight_expand_fill
bx.size_hint_align_fill
end
@rdg = Elm::ElmRadio.new self do |r|
r.state_value = :elm_bg_option_center
r.text = "Center"
r.size_hint_weight_expand_fill
r.smart_callback_add "changed", method(:cb_radio_changed)
@hbx.pack_end r
r.show
end
Elm::ElmRadio.new self do |r|
r.state_value = :elm_bg_option_scale
r.group_add @rdg
r.text = "Scale"
r.size_hint_weight_expand_fill
r.smart_callback_add "changed", method(:cb_radio_changed)
@hbx.pack_end r
r.show
end
Elm::ElmRadio.new self do |r|
r.state_value = :elm_bg_option_stretch
r.group_add @rdg
r.text = "Stretch"
r.size_hint_weight_expand_fill
r.smart_callback_add "changed", method(:cb_radio_changed)
@hbx.pack_end r
r.show
end
Elm::ElmRadio.new self do |r|
r.state_value = :elm_bg_option_tile
r.group_add @rdg
r.text = "Tile"
r.size_hint_weight_expand_fill
r.smart_callback_add "changed", method(:cb_radio_changed)
@hbx.pack_end r
r.show
end
@rdg.value_set :elm_bg_option_scale
Elm::ElmCheck.new self do |ck|
ck.text = "Show Overlay"
ck.size_hint_weight_expand_fill
ck.smart_callback_add "changed", method(:cb_overlay_changed)
@hbx.pack_end ck
ck.show
end
Elm::ElmSpinner.new self do |sp|
sp.style = "vertical"
sp.min_max = 1, 4
sp.label_format = "%.0f"
sp.editable = false
sp.special_value_add 1, "White"
sp.special_value_add 2, "Red"
sp.special_value_add 3, "Blue"
sp.special_value_add 4, "Green"
sp.size_hint_weight_expand
sp.size_hint_align_fill
sp.smart_callback_add "changed", method(:cb_color_changed)
@hbx.pack_end sp
sp.show
end
@bx.pack_end @hbx
@hbx.show
end
def cb_radio_changed data, evas_obj, event_info
@o_bg.option = Elm::ElmRadio.new(evas_obj).value
end
def cb_overlay_changed data, evas_obj, event_info
if Elm::ElmCheck.new(evas_obj).state
over = @o_bg.parent_widget.evas.edje_object_add
over.file = "#{PACKAGE_DATA_DIR}/objects/test.edj", "bg_overlay"
@o_bg.content = over
else
@o_bg.content = FFI::Pointer::NULL
end
end
def cb_color_changed data, evas_obj, event_info
case Elm::ElmSpinner.new(evas_obj).value
when 1.0
@o_bg.color = 255, 255, 255
when 2.0
@o_bg.color = 255, 0, 0
when 3.0
@o_bg.color = 0, 0, 255
when 4.0
@o_bg.color = 0, 255, 0
end
end
end
#
def self.test_bg_plain
TestBg.new 'bg-plain', 'Bg Plain', :plain_bg
end
#
def self.test_bg_image
TestBg.new 'bg-image', 'Bg Image', :image_bg
end
def self.test_bg_options
TestBg.new 'bg-options', 'Bg Options', :options_bg
end
#
end
#
# EOF
|