コード例 #1
0
        /// <summary>Opens a widget, passing this timeline as a global.</summary>
        internal Widgets.Widget openWidget(string template)
        {
            if (document == null || template == null)
            {
                Dom.Log.Add("PowerSlide requested to open a widget without a document/ template. Request was ignored.");
                return(null);
            }

            if (currentWidget != null)
            {
                if (currentWidget.Type == template)
                {
                    // Unchanged template.
                    return(currentWidget);
                }

                currentWidget.close();
                currentWidget = null;
            }

            // Open it now:
            currentWidget = document.widgets.open(template, null, "timeline", this);

            return(currentWidget);
        }
コード例 #2
0
        /// <summary>Collects options and displays the menu at the pointers position.
        /// Run this on the 'root' option list only (don't call it on submenu's).</summary>
        public void display(InputPointer ip, bool instant)
        {
            // First, collect the options:
            ContextEvent ce = collectOptions(ip);

            if (instant)
            {
                // Won't actually display - just immediately run op 0:
                run();
                return;
            }

            // Even if it collected nothing, attempt to display it.
            // The event contains the position for us.

            // Get the widget manager:
            Widgets.Manager widgets = (ce.contextDocument as HtmlDocument).widgets;

            // Open a widget (closing an existing one):
            widget = widgets.get(ce.template, null);

            if (widget != null)
            {
                widget.close();
            }

            widget = widgets.open(ce.template, null, buildGlobals(ce));
        }
コード例 #3
0
        /// <summary>Closes any visible version of this list.</summary>
        public void close(bool all)
        {
            if (all && parent != null)
            {
                // Go up the parent tree to close the root.
                parent.close(true);
                return;
            }

            // Clear all option elements:
            for (int i = 0; i < options.Count; i++)
            {
                options[i].buttonElement = null;
            }

            // Got a widget?
            if (widget != null)
            {
                // Yep - close it!
                widget.close();
                widget = null;
            }
        }