Example #1
0
        internal void ButtonSelected(HoverButton button)
        {
            // If a heading is clicked, hide/show all buttons below
            if (button.IsHeading)
            {
                if (!button.ChildrenAreHidden)
                {
                    HideChildren(button);
                }
                else
                {
                    ShowChildren(button);
                }
                return;
            }
            if (SelectedButton != null)
            {
                SelectedButton.Unselect();
            }
            SelectedButton = button;

            if (ButtonClickedEvent != null)
            {
                ButtonClickedEvent(null, button.Text.Trim(), button.Tag);
            }
        }
Example #2
0
        private void HideChildren(HoverButton button)
        {
            if (button.IsHeading)
            {
                // Hide the children of this heading
                int  currentBottom          = button.Bottom;
                bool haveReachedNextHeading = false;

                for (int i = button.Index + 1; i < Buttons.Count; i++)
                {
                    HoverButton nextButton = (HoverButton)Buttons[i];

                    if (nextButton.IsHeading)
                    {
                        haveReachedNextHeading = true;
                    }
                    if (!haveReachedNextHeading)
                    {
                        nextButton.Visible = false;
                    }
                    else
                    {
                        nextButton.Top = currentBottom;
                        currentBottom += nextButton.Height;
                    }
                }
                button.ChildrenAreHidden = true;
            }
            else
            {
                throw new InvalidOperationException("HideChildren can only be called by Heading buttons.");
            }
        }
Example #3
0
        public void Add(HoverButton button)
        {
            Slyce.Common.Utility.CheckForNulls(new object[] { button }, new string[] { "button" });
            ButtonHeight      = button.Height;
            button.Width      = this.ClientSize.Width;
            button.ParentList = this;
            button.Left       = 0;

            if (Buttons.Count > 0)
            {
                HoverButton prevButton = (HoverButton)Buttons[Buttons.Count - 1];
                button.Top = prevButton.Top + prevButton.Height;
            }
            else
            {
                button.Top = 0;
            }
            panel.Controls.Add(button);
            Buttons.Add(button);
        }
Example #4
0
        private void ShowChildren(HoverButton button)
        {
            if (button.IsHeading)
            {
                // Hide the children of this heading
                int currentBottom = button.Bottom;
                bool haveReachedNextHeading = false;

                for (int i = button.Index + 1; i < Buttons.Count; i++)
                {
                    HoverButton nextButton = (HoverButton)Buttons[i];

                    if (nextButton.IsHeading)
                    {
                        haveReachedNextHeading = true;
                    }
                    if (!haveReachedNextHeading && !nextButton.Visible)
                    {
                        nextButton.Visible = true;
                        nextButton.Top = currentBottom;
                        currentBottom = nextButton.Bottom;
                    }
                    else if (haveReachedNextHeading && nextButton.Visible)
                    {
                        nextButton.Top = currentBottom;
                        currentBottom = nextButton.Bottom;
                    }
                }
                button.ChildrenAreHidden = false;
            }
            else
            {
                throw new InvalidOperationException("HideChildren can only be called by Heading buttons.");
            }
        }
Example #5
0
        internal void ButtonSelected(HoverButton button)
        {
            // If a heading is clicked, hide/show all buttons below
            if (button.IsHeading)
            {
                if (!button.ChildrenAreHidden)
                {
                    HideChildren(button);
                }
                else
                {
                    ShowChildren(button);
                }
                return;
            }
            if (SelectedButton != null)
            {
                SelectedButton.Unselect();
            }
            SelectedButton = button;

            if (ButtonClickedEvent != null)
            {
                ButtonClickedEvent(null, button.Text.Trim(), button.Tag);
            }
        }
Example #6
0
        public void Add(HoverButton button)
        {
            Slyce.Common.Utility.CheckForNulls(new object[] { button }, new string[] { "button" });
            ButtonHeight = button.Height;
            button.Width = this.ClientSize.Width;
            button.ParentList = this;
            button.Left = 0;

            if (Buttons.Count > 0)
            {
                HoverButton prevButton = (HoverButton)Buttons[Buttons.Count - 1];
                button.Top = prevButton.Top + prevButton.Height;
            }
            else
            {
                button.Top = 0;
            }
            panel.Controls.Add(button);
            Buttons.Add(button);
        }