Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.1 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef FOCUSNAVGROUP_H
  8. #define FOCUSNAVGROUP_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui/vgui.h>
  13. #include <vgui_controls/PHandle.h>
  14. namespace vgui
  15. {
  16. class Panel;
  17. //-----------------------------------------------------------------------------
  18. // Purpose: Handles navigation through a set of panels, with tab order & hotkeys
  19. //-----------------------------------------------------------------------------
  20. class FocusNavGroup
  21. {
  22. public:
  23. FocusNavGroup(Panel *panel);
  24. ~FocusNavGroup();
  25. virtual Panel *GetDefaultPanel(); // returns a pointer to the panel with the default focus
  26. virtual void SetDefaultButton(Panel *panel); // sets which panel should receive input when ENTER is hit
  27. virtual VPANEL GetDefaultButton(); // panel which receives default input when ENTER is hit, if current focused item cannot accept ENTER
  28. virtual VPANEL GetCurrentDefaultButton(); // panel which receives input when ENTER is hit
  29. virtual Panel *FindPanelByHotkey(wchar_t key); // finds the panel which is activated by the specified key
  30. virtual bool RequestFocusPrev(VPANEL panel = NULL); // if panel is NULL, then the tab increment is based last known panel that had key focus
  31. virtual bool RequestFocusNext(VPANEL panel = NULL);
  32. virtual Panel *GetCurrentFocus();
  33. virtual VPANEL SetCurrentFocus(VPANEL panel, VPANEL defaultPanel); // returns the Default panel
  34. // sets the panel that owns this FocusNavGroup to be the root in the focus traversal heirarchy
  35. // focus change via KEY_TAB will only travel to children of this main panel
  36. virtual void SetFocusTopLevel(bool state);
  37. virtual void SetCurrentDefaultButton(VPANEL panel, bool sendCurrentDefaultButtonMessage = true);
  38. private:
  39. bool CanButtonBeDefault(VPANEL panel);
  40. VPanelHandle _defaultButton;
  41. VPanelHandle _currentDefaultButton;
  42. VPanelHandle _currentFocus;
  43. Panel *_mainPanel;
  44. bool _topLevelFocus;
  45. };
  46. } // namespace vgui
  47. #endif // FOCUSNAVGROUP_H