Exemplo n.º 1
0
 void MapTitle(ListViewColumn col, Gtk.TreeViewColumn tc)
 {
     if (col.HeaderView == null)
     {
         tc.Title = col.Title;
     }
     else
     {
         tc.Widget = CellUtil.CreateCellRenderer(ApplicationContext, col.HeaderView);
         tc.Widget?.Show();
     }
 }
Exemplo n.º 2
0
        void HandleEdited(object o, EditedArgs args)
        {
            SetCurrentEventRow();
            var view = (ITextCellViewFrontend)Frontend;

            if (!view.RaiseTextChanged() && view.TextField != null)
            {
                Gtk.TreeIter iter;
                if (TreeModel.GetIterFromString(out iter, args.Path))
                {
                    CellUtil.SetModelValue(TreeModel, iter, view.TextField.Index, view.TextField.FieldType, args.NewText);
                }
            }
        }
Exemplo n.º 3
0
        protected override void OnToggled(string path)
        {
            CellUtil.SetCurrentEventRow(treeBackend, path);

            IDataField field = (IDataField)view.StateField ?? view.ActiveField;

            if (!view.RaiseToggled() && (field != null))
            {
                Type type = field.FieldType;

                Gtk.TreeIter iter;
                if (treeModel.GetIterFromString(out iter, path))
                {
                    CheckBoxState newState;

                    if (view.AllowMixed && type == typeof(CheckBoxState))
                    {
                        if (Inconsistent)
                        {
                            newState = CheckBoxState.Off;
                        }
                        else if (Active)
                        {
                            newState = CheckBoxState.Mixed;
                        }
                        else
                        {
                            newState = CheckBoxState.On;
                        }
                    }
                    else
                    {
                        if (Active)
                        {
                            newState = CheckBoxState.Off;
                        }
                        else
                        {
                            newState = CheckBoxState.On;
                        }
                    }

                    object newValue = type == typeof(CheckBoxState) ?
                                      (object)newState : (object)(newState == CheckBoxState.On);

                    CellUtil.SetModelValue(treeModel, iter, field.Index, type, newValue);
                }
            }
            base.OnToggled(path);
        }
        void HandleToggled(object o, ToggledArgs args)
        {
            SetCurrentEventRow();

            var        view  = (IToggleCellViewFrontend)Frontend;
            IDataField field = (IDataField)(view as ICheckBoxCellViewFrontend)?.StateField ?? view.ActiveField;

            if (!view.RaiseToggled() && (field != null))
            {
                Type type = field.FieldType;

                Gtk.TreeIter iter;
                if (TreeModel.GetIterFromString(out iter, args.Path))
                {
                    CheckBoxState newState;

                    if (type == typeof(CheckBoxState) && ((ICheckBoxCellViewFrontend)view).AllowMixed)
                    {
                        if (renderer.Inconsistent)
                        {
                            newState = CheckBoxState.Off;
                        }
                        else if (renderer.Active)
                        {
                            newState = CheckBoxState.Mixed;
                        }
                        else
                        {
                            newState = CheckBoxState.On;
                        }
                    }
                    else
                    {
                        if (renderer.Active)
                        {
                            newState = CheckBoxState.Off;
                        }
                        else
                        {
                            newState = CheckBoxState.On;
                        }
                    }

                    object newValue = type == typeof(CheckBoxState) ?
                                      (object)newState : (object)(newState == CheckBoxState.On);

                    CellUtil.SetModelValue(TreeModel, iter, field.Index, type, newValue);
                }
            }
        }
Exemplo n.º 5
0
        protected override void OnEdited(string path, string new_text)
        {
            CellUtil.SetCurrentEventRow(treeBackend, path);

            if (!view.RaiseTextChanged() && view.TextField != null)
            {
                Gtk.TreeIter iter;
                if (treeModel.GetIterFromString(out iter, path))
                {
                    CellUtil.SetModelValue(treeModel, iter, view.TextField.Index, view.TextField.FieldType, new_text);
                }
            }
            base.OnEdited(path, new_text);
        }
Exemplo n.º 6
0
 void MapColumn(ListViewColumn col, Gtk.TreeViewColumn tc)
 {
     foreach (var k in cellViews.Where(e => e.Value.Column == tc).Select(e => e.Key).ToArray())
     {
         cellViews.Remove(k);
     }
     foreach (var v in col.Views)
     {
         var r = CellUtil.CreateCellRenderer(ApplicationContext, Frontend, this, tc, v);
         cellViews [v] = new CellInfo {
             Column   = tc,
             Renderer = r
         };
     }
 }
Exemplo n.º 7
0
 public object GetValue(Gtk.TreeIter it, int column)
 {
     return(CellUtil.GetModelValue(Store, it, column));
 }
Exemplo n.º 8
0
 public void SetValue(Gtk.TreeIter it, int column, object value)
 {
     CellUtil.SetModelValue(Store, it, column, ColumnTypes [column], value);
 }
Exemplo n.º 9
0
 public object GetValue(IDataField field)
 {
     return(CellUtil.GetModelValue(TreeModel, CurrentIter, field.Index));
 }
Exemplo n.º 10
0
 object ICellDataSource.GetValue(IDataField field)
 {
     return(CellUtil.GetModelValue(treeModel, iter, field.Index));
 }