1 #ifndef CNOID_MANIPULATOR_PLUGIN_MPR_PROGRAM_VIEW_BASE_H
2 #define CNOID_MANIPULATOR_PLUGIN_MPR_PROGRAM_VIEW_BASE_H
6 #include <cnoid/Signal>
7 #include <cnoid/Referenced>
9 #include "exportdecl.h"
14 class MprProgramItemBase;
16 class MprPositionStatement;
26 virtual void onActivated()
override;
27 virtual void onDeactivated()
override;
30 bool checkCurrentProgramItem()
const;
35 const std::vector<MprStatementPtr>& selectedStatements();
36 SignalProxy<void(std::vector<MprStatementPtr>& statements)> sigSelectedStatementsChanged();
38 void updateStatementTree();
45 static constexpr
int SpanToLast = -1;
46 virtual void activateStatement(
MprStatement* statement)
const;
47 virtual int labelSpan(
MprStatement* statement,
int column)
const;
48 virtual QVariant dataOfEditRole(
MprStatement* statement,
int column)
const;
49 virtual void setDataOfEditRole(
MprStatement* statement,
int column,
const QVariant& value)
const;
50 virtual QWidget* createEditor(
MprStatement* statement,
int column, QWidget* parent)
const;
51 virtual void setEditorData(
MprStatement* statement,
int column, QWidget* editor)
const;
52 virtual void setStatementData(
MprStatement* statement,
int column, QWidget* editor)
const;
59 QWidget* createDefaultEditor()
const;
62 template<
class StatementType>
64 registerStatementDelegate(
typeid(StatementType), delegate);
67 template<
class StatementType>
69 std::function<
void(StatementType* statement,
MenuManager& menuManager,
71 customizeContextMenu_(
72 typeid(StatementType),
75 func(
static_cast<StatementType*
>(statement), menuManager, menuFunction);
79 enum BodySyncMode { NoBodySync, DirectBodySync, TwoStageBodySync };
80 void setBodySyncMode(BodySyncMode mode);
81 BodySyncMode bodySyncMode()
const;
86 void addEditButton(
ToolButton* button,
int row);
90 MprStatement* statement,
int insertionType = AfterTargetPosition);
93 virtual void onCurrentStatementChanged(
MprStatement* statement);
95 virtual void onStatementActivated(
MprStatement* statement);
96 virtual void onStatementDoubleClicked(
MprStatement* statement);
98 virtual void onAttachedMenuRequest(
MenuManager& menuManager)
override;
99 virtual bool storeState(
Archive& archive)
override;
100 virtual bool restoreState(
const Archive& archive)
override;
103 void registerStatementDelegate(std::type_index statementType, StatementDelegate* delegate);
104 void registerBaseStatementDelegates();
106 void customizeContextMenu_(
107 const std::type_info& type,