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.

76 lines
3.2 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: This is input priority system, allowing various clients to
  4. // cause input messages / cursor control to be routed to them as opposed to
  5. // other clients.
  6. //
  7. //===========================================================================//
  8. #ifndef IINPUTCLIENTSTACK_H
  9. #define IINPUTCLIENTSTACK_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "appframework/iappsystem.h"
  14. #include "inputsystem/iinputsystem.h"
  15. ///-----------------------------------------------------------------------------
  16. /// A handle to an input context. These are arranged in a priority-based
  17. /// stack; the top context on the stack which is also enabled wins.
  18. ///-----------------------------------------------------------------------------
  19. DECLARE_POINTER_HANDLE( InputContextHandle_t );
  20. #define INPUT_CONTEXT_HANDLE_INVALID ( (InputContextHandle_t)0 )
  21. ///-----------------------------------------------------------------------------
  22. /// Purpose: This is input priority system, allowing various clients to
  23. /// cause input messages / cursor control to be routed to them as opposed to
  24. /// other clients.
  25. ///
  26. /// NOTE: For Source1, it would be a huge change to move all input (like
  27. /// the code in engine/keys.cpp for example) to go through this interface.
  28. /// Therefore, I'm going to stick with only dealing with cursor control,
  29. /// which is necessary for Jen's new gameUI system to interoperate with VGui.
  30. ///-----------------------------------------------------------------------------
  31. abstract_class IInputStackSystem : public IAppSystem
  32. {
  33. public:
  34. /// Allocates an input context, pushing it on top of the input stack,
  35. /// thereby giving it top priority
  36. virtual InputContextHandle_t PushInputContext() = 0;
  37. /// Pops the top input context off the input stack, and destroys it.
  38. virtual void PopInputContext( ) = 0;
  39. /// Enables/disables an input context, allowing something lower on the
  40. /// stack to have control of input. Disabling an input context which
  41. /// owns mouse capture
  42. virtual void EnableInputContext( InputContextHandle_t hContext, bool bEnable ) = 0;
  43. /// Allows a context to make the cursor visible;
  44. /// the topmost enabled context wins
  45. virtual void SetCursorVisible( InputContextHandle_t hContext, bool bVisible ) = 0;
  46. /// Allows a context to set the cursor icon;
  47. /// the topmost enabled context wins
  48. virtual void SetCursorIcon( InputContextHandle_t hContext, InputCursorHandle_t hCursor ) = 0;
  49. /// Allows a context to enable mouse capture. Disabling an input context
  50. /// deactivates mouse capture. Capture will occur if it happens on the
  51. /// topmost enabled context
  52. virtual void SetMouseCapture( InputContextHandle_t hContext, bool bEnable ) = 0;
  53. /// Allows a context to set the mouse position. It only has any effect if the
  54. /// specified context is the topmost enabled context
  55. virtual void SetCursorPosition( InputContextHandle_t hContext, int x, int y ) = 0;
  56. /// Returns true if the specified context is the topmost enabled context
  57. virtual bool IsTopmostEnabledContext( InputContextHandle_t hContext ) const = 0;
  58. };
  59. DECLARE_TIER2_INTERFACE( IInputStackSystem, g_pInputStackSystem );
  60. #endif // IINPUTCLIENTSTACK_H