Tweaked min size of the playlist edje.
[multipass-eu.git] / src / slider.rb
1 # $Id: slider.rb 1 2005-04-19 09:41:42Z tilman $
2
3 class VerticalSlider
4         def initialize(c, name, rel, x, y, height = 95)
5                 background = nil
6                 clip = nil
7                 main = nil
8
9                 c.part("#{name}.background", :image) do |p|
10                         background = p
11
12                         p.description do |d|
13                                 d.rel[0].to = d.rel[1].to = rel
14                                 d.rel[0].set_offset(x, y)
15                                 d.rel[1].set_rel(0.0, 0.0)
16                                 d.rel[1].set_offset(x + 6, y + height)
17
18                                 d.image = "images/background-fillbar-vertical.png"
19                         end
20                 end
21
22                 c.part("#{name}.clip", :rect) do |p|
23                         background.clip = p
24                         clip = p
25
26                         p.description.rel[1].to = background
27                 end
28
29                 c.part("#{name}.trough", :rect) do |p|
30                         p.description do |d|
31                                 d.color = "#00000000"
32
33                                 d.rel[0].to = d.rel[1].to = background
34                                 d.rel[0].set_offset(3, -3)
35                                 d.rel[1].set_offset(3, 3)
36                         end
37                 end
38
39                 c.part(name, :image) do |p|
40                         main = p
41                         clip.description.rel[0].to = p
42
43                         p.dragable.enabled[1] = true
44                         p.dragable.step[1] = 1
45                         p.dragable.count[1] = 1
46                         p.dragable.confine = c.part("#{name}.trough")
47
48                         ["normal", "hover", "down"].each do |state|
49                                 s = state == "normal" ? "default" : state
50                                 p.description(s) do |d|
51                                         d.set_size(15, 12)
52                                         d.image = "images/slider-grip-#{state}.png"
53                                 end
54                         end
55                 end
56
57                 c.part("#{name}.led", :image) do |p|
58                         p.repeat_events = true
59
60                         p.description do |d|
61                                 d.visible = false
62                                 d.color = "#ffffff00"
63
64                                 d.rel[0].to = d.rel[1].to = main
65
66                                 d.auto_rel = true
67                                 d.image = "images/slider-grip-led.png"
68                         end
69
70                         p.description("visible") do |d|
71                                 d.visible = true
72                                 d.color = "#ffffffff"
73
74                                 d.rel[0].to = d.rel[1].to = main
75
76                                 d.auto_rel = true
77                                 d.image = "images/slider-grip-led.png"
78                         end
79                 end
80
81                 c.program("#{name}.led.show", :set_state) do |p|
82                         p.signal ="mouse,down,1"
83                         p.source = main.name
84                         p.state = "visible"
85                         p.mode = :accelerate
86                         p.time = 0.5
87                         p.targets << ProgramTarget.new(c.part("#{name}.led"))
88                 end
89
90                 c.program("#{name}.led.hide", :set_state) do |p|
91                         p.signal = "mouse,up,1"
92                         p.source = main.name
93                         p.state = "default"
94                         p.mode = :decelerate
95                         p.time = 0.3
96                         p.targets << ProgramTarget.new(c.part("#{name}.led"))
97                 end
98         end
99 end