timeline_editor.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* timeline_editor.h - timeline editing widgets
  2. * Copyright (C) 2017-2018 caryoscelus
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef STUDIO_GENERIC_TIMELINE_EDITOR_H_805B2CB8_423E_5B86_BC21_F2CA9ABFA520
  18. #define STUDIO_GENERIC_TIMELINE_EDITOR_H_805B2CB8_423E_5B86_BC21_F2CA9ABFA520
  19. #include <core/std/memory.h>
  20. #include <core/util/class_init.h>
  21. #include <canvas/abstract_editor.h>
  22. class QMenu;
  23. namespace rainynite::studio {
  24. /**
  25. * Timeline editor: specialization of AbstractCanvasEditor for timeline.
  26. */
  27. class TimelineEditor : public AbstractCanvasEditor {
  28. public:
  29. /// Set editor preferred vertical position and size
  30. virtual void set_position_hint(int y, int height) {
  31. editor_y = y;
  32. editor_height = height;
  33. }
  34. bool call_context_menu(double y, double seconds, QMenu& menu);
  35. /// Context menu
  36. virtual bool context_menu(double /*seconds*/, QMenu& /*menu*/) {
  37. return false;
  38. }
  39. protected:
  40. int editor_y = 0;
  41. int editor_height = 0;
  42. };
  43. } // namespace rainynite::studio
  44. #endif