private void RefreshQueue()
        {
            m_queueGrid.Clear();
            int i = 0;
            foreach (var queueItem in m_selectedAssembler.Queue)
            {
                m_textCache.Clear()
                    .Append((int)queueItem.Amount)
                    .Append('x');

                var item = new MyGuiControlGrid.Item(
                    icon: queueItem.Blueprint.Icon,
                    toolTip: queueItem.Blueprint.DisplayNameText,
                    userData: queueItem);
                item.AddText(text: m_textCache, textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);

                if (MyFakes.SHOW_PRODUCTION_QUEUE_ITEM_IDS)
                {
                    m_textCache.Clear()
                        .Append((int)queueItem.ItemId);

                    item.AddText(text: m_textCache, textAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);
                }

                m_queueGrid.Add(item);
                ++i;
            }

            m_queueGrid.RowsCount = Math.Max(1 + (i / m_queueGrid.ColumnsCount), QUEUE_GRID_ROWS);
            RefreshProgress();
        }
        public static MyGuiControlGrid.Item CreateInventoryGridItem(MyPhysicalInventoryItem item)
        {
            var definition = MyDefinitionManager.Static.GetPhysicalItemDefinition(item.Content);

            var itemMass = definition.Mass * (double)item.Amount;
            var itemVolume = definition.Volume * 1000 * (double)item.Amount;

            var gridItem = new MyGuiControlGrid.Item(
                icon: definition.Icon,
                userData: item,
                toolTip: new StringBuilder().AppendFormat(MyTexts.GetString(MySpaceTexts.ToolTipTerminalInventory_ItemInfo),
                    definition.DisplayNameText,
                    (itemMass < 0.01) ? "<0.01" : itemMass.ToString(MyInventoryConstants.GUI_DISPLAY_FORMAT, CultureInfo.InvariantCulture),
                    (itemVolume < 0.01) ? "<0.01" : itemVolume.ToString(MyInventoryConstants.GUI_DISPLAY_FORMAT, CultureInfo.InvariantCulture),
                    (item.Content.Flags == MyItemFlags.Damaged ? MyTexts.Get(MySpaceTexts.ItemDamagedDescription) : MyTexts.Get(MySpaceTexts.Blank))).ToString());
            if (MyFakes.SHOW_INVENTORY_ITEM_IDS)
            {
                gridItem.ToolTip.AddToolTip(new StringBuilder().AppendFormat("ItemID: {0}", item.ItemId).ToString());
            }
            FormatItemAmount(item, m_textCache);
            gridItem.AddText(m_textCache, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);
            m_textCache.Clear();

            if (definition.IconSymbol.HasValue)
                gridItem.AddText(MyTexts.Get(definition.IconSymbol.Value), MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
            return gridItem;
        }
 private void SetGridItemAt(int slot, MyToolbarItem item, string icon, string subicon, String tooltip, Sandbox.Graphics.GUI.MyGuiControlGrid.ColoredIcon? symbol = null)
 {
     var gridItem = m_toolbarItemsGrid.GetItemAt(slot);
     if (gridItem == null)
     {
         gridItem = new MyGuiControlGrid.Item(
             icon: icon,
             subicon: subicon,
             toolTip: tooltip,
             userData: item);
         if(DrawNumbers)
             gridItem.AddText(MyToolbarComponent.GetSlotControlText(slot));
         //Ammo amount in toolbar
         if (item != null)
             gridItem.AddText(item.IconText, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
         else
             gridItem.ClearText(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
         gridItem.Enabled = (item != null) ? item.Enabled : true;
         if(symbol.HasValue)
             gridItem.AddIcon(symbol.Value, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
         m_toolbarItemsGrid.SetItemAt(slot, gridItem);
     }
     else
     {
         gridItem.UserData = item;
         gridItem.Icon = icon;
         gridItem.SubIcon = subicon;
         if (gridItem.ToolTip == null)
             gridItem.ToolTip = new MyToolTips();
         gridItem.ToolTip.ToolTips.Clear();
         gridItem.ToolTip.AddToolTip(tooltip);
         //Ammo amount in toolbar
         if (item != null)
             gridItem.AddText(item.IconText, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
         else
             gridItem.ClearText(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
         gridItem.Enabled = (item != null) ? item.Enabled : true;
         if (symbol.HasValue)
             gridItem.AddIcon(symbol.Value, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
     }
 }