14 layoutAboutToBeChanged().emit();
22 for (
auto node = scene->begin(); node != scene->end(); node++)
26 item->
ref = node.get();
31 layoutChanged().emit();
37 return Wt::WModelIndex();
44 return Wt::WModelIndex();
46 return createIndex(row, column, row);
67 if (role == Wt::ItemDataRole::Display || role == Wt::ItemDataRole::ToolTip)
69 if (
index.column() == 0)
71 return node->getName();
73 if (
index.column() == 1)
75 return node->getClassInfo()->getClassName();
78 else if (role == Wt::ItemDataRole::Decoration)
80 if (
index.column() == 0)
82 if (node->getName() ==
"cube")
84 return "icons/cube.png";
86 else if (node->getName() ==
"Mesh")
88 return "icons/mesh.png";
90 return std::string(
"icons/node.png");
94 return Wt::cpp17::any();
99 if (orientation == Wt::Orientation::Horizontal && role == Wt::ItemDataRole::Display) {
102 return std::string(
"Node");
104 return std::string(
"Type");
106 return Wt::cpp17::any();
110 return Wt::cpp17::any();
121 layoutAboutToBeChanged().emit();
122 layoutChanged().emit();
134 return mNode->getModuleList().size();
141 if (
mNode != 0 && index.isValid())
143 auto mod =
mNode->getModuleList();
144 auto iter = mod.begin();
145 std::advance(iter, index.row());
147 if (role == Wt::ItemDataRole::Display || role == Wt::ItemDataRole::ToolTip)
149 if (index.column() == 0)
151 return (*iter)->getName();
153 if (index.column() == 1)
155 return (*iter)->getModuleType();
158 else if (role == Wt::ItemDataRole::Decoration)
160 if (index.column() == 0)
162 return std::string(
"icons/module.png");
166 return Wt::cpp17::any();
172 if (orientation == Wt::Orientation::Horizontal && role == Wt::ItemDataRole::Display) {
175 return std::string(
"Module");
177 return std::string(
"Type");
179 return Wt::cpp17::any();
183 return Wt::cpp17::any();
188 if (
mNode != 0 && index.isValid())
190 auto mod =
mNode->getModuleList();
191 auto iter = mod.begin();
192 std::advance(iter, index.row());
195 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