Example #1
0
            public TreeMapItem(Gtk.TreeModel m,
                               ref Gtk.TreeIter iter,
                               bool horiz,
                               int textColumn,
                               int weightColumn)
            {
                if (m == null)
                {
                    throw new ArgumentNullException("m");
                }

                if (iter.Equals(Gtk.TreeIter.Zero))
                {
                    throw new ArgumentException("iter");
                }

                if (textColumn < 0)
                {
                    throw new ArgumentException("textColumn");
                }

                if (weightColumn < 0)
                {
                    throw new ArgumentException("weightColumn");
                }

                Path     = m.GetPath(iter);
                Title    = (string)m.GetValue(iter, textColumn);
                Weight   = (double)m.GetValue(iter, weightColumn);
                X        = 0;
                Y        = 0;
                Width    = 0;
                Height   = 0;
                Children = null;
                Horiz    = horiz;

                Gtk.TreeIter citer;
                double       c_total = 0.0;

                if (m.IterChildren(out citer, iter))
                {
                    do
                    {
                        AddChild(new TreeMapItem(m, ref citer, !horiz, textColumn, weightColumn));
                    } while (m.IterNext(ref citer));

                    // Get total weight
                    Children.ForEach(delegate(TreeMapItem i) {
                        c_total += Math.Abs(i.Weight);
                    });

                    this.ChildrenWeight = c_total;
                }
            }