pointer_stylus_delegate.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_EXO_POINTER_STYLUS_DELEGATE_H_
  5. #define COMPONENTS_EXO_POINTER_STYLUS_DELEGATE_H_
  6. #include "base/time/time.h"
  7. #include "ui/events/event_constants.h"
  8. namespace gfx {
  9. class Vector2dF;
  10. }
  11. namespace exo {
  12. class Pointer;
  13. // Handles tool-specific event details on pointers. Used as an extension to the
  14. // PointerDelegate.
  15. class PointerStylusDelegate {
  16. public:
  17. // Called at the top of the pointer's destructor, to give observers a
  18. // chance to remove themselves.
  19. virtual void OnPointerDestroying(Pointer* pointer) = 0;
  20. // Called when the type of pointer device changes.
  21. virtual void OnPointerToolChange(ui::EventPointerType type) = 0;
  22. // Called when the force (pressure) of the pointer changes.
  23. // Normalized to be [0, 1]. NaN means pressure is not supported by the
  24. // input device.
  25. virtual void OnPointerForce(base::TimeTicks time_stamp, float force) = 0;
  26. // Called when the tilt of a pen/stylus changes. Measured from surface normal
  27. // as plane angle in degrees, values lie in [-90,90]. A positive x is to the
  28. // right and a positive y is towards the user. Always 0 if the device does
  29. // not support it.
  30. virtual void OnPointerTilt(base::TimeTicks time_stamp,
  31. const gfx::Vector2dF& tilt) = 0;
  32. protected:
  33. virtual ~PointerStylusDelegate() {}
  34. };
  35. } // namespace exo
  36. #endif // COMPONENTS_EXO_POINTER_STYLUS_DELEGATE_H_