public bool HandleInput(MyGuiInput input, bool hasKeyboardActiveControl, bool hasKeyboardActiveControlPrevious, bool receivedFocusInThisUpdate) { var oldHooveredItem = HooveredItem; HooveredItem = null; bool captured = m_body.HandleInput(input, hasKeyboardActiveControl, hasKeyboardActiveControlPrevious, receivedFocusInThisUpdate) || m_vScrollbar.HandleInput(input, hasKeyboardActiveControl, hasKeyboardActiveControlPrevious, receivedFocusInThisUpdate) || m_hScrollbar.HandleInput(input, hasKeyboardActiveControl, hasKeyboardActiveControlPrevious, receivedFocusInThisUpdate); if (hasKeyboardActiveControl) { if (FocusedItem == null && m_body.GetItemCount() > 0 && (input.IsNewKeyPress(Keys.Up) || input.IsNewKeyPress(Keys.Down) || input.IsNewKeyPress(Keys.Left) || input.IsNewKeyPress(Keys.Right) || input.DeltaMouseScrollWheelValue() != 0)) { FocusItem(m_body[0]); } else if (FocusedItem != null) { if (input.IsNewKeyPress(Keys.Down) || (input.DeltaMouseScrollWheelValue() < 0 && Contains(MyGuiManager.MouseCursorPosition.X, MyGuiManager.MouseCursorPosition.Y))) { FocusItem(NextVisible(m_body, FocusedItem)); } if (input.IsNewKeyPress(Keys.Up) || (input.DeltaMouseScrollWheelValue() > 0 && Contains(MyGuiManager.MouseCursorPosition.X, MyGuiManager.MouseCursorPosition.Y))) { FocusItem(PrevVisible(m_body, FocusedItem)); } if (input.IsNewKeyPress(Keys.Right)) { if (FocusedItem.GetItemCount() > 0) { if (!FocusedItem.IsExpanded) { FocusedItem.IsExpanded = true; } else { var next = NextVisible(FocusedItem, FocusedItem); FocusItem(next); } } } if (input.IsNewKeyPress(Keys.Left)) { if (FocusedItem.GetItemCount() > 0 && FocusedItem.IsExpanded) { FocusedItem.IsExpanded = false; } else if (FocusedItem.Parent is MyTreeViewItem) { FocusItem(FocusedItem.Parent as MyTreeViewItem); } } if (FocusedItem.GetItemCount() > 0) { if (input.IsNewKeyPress(Keys.Add)) { FocusedItem.IsExpanded = true; } if (input.IsNewKeyPress(Keys.Subtract)) { FocusedItem.IsExpanded = false; } } } if (input.IsNewKeyPress(Keys.PageDown)) { m_vScrollbar.PageDown(); } if (input.IsNewKeyPress(Keys.PageUp)) { m_vScrollbar.PageUp(); } captured = captured || input.IsNewKeyPress(Keys.PageDown) || input.IsNewKeyPress(Keys.PageUp) || input.IsNewKeyPress(Keys.Down) || input.IsNewKeyPress(Keys.Up) || input.IsNewKeyPress(Keys.Left) || input.IsNewKeyPress(Keys.Right) || input.IsNewKeyPress(Keys.Add) || input.IsNewKeyPress(Keys.Subtract) || input.DeltaMouseScrollWheelValue() != 0; } // Hoovered item changed if (HooveredItem != oldHooveredItem) { m_control.ShowToolTip(HooveredItem == null ? null : HooveredItem.ToolTip); MyAudio.AddCue2D(MySoundCuesEnum.GuiMouseOver); } return(captured); }