Ejemplo n.º 1
0
        public static CellViewBackend CreateCellRenderer(ApplicationContext actx, Widget widget, ICellRendererTarget col, object target, ICellViewFrontend view)
        {
            CellViewBackend crd;

            if (view is ITextCellViewFrontend)
            {
                crd = new CustomCellRendererText();
            }
            else if (view is ICheckBoxCellViewFrontend || view is IRadioButtonCellViewFrontend)
            {
                crd = new CustomCellRendererToggle();
            }
            else if (view is IImageCellViewFrontend)
            {
                crd = new CustomCellRendererImage();
            }
            else if (view is ICanvasCellViewFrontend)
            {
                crd = new CustomCellRenderer();
            }
            else if (view is IComboBoxCellViewFrontend)
            {
                crd = new CustomCellRendererComboBox();
            }
            else
            {
                throw new NotSupportedException("Unknown cell view type: " + view.GetType());
            }

            crd.Initialize(view, col, target);
            col.PackStart(target, crd.CellRenderer, view.Expands);
            col.SetCellDataFunc(target, crd.CellRenderer, (cellLayout, cell, treeModel, iter) => crd.LoadData(treeModel, iter));
            view.AttachBackend(widget, crd);
            return(crd);
        }
Ejemplo n.º 2
0
Archivo: CellUtil.cs Proyecto: mono/xwt
        public static CellViewBackend CreateCellRenderer(ApplicationContext actx, Widget widget, ICellRendererTarget col, object target, ICellViewFrontend view)
        {
            CellViewBackend crd;

            if (view is ITextCellViewFrontend) {
                crd = new CustomCellRendererText ();
            }
            else if (view is ICheckBoxCellViewFrontend) {
                crd = new CustomCellRendererToggle ();
            }
            else if (view is IImageCellViewFrontend) {
                crd = new CustomCellRendererImage ();
            }
            else if (view is ICanvasCellViewFrontend) {
                crd = new CustomCellRenderer ();
            }
            else if (view is IComboBoxCellViewFrontend) {
                crd = new CustomCellRendererComboBox ();
            } else
                throw new NotSupportedException ("Unknown cell view type: " + view.GetType ());

            crd.Initialize (view, col, target);
            col.PackStart (target, crd.CellRenderer, false);
            col.SetCellDataFunc (target, crd.CellRenderer, (cellLayout, cell, treeModel, iter) => crd.LoadData (treeModel, iter));
            view.AttachBackend (widget, crd);
            return crd;
        }