13 layoutAboutToBeChanged().emit();
21 for (
auto node = scene->begin(); node != scene->end(); node++)
25 item->
ref = node.get();
30 layoutChanged().emit();
36 return Wt::WModelIndex();
43 return Wt::WModelIndex();
45 return createIndex(row, column, row);
66 if (role == Wt::ItemDataRole::Display || role == Wt::ItemDataRole::ToolTip)
68 if (
index.column() == 0)
70 return node->getName();
72 if (
index.column() == 1)
74 return node->getClassInfo()->getClassName();
77 else if (role == Wt::ItemDataRole::Decoration)
79 if (
index.column() == 0)
81 if (node->getName() ==
"cube")
83 return "icons/cube.png";
85 else if (node->getName() ==
"Mesh")
87 return "icons/mesh.png";
89 return std::string(
"icons/node.png");
93 return Wt::cpp17::any();
98 if (orientation == Wt::Orientation::Horizontal && role == Wt::ItemDataRole::Display) {
101 return std::string(
"Node");
103 return std::string(
"Type");
105 return Wt::cpp17::any();
109 return Wt::cpp17::any();
120 layoutAboutToBeChanged().emit();
121 layoutChanged().emit();
133 return mNode->getModuleList().size();
140 if (
mNode != 0 && index.isValid())
142 auto mod =
mNode->getModuleList();
143 auto iter = mod.begin();
144 std::advance(iter, index.row());
146 if (role == Wt::ItemDataRole::Display || role == Wt::ItemDataRole::ToolTip)
148 if (index.column() == 0)
150 return (*iter)->getName();
152 if (index.column() == 1)
154 return (*iter)->getModuleType();
157 else if (role == Wt::ItemDataRole::Decoration)
159 if (index.column() == 0)
161 return std::string(
"icons/module.png");
165 return Wt::cpp17::any();
171 if (orientation == Wt::Orientation::Horizontal && role == Wt::ItemDataRole::Display) {
174 return std::string(
"Module");
176 return std::string(
"Type");
178 return Wt::cpp17::any();
182 return Wt::cpp17::any();
187 if (
mNode != 0 && index.isValid())
189 auto mod =
mNode->getModuleList();
190 auto iter = mod.begin();
191 std::advance(iter, index.row());
194 return std::shared_ptr<dyno::Module>();
void setNode(std::shared_ptr< dyno::Node > node)
virtual Wt::cpp17::any headerData(int section, Wt::Orientation orientation=Wt::Orientation::Horizontal, Wt::ItemDataRole role=Wt::ItemDataRole::Display) const
virtual int columnCount(const Wt::WModelIndex &parent=Wt::WModelIndex()) const
std::shared_ptr< dyno::Module > getModule(const Wt::WModelIndex &index)
std::shared_ptr< dyno::Node > mNode
virtual int rowCount(const Wt::WModelIndex &parent=Wt::WModelIndex()) const
virtual Wt::cpp17::any data(const Wt::WModelIndex &index, Wt::ItemDataRole role=Wt::ItemDataRole::Display) const
void setScene(std::shared_ptr< dyno::SceneGraph > scene)
virtual Wt::WModelIndex index(int row, int column, const Wt::WModelIndex &parent=Wt::WModelIndex()) const
std::vector< NodeItem * > mNodeList
std::shared_ptr< dyno::SceneGraph > mScene
virtual int rowCount(const Wt::WModelIndex &parent=Wt::WModelIndex()) const
virtual int columnCount(const Wt::WModelIndex &parent=Wt::WModelIndex()) const
virtual Wt::WModelIndex parent(const Wt::WModelIndex &index) const
virtual Wt::cpp17::any headerData(int section, Wt::Orientation orientation=Wt::Orientation::Horizontal, Wt::ItemDataRole role=Wt::ItemDataRole::Display) const
std::shared_ptr< dyno::Node > getNode(const Wt::WModelIndex &index)
virtual Wt::cpp17::any data(const Wt::WModelIndex &index, Wt::ItemDataRole role=Wt::ItemDataRole::Display) const
std::shared_ptr< dyno::Node > ref