node_tree_dock.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * node_tree_dock.h - Dock with node tree
  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__NODE_TREE_DOCK_H__8AC1EE40
  19. #define __STUDIO__NODE_TREE_DOCK_H__8AC1EE40
  20. #include <QDockWidget>
  21. #include <generic/context_listener.h>
  22. namespace core {
  23. class AbstractValue;
  24. }
  25. namespace Ui {
  26. class NodeTreeDock;
  27. }
  28. namespace studio {
  29. class NodeModel;
  30. class NodeTreeDock : public QDockWidget, public ContextListener {
  31. Q_OBJECT
  32. public:
  33. explicit NodeTreeDock(std::shared_ptr<EditorContext> context_, QWidget* parent_);
  34. virtual ~NodeTreeDock();
  35. public:
  36. virtual void set_context(std::shared_ptr<EditorContext> context_) override;
  37. Q_SIGNALS:
  38. void activated(std::shared_ptr<core::AbstractValue> node);
  39. protected:
  40. void contextMenuEvent(QContextMenuEvent* event) override;
  41. private Q_SLOTS:
  42. void activate(QModelIndex const& index);
  43. private:
  44. std::unique_ptr<Ui::NodeTreeDock> ui;
  45. std::unique_ptr<NodeModel> model;
  46. };
  47. } // namespace studio
  48. #endif