Ejemplo n.º 1
0
        public TextMenu(Font font, string[] options, TextAlignment alignment, MenuDirection direction, int columns = 1)
        {
            m_font            = font;
            m_style           = TextStyle.Default;
            m_textColour      = UIColours.Text;
            m_highlightColour = UIColours.Hover;
            m_options         = new Text[options.Length];
            m_optionSet       = new TextMenuOptionSet(this);

            m_alignment = alignment;
            m_direction = direction;
            for (int i = 0; i < m_options.Length; ++i)
            {
                var option = new Text(m_font, options[i], m_textColour, TextAlignment.Left);
                option.Style = m_style;
                m_options[i] = option;
            }
            Enabled   = true;
            MouseOnly = false;

            m_highlight      = -1;
            m_mouseHighlight = false;
            m_minimumWidth   = 0.0f;

            m_showBackground     = false;
            m_backgroundGeometry = new Geometry(Primitive.Triangles, 4 * options.Length, 6 * options.Length);
            m_backgroundTexture  = Texture.Get("gui/inset_button.png", true);
            RecalculateWidth();
        }
Ejemplo n.º 2
0
 private void method_0(object object_0, MenuDirection menuDirection_0)
 {
     if (this.TitleClick != null)
     {
         this.TitleClick(object_0, menuDirection_0);
     }
 }
Ejemplo n.º 3
0
        private void openMenu()
        {
            //menu1.TranslateTo(0, 0 - (1 * (fabMenu.Height + MENU_SEPARATION_PADDING)), 100, Easing.Linear);
            //menu2.TranslateTo(0, 0 - (2 * (fabMenu.Height + MENU_SEPARATION_PADDING)), 150, Easing.Linear);
            //menu3.TranslateTo(0, 0 - (3 * (menu1.Height + MENU_SEPARATION_PADDING)), 200, Easing.Linear);


            menuWrapper.HeightRequest = (menuWrapper.Children.Count * (fabMenu.Height + MENU_SEPARATION_PADDING)); //4= fab items + fab menu
                                                                                                                   //menuWrapper.TranslateTo(0,0- (menuWrapper.HeightRequest/2));


            if (this.VerticalOptions.Equals(LayoutOptions.Center))
            {
                this.TranslateTo(0, 0 - ((menuWrapper.Height / 2) - (fabMenu.Height / 2)), 0, Easing.Linear);
            }
            else if (this.VerticalOptions.Equals(LayoutOptions.End))
            {
                this.TranslateTo(0, 0, 0, Easing.Linear);
            }
            else if (this.VerticalOptions.Equals(LayoutOptions.Start))
            {
                this.TranslateTo(0, 0, 0, Easing.Linear);
                direction = MenuDirection.BOTTOM;
                foreach (View v in menuWrapper.Children)
                {
                    AbsoluteLayout.SetLayoutBounds(v, new Rectangle(0.5, 0, fabMenu.WidthRequest, fabMenu.HeightRequest));
                    AbsoluteLayout.SetLayoutFlags(v, AbsoluteLayoutFlags.PositionProportional);
                }
            }

            uint animDuration = 50;

            for (int index = 0; index < menuWrapper.Children.Count; index++, animDuration += 30)
            {
                View v = menuWrapper.Children[index];

                if (v != fabMenu)
                {
                    if (direction == MenuDirection.TOP)
                    {
                        v.TranslateTo(0, 0 - ((index + 1) * (fabMenu.Height + MENU_SEPARATION_PADDING)), animDuration, Easing.Linear);
                    }
                    else if (direction == MenuDirection.BOTTOM)
                    {
                        v.TranslateTo(0, 0 + ((index + 1) * (fabMenu.Height + MENU_SEPARATION_PADDING)), animDuration, Easing.Linear);
                    }
                }
            }

            isOpen = true;
        }
Ejemplo n.º 4
0
    public void MoveSelected(MenuDirection direction)
    {
        if (InputTimeRemaining > 0)
        {
            return;
        }
        switch (direction)
        {
        case MenuDirection.Left:
            if (_selectedSlot == 0 || _selectedSlot == 6)
            {
                _selectedSlot += 5;
            }
            else
            {
                _selectedSlot--;
            }
            break;

        case MenuDirection.Right:
            if (_selectedSlot == 5 || _selectedSlot == 11)
            {
                _selectedSlot -= 5;
            }
            else
            {
                _selectedSlot++;
            }
            break;

        case MenuDirection.Up:
        case MenuDirection.Down:
            if (_selectedSlot > 5)
            {
                _selectedSlot -= 6;
            }
            else
            {
                _selectedSlot += 6;
            }
            break;
        }
        InputTimeRemaining = InputTimer;
        UpdateSelected();
    }
Ejemplo n.º 5
0
        /// <summary>
        /// Specifies Menu opening direction.
        /// </summary>
        /// <param name="value">The desired direction.</param>
        /// <example>
        /// <code lang="CS">
        ///  &lt;%= Html.Kendo().Menu()
        ///             .Name("Menu")
        ///             .Direction(MenuDirection.Left)
        /// %&gt;
        /// </code>
        /// </example>
        public MenuBuilder Direction(MenuDirection value)
        {
            Component.Direction = value.ToString().ToLower();

            return(this);
        }
Ejemplo n.º 6
0
        public string GetHistory(string sep, MenuDirection menuDirection)
        {
            string key = GetKey(false, "") + "-h";

            if (WebContext.Cache[key] != null)
            {
                return(WebContext.Cache[key].ToString());
            }

            StringBuilder ret = new StringBuilder();

            Regex re = new Regex("&reg;|®", RegexOptions.IgnoreCase);

            ret.Append(re.Replace(this.DisplayName, "<sup>&reg;</sup>"));
            if (menuDirection == MenuDirection.LTR)
            {
                ret.Insert(0, sep);
            }
            else
            {
                ret.Append(sep);
            }

            lwMenu m = this;

            while (m.Parents.Count > 0)
            {
                m = m.Parents[0];
                if (m.IsRoot)
                {
                    break;
                }
                if (menuDirection == MenuDirection.LTR)
                {
                    ret.Insert(0, m.GetLink());
                    ret.Insert(0, sep);
                }
                else
                {
                    ret.Append(m.GetLink());
                    ret.Append(sep);
                }
            }

            if (menuDirection == MenuDirection.LTR)
            {
                ret.Remove(0, sep.Length);
            }
            else
            {
                ret.Remove(ret.Length - sep.Length, sep.Length);
            }

            WebContext.Cache.Insert(
                key,
                ret.ToString(),
                new System.Web.Caching.CacheDependency(WebContext.Server.MapPath("~/App_Code/__Page.cs"))
                );

            return(ret.ToString());
        }
Ejemplo n.º 7
0
 private void method_1(object object_0, MenuDirection menuDirection_0)
 {
     base.Height = this.method_2();
 }
Ejemplo n.º 8
0
        protected virtual void renderMenuArea(HtmlTextWriter writer, List<MenuItem> items, Orientation orient, MenuDirection direction, int numLayers, string cssClass, int itemNumLayers, string itemCssClass, string firstDivId, string menupath)
        {
            renderStartLayers(writer, numLayers, cssClass, null, firstDivId);
            writer.WriteLine("<table border='0' cellspacing='0' cellpadding='0'>");
            writer.Indent++;
            if (orient == Orientation.Horizontal) { writer.WriteLine("<tr>"); writer.Indent++; }
            var includeImgSpan = shouldIncludeImageSpanInSubmenu(Items);
            for (int pos = 0; pos < items.Count; pos++) {
                MenuItem mi = items[pos];
                mi.setupMenuItem();
                if (mi.Visible) {
                    if (orient == Orientation.Vertical) {writer.WriteLine("<tr>"); writer.Indent++; }
                    writer.WriteLine("<td>"); writer.Indent++;

                    //string width100 = orient == Orientation.Horizontal ? string.Empty : "width:100%;";
                    string width100 = string.Empty;

                    string menudir = string.Empty;
                    for (MenuDirection m = MenuDirection.Left; m <= MenuDirection.Down; m = (MenuDirection)((int)m<<1)) {
                        if ((m & direction) != 0) menudir += " MenuDirection" + m.ToString();
                    }

                    if (mi.Items.Count != 0) { writer.WriteLine("<div class='{0} Silversite_Menu_SubMenuParent' style='{1}'>", orient == Orientation.Horizontal ? "VertMenu" : "HorzMenu", width100); writer.Indent++; }
                    string extraClass = string.Empty;

                    if (pos == 0)
                        if (items.Count == 1) extraClass = "FirstChild LastChild";
                        else extraClass = "FirstChild";
                    else if (pos == items.Count - 1) extraClass = "LastChild";

                    if (isMenuItemSelectedPage(mi)) extraClass += " Selected";
                    renderStartLayers(writer, itemNumLayers, itemCssClass, extraClass, null);
                    string target = calcTargetName(mi);
                    if (target.Length != 0)
                        target = string.Format(" target='{0}'", target);

                    var menuitempath = menupath + "," + pos.ToString();

                    string href;
                    if (mi.HandlesClick) {
                        href = Page.ClientScript.GetPostBackClientHyperlink(this, menuitempath.TrimStart(','), false);
                        target = string.Empty;
                    } else {
                        href = getMenuItemNavUrl(mi);
                        href = string.IsNullOrEmpty(href) ? "javascript:;" : ResolveUrl(href);
                    }

                    writer.WriteLine("<a href=\"{0}\"{2} style='display:block;white-space:nowrap;'><div style='white-space:nowrap;cursor:pointer;{3}'>{1}</div></a>",
                        href, getMenuItemHtml(includeImgSpan, mi), target, width100);

                    renderEndLayers(writer, itemNumLayers);
                    if (mi.Items.Count != 0) {
                        string extraSubMenuClass = string.Empty;
                        if (MenuShowEffect != SubMenuShowEffect.display)
                            extraSubMenuClass = MenuShowEffect.ToString() + "Menu" + menudir;
                        writer.WriteLine("</div>"); writer.Indent--;

                        if (scripts) {
                            writer.Write("<div class='");
                            writer.Write(SkinnedSubMenuCssClass);
                            writer.WriteLine(" {0}' style='z-index:1000;position:absolute;display:none;'>", extraSubMenuClass); writer.Indent++;
                            renderMenuArea(writer, mi.Items, Orientation.Vertical, direction, SubMenuNumLayers, SkinnedSubMenuCssClass, SubMenuItemNumLayers, SkinnedSubMenuItemCssClass, null, menuitempath);
                            writer.WriteLine("</div>"); writer.Indent--;
                        }
                    }
                    writer.WriteLine("</td>"); writer.Indent--;
                    if (orient == Orientation.Vertical) { writer.WriteLine("</tr>"); writer.Indent--; }
                }
            }
            if (orient == Orientation.Horizontal) { writer.WriteLine("</tr>"); writer.Indent--; }
            writer.WriteLine("</table>"); writer.Indent--;
            renderEndLayers(writer, numLayers);
        }