Esempio n. 1
0
        public void Initialize(PropertyDescriptor prop)
        {
            if (!prop.PropertyType.IsEnum)
            {
                throw new ApplicationException("Enumeration editor does not support editing values of type " + prop.PropertyType);
            }

            ebox = new Gtk.EventBox();
            ebox.Show();
            PackStart(ebox, true, true, 0);

            combo                     = Gtk.ComboBoxEntry.NewText();
            combo.Changed            += combo_Changed;
            combo.Entry.IsEditable    = false;
            combo.Entry.HasFrame      = false;
            combo.Entry.HeightRequest = combo.SizeRequest().Height;                     // The combo does not set the entry to the correct size when it does not have a frame
            combo.Show();
            ebox.Add(combo);

            tips = new Gtk.Tooltips();

            enm = Registry.LookupEnum(prop.PropertyType.FullName);
            foreach (Enum value in enm.Values)
            {
                combo.AppendText(enm[value].Label);
            }
        }
Esempio n. 2
0
        public void Initialize(EditSession session)
        {
            editSession = session;
            prop        = session.Property;

            ICollection valuesCollection = prop.Converter.GetStandardValues();

            values = new TraceLab.Core.Components.EnumValue[valuesCollection.Count];
            valuesCollection.CopyTo(values, 0);

            //values = System.Enum.GetValues (prop.PropertyType);
            Hashtable names = new Hashtable();

            foreach (FieldInfo f in prop.PropertyType.GetFields())
            {
                DescriptionAttribute att = (DescriptionAttribute)Attribute.GetCustomAttribute(f, typeof(DescriptionAttribute));
                if (att != null)
                {
                    names [f.Name] = att.Description;
                }
                else
                {
                    names [f.Name] = f.Name;
                }
            }


            ebox = new Gtk.EventBox();
            ebox.Show();
            PackStart(ebox, true, true, 0);

            combo                     = Gtk.ComboBoxEntry.NewText();
            combo.Changed            += combo_Changed;
            combo.Entry.IsEditable    = false;
            combo.Entry.CanFocus      = false;
            combo.Entry.HasFrame      = false;
            combo.Entry.HeightRequest = combo.SizeRequest().Height;
            combo.Show();
            ebox.Add(combo);

            foreach (TraceLab.Core.Components.EnumValue value in values)
            {
                string str = prop.Converter.ConvertToString(value);
                if (names.Contains(str))
                {
                    str = (string)names [str];
                }
                combo.AppendText(str);
            }
        }
Esempio n. 3
0
        public void Initialize(EditSession session)
        {
            PropertyDescriptor prop = session.Property;

            if (!prop.PropertyType.IsEnum)
            {
                throw new ApplicationException("Enumeration editor does not support editing values of type " + prop.PropertyType);
            }

            values = System.Enum.GetValues(prop.PropertyType);
            Hashtable names = new Hashtable();

            foreach (FieldInfo f in prop.PropertyType.GetFields())
            {
                DescriptionAttribute att = (DescriptionAttribute)Attribute.GetCustomAttribute(f, typeof(DescriptionAttribute));
                if (att != null)
                {
                    names [f.Name] = att.Description;
                }
                else
                {
                    names [f.Name] = f.Name;
                }
            }


            ebox = new Gtk.EventBox();
            ebox.Show();
            PackStart(ebox, true, true, 0);

            combo                     = Gtk.ComboBoxEntry.NewText();
            combo.Changed            += combo_Changed;
            combo.Entry.IsEditable    = false;
            combo.Entry.CanFocus      = false;
            combo.Entry.HasFrame      = false;
            combo.Entry.HeightRequest = combo.SizeRequest().Height;
            combo.Show();
            ebox.Add(combo);

            foreach (object value in values)
            {
                string str = prop.Converter.ConvertToString(value);
                if (names.Contains(str))
                {
                    str = (string)names [str];
                }
                combo.AppendText(str);
            }
        }
Esempio n. 4
0
        public ResponseIdEditor()
        {
            combo = Gtk.ComboBoxEntry.NewText ();
            combo.Changed += combo_Changed;
            combo.Show ();
            PackStart (combo, true, true, 0);

            entry = combo.Child as Gtk.Entry;
            entry.Changed += entry_Changed;

            enm = Registry.LookupEnum ("Gtk.ResponseType");
            values = new ArrayList ();
            foreach (Enum value in enm.Values) {
                if (enm[value].Label != "") {
                    combo.AppendText (enm[value].Label);
                    values.Add ((int)enm[value].Value);
                }
            }
        }
Esempio n. 5
0
        public ResponseIdEditor()
        {
            combo          = Gtk.ComboBoxEntry.NewText();
            combo.Changed += combo_Changed;
            combo.Show();
            PackStart(combo, true, true, 0);

            entry          = combo.Child as Gtk.Entry;
            entry.Changed += entry_Changed;

            enm    = Registry.LookupEnum("Gtk.ResponseType");
            values = new ArrayList();
            foreach (Enum value in enm.Values)
            {
                if (enm[value].Label != "")
                {
                    combo.AppendText(enm[value].Label);
                    values.Add(Convert.ToInt32(enm[value].Value));
                }
            }
        }
Esempio n. 6
0
		public void Initialize (PropertyDescriptor prop)
		{
			if (!prop.PropertyType.IsEnum)
				throw new ApplicationException ("Enumeration editor does not support editing values of type " + prop.PropertyType);
				
			ebox = new Gtk.EventBox ();
			ebox.Show ();
			PackStart (ebox, true, true, 0);

			combo = Gtk.ComboBoxEntry.NewText ();
			combo.Changed += combo_Changed;
			combo.Entry.IsEditable = false;
			combo.Entry.HasFrame = false;
			combo.Entry.HeightRequest = combo.SizeRequest ().Height;	// The combo does not set the entry to the correct size when it does not have a frame
			combo.Show ();
			ebox.Add (combo);

			enm = Registry.LookupEnum (prop.PropertyType.FullName);
			foreach (Enum value in enm.Values)
				combo.AppendText (enm[value].Label);
		}
        public void Initialize(EditSession session)
        {
            PropertyDescriptor prop = session.Property;

            if (!prop.PropertyType.IsEnum)
                throw new ApplicationException (Catalog.GetString("Enumeration editor does not support editing values of type ") + prop.PropertyType);

            values = System.Enum.GetValues (prop.PropertyType);
            Hashtable names = new Hashtable ();
            foreach (FieldInfo f in prop.PropertyType.GetFields ()) {
                DescriptionAttribute att = (DescriptionAttribute) Attribute.GetCustomAttribute (f, typeof(DescriptionAttribute));
                if (att != null)
                    names [f.Name] = att.Description;
                else
                    names [f.Name] = f.Name;
            }

            ebox = new Gtk.EventBox ();
            ebox.Show ();
            PackStart (ebox, true, true, 0);

            combo = Gtk.ComboBoxEntry.NewText ();
            combo.Changed += combo_Changed;
            combo.Entry.IsEditable = false;
            combo.Entry.CanFocus = false;
            combo.Entry.HasFrame = false;
            combo.Entry.HeightRequest = combo.SizeRequest ().Height;
            combo.Show ();
            ebox.Add (combo);

            foreach (object value in values) {
                string str = prop.Converter.ConvertToString (value);
                if (names.Contains (str))
                    str = (string) names [str];
                combo.AppendText (str);
            }
        }
		public void Initialize (EditSession session)
		{
            editSession = session;
            prop = session.Property;
           
            ICollection valuesCollection = prop.Converter.GetStandardValues();
            values = new TraceLab.Core.Components.EnumValue[valuesCollection.Count];
            valuesCollection.CopyTo(values, 0);

			//values = System.Enum.GetValues (prop.PropertyType);
			Hashtable names = new Hashtable ();
			foreach (FieldInfo f in prop.PropertyType.GetFields ()) {
				DescriptionAttribute att = (DescriptionAttribute) Attribute.GetCustomAttribute (f, typeof(DescriptionAttribute));
				if (att != null)
					names [f.Name] = att.Description;
				else
					names [f.Name] = f.Name;
			}
				       
			
			ebox = new Gtk.EventBox ();
			ebox.Show ();
			PackStart (ebox, true, true, 0);

			combo = Gtk.ComboBoxEntry.NewText ();
			combo.Changed += combo_Changed;
			combo.Entry.IsEditable = false;
			combo.Entry.CanFocus = false;
			combo.Entry.HasFrame = false;
			combo.Entry.HeightRequest = combo.SizeRequest ().Height;
			combo.Show ();
			ebox.Add (combo);

            foreach (TraceLab.Core.Components.EnumValue value in values) {
				string str = prop.Converter.ConvertToString (value);
				if (names.Contains (str))
					str = (string) names [str];
				combo.AppendText (str);
			}
		}