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

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.GtkCore/lib/stetic/libstetic/editor/Char.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
 
using System;
2
 
 
3
 
namespace Stetic.Editor {
4
 
 
5
 
        public class Char : Gtk.Entry, IPropertyEditor {
6
 
 
7
 
                public Char ()
8
 
                {
9
 
                        MaxLength = 1;
10
 
                }
11
 
 
12
 
                public void Initialize (PropertyDescriptor descriptor)
13
 
                {
14
 
                        if (descriptor.PropertyType != typeof(char))
15
 
                                throw new ApplicationException ("Char editor does not support editing values of type " + descriptor.PropertyType);
16
 
                }
17
 
                
18
 
                public void AttachObject (object obj)
19
 
                {
20
 
                }
21
 
                
22
 
                char last;
23
 
 
24
 
                public object Value {
25
 
                        get {
26
 
                                if (Text.Length == 0)
27
 
                                        return last;
28
 
                                else
29
 
                                        return Text[0];
30
 
                        }
31
 
                        set {
32
 
                                Text = value.ToString ();
33
 
                                last = (char) value;
34
 
                        }
35
 
                }
36
 
 
37
 
                protected override void OnChanged ()
38
 
                {
39
 
                        if (ValueChanged != null)
40
 
                                ValueChanged (this, EventArgs.Empty);
41
 
                }
42
 
 
43
 
                public event EventHandler ValueChanged;
44
 
        }
45
 
}