private void UpdateItemAtIndex(MyToolbar toolbar, int index) { Debug.Assert(toolbar == m_shownToolbar); int slot = toolbar.IndexToSlot(index); if (!toolbar.IsValidIndex(index) || !toolbar.IsValidSlot(slot)) { return; } SetGridItemAt(slot, toolbar[index], clear: true); if (toolbar.SelectedSlot == slot) { RefreshSelectedItem(toolbar); } }
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 UpdateItemIcon(MyToolbar toolbar, MyToolbar.IndexArgs args) { if (toolbar.IsValidIndex(args.ItemIndex)) { var slot = toolbar.IndexToSlot(args.ItemIndex); if (slot != -1) m_toolbarItemsGrid.GetItemAt(slot).Icon = toolbar.GetItemIcon(args.ItemIndex); } else { for (int i = 0; i < m_toolbarItemsGrid.ColumnsCount; ++i) { m_toolbarItemsGrid.GetItemAt(i).Icon = toolbar.GetItemIcon(toolbar.SlotToIndex(i)); } } }
private void UpdateItemAtIndex(MyToolbar toolbar, int index) { Debug.Assert(toolbar == m_shownToolbar); int slot = toolbar.IndexToSlot(index); if (!toolbar.IsValidIndex(index) || !toolbar.IsValidSlot(slot)) return; SetGridItemAt(slot, toolbar[index]); if (toolbar.SelectedSlot == slot) RefreshSelectedItem(toolbar); }