PeriDyno 1.2.1
Loading...
Searching...
No Matches
WParameterDataNode.h
Go to the documentation of this file.
1#pragma once
2
3#include <Wt/WAbstractItemModel.h>
4#include <Wt/WAbstractTableModel.h>
5#include <Wt/WText.h>
6#include <Wt/WPanel.h>
7#include <Wt/WTable.h>
8#include <Wt/WDoubleSpinBox.h>
9#include <Wt/WLogger.h>
10
11#include <FBase.h>
12#include "Field/FilePath.h"
13
24
25namespace dyno
26{
27 class Node;
28 class Module;
29 class SceneGraph;
30 class FBase;
31};
32
33class WParameterDataNode : public Wt::WAbstractTableModel
34{
35public:
36
39
40 void setNode(std::shared_ptr<dyno::Node> node);
41 void setModule(std::shared_ptr<dyno::Module> module);
42
43 virtual int columnCount(const Wt::WModelIndex& parent = Wt::WModelIndex()) const;
44 virtual int rowCount(const Wt::WModelIndex& parent = Wt::WModelIndex()) const;
45 //virtual int rowCountModule(const Wt::WModelIndex& parent = Wt::WModelIndex()) const;
46
47 virtual Wt::cpp17::any data(const Wt::WModelIndex& index,
48 Wt::ItemDataRole role = Wt::ItemDataRole::Display) const;
49
50 virtual Wt::cpp17::any headerData(int section,
51 Wt::Orientation orientation = Wt::Orientation::Horizontal,
52 Wt::ItemDataRole role = Wt::ItemDataRole::Display) const;
53
54 void createParameterPanel(Wt::WContainerWidget* parameterWidget);
55 void createParameterPanelModule(Wt::WPanel* panel);
56
57 void updateNode();
59
60 Wt::Signal<int>& changeValue()
61 {
62 return changeValue_;
63 }
64
65 void emit();
66
67public:
69 using constructor_t = Wt::WContainerWidget* (*)(dyno::FBase*);
70 const std::type_info* type;
72 };
73
74 static int registerWidget(const FieldWidgetMeta& meta);
75
76 static FieldWidgetMeta* getRegistedWidget(const std::string&);
77
78 Wt::WContainerWidget* createFieldWidget(dyno::FBase* field);
79
80private:
81
82 std::shared_ptr<dyno::Node> mNode;
83 std::shared_ptr<dyno::Module> mModule;
84 Wt::Signal<int> changeValue_;
85
86 void castToDerived(Wt::WContainerWidget* fw);
87
88 void addScalarFieldWidget(Wt::WTable* table, std::string label, dyno::FBase* field, int labelWidth = 150, int widgetWidth = 300);
89
90 void addStateFieldWidget(Wt::WTable* table, dyno::FBase* field);
91
92 static std::map<std::string, FieldWidgetMeta> sFieldWidgetMeta;
93};
Definition FBase.h:44
Definition Node.h:68
std::shared_ptr< dyno::Node > mNode
static FieldWidgetMeta * getRegistedWidget(const std::string &)
static std::map< std::string, FieldWidgetMeta > sFieldWidgetMeta
void addScalarFieldWidget(Wt::WTable *table, std::string label, dyno::FBase *field, int labelWidth=150, int widgetWidth=300)
static int registerWidget(const FieldWidgetMeta &meta)
virtual int rowCount(const Wt::WModelIndex &parent=Wt::WModelIndex()) const
std::shared_ptr< dyno::Module > mModule
void setModule(std::shared_ptr< dyno::Module > module)
void setNode(std::shared_ptr< dyno::Node > node)
Wt::Signal< int > & changeValue()
void createParameterPanel(Wt::WContainerWidget *parameterWidget)
Wt::Signal< int > changeValue_
void createParameterPanelModule(Wt::WPanel *panel)
void addStateFieldWidget(Wt::WTable *table, dyno::FBase *field)
void castToDerived(Wt::WContainerWidget *fw)
virtual Wt::cpp17::any data(const Wt::WModelIndex &index, Wt::ItemDataRole role=Wt::ItemDataRole::Display) const
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
Wt::WContainerWidget * createFieldWidget(dyno::FBase *field)
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
Wt::WContainerWidget *(*)(dyno::FBase *) constructor_t