💿🐜 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.

85 lines
2.0 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_CONTROL_SET_HPP
  20. #define ANTKEEPER_INPUT_CONTROL_SET_HPP
  21. #include <list>
  22. namespace input {
  23. class control;
  24. /**
  25. * A set of controls which can be managed simultaneously.
  26. *
  27. * @ingroup input
  28. */
  29. class control_set
  30. {
  31. public:
  32. /**
  33. * Adds a control to the control set.
  34. *
  35. * @param control Pointer to the control to add.
  36. */
  37. void add_control(control* control);
  38. /**
  39. * Removes a control from the control set.
  40. *
  41. * @param control Pointer to the control to remove.
  42. */
  43. void remove_control(control* control);
  44. /**
  45. * Removes all controls from the control set.
  46. */
  47. void remove_controls();
  48. /**
  49. * Calls control::update() on each control in this control set.
  50. */
  51. void update();
  52. /**
  53. * Enables or disables callbacks for all controls in the control set.
  54. *
  55. * @param enabled Whether to enable or disable callbacks for all controls in the control set.
  56. */
  57. void set_callbacks_enabled(bool enabled);
  58. /**
  59. * Returns the list of controls in the control set.
  60. */
  61. const std::list<control*>* get_controls() const;
  62. private:
  63. std::list<control*> controls;
  64. };
  65. inline const std::list<control*>* control_set::get_controls() const
  66. {
  67. return &controls;
  68. }
  69. } // namespace input
  70. #endif // ANTKEEPER_INPUT_CONTROL_SET_HPP