MouseTracker.h 677 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2021, Ben Wiederhake <BenWiederhake.GitHub@gmx.de>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Badge.h>
  8. #include <AK/Function.h>
  9. #include <AK/IntrusiveList.h>
  10. #include <LibGUI/Forward.h>
  11. #include <LibGfx/Point.h>
  12. namespace GUI {
  13. class MouseTracker {
  14. public:
  15. MouseTracker();
  16. virtual ~MouseTracker();
  17. static void track_mouse_move(Badge<ConnectionToWindowServer>, Gfx::IntPoint const&);
  18. protected:
  19. virtual void track_mouse_move(Gfx::IntPoint const&) = 0;
  20. private:
  21. IntrusiveListNode<MouseTracker> m_list_node;
  22. using List = IntrusiveList<&MouseTracker::m_list_node>;
  23. static List s_trackers;
  24. };
  25. }