-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTreeNode.h
58 lines (44 loc) · 1.37 KB
/
TreeNode.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
50
51
52
53
54
55
56
57
58
#ifndef Tree_Node_H
#define Tree_Node_H
#include"Control.h"
class TreeNode : public Control
{
private:
vector<TreeNode*> childNode;
TreeNode* parent;
string name;
Text text;
Sprite icon;
bool isExpanded;
FloatRect globalBounds;
static Texture downArrow;
static Texture rightArrow;
static bool isTextureLoaded;
static const int nodeHeight = 25;
public:
TreeNode(const string & title, const string & address, const Texture & ico, const Font & f);
TreeNode(const TreeNode & ref);
~TreeNode();
TreeNode* getChildNode(int index) const;
TreeNode* getParent() const;
string getText() const;
string getName() const;
int getNoOfChilds() const;
int findNodeHeight() const;
bool isNodeExpanded() const;
void addNode(const TreeNode & node);
void removeAllNodes();
void setParent(TreeNode * ptr);
void setPosition(const Vector2f & pos);
void setIcon(const Sprite & ico);
void setText(const string & title);
void setName(const string & address);
void expandNode(bool val);
virtual FloatRect getGlobalBounds() const;
virtual Control * clone() const;
virtual Control * handleEvent(Event event, Vector2f mousePos);
TreeNode * onClick(Vector2f mouse);
virtual void draw(RenderTarget& target, RenderStates states) const;
static void loadTextures();
};
#endif // !Tree_Node_H