示例#1
0
        void StartEditing(TableRow row)
        {
            GrabFocus();

            currentEditorRow = row;
            row.Focused      = true;

            var cell = GetCell(row);

            if (cell == null)
            {
                GrabFocus();
                QueueDraw();
                return;
            }

            editSession = cell.StartEditing(row.EditorBounds, State);
            if (editSession == null)
            {
                return;
            }

            currentEditor = (Gtk.Widget)editSession.Editor;
            Add(currentEditor);
            SetAllocation(currentEditor, row.EditorBounds);
            currentEditor.Show();
            currentEditor.GrabFocus();

            var refreshAtt = row.Property.Attributes.OfType <RefreshPropertiesAttribute> ().FirstOrDefault();
            var refresh    = refreshAtt == null ? RefreshProperties.None : refreshAtt.RefreshProperties;

            editSession.Changed += delegate {
                if (refresh == RefreshProperties.Repaint)
                {
                    parentGrid.Refresh();
                }
                else if (refresh == RefreshProperties.All)
                {
                    parentGrid.Populate(saveEditSession: true);
                }

                if (Changed != null)
                {
                    Changed(this, EventArgs.Empty);
                }
            };

            var vs = ((Gtk.Viewport)Parent).Vadjustment;

            if (row.EditorBounds.Top < vs.Value)
            {
                vs.Value = row.EditorBounds.Top;
            }
            else if (row.EditorBounds.Bottom > vs.Value + vs.PageSize)
            {
                vs.Value = row.EditorBounds.Bottom - vs.PageSize;
            }
            QueueDraw();
        }
示例#2
0
		void changeService_updateValues (object sender, ComponentChangedEventArgs e)
		{
			grid.Refresh ();
		}