public HelpTree () : base (GettextCatalog.GetString ("Help"), Gtk.Stock.Help) { tree_view = new MonoDevelop.Ide.Gui.Components.PadTreeView (); tree_view.AppendColumn ("name_col", tree_view.TextRenderer, "text", 0); tree_view.RowExpanded += new Gtk.RowExpandedHandler (RowExpanded); tree_view.Selection.Changed += new EventHandler (RowActivated); store = new TreeStore (typeof (string), typeof (Node)); tree_view.Model = store; tree_view.HeadersVisible = false; scroller = new MonoDevelop.Components.CompactScrolledWindow (); scroller.ShadowType = Gtk.ShadowType.None; scroller.Add (tree_view); if (HelpService.HelpTree != null) { root_iter = store.AppendValues (GettextCatalog.GetString ("Mono Documentation"), HelpService.HelpTree); PopulateNode (root_iter); tree_view.ExpandRow (new TreePath ("0"), false); TreeIter child_iter; start: if (store.IterChildren (out child_iter, root_iter)) { do { if (!store.IterHasChild (child_iter)) { store.Remove (ref child_iter); goto start; } } while (store.IterNext (ref child_iter)); } } Control.ShowAll (); }
void RowActivated(object o, EventArgs e) { Gtk.TreeIter iter; Gtk.TreeModel model; if (tree_view.Selection.GetSelected(out model, out iter)) { var path = store.GetPath(iter); if (path.Equals(store.GetPath(root_iter))) { return; } if (store.IterHasChild(iter)) { tree_view.ExpandRow(path, false); return; } Node n = (Node)store.GetValue(iter, 1); IdeApp.HelpOperations.ShowHelp(n.PublicUrl); } }
public HelpTree() : base(GettextCatalog.GetString("Help"), Gtk.Stock.Help) { tree_view = new MonoDevelop.Ide.Gui.Components.PadTreeView(); tree_view.AppendColumn("name_col", tree_view.TextRenderer, "text", 0); tree_view.RowExpanded += new Gtk.RowExpandedHandler(RowExpanded); tree_view.Selection.Changed += new EventHandler(RowActivated); store = new TreeStore(typeof(string), typeof(Node)); tree_view.Model = store; tree_view.HeadersVisible = false; scroller = new MonoDevelop.Components.CompactScrolledWindow(); scroller.ShadowType = Gtk.ShadowType.None; scroller.Add(tree_view); if (HelpService.HelpTree != null) { root_iter = store.AppendValues(GettextCatalog.GetString("Mono Documentation"), HelpService.HelpTree); PopulateNode(root_iter); tree_view.ExpandRow(new TreePath("0"), false); TreeIter child_iter; start: if (store.IterChildren(out child_iter, root_iter)) { do { if (!store.IterHasChild(child_iter)) { store.Remove(ref child_iter); goto start; } }while (store.IterNext(ref child_iter)); } } Control.ShowAll(); }