3
// Copyright (C) 2008 GNOME Do
5
// This program is free software: you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation, either version 3 of the License, or
8
// (at your option) any later version.
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
15
// You should have received a copy of the GNU General Public License
16
// along with this program. If not, see <http://www.gnu.org/licenses/>.
25
using Do.Interface.CairoUtils;
27
using Docky.Utilities;
29
namespace Docky.Interface
31
public class SeparatorItem : AbstractDockItem
34
#region IDockItem implementation
36
public override int Width {
37
get { return (int) (DockPreferences.IconSize * .3); }
40
public override ScalingType ScalingType {
42
return ScalingType.None;
49
public SeparatorItem ()
51
AnimationType = ClickAnimationType.None;
52
DockPreferences.IconSizeChanged += HandleIconSizeChanged;
55
void HandleIconSizeChanged ()
62
public override Surface GetIconSurface (Surface buffer, int targetSize, out int actualSize)
64
actualSize = DockPreferences.IconSize;
66
sr = buffer.CreateSimilar (Cairo.Content.ColorAlpha, Width, Height);
67
Context cr = new Context (sr);
72
cr.MoveTo (Width / 2 - .5, 0);
73
cr.LineTo (Width / 2 - .5, Height);
74
RadialGradient rg = new RadialGradient (Width / 2, Height / 2, 0, Width / 2, Height / 2, Height / 2);
75
rg.AddColorStop (0, new Cairo.Color (1, 1, 1, .4));
76
rg.AddColorStop (0.3, new Cairo.Color (1, 1, 1, .4));
77
rg.AddColorStop (1, new Cairo.Color (1, 1, 1, 0));
83
cr.MoveTo (Width / 2 + .5, 0);
84
cr.LineTo (Width / 2 + .5, Height);
85
rg = new RadialGradient (Width / 2, Height / 2, 0, Width / 2, Height / 2, Height / 2);
86
rg.AddColorStop (0, new Cairo.Color (0, 0, 0, .5));
87
rg.AddColorStop (0.3, new Cairo.Color (0, 0, 0, .5));
88
rg.AddColorStop (1, new Cairo.Color (0, 0, 0, 0));
94
(cr as IDisposable).Dispose ();
99
public override void Scrolled (Gdk.ScrollDirection direction)
101
base.Scrolled (direction);
103
if (direction == Gdk.ScrollDirection.Up)
104
DockPreferences.IconSize += 1;
105
else if (direction == Gdk.ScrollDirection.Down)
106
DockPreferences.IconSize -= 1;
109
#region IDisposable implementation
111
public override void Dispose ()
113
DockPreferences.IconSizeChanged -= HandleIconSizeChanged;
122
public override bool Equals (AbstractDockItem other)
126
return object.ReferenceEquals (this, other);