Debian Codegraph @

include/iselectable.h

raw
1 #pragma once
2
3 #include <memory>
4 #include "inode.h"
5
6 /**
7 * greebo: A Selectable is everything that can be highlighted
8 * by the user in the scene (e.g. by interaction with the mouse).
9 */
10 class ISelectable
11 {
12 public:
13 virtual ~ISelectable() {}
14
15 // Set the selection status of this object
16 virtual void setSelected(bool select) = 0;
17
18 // Check the selection status of this object (TRUE == selected)
19 virtual bool isSelected() const = 0;
20 };
21 typedef std::shared_ptr<ISelectable> ISelectablePtr;
22
23 namespace scene
24 {
25 class INode;
26 typedef std::shared_ptr<INode> INodePtr;
27 }
28
29 inline void Node_setSelected(const scene::INodePtr& node, bool selected)
30 {
31 auto selectable = scene::node_cast<ISelectable>(node);
32
33 if (selectable)
34 {
35 selectable->setSelected(selected);
36 }
37 }
38
39 inline bool Node_isSelected(const scene::INodePtr& node)
40 {
41 auto selectable = scene::node_cast<ISelectable>(node);
42
43 if (selectable)
44 {
45 return selectable->isSelected();
46 }
47
48 return false;
49 }