-# $Id: playlist_item.rb 8 2005-04-24 10:49:53Z tilman $
+# $Id: playlist_item.rb 9 2005-04-24 15:44:54Z tilman $
+
+TEXT_COLOR_HILIGHT = "#f0fafd"
EDJE.collection("playlist_item") do |c|
c.set_size(150, 10)
- c.part("title", :text) do |p|
- p.effect = :outline
+ ["title", "length"].each do |name|
+ c.part(name, :text) do |p|
+ p.effect = :outline
- p.description do |d|
- d.color = TEXT_COLOR
- d.outline_color = OUTLINE_COLOR
+ {"default" => TEXT_COLOR,
+ "selected" => TEXT_COLOR_HILIGHT}.each do |(state, color)|
+ p.description(state) do |d|
+ d.color = color
+ d.outline_color = OUTLINE_COLOR
- d.font = "fonts/acknowledge2.ttf"
- d.font_size = 12
- d.text = "Dark Tranquillity - Through Smudged Lenses"
- d.set_text_align(0.0)
+ d.font = "fonts/acknowledge2.ttf"
+ d.font_size = 12
+ d.text = "Dark Tranquillity - Through Smudged Lenses"
+ d.set_text_align(0.0)
+ end
+ end
end
end
- c.part("length", :text) do |p|
- p.effect = :outline
-
- p.description do |d|
- d.color = TEXT_COLOR
- d.outline_color = OUTLINE_COLOR
-
- d.font = "fonts/acknowledge2.ttf"
- d.font_size = 12
+ ["default", "selected"].each do |state|
+ c.part("length").description(state) do |d|
d.text = "04:11"
d.set_text_align(1.0)
end
end
+
+ ["selected", "unselected"].each do |state|
+ c.program("playlist_item.#{state}", :set_state) do |p|
+ p.signal = "PLAYLIST_ITEM_#{state.upcase}"
+ p.state = state == "unselected" ? "default" : state
+ p.mode = state == "selected" ? :accelerate : :decelerate
+ p.time = 0.5
+ p.targets << ProgramTarget.new(c.part("title"))
+ p.targets << ProgramTarget.new(c.part("length"))
+ end
+ end
end