timearea_dock.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * timearea_dock.h - time dock
  3. * Copyright (C) 2017 caryoscelus
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __STUDIO__TIMEAREA_DOCK_H__13AFC148
  19. #define __STUDIO__TIMEAREA_DOCK_H__13AFC148
  20. #include <core/std/memory.h>
  21. #include <core/context.h>
  22. #include <generic/context_listener.h>
  23. #include <generic/dock_registry.h>
  24. #include "close_destroy_dock.h"
  25. namespace Ui {
  26. class TimeareaDock;
  27. }
  28. namespace rainynite::studio {
  29. class NodeListModel;
  30. /**
  31. * Time area dock
  32. */
  33. class TimeareaDock : public DockWidget, public ContextListener {
  34. public:
  35. explicit TimeareaDock(shared_ptr<EditorContext> context_, QWidget* parent = nullptr);
  36. virtual ~TimeareaDock();
  37. public:
  38. bool eventFilter(QObject* object, QEvent* event) override;
  39. void contextMenuEvent(QContextMenuEvent* event) override;
  40. public:
  41. void set_context(shared_ptr<EditorContext> context) override;
  42. protected:
  43. void update_editors();
  44. void update_ruler();
  45. private:
  46. unique_ptr<Ui::TimeareaDock> ui;
  47. unique_ptr<NodeListModel> node_list_model;
  48. bool pinned = false;
  49. };
  50. REGISTER_DOCK("Timeline", TimeareaDock, Qt::BottomDockWidgetArea);
  51. }
  52. #endif