Exemplo n.º 1
0
        public void AddItem(IMusixMenuItem item)
        {
            Items.Add(item);
            MusixDynamicSidebarItem sidebarItem = new MusixDynamicSidebarItem(item);

            sidebarItem.SendStyle(Style);
            sidebarItem.OnSelect += SidebarItem_OnSelect;
            flowElements.Controls.Add(sidebarItem);
        }
Exemplo n.º 2
0
        public void SelectItem(IMusixMenuItem item)
        {
            MusixDynamicSidebarItem it = GetUIElement(item);

            if (it != null)
            {
                it.IsSelected = true;
            }
        }
Exemplo n.º 3
0
        public void RemoveItem(IMusixMenuItem item)
        {
            MusixDynamicSidebarItem UIElement = GetUIElement(item);

            if (UIElement != null)
            {
                UIElement.OnSelect -= SidebarItem_OnSelect;
                Items.Remove(item);
                flowElements.Controls.Remove(UIElement);
                return;
            }
        }
Exemplo n.º 4
0
        public void SelectItemAtIndex(int index)
        {
            IMusixMenuItem item = Items[index];

            System.Console.WriteLine($"Index {index} > {item.Name}");
            MusixDynamicSidebarItem menuItem = GetUIElement(item);

            System.Console.WriteLine($"Resolved entry index: {flowElements.Controls.IndexOf(menuItem)}");
            if (menuItem != null)
            {
                System.Console.WriteLine("setselected");
                menuItem.IsSelected = true;
            }
        }
Exemplo n.º 5
0
 public void CheckHover(MusixDynamicSidebarItem item, Point ctPoint)
 {
     if (IsInControl(item, ctPoint))
     {
         if (!item.IsHover)
         {
             item.IsHover = true;
         }
     }
     else
     {
         if (item.IsHover)
         {
             item.IsHover = false;
         }
     }
 }
Exemplo n.º 6
0
 private void SidebarItem_OnSelect(MusixDynamicSidebarItem item)
 {
     if (item == SelectedItem)
     {
         return;
     }
     else
     {
         SelectedItem = item;
     }
     item.MenuItem.OnSelect();
     OnSelectionChanged?.Invoke(item.MenuItem);
     foreach (MusixDynamicSidebarItem sidebarItem in flowElements.Controls.OfType <MusixDynamicSidebarItem>())
     {
         if (sidebarItem != item && sidebarItem.IsSelected)
         {
             sidebarItem.IsSelected = false;
             sidebarItem.MenuItem.OnDeselect();
         }
     }
 }
Exemplo n.º 7
0
 public void RemoveItem(MusixDynamicSidebarItem item)
 {
     item.OnSelect -= SidebarItem_OnSelect;
     Items.Remove(item.MenuItem);
     flowElements.Controls.Remove(item);
 }