public PropertyEditorCell GetEditor (PropertyDescriptor pd)
		{
			PropertyEditorCell cell = pd.GetEditor (typeof(PropertyEditorCell)) as PropertyEditorCell;
			if (cell != null)
				return cell;
			
			Type editorType = GetEditorType (pd);
			if (editorType == null)
				return Default;
			
			if (typeof(IPropertyEditor).IsAssignableFrom (editorType)) {
				if (!typeof(Gtk.Widget).IsAssignableFrom (editorType))
					throw new Exception ("The property editor '" + editorType + "' must be a Gtk Widget");
				return Default;
			}

			cell = cellCache [editorType] as PropertyEditorCell;
			if (cell != null)
				return cell;

			if (!typeof(PropertyEditorCell).IsAssignableFrom (editorType))
				throw new Exception ("The property editor '" + editorType + "' must be a subclass of Stetic.PropertyEditorCell or implement Stetic.IPropertyEditor");

			cell = (PropertyEditorCell) Activator.CreateInstance (editorType);
			cellCache [editorType] = cell;
			return cell;
		}
Esempio n. 2
0
 public CellRendererWidget(PropertyEditorCell cell)
 {
     this.cell     = cell;
     this.obj      = cell.Instance;
     this.property = cell.Property;
     em            = cell.EditorManager;
     this.ModifyBg(Gtk.StateType.Normal, this.Style.White);
 }
Esempio n. 3
0
        public PropertyDialogueEditor(PropertyEditorCell cell)
        {
            this.cell = cell;
            Spacing   = 3;
            PackStart(new CellRendererWidget(cell), true, true, 0);
            Label buttonLabel = new Label();

            buttonLabel.UseMarkup = true;
            buttonLabel.Xpad      = 0; buttonLabel.Ypad = 0;
            buttonLabel.Markup    = "<span size=\"small\">...</span>";
            Button dialogueButton = new Button(buttonLabel);

            dialogueButton.Clicked += new EventHandler(DialogueButtonClicked);
            PackStart(dialogueButton, false, false, 0);
            this.ModifyBg(Gtk.StateType.Normal, this.Style.White);
            ShowAll();
        }
        public void SetData(object instance, PropertyDescriptor property, PropertyEditorCell editor)
        {
            this.instance = instance;
            this.property = property;
            if (property == null)
            {
                this.CellBackgroundGdk = tree.Style.MidColors [(int)Gtk.StateType.Normal];
                sensitive = true;
            }
            else
            {
                this.CellBackground = null;
                sensitive           = !property.IsReadOnly || (editor != null && editor.EditsReadOnlyObject);
            }

            editorCell = editor;
        }
        void PropertyData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CellRendererProperty rc = (CellRendererProperty)cell;
            bool group = (bool)model.GetValue(iter, 2);

            if (group)
            {
                rc.SetData(null, null, null);
            }
            else
            {
                PropertyDescriptor prop     = (PropertyDescriptor)model.GetValue(iter, 1);
                PropertyEditorCell propCell = editorManager.GetEditor(prop);
                InstanceData       idata    = (InstanceData)model.GetValue(iter, 3);
                propCell.Initialize(tree, editorManager, prop, idata.Instance);
                rc.SetData(idata.Instance, prop, propCell);
            }
        }
        public void SetData(object instance, PropertyDescriptor property, PropertyEditorCell editor)
        {
            this.instance = instance;
            this.property = property;
            if (property == null) {
                this.CellBackgroundGdk = tree.Style.MidColors [(int) Gtk.StateType.Normal];
                sensitive = true;
            }
            else {
                this.CellBackground = null;
                sensitive = !property.IsReadOnly || (editor != null && editor.EditsReadOnlyObject);
            }

            editorCell = editor;
        }
 public PropertyDialogueEditor(PropertyEditorCell cell)
 {
     this.cell = cell;
     Spacing = 3;
     PackStart (new CellRendererWidget (cell), true, true, 0);
     Label buttonLabel = new Label ();
     buttonLabel.UseMarkup = true;
     buttonLabel.Xpad = 0; buttonLabel.Ypad = 0;
     buttonLabel.Markup = "<span size=\"small\">...</span>";
     Button dialogueButton = new Button (buttonLabel);
     dialogueButton.Clicked += new EventHandler (DialogueButtonClicked);
     PackStart (dialogueButton, false, false, 0);
     this.ModifyBg (Gtk.StateType.Normal, this.Style.White);
     ShowAll ();
 }
 public CellRendererWidget(PropertyEditorCell cell)
 {
     this.cell = cell;
     this.obj = cell.Instance;
     this.property = cell.Property;
     em = cell.EditorManager;
     this.ModifyBg (Gtk.StateType.Normal, this.Style.White);
 }