~ubuntu-branches/debian/jessie/banshee-community-extensions/jessie

« back to all changes in this revision

Viewing changes to src/ClutterFlow/ClutterFlow/ClutterSliderHandleButton.cs

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2011-09-20 18:45:46 UTC
  • mfrom: (1.2.9 upstream) (5.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20110920184546-3ahue2qplydc4t0e
Tags: 2.2.0-1
* [4940fab] Imported Upstream version 2.2.0
  + Notable bug fixes:
    - Karaoke: Fix crash when switching to Now Playing
    - Lyrics: Fix crash when switching to Now Playing

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
namespace ClutterFlow.Buttons
33
33
{
34
 
        
35
 
        public class ClutterSliderHandleButton : ClutterButton
36
 
        {
37
 
                protected Clutter.Text label;
38
 
                public string Label {
39
 
                        get { return label.Value; }
40
 
                        set {
41
 
                                if (value!=label.Value) {
42
 
                                        label.Value = value;
43
 
                                        Update ();
44
 
                                }
45
 
                        }
46
 
                }
47
 
                
48
 
                public ClutterSliderHandleButton(uint width, uint height, int state) : base(width, height, state) {
49
 
                        label = new Text("Sans Bold 10", "", new Clutter.Color(0.0f,0.0f,0.0f,0.8f));
50
 
                        Add (label);
51
 
                        label.SetAnchorPoint (label.Width*0.5f, label.Height*0.5f);
52
 
                        label.SetPosition (this.Width*0.5f,this.Height*0.5f);
53
 
                        label.ShowAll();
54
 
                }
55
 
 
56
 
                public override void Update ()
57
 
                {
58
 
                        base.Update ();
59
 
                        label.SetAnchorPoint (label.Width*0.5f, label.Height*0.5f);
60
 
                        label.SetPosition (this.Width*0.5f,this.Height*0.5f);
61
 
                        label.ShowAll ();
62
 
                }
63
 
 
64
 
                
65
 
                protected override void CreateTexture (Clutter.CairoTexture texture, int with_state) {
66
 
                        texture.Clear();
67
 
                        Cairo.Context context = texture.Create();
68
 
                        
69
 
                        context.Translate(texture.Width*0.5,texture.Height*0.5);
70
 
                        context.Arc(0,0,(texture.Height-1)*0.5,0,2*Math.PI);
71
 
                        context.ClosePath();
72
 
                        context.SetSourceRGBA(1.0,1.0,1.0, with_state==0 ? 0.3 : (with_state==1 ? 0.5 : 0.7));
73
 
                        context.FillPreserve();
74
 
                        context.SetSourceRGB(1.0,1.0,1.0);
75
 
                        context.LineWidth = 1;
76
 
                        context.Stroke();
77
 
                        
78
 
                        ((IDisposable) context.Target).Dispose();
79
 
                        ((IDisposable) context).Dispose();
80
 
                }
81
 
        }
 
34
 
 
35
    public class ClutterSliderHandleButton : ClutterButton
 
36
    {
 
37
        protected Clutter.Text label;
 
38
        public string Label {
 
39
            get { return label.Value; }
 
40
            set {
 
41
                if (value!=label.Value) {
 
42
                    label.Value = value;
 
43
                    Update ();
 
44
                }
 
45
            }
 
46
        }
 
47
 
 
48
        public ClutterSliderHandleButton(uint width, uint height, int state) : base(width, height, state) {
 
49
            label = new Text("Sans Bold 10", "", new Clutter.Color(0.0f,0.0f,0.0f,0.8f));
 
50
            Add (label);
 
51
            label.SetAnchorPoint (label.Width*0.5f, label.Height*0.5f);
 
52
            label.SetPosition (this.Width*0.5f,this.Height*0.5f);
 
53
            label.ShowAll();
 
54
        }
 
55
 
 
56
        public override void Update ()
 
57
        {
 
58
            base.Update ();
 
59
            label.SetAnchorPoint (label.Width*0.5f, label.Height*0.5f);
 
60
            label.SetPosition (this.Width*0.5f,this.Height*0.5f);
 
61
            label.ShowAll ();
 
62
        }
 
63
 
 
64
 
 
65
        protected override void CreateTexture (Clutter.CairoTexture texture, int with_state) {
 
66
            texture.Clear();
 
67
            Cairo.Context context = texture.Create ();
 
68
 
 
69
            context.Translate(texture.Width*0.5,texture.Height*0.5);
 
70
            context.Arc(0,0,(texture.Height-1)*0.5,0,2*Math.PI);
 
71
            context.ClosePath();
 
72
            context.SetSourceRGBA(1.0,1.0,1.0, with_state==0 ? 0.3 : (with_state==1 ? 0.5 : 0.7));
 
73
            context.FillPreserve();
 
74
            context.SetSourceRGB(1.0,1.0,1.0);
 
75
            context.LineWidth = 1;
 
76
            context.Stroke();
 
77
 
 
78
            ((IDisposable) context.Target).Dispose();
 
79
            ((IDisposable) context).Dispose();
 
80
        }
 
81
    }
82
82
}
 
 
b'\\ No newline at end of file'