mouse_capture_delegate.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2014 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_REMOTE_COCOA_APP_SHIM_MOUSE_CAPTURE_DELEGATE_H_
  5. #define COMPONENTS_REMOTE_COCOA_APP_SHIM_MOUSE_CAPTURE_DELEGATE_H_
  6. #if defined(__OBJC__)
  7. @class NSEvent;
  8. @class NSWindow;
  9. #else
  10. class NSEvent;
  11. class NSWindow;
  12. #endif
  13. namespace remote_cocoa {
  14. // Delegate for receiving captured events from a CocoaMouseCapture.
  15. class CocoaMouseCaptureDelegate {
  16. public:
  17. virtual ~CocoaMouseCaptureDelegate() = default;
  18. // Called when an event has been captured. This may be an event local to the
  19. // application, or a global event (sent to another application). If it is a
  20. // local event and this function returns true, the event will be swallowed
  21. // instead of propagated normally. The function return value is ignored for
  22. // global events.
  23. virtual bool PostCapturedEvent(NSEvent* event) = 0;
  24. // Called once. When another window acquires capture, or when the
  25. // CocoaMouseCapture is destroyed.
  26. virtual void OnMouseCaptureLost() = 0;
  27. // Returns the associated NSWindow.
  28. virtual NSWindow* GetWindow() const = 0;
  29. };
  30. } // namespace remote_cocoa
  31. #endif // COMPONENTS_REMOTE_COCOA_APP_SHIM_MOUSE_CAPTURE_DELEGATE_H_