private void Toolbar_ItemUpdated(MyToolbar toolbar, MyToolbar.IndexArgs args, MyToolbarItem.ChangeInfo changes) { // Quicker method if only icon changed if (changes == MyToolbarItem.ChangeInfo.Icon) { UpdateItemIcon(toolbar, args); } else { UpdateItemAtIndex(toolbar, args.ItemIndex); } }
private void UpdateItemIcon(MyToolbar toolbar, MyToolbar.IndexArgs args) { if (toolbar.IsValidIndex(args.ItemIndex)) { var slot = toolbar.IndexToSlot(args.ItemIndex); if (slot != -1) { m_toolbarItemsGrid.GetItemAt(slot).Icons = toolbar.GetItemIcons(args.ItemIndex); } } else { for (int i = 0; i < m_toolbarItemsGrid.ColumnsCount; ++i) { m_toolbarItemsGrid.GetItemAt(i).Icons = toolbar.GetItemIcons(toolbar.SlotToIndex(i)); } } }
private void Toolbar_ItemChanged(MyToolbar toolbar, MyToolbar.IndexArgs args) { UpdateItemAtIndex(toolbar, args.ItemIndex); }