1 # $Id: slider.rb 1 2005-04-19 09:41:42Z tilman $
4 def initialize(c, name, rel, x, y, height = 95)
9 c.part("#{name}.background", :image) do |p|
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)
18 d.image = "images/background-fillbar-vertical.png"
22 c.part("#{name}.clip", :rect) do |p|
26 p.description.rel[1].to = background
29 c.part("#{name}.trough", :rect) do |p|
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)
39 c.part(name, :image) do |p|
41 clip.description.rel[0].to = p
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")
48 ["normal", "hover", "down"].each do |state|
49 s = state == "normal" ? "default" : state
50 p.description(s) do |d|
52 d.image = "images/slider-grip-#{state}.png"
57 c.part("#{name}.led", :image) do |p|
58 p.repeat_events = true
64 d.rel[0].to = d.rel[1].to = main
67 d.image = "images/slider-grip-led.png"
70 p.description("visible") do |d|
74 d.rel[0].to = d.rel[1].to = main
77 d.image = "images/slider-grip-led.png"
81 c.program("#{name}.led.show", :set_state) do |p|
82 p.signal ="mouse,down,1"
87 p.targets << ProgramTarget.new(c.part("#{name}.led"))
90 c.program("#{name}.led.hide", :set_state) do |p|
91 p.signal = "mouse,up,1"
96 p.targets << ProgramTarget.new(c.part("#{name}.led"))