// Check if there are entries that should have help buttons public void UpdateHelpButtons() { IList <ValueReference> refs = valueReferenceGroup.GetValueReferences(); for (int i = 0; i < refs.Count; i++) { Gtk.Container container = helpButtonContainers[i]; if (container == null) { continue; } // Remove previous help button foreach (Gtk.Widget widget in container.Children) { container.Remove(widget); widget.Destroy(); } ValueReference r = refs[i]; if (r.Documentation != null) { Gtk.Button helpButton = new Gtk.Button("?"); helpButton.CanFocus = false; helpButton.Clicked += delegate(object sender, EventArgs e) { DocumentationDialog d = new DocumentationDialog(r.Documentation); d.Run(); d.Destroy(); }; container.Add(helpButton); } } this.ShowAll(); }
// TODO: pass in a label which it will update with the name from the combobox? public ComboBoxFromConstants(bool showHelp = true) { this.Build(); if (showHelp) { // When clicking the "help" button, create a popup with documentation for // possible values. (It checks for a "@values" field in the documentation.) Gtk.Button helpButton = new Gtk.Button("?"); helpButton.CanFocus = false; helpButton.Clicked += delegate(object sender, EventArgs e) { if (DefaultDocumentation == null) { return; } DocumentationDialog d = new DocumentationDialog(DefaultDocumentation); d.Run(); d.Destroy(); }; hbox1.PackStart(helpButton, false, false, 0); } }