Exemplo n.º 1
0
 public CellRendererWidget(InspectorEditorCell cell)
 {
     this.cell     = cell;
     this.obj      = cell.Instance;
     this.property = cell.Inspector;
     em            = cell.EditorManager;
     this.ModifyBg(Gtk.StateType.Normal, this.Style.White);
 }
Exemplo n.º 2
0
        public InspectorDialogueEditor(InspectorEditorCell 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();
        }
Exemplo n.º 3
0
        public InspectorEditorCell GetEditor(PropertyDescriptor pd)
        {
            InspectorEditorCell cell = pd.GetEditor(typeof(InspectorEditorCell)) as InspectorEditorCell;

            if (cell != null)
            {
                return(cell);
            }

            Type editorType = GetEditorType(pd);

            if (editorType == null)
            {
                return(Default);
            }

            if (typeof(IInspectorEditor).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 InspectorEditorCell;
            if (cell != null)
            {
                return(cell);
            }

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

            cell = (InspectorEditorCell)Activator.CreateInstance(editorType);
            cellCache [editorType] = cell;
            return(cell);
        }