Team Fortress 2 Source Code as on 22/4/2020
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.

86 lines
2.8 KiB

  1. //========= Copyright 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. // Creates/ destroys "input" contexts, which contains information
  42. // about which controls have mouse + key focus, for example.
  43. virtual HInputContext CreateInputContext() = 0;
  44. virtual void DestroyInputContext( HInputContext context ) = 0;
  45. // Associates a particular panel with an input context
  46. // Associating NULL is valid; it disconnects the panel from the context
  47. virtual void AssociatePanelWithInputContext( HInputContext context, VPANEL pRoot ) = 0;
  48. // Activates a particular input context, use DEFAULT_INPUT_CONTEXT
  49. // to get the one normally used by VGUI
  50. virtual void ActivateInputContext( HInputContext context ) = 0;
  51. // This method is called to post a cursor message to the current input context
  52. virtual void PostCursorMessage() = 0;
  53. // Cursor position; this is the current position read from the input queue.
  54. // We need to set it because client code may read this during Mouse Pressed
  55. // events, etc.
  56. virtual void UpdateCursorPosInternal( int x, int y ) = 0;
  57. // Called to handle explicit calls to CursorSetPos after input processing is complete
  58. virtual void HandleExplicitSetCursor( ) = 0;
  59. // Updates the internal key/mouse state associated with the current input context without sending messages
  60. virtual void SetKeyCodeState( KeyCode code, bool bPressed ) = 0;
  61. virtual void SetMouseCodeState( MouseCode code, MouseCodeState_t state ) = 0;
  62. virtual void UpdateButtonState( const InputEvent_t &event ) = 0;
  63. };
  64. } // namespace vgui
  65. #define VGUI_INPUTINTERNAL_INTERFACE_VERSION "VGUI_InputInternal001"
  66. #endif // IINPUTINTERNAL_H