Example #1
0
        private void OnNumbericNodeCellEditingStarted(object o, Gtk.EditingStartedArgs args)
        {
            var cell = o as INodeCellRenderer;

            if (cell != null)
            {
                object obj = YTreeModel.NodeAtPath(new TreePath(args.Path));
                if (cell.DataPropertyInfo != null)
                {
                    object propValue = cell.DataPropertyInfo.GetValue(obj, null);
                    var    spin      = o as CellRendererSpin;
                    if (spin != null)
                    {
                        //WORKAROUND to fix GTK bug that CellRendererSpin start editing only with integer number
                        if (cell.EditingValueConverter == null)
                        {
                            spin.Adjustment.Value = Convert.ToDouble(propValue);
                        }
                        else
                        {
                            spin.Adjustment.Value = (double)cell.EditingValueConverter.Convert(propValue, typeof(double), null, null);
                        }
                    }
                }
            }
        }
 void OnStartEditing(Gtk.EditingStartedArgs args)
 {
     editing   = true;
     editEntry = (Gtk.Entry)args.Editable;
     editEntry.KeyPressEvent += OnEditKeyPress;
     if (StartEditing != null)
     {
         StartEditing(this, EventArgs.Empty);
     }
 }
Example #3
0
        void OnExpEditing(object s, Gtk.EditingStartedArgs args)
        {
            TreeIter it;

            if (!store.GetIterFromString(out it, args.Path))
            {
                return;
            }
            Gtk.Entry e = (Gtk.Entry)args.Editable;
            if (e.Text == createMsg)
            {
                e.Text = string.Empty;
            }
        }
Example #4
0
        void OnLocationEditingStarted(object sender, Gtk.EditingStartedArgs args)
        {
            if (Entity.ProjectRows.Count == 0)
            {
                return;
            }

            var entry      = args.Editable as Entry;
            var completion = new EntryCompletion();
            var list       = new ListStore(typeof(string));

            foreach (var txt in Entity.ProjectRows.Where(x => !String.IsNullOrWhiteSpace(x.Location)).Select(x => x.Location.Trim()).Distinct())
            {
                list.AppendValues(txt);
            }
            completion.Model      = list;
            completion.TextColumn = 0;
            entry.Completion      = completion;
        }
        void OnValueEditing(object s, Gtk.EditingStartedArgs args)
        {
            TreeIter it;

            if (!store.GetIterFromString(out it, args.Path))
            {
                return;
            }

            Gtk.Entry e = (Gtk.Entry)args.Editable;

            ObjectValue val    = store.GetValue(it, ObjectCol) as ObjectValue;
            string      strVal = val.Value;

            if (!string.IsNullOrEmpty(strVal))
            {
                e.Text = strVal;
            }

            e.GrabFocus();
            OnStartEditing(args);
        }
Example #6
0
        void CellRenderer_EditingStarted(object o, EditingStartedArgs args)
        {
            if (!toggled)
                return;

            Gtk.TreeIter iter;
            Gtk.TreePath path = new Gtk.TreePath (args.Path);
            if (!Model.GetIter (out iter, path))
                return;

            Task task = Model.GetValue (iter, 0) as Task;
            if (task == null)
                return;

            taskBeingEdited = task;
            InactivateTimer.ToggleTimer (taskBeingEdited);
        }
		void PropRendererEditingStarted (object o, EditingStartedArgs args)
		{
			try {
				valueStore.Clear ();
	
				TreeIter iter;
				if (!treeStore.GetIterFromString (out iter, args.Path)) 
					return;
				
				var obj = (PObject) treeStore.GetValue (iter, 1);
				var values = PListScheme.AvailableValues (obj, CurrentTree);
				if (values != null) {
					var descr = new List<string> (values.Select (v => ShowDescriptions ? v.Description : v.Identifier));
					descr.Sort ();
					foreach (var val in descr) {
						valueStore.AppendValues (val);
					}
				}
			} catch (Exception ex) {
				GLib.ExceptionManager.RaiseUnhandledException (ex, false);
			}
		}
		void KeyRendererEditingStarted (object o, EditingStartedArgs args)
		{
			try {
				RefreshKeyStore ();
			} catch (Exception ex) {
				GLib.ExceptionManager.RaiseUnhandledException (ex, false);
			}
		}
Example #9
0
 /// <summary>
 /// User is about to edit a cell.
 /// </summary>
 /// <param name="sender">The sender of the event</param>
 /// <param name="e">The event arguments</param>
 private void OnCellBeginEdit(object sender, EditingStartedArgs e)
 {
     this.userEditingCell = true;
     IGridCell where = GetCurrentCell;
     this.valueBeforeEdit = this.DataSource.Rows[where.RowIndex][where.ColumnIndex];
 }
Example #10
0
 /// <summary>
 /// User is about to edit a cell.
 /// </summary>
 /// <param name="sender">The sender of the event</param>
 /// <param name="e">The event arguments</param>
 private void OnCellBeginEdit(object sender, EditingStartedArgs e)
 {
     this.userEditingCell = true;
     IGridCell where = GetCurrentCell;
     if (where.RowIndex >= DataSource.Rows.Count)
     {
         for (int i = DataSource.Rows.Count; i <= where.RowIndex; i++)
         {
             DataRow row = DataSource.NewRow();
             DataSource.Rows.Add(row);
         }
     }
     this.valueBeforeEdit = this.DataSource.Rows[where.RowIndex][where.ColumnIndex];
     Type dataType = this.valueBeforeEdit.GetType();
     if (dataType == typeof(DateTime))
     {
         Dialog dialog = new Dialog("Select date", gridview.Toplevel as Window, DialogFlags.DestroyWithParent);
         dialog.SetPosition(WindowPosition.None);
         VBox topArea = dialog.VBox;
         topArea.PackStart(new HBox());
         Calendar calendar = new Calendar();
         calendar.DisplayOptions = CalendarDisplayOptions.ShowHeading |
                              CalendarDisplayOptions.ShowDayNames |
                              CalendarDisplayOptions.ShowWeekNumbers;
         calendar.Date = (DateTime)this.valueBeforeEdit;
         topArea.PackStart(calendar, true, true, 0);
         dialog.ShowAll();
         dialog.Run();
         // What SHOULD we do here? For now, assume that if the user modified the date in the calendar dialog,
         // the resulting date is what they want. Otherwise, keep the text-editing (Entry) widget active, and
         // let the user enter a value manually.
         if (calendar.Date != (DateTime)this.valueBeforeEdit)
         {
             DateTime date = calendar.GetDate();
             this.DataSource.Rows[where.RowIndex][where.ColumnIndex] = date;
             CellRendererText render = sender as CellRendererText;
             if (render != null)
             {
                 render.Text = String.Format("{0:d}", date);
                 if (e.Editable is Entry)
                 {
                     (e.Editable as Entry).Text = render.Text;
                     (e.Editable as Entry).Destroy();
                     this.userEditingCell = false;
                     if (this.CellsChanged != null)
                     {
                         GridCellsChangedArgs args = new GridCellsChangedArgs();
                         args.ChangedCells = new List<IGridCell>();
                         args.ChangedCells.Add(this.GetCell(where.ColumnIndex, where.RowIndex));
                         this.CellsChanged(this, args);
                     }
                 }
             }
         }
         dialog.Destroy();
     }
 }
        void DeferEditing(object o, EditingStartedArgs args)
        {
            Gtk.TreeIter iter;
            store.GetIter (out iter, new Gtk.TreePath (args.Path));

            GLib.Idle.Add ( delegate () {
                ((Gtk.CellRendererText) o).StopEditing (true);
                entriesTV.SetCursorOnCell (new TreePath (args.Path), entriesTV.Columns [2],
                                           entriesTV.Columns [2].Cells [1], true);
                return false;
            });
        }
Example #12
0
		private void OnItemImageMemoEditingStarted(object o, EditingStartedArgs args) {
			TreeModel filter = itemEditImages.Model;
			TreeIter iter;
			filter.GetIter(out iter, new TreePath(args.Path));
			((Entry)args.Editable).Text = ((Model.Image)filter.GetValue(iter,0)).Memo.EmptyIfNull();
		}
Example #13
0
 /// <summary>
 /// User is about to edit a cell.
 /// </summary>
 /// <param name="sender">The sender of the event</param>
 /// <param name="e">The event arguments</param>
 private void OnCellBeginEdit(object sender, EditingStartedArgs e)
 {
     this.userEditingCell = true;
     IGridCell where = GetCurrentCell;
     if (where.RowIndex >= DataSource.Rows.Count)
     {
         for (int i = DataSource.Rows.Count; i <= where.RowIndex; i++)
         {
             DataRow row = DataSource.NewRow();
             DataSource.Rows.Add(row);
         }
     }
     this.valueBeforeEdit = this.DataSource.Rows[where.RowIndex][where.ColumnIndex];
 }
Example #14
0
		private void OnStartLocationItemEdit(object o, EditingStartedArgs args){
			TreeModel filter = locationsView.Model;
			Entry entry = (Entry)args.Editable;
			TreeIter iter;
			Location loc;
			
			filter.GetIter(out iter, new TreePath(args.Path));
			loc = (Location)filter.GetValue(iter,0);
			locationCompletion.Location = loc;
			entry.Completion = locationCompletion;
			if(loc.Item != null && loc.Item.Name != null) entry.Text = loc.Item.Name;
		}
Example #15
0
		private void OnStartItemTagEdit(object o, EditingStartedArgs args){
			// get the currently edited tag
			ItemTag tag = currentlyEditedItem.Tags[(new TreePath(args.Path)).Indices[0]];
			ItemTag[] comp = currentlyEditedItem.Tags.GetUnusedTags(tag);
			itemTagCompletion.Model = new TreeModelAdapter( new ItemTagsModel( comp ));
			
			// assign the stuff to the entry
			Entry entry = (Entry)args.Editable;
			entry.Completion = itemTagCompletion;
			entry.Text = tag.Name;
		}
Example #16
0
 /// <summary>User is about to start renaming a node.</summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="NodeLabelEditEventArgs"/> instance containing the event data.</param>
 private void OnBeforeLabelEdit(object sender, EditingStartedArgs e)
 {
     nodePathBeforeRename = SelectedNode;
     //TreeView.ContextMenuStrip = null;
     //e.CancelEdit = false;
 }
Example #17
0
 void OnServiceComboStartEdited(object o, EditingStartedArgs args)
 {
     ServiceCellEdit = args.Editable;
 }