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.

112 lines
4.1 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #ifndef IINPUTINTERNAL_H
  8. #define IINPUTINTERNAL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui/IInput.h>
  13. namespace vgui
  14. {
  15. enum MouseCodeState_t
  16. {
  17. BUTTON_RELEASED = 0,
  18. BUTTON_PRESSED,
  19. BUTTON_DOUBLECLICKED,
  20. };
  21. typedef int HInputContext;
  22. #define DEFAULT_INPUT_CONTEXT ((vgui::HInputContext)~0)
  23. class IInputInternal : public IInput
  24. {
  25. public:
  26. // processes input for a frame
  27. virtual void RunFrame() = 0;
  28. virtual void UpdateMouseFocus(int x, int y) = 0;
  29. // called when a panel becomes invalid
  30. virtual void PanelDeleted(VPANEL panel) = 0;
  31. // inputs into vgui input handling
  32. virtual bool InternalCursorMoved(int x,int y) = 0; //expects input in surface space
  33. virtual bool InternalMousePressed(MouseCode code) = 0;
  34. virtual bool InternalMouseDoublePressed(MouseCode code) = 0;
  35. virtual bool InternalMouseReleased(MouseCode code) = 0;
  36. virtual bool InternalMouseWheeled(int delta) = 0;
  37. virtual bool InternalKeyCodePressed(KeyCode code) = 0;
  38. virtual void InternalKeyCodeTyped(KeyCode code) = 0;
  39. virtual void InternalKeyTyped(wchar_t unichar) = 0;
  40. virtual bool InternalKeyCodeReleased(KeyCode code) = 0;
  41. //=============================================================================
  42. // HPE_BEGIN
  43. // [dwenger] Handle gamepad joystick movement.
  44. //=============================================================================
  45. virtual bool InternalJoystickMoved(int axis, int value) = 0;
  46. //=============================================================================
  47. // HPE_END
  48. //=============================================================================
  49. // Creates/ destroys "input" contexts, which contains information
  50. // about which controls have mouse + key focus, for example.
  51. virtual HInputContext CreateInputContext() = 0;
  52. virtual void DestroyInputContext( HInputContext context ) = 0;
  53. // Associates a particular panel with an input context
  54. // Associating NULL is valid; it disconnects the panel from the context
  55. virtual void AssociatePanelWithInputContext( HInputContext context, VPANEL pRoot ) = 0;
  56. // Activates a particular input context, use DEFAULT_INPUT_CONTEXT
  57. // to get the one normally used by VGUI
  58. virtual void ActivateInputContext( HInputContext context ) = 0;
  59. // This method is called to post a cursor message to the current input context
  60. virtual void PostCursorMessage() = 0;
  61. // Cursor position; this is the current position read from the input queue.
  62. // We need to set it because client code may read this during Mouse Pressed
  63. // events, etc.
  64. virtual void UpdateCursorPosInternal( int x, int y ) = 0;
  65. //=============================================================================
  66. // HPE_BEGIN
  67. // [dwenger] Handle gamepad joystick movement.
  68. //=============================================================================
  69. virtual void UpdateJoystickXPosInternal( int pos ) = 0;
  70. virtual void UpdateJoystickYPosInternal( int pos ) = 0;
  71. virtual int GetJoystickXPos( ) = 0;
  72. virtual int GetJoystickYPos( ) = 0;
  73. //=============================================================================
  74. // HPE_END
  75. //=============================================================================
  76. // Called to handle explicit calls to CursorSetPos after input processing is complete
  77. virtual void HandleExplicitSetCursor( ) = 0;
  78. // Resets a particular input context, use DEFAULT_INPUT_CONTEXT
  79. // to get the one normally used by VGUI
  80. virtual void ResetInputContext( HInputContext context ) = 0;
  81. // Updates the internal key/mouse state associated with the current input context without sending messages
  82. virtual void SetKeyCodeState( KeyCode code, bool bPressed ) = 0;
  83. virtual void SetMouseCodeState( MouseCode code, MouseCodeState_t state ) = 0;
  84. virtual void UpdateButtonState( const InputEvent_t &event ) = 0;
  85. };
  86. } // namespace vgui
  87. #define VGUI_INPUTINTERNAL_INTERFACE_VERSION "VGUI_InputInternal001"
  88. #endif // IINPUTINTERNAL_H