~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric-updates

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.GtkCore/libstetic/editor/IconSelectorMenuItem.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-18 08:40:51 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090218084051-gh8m6ukvokbwj7cf
Tags: 1.9.2+dfsg-1ubuntu1
* Merge from Debian Experimental (LP: #330519), remaining Ubuntu changes:
  + debian/control:
    - Update for Gnome# 2.24
    - Add libmono-cairo1.0-cil to build-deps to fool pkg-config check

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
using System;
 
3
 
 
4
namespace Stetic.Editor
 
5
{
 
6
        public class IconSelectorMenuItem: Gtk.MenuItem
 
7
        {
 
8
                IconSelectorItem selector;
 
9
                
 
10
                public event IconEventHandler IconSelected;
 
11
                
 
12
                public IconSelectorMenuItem (IconSelectorItem item)
 
13
                {
 
14
                        selector = item;
 
15
                        Add (selector);
 
16
                }
 
17
                
 
18
                protected override bool OnButtonPressEvent (Gdk.EventButton ev)
 
19
                {
 
20
                        if (IconSelected != null)
 
21
                                IconSelected (this, new IconEventArgs (selector.SelectedIcon));
 
22
                        selector.Destroy ();
 
23
                        return base.OnButtonPressEvent (ev);
 
24
                }
 
25
                
 
26
                protected override bool OnEnterNotifyEvent (Gdk.EventCrossing ev)
 
27
                {
 
28
                        return true;
 
29
                }
 
30
                
 
31
                protected override bool OnLeaveNotifyEvent (Gdk.EventCrossing ev)
 
32
                {
 
33
                        selector.ProcessLeaveNotifyEvent (ev);
 
34
                        return true;
 
35
                }
 
36
                
 
37
                protected override bool OnMotionNotifyEvent (Gdk.EventMotion ev)
 
38
                {
 
39
                        selector.ProcessMotionEvent ((int)ev.X - selector.Allocation.X + Allocation.X, (int)ev.Y - selector.Allocation.Y + Allocation.Y);
 
40
                        return true;
 
41
                }
 
42
        }
 
43
        
 
44
        public delegate void IconEventHandler (object s, IconEventArgs args);
 
45
        
 
46
        public class IconEventArgs: EventArgs
 
47
        {
 
48
                string iconId;
 
49
                
 
50
                public IconEventArgs (string iconId)
 
51
                {
 
52
                        this.iconId = iconId;
 
53
                }
 
54
                
 
55
                public string IconId {
 
56
                        get { return iconId; }
 
57
                }
 
58
        }
 
59
}