-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui_manager.cpp
More file actions
59 lines (48 loc) · 946 Bytes
/
ui_manager.cpp
File metadata and controls
59 lines (48 loc) · 946 Bytes
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
59
#include "ui_manager.h"
UIManager::UIManager(){
_parser = new Parser();
_factory = new ElementFactory();
}
UIManager::~UIManager(){
_parser->close();
delete _factory;
delete _parser;
}
void UIManager::open(char* filename){
_parser->open(filename);
}
Element* UIManager::layout(xmlNodePtr node){
Element* element= NULL;
if (NULL == node){
return NULL;
}
element = _factory->create(node);
if (NULL == element){
return NULL;
}
element->addChild(layout(node->xmlChildrenNode));
element->addNeighbor(layout(node->next));
return element;
}
void UIManager::layout(){
xmlNodePtr root, node;
root = _parser->root();
if (NULL == root){
return;
}
_root = layout(root);
}
void UIManager::freeLayout(Element* element){
if (NULL == element){
return;
}
freeLayout(element->child());
freeLayout(element->next());
delete element;
}
void UIManager::cleanLayout(){
if (NULL == _root){
return;
}
freeLayout(_root);
}