Example #1
0
 void HandleActivated(object sender, EventArgs e)
 {
     if (cellView.Editable && !cellView.RaiseToggled() && cellView.ActiveField != null)
     {
         CellContainer.SetValue(cellView.ActiveField, State != NSCellStateValue.Off);
     }
 }
Example #2
0
 protected override void OnToggled(string path)
 {
     if (!view.RaiseToggled() && view.ActiveField != null)
     {
         Gtk.TreeIter iter;
         if (treeModel.GetIterFromString(out iter, path))
         {
             CellUtil.SetModelValue(treeModel, iter, view.ActiveField.Index, view.ActiveField.FieldType, !Active);
         }
     }
     base.OnToggled(path);
 }
Example #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);
        }