1 #ifndef CNOID_BODY_PLUGIN_LINK_DEVICE_TREE_WIDGET_H
2 #define CNOID_BODY_PLUGIN_LINK_DEVICE_TREE_WIDGET_H
4 #include <cnoid/TreeWidget>
5 #include <cnoid/Signal>
7 #include <cnoid/Device>
9 #include "exportdecl.h"
13 class LinkDeviceTreeItem;
28 void setListingMode(
int mode);
29 int listingMode()
const;
30 void setLinkItemVisible(
bool on);
31 bool isLinkItemVisible()
const;
32 void setVisibleLinkPredicate(std::function<
bool(
Link* link)> pred);
33 void setJointItemVisible(
bool on);
34 bool isJointItemVisible()
const;
35 void setDeviceItemVisible(
bool on);
36 bool isDeviceItemVisible()
const;
38 void setNumberColumnMode(
int mode);
39 int numberColumnMode()
const;
40 void setDefaultExpansionLevel(
int level);
41 void setCacheEnabled(
bool on);
42 bool isCacheEnabled()
const;
44 int nameColumn()
const;
45 int numberColumn()
const;
46 int setNumColumns(
int n);
48 int addColumn(
const QString& headerText);
49 void setColumnStretchResizeMode(
int column);
50 void setColumnInteractiveResizeMode(
int column);
51 void setColumnResizeToContentsMode(
int column);
52 void setNameColumnMarginEnabled(
bool on);
53 void moveVisualColumnIndex(
int column,
int visualIndex);
63 void setAlignedItemWidget(
64 LinkDeviceTreeItem* item,
int column, QWidget* widget, Qt::Alignment alignment = Qt::AlignCenter);
67 void setBodyItem(
BodyItem* bodyItem,
bool forceTreeUpdate =
false);
69 void updateTreeItems();
71 SignalProxy<void(
bool isInitialCreation)> sigUpdateRequest();
73 int numLinkDeviceTreeItems();
78 const std::vector<bool>& linkSelection()
const;
79 const std::vector<int>& selectedLinkIndices()
const;
83 const std::vector<bool>& linkSelection(
BodyItem* bodyItem);
84 const std::vector<int>& selectedLinkIndices(
BodyItem* bodyItem);
87 void setLinkSelection(
BodyItem* bodyItem,
const std::vector<bool>& selection);
91 bool storeState(
Archive& archive);
94 bool restoreState(
const Archive& archive);
97 virtual void changeEvent(QEvent* event)
override;
109 LinkDeviceTreeItem(
const std::string& name, LinkDeviceTreeWidget::Impl* treeImpl =
nullptr);
111 const std::string&
name()
const {
return name_; }
112 const QString&
nameText()
const {
return nameText_; }
117 int numberColumnMode()
const;
119 virtual QVariant data(
int column,
int role)
const override;
120 virtual void setData(
int column,
int role,
const QVariant& value)
override;
128 LinkDeviceTreeWidget::Impl* treeImpl;
136 friend class LinkDeviceTreeWidget::Impl;