示例#1
0
        // 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);
                    };
                    container.Add(helpButton);
                }
            }
            this.ShowAll();
        }
        protected virtual void OnChildAdded(VisualElement view)
        {
            var viewRenderer = Platform.CreateRenderer(view);

            Platform.SetRenderer(view, viewRenderer);

            Gtk.Container container = Renderer.Container;
            container?.Add(viewRenderer.Container);
            viewRenderer.Container.ShowAll();
        }
示例#3
0
 public static void Add(Gtk.Container aContainer, Widget aWidget)
 {
     if (aWidget == null)
     {
         return;
     }
     if (aContainer == null)
     {
         throw new Exception("Adding widget to null container");
     }
     aContainer.Add(aWidget);
 }
示例#4
0
        // 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++)
            {
                if (widgetLists[i][1] is ComboBoxFromConstants) // These deal with documentation themselves
                {
                    continue;
                }

                Gtk.Container container = widgetLists[i][2] as Gtk.Container;
                if (container == null)
                {
                    continue;
                }

                bool isHelpButton = true;

                // Remove previous help button
                foreach (Gtk.Widget widget in container.Children)
                {
                    // Really hacky way to check whether this is the help button as we expect, or
                    // whether the "AddWidgetToRight" function was called to replace it, in which
                    // case we don't try to add the help button at all
                    if (!(widget is Gtk.Button && (widget as Gtk.Button).Label == "?"))
                    {
                        isHelpButton = false;
                        continue;
                    }
                    container.Remove(widget);
                    widget.Dispose();
                }

                if (!isHelpButton)
                {
                    continue;
                }

                ValueReference r = refs[i];
                if (r.Documentation != null)
                {
                    Gtk.Button helpButton = new Gtk.Button("?");
                    helpButton.FocusOnClick = false;
                    helpButton.Clicked     += delegate(object sender, EventArgs e) {
                        DocumentationDialog d = new DocumentationDialog(r.Documentation);
                    };
                    container.Add(helpButton);
                }
            }
            this.ShowAll();
        }