Пример #1
0
//		public VirtualGridRow GetSelectedGridRow()
//		{
//			TreePosition tp = Tree.SelectedRow;
//
//			foreach (VirtualGridRow row in Rows)
//			{
//				TreeNavigator tn = DataStore.GetNavigatorAt (tp);
//				//DataStore.
//				//VirtualGridRow rw = (VirtualGridRow)GetValue(tn,"");
//				//tn.GetValue(
//			}
//			return null;
//		}


        public void addData(TreeNavigator navigator, VirtualTreeRow row)
        {
            if (navigator == null)
            {
                throw new ArgumentNullException("navigator");
            }

            if (row == null)
            {
                throw new ArgumentNullException("row");
            }

            //add children
            if ((row.Children != null) && (row.Children.Count > 0))
            {
                TreeNavigator current = navigator;
                int           idx     = 0;
                foreach (KeyValuePair <String, VirtualTreeRow> kp in row.Children)
                {
                    if (idx > 0)
                    {
                        current.InsertAfter();
                    }

                    setData(current, kp.Value.Data);

                    if (kp.Value.Children.Count > 0)
                    {
                        addData(current.AddChild(), kp.Value);
                        current.MoveToParent();
                    }
                    else
                    {
                        if (kp.Value.Rows.Count > 0)
                        {
                            addData(current.AddChild(), kp.Value);
                            current.MoveToParent();
                        }
                    }

                    idx++;
                }
            }

            //if no children available add the assigned rows
            if ((row.Children == null) || (row.Children.Count < 1))
            {
                int idx = 0;
                foreach (VirtualGridRow rw in row.Rows)
                {
                    if (idx > 0)
                    {
                        navigator.InsertAfter();
                    }

                    setData(navigator, rw.Datas);

                    idx++;
                }
            }
        }
Пример #2
0
//DL rempixbuf
//		protected bool renderImage(VirtualTreeRow row, VirtualTreeRow childrow)
//		{
////			if ((row.Cells[0].CustomOption != null) && (row.Cells[0].CustomOption.Equals("nopic")))
////			{
////				return false;
////			}
//			if (childrow.BaseRow != null)
//			{
//				VirtualGridCell cell = childrow.BaseRow.getCell(row.HeaderColumn);
//				if (cell != null)
//				{
//					if (cell.CustomOption.Equals("nopic",StringComparison.OrdinalIgnoreCase))
//					{
//						return false;
//					}
//				}
//			}
//
//			if (row.HeaderColumn.CustomOption.Equals("pixbuf", StringComparison.OrdinalIgnoreCase))
//            {
//				return true;
//			}
//			return false;
//		}

        protected void addData(Gtk.TreeStore store, Gtk.TreeIter iter, VirtualTreeRow row, bool withiter)
        {
            //Console.WriteLine("->"  + row.NodeValue);
            //store.AppendValues(row.Data);
            foreach (KeyValuePair <String, VirtualTreeRow> kp in row.Children)
            {
                //GroupedChildRows grp = kp.Value;
                VirtualTreeRow childrow = kp.Value;

                Gtk.TreeIter it;
                bool         wi = withiter;
                if (!withiter)
                {
                    //DL rempixbuf
//                    if (renderImage(row, childrow))
//                    {
//                        it = store.AppendValues(childrow.DataWithImage);
//
//                        wi = true;
//                    }
                    //else
                    {
                        it = store.AppendValues(childrow.Data);
                        wi = true;
                    }
                }
                else
                {
//                    if (renderImage(row, childrow))
//                    {
//                        it = store.AppendValues(iter, childrow.DataWithImage);
//                    }
//                    else
//                    {
//
//                    }
                    it = store.AppendValues(iter, childrow.Data);
                }

                addData(store, it, childrow, wi);
            }             //foreach

            //add the data into a row
            if (row.HeaderColumn.ChildColumn == null)
            {
                //startStopWatch("AppendValues");
                if ((row.Rows != null) && (row.Rows.Count > 1))                 //TODO Count > 1 check .. or option ??
                {
                    //foreach (VirtualGridRow vr in row.Rows)
                    int idx = 0;
                    if (SkipFirstChildrow)
                    {
                        idx = 1;
                    }

                    for (int i = idx; i < row.Rows.Count; i++)
                    {
                        VirtualGridRow vr = row.Rows[i];
//DL rempixbuf
//	                    bool tmp = LoadPixBuf;
//	                    if (!PixBufInRow)
//	                    {
//	                        LoadPixBuf = false;
//	                    }
                        store.AppendValues(iter, vr.Datas);
                        //DL rempixbuf
                        //LoadPixBuf = tmp;
                    }
                }
                //stopStopWatch("AppendValues");
            }
        }