public bool HandleInput() { var oldHooveredItem = HooveredItem; HooveredItem = null; bool captured = m_body.HandleInput(m_control.HasFocus) || m_vScrollbar.HandleInput() || m_hScrollbar.HandleInput(); if (m_control.HasFocus) { if (FocusedItem == null && m_body.GetItemCount() > 0 && (MyInput.Static.IsNewKeyPressed(MyKeys.Up) || MyInput.Static.IsNewKeyPressed(MyKeys.Down) || MyInput.Static.IsNewKeyPressed(MyKeys.Left) || MyInput.Static.IsNewKeyPressed(MyKeys.Right) || MyInput.Static.DeltaMouseScrollWheelValue() != 0)) { FocusItem(m_body[0]); } else if (FocusedItem != null) { if (MyInput.Static.IsNewKeyPressed(MyKeys.Down) || (MyInput.Static.DeltaMouseScrollWheelValue() < 0 && Contains(MyGuiManager.MouseCursorPosition.X, MyGuiManager.MouseCursorPosition.Y))) { FocusItem(NextVisible(m_body, FocusedItem)); } if (MyInput.Static.IsNewKeyPressed(MyKeys.Up) || (MyInput.Static.DeltaMouseScrollWheelValue() > 0 && Contains(MyGuiManager.MouseCursorPosition.X, MyGuiManager.MouseCursorPosition.Y))) { FocusItem(PrevVisible(m_body, FocusedItem)); } if (MyInput.Static.IsNewKeyPressed(MyKeys.Right)) { if (FocusedItem.GetItemCount() > 0) { if (!FocusedItem.IsExpanded) { FocusedItem.IsExpanded = true; } else { var next = NextVisible(FocusedItem, FocusedItem); FocusItem(next); } } } if (MyInput.Static.IsNewKeyPressed(MyKeys.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 (MyInput.Static.IsNewKeyPressed(MyKeys.Add)) { FocusedItem.IsExpanded = true; } if (MyInput.Static.IsNewKeyPressed(MyKeys.Subtract)) { FocusedItem.IsExpanded = false; } } } if (MyInput.Static.IsNewKeyPressed(MyKeys.PageDown)) { m_vScrollbar.PageDown(); } if (MyInput.Static.IsNewKeyPressed(MyKeys.PageUp)) { m_vScrollbar.PageUp(); } captured = captured || MyInput.Static.IsNewKeyPressed(MyKeys.PageDown) || MyInput.Static.IsNewKeyPressed(MyKeys.PageUp) || MyInput.Static.IsNewKeyPressed(MyKeys.Down) || MyInput.Static.IsNewKeyPressed(MyKeys.Up) || MyInput.Static.IsNewKeyPressed(MyKeys.Left) || MyInput.Static.IsNewKeyPressed(MyKeys.Right) || MyInput.Static.IsNewKeyPressed(MyKeys.Add) || MyInput.Static.IsNewKeyPressed(MyKeys.Subtract) || MyInput.Static.DeltaMouseScrollWheelValue() != 0; } // Hoovered item changed if (HooveredItem != oldHooveredItem) { m_control.ShowToolTip(HooveredItem == null ? null : HooveredItem.ToolTip); MyGuiSoundManager.PlaySound(GuiSounds.MouseOver); } return(captured); }