2639cce5da48faf2daeb81e4e1687795bde3f5f5
[multipass-eu.git] / src / playlist-buttons.rb
1 # $Id: playlist-buttons.rb 24 2005-05-28 20:11:03Z tilman $
2
3 c = EDJE.collection("playlist")
4 root = c.part("root")
5 right = c.part("playlist.background.titlebar.right")
6
7 buttons = []
8
9 h = {"playlist.button.close" => ["close", [right, -10, 5]],
10      "playlist.button.switch" => [nil, [right, -30, 5]],
11      "playlist.button.system" => [nil, [root, 5, 5]]}
12 h.each do |name, (sig, (rel, x, y))|
13         args = [c, name, rel, image_from_name(name), x, y]
14         args << sig unless sig.nil?
15
16         buttons << (sig.nil? ? Button : SignalButton).new(*args).part
17 end
18
19 c.part("playlist.buttons.top.clip", :rect) do |p|
20         p.description do |d|
21                 d.rel[0].set_to(c.part("playlist.background.titlebar.left"))
22                 d.rel[1].set_to(c.part("playlist.background.titlebar.right"))
23         end
24
25         buttons.each { |b| b.clip = p }
26 end
27
28 buttons.clear
29
30 root = c.part("playlist.background.footer.left")
31
32 h = {"playlist.button.add" => ["file_dialog.open", [5, 5]],
33      "playlist.button.rem" => ["playlist_item.remove", [35, 5]],
34      "playlist.button.sel" => [nil, [65, 5]],
35      "playlist.button.misc" => [nil, [95, 5]]}
36 h.each do |name, (sig, (x, y))|
37         args = [c, name, root, nil, x, y]
38         args << sig unless sig.nil?
39
40         md = name.match(/playlist.button\.(.*)$/)
41         args[3] = "button-pl-" + md.captures.first.gsub(".", "-")
42
43         buttons << (sig.nil? ? Button : SignalButton).new(*args).part
44 end
45
46 c.part("playlist.buttons.footer.clip", :rect) do |p|
47         p.description do |d|
48                 d.rel[0].set_to(c.part("playlist.background.footer.left"))
49                 d.rel[1].set_to(c.part("playlist.background.footer.right"))
50         end
51
52         buttons.each { |b| b.clip = p }
53 end