summaryrefslogtreecommitdiffstats
path: root/gui/pages.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/pages.cpp')
-rw-r--r--gui/pages.cpp39
1 files changed, 32 insertions, 7 deletions
diff --git a/gui/pages.cpp b/gui/pages.cpp
index dc9edc798..2953eddb8 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -193,6 +193,12 @@ Page::Page(xml_node<>* page, xml_node<>* templates /* = NULL */)
return;
}
+Page::~Page()
+{
+ for (std::vector<GUIObject*>::iterator itr = mObjects.begin(); itr != mObjects.end(); ++itr)
+ delete *itr;
+}
+
bool Page::ProcessNode(xml_node<>* page, xml_node<>* templates /* = NULL */, int depth /* = 0 */)
{
if (depth == 10)
@@ -225,86 +231,101 @@ bool Page::ProcessNode(xml_node<>* page, xml_node<>* templates /* = NULL */, int
if (type == "text")
{
GUIText* element = new GUIText(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
mActions.push_back(element);
}
else if (type == "image")
{
GUIImage* element = new GUIImage(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
}
else if (type == "fill")
{
GUIFill* element = new GUIFill(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
}
else if (type == "action")
{
GUIAction* element = new GUIAction(child);
+ mObjects.push_back(element);
mActions.push_back(element);
}
else if (type == "console")
{
GUIConsole* element = new GUIConsole(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
mActions.push_back(element);
}
else if (type == "button")
{
GUIButton* element = new GUIButton(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
mActions.push_back(element);
}
else if (type == "checkbox")
{
GUICheckbox* element = new GUICheckbox(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
mActions.push_back(element);
}
else if (type == "fileselector")
{
GUIFileSelector* element = new GUIFileSelector(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
mActions.push_back(element);
}
else if (type == "animation")
{
GUIAnimation* element = new GUIAnimation(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
}
else if (type == "progressbar")
{
GUIProgressBar* element = new GUIProgressBar(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
mActions.push_back(element);
}
else if (type == "slider")
{
GUISlider* element = new GUISlider(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
mActions.push_back(element);
}
else if (type == "slidervalue")
{
GUISliderValue *element = new GUISliderValue(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
mActions.push_back(element);
}
else if (type == "listbox")
{
GUIListBox* element = new GUIListBox(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
mActions.push_back(element);
}
else if (type == "keyboard")
{
GUIKeyboard* element = new GUIKeyboard(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
mActions.push_back(element);
}
else if (type == "input")
{
GUIInput* element = new GUIInput(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
mActions.push_back(element);
mInputs.push_back(element);
@@ -312,6 +333,7 @@ bool Page::ProcessNode(xml_node<>* page, xml_node<>* templates /* = NULL */, int
else if (type == "partitionlist")
{
GUIPartitionList* element = new GUIPartitionList(child);
+ mObjects.push_back(element);
mRenders.push_back(element);
mActions.push_back(element);
}
@@ -497,13 +519,8 @@ void Page::SetPageFocus(int inFocus)
int Page::NotifyVarChange(std::string varName, std::string value)
{
- std::vector<ActionObject*>::iterator iter;
-
- // Don't try to handle a lack of handlers
- if (mActions.size() == 0)
- return 1;
-
- for (iter = mActions.begin(); iter != mActions.end(); ++iter)
+ std::vector<GUIObject*>::iterator iter;
+ for (iter = mObjects.begin(); iter != mObjects.end(); ++iter)
{
if ((*iter)->NotifyVarChange(varName, value))
LOGERR("An action handler errored on NotifyVarChange.\n");
@@ -526,6 +543,9 @@ PageSet::PageSet(char* xmlFile)
PageSet::~PageSet()
{
+ for (std::vector<Page*>::iterator itr = mPages.begin(); itr != mPages.end(); ++itr)
+ delete *itr;
+
delete mResources;
free(mXmlFile);
}
@@ -840,7 +860,10 @@ PageSet* PageManager::SelectPackage(std::string name)
tmp = FindPackage(name);
if (tmp)
+ {
mCurrentSet = tmp;
+ mCurrentSet->NotifyVarChange("", "");
+ }
else
LOGERR("Unable to find package.\n");
@@ -869,6 +892,8 @@ int PageManager::ReloadPackage(std::string name, std::string package)
}
if (mCurrentSet == set)
SelectPackage(name);
+ if (mBaseSet == set)
+ mBaseSet = mCurrentSet;
delete set;
return 0;
}