public TreePosition GetRowAtPosition(Point p)
 {
     Gtk.TreePath path = GetPathAtPosition(p);
     if (path != null)
     {
         Gtk.TreeIter iter;
         Widget.Model.GetIter(out iter, path);
         return(new IterPos(-1, iter));
     }
     return(null);
 }
Exemple #2
0
        public int GetIndex(IntPtr path)
        {
            Gtk.TreePath treepath = new Gtk.TreePath(path);
            int          depth    = treepath.Depth;

            if (depth <= 0)
            {
                return(PastTheEndIndex);
            }
            return(treepath.Indices[0]);
        }
Exemple #3
0
 int GetRow(Gtk.TreePath path)
 {
     if (path.Indices.Length > 0 && Handler.DataStore != null && Handler.DataStore.Count > 0)
     {
         return(path.Indices [0]);
     }
     else
     {
         return(-1);
     }
 }
 protected override void OnRowActivated(Gtk.TreePath path, Gtk.TreeViewColumn column)
 {
     // This is to work around an issue in ContextMenuTreeView, when we set the
     // SelectFunction to block selection then it doesn't seem to always get
     // properly unset.
     //   https://bugzilla.xamarin.com/show_bug.cgi?id=40469
     this.Selection.SelectFunction = (s, m, p, b) => {
         return(true);
     };
     base.OnRowActivated(path, column);
 }
Exemple #5
0
		public void GetRow(){
			int index;
			Gtk.TreePath path = new Gtk.TreePath("0");
			Assert.IsTrue(GetRowCallback(out index, path.Handle));
			Assert.AreEqual(0, index);

			int i = this._PastTheEndIndex - 1;
			path = new Gtk.TreePath(i.ToString());
			Assert.IsTrue(GetRowCallback(out index, path.Handle));
			Assert.AreEqual(this._PastTheEndIndex-1, index);
		}
Exemple #6
0
        public Gtk.TreeIter GetIterFromItem(T item, Gtk.TreePath path)
        {
            GCHandle gch;
            var      node = new Node {
                Item = item, Indices = path.Indices
            };

            gch = GCHandle.Alloc(node);
            Gtk.TreeIter result = Gtk.TreeIter.Zero;
            result.UserData = (IntPtr)gch;
            return(result);
        }
Exemple #7
0
        public bool foreachItem(Gtk.TreeModel mode, Gtk.TreePath path, Gtk.TreeIter iter)
        {
            VirtualGridRow cr = getGridRow(iter);

            if (cr != null)
            {
                if (!TreeIterators.ContainsKey(cr))
                {
                    TreeIterators.Add(cr, iter);
                }
            }
            return(false);
        }
        public InactivateTimer(TaskTreeView treeView,
									Gtk.TreeIter taskIter,
									Task taskToComplete,
									uint delayInSeconds)
        {
            tree = treeView;
            iter = taskIter;
            path = treeView.Model.GetPath (iter);
            task = taskToComplete;
            secondsLeft = delayInSeconds;
            delay = delayInSeconds * 1000; // Convert to milliseconds
            pulseTimeoutId = 0;
        }
Exemple #9
0
 private int SelectedIndex()
 {
     Gtk.TreeIter iter;
     tree.Selection.GetSelected(out iter);
     Gtk.TreePath path = tree.Model.GetPath(iter);
     if (path != null)
     {
         return(path.Indices.Length != -1 ? path.Indices[0] : -1);
     }
     else
     {
         return(-1);
     }
 }
Exemple #10
0
        private Album GetAlbum(int x, int y)
        {
            Gtk.TreePath path = null;
            base.List.GetPathAtPos(x, y, out path);

            if (path == null)
            {
                return(null);
            }

            IntPtr ptr = base.List.Model.HandleFromPath(path);

            return(GetAlbum(ptr));
        }
Exemple #11
0
        public void GetRow()
        {
            int index;

            Gtk.TreePath path = new Gtk.TreePath("0");
            Assert.IsTrue(GetRowCallback(out index, path.Handle));
            Assert.AreEqual(0, index);

            int i = this._PastTheEndIndex - 1;

            path = new Gtk.TreePath(i.ToString());
            Assert.IsTrue(GetRowCallback(out index, path.Handle));
            Assert.AreEqual(this._PastTheEndIndex - 1, index);
        }
Exemple #12
0
        public Gtk.TreePath GetPath(Gtk.TreeIter iter)
        {
            var node = NodeFromIter(iter);

            if (node == null)
            {
                throw new ArgumentException("iter");
            }

            var path = new Gtk.TreePath();

            path.AppendIndex(node.Row);
            return(path);
        }
 void ExpandItems(ITreeGridStore <ITreeGridItem> store, Gtk.TreePath path)
 {
     for (int i = 0; i < store.Count; i++)
     {
         var item = store[i];
         if (item.Expandable && item.Expanded)
         {
             var newpath = path.Copy();
             newpath.AppendIndex(i);
             Handler.Tree.ExpandToPath(newpath);
             ExpandItems((ITreeGridStore <ITreeGridItem>)item, newpath);
         }
     }
 }
Exemple #14
0
 EtoNode GetNodeAtPath(Gtk.TreePath path)
 {
     if (path.Indices.Length > 0 && Handler.store != null)
     {
         var row  = path.Indices[0];
         var item = Handler.store.GetItem(row);
         return(new EtoNode {
             Item = item, Row = row
         });
     }
     else
     {
         return(null);
     }
 }
 protected virtual void OnButtonUpClicked(object sender, System.EventArgs e)
 {
     Gtk.TreePath[] paths = engineList.Selection.GetSelectedRows();
     if (paths.Length > 0)
     {
         Gtk.TreePath p = paths [0];
         Gtk.TreeIter it1, it2;
         engineStore.GetIter(out it2, p);
         if (p.Prev() && engineStore.GetIter(out it1, p))
         {
             engineStore.Swap(it1, it2);
             UpdatePriorityButtons();
         }
     }
 }
Exemple #16
0
 private void InternalRowDeleted(Gtk.TreePath path)
 {
     GLib.Value      ret             = GLib.Value.Empty;
     GLib.ValueArray inst_and_params = new GLib.ValueArray(2);
     GLib.Value[]    vals            = new GLib.Value [2];
     vals [0] = new GLib.Value(this);
     inst_and_params.Append(vals [0]);
     vals [1] = new GLib.Value(path);
     inst_and_params.Append(vals [1]);
     g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
     foreach (GLib.Value v in vals)
     {
         v.Dispose();
     }
 }
 void UpdatePriorityButtons()
 {
     Gtk.TreePath[] paths = engineList.Selection.GetSelectedRows();
     if (paths.Length > 0)
     {
         Gtk.TreePath p = paths [0];
         Gtk.TreeIter it;
         engineStore.GetIter(out it, p);
         buttonDown.Sensitive = engineStore.IterNext(ref it);
         buttonUp.Sensitive   = p.Prev();
     }
     else
     {
         buttonDown.Sensitive = buttonUp.Sensitive = false;
     }
 }
Exemple #18
0
        public bool GetIter(out Gtk.TreeIter iter, Gtk.TreePath path)
        {
            iter = Gtk.TreeIter.Zero;
            if (path.Indices.Length == 0)
            {
                return(false);
            }
            int row = path.Indices [0];

            if (row >= source.RowCount)
            {
                return(false);
            }
            iter = IterFromNode(row);
            return(true);
        }
Exemple #19
0
 Node GetNodeAtPath(Gtk.TreePath path)
 {
     if (path.Indices.Length > 0)
     {
         var item = Handler.DataStore;
         for (int i = 0; i < path.Indices.Length; i++)
         {
             var idx = path.Indices[i];
             item = (TStore)(object)item[idx];
         }
         var node = new Node();
         node.Item    = (TItem)(object)item;
         node.Indices = path.Indices;
         return(node);
     }
     return(null);
 }
Exemple #20
0
        private void HandleViewModelSelectionChangedCore(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            _updatingSelection = true;
            try
            {
                var selection = _romListView.Selection;
                switch (e.Action)
                {
                case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
                case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
                case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
                    if (e.NewItems != null)
                    {
                        foreach (ProgramDescriptionViewModel item in e.NewItems)
                        {
                            var index = ViewModel.Programs.IndexOf(item);
                            var path  = new Gtk.TreePath();
                            path.AppendIndex(index);
                            selection.SelectPath(path);
                        }
                    }
                    if (e.OldItems != null)
                    {
                        foreach (ProgramDescriptionViewModel item in e.OldItems)
                        {
                            var index = ViewModel.Programs.IndexOf(item);
                            var path  = new Gtk.TreePath();
                            path.AppendIndex(index);
                            selection.UnselectPath(path);
                        }
                    }
                    break;

                case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
                    selection.UnselectAll();
                    break;

                case System.Collections.Specialized.NotifyCollectionChangedAction.Move:
                    break;
                }
            }
            finally
            {
                _updatingSelection = false;
            }
        }
Exemple #21
0
        public bool GetIter(out Gtk.TreeIter iter, Gtk.TreePath path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            var item = GetItemAtPath(path);

            if (item != null)
            {
                iter = GetIterFromItem(item, path);
                return(true);
            }
            iter = Gtk.TreeIter.Zero;
            return(false);
        }
Exemple #22
0
            bool IsChildIter(Gtk.TreeIter pit, Gtk.TreeIter cit, bool recursive)
            {
                Gtk.TreePath pitPath = tree.Store.GetPath(pit);
                Gtk.TreePath citPath = tree.Store.GetPath(cit);

                if (!citPath.Up())
                {
                    return(false);
                }

                if (citPath.Equals(pitPath))
                {
                    return(true);
                }

                return(recursive && pitPath.IsAncestor(citPath));
            }
Exemple #23
0
        public bool GetPathAtPos(int x, int y, out Gtk.TreePath path)
        {
            IntPtr pathHandle;
            IntPtr columnHandle;
            bool   raw_ret = gtk_tree_view_get_path_at_pos_intptr(Handle, x, y, out pathHandle, out columnHandle, IntPtr.Zero, IntPtr.Zero);

            if (raw_ret)
            {
                path = (Gtk.TreePath)GLib.Opaque.GetOpaque(pathHandle, typeof(Gtk.TreePath), true);
            }
            else
            {
                path = null;
            }

            return(raw_ret);
        }
 private void CellEditingEnded(string newValue, Gtk.TreePath path, bool commit)
 {
     if (commit)
     {
         EditingObject = new TextCellInPlaceEditorObjectData(path, EditingObject.Column, newValue);
         CommitEditCore();
     }
     else
     {
         CancelEditCore();
     }
     Renderer.EditingCanceled -= CellEditingCanceled;
     Renderer.Edited          -= CellEdited;
     Editor.TextInserted      -= HandleTextInserted;
     EditedElement             = null;
     EditingObject             = new TextCellInPlaceEditorObjectData(EditingObject.Path, EditingObject.Column);
 }
Exemple #25
0
        public bool GetIter(out Gtk.TreeIter iter, Gtk.TreePath path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }


            var row = GetRow(path);

            if (row >= 0)
            {
                iter = GetIterAtRow(row);
                return(true);
            }
            iter = Gtk.TreeIter.Zero;
            return(false);
        }
Exemple #26
0
        public bool GetIter(out Gtk.TreeIter iter, Gtk.TreePath path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }


            var node = GetNodeAtPath(path);

            if (node != null)
            {
                iter = IterFromNode(node);
                return(true);
            }
            iter = Gtk.TreeIter.Zero;
            return(false);
        }
        public Rectangle GetRowBounds(int row, bool includeMargin)
        {
            Gtk.TreePath path = new Gtk.TreePath(new [] { row });
            Gtk.TreeIter iter;
            if (!Widget.Model.GetIterFromString(out iter, path.ToString()))
            {
                return(Rectangle.Zero);
            }

            if (includeMargin)
            {
                return(GetRowBackgroundBounds(iter));
            }
            else
            {
                return(GetRowBounds(iter));
            }
        }
Exemple #28
0
        /// <summary>
        /// Attaches a submodel to the tree view's model.
        /// </summary>
        /// <param name='model'>
        /// The root model to be attached to.
        /// </param>
        /// <param name='parent'>[ref]
        /// The pointer where the elements to be attached to.
        /// </param>
        /// <param name='elements'>
        /// Elements.
        /// </param>
        protected void AttachSubTree(Gtk.TreeModel model, Gtk.TreeIter parent, object[] elements)
        {
            Debug.Assert(store != null, "TreeModel shouldn't be flat");

            // remove the values if they were added before.
            Gtk.TreePath path = store.GetPath(parent);
            path.Down();
            Gtk.TreeIter iter;
            while (store.GetIter(out iter, path))
            {
                store.Remove(ref iter);
            }

            // Add the elements to the tree view.
            for (uint i = 0; i < elements.Length; ++i)
            {
                store.AppendValues(parent, elements[i]);
            }
        }
Exemple #29
0
        /// <summary>
        /// Gets a Gtk.TreeIter for the node.
        /// </summary>
        /// <param name="iter">Receives the iterator to the node within the Gtk.TreeStore.</param>
        /// <param name="treeStore">The tree store containing reference to this node.</param>
        /// <returns><c>true</c>, if iter was successfully retrieved, or this node is the root, <c>false</c> otherwise.</returns>
        /// <remarks>If this is the root node, <paramref name="iter"/> contains Gtk.TreeIter.Zero. Caller must check for this.</remarks>
        internal bool GetIterForItem(out Gtk.TreeIter iter, Gtk.TreeStore treeStore)
        {
            iter = Gtk.TreeIter.Zero;
            var path   = new Gtk.TreePath();
            var node   = Model;
            var parent = Parent;

            while (parent != null)
            {
                var index = parent.IndexOfChild(node);
                path.PrependIndex(index);
                node   = parent;
                parent = node.Parent;
            }

            var succeeded = (path.Depth == 0) || treeStore.GetIter(out iter, path);

            return(succeeded);
        }
Exemple #30
0
        public bool GetPathAtPos(int x, int y, out Gtk.TreePath path, out Gtk.TreeViewColumn column, out int cell_x, out int cell_y)
        {
            IntPtr pathHandle;
            IntPtr columnHandle;
            bool   raw_ret = gtk_tree_view_get_path_at_pos(Handle, x, y, out pathHandle, out columnHandle, out cell_x, out cell_y);

            if (raw_ret)
            {
                column = (Gtk.TreeViewColumn)GLib.Object.GetObject(columnHandle, false);
                path   = (Gtk.TreePath)GLib.Opaque.GetOpaque(pathHandle, typeof(Gtk.TreePath), true);
            }
            else
            {
                path   = null;
                column = null;
            }

            return(raw_ret);
        }
Exemple #31
0
        public bool GetIter(out Gtk.TreeIter iter, Gtk.TreePath path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }


            var row = GetRow(path);

            if (row >= 0)
            {
                iter = new Gtk.TreeIter {
                    UserData = (IntPtr)(row + 1)
                };
                return(true);
            }
            iter = Gtk.TreeIter.Zero;
            return(false);
        }
Exemple #32
0
        public virtual int GetRowIndexOfPath(Gtk.TreePath path)
        {
            int rowIndex = 0;

            if (path.Indices.Length > 0)
            {
                for (int i = 0; i < path.Depth; i++)
                {
                    rowIndex += path.Indices[i] + 1;
                }

                rowIndex--;
            }
            else
            {
                rowIndex = -1;
            }

            return(rowIndex);
        }
 void HandleRowsReordered(object sender, ListRowOrderEventArgs e)
 {
     var p = new Gtk.TreePath (new int[] { e.Row });
     var it = IterFromNode (e.Row);
     adapter.EmitRowsReordered (p, it, e.ChildrenOrder);
     parent.QueueResize ();
 }
Exemple #34
0
        private void BankNumber_Edited(object o, Gtk.EditedArgs args)
        {
            // Set and Get data
            Gtk.TreeIter iter;
            Gtk.TreePath treepath = new Gtk.TreePath (args.Path);
            Gtk.CellRendererText nextCell = (Gtk.CellRendererText)checktableview.columnList [(int)ColumnType.BRANCH_NUMBER].Cell;
            Gtk.TreeViewColumn nextColumn = checktableview.columnList [(int)ColumnType.BRANCH_NUMBER].Column;
            string text = args.NewText;

            checkPropsList.GetIter (out iter, treepath);

            BL.CheckClass check = (BL.CheckClass)checkPropsList.GetValue (iter, 0);
            String formattedNumber = BL.Formatter.ZeroPad (text, BL.Constants.LENGTH_NUM_BANK);

            if (formattedNumber != null) {
                check.BankNumber = formattedNumber;
                // Move to next cell
                checktableview.SetCursorOnCell (treepath, nextColumn, nextCell, true);
            } else if (!text.Equals ("")) {
                Gtk.MessageDialog dialog = InvalidEntryDialog ("Número de banco inválido!");
                Gtk.ResponseType result = (Gtk.ResponseType)dialog.Run ();
                if (result == Gtk.ResponseType.Ok)
                    dialog.Destroy ();
            }
        }
Exemple #35
0
        private void Value_Edited(object o, Gtk.EditedArgs args)
        {
            Gtk.TreeIter iter;
            Gtk.TreePath treepath = new Gtk.TreePath (args.Path);
            Gtk.CellRendererText nextCell = (Gtk.CellRendererText)checktableview.columnList [(int)ColumnType.CUSTOMER_ID].Cell;
            Gtk.TreeViewColumn nextColumn = checktableview.columnList [(int)ColumnType.CUSTOMER_ID].Column;
            string text = args.NewText;

            checkPropsList.GetIter (out iter, treepath);

            BL.CheckClass check = (BL.CheckClass)checkPropsList.GetValue (iter, 0);

            Decimal value;
            if (BL.Formatter.GetValueWithoutCurrency (text, out value)) {
                check.Value = value;

                // If row is filled, there is no equal check and there is no other row below, add one
                if (isRowFilled (treepath) && (DAL.DataManager.GetCheck (check) == null)) {

                    if (!checkPropsList.IterNext (ref iter)) {
                        // Update Total
                        checkPropsList.GetIter (out iter, treepath);
                        lblTotal.Text = "Total: " + String.Format ("{0:C}", CalculateTotal ());

                        // Move to next cell
                        checkPropsList.AppendValues (new BL.CheckClass (), "");
                        checkPropsList.IterNext (ref iter);
                        checktableview.SetCursorOnCell (checkPropsList.GetPath (iter), nextColumn, nextCell, true);
                    }
                } else {
                    Gtk.MessageDialog dialog = InvalidEntryDialog ("Cheque já existe ou dados não estão completos!");
                    Gtk.ResponseType result = (Gtk.ResponseType)dialog.Run ();
                    if (result == Gtk.ResponseType.Ok)
                        dialog.Destroy ();
                }

            } else {
                Gtk.MessageDialog dialog = InvalidEntryDialog ("Valor inválido!");
                Gtk.ResponseType result = (Gtk.ResponseType)dialog.Run ();
                if (result == Gtk.ResponseType.Ok)
                    dialog.Destroy ();
            }
        }
Exemple #36
0
        private void Serial_Edited(object o, Gtk.EditedArgs args)
        {
            // Set and Get data
            Gtk.TreeIter iter;
            Gtk.TreePath treepath = new Gtk.TreePath (args.Path);
            Gtk.CellRendererText nextCell = (Gtk.CellRendererText)checktableview.columnList [(int)ColumnType.CHECK_DUEDATE].Cell;
            Gtk.TreeViewColumn nextColumn = checktableview.columnList [(int)ColumnType.CHECK_DUEDATE].Column;
            string text = args.NewText;

            checkPropsList.GetIter (out iter, treepath);

            BL.CheckClass check = (BL.CheckClass)checkPropsList.GetValue (iter, 0);
            check.Serial = text;
            // Move to next cell
            checktableview.SetCursorOnCell (treepath, nextColumn, nextCell, true);
        }
Exemple #37
0
        public Rectangle GetRowBounds(int row, bool includeMargin)
        {
            Gtk.TreePath path = new Gtk.TreePath (new [] { row });
            Gtk.TreeIter iter;
            if (!Widget.Model.GetIterFromString (out iter, path.ToString ()))
                return Rectangle.Zero;

            if (includeMargin)
                return GetRowBackgroundBounds (iter);
            else
                return GetRowBounds (iter);
        }
 void HandleRowInserted(object sender, ListRowEventArgs e)
 {
     var p = new Gtk.TreePath (new int[] { e.Row });
     var it = IterFromNode (e.Row);
     adapter.EmitRowInserted (p, it);
     parent.QueueResize ();
 }
		protected override bool OnButtonReleaseEvent (Gdk.EventButton evnt)
		{
			this.Selection.SelectFunction = (s, m, p, b) => {
				return true;
			};
			Gtk.TreePath buttonReleasePath;
			//If OnButtonPressEvent attempted on making deselection and dragging was not started
			//check if we are on same item as when we clicked(could be different if dragging is disabled)
			if (selectOnRelease &&
			    GetPathAtPos ((int)evnt.X, (int)evnt.Y, out buttonReleasePath) &&
			    buttonPressPath.Compare (buttonReleasePath) == 0) {

				//Simulate what would happen in OnButtonPressEvent if we were not blocking selection
				//notice that item is currently 100% selected since this check was performed in OnButtonPressEvent
				if (Selection.Mode == Gtk.SelectionMode.Multiple &&
				    (evnt.State & Gdk.ModifierType.ControlMask) > 0) {
					Selection.UnselectPath (buttonReleasePath);
				} else {
					//UnselectAll in case multiple were selected we want only our item to be selected now
					//if it was clicked but not dragged
					Selection.UnselectAll ();
					Selection.SelectPath (buttonReleasePath);
				}
				buttonPressPath = null;
			}
			selectOnRelease = false;

			bool res = base.OnButtonReleaseEvent (evnt);
			
			if (DoPopupMenu != null && evnt.IsContextMenuButton ()) {
				return true;
			}
			
			return res;
		}
Exemple #40
0
        protected override void OnSetDragStatus(Gdk.DragContext context, int x, int y, uint time, Gdk.DragAction action)
        {
            base.OnSetDragStatus (context, x, y, time, action);

            // We are overriding the TreeView methods for handling drag & drop, so we need
            // to manually highlight the selected row

            Gtk.TreeViewDropPosition tpos;
            Gtk.TreePath path;
            if (!Widget.GetDestRowAtPos (x, y, out path, out tpos))
                path = null;

            if (expandTimer == 0 || !object.Equals (autoExpandPath, path)) {
                if (expandTimer != 0)
                    GLib.Source.Remove (expandTimer);
                if (path != null) {
                    expandTimer = GLib.Timeout.Add (600, delegate {
                        Widget.ExpandRow (path, false);
                        return false;
                    });
                }
                autoExpandPath = path;
            }

            if (path != null && action != 0)
                Widget.SetDragDestRow (path, tpos);
            else
                Widget.SetDragDestRow (null, 0);
        }
Exemple #41
0
		public void GetRowBad()
		{
			Gtk.TreePath path;
			int index;

			path = new Gtk.TreePath("0.0");
			index = -1;
			Assert.IsFalse(GetRowCallback(out index, path.Handle));
			Assert.AreEqual(this._PastTheEndIndex, index);

			path = new Gtk.TreePath("-1");
			index = -1;
			Assert.IsFalse(GetRowCallback(out index, path.Handle));
			Assert.AreEqual(this._PastTheEndIndex, index);

			path = new Gtk.TreePath("");
			index = -1;
			Assert.IsFalse(GetRowCallback(out index, path.Handle));
			Assert.AreEqual(this._PastTheEndIndex, index);

			path = new Gtk.TreePath(this._PastTheEndIndex.ToString());
			index = -1;
			Assert.IsFalse(GetRowCallback(out index, path.Handle));
			Assert.AreEqual(this._PastTheEndIndex, index);
		}
Exemple #42
0
        public Rectangle GetCellBounds(int row, CellView cell, bool includeMargin)
        {
            var col = GetCellColumn (cell);
            var cr = GetCellRenderer (cell);
            Gtk.TreePath path = new Gtk.TreePath (new [] { row });

            Gtk.TreeIter iter;
            if (!Widget.Model.GetIterFromString (out iter, path.ToString ()))
                return Rectangle.Zero;

            if (includeMargin)
                return ((ICellRendererTarget)this).GetCellBackgroundBounds (col, cr, iter);
            else
                return ((ICellRendererTarget)this).GetCellBounds (col, cr, iter);
        }
Exemple #43
0
		protected void Prefered_Toggled(object sender, Gtk.ToggledArgs e)
		{			
			SpouseListModel spouseList = (SpouseListModel)_listModel;

			Gtk.TreePath path = new Gtk.TreePath(e.Path);
			Gtk.TreeIter iter;
			if (_listModel.GetIter(out iter, path))
			{
				GedcomIndividualRecord indi = _listModel.GetValue(iter, 0);
				spouseList.SetPrefered(indi.XRefID);
			}
		}
	public int GetIndex(IntPtr path)
	{
	  Gtk.TreePath treepath = new Gtk.TreePath(path);
	  int depth = treepath.Depth;
	  if (depth <= 0)
	  {
		return PastTheEndIndex;
	  }
	  return treepath.Indices[0];
	}
Exemple #45
0
        //
        // EDITED EVENT HANDLERS
        //
        private void CustID_Edited(object o, Gtk.EditedArgs args)
        {
            // Set and Get data
            Gtk.TreeIter iter;
            Gtk.TreePath treepath = new Gtk.TreePath (args.Path);
            Gtk.CellRendererText nextCell = (Gtk.CellRendererText)checktableview.columnList [(int)ColumnType.CHECK_NUMBER].Cell;
            Gtk.TreeViewColumn nextColumn = checktableview.columnList [(int)ColumnType.CHECK_NUMBER].Column;
            string text = BL.Formatter.GetNumericID (args.NewText);

            // Get iter
            checkPropsList.GetIter (out iter, treepath);
            // Get Check
            BL.CheckClass check = (BL.CheckClass)checkPropsList.GetValue (iter, 0);

            // Find customer
            BL.Customer customer = DAL.DataManager.GetCustomer (text);

            if (customer != null) {
                check.CustomerID = customer.Identity;
                checkPropsList.SetValue (iter, 1, customer.Name);

                // Move to next cell
                checktableview.SetCursorOnCell (treepath, nextColumn, nextCell, true);

            } else if (!text.Equals ("")) {
                Gtk.MessageDialog dialog = YesNoDialog ("Cliente não existente!\nQuer adicioná-lo?");
                Gtk.ResponseType result = (Gtk.ResponseType)dialog.Run ();
                if (result == Gtk.ResponseType.Yes) {
                    dialog.Destroy ();
                    Dialogs.AddCustomerDialog addCustDia = new Dialogs.AddCustomerDialog ();
                    addCustDia.AddedCustomer += (object sender, Cheque.GTK.Dialogs.AddCustomerEventArgs e) => {
                        check.CustomerID = BL.Formatter.GetNumericID (e.CustomerID);
                    };
                    addCustDia.GetEntryID ().Text = text;
                    addCustDia.Run ();
                    customer = DAL.DataManager.GetCustomer (check.CustomerID);
                    if (customer != null) {
                        checkPropsList.SetValue (iter, 1, customer.Name);
                        checktableview.SetCursorOnCell (treepath, nextColumn, nextCell, true);
                    }
                }
                dialog.Destroy ();
            }
        }
	public Gtk.TreePath GetPath(int index)
	{
	  this.VerifyValidIndex(index);
	  Gtk.TreePath path = new Gtk.TreePath();
	  path.AppendIndex(index);
	  path.Owned = false;
	  return path;
	}
Exemple #47
0
        private void DueDate_Edited(object o, Gtk.EditedArgs args)
        {
            Gtk.TreeIter iter;
            Gtk.TreePath treepath = new Gtk.TreePath (args.Path);
            Gtk.CellRendererText nextCell = (Gtk.CellRendererText)checktableview.columnList [(int)ColumnType.CHECK_VALUE].Cell;
            Gtk.TreeViewColumn nextColumn = checktableview.columnList [(int)ColumnType.CHECK_VALUE].Column;
            string text = args.NewText;

            checkPropsList.GetIter (out iter, treepath);

            BL.CheckClass check = (BL.CheckClass)checkPropsList.GetValue (iter, 0);

            // Parsing the date
            DateTime dt;
            DateTimeFormatInfo formatDate = new DateTimeFormatInfo { ShortDatePattern = "dd/MM/yyyy" };
            bool isParsed = DateTime.TryParse (text, formatDate, DateTimeStyles.None, out dt);

            if (isParsed) {
                check.DueDate = dt;
                check.CashDate = dt;
                // Move to next cell
                checktableview.SetCursorOnCell (treepath, nextColumn, nextCell, true);
            } else {
                Gtk.MessageDialog dialog = InvalidEntryDialog ("Data inválida!");
                Gtk.ResponseType result = (Gtk.ResponseType)dialog.Run ();
                if (result == Gtk.ResponseType.Ok)
                    dialog.Destroy ();
            }
        }
 void HandleRowDeleted(object sender, ListRowEventArgs e)
 {
     var p = new Gtk.TreePath (new int[] { e.Row });
     adapter.EmitRowDeleted (p);
     parent.QueueResize ();
 }
Exemple #49
0
		public Gtk.TreePath GetPath (Gtk.TreeIter iter)
		{
			var node = NodeFromIter (iter);
			if (node == null)
				throw new ArgumentException ("iter");

			var path = new Gtk.TreePath ();
			path.AppendIndex (node.Row);
			return path;
		}
        public Rectangle GetCellBounds(int row, CellView cell, bool includeMargin)
        {
            var col = GetCellColumn (cell);
            var cr = GetCellRenderer (cell);
            Gtk.TreePath path = new Gtk.TreePath (new [] { row });

            Gtk.TreeIter iter;
            if (!Widget.Model.GetIterFromString (out iter, path.ToString ()))
                return Rectangle.Zero;

            col.CellSetCellData (Widget.Model, iter, false, false);

            Gdk.Rectangle rect = includeMargin ? Widget.GetBackgroundArea (path, col) : Widget.GetCellArea (path, col);

            int x, y, w, h;
            col.CellGetPosition (cr, out x, out w);
            col.CellGetSize (rect, out x, out y, out w, out h);

            return new Rectangle (x, y, w, h);
        }
Exemple #51
0
		public void GetPath()
		{
			Gtk.TreePath path;
			path = new Gtk.TreePath(GetPathCallback(0));
			Assert.AreEqual("0", path.ToString());

			path = new Gtk.TreePath(GetPathCallback(this._PastTheEndIndex-1));
			int i = this._PastTheEndIndex -1;
			Assert.AreEqual(i.ToString(), path.ToString());
		}