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