예제 #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);
        }
예제 #2
0
        public void SelectItem(IMusixMenuItem item)
        {
            MusixDynamicSidebarItem it = GetUIElement(item);

            if (it != null)
            {
                it.IsSelected = true;
            }
        }
예제 #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;
            }
        }
예제 #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;
            }
        }
예제 #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;
         }
     }
 }
예제 #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();
         }
     }
 }
예제 #7
0
 public void RemoveItem(MusixDynamicSidebarItem item)
 {
     item.OnSelect -= SidebarItem_OnSelect;
     Items.Remove(item.MenuItem);
     flowElements.Controls.Remove(item);
 }