Added scrollbar to playlist.
authorTilman Sauerbeck <tilman@code-monkey.de>
Mon, 25 Apr 2005 22:01:53 +0000 (22:01 +0000)
committerTilman Sauerbeck <tilman@code-monkey.de>
Mon, 25 Apr 2005 22:01:53 +0000 (22:01 +0000)
images/scroll-grip-down.png [new file with mode: 0644]
images/scroll-grip-hover.png [new file with mode: 0644]
images/scroll-grip-normal.png [new file with mode: 0644]
src/playlist-background.rb
src/playlist-scrollbar.rb [new file with mode: 0644]
src/playlist.rb

diff --git a/images/scroll-grip-down.png b/images/scroll-grip-down.png
new file mode 100644 (file)
index 0000000..531ed6e
Binary files /dev/null and b/images/scroll-grip-down.png differ
diff --git a/images/scroll-grip-hover.png b/images/scroll-grip-hover.png
new file mode 100644 (file)
index 0000000..f16079e
Binary files /dev/null and b/images/scroll-grip-hover.png differ
diff --git a/images/scroll-grip-normal.png b/images/scroll-grip-normal.png
new file mode 100644 (file)
index 0000000..9b7028f
Binary files /dev/null and b/images/scroll-grip-normal.png differ
index 60c220e99499bd0ab4e474c5f0008b3436aafd89..6226f64f259efdab9d5e4a2b32bcf54e42777c0f 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: playlist-background.rb 15 2005-04-25 21:46:52Z tilman $
+# $Id: playlist-background.rb 16 2005-04-25 22:01:53Z tilman $
 
 c = EDJE.collection("playlist")
 root = c.part("root")
@@ -212,5 +212,8 @@ c.part("playlist.container", :swallow) do |p|
        p.description do |d|
                d.rel[0].set_to(c.part("playlist.background.middle"))
                d.rel[1].set_to(c.part("playlist.background.middle"))
+
+               # leave some space for the scrollbar
+               d.rel[1].set_offset(-19, -1)
        end
 end
diff --git a/src/playlist-scrollbar.rb b/src/playlist-scrollbar.rb
new file mode 100644 (file)
index 0000000..b163706
--- /dev/null
@@ -0,0 +1,42 @@
+# $Id: playlist-scrollbar.rb 16 2005-04-25 22:01:53Z tilman $
+
+c = EDJE.collection("playlist")
+
+c.part("playlist.scrollbar.trough", :rect) do |p|
+       p.description do |d|
+               d.rel[0].set_to(c.part("playlist.container"))
+               d.rel[1].set_to(c.part("playlist.background.middle"))
+
+               d.rel[0].set_rel(1.0, 0.0)
+               d.rel[0].set_offset(5, 0)
+
+               d.color = "#00000000"
+       end
+end
+
+c.part("playlist.scrollbar.handle", :image) do |p|
+       p.dragable.enabled[1] = true
+       p.dragable.step[1] = 1
+       p.dragable.count[1] = 1
+       p.dragable.confine = c.part("playlist.scrollbar.trough")
+
+       ["normal", "hover", "down"].each do |state|
+               s = state == "normal" ? "default" : state
+
+               p.description(s) do |d|
+                       d.set_size(13, 41)
+                       d.image = "images/scroll-grip-#{state}.png"
+               end
+       end
+end
+
+{"in" => "hover", "out" => "default",
+ "down,1" => "down", "up,1" => "hover"}.each do |(ev, state)|
+       c.program("playlist.scrollbar.handle.#{ev}", :set_state) do |p|
+               p.signal = "mouse,#{ev}"
+               p.source = "playlist.scrollbar.handle"
+               p.state = state
+               p.time = 0.1
+               p.targets << ProgramTarget.new(c.part(p.source))
+       end
+end
index bf67b8840323b9b4edca5a66c59299c6d84b834c..3373138f877ecabeaae493e5e6774c55e7ae2586 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: playlist.rb 13 2005-04-24 19:56:20Z tilman $
+# $Id: playlist.rb 16 2005-04-25 22:01:53Z tilman $
 
 EDJE.collection("playlist") do |c|
        c.set_min(300, 250)
@@ -12,4 +12,5 @@ EDJE.collection("playlist") do |c|
 
        load "src/playlist-background.rb"
        load "src/playlist-buttons.rb"
+       load "src/playlist-scrollbar.rb"
 end