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
		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
				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;
		}
Ejemplo n.º 3
0
 public static Gtk.CellRenderer CreateCellRenderer(ApplicationContext actx, ICellRendererTarget col, object target, ICellViewFrontend view, Gtk.TreeModel model)
 {
     if (view is ITextCellViewFrontend)
     {
         var cr = new CustomCellRendererText((ITextCellViewFrontend)view);
         col.PackStart(target, cr, false);
         col.SetCellDataFunc(target, cr, (cell_layout, cell, treeModel, iter) => cr.LoadData(treeModel, iter));
         return(cr);
     }
     else if (view is ICheckBoxCellViewFrontend)
     {
         CustomCellRendererToggle cr = new CustomCellRendererToggle((ICheckBoxCellViewFrontend)view);
         col.PackStart(target, cr, false);
         col.SetCellDataFunc(target, cr, (cellLayout, cell, treeModel, iter) => cr.LoadData(treeModel, iter));
         return(cr);
     }
     else if (view is IImageCellViewFrontend)
     {
         CustomCellRendererImage cr = new CustomCellRendererImage(actx, (IImageCellViewFrontend)view);
         col.PackStart(target, cr, false);
         col.SetCellDataFunc(target, cr, (cellLayout, cell, treeModel, iter) => cr.LoadData(treeModel, iter));
         return(cr);
     }
     else if (view is ICanvasCellViewFrontend)
     {
         var cr = new CustomCellRenderer((ICanvasCellViewFrontend)view);
         col.PackStart(target, cr, false);
         col.SetCellDataFunc(target, cr, (cellLayout, cell, treeModel, iter) => cr.LoadData(treeModel, iter));
         return(cr);
     }
     throw new NotSupportedException("Unknown cell view type: " + view.GetType());
 }
Ejemplo n.º 4
0
 public static Gtk.CellRenderer CreateCellRenderer(ApplicationContext actx, ICellRendererTarget col, object target, ICellViewFrontend view, Gtk.TreeModel model)
 {
     if (view is ITextCellViewFrontend) {
         var cr = new CustomCellRendererText ((ITextCellViewFrontend)view);
         col.PackStart (target, cr, false);
         col.SetCellDataFunc (target, cr, (cell_layout, cell, treeModel, iter) => cr.LoadData (treeModel, iter));
         return cr;
     }
     else if (view is ICheckBoxCellViewFrontend) {
         CustomCellRendererToggle cr = new CustomCellRendererToggle ((ICheckBoxCellViewFrontend)view);
         col.PackStart (target, cr, false);
         col.SetCellDataFunc (target, cr, (cellLayout, cell, treeModel, iter) => cr.LoadData (treeModel, iter));
         return cr;
     }
     else if (view is IImageCellViewFrontend) {
         CustomCellRendererImage cr = new CustomCellRendererImage (actx, (IImageCellViewFrontend)view);
         col.PackStart (target, cr, false);
         col.SetCellDataFunc (target, cr, (cellLayout, cell, treeModel, iter) => cr.LoadData (treeModel, iter));
         return cr;
     }
     else if (view is ICanvasCellViewFrontend) {
         var cr = new CustomCellRenderer ((ICanvasCellViewFrontend) view);
         col.PackStart (target, cr, false);
         col.SetCellDataFunc (target, cr, (cellLayout, cell, treeModel, iter) => cr.LoadData (treeModel, iter));
         return cr;
     }
     throw new NotSupportedException ("Unknown cell view type: " + view.GetType ());
 }