Example #1
0
 protected void OnExpand(object sender, EventArgs e)
 {
     if (expandAction.Active == true)
     {
         tree.ExpandAll();
     }
     else
     {
         tree.CollapseAll();
     }
 }
        /// <summary>
        /// Add new tab to Notebook object and fill it with 
        /// scan result of multimedia file
        /// </summary>
        private void FillListView(List<string[]> video, List<string[]> audio, string filePath)
        {
            TreeStore store = null;

            ScrolledWindow sw = new ScrolledWindow();

            Label lblIndex =
                new Label(Path.GetFileName(filePath).PadRight(25).Substring(0,25).Trim());
            lblIndex.TooltipText = Path.GetFileName(filePath);

            tabContainer.AppendPage(sw, lblIndex);

            TreeView tv = new TreeView();
            tv.HeadersVisible = true;

            tv.AppendColumn ("", new CellRendererPixbuf(), "pixbuf", 0);
            tv.AppendColumn ("Description", new CellRendererText(), "text", 1);
            tv.AppendColumn ("Value", new CellRendererText(), "text", 2);

            sw.Add(tv);

            store = new TreeStore (typeof (Gdk.Pixbuf), typeof (string), typeof (string));
            TreeIter iter = store.AppendValues (Gdk.Pixbuf.LoadFromResource("video.png"),
                                                "Video", "");

            for (int k=0; k<video.Count; k++)
            {
                store.AppendValues(iter, null, video[k][0], video[k][1]);
            }

            iter = store.AppendValues (Gdk.Pixbuf.LoadFromResource("sound.png"),
                                       "Audio", "");

            for (int k=0; k<audio.Count; k++)
            {
                store.AppendValues(iter, null, audio[k][0], audio[k][1]);
            }

            tv.Model = store;
            tv.ExpandAll();
        }
            void BuildTreeView()
            {
                TreeStore store = new TreeStore(typeof(string));

                bookmarks_treeview.Model = store;

                TreeIter iter = store.AppendValues(root_group.Name);

                // appending root
                iter_to_id[iter] = root_group.ID;

                // calling the recursevily builder
                BuildTreeViewHelper(root_group, iter, store);

                /*
                 * foreach (object i in root_group.Members) {
                 *  if (i is Bookmark)
                 *          iter_to_id[store.AppendValues (iter, ((Bookmark)i).Name )] = ((Bookmark)i).ID;
                 * }
                 */
                bookmarks_treeview.ExpandAll();
            }
Example #4
0
        ///<summary>Populate the layout list</summary>
        void PopulateLayoutList()
        {
            // specify the column types
            TreeStore ts = new TreeStore(typeof(string), typeof(string));

            TreeIter ti = ts.AppendValues(Catalog.GetString("System-wide Layouts"), string.Empty);

            // fill list from bless data dir
            string dataDir = FileResourcePath.GetDataPath("data");

            if (Directory.Exists(dataDir))
            {
                string[] files = Directory.GetFiles(dataDir, "*.layout");
                foreach (string s in files)
                {
                    ts.AppendValues(ti, System.IO.Path.GetFileName(s), s);
                }
            }

            ti = ts.AppendValues(Catalog.GetString("User Layouts"), string.Empty);

            // fill list from user layout dir
            if (Directory.Exists(layoutDir))
            {
                string[] files = Directory.GetFiles(layoutDir, "*.layout");
                foreach (string s in files)
                {
                    ts.AppendValues(ti, System.IO.Path.GetFileName(s), s);
                }
            }

            // Create the treeview
            LayoutList.Model = ts;
            LayoutList.AppendColumn("Layout", new CellRendererText(), "text", (int)LayoutColumn.Filename);
            LayoutList.ExpandAll();
            LayoutList.Selection.Changed += OnLayoutListSelectionChanged;
        }
		public DirtyFilesDialog () : base (GettextCatalog.GetString ("Save Files"), IdeApp.Workbench.RootWindow, DialogFlags.Modal)
		{
			tsFiles = new TreeStore (typeof(string), typeof(bool), typeof(SdiWorkspaceWindow), typeof(bool));
			tvFiles = new TreeView (tsFiles);
			TreeIter topCombineIter = TreeIter.Zero;
			Hashtable projectIters = new Hashtable ();
			
			foreach (Document doc in IdeApp.Workbench.Documents) {
				if (!doc.IsDirty)
					continue;
				
				IViewContent viewcontent = doc.Window.ViewContent;
				 
				if (viewcontent.Project != null) {
					TreeIter projIter = TreeIter.Zero;
					if (projectIters.ContainsKey (viewcontent.Project))
						projIter = (TreeIter)projectIters [viewcontent.Project];
					else {
						if (topCombineIter.Equals (TreeIter.Zero))
							projIter = tsFiles.AppendValues (GettextCatalog.GetString ("Project: {0}", viewcontent.Project.Name), true, null, false);
						else
							projIter = tsFiles.AppendValues (topCombineIter, GettextCatalog.GetString ("Project: {0}", viewcontent.Project.Name), true, null, false);
						projectIters [viewcontent.Project] = projIter;
					}
					tsFiles.AppendValues (projIter, viewcontent.PathRelativeToProject, true, viewcontent.WorkbenchWindow);
				} else {
					if (viewcontent.ContentName == null) {
						viewcontent.ContentName = System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), viewcontent.UntitledName);
					}
					tsFiles.AppendValues (viewcontent.ContentName, true, viewcontent.WorkbenchWindow);
				}
			}
			if (!topCombineIter.Equals (TreeIter.Zero)) {
				if (!tsFiles.IterHasChild (topCombineIter))
					tsFiles.Remove (ref topCombineIter); 
			}

			TreeViewColumn mainColumn = new TreeViewColumn ();
			mainColumn.Title = "header";
			
			togRender = new CellRendererToggle ();
			togRender.Toggled += toggled;
			mainColumn.PackStart (togRender, false);
			mainColumn.AddAttribute (togRender, "active", 1);
			mainColumn.AddAttribute (togRender, "inconsistent", 3);
			
			textRender = new CellRendererText ();
			mainColumn.PackStart (textRender, true);
			mainColumn.AddAttribute (textRender, "text", 0);

			tvFiles.AppendColumn (mainColumn);
			tvFiles.HeadersVisible = false;
			tvFiles.ExpandAll ();

			ScrolledWindow sc = new ScrolledWindow ();
			sc.Add (tvFiles);
			sc.ShadowType = ShadowType.In;

			sc.BorderWidth = 6;
			this.VBox.PackStart (sc, true, true, 6);
			
			btnSaveAndQuit = new Button (GettextCatalog.GetString ("_Save and Close"));
			btnQuit = new Button (Gtk.Stock.Quit);
			btnQuit.Label = GettextCatalog.GetString ("_Close");
			btnCancel = new Button (Gtk.Stock.Cancel);

			btnSaveAndQuit.Clicked += SaveAndQuit;
			btnQuit.Clicked += Quit;
			btnCancel.Clicked += Cancel;

			this.ActionArea.PackStart (btnCancel);
			this.ActionArea.PackStart (btnQuit);
			this.ActionArea.PackStart (btnSaveAndQuit);
			this.SetDefaultSize (300, 200);
			this.Child.ShowAll ();
		}
Example #6
0
		private TreeView CreateTree ()
		{
			TreeView view = new TreeView ();
			view.Model = FillTree ();

			CellRendererText cr = new CellRendererText ();
			TreeViewColumn column = new TreeViewColumn ("Widget (double click for demo)", cr, "text", 0);
			column.AddAttribute (cr, "style" , 2);
			view.AppendColumn (column);

			view.Selection.Changed += new EventHandler (TreeChanged);
			view.RowActivated += new RowActivatedHandler (RowActivated);
			view.ExpandAll ();
			view.SetSizeRequest (200, -1);
			view.Selection.Mode = Gtk.SelectionMode.Browse;
			return view;
		}
        public DirtyFilesDialog()
            : base(GettextCatalog.GetString ("Save Files"), (Gtk.Window)WorkbenchSingleton.Workbench, DialogFlags.Modal)
        {
            tsFiles = new TreeStore (typeof (string), typeof (bool), typeof (SdiWorkspaceWindow), typeof (bool));
            tvFiles = new TreeView (tsFiles);
            TreeIter topCombineIter = TreeIter.Zero;
            Hashtable projectIters = new Hashtable ();
            if (Runtime.ProjectService.CurrentOpenCombine != null) {
                topCombineIter = tsFiles.AppendValues (String.Format (GettextCatalog.GetString ("Solution: {0}"), Runtime.ProjectService.CurrentOpenCombine.Name), true, null, false);
            }
            foreach (IViewContent viewcontent in WorkbenchSingleton.Workbench.ViewContentCollection) {
                if (!viewcontent.IsDirty)
                    continue;

                if (viewcontent.HasProject) {
                    TreeIter projIter = TreeIter.Zero;
                    if (projectIters.ContainsKey (viewcontent.Project))
                        projIter = (TreeIter) projectIters[viewcontent.Project];
                    else {
                        if (topCombineIter.Equals (TreeIter.Zero))
                            projIter = tsFiles.AppendValues (String.Format (GettextCatalog.GetString ("Project: {0}"), viewcontent.Project.Name), true, null, false);
                        else
                            projIter = tsFiles.AppendValues (topCombineIter, String.Format (GettextCatalog.GetString ("Project: {0}"), viewcontent.Project.Name), true, null, false);
                        projectIters[viewcontent.Project] = projIter;
                    }
                    tsFiles.AppendValues (projIter, viewcontent.PathRelativeToProject, true, viewcontent.WorkbenchWindow);
                } else {
                    if (viewcontent.ContentName == null) {
                        viewcontent.ContentName = System.IO.Path.Combine (Environment.GetEnvironmentVariable ("HOME"), viewcontent.UntitledName);
                    }
                    tsFiles.AppendValues (viewcontent.ContentName, true, viewcontent.WorkbenchWindow);
                }
            }
            if (!topCombineIter.Equals (TreeIter.Zero)) {
                if (!tsFiles.IterHasChild (topCombineIter))
                    tsFiles.Remove (ref topCombineIter);
            }

            TreeViewColumn mainColumn = new TreeViewColumn ();
            mainColumn.Title = "header";

            CellRendererToggle togRender = new CellRendererToggle ();
            togRender.Toggled += new ToggledHandler (toggled);
            mainColumn.PackStart (togRender, false);
            mainColumn.AddAttribute (togRender, "active", 1);
            mainColumn.AddAttribute (togRender, "inconsistent", 3);

            CellRendererText textRender = new CellRendererText ();
            mainColumn.PackStart (textRender, true);
            mainColumn.AddAttribute (textRender, "text", 0);

            tvFiles.AppendColumn (mainColumn);
            tvFiles.HeadersVisible = false;
            tvFiles.ExpandAll ();

            ScrolledWindow sc = new ScrolledWindow ();
            sc.Add (tvFiles);
            sc.ShadowType = ShadowType.In;

            sc.BorderWidth = 6;
            this.VBox.PackStart (sc, true, true, 6);

            btnSaveAndQuit = new Button (GettextCatalog.GetString ("_Save and Quit"));
            btnQuit = new Button (Gtk.Stock.Quit);
            btnCancel = new Button (Gtk.Stock.Cancel);

            btnSaveAndQuit.Clicked += new EventHandler (SaveAndQuit);
            btnQuit.Clicked += new EventHandler (Quit);
            btnCancel.Clicked += new EventHandler (Cancel);

            this.ActionArea.PackStart (btnCancel);
            this.ActionArea.PackStart (btnQuit);
            this.ActionArea.PackStart (btnSaveAndQuit);
            this.SetDefaultSize (300, 200);
            this.ShowAll ();
        }
Example #8
0
        public AddinView()
        {
            var hbox = new HBox () { Spacing = 6 };

            var filter_label = new Label (Catalog.GetString ("Show:"));
            var filter_combo = new ComboBoxText ();
            filter_combo.AppendText (Catalog.GetString ("All"));
            filter_combo.AppendText (Catalog.GetString ("Enabled"));
            filter_combo.AppendText (Catalog.GetString ("Not Enabled"));
            filter_combo.Active = 0;

            var search_label = new Label (Catalog.GetString ("Search:"));
            var search_entry = new Banshee.Widgets.SearchEntry () {
                WidthRequest = 160,
                Visible = true,
                Ready = true
            };

            hbox.PackStart (filter_label, false, false, 0);
            hbox.PackStart (filter_combo, false, false, 0);
            hbox.PackEnd   (search_entry, false, false, 0);
            hbox.PackEnd   (search_label, false, false, 0);

            var model = new TreeStore (typeof(bool), typeof(bool), typeof (string), typeof (Addin));

            var addins = AddinManager.Registry.GetAddins ().Where (a => { return
                a.Name != a.Id && a.Description != null &&
                !String.IsNullOrEmpty (a.Description.Category) && !a.Description.Category.StartsWith ("required:") &&
                (!a.Description.Category.Contains ("Debug") || ApplicationContext.Debugging);
            });

            var categorized_addins = addins.GroupBy<Addin, string> (a => a.Description.Category)
                                           .Select (c => new {
                                                Addins = c.OrderBy (a => Catalog.GetString (a.Name)).ToList (),
                                                Name = c.Key,
                                                NameLocalized = Catalog.GetString (c.Key) })
                                           .OrderBy (c => c.NameLocalized)
                                           .ToList ();

            tree_view = new TreeView () {
                FixedHeightMode = false,
                HeadersVisible = false,
                SearchColumn = 1,
                RulesHint = true,
                Model = model
            };

            var update_model = new System.Action (() => {
                string search = search_entry.Query;
                bool? enabled = filter_combo.Active > 0 ? (bool?) (filter_combo.Active == 1 ? true : false) : null;
                model.Clear ();
                foreach (var cat in categorized_addins) {
                    var cat_iter = model.AppendValues (false, false, String.Format ("<b>{0}</b>", GLib.Markup.EscapeText (cat.NameLocalized)), null);
                    bool any = false;
                    foreach (var a in cat.Addins.Matching (search)) {
                        if (enabled == null || (a.Enabled == enabled.Value)) {
                            model.AppendValues (cat_iter, true,
                                a.Enabled,
                                String.Format (
                                    "<b>{0}</b>\n<small>{1}</small>",
                                    GLib.Markup.EscapeText (Catalog.GetString (a.Name)),
                                    GLib.Markup.EscapeText (Catalog.GetString (a.Description.Description))),
                                a
                            );
                            any = true;
                        }
                    }

                    if (!any) {
                        model.Remove (ref cat_iter);
                    }
                }
                tree_view.ExpandAll ();
            });

            var txt_cell = new CellRendererText () { WrapMode = Pango.WrapMode.Word };
            tree_view.AppendColumn ("Name", txt_cell , "markup", Columns.Name);

            var check_cell = new CellRendererToggle () { Activatable = true };
            tree_view.AppendColumn ("Enable", check_cell, "visible", Columns.IsAddin, "active", Columns.IsEnabled);
            check_cell.Toggled += (o, a) => {
                TreeIter iter;
                if (model.GetIter (out iter, new TreePath (a.Path))) {
                    var addin = model.GetValue (iter, 3) as Addin;
                    bool enabled = (bool) model.GetValue (iter, 1);
                    addin.Enabled = !enabled;
                    model.SetValue (iter, 1, addin.Enabled);
                    model.Foreach (delegate (ITreeModel current_model, TreePath path, TreeIter current_iter) {
                        var an = current_model.GetValue (current_iter, 3) as Addin;
                        if (an != null) {
                            current_model.SetValue (current_iter, 1, an.Enabled);
                        }
                        return false;
                    });
                }
            };

            update_model ();
            search_entry.Changed += (o, a) => update_model ();
            filter_combo.Changed += (o, a) => update_model ();

            var tree_scroll = new Hyena.Widgets.ScrolledWindow () {
                HscrollbarPolicy = PolicyType.Never
            };
            tree_scroll.AddWithFrame (tree_view);

            Spacing = 6;
            PackStart (hbox, false, false, 0);
            PackStart (tree_scroll, true, true, 0);
            ShowAll ();
            search_entry.GrabFocus ();

            txt_cell.WrapWidth = 300;
        }
Example #9
0
        public DemoMain()
        {
            window = new Gtk.Window("TestForm1");
            Gtk.HBox hbox = new Gtk.HBox(false, 0);
            hbox1 = new Gtk.HBox(false, 0);
            Gtk.HBox hbox2 = new Gtk.HBox(false, 0);
            Gtk.HBox hbox3 = new Gtk.HBox(false, 0);
            hbox.Add(hbox1);
            window.SetDefaultSize(600, 400);
            window.DeleteEvent += new DeleteEventHandler(WindowDelete);

            button1          = new Gtk.Button("button1");
            button1.Clicked += Button1Clicked;
            button2          = new Gtk.Button("button2");
            button3          = new Gtk.Button("button3");
            Gtk.Button button4 = new Gtk.Button("button4");
            button4.Clicked += Button4Clicked;
            Gtk.Button button5 = new Gtk.Button("button5");
            Gtk.Button button6 = new Gtk.Button("button6");
            Gtk.Button button7 = new Gtk.Button("button7");
            button7.Sensitive = false;

            scaleButton1 = new Gtk.ScaleButton(0, 0, 100, 10, new string [0]);

            hbox1.Add(hbox3);
            hbox1.Add(hbox2);
            hbox1.Add(button3);
            hbox1.Add(button2);

            button3.Accessible.Description = "help text 3";
            button3.Sensitive = false;

            label1 = new Gtk.Label("label1");

            textBox1 = new Gtk.Entry();
            Gtk.Entry textBox2 = new Gtk.Entry();
            textBox2.Visibility = false;
            textBox2.Sensitive  = false;
            textBox2.IsEditable = false;
            textBox3            = new Gtk.TextView();
            // TODO: scrollbars
            Gtk.CheckButton checkbox1 = new Gtk.CheckButton("checkbox1");
            Gtk.CheckButton checkbox2 = new Gtk.CheckButton("checkbox2");
            checkbox2.Sensitive = false;

            Gtk.TreeStore   store = new Gtk.TreeStore(typeof(string), typeof(string));
            Gtk.TreeIter [] iters = new Gtk.TreeIter [2];
            iters [0] = store.AppendNode();
            store.SetValues(iters [0], "item 1", "item 1 (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 1a", "item 1a (2)");
            iters [0] = store.AppendNode();
            store.SetValues(iters [0], "item 2", "item 2 (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 2a", "item 2a (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 2b", "item 2b (2)");
            treeView1 = new Gtk.TreeView(store);
            AddTreeViewColumn(treeView1, 0, "column 1");
            treeView1.CollapseAll();

            treeView2 = new Gtk.TreeView(store);
            AddTreeViewColumn(treeView2, 0, "column 1");
            AddTreeViewColumn(treeView2, 1, "column 2");
            treeView2.CollapseAll();
            treeView2.Accessible.Name = "treeView2";

            tableStore = new Gtk.TreeStore(typeof(string), typeof(string), typeof(string), typeof(string));
            iters [0]  = tableStore.AppendNode();
            tableStore.SetValues(iters [0], "False", "Alice", "24", "");
            iters [0] = tableStore.AppendNode();
            tableStore.SetValues(iters [0], "True", "Bob", "28", "");
            dataGridView1 = new Gtk.TreeView(tableStore);
            dataGridView1 = new Gtk.TreeView(tableStore);
            dataGridView1 = new Gtk.TreeView(tableStore);
            AddTreeViewColumn(dataGridView1, 0, "Gender");
            AddTreeViewColumn(dataGridView1, 1, "Name");
            AddTreeViewColumn(dataGridView1, 2, "Age");
            dataGridView1.Accessible.Name = "dataGridView1";

            hboxPanel = new Gtk.HBox();
            Gtk.Button btnRemoveTextBox = new Gtk.Button("Remove");
            btnRemoveTextBox.Clicked += RemoveTextBoxClicked;
            Gtk.Button btnAddTextBox = new Gtk.Button("Add");
            btnAddTextBox.Clicked     += AddTextBoxClicked;
            txtCommand                 = new Gtk.Entry();
            txtCommand.Accessible.Name = "txtCommand";
            Gtk.Button btnRun = new Gtk.Button("Run");
            btnRun.Clicked += btnRunClicked;
            hboxPanel.Add(btnRemoveTextBox);
            hboxPanel.Add(btnAddTextBox);

            Gtk.TreeStore treeStore = new Gtk.TreeStore(typeof(string));
            Gtk.TreeIter  iter      = treeStore.AppendNode();
            treeStore.SetValue(iter, 0, "Item 0");
            iter = treeStore.AppendNode();
            treeStore.SetValue(iter, 0, "Item 1");
            listView1 = new Gtk.TreeView(treeStore);
            AddTreeViewColumn(listView1, 0, "items");
            listView1.Accessible.Name = "listView1";
            listView1.ExpandAll();

            hbox2.Add(button5);
            hbox2.Add(checkbox1);
            hbox2.Add(checkbox2);
            hbox2.Add(button4);
            hbox2.Accessible.Name = "groupBox2";

            hbox3.Add(button7);
            hbox3.Add(button6);
            hbox3.Sensitive       = false;
            hbox3.Accessible.Name = "groupBox3";

            hbox.Add(textBox3);
            hbox.Add(textBox2);
            hbox.Add(textBox1);
            hbox.Add(label1);
            hbox.Add(button1);
            hbox.Add(treeView1);
            hbox.Add(treeView2);
            hbox.Add(listView1);
            hbox.Add(dataGridView1);
            hbox.Add(txtCommand);
            hbox.Add(btnRun);
            hbox.Add(hboxPanel);
            hbox.Add(scaleButton1);

            Gtk.Menu file = new Gtk.Menu();
            file.Append(new Gtk.MenuItem("_New"));
            file.Append(new Gtk.MenuItem("_Open"));
            file.Append(new Gtk.CheckMenuItem("Check"));
            Gtk.MenuItem fileItem = new Gtk.MenuItem("File");
            fileItem.Submenu = file;
            Gtk.Menu edit = new Gtk.Menu();
            edit.Append(new Gtk.MenuItem("_Undo"));
            edit.Append(new Gtk.SeparatorMenuItem());
            edit.Append(new Gtk.MenuItem("_Cut"));
            edit.Append(new Gtk.MenuItem("Copy"));
            edit.Append(new Gtk.MenuItem("_Paste"));
            Gtk.MenuItem editItem = new Gtk.MenuItem("Edit");
            editItem.Submenu = edit;
            Gtk.MenuBar menuBar = new Gtk.MenuBar();
            menuBar.Append(fileItem);
            menuBar.Append(editItem);
            hbox.Add(menuBar);

            hbox.Add(new Gtk.SpinButton(0, 100, 1));
            hbox.Add(new Gtk.ToggleButton("ToggleButton"));
            Gtk.Adjustment adj = new Gtk.Adjustment(50, 0, 100,
                                                    1, 10, 10);
            hbox.Add(new Gtk.VScrollbar(adj));

            window.Add(hbox);
            window.ShowAll();
        }
		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);
		}
Example #11
0
		public DemoMain ()
		{
			window = new Gtk.Window ("TestForm1");
			Gtk.HBox hbox = new Gtk.HBox (false, 0);
			hbox1 = new Gtk.HBox (false, 0);
			Gtk.HBox hbox2 = new Gtk.HBox (false, 0);
			Gtk.HBox hbox3 = new Gtk.HBox (false, 0);
			hbox.Add (hbox1);
			window.SetDefaultSize (600, 400);
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);

			button1 = new Gtk.Button ("button1");
			button1.Clicked += Button1Clicked;
			button2 = new Gtk.Button ("button2");
			button3 = new Gtk.Button ("button3");
			Gtk.Button button4 = new Gtk.Button ("button4");
			button4.Clicked += Button4Clicked;
			Gtk.Button button5 = new Gtk.Button ("button5");
			Gtk.Button button6 = new Gtk.Button ("button6");
			Gtk.Button button7 = new Gtk.Button ("button7");
			button7.Sensitive = false;

			scaleButton1 = new Gtk.ScaleButton (0, 0, 100, 10, new string [0]);

			hbox1.Add (hbox3);
			hbox1.Add (hbox2);
			hbox1.Add (button3);
			hbox1.Add (button2);

			button3.Accessible.Description = "help text 3";
			button3.Sensitive = false;

			label1 = new Gtk.Label ("label1");

			textBox1 = new Gtk.Entry ();
			Gtk.Entry textBox2 = new Gtk.Entry ();
			textBox2.Visibility = false;
			textBox2.Sensitive = false;
			textBox2.IsEditable = false;
			textBox3 = new Gtk.TextView ();
			// TODO: scrollbars
			Gtk.CheckButton checkbox1 = new Gtk.CheckButton ("checkbox1");
			Gtk.CheckButton checkbox2 = new Gtk.CheckButton ("checkbox2");
			checkbox2.Sensitive = false;

			Gtk.TreeStore store = new Gtk.TreeStore (typeof (string), typeof (string));
			Gtk.TreeIter [] iters = new Gtk.TreeIter [2];
			iters [0] = store.AppendNode ();
			store.SetValues (iters [0], "item 1", "item 1 (2)");
			iters [1] = store.AppendNode (iters [0]);
			store.SetValues (iters [1], "item 1a", "item 1a (2)");
			iters [0] = store.AppendNode ();
			store.SetValues (iters [0], "item 2", "item 2 (2)");
			iters [1] = store.AppendNode (iters [0]);
			store.SetValues (iters [1], "item 2a", "item 2a (2)");
			iters [1] = store.AppendNode (iters [0]);
			store.SetValues (iters [1], "item 2b", "item 2b (2)");
			treeView1 = new Gtk.TreeView (store);
			AddTreeViewColumn (treeView1, 0, "column 1");
			treeView1.CollapseAll ();

			treeView2 = new Gtk.TreeView (store);
			AddTreeViewColumn (treeView2, 0, "column 1");
			AddTreeViewColumn (treeView2, 1, "column 2");
			treeView2.CollapseAll ();
			treeView2.Accessible.Name = "treeView2";

			tableStore = new Gtk.TreeStore (typeof (string), typeof (string), typeof (string), typeof (string));
			iters [0] = tableStore.AppendNode ();
			tableStore.SetValues (iters [0], "False", "Alice", "24", "");
			iters [0] = tableStore.AppendNode ();
			tableStore.SetValues (iters [0], "True", "Bob", "28", "");
			dataGridView1 = new Gtk.TreeView (tableStore);
			dataGridView1 = new Gtk.TreeView (tableStore);
			dataGridView1 = new Gtk.TreeView (tableStore);
			AddTreeViewColumn (dataGridView1, 0, "Gender");
			AddTreeViewColumn (dataGridView1, 1, "Name");
			AddTreeViewColumn (dataGridView1, 2, "Age");
			dataGridView1.Accessible.Name = "dataGridView1";

			hboxPanel = new Gtk.HBox ();
			Gtk.Button btnRemoveTextBox = new Gtk.Button ("Remove");
			btnRemoveTextBox.Clicked += RemoveTextBoxClicked;
			Gtk.Button btnAddTextBox = new Gtk.Button ("Add");
			btnAddTextBox.Clicked += AddTextBoxClicked;
			txtCommand = new Gtk.Entry ();
			txtCommand.Accessible.Name = "txtCommand";
			Gtk.Button btnRun = new Gtk.Button ("Run");
			btnRun.Clicked += btnRunClicked;
			hboxPanel.Add (btnRemoveTextBox);
			hboxPanel.Add (btnAddTextBox);

			Gtk.TreeStore treeStore = new Gtk.TreeStore (typeof (string));
			Gtk.TreeIter iter = treeStore.AppendNode ();
			treeStore.SetValue (iter, 0, "Item 0");
			iter = treeStore.AppendNode ();
			treeStore.SetValue (iter, 0, "Item 1");
			listView1 = new Gtk.TreeView (treeStore);
			AddTreeViewColumn (listView1, 0, "items");
			listView1.Accessible.Name = "listView1";
			listView1.ExpandAll ();

			hbox2.Add (button5);
			hbox2.Add (checkbox1);
			hbox2.Add (checkbox2);
			hbox2.Add (button4);
			hbox2.Accessible.Name = "groupBox2";

			hbox3.Add (button7);
			hbox3.Add (button6);
			hbox3.Sensitive = false;
			hbox3.Accessible.Name = "groupBox3";

			hbox.Add (textBox3);
			hbox.Add (textBox2);
			hbox.Add (textBox1);
			hbox.Add (label1);
			hbox.Add (button1);
			hbox.Add (treeView1);
			hbox.Add (treeView2);
			hbox.Add (listView1);
			hbox.Add (dataGridView1);
			hbox.Add (txtCommand);
			hbox.Add (btnRun);
			hbox.Add (hboxPanel);
			hbox.Add (scaleButton1);

			Gtk.Menu file = new Gtk.Menu ();
			file.Append (new Gtk.MenuItem ("_New"));
			file.Append (new Gtk.MenuItem ("_Open"));
			file.Append (new Gtk.CheckMenuItem ("Check"));
			Gtk.MenuItem fileItem = new Gtk.MenuItem ("File");
			fileItem.Submenu = file;
			Gtk.Menu edit = new Gtk.Menu ();
			edit.Append (new Gtk.MenuItem ("_Undo"));
			edit.Append (new Gtk.SeparatorMenuItem ());
			edit.Append (new Gtk.MenuItem ("_Cut"));
			edit.Append (new Gtk.MenuItem ("Copy"));
			edit.Append (new Gtk.MenuItem ("_Paste"));
			Gtk.MenuItem editItem = new Gtk.MenuItem ("Edit");
			editItem.Submenu = edit;
			Gtk.MenuBar menuBar = new Gtk.MenuBar ();
			menuBar.Append (fileItem);
			menuBar.Append (editItem);
			hbox.Add (menuBar);

		hbox.Add (new Gtk.SpinButton (0, 100, 1));
		hbox.Add (new Gtk.ToggleButton ("ToggleButton"));
			Gtk.Adjustment adj = new Gtk.Adjustment (50, 0, 100,
				1, 10, 10);
		hbox.Add (new Gtk.VScrollbar (adj));

			window.Add (hbox);
			window.ShowAll ();
		}