示例#1
0
		static void GraphFunc (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
		{
			var renderer = (RevisionGraphCellRenderer)cell;
			Gtk.TreeIter node;
			model.GetIterFirst (out node);
			
			renderer.FirstNode = node.Equals (iter);
			model.IterNthChild (out node, model.IterNChildren () - 1);
			renderer.LastNode =  node.Equals (iter);
		}
 protected void BtnOk_Click(object sender, EventArgs e)
 {
     Gtk.TreeModel model = nodeView.Model;
     Gtk.TreeIter  iter;
     if (model.GetIterFirst(out iter))
     {
         do
         {
             if ((bool)nodeView.Model.GetValue(iter, 0))
             {
                 ResourceLocation rl = new ResourceLocation();
                 rl.URL = nodeView.Model.GetValue(iter, 1).ToString();
                 Downloader download = DownloadManager.Instance.Add(
                     rl,
                     new ResourceLocation[0],
                     System.IO.Path.Combine(MonoDM.Core.Settings.Default.DownloadFolder, PathHelper.GetFileNameFromUrl(rl.URL)),
                     MonoDM.Core.Settings.Default.MaxSegments,
                     cbStartNow.Active);
             }
         } while (model.IterNext(ref iter));
     }
     Destroy();
 }
		public SystemDisplayGTK ()
		{
			this.Build ();	//Assembles window as layed out in Designer mode

			// Fill Stars Frame
			starDataShown = new ListStore (typeof(string), typeof(string), typeof(double), typeof(double),
			                               typeof(double), typeof(double), typeof(double), typeof(double));

			foreach (Entities.StarSystem systemMember in GameState.Instance.StarSystems) {
				SystemList.AppendText (systemMember.ToString ());
			}
			Gtk.TreeModel systemModel = SystemList.Model;
			Gtk.TreeIter firstItem;
			systemModel.GetIterFirst (out firstItem);
			SystemList.SetActiveIter (firstItem);

			starView = new Gtk.TreeView (starDataShown);
			starsFrame.Add (starView);
			string[] starHeader = {
				"Name",
				"Class",
				"Radius",
				"Mass",
				"Luminosity",
				"Temperature",
				"Habitable Zone",
				"Orbital Radius (AU)"
			};
			int headerIndex = 0;
			foreach (string header in starHeader) {
				starView.AppendColumn (header, new CellRendererText (), "text", headerIndex++);
			}

			starView.HeadersVisible = true;
			starView.ExpandAll ();

			// Fill Planet list frames
			string[] planetHeader = {
				"Name",
				"Type",
				"Surface\nTemp.",
				"Surface\nGravity",
				"Atmospher\n(Earth Masses)",
				"Orbit Dist\n(Avg)",
				"Pressure",
				"Radius"
			};

			planetList = new List<ListStore>();
			planetView = new List<TreeView>();
			for (int j = 0; j < 4; j++) {
				planetList.Add( new Gtk.ListStore (typeof(string), typeof(string), typeof(string), typeof(string), typeof(string),
				                                typeof(double), typeof(double), typeof(double)));

				planetView.Add( new Gtk.TreeView (planetList[j]));
				headerIndex = 0;
				foreach (string header in planetHeader) {
					planetView [j].AppendColumn (header, new CellRendererText (), "text", headerIndex++);
				}
			}

			StarA_Space.Add (planetView[0]);
			StarB_Space.Add (planetView[1]);
			StarC_Space.Add (planetView[2]);
			StarD_Space.Add (planetView[3]);

			// After Setupt iniltialize data for default system
			isSetupFinished = true;
			selectedSystem = GameState.Instance.StarSystems [0];
			setSystemType (selectedSystem.Stars.Count);
		}