@objects = [@img, @label]
@objects.each { |o| add_member(o) }
+ set_color(255, 255, 255, 0)
@img.set_color(255, 255, 255, 0)
@label.set_color(255, 0, 0, 0)
end
# smart callbacks
- def on_show
+ def smart_show
@objects.each { |o| o.show }
- @alpha_anim ||= AlphaAnimator.new(2, @img, @label)
+ @alpha_anim ||= AlphaAnimator.new(2, self)
@alpha_anim.on_finished { @alpha_anim = nil }
end
- def on_hide
+ def smart_hide
@objects.each { |o| o.hide }
@alpha_anim && @alpha_anim.delete
@alpha_anim = nil
end
- def on_delete
+ def smart_delete
@objects.each { |o| o.delete }
@objects.clear
@img = @label = @alpha_anim = nil
end
- def on_move(x, y)
+ def smart_move(x, y)
@objects.each { |o| o.move(x, y) }
@label.center(self)
end
- def on_resize(w, h)
+ def smart_resize(w, h)
@img.resize(w, h)
end
+
+ def smart_color_set(r, g, b, a)
+ @objects.each { |o| o.alpha = a }
+ end
end
class Container < Evas::Smart
super
@bg = Evas::Rectangle.new(evas)
- @bg.set_color(0, 0, 0, 255)
+ @bg.set_color(0, 0, 0, 8)
add_member(@bg)
end
# smart callbacks
- def on_show
+ def smart_show
@bg.show
end
- def on_hide
+ def smart_hide
@bg.hide
end
- def on_delete
+ def smart_delete
@bg.delete
@bg = nil
end
- def on_move(x, y)
+ def smart_move(x, y)
@bg.move(x, y)
end
- def on_resize(w, h)
+ def smart_resize(w, h)
@bg.resize(w, h)
end
def initialize
super
+ self.has_alpha = true
self.title = "Embrace"
self.borderless = true