~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Ide/MonoDevelop.Components/HoverImageButton.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
using System;
30
30
using Gtk;
 
31
using MonoDevelop.Ide;
31
32
 
32
33
namespace MonoDevelop.Components
33
34
{
54
55
 
55
56
        public HoverImageButton()
56
57
        {
 
58
                        Gtk.Alignment al = new Alignment (0.5f, 0.5f, 0f, 0f);
 
59
                        al.Show ();
57
60
            CanFocus = true;
58
 
 
 
61
                        VisibleWindow = false;
59
62
            image = new Image();
60
63
            image.Show();
61
 
            Add(image);
 
64
                        al.Add (image);
 
65
            Add(al);
62
66
        }
63
67
 
64
68
        public HoverImageButton(IconSize size, string icon_name) : this(size, new string [] { icon_name })
65
69
        {
66
70
        }
67
71
 
68
 
        public HoverImageButton(IconSize size, string [] icon_names) : this()
 
72
        public HoverImageButton(IconSize size, params string [] icon_names) : this()
69
73
        {
70
74
            this.icon_size = size;
71
75
            this.icon_names = icon_names;
102
106
 
103
107
        protected override bool OnLeaveNotifyEvent(Gdk.EventCrossing evnt)
104
108
        {
105
 
            is_hovering = false;
 
109
                        image.GdkWindow.Cursor = null;
 
110
                        is_hovering = false;
106
111
            UpdateImage();
107
112
            return base.OnLeaveNotifyEvent(evnt);
108
113
        }
151
156
        {
152
157
            base.OnExposeEvent(evnt);
153
158
 
154
 
            PropagateExpose(Child, evnt);
155
 
 
156
159
            if(HasFocus && draw_focus) {
157
160
                Style.PaintFocus(Style, GdkWindow, StateType.Normal, evnt.Area, this, "button",
158
161
                    0, 0, Allocation.Width, Allocation.Height);
171
174
        {
172
175
            int width, height;
173
176
            Icon.SizeLookup(icon_size, out width, out height);
174
 
            IconTheme theme = IconTheme.GetForScreen(Screen);
175
177
 
176
178
            if(normal_pixbuf != null) {
177
179
                normal_pixbuf.Dispose();
185
187
 
186
188
            for(int i = 0; i < icon_names.Length; i++) {
187
189
                try {
188
 
                    normal_pixbuf = RenderIcon(icon_names[i], icon_size, null)
189
 
                        ?? theme.LoadIcon(icon_names[i], width, 0);
190
 
                    active_pixbuf = ColorShiftPixbuf(normal_pixbuf, 30);
 
190
                                        normal_pixbuf = ImageService.GetPixbuf (icon_names[i], icon_size);
 
191
                                        active_pixbuf = ColorShiftPixbuf(normal_pixbuf, 30);
191
192
                    break;
192
193
                } catch {
193
194
                }
223
224
                byte *dest_pixels = dest_pixels_orig + i * dest.Rowstride;
224
225
 
225
226
                for(int j = 0; j < src.Width; j++) {
226
 
                    *(dest_pixels++) = PixelClamp(*(src_pixels++) + shift);
227
 
                    *(dest_pixels++) = PixelClamp(*(src_pixels++) + shift);
228
 
                    *(dest_pixels++) = PixelClamp(*(src_pixels++) + shift);
 
227
                    *(dest_pixels++) = PixelClamp(*(src_pixels++) - shift);
 
228
                    *(dest_pixels++) = PixelClamp(*(src_pixels++) - shift);
 
229
                    *(dest_pixels++) = PixelClamp(*(src_pixels++) - shift);
229
230
 
230
231
                    if(src.HasAlpha) {
231
232
                        *(dest_pixels++) = *(src_pixels++);