💿🐜 Antkeeper source code https://antkeeper.com
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.

57 lines
1.5 KiB

  1. /*
  2. * Copyright (C) 2021 Christopher J. Howard
  3. *
  4. * This file is part of Antkeeper source code.
  5. *
  6. * Antkeeper source code is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Antkeeper source code is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef ANTKEEPER_INPUT_DEVICE_HPP
  20. #define ANTKEEPER_INPUT_DEVICE_HPP
  21. #include "event/event-dispatcher.hpp"
  22. namespace input {
  23. /**
  24. * Base class for virtual devices which generate input events.
  25. */
  26. class device
  27. {
  28. public:
  29. device();
  30. virtual ~device() = default;
  31. void set_event_dispatcher(event_dispatcher* event_dispatcher);
  32. const event_dispatcher* get_event_dispatcher() const;
  33. event_dispatcher* get_event_dispatcher();
  34. protected:
  35. event_dispatcher* event_dispatcher;
  36. };
  37. inline const event_dispatcher* device::get_event_dispatcher() const
  38. {
  39. return event_dispatcher;
  40. }
  41. inline event_dispatcher* device::get_event_dispatcher()
  42. {
  43. return event_dispatcher;
  44. }
  45. } // namespace input
  46. #endif // ANTKEEPER_INPUT_DEVICE_HPP